CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
EventTimeDistribution Class Reference

#include <DPGAnalysis/SiStripTools/plugins/EventTimeDistribution.cc>

Inheritance diagram for EventTimeDistribution:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 EventTimeDistribution (const edm::ParameterSet &)
 
 ~EventTimeDistribution () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT< APVCyclePhaseCollection_apvphasecollToken
 
TH1F ** _bx
 
TH1F ** _bxincycle
 
TH2F ** _bxincyclevsbx
 
TH1F ** _dbx
 
TH2F ** _dbxvsbx
 
TH2F ** _dbxvsbxincycle
 
edm::EDGetTokenT< EventWithHistory_historyProductToken
 
unsigned int _nevents
 
TH1F ** _orbit
 
TH2F ** _orbitvsbxincycle
 
const std::string _phasepart
 
RunHistogramManager _rhm
 
const bool _wantbxincyclevsbx
 
const bool _wantdbxvsbx
 
const bool _wantdbxvsbxincycle
 
const bool _wantorbitvsbxincycle
 
std::vector< TH1F ** > m_dbxhistos
 
std::vector< std::pair< unsigned int, unsigned int > > m_dbxindices
 
TH1F ** m_ewhdepth
 
const bool m_ewhdepthHisto
 
const unsigned int m_LSfrac
 
const unsigned int m_maxLS
 

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 &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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 53 of file EventTimeDistribution.cc.

Constructor & Destructor Documentation

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

Definition at line 105 of file EventTimeDistribution.cc.

References _bx, _bxincycle, _bxincyclevsbx, _dbx, _dbxvsbx, _dbxvsbxincycle, _orbit, _orbitvsbxincycle, _rhm, _wantbxincyclevsbx, _wantdbxvsbx, _wantdbxvsbxincycle, _wantorbitvsbxincycle, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), LogDebug, m_dbxhistos, m_dbxindices, m_ewhdepth, m_ewhdepthHisto, m_LSfrac, m_maxLS, RunHistogramManager::makeTH1F(), RunHistogramManager::makeTH2F(), and CalibrationSummaryClient_cfi::params.

