CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
dEdxAnalyzer Class Reference

#include <dEdxAnalyzer.h>

Inheritance diagram for dEdxAnalyzer:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Classes

struct  dEdxMEs
 

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 dEdxAnalyzer (const edm::ParameterSet &)
 
void endJob () override
 
double mass (double P, double I)
 
 ~dEdxAnalyzer () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Attributes

std::vector< std::string > AlgoNames
 
edm::ParameterSet conf_
 
double dEdxC
 
std::vector< std::string > dEdxInputList_
 
double dEdxK
 
std::vector< dEdxMEsdEdxMEsVector
 
std::vector< edm::EDGetTokenT< reco::DeDxDataValueMap > > dEdxTokenList_
 
bool doAllPlots_
 
bool doDeDxPlots_
 
DQMStoredqmStore_
 
edm::ParameterSet fullconf_
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
double HighPtThreshold
 
double HIPdEdxMin
 
std::string histname
 
double TrackHitMin
 
edm::InputTag trackInputTag_
 
std::string TrackName
 
edm::EDGetTokenT< reco::TrackCollectiontrackToken_
 

Detailed Description

Monitoring source for general quantities related to track dEdx.

Definition at line 35 of file dEdxAnalyzer.h.

Constructor & Destructor Documentation

dEdxAnalyzer::dEdxAnalyzer ( const edm::ParameterSet iConfig)
explicit

Definition at line 22 of file dEdxAnalyzer.cc.

References conf_, dEdxInputList_, dEdxTokenList_, edm::ParameterSet::getParameter(), AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, trackInputTag_, and trackToken_.

