#include <DPGAnalysis/SiStripTools/plugins/APVCyclePhaseMonitor.cc>
Public Member Functions | |
APVCyclePhaseMonitor (const edm::ParameterSet &) | |
~APVCyclePhaseMonitor () | |
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 |
const unsigned int | m_LSfrac |
const unsigned int | m_maxLS |
RunHistogramManager | m_rhm |
Description: <one line="" class="" summary>="">
Implementation: <Notes on="" implementation>="">
Definition at line 51 of file APVCyclePhaseMonitor.cc.
APVCyclePhaseMonitor::APVCyclePhaseMonitor | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 93 of file APVCyclePhaseMonitor.cc.
References _apvphasecollection, _hselectedphases, _hselectedphasessize, _hselectedphasesvector, _hselectedphasevectorvsorbit, _hselectedphasevsorbit, _selectedparts, _selectedvectorparts, m_LSfrac, m_maxLS, m_rhm, RunHistogramManager::makeTH1F(), and RunHistogramManager::makeTProfile().
: _apvphasecollection(iConfig.getParameter<edm::InputTag>("apvCyclePhaseCollection")), _selectedparts(iConfig.getUntrackedParameter<std::vector<std::string> >("selectedPartitions",std::vector<std::string>())), _selectedvectorparts(iConfig.getUntrackedParameter<std::vector<std::string> >("selectedVectorPartitions",std::vector<std::string>())), m_maxLS(iConfig.getUntrackedParameter<unsigned int>("maxLSBeforeRebin",125)), m_LSfrac(iConfig.getUntrackedParameter<unsigned int>("startingLSFraction",16)), _hphases(),_hselectedphases(),_hselectedphasesvector(),_hselectedphasessize(), _hphasevsorbit(),_hselectedphasevsorbit(),_hselectedphasevectorvsorbit(), _nevents(0) { //now do what ever initialization is needed edm::LogInfo("UsedAPVCyclePhaseCollection") << " APVCyclePhaseCollection " << _apvphasecollection << " used"; for(std::vector<std::string>::const_iterator part=_selectedparts.begin();part!=_selectedparts.end();++part) { char hname[300]; sprintf(hname,"selected_phase_%s",part->c_str()); edm::LogInfo("SelectedTH1FBeingBooked") << "TH1F " << hname << " being booked" ; _hselectedphases[*part] = m_rhm.makeTH1F(hname,hname,70,-0.5,69.5); sprintf(hname,"selected_phasevsorbit_%s",part->c_str()); edm::LogInfo("SelectedTProfileBeingBooked") << "TProfile " << hname << " being booked" ; _hselectedphasevsorbit[*part] = m_rhm.makeTProfile(hname,hname,m_LSfrac*m_maxLS,0,m_maxLS*262144); } for(std::vector<std::string>::const_iterator part=_selectedvectorparts.begin(); part!=_selectedvectorparts.end();++part) { char hname[300]; sprintf(hname,"selected_phase_vector_%s",part->c_str()); edm::LogInfo("SelectedVectTH1FBeingBooked") << "TH1F " << hname << " being booked" ; _hselectedphasesvector[*part] = m_rhm.makeTH1F(hname,hname,70,-0.5,69.5); sprintf(hname,"selected_phase_size_%s",part->c_str()); edm::LogInfo("SelectedVectSizeTH1FBeingBooked") << "TH1F " << hname << " being booked" ; _hselectedphasessize[*part] = m_rhm.makeTH1F(hname,hname,10,-0.5,9.5); sprintf(hname,"selected_phasevectorvsorbit_%s",part->c_str()); edm::LogInfo("SelectedVectTProfileBeingBooked") << "TProfile " << hname << " being booked" ; _hselectedphasevectorvsorbit[*part] = m_rhm.makeTProfile(hname,hname,m_LSfrac*m_maxLS,0,m_maxLS*262144); } }
APVCyclePhaseMonitor::~APVCyclePhaseMonitor | ( | ) |
Definition at line 142 of file APVCyclePhaseMonitor.cc.
{ // do anything here that needs to be done at desctruction time // (e.g. close files, deallocate resources etc.) }
void APVCyclePhaseMonitor::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [private, virtual] |
Implements edm::EDAnalyzer.
Definition at line 157 of file APVCyclePhaseMonitor.cc.
References _apvphasecollection, _hphases, _hphasevsorbit, _hselectedphases, _hselectedphasessize, _hselectedphasesvector, _hselectedphasevectorvsorbit, _hselectedphasevsorbit, _nevents, _selectedparts, _selectedvectorparts, HcalObjRepresent::Fill(), edm::Event::getByLabel(), m_LSfrac, m_maxLS, TFileDirectory::mkdir(), edm::EventBase::orbitNumber(), and edm::Event::run().
{ using namespace edm; _nevents++; edm::Handle<APVCyclePhaseCollection> apvphases; iEvent.getByLabel(_apvphasecollection,apvphases); // improve the matchin between default and actual partitions edm::Service<TFileService> tfserv; for(std::map<std::string,int>::const_iterator phase = apvphases->get().begin(); phase != apvphases->get().end(); ++phase) { if(_hphases.find(phase->first)==_hphases.end()) { char dirname[300]; sprintf(dirname,"run_%d",iEvent.run()); TFileDirectory subrun = tfserv->mkdir(dirname); char hname[300]; sprintf(hname,"phase_%s",phase->first.c_str()); edm::LogInfo("TH1FBeingBooked") << "TH1F " << hname << " being booked" ; _hphases[phase->first] = subrun.make<TH1F>(hname,hname,70,-0.5,69.5); _hphases[phase->first]->GetXaxis()->SetTitle("BX mod 70"); _hphases[phase->first]->GetYaxis()->SetTitle("Events"); sprintf(hname,"phasevsorbit_%s",phase->first.c_str()); edm::LogInfo("TProfileBeingBooked") << "TProfile " << hname << " being booked" ; _hphasevsorbit[phase->first] = subrun.make<TProfile>(hname,hname,m_LSfrac*m_maxLS,0,m_maxLS*262144); _hphasevsorbit[phase->first]->SetBit(TH1::kCanRebin); _hphasevsorbit[phase->first]->GetXaxis()->SetTitle("time [orbit#]"); _hphasevsorbit[phase->first]->GetYaxis()->SetTitle("Phase"); } _hphases[phase->first]->Fill(phase->second); _hphasevsorbit[phase->first]->Fill(iEvent.orbitNumber(),phase->second); } // selected partitions for(std::vector<std::string>::const_iterator part=_selectedparts.begin();part!=_selectedparts.end();++part) { if(_hselectedphases.find(*part)!=_hselectedphases.end() && _hselectedphases[*part] && *_hselectedphases[*part]) { (*_hselectedphases[*part])->Fill(apvphases->getPhase(*part)); } if(_hselectedphasevsorbit.find(*part)!=_hselectedphasevsorbit.end() && _hselectedphasevsorbit[*part] && *_hselectedphasevsorbit[*part]) { (*_hselectedphasevsorbit[*part])->Fill(iEvent.orbitNumber(),apvphases->getPhase(*part)); } } for(std::vector<std::string>::const_iterator part=_selectedvectorparts.begin(); part!=_selectedvectorparts.end();++part) { const std::vector<int> phases = apvphases->getPhases(*part); if(_hselectedphasessize.find(*part)!=_hselectedphasessize.end() && _hselectedphasessize[*part] && *_hselectedphasessize[*part]) { (*_hselectedphasessize[*part])->Fill(phases.size()); } for(std::vector<int>::const_iterator phase=phases.begin();phase!=phases.end();++phase) { if(_hselectedphasesvector.find(*part)!=_hselectedphasesvector.end() && _hselectedphasesvector[*part] && *_hselectedphasesvector[*part]) { (*_hselectedphasesvector[*part])->Fill(*phase); } if(_hselectedphasevectorvsorbit.find(*part)!=_hselectedphasevectorvsorbit.end() && _hselectedphasevectorvsorbit[*part] && *_hselectedphasevectorvsorbit[*part]) { (*_hselectedphasevectorvsorbit[*part])->Fill(iEvent.orbitNumber(),*phase); } } } }
void APVCyclePhaseMonitor::beginJob | ( | void | ) | [private, virtual] |
void APVCyclePhaseMonitor::beginRun | ( | const edm::Run & | iRun, |
const edm::EventSetup & | |||
) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 229 of file APVCyclePhaseMonitor.cc.
References _hphases, _hphasevsorbit, _hselectedphases, _hselectedphasessize, _hselectedphasesvector, _hselectedphasevectorvsorbit, _hselectedphasevsorbit, RunHistogramManager::beginRun(), estimatePileup::hist, and m_rhm.
{ _hphases.clear(); _hphasevsorbit.clear(); m_rhm.beginRun(iRun); for(std::map<std::string,TH1F**>::const_iterator hist=_hselectedphases.begin();hist!=_hselectedphases.end();++hist) { if(*(hist->second)) { (*(hist->second))->GetXaxis()->SetTitle("BX mod 70"); (*(hist->second))->GetYaxis()->SetTitle("Events"); } } for(std::map<std::string,TProfile**>::const_iterator prof=_hselectedphasevsorbit.begin();prof!=_hselectedphasevsorbit.end();++prof) { if(*(prof->second)) { (*(prof->second))->SetBit(TH1::kCanRebin); (*(prof->second))->GetXaxis()->SetTitle("time [orbit#]"); (*(prof->second))->GetYaxis()->SetTitle("Phase"); } } for(std::map<std::string,TH1F**>::const_iterator hist=_hselectedphasesvector.begin();hist!=_hselectedphasesvector.end();++hist) { if(*(hist->second)) { (*(hist->second))->GetXaxis()->SetTitle("BX mod 70"); (*(hist->second))->GetYaxis()->SetTitle("Events"); } } for(std::map<std::string,TH1F**>::const_iterator hist=_hselectedphasessize.begin();hist!=_hselectedphasessize.end();++hist) { if(*(hist->second)) { (*(hist->second))->GetXaxis()->SetTitle("Number of Phases"); (*(hist->second))->GetYaxis()->SetTitle("Events"); } } for(std::map<std::string,TProfile**>::const_iterator prof=_hselectedphasevectorvsorbit.begin();prof!=_hselectedphasevectorvsorbit.end();++prof) { if(*(prof->second)) { (*(prof->second))->SetBit(TH1::kCanRebin); (*(prof->second))->GetXaxis()->SetTitle("time [orbit#]"); (*(prof->second))->GetYaxis()->SetTitle("Phase"); } } }
void APVCyclePhaseMonitor::endJob | ( | void | ) | [private, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 284 of file APVCyclePhaseMonitor.cc.
References _nevents.
{ edm::LogInfo("EndOfJob") << _nevents << " analyzed events"; }
void APVCyclePhaseMonitor::endRun | ( | const edm::Run & | iRun, |
const edm::EventSetup & | |||
) | [private, virtual] |
const edm::InputTag APVCyclePhaseMonitor::_apvphasecollection [private] |
Definition at line 66 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and APVCyclePhaseMonitor().
std::map<std::string,TH1F*> APVCyclePhaseMonitor::_hphases [private] |
Definition at line 72 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and beginRun().
std::map<std::string,TProfile*> APVCyclePhaseMonitor::_hphasevsorbit [private] |
Definition at line 76 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and beginRun().
std::map<std::string,TH1F**> APVCyclePhaseMonitor::_hselectedphases [private] |
Definition at line 73 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), APVCyclePhaseMonitor(), and beginRun().
std::map<std::string,TH1F**> APVCyclePhaseMonitor::_hselectedphasessize [private] |
Definition at line 75 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), APVCyclePhaseMonitor(), and beginRun().
std::map<std::string,TH1F**> APVCyclePhaseMonitor::_hselectedphasesvector [private] |
Definition at line 74 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), APVCyclePhaseMonitor(), and beginRun().
std::map<std::string,TProfile**> APVCyclePhaseMonitor::_hselectedphasevectorvsorbit [private] |
Definition at line 78 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), APVCyclePhaseMonitor(), and beginRun().
std::map<std::string,TProfile**> APVCyclePhaseMonitor::_hselectedphasevsorbit [private] |
Definition at line 77 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), APVCyclePhaseMonitor(), and beginRun().
unsigned int APVCyclePhaseMonitor::_nevents [private] |
Definition at line 79 of file APVCyclePhaseMonitor.cc.
std::vector<std::string> APVCyclePhaseMonitor::_selectedparts [private] |
Definition at line 67 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and APVCyclePhaseMonitor().
std::vector<std::string> APVCyclePhaseMonitor::_selectedvectorparts [private] |
Definition at line 68 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and APVCyclePhaseMonitor().
const unsigned int APVCyclePhaseMonitor::m_LSfrac [private] |
Definition at line 70 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and APVCyclePhaseMonitor().
const unsigned int APVCyclePhaseMonitor::m_maxLS [private] |
Definition at line 69 of file APVCyclePhaseMonitor.cc.
Referenced by analyze(), and APVCyclePhaseMonitor().
Definition at line 71 of file APVCyclePhaseMonitor.cc.
Referenced by APVCyclePhaseMonitor(), and beginRun().