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
EventTimeDistribution Class Reference

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

Inheritance diagram for EventTimeDistribution:
edm::EDAnalyzer

Public Member Functions

 EventTimeDistribution (const edm::ParameterSet &)
 
 ~EventTimeDistribution ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Member Functions

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

Private Attributes

const edm::InputTag _apvphasecoll
 
const double _binsize
 
TH1F ** _bx
 
TH1F ** _bxincycle
 
TH2F ** _bxincyclevsbx
 
TH1F ** _dbx
 
TH2F ** _dbxvsbx
 
TH2F ** _dbxvsbxincycle
 
const edm::InputTag _historyProduct
 
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
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

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 102 of file EventTimeDistribution.cc.

References _apvphasecoll, _binsize, _bx, _bxincycle, _bxincyclevsbx, _dbx, _dbxvsbx, _dbxvsbxincycle, _orbit, _orbitvsbxincycle, _rhm, _wantbxincyclevsbx, _wantdbxvsbx, _wantdbxvsbxincycle, _wantorbitvsbxincycle, RunHistogramManager::makeTH1F(), and RunHistogramManager::makeTH2F().

102  :
103  _historyProduct(iConfig.getParameter<edm::InputTag>("historyProduct")),
104  _apvphasecoll(iConfig.getParameter<edm::InputTag>("apvPhaseCollection")),
105  _phasepart(iConfig.getUntrackedParameter<std::string>("phasePartition","None")),
106  _wantdbxvsbxincycle(iConfig.getUntrackedParameter<bool>("wantDBXvsBXincycle",false)),
107  _wantdbxvsbx(iConfig.getUntrackedParameter<bool>("wantDBXvsBX",false)),
108  _wantbxincyclevsbx(iConfig.getUntrackedParameter<bool>("wantBXincyclevsBX",false)),
109  _wantorbitvsbxincycle(iConfig.getUntrackedParameter<bool>("wantOrbitvsBXincycle",false)),
110  _nevents(0),
111  _binsize(iConfig.getUntrackedParameter<double>("minBinSizeInSec",1.)),
112  _rhm(),
114 {
115  //now do what ever initialization is needed
116 
117  _dbx = _rhm.makeTH1F("dbx","dbx",1000,-0.5,999.5);
118  _bx = _rhm.makeTH1F("bx","BX number",3564,-0.5,3563.5);
119  _bxincycle = _rhm.makeTH1F("bxcycle","bxcycle",70,-0.5,69.5);
120  _orbit = _rhm.makeTH1F("orbit","orbit",3600,0,11223*_binsize*3600);
121  if(_wantdbxvsbxincycle) _dbxvsbxincycle = _rhm.makeTH2F("dbxvsbxincycle","dbxvsbxincycle",70,-0.5,69.5,1000,-0.5,999.5);
122  if(_wantdbxvsbx) _dbxvsbx = _rhm.makeTH2F("dbxvsbx","dbxvsbx",3564,-0.5,3563.5,1000,-0.5,999.5);
123  if(_wantbxincyclevsbx) _bxincyclevsbx = _rhm.makeTH2F("bxincyclevsbx","bxincyclevsbx",3564,-0.5,3563.5,70,-0.5,69.5);
124  if(_wantorbitvsbxincycle) _orbitvsbxincycle = _rhm.makeTH2F("orbitvsbxincycle","orbitvsbxincycle",70,-0.5,69.5,3600,0,11223*_binsize*3600);
125 
126  edm::LogInfo("UsedAPVCyclePhaseCollection") << " APVCyclePhaseCollection " << _apvphasecoll << " used";
127 
128 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const edm::InputTag _apvphasecoll
TH1F ** makeTH1F(const char *name, const char *title, const unsigned int nbinx, const double xmin, const double xmax)
const edm::InputTag _historyProduct
RunHistogramManager _rhm
const std::string _phasepart
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)
EventTimeDistribution::~EventTimeDistribution ( )

Definition at line 131 of file EventTimeDistribution.cc.

