CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes
MonitorTrackResidualsBase< pixel_or_strip > Class Template Reference

#include <MonitorTrackResiduals.h>

Inheritance diagram for MonitorTrackResidualsBase< pixel_or_strip >:
DQMEDAnalyzer edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

struct  HistoPair
 
struct  HistoXY
 

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
 MonitorTrackResidualsBase (const edm::ParameterSet &)
 
 ~MonitorTrackResidualsBase () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
virtual void dqmEndLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual void dqmEndRun (edm::Run const &, edm::EventSetup const &)
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) final
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::EndLuminosityBlockProducer, edm::one::WatchLuminosityBlocks, edm::Accumulator >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef std::map< std::pair< std::string, int32_t >, HistoXYHistoSet
 

Private Member Functions

void createMEs (DQMStore::IBooker &, const edm::EventSetup &)
 
std::pair< std::string, int32_t > findSubdetAndLayer (uint32_t ModuleID, const TrackerTopology *tTopo)
 

Private Attributes

TrackerValidationVariables avalidator_
 
edm::ParameterSet conf_
 
GenericTriggerEventFlaggenTriggerEventFlag_
 
unsigned long long m_cacheID_
 
HistoSet m_ModuleResiduals
 
HistoSet m_SubdetLayerResiduals
 
bool ModOn
 
edm::EDGetTokenT< reco::VertexCollectionofflinePrimaryVerticesToken_
 
edm::ParameterSet Parameters
 
std::unique_ptr< TkHistoMaptkhisto_ResidualsMean
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

template<TrackerType pixel_or_strip>
class MonitorTrackResidualsBase< pixel_or_strip >

Definition at line 38 of file MonitorTrackResiduals.h.

Member Typedef Documentation

template<TrackerType pixel_or_strip>
typedef std::map<std::pair<std::string, int32_t>, HistoXY> MonitorTrackResidualsBase< pixel_or_strip >::HistoSet
private

Definition at line 64 of file MonitorTrackResiduals.h.

Constructor & Destructor Documentation

template<TrackerType pixel_or_strip>
MonitorTrackResidualsBase< pixel_or_strip >::MonitorTrackResidualsBase ( const edm::ParameterSet iConfig)
explicit

Definition at line 19 of file MonitorTrackResiduals.cc.

References MonitorTrackResidualsBase< pixel_or_strip >::conf_, edm::ParameterSet::getParameter(), MonitorTrackResidualsBase< pixel_or_strip >::ModOn, MonitorTrackResidualsBase< pixel_or_strip >::offlinePrimaryVerticesToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

20  : conf_(iConfig),
21  m_cacheID_(0),
23  iConfig.getParameter<edm::ParameterSet>("genericTriggerEventPSet"), consumesCollector(), *this)),
24  avalidator_(iConfig, consumesCollector()) {
25  ModOn = conf_.getParameter<bool>("Mod_On");
26  offlinePrimaryVerticesToken_ = consumes<reco::VertexCollection>(std::string("offlinePrimaryVertices"));
27 }
T getParameter(std::string const &) const
TrackerValidationVariables avalidator_
Provides a code based selection for trigger and DCS information in order to have no failing filters i...
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
GenericTriggerEventFlag * genTriggerEventFlag_
template<TrackerType pixel_or_strip>
MonitorTrackResidualsBase< pixel_or_strip >::~MonitorTrackResidualsBase ( )
override

Definition at line 30 of file MonitorTrackResiduals.cc.

References MonitorTrackResidualsBase< pixel_or_strip >::genTriggerEventFlag_.

30  {
32  delete genTriggerEventFlag_;
33 }
GenericTriggerEventFlag * genTriggerEventFlag_

Member Function Documentation

template<TrackerType pixel_or_strip>
void MonitorTrackResidualsBase< pixel_or_strip >::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 236 of file MonitorTrackResiduals.cc.

