CMS 3D CMS Logo

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

#include <dEdxHitAnalyzer.h>

Inheritance diagram for dEdxHitAnalyzer:
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
 
 dEdxHitAnalyzer (const edm::ParameterSet &)
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
double harmonic2 (const reco::DeDxHitInfo *dedxHits)
 
 ~dEdxHitAnalyzer () 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_
 
int dEdxHarm2Bin
 
double dEdxHarm2Max
 
double dEdxHarm2Min
 
std::vector< std::string > dEdxInputList_
 
std::vector< dEdxMEsdEdxMEsVector
 
int dEdxNHitBin
 
double dEdxNHitMax
 
double dEdxNHitMin
 
int dEdxPixelBin
 
double dEdxPixelMax
 
double dEdxPixelMin
 
int dEdxStripBin
 
double dEdxStripMax
 
double dEdxStripMin
 
std::vector< edm::EDGetTokenT< reco::DeDxHitInfoAss > > dEdxTokenList_
 
bool doAllPlots_
 
bool doDeDxPlots_
 
edm::ParameterSet fullconf_
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
std::string histname
 
std::string MEFolderName
 
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 dEdxHitAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file dEdxHitAnalyzer.cc.

References conf_, dEdxHarm2Bin, dEdxHarm2Max, dEdxHarm2Min, dEdxInputList_, dEdxNHitBin, dEdxNHitMax, dEdxNHitMin, dEdxPixelBin, dEdxPixelMax, dEdxPixelMin, dEdxStripBin, dEdxStripMax, dEdxStripMin, dEdxTokenList_, edm::ParameterSet::getParameter(), MEFolderName, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, trackInputTag_, and trackToken_.

