CMS 3D CMS Logo

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

#include <DPGAnalysis/SiStripTools/src/MultiplicityTimeCorrelations.cc>

Inheritance diagram for MultiplicityTimeCorrelations:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 MultiplicityTimeCorrelations (const edm::ParameterSet &)
 
 ~MultiplicityTimeCorrelations ()
 
- 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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endJob () override
 

Private Attributes

edm::EDGetTokenT
< APVCyclePhaseCollection
_apvphasecollToken
 
std::map< unsigned int, int > _binmax
 
std::vector< int > _dbxbins
 
std::map< int, std::map
< unsigned int, TH1F * > > 
_dbxhistos
 
DigiBXCorrHistogramMaker
< EventWithHistory
_digibxcorrhmevent
 
EventWithHistoryFilter _evfilter
 
edm::InputTag _hecollection
 
edm::EDGetTokenT
< EventWithHistory
_hecollectionToken
 
int _highorbit
 
int _loworbit
 
int _mindbx
 
int _mintrpltdbx
 
edm::EDGetTokenT< std::map
< unsigned int, int > > 
_multiplicityMapToken
 
std::map< unsigned int,
std::string > 
_subdets
 
SiStripTKNumbers _trnumb
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- 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

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 61 of file MultiplicityTimeCorrelations.cc.

Constructor & Destructor Documentation

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

Definition at line 117 of file MultiplicityTimeCorrelations.cc.

References _binmax, _dbxbins, _dbxhistos, _digibxcorrhmevent, _evfilter, _hecollection, _mindbx, _mintrpltdbx, _subdets, _trnumb, edm::ParameterSet::addUntrackedParameter(), newFWLiteAna::bin, DigiBXCorrHistogramMaker< T >::book(), edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getUntrackedParameter(), HLT_FULL_cff::labels, LogDebug, TFileDirectory::make(), TFileService::mkdir(), SiStripTKNumbers::nstrips(), EventWithHistoryFilter::set(), and AlCaHLTBitMon_QueryRunRegistry::string.