24  , fullconf_( iConfig )
25  , conf_ (fullconf_.getParameter<edm::ParameterSet>("dEdxParameters") )
26  , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") )
27  , doDeDxPlots_ ( conf_.getParameter<bool>("doDeDxPlots") )
28  , genTriggerEventFlag_( new GenericTriggerEventFlag(conf_.getParameter<edm::ParameterSet>("genericTriggerEventPSet"),consumesCollector(), *this) )
29 {
30 
32  trackToken_ = consumes<reco::TrackCollection>(trackInputTag_);
33 
34  dEdxInputList_ = conf_.getParameter<std::vector<std::string> >("deDxProducers");
35  for (auto const& tag : dEdxInputList_) {
36  dEdxTokenList_.push_back(consumes<reco::DeDxDataValueMap>(edm::InputTag(tag) ) );
37  }
38 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: dEdxAnalyzer.h:82
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:52
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:84
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:92
edm::ParameterSet fullconf_
Definition: dEdxAnalyzer.h:51
bool doAllPlots_
Definition: dEdxAnalyzer.h:54
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:55
edm::InputTag trackInputTag_
Definition: dEdxAnalyzer.h:81
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:50
std::vector< edm::EDGetTokenT< reco::DeDxDataValueMap > > dEdxTokenList_
Definition: dEdxAnalyzer.h:85
dEdxAnalyzer::~dEdxAnalyzer ( )
override

Definition at line 40 of file dEdxAnalyzer.cc.

References genTriggerEventFlag_.

41 {
42 
44 }
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:92

Member Function Documentation

void dEdxAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 164 of file dEdxAnalyzer.cc.

References GenericTriggerEventFlag::accept(), plot_hgcal_utils::dEdx, dEdxInputList_, dEdxMEsVector, dEdxTokenList_, doAllPlots_, doDeDxPlots_, genTriggerEventFlag_, edm::Event::getByToken(), HighPtThreshold, reco::TrackBase::highPurity, HIPdEdxMin, mps_fire::i, edm::HandleBase::isValid(), mass(), GenericTriggerEventFlag::on(), edm::Handle< T >::product(), protons_cff::t, HiIsolationCommonParameters_cff::track, TrackHitMin, and trackToken_.

165 {
166 
167  // Filter out events if Trigger Filtering is requested
168  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
169 
170 
171  if ( doDeDxPlots_ || doAllPlots_ ){
172  edm::Handle<reco::TrackCollection> trackCollectionHandle;
173  iEvent.getByToken(trackToken_, trackCollectionHandle );
174  if(!trackCollectionHandle.isValid())return;
175 
176  for(unsigned int i=0;i<dEdxInputList_.size();i++){
177  edm::Handle<reco::DeDxDataValueMap> dEdxObjectHandle;
178  iEvent.getByToken(dEdxTokenList_[i], dEdxObjectHandle );
179  if(!dEdxObjectHandle.isValid())continue;
180  const edm::ValueMap<reco::DeDxData> dEdxColl = *dEdxObjectHandle.product();
181 
182 
183  for(unsigned int t=0; t<trackCollectionHandle->size(); t++){
184  reco::TrackRef track = reco::TrackRef( trackCollectionHandle, t );
185 
186 
187  if(track->quality(reco::TrackBase::highPurity) ) {
188  //MIPs
189  if( track->pt() >= 5.0 && track->numberOfValidHits()>TrackHitMin){
190  dEdxMEsVector[i].ME_MipDeDx ->Fill(dEdxColl[track].dEdx());
191  dEdxMEsVector[i].ME_MipDeDxNHits ->Fill(dEdxColl[track].numberOfMeasurements());
192  if (dEdxColl[track].numberOfMeasurements()!=0)
193  dEdxMEsVector[i].ME_MipDeDxNSatHits->Fill((1.0*dEdxColl[track].numberOfSaturatedMeasurements())/dEdxColl[track].numberOfMeasurements());
194  dEdxMEsVector[i].ME_MipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
195 
196 
197  if(track->pt() >= HighPtThreshold){
198  dEdxMEsVector[i].ME_MipHighPtDeDx ->Fill(dEdxColl[track].dEdx());
199  dEdxMEsVector[i].ME_MipHighPtDeDxNHits ->Fill(dEdxColl[track].numberOfMeasurements());
200  }
201 
202  //HighlyIonizing particles
203  }else if(track->pt()<2 && dEdxColl[track].dEdx()>HIPdEdxMin){
204  dEdxMEsVector[i].ME_HipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
205  }
206  }
207  }
208  }
209  }
210 }
double HighPtThreshold
Definition: dEdxAnalyzer.h:78
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: dEdxAnalyzer.h:82
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
double TrackHitMin
Definition: dEdxAnalyzer.h:78
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:84
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:92
bool doAllPlots_
Definition: dEdxAnalyzer.h:54
bool isValid() const
Definition: HandleBase.h:74
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:55
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:89
double mass(double P, double I)
T const * product() const
Definition: Handle.h:74
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:21
double HIPdEdxMin
Definition: dEdxAnalyzer.h:78
std::vector< edm::EDGetTokenT< reco::DeDxDataValueMap > > dEdxTokenList_
Definition: dEdxAnalyzer.h:85
void dEdxAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
override

Definition at line 70 of file dEdxAnalyzer.cc.

References DQMStore::IBooker::book1D(), conf_, dEdxC, dEdxInputList_, dEdxK, dEdxMEsVector, doAllPlots_, doDeDxPlots_, genTriggerEventFlag_, edm::ParameterSet::getParameter(), HighPtThreshold, HIPdEdxMin, histname, mps_fire::i, GenericTriggerEventFlag::initRun(), GenericTriggerEventFlag::on(), DQMStore::IBooker::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and TrackHitMin.

73 {
74 
75  // Initialize the GenericTriggerEventFlag
76  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
77 
78 
79  // parameters from the configuration
80  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
81 
82  // get binning from the configuration
83  TrackHitMin = conf_.getParameter<double>("TrackHitMin");
84  HIPdEdxMin = conf_.getParameter<double>("HIPdEdxMin");
85  HighPtThreshold = conf_.getParameter<double>("HighPtThreshold");
86 
87  dEdxK = conf_.getParameter<double>("dEdxK");
88  dEdxC = conf_.getParameter<double>("dEdxC");
89 
90 
91  int dEdxNHitBin = conf_.getParameter<int>( "dEdxNHitBin");
92  double dEdxNHitMin = conf_.getParameter<double>("dEdxNHitMin");
93  double dEdxNHitMax = conf_.getParameter<double>("dEdxNHitMax");
94 
95  int dEdxBin = conf_.getParameter<int>( "dEdxBin");
96  double dEdxMin = conf_.getParameter<double>("dEdxMin");
97  double dEdxMax = conf_.getParameter<double>("dEdxMax");
98 
99  int dEdxHIPmassBin = conf_.getParameter<int>( "dEdxHIPmassBin");
100  double dEdxHIPmassMin = conf_.getParameter<double>("dEdxHIPmassMin");
101  double dEdxHIPmassMax = conf_.getParameter<double>("dEdxHIPmassMax");
102 
103  int dEdxMIPmassBin = conf_.getParameter<int>( "dEdxMIPmassBin");
104  double dEdxMIPmassMin = conf_.getParameter<double>("dEdxMIPmassMin");
105  double dEdxMIPmassMax = conf_.getParameter<double>("dEdxMIPmassMax");
106 
107  ibooker.setCurrentFolder(MEFolderName);
108 
109  // book the Hit Property histograms
110  // ---------------------------------------------------------------------------------//
111 
112  if ( doDeDxPlots_ || doAllPlots_ ){
113  for(unsigned int i=0;i<dEdxInputList_.size();i++){
114  ibooker.setCurrentFolder(MEFolderName+"/"+ dEdxInputList_[i]);
115  dEdxMEsVector.push_back(dEdxMEs() );
116 
117  histname = "MIP_dEdxPerTrack_";
118  dEdxMEsVector[i].ME_MipDeDx = ibooker.book1D(histname, histname, dEdxBin, dEdxMin, dEdxMax);
119  dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("dEdx of each MIP Track (MeV/cm)");
120  dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("Number of Tracks", 2);
121 
122  histname = "MIP_NumberOfdEdxHitsPerTrack_";
123  dEdxMEsVector[i].ME_MipDeDxNHits = ibooker.book1D(histname, histname, dEdxNHitBin, dEdxNHitMin, dEdxNHitMax);
124  dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of dEdxHits of each MIP Track");
125  dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of Tracks", 2);
126 
127  histname = "MIP_FractionOfSaturateddEdxHitsPerTrack_";
128  dEdxMEsVector[i].ME_MipDeDxNSatHits = ibooker.book1D(histname, histname,2*dEdxNHitBin, 0, 1);
129  dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Fraction of Saturated dEdxHits of each MIP Track");
130  dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Number of Tracks", 2);
131 
132  histname = "MIP_MassPerTrack_";
133  dEdxMEsVector[i].ME_MipDeDxMass = ibooker.book1D(histname, histname, dEdxMIPmassBin, dEdxMIPmassMin, dEdxMIPmassMax);
134  dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("dEdx Mass of each MIP Track (GeV/c^{2})");
135  dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("Number of Tracks", 2);
136 
137  histname = "HIP_MassPerTrack_";
138  dEdxMEsVector[i].ME_HipDeDxMass = ibooker.book1D(histname, histname, dEdxHIPmassBin, dEdxHIPmassMin, dEdxHIPmassMax);
139  dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("dEdx Mass of each HIP Track (GeV/c^{2})");
140  dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("Number of Tracks", 2);
141 
142  histname = "MIPOfHighPt_dEdxPerTrack_";
143  dEdxMEsVector[i].ME_MipHighPtDeDx = ibooker.book1D(histname, histname, dEdxBin, dEdxMin, dEdxMax);
144  dEdxMEsVector[i].ME_MipHighPtDeDx->setAxisTitle("dEdx of each MIP (of High pT) Track (MeV/cm)");
145  dEdxMEsVector[i].ME_MipHighPtDeDx->setAxisTitle("Number of Tracks", 2);
146 
147  histname = "MIPOfHighPt_NumberOfdEdxHitsPerTrack_";
148  dEdxMEsVector[i].ME_MipHighPtDeDxNHits = ibooker.book1D(histname, histname, dEdxNHitBin, dEdxNHitMin, dEdxNHitMax);
149  dEdxMEsVector[i].ME_MipHighPtDeDxNHits->setAxisTitle("Number of dEdxHits of each MIP (of High pT) Track");
150  dEdxMEsVector[i].ME_MipHighPtDeDxNHits->setAxisTitle("Number of Tracks", 2);
151  }
152  }
153 
154 }
T getParameter(std::string const &) const
double HighPtThreshold
Definition: dEdxAnalyzer.h:78
double dEdxC
Definition: dEdxAnalyzer.h:79
double TrackHitMin
Definition: dEdxAnalyzer.h:78
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:52
double dEdxK
Definition: dEdxAnalyzer.h:79
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:84
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:92
bool doAllPlots_
Definition: dEdxAnalyzer.h:54
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:55
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:89
double HIPdEdxMin
Definition: dEdxAnalyzer.h:78
std::string histname
Definition: dEdxAnalyzer.h:90
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void dEdxAnalyzer::endJob ( void  )
override

Definition at line 48 of file dEdxAnalyzer.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), PostProcessorHGCAL_cfi::outputFileName, DQMStore::save(), DQMStore::showDirStructure(), and AlCaHLTBitMon_QueryRunRegistry::string.