106  : _historyProductToken(consumes<EventWithHistory>(iConfig.getParameter<edm::InputTag>("historyProduct"))),
107  _apvphasecollToken(consumes<APVCyclePhaseCollection>(iConfig.getParameter<edm::InputTag>("apvPhaseCollection"))),
108  _phasepart(iConfig.getUntrackedParameter<std::string>("phasePartition", "None")),
109  _wantdbxvsbxincycle(iConfig.getUntrackedParameter<bool>("wantDBXvsBXincycle", false)),
110  _wantdbxvsbx(iConfig.getUntrackedParameter<bool>("wantDBXvsBX", false)),
111  _wantbxincyclevsbx(iConfig.getUntrackedParameter<bool>("wantBXincyclevsBX", false)),
112  _wantorbitvsbxincycle(iConfig.getUntrackedParameter<bool>("wantOrbitvsBXincycle", false)),
113  _nevents(0),
114  m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin", 100)),
115  m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction", 4)),
116  m_ewhdepthHisto(iConfig.getUntrackedParameter<bool>("wantEWHDepthHisto", false)),
118  _dbxvsbxincycle(nullptr),
119  _dbxvsbx(nullptr),
120  _bxincyclevsbx(nullptr),
121  _orbitvsbxincycle(nullptr),
122  m_ewhdepth(nullptr) {
123  //now do what ever initialization is needed
124 
125  std::vector<edm::ParameterSet> dbxhistoparams(iConfig.getUntrackedParameter<std::vector<edm::ParameterSet> >(
126  "dbxHistosParams", std::vector<edm::ParameterSet>()));
127 
128  for (std::vector<edm::ParameterSet>::const_iterator params = dbxhistoparams.begin(); params != dbxhistoparams.end();
129  ++params) {
130  m_dbxindices.push_back(std::pair<unsigned int, unsigned int>(params->getParameter<unsigned int>("firstEvent"),
131  params->getParameter<unsigned int>("secondEvent")));
132  char hname[300];
133  sprintf(hname,
134  "dbx_%d_%d",
135  params->getParameter<unsigned int>("firstEvent"),
136  params->getParameter<unsigned int>("secondEvent"));
137  char htitle[300];
138  sprintf(htitle,
139  "dbx(%d,%d)",
140  params->getParameter<unsigned int>("firstEvent"),
141  params->getParameter<unsigned int>("secondEvent"));
142 
143  m_dbxhistos.push_back(_rhm.makeTH1F(hname,
144  htitle,
145  params->getParameter<int>("nbins"),
146  params->getParameter<double>("min"),
147  params->getParameter<double>("max")));
148  LogDebug("DBXHistoPreBooking") << "Booked DBX histo named " << hname << " untitled " << htitle;
149  }
150 
151  _dbx = _rhm.makeTH1F("dbx", "dbx", 1000, -0.5, 999.5);
152  _bx = _rhm.makeTH1F("bx", "BX number", 3564, -0.5, 3563.5);
153  _bxincycle = _rhm.makeTH1F("bxcycle", "bxcycle", 70, -0.5, 69.5);
154  _orbit = _rhm.makeTH1F("orbit", "orbit", m_LSfrac * m_maxLS, 0, m_maxLS * 262144);
156  _dbxvsbxincycle = _rhm.makeTH2F("dbxvsbxincycle", "dbxvsbxincycle", 70, -0.5, 69.5, 1000, -0.5, 999.5);
157  if (_wantdbxvsbx)
158  _dbxvsbx = _rhm.makeTH2F("dbxvsbx", "dbxvsbx", 3564, -0.5, 3563.5, 1000, -0.5, 999.5);
159  if (_wantbxincyclevsbx)
160  _bxincyclevsbx = _rhm.makeTH2F("bxincyclevsbx", "bxincyclevsbx", 3564, -0.5, 3563.5, 70, -0.5, 69.5);
163  _rhm.makeTH2F("orbitvsbxincycle", "orbitvsbxincycle", 70, -0.5, 69.5, m_maxLS, 0, m_maxLS * 262144);
164  if (m_ewhdepthHisto)
165  m_ewhdepth = _rhm.makeTH1F("ewhdepth", "EventWithHistory Depth", 11, -0.5, 10.5);
166 
167  edm::LogInfo("UsedAPVCyclePhaseCollection")
168  << " APVCyclePhaseCollection " << iConfig.getParameter<edm::InputTag>("apvPhaseCollection") << " used";
169 }
#define LogDebug(id)
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
edm::EDGetTokenT< EventWithHistory > _historyProductToken
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
std::vector< std::pair< unsigned int, unsigned int > > m_dbxindices
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
const unsigned int m_LSfrac
RunHistogramManager _rhm
const std::string _phasepart
const unsigned int m_maxLS
TH2F ** makeTH2F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax, const unsigned int nbiny, const double ymin, const double ymax)
std::vector< TH1F ** > m_dbxhistos
EventTimeDistribution::~EventTimeDistribution ( )
override

Definition at line 171 of file EventTimeDistribution.cc.

171  {
172  // do anything here that needs to be done at desctruction time
173  // (e.g. close files, deallocate resources etc.)
174 }

Member Function Documentation

void EventTimeDistribution::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 181 of file EventTimeDistribution.cc.

References _apvphasecollToken, _bxincyclevsbx, _dbxvsbx, _dbxvsbxincycle, _historyProductToken, _nevents, _orbitvsbxincycle, _phasepart, EventWithHistory::absoluteBX(), edm::EventBase::bunchCrossing(), EventWithHistory::deltaBX(), EventWithHistory::depth(), edm::HandleBase::failedToGet(), HcalObjRepresent::Fill(), edm::Event::getByToken(), APVCyclePhaseCollection::getPhase(), hcalSimParameters_cfi::he, bTagCombinedSVVariables_cff::indices, APVCyclePhaseCollection::invalid, edm::HandleBase::isValid(), LogDebug, m_dbxhistos, m_dbxindices, m_ewhdepth, APVCyclePhaseCollection::multiphase, APVCyclePhaseCollection::nopartition, and edm::EventBase::orbitNumber().

