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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
double dEdxK
 
std::vector< dEdxMEsdEdxMEsVector
 
bool doAllPlots_
 
bool doDeDxPlots_
 
DQMStoredqmStore_
 
edm::ParameterSet fullconf_
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
double HIPdEdxMin
 
std::string histname
 
double TrackHitMin
 
std::string TrackName
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Protected Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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 27 of file dEdxAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 28 of file dEdxAnalyzer.cc.

30  , fullconf_( iConfig )
31  , conf_ (fullconf_.getParameter<edm::ParameterSet>("dEdxParameters") )
32  , doAllPlots_ ( conf_.getParameter<bool>("doAllPlots") )
33  , doDeDxPlots_ ( conf_.getParameter<bool>("doDeDxPlots") )
35 {
36 }
T getParameter(std::string const &) const
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:48
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:78
edm::ParameterSet fullconf_
Definition: dEdxAnalyzer.h:47
bool doAllPlots_
Definition: dEdxAnalyzer.h:50
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:51
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:46
dEdxAnalyzer::~dEdxAnalyzer ( )

Definition at line 38 of file dEdxAnalyzer.cc.

References genTriggerEventFlag_.

39 {
40 
42 }
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:78

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(), AlgoNames, dEdxMEsVector, doAllPlots_, doDeDxPlots_, genTriggerEventFlag_, edm::Event::getByLabel(), reco::TrackBase::highPurity, HIPdEdxMin, i, edm::HandleBase::isValid(), mass(), GenericTriggerEventFlag::on(), edm::Handle< T >::product(), lumiQTWidget::t, TrackHitMin, and TrackName.

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  if(!trackCollectionHandle.isValid())return;
156 
157 
158  for(unsigned int i=0;i<AlgoNames.size();i++){
159  edm::Handle<reco::DeDxDataValueMap> dEdxObjectHandle;
160  iEvent.getByLabel(AlgoNames[i],dEdxObjectHandle);
161  if(!dEdxObjectHandle.isValid())continue;
162  const edm::ValueMap<reco::DeDxData> dEdxColl = *dEdxObjectHandle.product();
163 
164 
165  for(unsigned int t=0; t<trackCollectionHandle->size(); t++){
166  reco::TrackRef track = reco::TrackRef( trackCollectionHandle, t );
167 
168 
169  if(track->quality(reco::TrackBase::highPurity) ) {
170  //MIPs
171  if( track->pt() >= 5.0 && track->numberOfValidHits()>TrackHitMin){
172  dEdxMEsVector[i].ME_MipDeDx ->Fill(dEdxColl[track].dEdx());
173  dEdxMEsVector[i].ME_MipDeDxNHits ->Fill(dEdxColl[track].numberOfMeasurements());
174  if (dEdxColl[track].numberOfMeasurements()!=0)
175  dEdxMEsVector[i].ME_MipDeDxNSatHits->Fill((1.0*dEdxColl[track].numberOfSaturatedMeasurements())/dEdxColl[track].numberOfMeasurements());
176  dEdxMEsVector[i].ME_MipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
177 
178  //HighlyIonizing particles
179  }else if(track->pt()<2 && dEdxColl[track].dEdx()>HIPdEdxMin){
180  dEdxMEsVector[i].ME_HipDeDxMass ->Fill(mass(track->p(), dEdxColl[track].dEdx()));
181  }
182  }
183  }
184  }
185  }
186 }
int i
Definition: DBlmapReader.cc:9
double TrackHitMin
Definition: dEdxAnalyzer.h:70
std::vector< std::string > AlgoNames
Definition: dEdxAnalyzer.h:74
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:78
bool doAllPlots_
Definition: dEdxAnalyzer.h:50
bool isValid() const
Definition: HandleBase.h:76
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:51
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:75
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:74
double HIPdEdxMin
Definition: dEdxAnalyzer.h:70
std::string TrackName
Definition: dEdxAnalyzer.h:73
void dEdxAnalyzer::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file dEdxAnalyzer.cc.

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