49 {
50  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
52  if(outputMEsInRootFile)
53  {
55  dqmStore_->save(outputFileName);
56  }
57 }
T getParameter(std::string const &) const
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:52
void showDirStructure() const
Definition: DQMStore.cc:3307
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:50
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
Definition: DQMStore.cc:2465
void dEdxAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 215 of file dEdxAnalyzer.cc.

References edm::ConfigurationDescriptions::addDefault(), DEFINE_FWK_MODULE, and edm::ParameterSetDescription::setUnknown().

215  {
216  //The following says we do not know what parameters are allowed so do no validation
217  // Please change this to state exactly what you do use, even if it is no parameters
219  desc.setUnknown();
220  descriptions.addDefault(desc);
221 }
void addDefault(ParameterSetDescription const &psetDescription)
double dEdxAnalyzer::mass ( double  P,
double  I 
)

Definition at line 157 of file dEdxAnalyzer.cc.

References dEdxC, dEdxK, and mathSSE::sqrt().

Referenced by Particle.Particle::__str__(), DiObject.DiMuon::__str__(), and analyze().

157  {
158  if(I-dEdxC<0)return -1;
159  return sqrt((I-dEdxC)/dEdxK)*P;
160 }
double dEdxC
Definition: dEdxAnalyzer.h:79
double dEdxK
Definition: dEdxAnalyzer.h:79
T sqrt(T t)
Definition: SSEVec.h:18
const std::complex< double > I
Definition: I.h:8
std::pair< OmniClusterRef, TrackingParticleRef > P