References funct::abs(), GenericTriggerEventFlag::accept(), MonitorTrackResidualsBase< pixel_or_strip >::avalidator_, DEFINE_FWK_MODULE, reco::TrackBase::dxy(), reco::TrackBase::dxyError(), TrackerValidationVariables::fillTrackQuantities(), MonitorTrackResidualsBase< pixel_or_strip >::findSubdetAndLayer(), MonitorTrackResidualsBase< pixel_or_strip >::genTriggerEventFlag_, edm::EventSetup::get(), edm::Event::getByToken(), combine::histos, fastTrackerRecHitType::isPixel(), edm::HandleBase::isValid(), MonitorTrackResidualsBase< pixel_or_strip >::m_ModuleResiduals, MonitorTrackResidualsBase< pixel_or_strip >::m_SubdetLayerResiduals, MonitorTrackResidualsBase< pixel_or_strip >::ModOn, MonitorTrackResidualsBase< pixel_or_strip >::offlinePrimaryVerticesToken_, GenericTriggerEventFlag::on(), BeamMonitor_cff::primaryVertex, edm::ESHandle< T >::product(), reco::TrackBase::pt(), MonitorTrackResidualsBase< pixel_or_strip >::tkhisto_ResidualsMean, HLT_2018_cff::track, TRACKERTYPE_PIXEL, parallelization::uint, and pwdgSkimBPark_cfi::vertices.