68 {
69  // parameters from the configuration
70  AlgoNames = conf_.getParameter<std::vector<std::string> >("deDxProducers");
71  TrackName = conf_.getParameter<std::string>("TracksForDeDx");
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<AlgoNames.size();i++){
105  dqmStore_->setCurrentFolder(MEFolderName+"/"+ AlgoNames[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:722
double dEdxC
Definition: dEdxAnalyzer.h:71
double TrackHitMin
Definition: dEdxAnalyzer.h:70
std::vector< std::string > AlgoNames
Definition: dEdxAnalyzer.h:74
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:48
double dEdxK
Definition: dEdxAnalyzer.h:71
bool doAllPlots_
Definition: dEdxAnalyzer.h:50
bool doDeDxPlots_
Definition: dEdxAnalyzer.h:51
std::vector< dEdxMEs > dEdxMEsVector
Definition: dEdxAnalyzer.h:75
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:46
double HIPdEdxMin
Definition: dEdxAnalyzer.h:70
std::string histname
Definition: dEdxAnalyzer.h:76
std::string TrackName
Definition: dEdxAnalyzer.h:73
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:434
void dEdxAnalyzer::beginLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file dEdxAnalyzer.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file dEdxAnalyzer.cc.

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

60 {
61 
62  // Initialize the GenericTriggerEventFlag
63  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( iRun, iSetup );
64 }
GenericTriggerEventFlag * genTriggerEventFlag_
Definition: dEdxAnalyzer.h:78
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 46 of file dEdxAnalyzer.cc.

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

47 {
48  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
50  if(outputMEsInRootFile)
51  {
53  dqmStore_->save(outputFileName);
54  }
55 }
T getParameter(std::string const &) const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2118
edm::ParameterSet conf_
Definition: dEdxAnalyzer.h:48
DQMStore * dqmStore_
Definition: dEdxAnalyzer.h:46
void showDirStructure(void) const
Definition: DQMStore.cc:2766
void dEdxAnalyzer::endLuminosityBlock ( edm::LuminosityBlock const &  ,
edm::EventSetup const &   
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 197 of file dEdxAnalyzer.cc.

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

Definition at line 203 of file dEdxAnalyzer.cc.

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

203  {
204  //The following says we do not know what parameters are allowed so do no validation
205  // Please change this to state exactly what you do use, even if it is no parameters
207  desc.setUnknown();
208  descriptions.addDefault(desc);
209 }
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:71
#define P
double dEdxK
Definition: dEdxAnalyzer.h:71
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 74 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

edm::ParameterSet dEdxAnalyzer::conf_
private

Definition at line 48 of file dEdxAnalyzer.h.

Referenced by beginJob(), and endJob().

double dEdxAnalyzer::dEdxC
private

Definition at line 71 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

double dEdxAnalyzer::dEdxK
private

Definition at line 71 of file dEdxAnalyzer.h.

Referenced by beginJob(), and mass().

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

Definition at line 75 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

bool dEdxAnalyzer::doAllPlots_
private

Definition at line 50 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

bool dEdxAnalyzer::doDeDxPlots_
private

Definition at line 51 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

DQMStore* dEdxAnalyzer::dqmStore_
private

Definition at line 46 of file dEdxAnalyzer.h.

Referenced by beginJob(), and endJob().

edm::ParameterSet dEdxAnalyzer::fullconf_
private

Definition at line 47 of file dEdxAnalyzer.h.

GenericTriggerEventFlag* dEdxAnalyzer::genTriggerEventFlag_
private

Definition at line 78 of file dEdxAnalyzer.h.

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

double dEdxAnalyzer::HIPdEdxMin
private

Definition at line 70 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string dEdxAnalyzer::histname
private

Definition at line 76 of file dEdxAnalyzer.h.

Referenced by beginJob().

double dEdxAnalyzer::TrackHitMin
private

Definition at line 70 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string dEdxAnalyzer::TrackName
private

Definition at line 73 of file dEdxAnalyzer.h.

Referenced by analyze(), and beginJob().