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

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

Inheritance diagram for APVCyclePhaseMonitor:
edm::EDAnalyzer

Public Member Functions

 APVCyclePhaseMonitor (const edm::ParameterSet &)
 
 ~APVCyclePhaseMonitor ()
 
- 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 _apvphasecollection
 
std::map< std::string, TH1F * > _hphases
 
std::map< std::string, TProfile * > _hphasevsorbit
 
std::map< std::string, TH1F * > _hselectedphases
 
std::map< std::string, TH1F * > _hselectedphasessize
 
std::map< std::string, TH1F * > _hselectedphasesvector
 
std::map< std::string, TProfile * > _hselectedphasevectorvsorbit
 
std::map< std::string, TProfile * > _hselectedphasevsorbit
 
unsigned int _nevents
 
std::vector< std::string > _selectedparts
 
std::vector< std::string > _selectedvectorparts
 

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 49 of file APVCyclePhaseMonitor.cc.

Constructor & Destructor Documentation

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

Definition at line 88 of file APVCyclePhaseMonitor.cc.

References _apvphasecollection.

88  :
89  _apvphasecollection(iConfig.getParameter<edm::InputTag>("apvCyclePhaseCollection")),
90  _selectedparts(iConfig.getUntrackedParameter<std::vector<std::string> >("selectedPartitions",std::vector<std::string>())),
91  _selectedvectorparts(iConfig.getUntrackedParameter<std::vector<std::string> >("selectedVectorPartitions",std::vector<std::string>())),
94  _nevents(0)
95 {
96  //now do what ever initialization is needed
97 
98  edm::LogInfo("UsedAPVCyclePhaseCollection") << " APVCyclePhaseCollection " << _apvphasecollection << " used";
99 
100 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::vector< std::string > _selectedparts
std::map< std::string, TH1F * > _hselectedphasessize
std::map< std::string, TH1F * > _hselectedphasesvector
std::map< std::string, TH1F * > _hphases
std::vector< std::string > _selectedvectorparts
std::map< std::string, TProfile * > _hselectedphasevsorbit
const edm::InputTag _apvphasecollection
std::map< std::string, TProfile * > _hphasevsorbit
std::map< std::string, TProfile * > _hselectedphasevectorvsorbit
std::map< std::string, TH1F * > _hselectedphases
APVCyclePhaseMonitor::~APVCyclePhaseMonitor ( )

Definition at line 103 of file APVCyclePhaseMonitor.cc.

104 {
105 
106  // do anything here that needs to be done at desctruction time
107  // (e.g. close files, deallocate resources etc.)
108 
109 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 118 of file APVCyclePhaseMonitor.cc.

References _apvphasecollection, _hphases, _hphasevsorbit, _hselectedphases, _hselectedphasessize, _hselectedphasesvector, _hselectedphasevectorvsorbit, _hselectedphasevsorbit, _nevents, _selectedparts, _selectedvectorparts, edm::Event::getByLabel(), TFileDirectory::mkdir(), edm::EventBase::orbitNumber(), and edm::Event::run().

119 {
120  using namespace edm;
121 
122  _nevents++;
123 
125  iEvent.getByLabel(_apvphasecollection,apvphases);
126 
127  // improve the matchin between default and actual partitions
128 
130 
131  for(std::map<std::string,int>::const_iterator phase = apvphases->get().begin(); phase != apvphases->get().end(); ++phase) {
132 
133  if(_hphases.find(phase->first)==_hphases.end()) {
134  char dirname[300];
135  sprintf(dirname,"run_%d",iEvent.run());
136  TFileDirectory subrun = tfserv->mkdir(dirname);
137 
138  char hname[300];
139 
140  sprintf(hname,"phase_%s",phase->first.c_str());
141  edm::LogInfo("TH1FBeingBooked") << "TH1F " << hname << " being booked" ;
142  _hphases[phase->first] = subrun.make<TH1F>(hname,hname,70,-0.5,69.5);
143  _hphases[phase->first]->GetXaxis()->SetTitle("BX mod 70"); _hphases[phase->first]->GetYaxis()->SetTitle("Events");
144 
145  sprintf(hname,"phasevsorbit_%s",phase->first.c_str());
146  edm::LogInfo("TProfileBeingBooked") << "TProfile " << hname << " being booked" ;
147  _hphasevsorbit[phase->first] = subrun.make<TProfile>(hname,hname,1800,0.,1800*11223);
148  _hphasevsorbit[phase->first]->SetBit(TH1::kCanRebin);
149  _hphasevsorbit[phase->first]->GetXaxis()->SetTitle("time [orbit#]"); _hphasevsorbit[phase->first]->GetYaxis()->SetTitle("Phase");
150 
151  }
152  _hphases[phase->first]->Fill(phase->second);
153  _hphasevsorbit[phase->first]->Fill(iEvent.orbitNumber(),phase->second);
154  }
155 
156  // selected partitions
157 
158  for(std::vector<std::string>::const_iterator part=_selectedparts.begin();part!=_selectedparts.end();++part) {
159  if(_hselectedphases.find(*part)!=_hselectedphases.end()) {
160  _hselectedphases[*part]->Fill(apvphases->getPhase(*part));
161  }
163  _hselectedphasevsorbit[*part]->Fill(iEvent.orbitNumber(),apvphases->getPhase(*part));
164  }
165  }
166 
167  for(std::vector<std::string>::const_iterator part=_selectedvectorparts.begin();
168  part!=_selectedvectorparts.end();++part) {
169 
170  const std::vector<int> phases = apvphases->getPhases(*part);
171 
173  _hselectedphasessize[*part]->Fill(phases.size());
174  }
175 
176  for(std::vector<int>::const_iterator phase=phases.begin();phase!=phases.end();++phase) {
178  _hselectedphasesvector[*part]->Fill(*phase);
179  }
181  _hselectedphasevectorvsorbit[*part]->Fill(iEvent.orbitNumber(),*phase);
182  }
183  }
184 
185  }
186 }
std::vector< std::string > _selectedparts
std::map< std::string, TH1F * > _hselectedphasessize
std::map< std::string, TH1F * > _hselectedphasesvector
std::map< std::string, TH1F * > _hphases
RunNumber_t run() const
Definition: Event.h:66
int orbitNumber() const
Definition: EventBase.h:63
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::vector< std::string > _selectedvectorparts
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
part
Definition: HCALResponse.h:21
std::map< std::string, TProfile * > _hselectedphasevsorbit
const edm::InputTag _apvphasecollection
std::map< std::string, TProfile * > _hphasevsorbit
std::map< std::string, TProfile * > _hselectedphasevectorvsorbit
std::map< std::string, TH1F * > _hselectedphases
void APVCyclePhaseMonitor::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 257 of file APVCyclePhaseMonitor.cc.