132 {
133 
134  // do anything here that needs to be done at desctruction time
135  // (e.g. close files, deallocate resources etc.)
136 
137 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 146 of file EventTimeDistribution.cc.

References _apvphasecoll, _bxincyclevsbx, _dbxvsbx, _dbxvsbxincycle, _historyProduct, _nevents, _orbitvsbxincycle, _phasepart, edm::EventBase::bunchCrossing(), edm::Event::getByLabel(), APVCyclePhaseCollection::invalid, APVCyclePhaseCollection::multiphase, APVCyclePhaseCollection::nopartition, and edm::EventBase::orbitNumber().

147 {
148  using namespace edm;
149 
150  _nevents++;
151 
153  iEvent.getByLabel(_historyProduct,he);
154 
156  iEvent.getByLabel(_apvphasecoll,apvphase);
157 
158  long long tbx = he->absoluteBX();
159  if(apvphase.isValid() && !apvphase.failedToGet()) {
160  const int thephase = apvphase->getPhase(_phasepart);
161  if(thephase!=APVCyclePhaseCollection::invalid &&
164  tbx -= thephase;
165  }
166 
167 
168 
169  // improve the matchin between default and actual partitions
170 
171  (*_dbx)->Fill(he->deltaBX());
172  (*_bx)->Fill(iEvent.bunchCrossing());
173  (*_bxincycle)->Fill(tbx%70);
174  (*_orbit)->Fill(iEvent.orbitNumber());
175  if(_dbxvsbxincycle && *_dbxvsbxincycle) (*_dbxvsbxincycle)->Fill(tbx%70,he->deltaBX());
176  if(_dbxvsbx && *_dbxvsbx) (*_dbxvsbx)->Fill(iEvent.bunchCrossing(),he->deltaBX());
177  if(_bxincyclevsbx && *_bxincyclevsbx) (*_bxincyclevsbx)->Fill(iEvent.bunchCrossing(),tbx%70);
178  if(_orbitvsbxincycle && *_orbitvsbxincycle) (*_orbitvsbxincycle)->Fill(tbx%70,iEvent.orbitNumber());
179 
180 
181 }
const edm::InputTag _apvphasecoll
int bunchCrossing() const
Definition: EventBase.h:62
const edm::InputTag _historyProduct
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
const std::string _phasepart
void EventTimeDistribution::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 223 of file EventTimeDistribution.cc.

224 {
225 
226 }
void EventTimeDistribution::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 184 of file EventTimeDistribution.cc.

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

185 {
186 
187  _rhm.beginRun(iRun);
188  if(*_dbx) { (*_dbx)->GetXaxis()->SetTitle("#DeltaBX"); }
189 
190  if(*_bx) { (*_bx)->GetXaxis()->SetTitle("BX"); }
191 
192  if(*_bxincycle) { (*_bxincycle)->GetXaxis()->SetTitle("Event BX mod(70)"); }
193 
194  if(*_orbit) {
195  (*_orbit)->SetBit(TH1::kCanRebin);
196  (*_orbit)->GetXaxis()->SetTitle("time [Orb#]");
197  }
198 
200  (*_dbxvsbxincycle)->GetXaxis()->SetTitle("Event BX mod(70)"); (*_dbxvsbxincycle)->GetYaxis()->SetTitle("#DeltaBX");
201  }
202 
203  if(_dbxvsbx && *_dbxvsbx) { (*_dbxvsbx)->GetXaxis()->SetTitle("BX"); (*_dbxvsbx)->GetYaxis()->SetTitle("#DeltaBX"); }
204 
206  (*_bxincyclevsbx)->GetXaxis()->SetTitle("BX"); (*_bxincyclevsbx)->GetYaxis()->SetTitle("Event BX mod(70)");
207  }
208 
210  (*_orbitvsbxincycle)->SetBit(TH1::kCanRebin);
211  (*_orbitvsbxincycle)->GetXaxis()->SetTitle("Event BX mod(70)"); (*_orbitvsbxincycle)->GetYaxis()->SetTitle("time [Orb#]");
212  }
213 }
RunHistogramManager _rhm
void beginRun(const edm::Run &iRun)
void EventTimeDistribution::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 230 of file EventTimeDistribution.cc.

References _nevents.

230  {
231 
232  edm::LogInfo("EndOfJob") << _nevents << " analyzed events";
233 
234 }
void EventTimeDistribution::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 216 of file EventTimeDistribution.cc.

217 {
218 }

Member Data Documentation

const edm::InputTag EventTimeDistribution::_apvphasecoll
private

Definition at line 69 of file EventTimeDistribution.cc.

Referenced by analyze(), and EventTimeDistribution().

const double EventTimeDistribution::_binsize
private

Definition at line 76 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

TH1F** EventTimeDistribution::_bx
private

Definition at line 81 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH1F** EventTimeDistribution::_bxincycle
private

Definition at line 82 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_bxincyclevsbx
private

Definition at line 86 of file EventTimeDistribution.cc.

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

TH1F** EventTimeDistribution::_dbx
private

Definition at line 80 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_dbxvsbx
private

Definition at line 85 of file EventTimeDistribution.cc.

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

TH2F** EventTimeDistribution::_dbxvsbxincycle
private

Definition at line 84 of file EventTimeDistribution.cc.

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

const edm::InputTag EventTimeDistribution::_historyProduct
private

Definition at line 68 of file EventTimeDistribution.cc.

Referenced by analyze().

unsigned int EventTimeDistribution::_nevents
private

Definition at line 75 of file EventTimeDistribution.cc.

Referenced by analyze(), and endJob().

TH1F** EventTimeDistribution::_orbit
private

Definition at line 83 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

TH2F** EventTimeDistribution::_orbitvsbxincycle
private

Definition at line 87 of file EventTimeDistribution.cc.

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

const std::string EventTimeDistribution::_phasepart
private

Definition at line 70 of file EventTimeDistribution.cc.

Referenced by analyze().

RunHistogramManager EventTimeDistribution::_rhm
private

Definition at line 78 of file EventTimeDistribution.cc.

Referenced by beginRun(), and EventTimeDistribution().

const bool EventTimeDistribution::_wantbxincyclevsbx
private

Definition at line 73 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantdbxvsbx
private

Definition at line 72 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantdbxvsbxincycle
private

Definition at line 71 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().

const bool EventTimeDistribution::_wantorbitvsbxincycle
private

Definition at line 74 of file EventTimeDistribution.cc.

Referenced by EventTimeDistribution().