-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create DQM module for dEdx mass estimation
- Loading branch information
Showing
3 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#ifndef DQM_TRKDEDXMASSESTFEATURES_H | ||
#define DQM_TRKDEDXMASSESTFEATURES_H | ||
|
||
// LDMX Framework | ||
#include "Framework/Configure/Parameters.h" // Needed to import parameters from configuration file | ||
#include "Framework/EventProcessor.h" //Needed to declare processor | ||
|
||
namespace dqm { | ||
|
||
/** | ||
* @class TrkDeDxMassEstFeatures | ||
* @brief Generate histograms to check tracker dE/dx mass estimate features | ||
*/ | ||
class TrkDeDxMassEstFeatures : public framework::Analyzer { | ||
public: | ||
/** | ||
* Constructor | ||
* | ||
* Blank Analyzer constructor | ||
*/ | ||
TrkDeDxMassEstFeatures(const std::string& name, framework::Process& process) | ||
: framework::Analyzer(name, process) {} | ||
|
||
/** | ||
* Input python configuration parameters | ||
*/ | ||
virtual void configure(framework::config::Parameters& ps); | ||
|
||
/** | ||
* Fills histograms | ||
*/ | ||
virtual void analyze(const framework::Event& event); | ||
|
||
/// Method executed before processing of events begins. | ||
void onProcessStart() override; | ||
|
||
private: | ||
/// Collection Name for mass estimate object | ||
std::string mass_estimate_name_; | ||
|
||
/// Pass Name for mass estimate object | ||
std::string mass_estimate_pass_; | ||
}; | ||
} // namespace dqm | ||
|
||
#endif /* DQM_TRKDEDXMASSESTFEATURES_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
#include "DQM/TrkDeDxMassEstFeatures.h" | ||
|
||
#include "Recon/Event/TrackDeDxMassEstimate.h" | ||
|
||
namespace dqm { | ||
|
||
void TrkDeDxMassEstFeatures::configure(framework::config::Parameters &ps) { | ||
mass_estimate_name_ = ps.getParameter<std::string>("mass_estimate_name"); | ||
mass_estimate_pass_ = ps.getParameter<std::string>("mass_estimate_pass"); | ||
|
||
return; | ||
} | ||
|
||
void TrkDeDxMassEstFeatures::analyze(const framework::Event &event) { | ||
auto massEstimates{ | ||
event.getCollection<ldmx::TrackDeDxMassEstimate>(mass_estimate_name_, | ||
mass_estimate_pass_)}; | ||
|
||
for (const auto &massEst : massEstimates) { | ||
histograms_.fill("mass_estimate", massEst.getMass()); | ||
histograms_.fill("track_type", massEst.getTrackType()); | ||
} | ||
|
||
return; | ||
} | ||
|
||
void TrkDeDxMassEstFeatures::onProcessStart() { | ||
std::vector<std::string> labels = {"Other", // 0 | ||
"Tagger", // 1 | ||
"Recoil", // 2 | ||
""}; | ||
TH1 *hist = histograms_.get("track_type"); | ||
for (int ilabel{1}; ilabel < labels.size(); ++ilabel) { | ||
hist->GetXaxis()->SetBinLabel(ilabel, labels[ilabel - 1].c_str()); | ||
} | ||
} | ||
|
||
} // namespace dqm | ||
|
||
DECLARE_ANALYZER_NS(dqm, TrkDeDxMassEstFeatures); |