LDMX Software
Public Member Functions | Private Attributes | List of all members
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 beforeNewRun (ldmx::RunHeader &header)
 Handle allowing producers to modify run headers before the run begins.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 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 EnoiseCut_ {0.}
 
double deltaTime_ {0}
 
double deltaR_ {0}
 
double EminCluster_ {0.}
 
double cutOff_ {0.}
 
std::string clusterCollName_
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Producer
static const int CLASSTYPE {1}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 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.

◆ ~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 EnoiseCut_ = parameters.getParameter<double>("EnoiseCut");
21 deltaTime_ = parameters.getParameter<double>("deltaTime");
22 deltaR_ = parameters.getParameter<double>("deltaR");
23 EminCluster_ = parameters.getParameter<double>("EminCluster");
24 cutOff_ = parameters.getParameter<double>("cutOff");
25
26 clusterCollName_ = parameters.getParameter<std::string>("clusterCollName");
27}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

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

◆ 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 33 of file HcalClusterProducer.cxx.

33 {
34 const ldmx::HcalGeometry& hcalGeom = getCondition<ldmx::HcalGeometry>(
36
37 TemplatedClusterFinder<MyClusterWeight> finder;
38
39 std::vector<ldmx::HcalCluster> hcalClusters;
40 std::list<const ldmx::HcalHit*> seedList;
41 std::vector<ldmx::HcalHit> hcalHits =
42 event.getCollection<ldmx::HcalHit>("HcalRecHits");
43
44 if (hcalHits.empty()) {
45 return;
46 }
47
48 for (ldmx::HcalHit& hit : hcalHits) {
49 if (hit.getEnergy() < EnoiseCut_) continue;
50 if (hit.getEnergy() == 0) continue;
51 finder.add(&hit, hcalGeom);
52 }
53
54 // seedList.sort([](const ldmx::HcalHit* a, const ldmx::HcalHit* b) {return
55 // a->getEnergy() > b->getEnergy();});
56 finder.cluster(EminCluster_, cutOff_, deltaTime_);
57
58 std::vector<WorkingCluster> wcVec = finder.getClusters();
59 for (unsigned int c = 0; c < wcVec.size(); c++) {
60 if (wcVec[c].empty()) continue;
61 ldmx::HcalCluster cluster;
62 cluster.setEnergy(wcVec[c].centroid().E());
63 cluster.setCentroidXYZ(wcVec[c].centroid().Px(), wcVec[c].centroid().Py(),
64 wcVec[c].centroid().Pz());
65 cluster.setNHits(wcVec[c].getHits().size());
66 cluster.addHits(wcVec[c].getHits());
67 std::vector<const ldmx::HcalHit*> hits = wcVec[c].getHits();
68 if (hits.size() > 0) {
69 std::sort(hits.begin(), hits.end(), compHitTimes);
70 cluster.setTime(hits[0]->getTime());
71 }
72 hcalClusters.push_back(cluster);
73 }
74 event.add(clusterCollName_, hcalClusters);
75}
void setNHits(int nHits)
Sets total number of hits in the cluster.
Definition CaloCluster.h:65
void setEnergy(double energy)
Sets total energy for the cluster.
Definition CaloCluster.h:59
void setCentroidXYZ(double x, double y, double z)
Sets the three coordinates of the cluster centroid.
Definition CaloCluster.h:85
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:23

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

Member Data Documentation

◆ clusterCollName_

std::string hcal::HcalClusterProducer::clusterCollName_
private

Definition at line 56 of file HcalClusterProducer.h.

◆ cutOff_

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

Definition at line 55 of file HcalClusterProducer.h.

55{0.};

◆ deltaR_

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

Definition at line 53 of file HcalClusterProducer.h.

53{0};

◆ deltaTime_

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

Definition at line 52 of file HcalClusterProducer.h.

52{0};

◆ EminCluster_

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

Definition at line 54 of file HcalClusterProducer.h.

54{0.};

◆ EnoiseCut_

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

Definition at line 51 of file HcalClusterProducer.h.

51{0.};

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