117  :
119  _evfilter(),
120  _hecollection(iConfig.getParameter<edm::InputTag>("historyProduct")),
121  _hecollectionToken(consumes<EventWithHistory>(_hecollection)),
122  _apvphasecollToken(consumes<APVCyclePhaseCollection>(iConfig.getParameter<edm::InputTag>("apvPhaseCollection"))),
123  _multiplicityMapToken(mayConsume<std::map<unsigned int, int> >(iConfig.getParameter<edm::InputTag>("multiplicityMap"))),
124  _subdets(),
125  _binmax(),
126  _loworbit(iConfig.getUntrackedParameter<int>("lowedgeOrbit")),
127  _highorbit(iConfig.getUntrackedParameter<int>("highedgeOrbit")),
128  _mindbx(iConfig.getUntrackedParameter<int>("minDBX")),
129  _mintrpltdbx(iConfig.getUntrackedParameter<int>("minTripletDBX")),
130  _trnumb(),
131  _dbxbins(iConfig.getUntrackedParameter<std::vector<int> >("dbxBins"))
132 {
133  //now do what ever initialization is needed
134 
135  // configure the filter
136 
137  edm::ParameterSet filterConfig;
138  filterConfig.addUntrackedParameter<edm::InputTag>("historyProduct",_hecollection);
139  if(_mindbx>0) {
140  std::vector<int> dbxrange;
141  dbxrange.push_back(_mindbx+1);
142  dbxrange.push_back(-1);
143  filterConfig.addUntrackedParameter<std::vector<int> >("dbxRange",dbxrange);
144  }
145  if(_mintrpltdbx>0) {
146  std::vector<int> dbxtrpltrange;
147  dbxtrpltrange.push_back(_mintrpltdbx+1);
148  dbxtrpltrange.push_back(-1);
149  filterConfig.addUntrackedParameter<std::vector<int> >("dbxTripletRange",dbxtrpltrange);
150  }
151 
152  _evfilter.set(filterConfig, consumesCollector());
153 
154  //
155 
157 
158  // create map of labels
159 
160  std::vector<edm::ParameterSet> wantedsubds(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >("wantedSubDets"));
161 
162  for(std::vector<edm::ParameterSet>::iterator ps=wantedsubds.begin();ps!=wantedsubds.end();++ps) {
163  _subdets[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<std::string>("detLabel");
164  _binmax[ps->getParameter<unsigned int>("detSelection")] = ps->getParameter<int>("binMax");
165  }
166  std::map<int,std::string> labels;
167 
168  for(std::map<unsigned int,std::string>::const_iterator subd=_subdets.begin();subd!=_subdets.end();++subd) {
169  labels[int(subd->first)] = subd->second;
170  }
171 
172  //
173 
174  _digibxcorrhmevent.book("EventProcs",labels);
175 
176  TFileDirectory subdbxbin = tfserv->mkdir("DBXDebugging");
177 
178  for(std::vector<int>::const_iterator bin=_dbxbins.begin();bin!=_dbxbins.end();bin++) {
179  char hname[200]; char htitle[200];
180 
181  edm::LogInfo("DBXHistosBinMaxValue") << "Setting bin max values";
182 
183  for(std::map<unsigned int, std::string>::const_iterator subd=_subdets.begin();subd!=_subdets.end();++subd) {
184  if(_binmax.find(subd->first)==_binmax.end()) {
185  edm::LogVerbatim("DBXHistosNotConfiguredBinMax") << "Bin max for " << subd->second
186  << " not configured: " << _trnumb.nstrips(int(subd->first)) << " used";
187  _binmax[subd->first] = _trnumb.nstrips(int(subd->first));
188  }
189 
190  edm::LogVerbatim("DBXHistosBinMaxValue") << "Bin max for " << subd->second << " is " << _binmax[subd->first];
191 
192 
193 
194  sprintf(hname,"sumn%sdigi_%d",subd->second.c_str(),*bin);
195  sprintf(htitle,"%s digi multiplicity at DBX = %d",subd->second.c_str(),*bin);
196  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
197  _dbxhistos[*bin][subd->first]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_binmax[subd->first]/(20*1000)*1000);
198  _dbxhistos[*bin][subd->first]->GetXaxis()->SetTitle("Number of Digis");
199  }
200  /*
201  sprintf(hname,"sumntkdigi_%d",*bin);
202  sprintf(htitle,"TK digi multiplicity at DBX = %d",*bin);
203  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
204  _dbxtkhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(0)/(20*1000)*1000);
205  _dbxtkhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
206 
207  sprintf(hname,"sumntibdigi_%d",*bin);
208  sprintf(htitle,"TIB digi multiplicity at DBX = %d",*bin);
209  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
210  _dbxtibhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TIB)/(20*1000)*1000);
211  _dbxtibhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
212 
213  sprintf(hname,"sumntiddigi_%d",*bin);
214  sprintf(htitle,"TID digi multiplicity at DBX = %d",*bin);
215  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
216  _dbxtidhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TID)/(20*1000)*1000);
217  _dbxtidhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
218 
219  sprintf(hname,"sumntobdigi_%d",*bin);
220  sprintf(htitle,"TOB digi multiplicity at DBX = %d",*bin);
221  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
222  _dbxtobhistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TOB)/(20*1000)*1000);
223  _dbxtobhistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
224 
225  sprintf(hname,"sumntecdigi_%d",*bin);
226  sprintf(htitle,"TEC digi multiplicity at DBX = %d",*bin);
227  LogDebug("DBXDebug") << "creating histogram " << hname << " " << htitle;
228  _dbxtechistos[*bin]= subdbxbin.make<TH1F>(hname,htitle,1000,0.,_trnumb.nstrips(SiStripDetId::TEC)/(20*1000)*1000);
229  _dbxtechistos[*bin]->GetXaxis()->SetTitle("Number of Digis");
230  */
231  }
232 
233 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::map< unsigned int, int > _binmax
DigiBXCorrHistogramMaker< EventWithHistory > _digibxcorrhmevent
std::map< unsigned int, std::string > _subdets
std::map< int, std::map< unsigned int, TH1F * > > _dbxhistos
int nstrips(const SiStripDetId &detid) const
void set(const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC)
void book(const char *dirname, const std::map< int, std::string > &labels)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< EventWithHistory > _hecollectionToken
T * make(const Args &...args) const
make new ROOT object
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
Definition: TFileService.h:69
edm::EDGetTokenT< std::map< unsigned int, int > > _multiplicityMapToken
void addUntrackedParameter(std::string const &name, T const &value)
Definition: ParameterSet.h:208
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
EDGetTokenT< ProductType > mayConsume(edm::InputTag const &tag)
MultiplicityTimeCorrelations::~MultiplicityTimeCorrelations ( )

Definition at line 236 of file MultiplicityTimeCorrelations.cc.

237 {
238 
239  // do anything here that needs to be done at desctruction time
240  // (e.g. close files, deallocate resources etc.)
241 
242 }

Member Function Documentation

void MultiplicityTimeCorrelations::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 251 of file MultiplicityTimeCorrelations.cc.

References _apvphasecollToken, _dbxhistos, _digibxcorrhmevent, _evfilter, _hecollectionToken, _highorbit, _loworbit, _multiplicityMapToken, _subdets, DigiBXCorrHistogramMaker< T >::fill(), edm::Event::getByToken(), VarParsing::mult, edm::EventBase::orbitNumber(), and EventWithHistoryFilter::selected().

252 {
253  using namespace edm;
254 
255  // get Phase
256 
258  iEvent.getByToken(_apvphasecollToken,apvphase);
259 
260  // get HE
261 
263  iEvent.getByToken(_hecollectionToken,he);
264 
265  // check if the event is selected
266 
267  if((_loworbit < 0 || iEvent.orbitNumber() >= _loworbit) &&
268  (_highorbit < 0 || iEvent.orbitNumber() <= _highorbit)) {
269 
270  if(_evfilter.selected(iEvent,iSetup)) {
271 
272 
273  //Compute digi multiplicity
274  /*
275  int ntkdigi=0;
276  int ntibdigi=0;
277  int ntiddigi=0;
278  int ntobdigi=0;
279  int ntecdigi=0;
280  */
282  iEvent.getByToken(_multiplicityMapToken,mults);
283 
284  // create map of digi multiplicity
285 
286  std::map<int,int> digimap;
287  for(std::map<unsigned int, int>::const_iterator mult=mults->begin();mult!=mults->end();++mult) {
288  if(_subdets.find(mult->first)!=_subdets.end()) digimap[int(mult->first)] = mult->second;
289  }
290 
291  _digibxcorrhmevent.fill(*he,digimap,apvphase);
292 
293  // fill debug histos
294 
295  if(he->depth()!=0) {
296 
297  long long dbx = he->deltaBX();
298 
299  if(_dbxhistos.find(dbx)!=_dbxhistos.end()) {
300  for(std::map<unsigned int,int>::const_iterator ndigi=mults->begin();ndigi!=mults->end();++ndigi) {
301  _dbxhistos[dbx][ndigi->first]->Fill(ndigi->second);
302  }
303  }
304  if(_dbxhistos.find(-1)!=_dbxhistos.end()) {
305  for(std::map<unsigned int,int>::const_iterator ndigi=mults->begin();ndigi!=mults->end();++ndigi) {
306  _dbxhistos[-1][ndigi->first]->Fill(ndigi->second);
307  }
308  }
309  /*
310  if(_dbxtkhistos.find(dbx)!=_dbxtkhistos.end()) {
311  _dbxtkhistos[dbx]->Fill(ntkdigi);
312  }
313  if(_dbxtkhistos.find(-1)!=_dbxtkhistos.end()) {
314  _dbxtkhistos[-1]->Fill(ntkdigi);
315  }
316 
317  if(_dbxtibhistos.find(dbx)!=_dbxtibhistos.end()) {
318  _dbxtibhistos[dbx]->Fill(ntibdigi);
319  }
320  if(_dbxtibhistos.find(-1)!=_dbxtibhistos.end()) {
321  _dbxtibhistos[-1]->Fill(ntibdigi);
322  }
323 
324  if(_dbxtidhistos.find(dbx)!=_dbxtidhistos.end()) {
325  _dbxtidhistos[dbx]->Fill(ntiddigi);
326  }
327  if(_dbxtidhistos.find(-1)!=_dbxtidhistos.end()) {
328  _dbxtidhistos[-1]->Fill(ntiddigi);
329  }
330  if(_dbxtobhistos.find(dbx)!=_dbxtobhistos.end()) {
331  _dbxtobhistos[dbx]->Fill(ntobdigi);
332  }
333  if(_dbxtobhistos.find(-1)!=_dbxtobhistos.end()) {
334  _dbxtobhistos[-1]->Fill(ntobdigi);
335  }
336  if(_dbxtechistos.find(dbx)!=_dbxtechistos.end()) {
337  _dbxtechistos[dbx]->Fill(ntecdigi);
338  }
339  if(_dbxtechistos.find(-1)!=_dbxtechistos.end()) {
340  _dbxtechistos[-1]->Fill(ntecdigi);
341  }
342  */
343  }
344  }
345  }
346 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
DigiBXCorrHistogramMaker< EventWithHistory > _digibxcorrhmevent
std::map< unsigned int, std::string > _subdets
std::map< int, std::map< unsigned int, TH1F * > > _dbxhistos
edm::EDGetTokenT< EventWithHistory > _hecollectionToken
int orbitNumber() const
Definition: EventBase.h:66
const bool selected(const EventWithHistory &he, const edm::EventSetup &iSetup) const
edm::EDGetTokenT< std::map< unsigned int, int > > _multiplicityMapToken
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
void fill(const T &he, const std::map< int, int > &ndigi, const edm::Handle< APVCyclePhaseCollection > &phase)
void MultiplicityTimeCorrelations::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 351 of file MultiplicityTimeCorrelations.cc.

References _highorbit, _loworbit, and LogDebug.

352 {
353 
354  LogDebug("IntegerDebug") << " int max and min " << INT_MIN << " " << INT_MAX;
355  LogDebug("IntegerDebug") << " uint max and min " << UINT_MAX;
356  LogDebug("IntegerDebug") << " long max and min " << LONG_MIN << " " << LONG_MAX;
357  LogDebug("IntegerDebug") << " ulong max and min " << ULONG_MAX;
358  LogDebug("IntegerDebug") << " long long max and min " << LLONG_MIN << " " << LLONG_MAX;
359  LogDebug("IntegerDebug") << " u long long max and min " << ULLONG_MAX;
360 
361 
362  edm::LogInfo("MultiplicityTimeCorrelations") << " Correlation studies performed only in the orbit # range " << _loworbit << " " << _highorbit ;
363 
364 }
#define LogDebug(id)
void MultiplicityTimeCorrelations::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 367 of file MultiplicityTimeCorrelations.cc.

References _digibxcorrhmevent, DigiBXCorrHistogramMaker< T >::beginRun(), and edm::RunBase::run().

367  {
368 
370 
371 }
RunNumber_t run() const
Definition: RunBase.h:40
DigiBXCorrHistogramMaker< EventWithHistory > _digibxcorrhmevent
void beginRun(const unsigned int nrun)
void MultiplicityTimeCorrelations::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 374 of file MultiplicityTimeCorrelations.cc.

374  {
375 }

Member Data Documentation

edm::EDGetTokenT<APVCyclePhaseCollection> MultiplicityTimeCorrelations::_apvphasecollToken
private

Definition at line 89 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze().

std::map<unsigned int, int> MultiplicityTimeCorrelations::_binmax
private

Definition at line 92 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

std::vector<int> MultiplicityTimeCorrelations::_dbxbins
private

Definition at line 102 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

std::map<int,std::map<unsigned int,TH1F*> > MultiplicityTimeCorrelations::_dbxhistos
private

Definition at line 78 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

DigiBXCorrHistogramMaker<EventWithHistory> MultiplicityTimeCorrelations::_digibxcorrhmevent
private

Definition at line 75 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), beginRun(), and MultiplicityTimeCorrelations().

EventWithHistoryFilter MultiplicityTimeCorrelations::_evfilter
private

Definition at line 76 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

edm::InputTag MultiplicityTimeCorrelations::_hecollection
private

Definition at line 87 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

edm::EDGetTokenT<EventWithHistory> MultiplicityTimeCorrelations::_hecollectionToken
private

Definition at line 88 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze().

int MultiplicityTimeCorrelations::_highorbit
private

Definition at line 95 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and beginJob().

int MultiplicityTimeCorrelations::_loworbit
private

Definition at line 94 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and beginJob().

int MultiplicityTimeCorrelations::_mindbx
private

Definition at line 97 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

int MultiplicityTimeCorrelations::_mintrpltdbx
private

Definition at line 98 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().

edm::EDGetTokenT<std::map<unsigned int, int> > MultiplicityTimeCorrelations::_multiplicityMapToken
private

Definition at line 90 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze().

std::map<unsigned int, std::string> MultiplicityTimeCorrelations::_subdets
private

Definition at line 91 of file MultiplicityTimeCorrelations.cc.

Referenced by analyze(), and MultiplicityTimeCorrelations().

SiStripTKNumbers MultiplicityTimeCorrelations::_trnumb
private

Definition at line 100 of file MultiplicityTimeCorrelations.cc.

Referenced by MultiplicityTimeCorrelations().