258 {
259 
260 }
void APVCyclePhaseMonitor::beginRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file APVCyclePhaseMonitor.cc.

References _hphases, _hphasevsorbit, _hselectedphases, _hselectedphasessize, _hselectedphasesvector, _hselectedphasevectorvsorbit, _hselectedphasevsorbit, _selectedparts, _selectedvectorparts, TFileDirectory::mkdir(), and edm::RunBase::run().

190 {
191 
192  _hphases.clear();
193  _hselectedphases.clear();
194  _hselectedphasesvector.clear();
195  _hselectedphasessize.clear();
196  _hphasevsorbit.clear();
197  _hselectedphasevsorbit.clear();
199 
201 
202  char dirname[300];
203  sprintf(dirname,"run_%d",iRun.run());
204  TFileDirectory subrun = tfserv->mkdir(dirname);
205 
206  for(std::vector<std::string>::const_iterator part=_selectedparts.begin();part!=_selectedparts.end();++part) {
207 
208  char hname[300];
209 
210  sprintf(hname,"selected_phase_%s",part->c_str());
211  edm::LogInfo("SelectedTH1FBeingBooked") << "TH1F " << hname << " being booked" ;
212  _hselectedphases[*part] = subrun.make<TH1F>(hname,hname,70,-0.5,69.5);
213  _hselectedphases[*part]->GetXaxis()->SetTitle("BX mod 70"); _hselectedphases[*part]->GetYaxis()->SetTitle("Events");
214 
215  sprintf(hname,"selected_phasevsorbit_%s",part->c_str());
216  edm::LogInfo("SelectedTProfileBeingBooked") << "TProfile " << hname << " being booked" ;
217  _hselectedphasevsorbit[*part] = subrun.make<TProfile>(hname,hname,1800,0.,1800*11223);
218  _hselectedphasevsorbit[*part]->SetBit(TH1::kCanRebin);
219  _hselectedphasevsorbit[*part]->GetXaxis()->SetTitle("time [orbit#]");
220  _hselectedphasevsorbit[*part]->GetYaxis()->SetTitle("Phase");
221  }
222 
223  for(std::vector<std::string>::const_iterator part=_selectedvectorparts.begin();
224  part!=_selectedvectorparts.end();++part) {
225 
226  char hname[300];
227 
228  sprintf(hname,"selected_phase_vector_%s",part->c_str());
229  edm::LogInfo("SelectedVectTH1FBeingBooked") << "TH1F " << hname << " being booked" ;
230  _hselectedphasesvector[*part] = subrun.make<TH1F>(hname,hname,70,-0.5,69.5);
231  _hselectedphasesvector[*part]->GetXaxis()->SetTitle("BX mod 70");
232  _hselectedphasesvector[*part]->GetYaxis()->SetTitle("Events");
233 
234  sprintf(hname,"selected_phase_size_%s",part->c_str());
235  edm::LogInfo("SelectedVectSizeTH1FBeingBooked") << "TH1F " << hname << " being booked" ;
236  _hselectedphasessize[*part] = subrun.make<TH1F>(hname,hname,10,-0.5,9.5);
237  _hselectedphasessize[*part]->GetXaxis()->SetTitle("Number of Phases");
238  _hselectedphasessize[*part]->GetYaxis()->SetTitle("Events");
239 
240  sprintf(hname,"selected_phasevectorvsorbit_%s",part->c_str());
241  edm::LogInfo("SelectedVectTProfileBeingBooked") << "TProfile " << hname << " being booked" ;
242  _hselectedphasevectorvsorbit[*part] = subrun.make<TProfile>(hname,hname,1800,0.,1800*11223);
243  _hselectedphasevectorvsorbit[*part]->SetBit(TH1::kCanRebin);
244  _hselectedphasevectorvsorbit[*part]->GetXaxis()->SetTitle("time [orbit#]");
245  _hselectedphasevectorvsorbit[*part]->GetYaxis()->SetTitle("Phase");
246  }
247 }
std::vector< std::string > _selectedparts
RunNumber_t run() const
Definition: RunBase.h:44
std::map< std::string, TH1F * > _hselectedphasessize
std::map< std::string, TH1F * > _hselectedphasesvector
std::map< std::string, TH1F * > _hphases
std::vector< std::string > _selectedvectorparts
TFileDirectory mkdir(const std::string &dir, const std::string &descr="")
create a new subdirectory
part
Definition: HCALResponse.h:21
std::map< std::string, TProfile * > _hselectedphasevsorbit
std::map< std::string, TProfile * > _hphasevsorbit
std::map< std::string, TProfile * > _hselectedphasevectorvsorbit
std::map< std::string, TH1F * > _hselectedphases
void APVCyclePhaseMonitor::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 264 of file APVCyclePhaseMonitor.cc.

