LDMX Software
Public Types | Public Member Functions | Private Attributes | List of all members
dqm::HcalInefficiencyAnalyzer Class Reference

Public Types

enum  vetoCategories {
  back = 0 , top = 1 , bottom = 2 , right = 3 ,
  left = 4 , any = 5 , both = 6 , back_only = 7 ,
  side_only = 8 , neither = 9
}
 

Public Member Functions

 HcalInefficiencyAnalyzer (const std::string &name, framework::Process &process)
 
void configure (framework::config::Parameters &parameters) override
 Callback for the EventProcessor to configure itself from the given set of parameters.
 
bool hitPassesVeto (const ldmx::HcalHit &hit, int section)
 
void analyze (const framework::Event &event) override
 Process the event and make histograms or summaries.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
- 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

std::string hcalSimHitsCollection_ {"HcalSimHits"}
 
std::string hcalRecHitsCollection_ {"HcalRecHits"}
 
std::string hcalSimHitsPassName_ {""}
 
std::string hcalRecHitsPassName_ {""}
 
float pe_veto_threshold
 
double max_hit_time_
 

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::Analyzer
static const int CLASSTYPE {2}
 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

Definition at line 15 of file HcalInefficiencyDQM.h.

Member Enumeration Documentation

◆ vetoCategories

enum dqm::HcalInefficiencyAnalyzer::vetoCategories

Definition at line 20 of file HcalInefficiencyDQM.h.

20 {
21 back = 0,
22 top = 1,
23 bottom = 2,
24 right = 3,
25 left = 4,
26 any = 5,
27 both = 6,
28 back_only = 7,
29 side_only = 8,
30 neither = 9
31 };

Constructor & Destructor Documentation

◆ HcalInefficiencyAnalyzer()

dqm::HcalInefficiencyAnalyzer::HcalInefficiencyAnalyzer ( const std::string &  name,
framework::Process process 
)
inline

Definition at line 17 of file HcalInefficiencyDQM.h.

18 : framework::Analyzer{name, process} {}
Base class for a module which does not produce a data product.

Member Function Documentation

◆ analyze()

void dqm::HcalInefficiencyAnalyzer::analyze ( const framework::Event event)
overridevirtual

Process the event and make histograms or summaries.

Parameters
eventThe Event to analyze

Implements framework::Analyzer.

Definition at line 5 of file HcalInefficiencyDQM.cxx.

5 {
6 const auto hcalSimHits = event.getCollection<ldmx::SimCalorimeterHit>(
7 hcalSimHitsCollection_, hcalSimHitsPassName_);
8 const auto hcalRecHits = event.getCollection<ldmx::HcalHit>(
9 hcalRecHitsCollection_, hcalRecHitsPassName_);
10
11 const int failedVeto{999};
12 // Check veto for each section, combined side hcal veto
13 std::vector<int> firstLayersHit{failedVeto, failedVeto, failedVeto,
14 failedVeto, failedVeto};
15
16 const std::vector<std::string> sectionNames{"back", "top", "bottom", "right",
17 "left"};
18 for (const auto &hit : hcalRecHits) {
19 const ldmx::HcalID id{static_cast<ldmx::DetectorID::RawValue>(hit.getID())};
20 const auto section{id.section()};
21 const auto layer{id.layer()};
22 if (hitPassesVeto(hit, section)) {
23 if (layer < firstLayersHit[section]) {
24 firstLayersHit[section] = layer;
25 }
26 }
27 }
28
29 bool vetoedByBack{firstLayersHit[ldmx::HcalID::HcalSection::BACK] !=
30 failedVeto};
31 bool vetoedByTop{firstLayersHit[ldmx::HcalID::HcalSection::TOP] !=
32 failedVeto};
33 bool vetoedByBottom{firstLayersHit[ldmx::HcalID::HcalSection::BOTTOM] !=
34 failedVeto};
35 bool vetoedByRight{firstLayersHit[ldmx::HcalID::HcalSection::RIGHT] !=
36 failedVeto};
37 bool vetoedByLeft{firstLayersHit[ldmx::HcalID::HcalSection::LEFT] !=
38 failedVeto};
39 bool vetoedBySide{vetoedByTop || vetoedByBottom || vetoedByRight ||
40 vetoedByLeft};
41
42 for (int section{0}; section < firstLayersHit.size(); ++section) {
43 const auto layer{firstLayersHit[section]};
44 const auto sectionName{sectionNames[section]};
45 if (layer != failedVeto) {
46 histograms_.fill("inefficiency_" + sectionName, layer);
47 histograms_.fill("efficiency", section);
48 }
49 }
50 if (vetoedByBack || vetoedBySide) {
51 histograms_.fill("efficiency", vetoCategories::any);
52 if (vetoedByBack && vetoedBySide) {
53 histograms_.fill("efficiency", vetoCategories::both);
54 } else if (vetoedByBack && !vetoedBySide) {
55 histograms_.fill("efficiency", vetoCategories::back_only);
56 } else if (vetoedBySide && !vetoedByBack) {
57 histograms_.fill("efficiency", vetoCategories::side_only);
58 }
59 } else {
60 histograms_.fill("efficiency", vetoCategories::neither);
61 }
62}
HistogramHelper histograms_
Interface class for making and filling histograms.
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
Stores reconstructed hit information from the HCAL.
Definition HcalHit.h:23
Implements detector ids for HCal subdetector.
Definition HcalID.h:19
Stores simulated calorimeter hit information.