236  {
237  auto vtracks = std::vector<TrackerValidationVariables::AVTrackStruct>();
238  // Filter out events if Trigger Filtering is requested
239  if (genTriggerEventFlag_->on() && !genTriggerEventFlag_->accept(iEvent, iSetup))
240  return;
241 
243  iEvent.getByToken(offlinePrimaryVerticesToken_, vertices);
244  if (!vertices.isValid() || vertices->empty())
245  return;
246  const auto primaryVertex = vertices->at(0);
247 
248  // Retrieve tracker topology from geometry
249  edm::ESHandle<TrackerTopology> tTopoHandle;
250  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
251  const TrackerTopology *const tTopo = tTopoHandle.product();
252 
254  iSetup,
255  // tell the validator to only look at good tracks
256  [&](const reco::Track &track) -> bool {
257  return track.pt() > 0.75 &&
258  abs(track.dxy(primaryVertex.position())) < 5 * track.dxyError();
259  },
260  vtracks);
261 
262  for (auto &track : vtracks) {
263  for (auto &it : track.hits) {
264  uint RawId = it.rawDetId;
265 
266  auto id = DetId(RawId);
267  auto isPixel = id.subdetId() == 1 || id.subdetId() == 2;
268  if (isPixel != (pixel_or_strip == TRACKERTYPE_PIXEL))
269  continue;
270 
271  if (ModOn) {
272  auto &mod_histos = m_ModuleResiduals[std::make_pair("", RawId)];
273  mod_histos.x.base->Fill(it.resXprime);
274  mod_histos.x.normed->Fill(it.resXprime / it.resXprimeErr);
275  mod_histos.y.base->Fill(it.resYprime);
276  mod_histos.y.normed->Fill(it.resYprime / it.resYprimeErr);
277  }
278 
279  auto subdetandlayer = findSubdetAndLayer(RawId, tTopo);
280  auto histos = m_SubdetLayerResiduals[subdetandlayer];
281  // fill if its error is not zero
282  if (it.resXprimeErr != 0 && histos.x.base) {
283  histos.x.base->Fill(it.resXprime);
284  histos.x.normed->Fill(it.resXprime / it.resXprimeErr);
285  if (!isPixel)
286  tkhisto_ResidualsMean->fill(RawId, it.resXprime);
287  }
288  if (it.resYprimeErr != 0 && histos.y.base) {
289  histos.y.base->Fill(it.resYprime);
290  histos.y.normed->Fill(it.resYprime / it.resYprimeErr);
291  }
292  }
293  }
294 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
double dxyError() const
error on dxy
Definition: TrackBase.h:716
TrackerValidationVariables avalidator_
edm::EDGetTokenT< reco::VertexCollection > offlinePrimaryVerticesToken_
std::unique_ptr< TkHistoMap > tkhisto_ResidualsMean
bool accept(const edm::Event &event, const edm::EventSetup &setup)
To be called from analyze/filter() methods.
double pt() const
track transverse momentum
Definition: TrackBase.h:602
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:70
Definition: DetId.h:17
void fillTrackQuantities(const edm::Event &, const edm::EventSetup &, std::vector< AVTrackStruct > &v_avtrackout)
GenericTriggerEventFlag * genTriggerEventFlag_
histos
Definition: combine.py:4
T get() const
Definition: EventSetup.h:73
bool isPixel(HitType hitType)
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:587
std::pair< std::string, int32_t > findSubdetAndLayer(uint32_t ModuleID, const TrackerTopology *tTopo)
primaryVertex
hltOfflineBeamSpot for HLTMON
T const * product() const
Definition: ESHandle.h:86
template<TrackerType pixel_or_strip>
void MonitorTrackResidualsBase< pixel_or_strip >::bookHistograms ( DQMStore::IBooker ,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 36 of file MonitorTrackResiduals.cc.

References MonitorTrackResidualsBase< pixel_or_strip >::createMEs(), edm::EventSetup::get(), MonitorTrackResidualsBase< pixel_or_strip >::m_cacheID_, edm::ESHandle< T >::product(), SiStripFolderOrganizer::setSiStripFolderName(), AlCaHLTBitMon_QueryRunRegistry::string, and MonitorTrackResidualsBase< pixel_or_strip >::tkhisto_ResidualsMean.

38  {
39  unsigned long long cacheID = iSetup.get<TrackerDigiGeometryRecord>().cacheIdentifier();
40  if (m_cacheID_ != cacheID) {
41  m_cacheID_ = cacheID;
42  this->createMEs(ibooker, iSetup);
43  }
44  std::string topFolderName_ = "SiStrip";
45  SiStripFolderOrganizer folder_organizer;
46  folder_organizer.setSiStripFolderName(topFolderName_);
47  edm::ESHandle<TkDetMap> tkDetMapHandle;
48  iSetup.get<TrackerTopologyRcd>().get(tkDetMapHandle);
49  tkhisto_ResidualsMean = std::make_unique<TkHistoMap>(
50  tkDetMapHandle.product(), ibooker, topFolderName_, "TkHMap_ResidualsMean", 0.0, true);
51 }
void setSiStripFolderName(std::string name)
std::unique_ptr< TkHistoMap > tkhisto_ResidualsMean
void createMEs(DQMStore::IBooker &, const edm::EventSetup &)
T const * product() const
Definition: ESHandle.h:86
template<TrackerType pixel_or_strip>
void MonitorTrackResidualsBase< pixel_or_strip >::createMEs ( DQMStore::IBooker ibooker,
const edm::EventSetup iSetup 
)
private

Definition at line 102 of file MonitorTrackResiduals.cc.

References funct::abs(), dqm::dqmstoreimpl::DQMStore::IBooker::book1D(), MonitorTrackResidualsBase< pixel_or_strip >::conf_, TrackerGeometry::detIds(), MonitorTrackResidualsBase< pixel_or_strip >::findSubdetAndLayer(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), combine::histos, photons_cff::ids, PixelPluginsPhase0_cfi::isBarrel, fastTrackerRecHitType::isPixel(), MonitorTrackResidualsBase< pixel_or_strip >::m_ModuleResiduals, MonitorTrackResidualsBase< pixel_or_strip >::m_SubdetLayerResiduals, MonitorTrackResidualsBase< pixel_or_strip >::ModOn, edm::ESHandle< T >::product(), dqm::impl::MonitorElement::setAxisTitle(), dqm::dqmstoreimpl::DQMStore::IBooker::setCurrentFolder(), SiStripFolderOrganizer::setDetectorFolder(), SiStripFolderOrganizer::setLayerFolder(), AlCaHLTBitMon_QueryRunRegistry::string, TRACKERTYPE_PIXEL, and geometryCSVtoXML::xy.

Referenced by MonitorTrackResidualsBase< pixel_or_strip >::bookHistograms().

102  {
103  // Retrieve tracker topology and geometry
104  edm::ESHandle<TrackerTopology> tTopoHandle;
105  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
106  const TrackerTopology *const tTopo = tTopoHandle.product();
107 
109  iSetup.get<TrackerDigiGeometryRecord>().get(TG);
110 
111  Parameters = conf_.getParameter<edm::ParameterSet>("TH1ResModules");
112  int32_t i_residuals_Nbins = Parameters.getParameter<int32_t>("Nbinx");
113  double d_residual_xmin = Parameters.getParameter<double>("xmin");
114  double d_residual_xmax = Parameters.getParameter<double>("xmax");
115  Parameters = conf_.getParameter<edm::ParameterSet>("TH1NormResModules");
116  int32_t i_normres_Nbins = Parameters.getParameter<int32_t>("Nbinx");
117  double d_normres_xmin = Parameters.getParameter<double>("xmin");
118  double d_normres_xmax = Parameters.getParameter<double>("xmax");
119 
120  // use SistripHistoId for producing histogram id (and title)
121  SiStripHistoId hidmanager;
122 
123  SiStripFolderOrganizer strip_organizer;
124  auto pixel_organizer = SiPixelFolderOrganizer(false);
125 
126  // Collect list of modules from Tracker Geometry
127  // book histo per each detector module
128  auto ids = TG->detIds(); // or detUnitIds?
129  for (DetId id : ids) {
130  auto ModuleID = id.rawId();
131  auto isPixel = id.subdetId() == 1 || id.subdetId() == 2;
132  if (isPixel != (pixel_or_strip == TRACKERTYPE_PIXEL))
133  continue;
134 
135  // Book module histogramms?
136  if (ModOn) {
137  switch (id.subdetId()) {
138  case 1:
139  pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
140  break;
141  case 2:
142  pixel_organizer.setModuleFolder(ibooker, ModuleID, 0);
143  break;
144  default:
145  strip_organizer.setDetectorFolder(ModuleID, tTopo);
146  }
147  {
148  // this sounds strip specific but also works for pixel
149  std::string hid = hidmanager.createHistoId("HitResidualsX", "det", ModuleID);
150  std::string normhid = hidmanager.createHistoId("NormalizedHitResidualsX", "det", ModuleID);
151  auto &histos = m_ModuleResiduals[std::make_pair("", ModuleID)];
152  histos.x.base = ibooker.book1D(hid, hid, i_residuals_Nbins, d_residual_xmin, d_residual_xmax);
153  histos.x.base->setAxisTitle("(x_{pred} - x_{rec})' [cm]");
154  histos.x.normed = ibooker.book1D(normhid, normhid, i_normres_Nbins, d_normres_xmin, d_normres_xmax);
155  histos.x.normed->setAxisTitle("(x_{pred} - x_{rec})'/#sigma");
156  }
157  {
158  std::string hid = hidmanager.createHistoId("HitResidualsY", "det", ModuleID);
159  std::string normhid = hidmanager.createHistoId("NormalizedHitResidualsY", "det", ModuleID);
160  auto &histos = m_ModuleResiduals[std::make_pair("", ModuleID)];
161  histos.y.base = ibooker.book1D(hid, hid, i_residuals_Nbins, d_residual_xmin, d_residual_xmax);
162  histos.y.base->setAxisTitle("(y_{pred} - y_{rec})' [cm]");
163  histos.y.normed = ibooker.book1D(normhid, normhid, i_normres_Nbins, d_normres_xmin, d_normres_xmax);
164  histos.y.normed->setAxisTitle("(y_{pred} - y_{rec})'/#sigma");
165  }
166  }
167 
168  auto subdetandlayer = findSubdetAndLayer(ModuleID, tTopo);
169  if (m_SubdetLayerResiduals.find(subdetandlayer) == m_SubdetLayerResiduals.end()) {
170  // add new histograms
171  auto &histos = m_SubdetLayerResiduals[subdetandlayer];
172  switch (id.subdetId()) {
173  // Pixel Barrel, Endcap
174  // We can't use the folder organizer here (SiPixelActionExecutor.cc#1638
175  // does the same)
176  case 1:
177  ibooker.setCurrentFolder("Pixel/Barrel");
178  break;
179  case 2:
180  ibooker.setCurrentFolder("Pixel/Endcap");
181  break;
182  // All strip
183  default:
184  strip_organizer.setLayerFolder(ModuleID, tTopo, subdetandlayer.second);
185  }
186 
187  auto isBarrel = subdetandlayer.first.find("B") != std::string::npos;
188 
189  auto xy = std::vector<std::pair<HistoPair &, const char *>>{std::make_pair(std::ref(histos.x), "X"),
190  std::make_pair(std::ref(histos.y), "Y")};
191  for (auto &histopair : xy) {
192  // book histogramms on layer level, check for barrel/pixel only for
193  // correct labeling
194 
195  // Skip the Y plots for strips.
196  if (!isPixel && histopair.second[0] == 'Y')
197  continue;
198 
199  std::string histoname = isPixel ? ( // Pixel name
200  Form("HitResiduals%s_%s%d",
201  histopair.second,
202  isBarrel ? "L" : (subdetandlayer.second > 0 ? "Dp" : "Dm"),
203  std::abs(subdetandlayer.second)))
204  : (Form("HitResiduals_%s__%s__%d", // Strip TODO: We use a
205  // legacy name.
206  subdetandlayer.first.c_str(),
207  isBarrel ? "Layer" : "wheel",
208  std::abs(subdetandlayer.second)));
209 
210  std::string histotitle = Form("HitResiduals %s on %s%s full %s %d",
211  histopair.second,
212  subdetandlayer.first.c_str(),
213  isBarrel ? "" : (subdetandlayer.second > 0 ? "+" : "-"),
214  isBarrel ? "Layer" : (isPixel ? "Disk" : "Wheel"),
215  std::abs(subdetandlayer.second));
216 
217  std::string normhistoname = Form("Normalized%s", histoname.c_str());
218  std::string normhistotitle = Form("Normalized%s", histotitle.c_str());
219 
220  // std::cout << "##### Booking: " << ibooker.pwd() << " title " <<
221  // histoname << std::endl;
222 
223  histopair.first.base =
224  ibooker.book1D(histoname.c_str(), histotitle.c_str(), i_residuals_Nbins, d_residual_xmin, d_residual_xmax);
225  histopair.first.base->setAxisTitle("(x_{pred} - x_{rec})' [cm]");
226 
227  histopair.first.normed = ibooker.book1D(
228  normhistoname.c_str(), normhistotitle.c_str(), i_normres_Nbins, d_normres_xmin, d_normres_xmax);
229  histopair.first.normed->setAxisTitle("(x_{pred} - x_{rec})'/#sigma");
230  }
231  }
232  } // end loop over activeDets
233 }
T getParameter(std::string const &) const
void setLayerFolder(uint32_t rawdetid, const TrackerTopology *tTopo, int32_t layer=0, bool ring_flag=false)
void setDetectorFolder(uint32_t rawdetid, const TrackerTopology *tTopo)
vector< ParameterSet > Parameters
const DetIdContainer & detIds() const override
Returm a vector of all GeomDet DetIds (including those of GeomDetUnits)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Definition: DetId.h:17
histos
Definition: combine.py:4
T get() const
Definition: EventSetup.h:73
bool isPixel(HitType hitType)
std::pair< std::string, int32_t > findSubdetAndLayer(uint32_t ModuleID, const TrackerTopology *tTopo)
T const * product() const
Definition: ESHandle.h:86
template<TrackerType pixel_or_strip>
void MonitorTrackResidualsBase< pixel_or_strip >::dqmBeginRun ( const edm::Run ,
const edm::EventSetup  
)
override

Definition at line 54 of file MonitorTrackResiduals.cc.

References MonitorTrackResidualsBase< pixel_or_strip >::genTriggerEventFlag_, GenericTriggerEventFlag::initRun(), and GenericTriggerEventFlag::on().

54  {
55  // Initialize the GenericTriggerEventFlag
56  if (genTriggerEventFlag_->on())
58 }
GenericTriggerEventFlag * genTriggerEventFlag_
void initRun(const edm::Run &run, const edm::EventSetup &setup)
To be called from beginRun() methods.
template<TrackerType pixel_or_strip>
std::pair< std::string, int32_t > MonitorTrackResidualsBase< pixel_or_strip >::findSubdetAndLayer ( uint32_t  ModuleID,
const TrackerTopology tTopo 
)
private

Definition at line 61 of file MonitorTrackResiduals.cc.

References TrackerTopology::pxbLayer(), TrackerTopology::pxfDisk(), TrackerTopology::pxfSide(), AlCaHLTBitMon_QueryRunRegistry::string, TrackerTopology::tecSide(), TrackerTopology::tecWheel(), TrackerTopology::tibLayer(), TrackerTopology::tidSide(), TrackerTopology::tidWheel(), and TrackerTopology::tobLayer().

Referenced by MonitorTrackResidualsBase< pixel_or_strip >::analyze(), and MonitorTrackResidualsBase< pixel_or_strip >::createMEs().

62  {
63  std::string subdet = "";
64  int32_t layer = 0;
65  auto id = DetId(ModuleID);
66  switch (id.subdetId()) {
67  // Pixel Barrel, Endcap
68  case 1:
69  subdet = "BPIX";
70  layer = tTopo->pxbLayer(id);
71  break;
72  case 2:
73  subdet = "FPIX";
74  layer = tTopo->pxfDisk(id) * (tTopo->pxfSide(ModuleID) == 1 ? -1 : +1);
75  break;
76  // Strip TIB, TID, TOB, TEC
77  case 3:
78  subdet = "TIB";
79  layer = tTopo->tibLayer(id);
80  break;
81  case 4:
82  subdet = "TID";
83  layer = tTopo->tidWheel(id) * (tTopo->tidSide(ModuleID) == 1 ? -1 : +1);
84  break;
85  case 5:
86  subdet = "TOB";
87  layer = tTopo->tobLayer(id);
88  break;
89  case 6:
90  subdet = "TEC";
91  layer = tTopo->tecWheel(id) * (tTopo->tecSide(ModuleID) == 1 ? -1 : +1);
92  break;
93  default:
94  // TODO: Fail loudly.
95  subdet = "UNKNOWN";
96  layer = 0;
97  }
98  return std::make_pair(subdet, layer);
99 }
unsigned int tibLayer(const DetId &id) const
unsigned int pxfDisk(const DetId &id) const
unsigned int tidWheel(const DetId &id) const
unsigned int tidSide(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
Definition: DetId.h:17
unsigned int pxfSide(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
unsigned int tobLayer(const DetId &id) const
unsigned int tecSide(const DetId &id) const

Member Data Documentation

template<TrackerType pixel_or_strip>
TrackerValidationVariables MonitorTrackResidualsBase< pixel_or_strip >::avalidator_
private
template<TrackerType pixel_or_strip>
edm::ParameterSet MonitorTrackResidualsBase< pixel_or_strip >::conf_
private
template<TrackerType pixel_or_strip>
GenericTriggerEventFlag* MonitorTrackResidualsBase< pixel_or_strip >::genTriggerEventFlag_
private
template<TrackerType pixel_or_strip>
unsigned long long MonitorTrackResidualsBase< pixel_or_strip >::m_cacheID_
private
template<TrackerType pixel_or_strip>
HistoSet MonitorTrackResidualsBase< pixel_or_strip >::m_ModuleResiduals
private
template<TrackerType pixel_or_strip>
HistoSet MonitorTrackResidualsBase< pixel_or_strip >::m_SubdetLayerResiduals
private
template<TrackerType pixel_or_strip>
bool MonitorTrackResidualsBase< pixel_or_strip >::ModOn
private
template<TrackerType pixel_or_strip>
edm::EDGetTokenT<reco::VertexCollection> MonitorTrackResidualsBase< pixel_or_strip >::offlinePrimaryVerticesToken_
private
template<TrackerType pixel_or_strip>
edm::ParameterSet MonitorTrackResidualsBase< pixel_or_strip >::Parameters
private

Definition at line 71 of file MonitorTrackResiduals.h.

template<TrackerType pixel_or_strip>
std::unique_ptr<TkHistoMap> MonitorTrackResidualsBase< pixel_or_strip >::tkhisto_ResidualsMean
private