#include <DQM/TrackerMonitorTrack/interface/MonitorTrackResiduals.cc>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (void) |
virtual void | beginRun (edm::Run const &run, edm::EventSetup const &iSetup) |
void | createMEs (const edm::EventSetup &) |
virtual void | endJob (void) |
virtual void | endRun (const edm::Run &, const edm::EventSetup &) |
MonitorTrackResiduals (const edm::ParameterSet &) | |
void | resetLayerMEs (const std::pair< std::string, int32_t > &) |
void | resetModuleMEs (int32_t modid) |
~MonitorTrackResiduals () | |
Private Attributes | |
edm::ParameterSet | conf_ |
DQMStore * | dqmStore_ |
SiStripFolderOrganizer | folder_organizer |
GenericTriggerEventFlag * | genTriggerEventFlag_ |
HistoClass | HitResidual |
unsigned long long | m_cacheID_ |
std::map< std::pair < std::string, int32_t > , MonitorElement * > | m_SubdetLayerNormedResiduals |
std::map< std::pair < std::string, int32_t > , MonitorElement * > | m_SubdetLayerResiduals |
bool | ModOn |
HistoClass | NormedHitResiduals |
edm::ParameterSet | Parameters |
bool | reset_me_after_each_run |
Monitoring source for track residuals on each detector module
Definition at line 31 of file MonitorTrackResiduals.h.
MonitorTrackResiduals::MonitorTrackResiduals | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 28 of file MonitorTrackResiduals.cc.
: dqmStore_( edm::Service<DQMStore>().operator->() ) , conf_(iConfig), m_cacheID_(0) , genTriggerEventFlag_(new GenericTriggerEventFlag(iConfig)) { }
MonitorTrackResiduals::~MonitorTrackResiduals | ( | ) |
Definition at line 34 of file MonitorTrackResiduals.cc.
References genTriggerEventFlag_.
{ if (genTriggerEventFlag_) delete genTriggerEventFlag_; }
void MonitorTrackResiduals::analyze | ( | const edm::Event & | iEvent, |
const edm::EventSetup & | iSetup | ||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 173 of file MonitorTrackResiduals.cc.
References GenericTriggerEventFlag::accept(), conf_, TrackerValidationVariables::fillHitQuantities(), folder_organizer, genTriggerEventFlag_, SiStripFolderOrganizer::GetSubDetAndLayer(), HitResidual, m_SubdetLayerNormedResiduals, m_SubdetLayerResiduals, ModOn, NormedHitResiduals, GenericTriggerEventFlag::on(), and SiStripDetId::subDetector().
{ // Filter out events if Trigger Filtering is requested if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return; TrackerValidationVariables avalidator_(iSetup,conf_); std::vector<TrackerValidationVariables::AVHitStruct> v_hitstruct; avalidator_.fillHitQuantities(iEvent,v_hitstruct); for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator it = v_hitstruct.begin(), itEnd = v_hitstruct.end(); it != itEnd; ++it) { uint RawId = it->rawDetId; // fill if hit belongs to StripDetector and its error is not zero if( it->resXprimeErr != 0 && SiStripDetId(RawId).subDetector() != 0 ) { if (ModOn && HitResidual[RawId]) { HitResidual[RawId]->Fill(it->resXprime); NormedHitResiduals[RawId]->Fill(it->resXprime/it->resXprimeErr); } std::pair<std::string, int32_t> subdetandlayer = folder_organizer.GetSubDetAndLayer(RawId); if(m_SubdetLayerResiduals[subdetandlayer]) { m_SubdetLayerResiduals[subdetandlayer]->Fill(it->resXprime); m_SubdetLayerNormedResiduals[subdetandlayer]->Fill(it->resXprime/it->resXprimeErr); } } } }
void MonitorTrackResiduals::beginJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 39 of file MonitorTrackResiduals.cc.
References conf_, edm::ParameterSet::getParameter(), ModOn, and reset_me_after_each_run.
{ ModOn = conf_.getParameter<bool>("Mod_On"); reset_me_after_each_run = conf_.getParameter<bool>("ResetAfterRun"); }
void MonitorTrackResiduals::beginRun | ( | edm::Run const & | run, |
edm::EventSetup const & | iSetup | ||
) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 44 of file MonitorTrackResiduals.cc.
References createMEs(), folder_organizer, genTriggerEventFlag_, edm::EventSetup::get(), SiStripFolderOrganizer::GetSubDetAndLayer(), HitResidual, GenericTriggerEventFlag::initRun(), m_cacheID_, m_SubdetLayerResiduals, python::multivaluedict::map(), ModOn, GenericTriggerEventFlag::on(), reset_me_after_each_run, resetLayerMEs(), and resetModuleMEs().
{ unsigned long long cacheID = iSetup.get<SiStripDetCablingRcd>().cacheIdentifier(); if (m_cacheID_ != cacheID) { m_cacheID_ = cacheID; this->createMEs(iSetup); } if(reset_me_after_each_run) { if(ModOn) { for(std::map<int32_t, MonitorElement*>::const_iterator it = HitResidual.begin(), itEnd = HitResidual.end(); it!= itEnd;++it) { this->resetModuleMEs(it->first); this->resetLayerMEs(folder_organizer.GetSubDetAndLayer(it->first)); } } else { for(std::map< std::pair<std::string,int32_t>, MonitorElement*>::const_iterator it = m_SubdetLayerResiduals.begin(), itEnd = m_SubdetLayerResiduals.end(); it!= itEnd;++it) { this->resetLayerMEs(it->first); } } // end if-else Module level on } // end reset after run // Initialize the GenericTriggerEventFlag if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( run, iSetup ); }
void MonitorTrackResiduals::createMEs | ( | const edm::EventSetup & | iSetup | ) |
Definition at line 71 of file MonitorTrackResiduals.cc.
References abs, DQMStore::book1D(), conf_, dqmStore_, folder_organizer, edm::EventSetup::get(), edm::ParameterSet::getParameter(), SiStripFolderOrganizer::GetSubDetAndLayer(), HitResidual, m_SubdetLayerNormedResiduals, m_SubdetLayerResiduals, ModOn, NormedHitResiduals, MonitorElement::setAxisTitle(), SiStripFolderOrganizer::setDetectorFolder(), SiStripFolderOrganizer::setLayerFolder(), SiStripFolderOrganizer::setSiStripFolder(), and SiStripDetId::subDetector().
Referenced by beginRun().
{ Parameters = conf_.getParameter<edm::ParameterSet>("TH1ResModules"); int32_t i_residuals_Nbins = Parameters.getParameter<int32_t>("Nbinx"); double d_residual_xmin = Parameters.getParameter<double>("xmin"); double d_residual_xmax = Parameters.getParameter<double>("xmax"); Parameters = conf_.getParameter<edm::ParameterSet>("TH1NormResModules"); int32_t i_normres_Nbins = Parameters.getParameter<int32_t>("Nbinx"); double d_normres_xmin = Parameters.getParameter<double>("xmin"); double d_normres_xmax = Parameters.getParameter<double>("xmax"); // use SistripHistoId for producing histogram id (and title) SiStripHistoId hidmanager; folder_organizer.setSiStripFolder(); // top SiStrip folder // take from eventSetup the SiStripDetCabling object edm::ESHandle<SiStripDetCabling> tkmechstruct; iSetup.get<SiStripDetCablingRcd>().get(tkmechstruct); // get list of active detectors from SiStripDetCabling std::vector<uint32_t> activeDets; activeDets.clear(); // just in case tkmechstruct->addActiveDetectorsRawIds(activeDets); // use SiStripSubStructure for selecting certain regions SiStripSubStructure substructure; std::vector<uint32_t> DetIds = activeDets; // book histo per each detector module for (std::vector<uint32_t>::const_iterator DetItr=activeDets.begin(), DetItrEnd = activeDets.end(); DetItr!=DetItrEnd; ++DetItr) { uint ModuleID = (*DetItr); // is this a StripModule? if( SiStripDetId(ModuleID).subDetector() != 0 ) { folder_organizer.setDetectorFolder(ModuleID); // detid sets appropriate detector folder // Book module histogramms? if (ModOn) { std::string hid = hidmanager.createHistoId("HitResiduals","det",ModuleID); std::string normhid = hidmanager.createHistoId("NormalizedHitResiduals","det",ModuleID); HitResidual[ModuleID] = dqmStore_->book1D(hid, hid, i_residuals_Nbins,d_residual_xmin,d_residual_xmax); HitResidual[ModuleID]->setAxisTitle("(x_{pred} - x_{rec})' [cm]"); NormedHitResiduals[ModuleID] = dqmStore_->book1D(normhid, normhid, i_normres_Nbins,d_normres_xmin,d_normres_xmax); NormedHitResiduals[ModuleID]->setAxisTitle("(x_{pred} - x_{rec})'/#sigma"); } // book layer level histogramms std::pair<std::string,int32_t> subdetandlayer = folder_organizer.GetSubDetAndLayer(ModuleID); folder_organizer.setLayerFolder(ModuleID,subdetandlayer.second); if(! m_SubdetLayerResiduals[subdetandlayer ] ) { // book histogramms on layer level, check for barrel for correct labeling std::string histoname = Form(subdetandlayer.first.find("B") != std::string::npos ? "HitResiduals_%s__Layer__%d" : "HitResiduals_%s__wheel__%d" , subdetandlayer.first.c_str(),std::abs(subdetandlayer.second)); std::string normhistoname = Form(subdetandlayer.first.find("B") != std::string::npos ? "NormalizedHitResidual_%s__Layer__%d" : "NormalizedHitResidual_%s__wheel__%d" , subdetandlayer.first.c_str(),std::abs(subdetandlayer.second)); m_SubdetLayerResiduals[subdetandlayer] = dqmStore_->book1D(histoname.c_str(),histoname.c_str(), i_residuals_Nbins,d_residual_xmin,d_residual_xmax); m_SubdetLayerResiduals[subdetandlayer]->setAxisTitle("(x_{pred} - x_{rec})' [cm]"); m_SubdetLayerNormedResiduals[subdetandlayer] = dqmStore_->book1D(normhistoname.c_str(),normhistoname.c_str(), i_normres_Nbins,d_normres_xmin,d_normres_xmax); m_SubdetLayerNormedResiduals[subdetandlayer]->setAxisTitle("(x_{pred} - x_{rec})'/#sigma"); } } // end 'is strip module' } // end loop over activeDets }
void MonitorTrackResiduals::endJob | ( | void | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 162 of file MonitorTrackResiduals.cc.
References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, and DQMStore::save().
{ //dqmStore_->showDirStructure(); bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile"); std::string outputFileName = conf_.getParameter<std::string>("OutputFileName"); if(outputMEsInRootFile){ dqmStore_->save(outputFileName); } }
void MonitorTrackResiduals::endRun | ( | const edm::Run & | , |
const edm::EventSetup & | |||
) | [virtual] |
void MonitorTrackResiduals::resetLayerMEs | ( | const std::pair< std::string, int32_t > & | subdetandlayer | ) |
Definition at line 151 of file MonitorTrackResiduals.cc.
References m_SubdetLayerNormedResiduals, and m_SubdetLayerResiduals.
Referenced by beginRun().
{ m_SubdetLayerResiduals [subdetandlayer]->Reset(); m_SubdetLayerNormedResiduals[subdetandlayer]->Reset(); }
void MonitorTrackResiduals::resetModuleMEs | ( | int32_t | modid | ) |
Definition at line 146 of file MonitorTrackResiduals.cc.
References HitResidual, and NormedHitResiduals.
Referenced by beginRun().
{ HitResidual[modid]->Reset(); NormedHitResiduals[modid]->Reset(); }
Definition at line 48 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginJob(), createMEs(), and endJob().
DQMStore* MonitorTrackResiduals::dqmStore_ [private] |
Definition at line 47 of file MonitorTrackResiduals.h.
Referenced by createMEs(), and endJob().
Definition at line 54 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginRun(), and createMEs().
Definition at line 58 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginRun(), and ~MonitorTrackResiduals().
HistoClass MonitorTrackResiduals::HitResidual [private] |
Definition at line 52 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginRun(), createMEs(), and resetModuleMEs().
unsigned long long MonitorTrackResiduals::m_cacheID_ [private] |
Definition at line 55 of file MonitorTrackResiduals.h.
Referenced by beginRun().
std::map< std::pair<std::string,int32_t>, MonitorElement* > MonitorTrackResiduals::m_SubdetLayerNormedResiduals [private] |
Definition at line 51 of file MonitorTrackResiduals.h.
Referenced by analyze(), createMEs(), and resetLayerMEs().
std::map< std::pair<std::string,int32_t>, MonitorElement* > MonitorTrackResiduals::m_SubdetLayerResiduals [private] |
Definition at line 50 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginRun(), createMEs(), and resetLayerMEs().
bool MonitorTrackResiduals::ModOn [private] |
Definition at line 57 of file MonitorTrackResiduals.h.
Referenced by analyze(), beginJob(), beginRun(), and createMEs().
Definition at line 53 of file MonitorTrackResiduals.h.
Referenced by analyze(), createMEs(), and resetModuleMEs().
Definition at line 49 of file MonitorTrackResiduals.h.
bool MonitorTrackResiduals::reset_me_after_each_run [private] |
Definition at line 56 of file MonitorTrackResiduals.h.
Referenced by beginJob(), and beginRun().