23  : fullconf_( iConfig )
24  , conf_ (fullconf_.getParameter<edm::ParameterSet>("dEdxParameters") )
25  , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") )
26  , doDeDxPlots_ ( conf_.getParameter<bool>("doDeDxPlots") )
27  , genTriggerEventFlag_( new GenericTriggerEventFlag(conf_.getParameter<edm::ParameterSet>("genericTriggerEventPSet"),consumesCollector(), *this) )
28 {
29 
31  trackToken_ = consumes<reco::TrackCollection>(trackInputTag_);
32 
33  dEdxInputList_ = conf_.getParameter<std::vector<std::string> >("deDxHitProducers");
34  for (auto const& tag : dEdxInputList_) {
35  dEdxTokenList_.push_back(consumes<reco::DeDxHitInfoAss>(edm::InputTag(tag) ) );
36  }
37 
38  // parameters from the configuration
39  MEFolderName = conf_.getParameter<std::string>("FolderName");
40 
41  dEdxNHitBin = conf_.getParameter<int>( "dEdxNHitBin");
42  dEdxNHitMin = conf_.getParameter<double>("dEdxNHitMin");
43  dEdxNHitMax = conf_.getParameter<double>("dEdxNHitMax");
44 
45  dEdxStripBin = conf_.getParameter<int>( "dEdxStripBin");
46  dEdxStripMin = conf_.getParameter<double>("dEdxStripMin");
47  dEdxStripMax = conf_.getParameter<double>("dEdxStripMax");
48 
49  dEdxPixelBin = conf_.getParameter<int>( "dEdxPixelBin");
50  dEdxPixelMin = conf_.getParameter<double>("dEdxPixelMin");
51  dEdxPixelMax = conf_.getParameter<double>("dEdxPixelMax");
52 
53  dEdxHarm2Bin = conf_.getParameter<int>( "dEdxHarm2Bin");
54  dEdxHarm2Min = conf_.getParameter<double>("dEdxHarm2Min");
55  dEdxHarm2Max = conf_.getParameter<double>("dEdxHarm2Max");
56 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
std::vector< std::string > dEdxInputList_
edm::InputTag trackInputTag_
GenericTriggerEventFlag * genTriggerEventFlag_
edm::ParameterSet fullconf_
std::vector< edm::EDGetTokenT< reco::DeDxHitInfoAss > > dEdxTokenList_
edm::ParameterSet conf_
std::string MEFolderName
dEdxHitAnalyzer::~dEdxHitAnalyzer ( )
override

Definition at line 58 of file dEdxHitAnalyzer.cc.

References genTriggerEventFlag_.

59 {
60 
62 }
GenericTriggerEventFlag * genTriggerEventFlag_

Member Function Documentation

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

Definition at line 134 of file dEdxHitAnalyzer.cc.

References GenericTriggerEventFlag::accept(), reco::DeDxHitInfo::charge(), dEdxInputList_, dEdxMEsVector, dEdxTokenList_, reco::DeDxHitInfo::detId(), doAllPlots_, doDeDxPlots_, HcalObjRepresent::Fill(), genTriggerEventFlag_, edm::Event::getByToken(), h, harmonic2(), reco::TrackBase::highPurity, mps_fire::i, edm::Ref< C, T, F >::isNull(), edm::HandleBase::isValid(), GenericTriggerEventFlag::on(), reco::DeDxHitInfo::size(), lumiQTWidget::t, HiIsolationCommonParameters_cff::track, and trackToken_.

135 {
136 
137  // Filter out events if Trigger Filtering is requested
138  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
139 
140 
141  if ( doDeDxPlots_ || doAllPlots_ ){
142  edm::Handle<reco::TrackCollection> trackCollectionHandle;
143  iEvent.getByToken(trackToken_, trackCollectionHandle );
144  if(!trackCollectionHandle.isValid())return;
145 
146  for(unsigned int i=0;i<dEdxInputList_.size();i++){
147  edm::Handle<reco::DeDxHitInfoAss> dEdxObjectHandle;
148  iEvent.getByToken(dEdxTokenList_[i], dEdxObjectHandle );
149  if(!dEdxObjectHandle.isValid())continue;
150 
151  for(unsigned int t=0; t<trackCollectionHandle->size(); t++){
152  reco::TrackRef track = reco::TrackRef( trackCollectionHandle, t );
153 
154  if(track->quality(reco::TrackBase::highPurity) ) {
155  const reco::DeDxHitInfo* dedxHits = nullptr;
156  if(!track.isNull()) {
157  reco::DeDxHitInfoRef dedxHitsRef = (*dEdxObjectHandle)[track];
158  if(!dedxHitsRef.isNull())dedxHits = &(*dedxHitsRef);
159  }
160  if(!dedxHits)continue;
161 
162  for(unsigned int h=0;h<dedxHits->size();h++){
163  DetId detid(dedxHits->detId(h));
164  if(detid.subdetId()>=3)dEdxMEsVector[i].ME_StripHitDeDx ->Fill(dedxHits->charge(h));
165  if(detid.subdetId()<3 )dEdxMEsVector[i].ME_PixelHitDeDx ->Fill(dedxHits->charge(h));
166  }
167  dEdxMEsVector[i].ME_NHitDeDx->Fill(dedxHits->size());
168  dEdxMEsVector[i].ME_Harm2DeDx->Fill(harmonic2(dedxHits));
169  }
170  }
171  }
172  }
173 }
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
float charge(size_t i) const
Definition: DeDxHitInfo.h:42
edm::EDGetTokenT< reco::TrackCollection > trackToken_
std::vector< std::string > dEdxInputList_
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
GenericTriggerEventFlag * genTriggerEventFlag_
bool isValid() const
Definition: HandleBase.h:74
std::vector< edm::EDGetTokenT< reco::DeDxHitInfoAss > > dEdxTokenList_
bool isNull() const
Checks for null.
Definition: Ref.h:248
double harmonic2(const reco::DeDxHitInfo *dedxHits)
Definition: DetId.h:18
size_t size() const
Definition: DeDxHitInfo.h:41
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:21
DetId detId(size_t i) const
Definition: DeDxHitInfo.h:44
std::vector< dEdxMEs > dEdxMEsVector
void dEdxHitAnalyzer::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
override

Definition at line 73 of file dEdxHitAnalyzer.cc.

References DQMStore::IBooker::book1D(), dEdxHarm2Bin, dEdxHarm2Max, dEdxHarm2Min, dEdxInputList_, dEdxMEsVector, dEdxNHitBin, dEdxNHitMax, dEdxNHitMin, dEdxPixelBin, dEdxPixelMax, dEdxPixelMin, dEdxStripBin, dEdxStripMax, dEdxStripMin, doAllPlots_, doDeDxPlots_, histname, mps_fire::i, MEFolderName, and DQMStore::IBooker::setCurrentFolder().

76 {
77 
79 
80  // book the Hit Property histograms
81  // ---------------------------------------------------------------------------------//
82 
83  if ( doDeDxPlots_ || doAllPlots_ ){
84  for(unsigned int i=0;i<dEdxInputList_.size();i++){
86  dEdxMEsVector.push_back(dEdxMEs() );
87 
88  histname = "Strip_dEdxPerCluster_";
90  dEdxMEsVector[i].ME_StripHitDeDx->setAxisTitle("dEdx of on-track strip cluster (ADC)");
91  dEdxMEsVector[i].ME_StripHitDeDx->setAxisTitle("Number of Strip clusters", 2);
92 
93  histname = "Pixel_dEdxPerCluster_";
95  dEdxMEsVector[i].ME_PixelHitDeDx->setAxisTitle("dEdx of on-track pixel cluster (ADC)");
96  dEdxMEsVector[i].ME_PixelHitDeDx->setAxisTitle("Number of Pixel clusters", 2);
97 
98  histname = "NumberOfdEdxHitsPerTrack_";
100  dEdxMEsVector[i].ME_NHitDeDx->setAxisTitle("Number of dEdxHits per Track");
101  dEdxMEsVector[i].ME_NHitDeDx->setAxisTitle("Number of Tracks", 2);
102 
103  histname = "Harm2_dEdxPerTrack_";
105  dEdxMEsVector[i].ME_Harm2DeDx->setAxisTitle("Harmonic2 dEdx estimator for each Track");
106  dEdxMEsVector[i].ME_Harm2DeDx->setAxisTitle("Number of Tracks", 2);
107  }
108  }
109 }
std::vector< std::string > dEdxInputList_
std::string histname
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
std::string MEFolderName
std::vector< dEdxMEs > dEdxMEsVector
void dEdxHitAnalyzer::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
override

Definition at line 66 of file dEdxHitAnalyzer.cc.

References genTriggerEventFlag_, GenericTriggerEventFlag::initRun(), and GenericTriggerEventFlag::on().

67 {
68  // Initialize the GenericTriggerEventFlag
69  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
70 }
GenericTriggerEventFlag * genTriggerEventFlag_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void dEdxHitAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 180 of file dEdxHitAnalyzer.cc.

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

180  {
181  //The following says we do not know what parameters are allowed so do no validation
182  // Please change this to state exactly what you do use, even if it is no parameters
184  desc.setUnknown();
185  descriptions.addDefault(desc);
186 }
void addDefault(ParameterSetDescription const &psetDescription)
double dEdxHitAnalyzer::harmonic2 ( const reco::DeDxHitInfo dedxHits)

Definition at line 111 of file dEdxHitAnalyzer.cc.

References reco::DeDxHitInfo::charge(), reco::DeDxHitInfo::detId(), MillePedeFileConverter_cfg::e, h, mps_fire::i, reco::DeDxHitInfo::pathlength(), funct::pow(), mps_fire::result, reco::DeDxHitInfo::size(), and findQualityFiles::size.

Referenced by analyze().

111  {
112  if(!dedxHits)return -1;
113  std::vector<double> vect;
114  for(unsigned int h=0;h<dedxHits->size();h++){
115  DetId detid(dedxHits->detId(h));
116  double Norm = (detid.subdetId()<3)?3.61e-06:3.61e-06*265;
117  double ChargeOverPathlength = Norm*dedxHits->charge(h)/dedxHits->pathlength(h);
118  vect.push_back(ChargeOverPathlength); //save charge
119  }
120 
121  int size = vect.size();
122  if(size<=0)return -1;
123  double result=0;
124  double expo = -2;
125  for(int i = 0; i< size; i ++){
126  result+=pow(vect[i],expo);
127  }
128  return pow(result/size,1./expo);
129 }
size
Write out results.
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
float charge(size_t i) const
Definition: DeDxHitInfo.h:42
Definition: DetId.h:18
size_t size() const
Definition: DeDxHitInfo.h:41
float pathlength(size_t i) const
Definition: DeDxHitInfo.h:43
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:40
DetId detId(size_t i) const
Definition: DeDxHitInfo.h:44

Member Data Documentation

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

Definition at line 77 of file dEdxHitAnalyzer.h.

edm::ParameterSet dEdxHitAnalyzer::conf_
private

Definition at line 50 of file dEdxHitAnalyzer.h.

Referenced by dEdxHitAnalyzer().

int dEdxHitAnalyzer::dEdxHarm2Bin
private

Definition at line 98 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxHarm2Max
private

Definition at line 100 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxHarm2Min
private

Definition at line 99 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

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

Definition at line 73 of file dEdxHitAnalyzer.h.

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

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

Definition at line 78 of file dEdxHitAnalyzer.h.

Referenced by analyze(), and bookHistograms().

int dEdxHitAnalyzer::dEdxNHitBin
private

Definition at line 86 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxNHitMax
private

Definition at line 88 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxNHitMin
private

Definition at line 87 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

int dEdxHitAnalyzer::dEdxPixelBin
private

Definition at line 94 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxPixelMax
private

Definition at line 96 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxPixelMin
private

Definition at line 95 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

int dEdxHitAnalyzer::dEdxStripBin
private

Definition at line 90 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxStripMax
private

Definition at line 92 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

double dEdxHitAnalyzer::dEdxStripMin
private

Definition at line 91 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

std::vector<edm::EDGetTokenT<reco::DeDxHitInfoAss> > dEdxHitAnalyzer::dEdxTokenList_
private

Definition at line 74 of file dEdxHitAnalyzer.h.

Referenced by analyze(), and dEdxHitAnalyzer().

bool dEdxHitAnalyzer::doAllPlots_
private

Definition at line 52 of file dEdxHitAnalyzer.h.

Referenced by analyze(), and bookHistograms().

bool dEdxHitAnalyzer::doDeDxPlots_
private

Definition at line 53 of file dEdxHitAnalyzer.h.

Referenced by analyze(), and bookHistograms().

edm::ParameterSet dEdxHitAnalyzer::fullconf_
private

Definition at line 49 of file dEdxHitAnalyzer.h.

GenericTriggerEventFlag* dEdxHitAnalyzer::genTriggerEventFlag_
private

Definition at line 81 of file dEdxHitAnalyzer.h.

Referenced by analyze(), dqmBeginRun(), and ~dEdxHitAnalyzer().

std::string dEdxHitAnalyzer::histname
private

Definition at line 79 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms().

std::string dEdxHitAnalyzer::MEFolderName
private

Definition at line 84 of file dEdxHitAnalyzer.h.

Referenced by bookHistograms(), and dEdxHitAnalyzer().

edm::InputTag dEdxHitAnalyzer::trackInputTag_
private

Definition at line 70 of file dEdxHitAnalyzer.h.

Referenced by dEdxHitAnalyzer().

std::string dEdxHitAnalyzer::TrackName
private

Definition at line 76 of file dEdxHitAnalyzer.h.

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

Definition at line 71 of file dEdxHitAnalyzer.h.

Referenced by analyze(), and dEdxHitAnalyzer().