Member Data Documentation

std::vector< std::string > dEdxAnalyzer::AlgoNames
private

Definition at line 88 of file dEdxAnalyzer.h.

edm::ParameterSet dEdxAnalyzer::conf_
private

Definition at line 52 of file dEdxAnalyzer.h.

Referenced by bookHistograms(), dEdxAnalyzer(), and endJob().

double dEdxAnalyzer::dEdxC
private

Definition at line 79 of file dEdxAnalyzer.h.

Referenced by bookHistograms(), and mass().

std::vector<std::string> dEdxAnalyzer::dEdxInputList_
private

Definition at line 84 of file dEdxAnalyzer.h.

Referenced by analyze(), bookHistograms(), and dEdxAnalyzer().

double dEdxAnalyzer::dEdxK
private

Definition at line 79 of file dEdxAnalyzer.h.

Referenced by bookHistograms(), and mass().

std::vector< dEdxMEs > dEdxAnalyzer::dEdxMEsVector
private

Definition at line 89 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

std::vector<edm::EDGetTokenT<reco::DeDxDataValueMap> > dEdxAnalyzer::dEdxTokenList_
private

Definition at line 85 of file dEdxAnalyzer.h.

Referenced by analyze(), and dEdxAnalyzer().

bool dEdxAnalyzer::doAllPlots_
private

Definition at line 54 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

bool dEdxAnalyzer::doDeDxPlots_
private

Definition at line 55 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

DQMStore* dEdxAnalyzer::dqmStore_
private

Definition at line 50 of file dEdxAnalyzer.h.

Referenced by endJob().

edm::ParameterSet dEdxAnalyzer::fullconf_
private

Definition at line 51 of file dEdxAnalyzer.h.

GenericTriggerEventFlag* dEdxAnalyzer::genTriggerEventFlag_
private

Definition at line 92 of file dEdxAnalyzer.h.

Referenced by analyze(), bookHistograms(), and ~dEdxAnalyzer().

double dEdxAnalyzer::HighPtThreshold
private

Definition at line 78 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

double dEdxAnalyzer::HIPdEdxMin
private

Definition at line 78 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

std::string dEdxAnalyzer::histname
private

Definition at line 90 of file dEdxAnalyzer.h.

Referenced by bookHistograms().

double dEdxAnalyzer::TrackHitMin
private

Definition at line 78 of file dEdxAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::InputTag dEdxAnalyzer::trackInputTag_
private

Definition at line 81 of file dEdxAnalyzer.h.

Referenced by dEdxAnalyzer().

std::string dEdxAnalyzer::TrackName
private

Definition at line 87 of file dEdxAnalyzer.h.

edm::EDGetTokenT<reco::TrackCollection> dEdxAnalyzer::trackToken_
private

Definition at line 82 of file dEdxAnalyzer.h.

Referenced by analyze(), and dEdxAnalyzer().