LDMX Software
hcal::HcalClusterProducer Class Reference

Make clusters from hits in the HCAL. More...

#include <HcalClusterProducer.h>

Public Member Functions

 HcalClusterProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
void produce (framework::Event &event) override
 Process the event and put new data products into it.
 
- Public Member Functions inherited from framework::Producer
 Producer (const std::string &name, Process &process)
 Class constructor.
 
virtual void process (Event &event) final
 Processing an event for a Producer is calling produce.
 
- Public Member Functions inherited from framework::EventProcessor
 DECLARE_FACTORY (EventProcessor, EventProcessor *, const std::string &, Process &)
 declare that we have a factory for this class
 
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()=default
 Class destructor.
 
virtual void beforeNewRun (ldmx::RunHeader &run_header)
 Callback for Producers to add parameters to the run header before conditions are initialized.
 
virtual void onNewRun (const ldmx::RunHeader &run_header)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &event_file)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessStart ()
 Callback for the EventProcessor to take any necessary action when the processing of events starts, such as creating histograms.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module_.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Private Attributes

double enoise_cut_ {0.}
 
double delta_time_ {0}
 
double delta_r_ {0}
 
double emin_cluster_ {0.}
 
double cut_off_ {0.}
 
std::string cluster_coll_name_
 
std::string hcal_hits_pass_name_
 

Additional Inherited Members

- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramPool histograms_
 helper object for making and filling histograms
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger the_log_
 The logger for this EventProcessor.
 

Detailed Description

Make clusters from hits in the HCAL.

Definition at line 34 of file HcalClusterProducer.h.

Constructor & Destructor Documentation

◆ HcalClusterProducer()

hcal::HcalClusterProducer::HcalClusterProducer ( const std::string & name,
framework::Process & process )

Definition at line 15 of file HcalClusterProducer.cxx.

17 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.
virtual void process(Event &event) final
Processing an event for a Producer is calling produce.

◆ ~HcalClusterProducer()

virtual hcal::HcalClusterProducer::~HcalClusterProducer ( )
inlinevirtual

Definition at line 38 of file HcalClusterProducer.h.

38{ ; }

Member Function Documentation

◆ configure()

void hcal::HcalClusterProducer::configure ( framework::config::Parameters & parameters)
overridevirtual

Configure the processor using the given user specified parameters.

Parameters
parametersSet of parameters used to configure this processor.

Reimplemented from framework::EventProcessor.

Definition at line 19 of file HcalClusterProducer.cxx.

19 {
20 enoise_cut_ = parameters.get<double>("EnoiseCut");
21 delta_time_ = parameters.get<double>("deltaTime");
22 delta_r_ = parameters.get<double>("deltaR");
23 emin_cluster_ = parameters.get<double>("EminCluster");
24 cut_off_ = parameters.get<double>("cutOff");
25
26 cluster_coll_name_ = parameters.get<std::string>("clusterCollName");
27 hcal_hits_pass_name_ = parameters.get<std::string>("hcal_hits_pass_name");
28}
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:78

References framework::config::Parameters::get().

◆ produce()

void hcal::HcalClusterProducer::produce ( framework::Event & event)
overridevirtual

Process the event and put new data products into it.

Parameters
eventThe Event to process.

Implements framework::Producer.

Definition at line 34 of file HcalClusterProducer.cxx.

34 {
37
38 TemplatedClusterFinder<MyClusterWeight> finder;
39
40 std::vector<ldmx::HcalCluster> hcal_clusters;
41 std::list<const ldmx::HcalHit*> seed_list;
42 std::vector<ldmx::HcalHit> hcal_hits =
43 event.getCollection<ldmx::HcalHit>("HcalRecHits", hcal_hits_pass_name_);
44
45 if (hcal_hits.empty()) {
46 return;
47 }
48
49 for (ldmx::HcalHit& hit : hcal_hits) {
50 if (hit.getEnergy() < enoise_cut_) continue;
51 if (hit.getEnergy() == 0) continue;
52 finder.add(&hit, hcal_geom);
53 }
54
55 // seedList.sort([](const ldmx::HcalHit* a, const ldmx::HcalHit* b) {return
56 // a->getEnergy() > b->getEnergy();});
57 finder.cluster(emin_cluster_, cut_off_, delta_time_);
58
59 std::vector<WorkingCluster> wc_vec = finder.getClusters();
60 for (unsigned int c = 0; c < wc_vec.size(); c++) {
61 if (wc_vec[c].empty()) continue;
62 ldmx::HcalCluster cluster;
63 cluster.setEnergy(wc_vec[c].centroid().E());
64 cluster.setCentroidXYZ(wc_vec[c].centroid().Px(), wc_vec[c].centroid().Py(),
65 wc_vec[c].centroid().Pz());
66 cluster.setNHits(wc_vec[c].getHits().size());
67 cluster.addHits(wc_vec[c].getHits());
68 std::vector<const ldmx::HcalHit*> hits = wc_vec[c].getHits();
69 if (hits.size() > 0) {
70 std::sort(hits.begin(), hits.end(), compHitTimes);
71 cluster.setTime(hits[0]->getTime());
72 }
73 hcal_clusters.push_back(cluster);
74 }
75 event.add(cluster_coll_name_, hcal_clusters);
76}
const T & getCondition(const std::string &condition_name)
Access a conditions object for the current event.
void setNHits(int nHits)
Sets total number of hits in the cluster.
Definition CaloCluster.h:65
void setCentroidXYZ(double centroid_x, double centroid_y, double centroid_z)
Sets the three coordinates of the cluster centroid.
Definition CaloCluster.h:85
void setEnergy(double energy)
Sets total energy for the cluster.
Definition CaloCluster.h:59
Stores cluster information from the HCal.
Definition HcalCluster.h:21
void addHits(const std::vector< const ldmx::HcalHit * > hitsVec)
Take in the hits that make up the cluster.
Implementation of HCal strip readout.
static constexpr const char * CONDITIONS_OBJECT_NAME
Conditions object: The name of the python configuration calling this class (Hcal/python/HcalGeometry....
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:24

References ldmx::HcalCluster::addHits(), ldmx::HcalGeometry::CONDITIONS_OBJECT_NAME, ldmx::CaloCluster::setCentroidXYZ(), ldmx::CaloCluster::setEnergy(), and ldmx::CaloCluster::setNHits().

Member Data Documentation

◆ cluster_coll_name_

std::string hcal::HcalClusterProducer::cluster_coll_name_
private

Definition at line 56 of file HcalClusterProducer.h.

◆ cut_off_

double hcal::HcalClusterProducer::cut_off_ {0.}
private

Definition at line 55 of file HcalClusterProducer.h.

55{0.};

◆ delta_r_

double hcal::HcalClusterProducer::delta_r_ {0}
private

Definition at line 53 of file HcalClusterProducer.h.

53{0};

◆ delta_time_

double hcal::HcalClusterProducer::delta_time_ {0}
private

Definition at line 52 of file HcalClusterProducer.h.

52{0};

◆ emin_cluster_

double hcal::HcalClusterProducer::emin_cluster_ {0.}
private

Definition at line 54 of file HcalClusterProducer.h.

54{0.};

◆ enoise_cut_

double hcal::HcalClusterProducer::enoise_cut_ {0.}
private

Definition at line 51 of file HcalClusterProducer.h.

51{0.};

◆ hcal_hits_pass_name_

std::string hcal::HcalClusterProducer::hcal_hits_pass_name_
private

Definition at line 57 of file HcalClusterProducer.h.


The documentation for this class was generated from the following files: