CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Private Attributes
dEdxAnalyzer Class Reference

#include <dEdxAnalyzer.h>

Inheritance diagram for dEdxAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Classes

struct  dEdxMEs
 

Public Member Functions

virtual void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual void beginJob ()
 
virtual void beginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
 dEdxAnalyzer (const edm::ParameterSet &)
 
virtual void endJob ()
 
virtual void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
double mass (double P, double I)
 
 ~dEdxAnalyzer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

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 HIPdEdxMin
 
std::string histname
 
double TrackHitMin
 
edm::InputTag trackInputTag_
 
std::string TrackName
 
edm::EDGetTokenT
< reco::TrackCollection
trackToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Monitoring source for general quantities related to track dEdx.

Definition at line 33 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") )
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:80
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:54
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:82
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:90
edm::ParameterSet fullconf_
Definition: dEdxAnalyzer.h:53
bool doAllPlots_
Definition: dEdxAnalyzer.h:56
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:57
edm::InputTag trackInputTag_
Definition: dEdxAnalyzer.h:79
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:52
std::vector< edm::EDGetTokenT< reco::DeDxDataValueMap > > dEdxTokenList_
Definition: dEdxAnalyzer.h:83
dEdxAnalyzer::~dEdxAnalyzer ( )

Definition at line 40 of file dEdxAnalyzer.cc.

References genTriggerEventFlag_.

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

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 145 of file dEdxAnalyzer.cc.

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

146 {
147 
148  // Filter out events if Trigger Filtering is requested
149  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
150 
151 
152  if ( doDeDxPlots_ || doAllPlots_ ){
153  edm::Handle<reco::TrackCollection> trackCollectionHandle;
154  // iEvent.getByLabel(TrackName,trackCollectionHandle);
155  iEvent.getByToken(trackToken_, trackCollectionHandle );
156  if(!trackCollectionHandle.isValid())return;
157 
158  for(unsigned int i=0;i<dEdxInputList_.size();i++){
159  edm::Handle<reco::DeDxDataValueMap> dEdxObjectHandle;
160  // iEvent.getByLabel(AlgoNames[i],dEdxObjectHandle);
161  iEvent.getByToken(dEdxTokenList_[i], dEdxObjectHandle );
162  if(!dEdxObjectHandle.isValid())continue;
163  const edm::ValueMap<reco::DeDxData> dEdxColl = *dEdxObjectHandle.product();
164 
165 
166  for(unsigned int t=0; t<trackCollectionHandle->size(); t++){
167  reco::TrackRef track = reco::TrackRef( trackCollectionHandle, t );
168 
169 
170  if(track->quality(reco::TrackBase::highPurity) ) {
171  //MIPs
172  if( track->pt() >= 5.0 && track->numberOfValidHits()>TrackHitMin){
173  dEdxMEsVector[i].ME_MipDeDx ->Fill(dEdxColl[track].dEdx());
174  dEdxMEsVector[i].ME_MipDeDxNHits ->Fill(dEdxColl[track].numberOfMeasurements());
175  if (dEdxColl[track].numberOfMeasurements()!=0)
176  dEdxMEsVector[i].ME_MipDeDxNSatHits->Fill((1.0*dEdxColl[track].numberOfSaturatedMeasurements())/dEdxColl[track].numberOfMeasurements());
177  dEdxMEsVector[i].ME_MipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
178 
179  //HighlyIonizing particles
180  }else if(track->pt()<2 && dEdxColl[track].dEdx()>HIPdEdxMin){
181  dEdxMEsVector[i].ME_HipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
182  }
183  }
184  }
185  }
186  }
187 }
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::TrackCollection > trackToken_
Definition: dEdxAnalyzer.h:80
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
double TrackHitMin
Definition: dEdxAnalyzer.h:76
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:82
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:90
bool doAllPlots_
Definition: dEdxAnalyzer.h:56
bool isValid() const
Definition: HandleBase.h:76
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:57
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:87
double mass(double P, double I)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
T const * product() const
Definition: Handle.h:81
double HIPdEdxMin
Definition: dEdxAnalyzer.h:76
std::vector< edm::EDGetTokenT< reco::DeDxDataValueMap > > dEdxTokenList_
Definition: dEdxAnalyzer.h:83
void dEdxAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file dEdxAnalyzer.cc.

