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 Attributes
MonitorTrackResiduals Class Reference

#include <DQM/TrackerMonitorTrack/interface/MonitorTrackResiduals.cc>

Inheritance diagram for MonitorTrackResiduals:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void createMEs (DQMStore::IBooker &, const edm::EventSetup &)
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob (void)
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
 MonitorTrackResiduals (const edm::ParameterSet &)
 
 ~MonitorTrackResiduals ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

TrackerValidationVariables avalidator_
 
edm::ParameterSet conf_
 
DQMStoredqmStore_
 
SiStripFolderOrganizer folder_organizer
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
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
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 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

Monitoring source for track residuals on each detector module

Definition at line 31 of file MonitorTrackResiduals.h.

Constructor & Destructor Documentation

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

Definition at line 24 of file MonitorTrackResiduals.cc.

References conf_, edm::ParameterSet::getParameter(), and ModOn.

26  , conf_(iConfig), m_cacheID_(0)
28  , avalidator_(iConfig, consumesCollector()) {
29  ModOn = conf_.getParameter<bool>("Mod_On");
30 }
T getParameter(std::string const &) const
unsigned long long m_cacheID_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
TrackerValidationVariables avalidator_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
GenericTriggerEventFlag * genTriggerEventFlag_
MonitorTrackResiduals::~MonitorTrackResiduals ( )

Definition at line 32 of file MonitorTrackResiduals.cc.

References genTriggerEventFlag_.

32  {
34 }
GenericTriggerEventFlag * genTriggerEventFlag_

Member Function Documentation

void MonitorTrackResiduals::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 151 of file MonitorTrackResiduals.cc.

References GenericTriggerEventFlag::accept(), avalidator_, TrackerValidationVariables::fillHitQuantities(), folder_organizer, genTriggerEventFlag_, edm::EventSetup::get(), SiStripFolderOrganizer::GetSubDetAndLayer(), HitResidual, m_SubdetLayerNormedResiduals, m_SubdetLayerResiduals, ModOn, NormedHitResiduals, GenericTriggerEventFlag::on(), edm::ESHandle< class >::product(), and SiStripDetId::subDetector().

151  {
152 
153  // Filter out events if Trigger Filtering is requested
154  if (genTriggerEventFlag_->on()&& ! genTriggerEventFlag_->accept( iEvent, iSetup) ) return;
155 
156  //Retrieve tracker topology from geometry
157  edm::ESHandle<TrackerTopology> tTopoHandle;
158  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
159  const TrackerTopology* const tTopo = tTopoHandle.product();
160 
161  std::vector<TrackerValidationVariables::AVHitStruct> v_hitstruct;
162  avalidator_.fillHitQuantities(iEvent,v_hitstruct);
163  for (std::vector<TrackerValidationVariables::AVHitStruct>::const_iterator it = v_hitstruct.begin(),
164  itEnd = v_hitstruct.end(); it != itEnd; ++it) {
165  uint RawId = it->rawDetId;
166 
167  // fill if hit belongs to StripDetector and its error is not zero
168  if( it->resXprimeErr != 0 && SiStripDetId(RawId).subDetector() != 0 ) {
169  if (ModOn && HitResidual[RawId]) {
170  HitResidual[RawId]->Fill(it->resXprime);
171  NormedHitResiduals[RawId]->Fill(it->resXprime/it->resXprimeErr);
172  }
173  std::pair<std::string, int32_t> subdetandlayer = folder_organizer.GetSubDetAndLayer(RawId, tTopo);
174  if(m_SubdetLayerResiduals[subdetandlayer]) {
175  m_SubdetLayerResiduals[subdetandlayer]->Fill(it->resXprime);
176  m_SubdetLayerNormedResiduals[subdetandlayer]->Fill(it->resXprime/it->resXprimeErr);
177  }
178  }
179  }
180 
181 }
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
void fillHitQuantities(const Trajectory *trajectory, std::vector< AVHitStruct > &v_avhitout)
SiStripFolderOrganizer folder_organizer
TrackerValidationVariables avalidator_
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
std::map< std::pair< std::string, int32_t >, MonitorElement * > m_SubdetLayerNormedResiduals
GenericTriggerEventFlag * genTriggerEventFlag_
std::map< std::pair< std::string, int32_t >, MonitorElement * > m_SubdetLayerResiduals
void MonitorTrackResiduals::beginJob ( void  )
virtual

Definition at line 37 of file MonitorTrackResiduals.cc.

37  {
38 }
void MonitorTrackResiduals::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 40 of file MonitorTrackResiduals.cc.

References createMEs(), edm::EventSetup::get(), and m_cacheID_.

41 {
42  unsigned long long cacheID = iSetup.get<SiStripDetCablingRcd>().cacheIdentifier();
43  if (m_cacheID_ != cacheID) {
44  m_cacheID_ = cacheID;
45  this->createMEs( ibooker , iSetup);
46  }
47 }
unsigned long long m_cacheID_
void createMEs(DQMStore::IBooker &, const edm::EventSetup &)
void MonitorTrackResiduals::createMEs ( DQMStore::IBooker ibooker,
const edm::EventSetup iSetup 
)