181  {
182  using namespace edm;
183 
184  _nevents++;
185 
187  iEvent.getByToken(_historyProductToken, he);
188 
189  // improve the matchin between default and actual partitions
190 
191  (*_dbx)->Fill(he->deltaBX());
192  std::vector<std::pair<unsigned int, unsigned int> >::const_iterator indices = m_dbxindices.begin();
193  for (std::vector<TH1F**>::const_iterator dbxhist = m_dbxhistos.begin(); dbxhist != m_dbxhistos.end();
194  ++dbxhist, ++indices) {
195  (*(*dbxhist))->Fill(he->deltaBX(indices->first, indices->second));
196  }
197 
198  (*_bx)->Fill(iEvent.bunchCrossing() % 3564);
199  (*_orbit)->Fill(iEvent.orbitNumber());
200  if (_dbxvsbx && *_dbxvsbx)
201  (*_dbxvsbx)->Fill(iEvent.bunchCrossing() % 3564, he->deltaBX());
202  if (m_ewhdepth && *m_ewhdepth)
203  (*m_ewhdepth)->Fill(he->depth());
204 
206  iEvent.getByToken(_apvphasecollToken, apvphase);
207 
208  long long tbx = he->absoluteBX();
209  if (apvphase.isValid() && !apvphase.failedToGet()) {
210  const int thephase = apvphase->getPhase(_phasepart);
213  tbx -= thephase;
214  (*_bxincycle)->Fill(tbx % 70);
216  (*_dbxvsbxincycle)->Fill(tbx % 70, he->deltaBX());
218  (*_bxincyclevsbx)->Fill(iEvent.bunchCrossing() % 3564, tbx % 70);
220  (*_orbitvsbxincycle)->Fill(tbx % 70, iEvent.orbitNumber());
221 
222  } else {
223  LogDebug("InvalidPhase") << "Invalid APVCyclePhase value : " << _phasepart << " " << thephase;
224  }
225  }
226 }
#define LogDebug(id)
unsigned int depth() const
long long deltaBX(const unsigned int ev2, const unsigned int ev1) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
int bunchCrossing() const
Definition: EventBase.h:64
long long absoluteBX(const unsigned int ev1) const
edm::EDGetTokenT< APVCyclePhaseCollection > _apvphasecollToken
edm::EDGetTokenT< EventWithHistory > _historyProductToken
std::vector< std::pair< unsigned int, unsigned int > > m_dbxindices
const int getPhase(const std::string partition) const
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int orbitNumber() const
Definition: EventBase.h:65
bool isValid() const
Definition: HandleBase.h:70
const std::string _phasepart
bool failedToGet() const
Definition: HandleBase.h:72
HLT enums.
std::vector< TH1F ** > m_dbxhistos
void EventTimeDistribution::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 288 of file EventTimeDistribution.cc.

288 {}
void EventTimeDistribution::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 228 of file EventTimeDistribution.cc.

References _bx, _bxincycle, _bxincyclevsbx, _dbx, _dbxvsbx, _dbxvsbxincycle, _orbit, _orbitvsbxincycle, _rhm, RunHistogramManager::beginRun(), LogDebug, m_dbxhistos, and m_ewhdepth.