References DQMStore::book1D(), conf_, dEdxC, dEdxInputList_, dEdxK, dEdxMEsVector, doAllPlots_, doDeDxPlots_, dqmStore_, edm::ParameterSet::getParameter(), HIPdEdxMin, histname, i, DQMStore::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and TrackHitMin.

70 {
71  // parameters from the configuration
72  std::string MEFolderName = conf_.getParameter<std::string>("FolderName");
73 
74  // get binning from the configuration
75  TrackHitMin = conf_.getParameter<double>("TrackHitMin");
76  HIPdEdxMin = conf_.getParameter<double>("HIPdEdxMin");
77 
78  dEdxK = conf_.getParameter<double>("dEdxK");
79  dEdxC = conf_.getParameter<double>("dEdxC");
80 
81 
82  int dEdxNHitBin = conf_.getParameter<int>( "dEdxNHitBin");
83  double dEdxNHitMin = conf_.getParameter<double>("dEdxNHitMin");
84  double dEdxNHitMax = conf_.getParameter<double>("dEdxNHitMax");
85 
86  int dEdxBin = conf_.getParameter<int>( "dEdxBin");
87  double dEdxMin = conf_.getParameter<double>("dEdxMin");
88  double dEdxMax = conf_.getParameter<double>("dEdxMax");
89 
90  int dEdxHIPmassBin = conf_.getParameter<int>( "dEdxHIPmassBin");
91  double dEdxHIPmassMin = conf_.getParameter<double>("dEdxHIPmassMin");
92  double dEdxHIPmassMax = conf_.getParameter<double>("dEdxHIPmassMax");
93 
94  int dEdxMIPmassBin = conf_.getParameter<int>( "dEdxMIPmassBin");
95  double dEdxMIPmassMin = conf_.getParameter<double>("dEdxMIPmassMin");
96  double dEdxMIPmassMax = conf_.getParameter<double>("dEdxMIPmassMax");
97 
98  dqmStore_->setCurrentFolder(MEFolderName);
99 
100  // book the Hit Property histograms
101  // ---------------------------------------------------------------------------------//
102 
103  if ( doDeDxPlots_ || doAllPlots_ ){
104  for(unsigned int i=0;i<dEdxInputList_.size();i++){
105  dqmStore_->setCurrentFolder(MEFolderName+"/"+ dEdxInputList_[i]);
106  dEdxMEsVector.push_back(dEdxMEs() );
107 
108  histname = "MIP_dEdxPerTrack_";
109  dEdxMEsVector[i].ME_MipDeDx = dqmStore_->book1D(histname, histname, dEdxBin, dEdxMin, dEdxMax);
110  dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("dEdx of each MIP Track (MeV/cm)");
111  dEdxMEsVector[i].ME_MipDeDx->setAxisTitle("Number of Tracks", 2);
112 
113  histname = "MIP_NumberOfdEdxHitsPerTrack_";
114  dEdxMEsVector[i].ME_MipDeDxNHits = dqmStore_->book1D(histname, histname, dEdxNHitBin, dEdxNHitMin, dEdxNHitMax);
115  dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of dEdxHits of each MIP Track");
116  dEdxMEsVector[i].ME_MipDeDxNHits->setAxisTitle("Number of Tracks", 2);
117 
118  histname = "MIP_FractionOfSaturateddEdxHitsPerTrack_";
119  dEdxMEsVector[i].ME_MipDeDxNSatHits = dqmStore_->book1D(histname, histname,2*dEdxNHitBin, 0, 1);
120  dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Fraction of Saturated dEdxHits of each MIP Track");
121  dEdxMEsVector[i].ME_MipDeDxNSatHits->setAxisTitle("Number of Tracks", 2);
122 
123  histname = "MIP_MassPerTrack_";
124  dEdxMEsVector[i].ME_MipDeDxMass = dqmStore_->book1D(histname, histname, dEdxMIPmassBin, dEdxMIPmassMin, dEdxMIPmassMax);
125  dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("dEdx Mass of each MIP Track (GeV/c^{2})");
126  dEdxMEsVector[i].ME_MipDeDxMass->setAxisTitle("Number of Tracks", 2);
127 
128  histname = "HIP_MassPerTrack_";
129  dEdxMEsVector[i].ME_HipDeDxMass = dqmStore_->book1D(histname, histname, dEdxHIPmassBin, dEdxHIPmassMin, dEdxHIPmassMax);
130  dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("dEdx Mass of each HIP Track (GeV/c^{2})");
131  dEdxMEsVector[i].ME_HipDeDxMass->setAxisTitle("Number of Tracks", 2);
132 
133  }
134  }
135 }
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
double dEdxC
Definition: dEdxAnalyzer.h:77
double TrackHitMin
Definition: dEdxAnalyzer.h:76
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:54
double dEdxK
Definition: dEdxAnalyzer.h:77
std::vector< std::string > dEdxInputList_
Definition: dEdxAnalyzer.h:82
bool doAllPlots_
Definition: dEdxAnalyzer.h:56
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:57
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:87
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:52
double HIPdEdxMin
Definition: dEdxAnalyzer.h:76
std::string histname
Definition: dEdxAnalyzer.h:88
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
void dEdxAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 192 of file dEdxAnalyzer.cc.