Definition at line 55 of file MonitorTrackResiduals.cc.

References funct::abs(), DQMStore::IBooker::book1D(), conf_, folder_organizer, edm::EventSetup::get(), edm::ParameterSet::getParameter(), SiStripFolderOrganizer::GetSubDetAndLayer(), HitResidual, m_SubdetLayerNormedResiduals, m_SubdetLayerResiduals, ModOn, NormedHitResiduals, edm::ESHandle< class >::product(), MonitorElement::setAxisTitle(), SiStripFolderOrganizer::setDetectorFolder(), SiStripFolderOrganizer::setLayerFolder(), SiStripFolderOrganizer::setSiStripFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and SiStripDetId::subDetector().

Referenced by bookHistograms().

55  {
56 
57  //Retrieve tracker topology from geometry
59  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
60  const TrackerTopology* const tTopo = tTopoHandle.product();
61 
62  Parameters = conf_.getParameter<edm::ParameterSet>("TH1ResModules");
63  int32_t i_residuals_Nbins = Parameters.getParameter<int32_t>("Nbinx");
64  double d_residual_xmin = Parameters.getParameter<double>("xmin");
65  double d_residual_xmax = Parameters.getParameter<double>("xmax");
66  Parameters = conf_.getParameter<edm::ParameterSet>("TH1NormResModules");
67  int32_t i_normres_Nbins = Parameters.getParameter<int32_t>("Nbinx");
68  double d_normres_xmin = Parameters.getParameter<double>("xmin");
69  double d_normres_xmax = Parameters.getParameter<double>("xmax");
70 
71 
72  // use SistripHistoId for producing histogram id (and title)
73  SiStripHistoId hidmanager;
74  folder_organizer.setSiStripFolder(); // top SiStrip folder
75 
76  // take from eventSetup the SiStripDetCabling object
78  iSetup.get<SiStripDetCablingRcd>().get(tkmechstruct);
79 
80  // get list of active detectors from SiStripDetCabling
81  std::vector<uint32_t> activeDets;
82  activeDets.clear(); // just in case
83  tkmechstruct->addActiveDetectorsRawIds(activeDets);
84 
85  // use SiStripSubStructure for selecting certain regions
86  SiStripSubStructure substructure;
87  std::vector<uint32_t> DetIds = activeDets;
88 
89  // book histo per each detector module
90  for (std::vector<uint32_t>::const_iterator DetItr=activeDets.begin(),
91  DetItrEnd = activeDets.end(); DetItr!=DetItrEnd; ++DetItr)
92  {
93  uint ModuleID = (*DetItr);
94 
95  // is this a StripModule?
96  if( SiStripDetId(ModuleID).subDetector() != 0 ) {
97 
98  folder_organizer.setDetectorFolder(ModuleID, tTopo); // detid sets appropriate detector folder
99  // Book module histogramms?
100  if (ModOn) {
101  std::string hid = hidmanager.createHistoId("HitResiduals","det",ModuleID);
102  std::string normhid = hidmanager.createHistoId("NormalizedHitResiduals","det",ModuleID);
103  HitResidual[ModuleID] = ibooker.book1D(hid, hid,
104  i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
105  HitResidual[ModuleID]->setAxisTitle("(x_{pred} - x_{rec})' [cm]");
106  NormedHitResiduals[ModuleID] = ibooker.book1D(normhid, normhid,
107  i_normres_Nbins,d_normres_xmin,d_normres_xmax);
108  NormedHitResiduals[ModuleID]->setAxisTitle("(x_{pred} - x_{rec})'/#sigma");
109  }
110  // book layer level histogramms
111  std::pair<std::string,int32_t> subdetandlayer = folder_organizer.GetSubDetAndLayer(ModuleID, tTopo);
112  folder_organizer.setLayerFolder(ModuleID,tTopo,subdetandlayer.second);
113  if(! m_SubdetLayerResiduals[subdetandlayer ] ) {
114  // book histogramms on layer level, check for barrel for correct labeling
115  std::string histoname = Form(subdetandlayer.first.find("B") != std::string::npos ?
116  "HitResiduals_%s__Layer__%d" : "HitResiduals_%s__wheel__%d" ,
117  subdetandlayer.first.c_str(),std::abs(subdetandlayer.second));
118  std::string normhistoname =
119  Form(subdetandlayer.first.find("B") != std::string::npos ?
120  "NormalizedHitResidual_%s__Layer__%d" : "NormalizedHitResidual_%s__wheel__%d" ,
121  subdetandlayer.first.c_str(),std::abs(subdetandlayer.second));
122  m_SubdetLayerResiduals[subdetandlayer] =
123  ibooker.book1D(histoname.c_str(),histoname.c_str(),
124  i_residuals_Nbins,d_residual_xmin,d_residual_xmax);
125  m_SubdetLayerResiduals[subdetandlayer]->setAxisTitle("(x_{pred} - x_{rec})' [cm]");
126  m_SubdetLayerNormedResiduals[subdetandlayer] =
127  ibooker.book1D(normhistoname.c_str(),normhistoname.c_str(),
128  i_normres_Nbins,d_normres_xmin,d_normres_xmax);
129  m_SubdetLayerNormedResiduals[subdetandlayer]->setAxisTitle("(x_{pred} - x_{rec})'/#sigma");
130  }
131  } // end 'is strip module'
132  } // end loop over activeDets
133 }
T getParameter(std::string const &) const
std::pair< std::string, int32_t > GetSubDetAndLayer(const uint32_t &detid, const TrackerTopology *tTopo, bool ring_flag=0)
SiStripFolderOrganizer folder_organizer
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
vector< ParameterSet > Parameters
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Detector identifier class for the strip tracker.
Definition: SiStripDetId.h:17
SubDetector subDetector() const
Definition: SiStripDetId.h:114
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=0)
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
std::map< std::pair< std::string, int32_t >, MonitorElement * > m_SubdetLayerNormedResiduals
std::map< std::pair< std::string, int32_t >, MonitorElement * > m_SubdetLayerResiduals
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void MonitorTrackResiduals::dqmBeginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from DQMEDAnalyzer.