References _nevents.

264  {
265 
266  edm::LogInfo("EndOfJob") << _nevents << " analyzed events";
267 
268 }
void APVCyclePhaseMonitor::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 250 of file APVCyclePhaseMonitor.cc.

251 {
252 }

Member Data Documentation

const edm::InputTag APVCyclePhaseMonitor::_apvphasecollection
private

Definition at line 64 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and APVCyclePhaseMonitor().

std::map<std::string,TH1F*> APVCyclePhaseMonitor::_hphases
private

Definition at line 67 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TProfile*> APVCyclePhaseMonitor::_hphasevsorbit
private

Definition at line 71 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TH1F*> APVCyclePhaseMonitor::_hselectedphases
private

Definition at line 68 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TH1F*> APVCyclePhaseMonitor::_hselectedphasessize
private

Definition at line 70 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TH1F*> APVCyclePhaseMonitor::_hselectedphasesvector
private

Definition at line 69 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TProfile*> APVCyclePhaseMonitor::_hselectedphasevectorvsorbit
private

Definition at line 73 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::map<std::string,TProfile*> APVCyclePhaseMonitor::_hselectedphasevsorbit
private

Definition at line 72 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

unsigned int APVCyclePhaseMonitor::_nevents
private

Definition at line 74 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and endJob().

std::vector<std::string> APVCyclePhaseMonitor::_selectedparts
private

Definition at line 65 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().

std::vector<std::string> APVCyclePhaseMonitor::_selectedvectorparts
private

Definition at line 66 of file APVCyclePhaseMonitor.cc.

Referenced by analyze(), and beginRun().