193 {
194 }
void dEdxAnalyzer::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 61 of file dEdxAnalyzer.cc.

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

62 {
63 
64  // Initialize the GenericTriggerEventFlag
65  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
66 }
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:90
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void dEdxAnalyzer::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 48 of file dEdxAnalyzer.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::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:54
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:52
void showDirStructure(void) const
Definition: DQMStore.cc:2961
void dEdxAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 198 of file dEdxAnalyzer.cc.

199 {
200 }
void dEdxAnalyzer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 204 of file dEdxAnalyzer.cc.

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

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

Definition at line 138 of file dEdxAnalyzer.cc.

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

Referenced by analyze().

138  {
139  if(I-dEdxC<0)return -1;
140  return sqrt((I-dEdxC)/dEdxK)*P;
141 }
double dEdxC
Definition: dEdxAnalyzer.h:77
#define P
double dEdxK
Definition: dEdxAnalyzer.h:77
T sqrt(T t)
Definition: SSEVec.h:48
const std::complex< double > I
Definition: I.h:8

Member Data Documentation

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

Definition at line 86 of file dEdxAnalyzer.h.

edm::ParameterSet dEdxAnalyzer::conf_
private

Definition at line 54 of file dEdxAnalyzer.h.

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

double dEdxAnalyzer::dEdxC
private

Definition at line 77 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

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

Definition at line 82 of file dEdxAnalyzer.h.

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

double dEdxAnalyzer::dEdxK
private

Definition at line 77 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

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

Definition at line 87 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

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

Definition at line 83 of file dEdxAnalyzer.h.

Referenced by analyze(), and dEdxAnalyzer().

bool dEdxAnalyzer::doAllPlots_
private

Definition at line 56 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

bool dEdxAnalyzer::doDeDxPlots_
private

Definition at line 57 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

DQMStore* dEdxAnalyzer::dqmStore_
private

Definition at line 52 of file dEdxAnalyzer.h.

Referenced by beginJob(), and endJob().

edm::ParameterSet dEdxAnalyzer::fullconf_
private

Definition at line 53 of file dEdxAnalyzer.h.

GenericTriggerEventFlag* dEdxAnalyzer::genTriggerEventFlag_
private

Definition at line 90 of file dEdxAnalyzer.h.

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

double dEdxAnalyzer::HIPdEdxMin
private

Definition at line 76 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string dEdxAnalyzer::histname
private

Definition at line 88 of file dEdxAnalyzer.h.

Referenced by beginJob().

double dEdxAnalyzer::TrackHitMin
private

Definition at line 76 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::InputTag dEdxAnalyzer::trackInputTag_
private

Definition at line 79 of file dEdxAnalyzer.h.

Referenced by dEdxAnalyzer().

std::string dEdxAnalyzer::TrackName
private

Definition at line 85 of file dEdxAnalyzer.h.

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

Definition at line 80 of file dEdxAnalyzer.h.

Referenced by analyze(), and dEdxAnalyzer().