228  {
229  _rhm.beginRun(iRun);
230 
231  if (*_dbx) {
232  (*_dbx)->GetXaxis()->SetTitle("#DeltaBX");
233  }
234 
235  LogDebug("NomberOfHistos") << m_dbxhistos.size();
236  for (std::vector<TH1F**>::const_iterator dbxhist = m_dbxhistos.begin(); dbxhist != m_dbxhistos.end(); ++dbxhist) {
237  LogDebug("HistoPointer") << *dbxhist;
238  if (*(*dbxhist)) {
239  (*(*dbxhist))->GetXaxis()->SetTitle("#DeltaBX");
240  }
241  }
242  LogDebug("LabelDone") << "all labels set";
243 
244  if (*_bx) {
245  (*_bx)->GetXaxis()->SetTitle("BX");
246  }
247 
248  if (*_bxincycle) {
249  (*_bxincycle)->GetXaxis()->SetTitle("Event BX mod(70)");
250  }
251 
252  if (*_orbit) {
253  (*_orbit)->SetCanExtend(TH1::kXaxis);
254  (*_orbit)->GetXaxis()->SetTitle("time [Orb#]");
255  }
256 
257  LogDebug("StdPlotsDone") << "all labels in std plots set";
258 
260  (*_dbxvsbxincycle)->GetXaxis()->SetTitle("Event BX mod(70)");
261  (*_dbxvsbxincycle)->GetYaxis()->SetTitle("#DeltaBX");
262  }
263 
264  if (_dbxvsbx && *_dbxvsbx) {
265  (*_dbxvsbx)->GetXaxis()->SetTitle("BX");
266  (*_dbxvsbx)->GetYaxis()->SetTitle("#DeltaBX");
267  }
268 
269  if (_bxincyclevsbx && *_bxincyclevsbx) {
270  (*_bxincyclevsbx)->GetXaxis()->SetTitle("BX");
271  (*_bxincyclevsbx)->GetYaxis()->SetTitle("Event BX mod(70)");
272  }
273 
275  (*_orbitvsbxincycle)->SetCanExtend(TH1::kYaxis);
276  (*_orbitvsbxincycle)->GetXaxis()->SetTitle("Event BX mod(70)");
277  (*_orbitvsbxincycle)->GetYaxis()->SetTitle("time [Orb#]");
278  }
279 
280  if (m_ewhdepth && *m_ewhdepth) {
281  (*m_ewhdepth)->GetXaxis()->SetTitle("Depth");
282  }
283 }
#define LogDebug(id)
RunHistogramManager _rhm
void beginRun(const edm::Run &iRun)
std::vector< TH1F ** > m_dbxhistos
void EventTimeDistribution::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 291 of file EventTimeDistribution.cc.

References _nevents, and DEFINE_FWK_MODULE.

291 { edm::LogInfo("EndOfJob") << _nevents << " analyzed events"; }
void EventTimeDistribution::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 285 of file EventTimeDistribution.cc.

285 {}

Member Data Documentation

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

Definition at line 68 of file EventTimeDistribution.cc.

Referenced by analyze().

TH1F** EventTimeDistribution::_bx
private

Definition at line 84 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH1F** EventTimeDistribution::_bxincycle
private

Definition at line 85 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_bxincyclevsbx
private

Definition at line 89 of file EventTimeDistribution.cc.

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

TH1F** EventTimeDistribution::_dbx
private

Definition at line 81 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_dbxvsbx
private

Definition at line 88 of file EventTimeDistribution.cc.

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

TH2F** EventTimeDistribution::_dbxvsbxincycle
private

Definition at line 87 of file EventTimeDistribution.cc.

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

edm::EDGetTokenT<EventWithHistory> EventTimeDistribution::_historyProductToken
private

Definition at line 67 of file EventTimeDistribution.cc.

Referenced by analyze().

unsigned int EventTimeDistribution::_nevents
private

Definition at line 74 of file EventTimeDistribution.cc.

Referenced by analyze(), and endJob().

TH1F** EventTimeDistribution::_orbit
private

Definition at line 86 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_orbitvsbxincycle
private

Definition at line 90 of file EventTimeDistribution.cc.

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

const std::string EventTimeDistribution::_phasepart
private

Definition at line 69 of file EventTimeDistribution.cc.

Referenced by analyze().

RunHistogramManager EventTimeDistribution::_rhm
private

Definition at line 79 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

const bool EventTimeDistribution::_wantbxincyclevsbx
private

Definition at line 72 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantdbxvsbx
private

Definition at line 71 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantdbxvsbxincycle
private

Definition at line 70 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantorbitvsbxincycle
private

Definition at line 73 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

std::vector<TH1F**> EventTimeDistribution::m_dbxhistos
private

Definition at line 82 of file EventTimeDistribution.cc.

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

std::vector<std::pair<unsigned int, unsigned int> > EventTimeDistribution::m_dbxindices
private

Definition at line 83 of file EventTimeDistribution.cc.

Referenced by analyze(), and EventTimeDistribution().

TH1F** EventTimeDistribution::m_ewhdepth
private

Definition at line 91 of file EventTimeDistribution.cc.

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

const bool EventTimeDistribution::m_ewhdepthHisto
private

Definition at line 77 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const unsigned int EventTimeDistribution::m_LSfrac
private

Definition at line 76 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const unsigned int EventTimeDistribution::m_maxLS
private

Definition at line 75 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().