Definition at line 49 of file MonitorTrackResiduals.cc.

References genTriggerEventFlag_, GenericTriggerEventFlag::initRun(), and GenericTriggerEventFlag::on().

49  {
50 
51  // Initialize the GenericTriggerEventFlag
52  if ( genTriggerEventFlag_->on() ) genTriggerEventFlag_->initRun( run, iSetup );
53 }
GenericTriggerEventFlag * genTriggerEventFlag_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
void MonitorTrackResiduals::endJob ( void  )
virtual

Definition at line 140 of file MonitorTrackResiduals.cc.

References conf_, dqmStore_, edm::ParameterSet::getParameter(), dumpDBToFile_GT_ttrig_cfg::outputFileName, DQMStore::save(), and AlCaHLTBitMon_QueryRunRegistry::string.

140  {
141 
142  //dqmStore_->showDirStructure();
143  bool outputMEsInRootFile = conf_.getParameter<bool>("OutputMEsInRootFile");
145  if(outputMEsInRootFile){
146  dqmStore_->save(outputFileName);
147  }
148 }
T getParameter(std::string const &) const
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, const uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE", const bool resetMEsAfterWriting=false)
Definition: DQMStore.cc:2608
void MonitorTrackResiduals::endRun ( const edm::Run ,
const edm::EventSetup  
)
virtual

Reimplemented from edm::stream::EDAnalyzerBase.

Definition at line 136 of file MonitorTrackResiduals.cc.

136  {
137 }

Member Data Documentation

TrackerValidationVariables MonitorTrackResiduals::avalidator_
private

Definition at line 57 of file MonitorTrackResiduals.h.

Referenced by analyze().

edm::ParameterSet MonitorTrackResiduals::conf_
private

Definition at line 47 of file MonitorTrackResiduals.h.

Referenced by createMEs(), endJob(), and MonitorTrackResiduals().

DQMStore* MonitorTrackResiduals::dqmStore_
private

Definition at line 46 of file MonitorTrackResiduals.h.

Referenced by endJob().

SiStripFolderOrganizer MonitorTrackResiduals::folder_organizer
private

Definition at line 53 of file MonitorTrackResiduals.h.

Referenced by analyze(), and createMEs().

GenericTriggerEventFlag* MonitorTrackResiduals::genTriggerEventFlag_
private

Definition at line 56 of file MonitorTrackResiduals.h.

Referenced by analyze(), dqmBeginRun(), and ~MonitorTrackResiduals().

HistoClass MonitorTrackResiduals::HitResidual
private

Definition at line 51 of file MonitorTrackResiduals.h.

Referenced by analyze(), and createMEs().

unsigned long long MonitorTrackResiduals::m_cacheID_
private

Definition at line 54 of file MonitorTrackResiduals.h.

Referenced by bookHistograms().

std::map< std::pair<std::string,int32_t>, MonitorElement* > MonitorTrackResiduals::m_SubdetLayerNormedResiduals
private

Definition at line 50 of file MonitorTrackResiduals.h.

Referenced by analyze(), and createMEs().

std::map< std::pair<std::string,int32_t>, MonitorElement* > MonitorTrackResiduals::m_SubdetLayerResiduals
private

Definition at line 49 of file MonitorTrackResiduals.h.

Referenced by analyze(), and createMEs().

bool MonitorTrackResiduals::ModOn
private

Definition at line 55 of file MonitorTrackResiduals.h.

Referenced by analyze(), createMEs(), and MonitorTrackResiduals().

HistoClass MonitorTrackResiduals::NormedHitResiduals
private

Definition at line 52 of file MonitorTrackResiduals.h.

Referenced by analyze(), and createMEs().

edm::ParameterSet MonitorTrackResiduals::Parameters
private

Definition at line 48 of file MonitorTrackResiduals.h.