LDMX Software
Public Member Functions | Private Attributes | List of all members
ecal::EcalClusterProducer Class Reference

Simple algorithm that does clustering in the ECal. More...

#include <EcalClusterProducer.h>

Public Member Functions

 EcalClusterProducer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Configure the processor using the given user specified parameters.
 
virtual 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 seedThreshold_ {0}
 
double cutoff_ {0}
 
std::string digisPassName_
 
std::string algoCollName_
 
std::string clusterCollName_
 
TString algoName_
 The name of the cluster algorithm used.
 

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

Simple algorithm that does clustering in the ECal.

Definition at line 45 of file EcalClusterProducer.h.

Constructor & Destructor Documentation

◆ EcalClusterProducer()

ecal::EcalClusterProducer::EcalClusterProducer ( const std::string &  name,
framework::Process process 
)

Definition at line 11 of file EcalClusterProducer.cxx.

13 : Producer(name, process) {}
Producer(const std::string &name, Process &process)
Class constructor.

◆ ~EcalClusterProducer()

ecal::EcalClusterProducer::~EcalClusterProducer ( )
virtual

Definition at line 15 of file EcalClusterProducer.cxx.

15{}

Member Function Documentation

◆ configure()

void ecal::EcalClusterProducer::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 17 of file EcalClusterProducer.cxx.

17 {
18 cutoff_ = parameters.getParameter<double>("cutoff");
19 seedThreshold_ = parameters.getParameter<double>("seedThreshold");
20 digisPassName_ = parameters.getParameter<std::string>("digisPassName");
21 algoCollName_ = parameters.getParameter<std::string>("algoCollName");
22 algoName_ = parameters.getParameter<std::string>("algoName");
23 clusterCollName_ = parameters.getParameter<std::string>("clusterCollName");
24}
TString algoName_
The name of the cluster algorithm used.
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 ecal::EcalClusterProducer::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 26 of file EcalClusterProducer.cxx.

26 {
27 // Get the Ecal Geometry
28 const auto& geometry = getCondition<ldmx::EcalGeometry>(
29 ldmx::EcalGeometry::CONDITIONS_OBJECT_NAME);
30
31 TemplatedClusterFinder<MyClusterWeight> cf;
32
33 std::vector<ldmx::EcalHit> ecalHits =
34 event.getCollection<ldmx::EcalHit>("ecalDigis", digisPassName_);
35 int nEcalDigis = ecalHits.size();
36
37 // Don't do anything if there are no ECal digis!
38 if (!(nEcalDigis > 0)) {
39 return;
40 }
41
42 for (ldmx::EcalHit& hit : ecalHits) {
43 // Skip zero energy digis.
44 if (hit.getEnergy() == 0) {
45 continue;
46 }
47
48 cf.add(&hit, geometry);
49 }
50
51 cf.cluster(seedThreshold_, cutoff_);
52 std::vector<WorkingCluster> wcVec = cf.getClusters();
53
54 std::map<int, double> cWeights = cf.getWeights();
55
56 ldmx::ClusterAlgoResult algoResult;
57 algoResult.set(algoName_, 3, cWeights.rbegin()->first);
58 algoResult.setAlgoVar(0, cutoff_);
59 algoResult.setAlgoVar(1, seedThreshold_);
60 algoResult.setAlgoVar(2, cf.getNSeeds());
61
62 std::map<int, double>::iterator it = cWeights.begin();
63 for (it = cWeights.begin(); it != cWeights.end(); it++) {
64 algoResult.setWeight(it->first, it->second / 100);
65 }
66
67 std::vector<ldmx::EcalCluster> ecalClusters;
68 for (int aWC = 0; aWC < wcVec.size(); aWC++) {
69 ldmx::EcalCluster cluster;
70
71 cluster.setEnergy(wcVec[aWC].centroid().E());
72 cluster.setCentroidXYZ(wcVec[aWC].centroid().Px(),
73 wcVec[aWC].centroid().Py(),
74 wcVec[aWC].centroid().Pz());
75 cluster.setNHits(wcVec[aWC].getHits().size());
76 cluster.addHits(wcVec[aWC].getHits());
77
78 ecalClusters.push_back(cluster);
79 }
80
81 event.add(clusterCollName_, ecalClusters);
82 event.add(algoCollName_, algoResult);
83}
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
Contains details about the clustering algorithm.
void setAlgoVar(int element, double value)
Set an algorithm variable.
void set(const TString &name, int nvar)
Set name and number of variables of cluster algo.
void setWeight(int nClusters, double weight)
Set a weight when number of clusters reached.
Stores cluster information from the ECal.
Definition EcalCluster.h:20
void addHits(const std::vector< const ldmx::EcalHit * > hitsVec)
Take in the hits that make up the cluster.
Stores reconstructed hit information from the ECAL.
Definition EcalHit.h:19

References ldmx::EcalCluster::addHits(), ldmx::ClusterAlgoResult::set(), ldmx::ClusterAlgoResult::setAlgoVar(), ldmx::CaloCluster::setCentroidXYZ(), ldmx::CaloCluster::setEnergy(), ldmx::CaloCluster::setNHits(), and ldmx::ClusterAlgoResult::setWeight().

Member Data Documentation

◆ algoCollName_

std::string ecal::EcalClusterProducer::algoCollName_
private

Definition at line 64 of file EcalClusterProducer.h.

◆ algoName_

TString ecal::EcalClusterProducer::algoName_
private

The name of the cluster algorithm used.

Definition at line 68 of file EcalClusterProducer.h.

◆ clusterCollName_

std::string ecal::EcalClusterProducer::clusterCollName_
private

Definition at line 65 of file EcalClusterProducer.h.

◆ cutoff_

double ecal::EcalClusterProducer::cutoff_ {0}
private

Definition at line 62 of file EcalClusterProducer.h.

62{0};

◆ digisPassName_

std::string ecal::EcalClusterProducer::digisPassName_
private

Definition at line 63 of file EcalClusterProducer.h.

◆ seedThreshold_

double ecal::EcalClusterProducer::seedThreshold_ {0}
private

Definition at line 61 of file EcalClusterProducer.h.

61{0};

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