References framework::HistogramHelper::fill(), and framework::EventProcessor::histograms_.

◆ configure()

void dqm::HcalInefficiencyAnalyzer::configure ( framework::config::Parameters parameters)
overridevirtual

Callback for the EventProcessor to configure itself from the given set of parameters.

The parameters a processor has access to are the member variables of the python class in the sequence that has className equal to the EventProcessor class name.

For an example, look at MyProcessor.

Parameters
parametersParameters for configuration.

Reimplemented from framework::EventProcessor.

Definition at line 64 of file HcalInefficiencyDQM.cxx.

66 {
67 hcalSimHitsCollection_ =
68 parameters.getParameter<std::string>("sim_coll_name");
69 hcalRecHitsCollection_ =
70 parameters.getParameter<std::string>("rec_coll_name");
71 hcalSimHitsPassName_ = parameters.getParameter<std::string>("sim_pass_name");
72 hcalRecHitsPassName_ = parameters.getParameter<std::string>("rec_pass_name");
73 pe_veto_threshold = parameters.getParameter<double>("pe_veto_threshold");
74 max_hit_time_ = parameters.getParameter<double>("max_hit_time");
75}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

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

◆ hitPassesVeto()

bool dqm::HcalInefficiencyAnalyzer::hitPassesVeto ( const ldmx::HcalHit hit,
int  section 
)
inline

Definition at line 34 of file HcalInefficiencyDQM.h.

34 {
35 if (hit.getPE() < pe_veto_threshold || hit.getTime() > max_hit_time_) {
36 return true;
37 }
38 if (section == ldmx::HcalID::HcalSection::BACK && hit.getMinPE() < 1) {
39 return true;
40 }
41 return false;
42 }
float getTime() const
Get the time of the hit [ns].
float getMinPE() const
Get the minimum number of photoelectrons estimated for this hit if two sided readout.
Definition HcalHit.h:58
float getPE() const
Get the number of photoelectrons estimated for this hit.
Definition HcalHit.h:50

Member Data Documentation

◆ hcalRecHitsCollection_

std::string dqm::HcalInefficiencyAnalyzer::hcalRecHitsCollection_ {"HcalRecHits"}
private

Definition at line 48 of file HcalInefficiencyDQM.h.

48{"HcalRecHits"};

◆ hcalRecHitsPassName_

std::string dqm::HcalInefficiencyAnalyzer::hcalRecHitsPassName_ {""}
private

Definition at line 50 of file HcalInefficiencyDQM.h.

50{""};

◆ hcalSimHitsCollection_

std::string dqm::HcalInefficiencyAnalyzer::hcalSimHitsCollection_ {"HcalSimHits"}
private

Definition at line 47 of file HcalInefficiencyDQM.h.

47{"HcalSimHits"};

◆ hcalSimHitsPassName_

std::string dqm::HcalInefficiencyAnalyzer::hcalSimHitsPassName_ {""}
private

Definition at line 49 of file HcalInefficiencyDQM.h.

49{""};

◆ max_hit_time_

double dqm::HcalInefficiencyAnalyzer::max_hit_time_
private

Definition at line 54 of file HcalInefficiencyDQM.h.

◆ pe_veto_threshold

float dqm::HcalInefficiencyAnalyzer::pe_veto_threshold
private

Definition at line 53 of file HcalInefficiencyDQM.h.


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