CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Phase2OTValidateCluster Class Reference

#include <Phase2OTValidateCluster.cc>

Inheritance diagram for Phase2OTValidateCluster:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Classes

struct  ClusterMEs
 

Public Types

typedef std::map< unsigned int, std::vector< PSimHit > > SimHitsMap
 
typedef std::map< unsigned int, SimTrackSimTracksMap
 
- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
void dqmBeginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
 Phase2OTValidateCluster (const edm::ParameterSet &)
 
 ~Phase2OTValidateCluster () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 

Private Member Functions

void bookLayerHistos (DQMStore::IBooker &ibooker, uint32_t det_it, const std::string &subdir)
 
void fillOTHistos (const edm::Event &iEvent, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &simTracks)
 
std::vector< unsigned int > getSimTrackId (const edm::Handle< edm::DetSetVector< PixelDigiSimLink >> &pixelSimLinks, const DetId &detId, unsigned int channel)
 

Private Attributes

edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNewclustersToken_
 
edm::ParameterSet config_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::map< std::string, ClusterMEslayerMEs_
 
std::vector< edm::InputTagpSimHitSrc_
 
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simITLinksToken_
 
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simOTLinksToken_
 
double simtrackminpt_
 
edm::EDGetTokenT< edm::SimTrackContainersimTracksToken_
 
const TrackerGeometrytkGeom_ = nullptr
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
const TrackerTopologytTopo_ = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Description: Validation plots tracker clusters.

Definition at line 50 of file Phase2OTValidateCluster.cc.

Member Typedef Documentation

◆ SimHitsMap

typedef std::map<unsigned int, std::vector<PSimHit> > Phase2OTValidateCluster::SimHitsMap

Definition at line 52 of file Phase2OTValidateCluster.cc.

◆ SimTracksMap

typedef std::map<unsigned int, SimTrack> Phase2OTValidateCluster::SimTracksMap

Definition at line 53 of file Phase2OTValidateCluster.cc.

Constructor & Destructor Documentation

◆ Phase2OTValidateCluster()

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

Definition at line 102 of file Phase2OTValidateCluster.cc.

References pSimHitSrc_, and simHitTokens_.

103  : config_(iConfig),
104  simtrackminpt_(config_.getParameter<double>("SimTrackMinPt")),
106  config_.getParameter<edm::InputTag>("OuterTrackerDigiSimLinkSource"))),
107  simTracksToken_(consumes<edm::SimTrackContainer>(config_.getParameter<edm::InputTag>("simtracks"))),
109  consumes<Phase2TrackerCluster1DCollectionNew>(config_.getParameter<edm::InputTag>("ClusterSource"))),
110  pSimHitSrc_(config_.getParameter<std::vector<edm::InputTag>>("PSimHitSource")),
111  geomToken_(esConsumes<TrackerGeometry, TrackerDigiGeometryRecord, edm::Transition::BeginRun>()),
112  topoToken_(esConsumes<TrackerTopology, TrackerTopologyRcd, edm::Transition::BeginRun>()) {
113  edm::LogInfo("Phase2OTValidateCluster") << ">>> Construct Phase2OTValidateCluster ";
114  for (const auto& itag : pSimHitSrc_)
115  simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
116 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< edm::InputTag > pSimHitSrc_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simOTLinksToken_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
Log< level::Info, false > LogInfo
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > clustersToken_

◆ ~Phase2OTValidateCluster()

Phase2OTValidateCluster::~Phase2OTValidateCluster ( )
override

Definition at line 118 of file Phase2OTValidateCluster.cc.

118  {
119  // do anything here that needs to be done at desctruction time
120  // (e.g. close files, deallocate resources etc.)
121  edm::LogInfo("Phase2OTValidateCluster") << ">>> Destroy Phase2OTValidateCluster ";
122 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

void Phase2OTValidateCluster::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 133 of file Phase2OTValidateCluster.cc.

References fillOTHistos(), iEvent, FastTrackerRecHitCombiner_cfi::simHits, simHitTokens_, simtrackminpt_, TrackCandidateProducer_cfi::simTracks, and simTracksToken_.

133  {
134  // Getting simHits
135  std::vector<edm::Handle<edm::PSimHitContainer>> simHits;
136  for (const auto& itoken : simHitTokens_) {
137  const auto& simHitHandle = iEvent.getHandle(itoken);
138  if (!simHitHandle.isValid())
139  continue;
140  simHits.emplace_back(simHitHandle);
141  }
142  // Get the SimTracks
143  const auto& simTracksRaw = iEvent.getHandle(simTracksToken_);
144  // Rearrange the simTracks for ease of use <simTrackID, simTrack>
146  for (edm::SimTrackContainer::const_iterator simTrackIt(simTracksRaw->begin()); simTrackIt != simTracksRaw->end();
147  ++simTrackIt) {
148  if (simTrackIt->momentum().pt() > simtrackminpt_) {
149  simTracks.emplace(simTrackIt->trackId(), *simTrackIt);
150  }
151  }
153 }
std::map< unsigned int, SimTrack > SimTracksMap
edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
void fillOTHistos(const edm::Event &iEvent, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &simTracks)
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_

◆ bookHistograms()

void Phase2OTValidateCluster::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 257 of file Phase2OTValidateCluster.cc.

References bookLayerHistos(), edm::ESWatcher< T >::check(), config_, TrackerGeometry::detUnits(), edm::ParameterSet::getParameter(), GeomDetEnumerators::P2PXB, GeomDetEnumerators::P2PXEC, AlCaHLTBitMon_QueryRunRegistry::string, and tkGeom_.

259  {
260  std::string top_folder = config_.getParameter<std::string>("TopFolderName");
261  edm::LogInfo("Phase2OTValidateCluster") << " Booking Histograms in: " << top_folder;
262 
263  edm::ESWatcher<TrackerDigiGeometryRecord> theTkDigiGeomWatcher;
264  if (theTkDigiGeomWatcher.check(iSetup)) {
265  for (auto const& det_u : tkGeom_->detUnits()) {
266  //Always check TrackerNumberingBuilder before changing this part
267  if ((det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXB ||
268  det_u->subDetector() == GeomDetEnumerators::SubDetector::P2PXEC))
269  continue; //continue if Pixel
270  uint32_t detId_raw = det_u->geographicalId().rawId();
271  bookLayerHistos(ibooker, detId_raw, top_folder);
272  }
273  }
274 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
const TrackerGeometry * tkGeom_
void bookLayerHistos(DQMStore::IBooker &ibooker, uint32_t det_it, const std::string &subdir)
Log< level::Info, false > LogInfo
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57

◆ bookLayerHistos()

void Phase2OTValidateCluster::bookLayerHistos ( DQMStore::IBooker ibooker,
uint32_t  det_it,
const std::string &  subdir 
)
private

Definition at line 277 of file Phase2OTValidateCluster.cc.

References phase2tkutil::book1DFromPSet(), dqm::implementation::NavigatorBase::cd(), config_, Phase2OTValidateCluster::ClusterMEs::deltaX_P, Phase2OTValidateCluster::ClusterMEs::deltaX_P_primary, Phase2OTValidateCluster::ClusterMEs::deltaX_S, Phase2OTValidateCluster::ClusterMEs::deltaX_S_primary, Phase2OTValidateCluster::ClusterMEs::deltaY_P, Phase2OTValidateCluster::ClusterMEs::deltaY_P_primary, Phase2OTValidateCluster::ClusterMEs::deltaY_S, Phase2OTValidateCluster::ClusterMEs::deltaY_S_primary, ctppsRandomDQMSource_cfi::folderName, TrackerGeometry::getDetectorType(), phase2tkutil::getOTHistoId(), edm::ParameterSet::getParameter(), layerMEs_, TrackerGeometry::Ph2PSP, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, mkLumiAveragedPlots::subdir, tkGeom_, and tTopo_.

Referenced by bookHistograms().

277  {
279  if (folderName.empty()) {
280  edm::LogWarning("Phase2OTValidateCluster") << ">>>> Invalid histo_id ";
281  return;
282  }
283 
284  if (layerMEs_.find(folderName) == layerMEs_.end()) {
285  ibooker.cd();
286  edm::LogInfo("Phase2TrackerValidateDigi") << " Booking Histograms in: " << subdir + '/' + folderName;
287  ClusterMEs local_mes;
289  ibooker.setCurrentFolder(subdir + '/' + folderName);
290 
291  local_mes.deltaX_P =
293 
294  local_mes.deltaY_P =
296 
297  // Puting primary digis in a subfolder
298  ibooker.setCurrentFolder(subdir + '/' + folderName + "/PrimarySimHits");
299 
300  local_mes.deltaX_P_primary =
301  phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("Delta_X_Pixel_Primary"), ibooker);
302 
303  local_mes.deltaY_P_primary =
304  phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("Delta_Y_Pixel_Primary"), ibooker);
305  }
306  ibooker.setCurrentFolder(subdir + '/' + folderName);
307 
308  local_mes.deltaX_S =
310 
311  local_mes.deltaY_S =
313 
314  // Puting primary digis in a subfolder
315  ibooker.setCurrentFolder(subdir + '/' + folderName + "/PrimarySimHits");
316 
317  local_mes.deltaX_S_primary =
318  phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("Delta_X_Strip_Primary"), ibooker);
319 
320  local_mes.deltaY_S_primary =
321  phase2tkutil::book1DFromPSet(config_.getParameter<edm::ParameterSet>("Delta_Y_Strip_Primary"), ibooker);
322 
323  layerMEs_.emplace(folderName, local_mes);
324  }
325 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
const TrackerGeometry * tkGeom_
const TrackerTopology * tTopo_
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
ModuleType getDetectorType(DetId) const
MonitorElement * book1DFromPSet(const edm::ParameterSet &hpars, DQMStore::IBooker &ibooker)
Log< level::Info, false > LogInfo
std::map< std::string, ClusterMEs > layerMEs_
Log< level::Warning, false > LogWarning

◆ dqmBeginRun()

void Phase2OTValidateCluster::dqmBeginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 126 of file Phase2OTValidateCluster.cc.

References geomToken_, edm::EventSetup::getData(), tkGeom_, topoToken_, and tTopo_.

126  {
127  tkGeom_ = &iSetup.getData(geomToken_);
128  tTopo_ = &iSetup.getData(topoToken_);
129 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const TrackerGeometry * tkGeom_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
const TrackerTopology * tTopo_
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_

◆ fillDescriptions()

void Phase2OTValidateCluster::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 341 of file Phase2OTValidateCluster.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, ProducerED_cfi::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

341  {
343  //for macro-pixel sensors
344  std::string mptag = "macro-pixel sensor";
345  std::string striptag = "strip sensor";
346  {
348  psd0.add<std::string>("name", "Delta_X_Pixel");
349  psd0.add<std::string>("title", "#Delta X " + mptag + ";Cluster resolution X coordinate [#mum]");
350  psd0.add<bool>("switch", true);
351  psd0.add<double>("xmax", 250);
352  psd0.add<double>("xmin", -250);
353  psd0.add<int>("NxBins", 100);
354  desc.add<edm::ParameterSetDescription>("Delta_X_Pixel", psd0);
355  }
356  {
358  psd0.add<std::string>("name", "Delta_Y_Pixel");
359  psd0.add<std::string>("title", "#Delta Y " + mptag + ";Cluster resolution Y coordinate [#mum]");
360  psd0.add<bool>("switch", true);
361  psd0.add<double>("xmin", -1500);
362  psd0.add<double>("xmax", 1500);
363  psd0.add<int>("NxBins", 100);
364  desc.add<edm::ParameterSetDescription>("Delta_Y_Pixel", psd0);
365  }
366  {
368  psd0.add<std::string>("name", "Delta_X_Pixel_Primary");
369  psd0.add<std::string>("title", "#Delta X " + mptag + ";cluster resolution X coordinate [#mum]");
370  psd0.add<bool>("switch", true);
371  psd0.add<double>("xmin", -250);
372  psd0.add<double>("xmax", 250);
373  psd0.add<int>("NxBins", 100);
374  desc.add<edm::ParameterSetDescription>("Delta_X_Pixel_Primary", psd0);
375  }
376  {
378  psd0.add<std::string>("name", "Delta_Y_Pixel_Primary");
379  psd0.add<std::string>("title", "#Delta Y " + mptag + ";cluster resolution Y coordinate [#mum]");
380  psd0.add<bool>("switch", true);
381  psd0.add<double>("xmin", -1500);
382  psd0.add<double>("xmax", 1500);
383  psd0.add<int>("NxBins", 100);
384  desc.add<edm::ParameterSetDescription>("Delta_Y_Pixel_Primary", psd0);
385  }
386 
387  //strip sensors
388  {
390  psd0.add<std::string>("name", "Delta_X_Strip");
391  psd0.add<std::string>("title", "#Delta X " + striptag + ";Cluster resolution X coordinate [#mum]");
392  psd0.add<bool>("switch", true);
393  psd0.add<double>("xmin", -250);
394  psd0.add<double>("xmax", 250);
395  psd0.add<int>("NxBins", 100);
396  desc.add<edm::ParameterSetDescription>("Delta_X_Strip", psd0);
397  }
398  {
400  psd0.add<std::string>("name", "Delta_Y_Strip");
401  psd0.add<std::string>("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate [cm]");
402  psd0.add<double>("xmin", -5.0);
403  psd0.add<bool>("switch", true);
404  psd0.add<double>("xmax", 5.0);
405  psd0.add<int>("NxBins", 100);
406  desc.add<edm::ParameterSetDescription>("Delta_Y_Strip", psd0);
407  }
408  {
410  psd0.add<std::string>("name", "Delta_X_Strip_Primary");
411  psd0.add<std::string>("title", "#Delta X " + striptag + ";Cluster resolution X coordinate [#mum]");
412  psd0.add<bool>("switch", true);
413  psd0.add<double>("xmin", -250);
414  psd0.add<double>("xmax", 250);
415  psd0.add<int>("NxBins", 100);
416  desc.add<edm::ParameterSetDescription>("Delta_X_Strip_Primary", psd0);
417  }
418  {
420  psd0.add<std::string>("name", "Delta_Y_Strip_Primary");
421  psd0.add<std::string>("title", "#Delta Y " + striptag + ";Cluster resolution Y coordinate [cm]");
422  psd0.add<double>("xmin", -5.0);
423  psd0.add<bool>("switch", true);
424  psd0.add<double>("xmax", 5.0);
425  psd0.add<int>("NxBins", 100);
426  desc.add<edm::ParameterSetDescription>("Delta_Y_Strip_Primary", psd0);
427  }
428  desc.add<std::string>("TopFolderName", "TrackerPhase2OTClusterV");
429  desc.add<edm::InputTag>("ClusterSource", edm::InputTag("siPhase2Clusters"));
430  desc.add<edm::InputTag>("OuterTrackerDigiSimLinkSource", edm::InputTag("simSiPixelDigis", "Tracker"));
431  desc.add<edm::InputTag>("simtracks", edm::InputTag("g4SimHits"));
432  desc.add<double>("SimTrackMinPt", 0.0);
433  desc.add<std::vector<edm::InputTag>>("PSimHitSource",
434  {
435  edm::InputTag("g4SimHits:TrackerHitsTIBLowTof"),
436  edm::InputTag("g4SimHits:TrackerHitsTIBHighTof"),
437  edm::InputTag("g4SimHits:TrackerHitsTIDLowTof"),
438  edm::InputTag("g4SimHits:TrackerHitsTIDHighTof"),
439  edm::InputTag("g4SimHits:TrackerHitsTOBLowTof"),
440  edm::InputTag("g4SimHits:TrackerHitsTOBHighTof"),
441  edm::InputTag("g4SimHits:TrackerHitsTECLowTof"),
442  edm::InputTag("g4SimHits:TrackerHitsTECHighTof"),
443  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelLowTof"),
444  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelHighTof"),
445  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapLowTof"),
446  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapHighTof"),
447  });
448  descriptions.add("Phase2OTValidateCluster", desc);
449 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillOTHistos()

void Phase2OTValidateCluster::fillOTHistos ( const edm::Event iEvent,
const std::vector< edm::Handle< edm::PSimHitContainer >> &  simHits,
const std::map< unsigned int, SimTrack > &  simTracks 
)
private

Definition at line 155 of file Phase2OTValidateCluster.cc.

References PVValHelper::add(), clustersToken_, phase2tkutil::cmtomicron, Phase2OTValidateCluster::ClusterMEs::deltaX_P, Phase2OTValidateCluster::ClusterMEs::deltaX_P_primary, Phase2OTValidateCluster::ClusterMEs::deltaX_S, Phase2OTValidateCluster::ClusterMEs::deltaX_S_primary, Phase2OTValidateCluster::ClusterMEs::deltaY_P, Phase2OTValidateCluster::ClusterMEs::deltaY_P_primary, Phase2OTValidateCluster::ClusterMEs::deltaY_S, Phase2OTValidateCluster::ClusterMEs::deltaY_S_primary, PVValHelper::dx, PVValHelper::dy, vertexPlots::e4, dqm::impl::MonitorElement::Fill(), TrackerGeometry::getDetectorType(), phase2tkutil::getOTHistoId(), getSimTrackId(), mps_fire::i, TrackerGeometry::idToDetUnit(), iEvent, phase2tkutil::isPrimary(), dqmiolumiharvest::j, layerMEs_, pfDeepBoostedJetPreprocessParams_cfi::lower_bound, TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2SS, Phase2TrackerDigi::pixelToChannel(), FastTrackerRecHitCombiner_cfi::simHits, simOTLinksToken_, TrackCandidateProducer_cfi::simTracks, jetUpdater_cfi::sort, AlCaHLTBitMon_QueryRunRegistry::string, tkGeom_, tTopo_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

157  {
158  // Getting the clusters
159  const auto& clusterHandle = iEvent.getHandle(clustersToken_);
160  // Getting PixelDigiSimLinks
161  const auto& pixelSimLinksHandle = iEvent.getHandle(simOTLinksToken_);
162 
163  // Number of clusters
164  std::map<std::string, unsigned int> nPrimarySimHits[3];
165  std::map<std::string, unsigned int> nOtherSimHits[3];
166  for (const auto& DSVItr : *clusterHandle) {
167  // Getting the id of detector unit
168  uint32_t rawid = DSVItr.detId();
169  DetId detId(rawid);
170  const GeomDetUnit* geomDetUnit(tkGeom_->idToDetUnit(detId));
171  if (!geomDetUnit)
172  continue;
174 
175  std::string folderkey = phase2tkutil::getOTHistoId(detId, tTopo_);
176  for (const auto& clusterItr : DSVItr) {
177  MeasurementPoint mpCluster(clusterItr.center(), clusterItr.column() + 0.5);
178  Local3DPoint localPosCluster = geomDetUnit->topology().localPosition(mpCluster);
179 
180  // Get simTracks from the cluster
181  std::vector<unsigned int> clusterSimTrackIds;
182  for (unsigned int i(0); i < clusterItr.size(); ++i) {
183  unsigned int channel(Phase2TrackerDigi::pixelToChannel(clusterItr.firstRow() + i, clusterItr.column()));
184  std::vector<unsigned int> simTrackIds(getSimTrackId(pixelSimLinksHandle, detId, channel));
185  for (auto it : simTrackIds) {
186  bool add = true;
187  for (unsigned int j = 0; j < clusterSimTrackIds.size(); ++j) {
188  // only save simtrackids that are not present yet
189  if (it == clusterSimTrackIds.at(j))
190  add = false;
191  }
192  if (add)
193  clusterSimTrackIds.push_back(it);
194  }
195  }
196  std::sort(clusterSimTrackIds.begin(), clusterSimTrackIds.end());
197  const PSimHit* closestSimHit = nullptr;
198  float mind = 1e4;
199  // Get the SimHit
200  for (const auto& psimhitCont : simHits) {
201  for (const auto& simhitIt : *psimhitCont) {
202  if (rawid == simhitIt.detUnitId()) {
203  auto it = std::lower_bound(clusterSimTrackIds.begin(), clusterSimTrackIds.end(), simhitIt.trackId());
204  if (it != clusterSimTrackIds.end() && *it == simhitIt.trackId()) {
205  float dx = simhitIt.localPosition().x() - localPosCluster.x();
206  float dy = simhitIt.localPosition().y() - localPosCluster.y();
207  float dist = dx * dx + dy * dy;
208  if (!closestSimHit || dist < mind) {
209  mind = dist;
210  closestSimHit = &simhitIt;
211  }
212  }
213  }
214  } //end loop over PSimhitcontainers
215  } //end loop over simHits
216 
217  if (!closestSimHit)
218  continue;
219  // only look at simhits from highpT tracks
220  auto simTrackIt(simTracks.find(closestSimHit->trackId()));
221  if (simTrackIt == simTracks.end())
222  continue;
223 
224  Local3DPoint localPosSimHit(closestSimHit->localPosition());
225  const float deltaX = localPosCluster.x() - localPosSimHit.x();
226  const float deltaY = localPosCluster.y() - localPosSimHit.y();
227 
228  auto layerMEit = layerMEs_.find(folderkey);
229  if (layerMEit == layerMEs_.end())
230  continue;
231 
232  ClusterMEs& local_mes = layerMEit->second;
234  local_mes.deltaX_P->Fill(phase2tkutil::cmtomicron * deltaX);
235  local_mes.deltaY_P->Fill(phase2tkutil::cmtomicron * deltaY);
237  local_mes.deltaX_S->Fill(phase2tkutil::cmtomicron * deltaX);
238  local_mes.deltaY_S->Fill(deltaY);
239  }
240  // Primary particles only
241  if (phase2tkutil::isPrimary(simTrackIt->second, closestSimHit)) {
243  local_mes.deltaX_P_primary->Fill(phase2tkutil::cmtomicron * deltaX);
244  local_mes.deltaY_P_primary->Fill(phase2tkutil::cmtomicron * deltaY);
246  local_mes.deltaX_S_primary->Fill(phase2tkutil::cmtomicron * deltaX);
247  local_mes.deltaY_S_primary->Fill(deltaY);
248  }
249  }
250  }
251  }
252 }
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
static constexpr float cmtomicron
bool isPrimary(const SimTrack &simTrk, const PSimHit *simHit)
const TrackerGeometry * tkGeom_
edm::EDGetTokenT< edm::DetSetVector< PixelDigiSimLink > > simOTLinksToken_
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
const TrackerTopology * tTopo_
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
ModuleType getDetectorType(DetId) const
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
Definition: DetId.h:17
std::map< std::string, ClusterMEs > layerMEs_
void add(std::map< std::string, TH1 *> &h, TH1 *hist)
edm::EDGetTokenT< Phase2TrackerCluster1DCollectionNew > clustersToken_
std::vector< unsigned int > getSimTrackId(const edm::Handle< edm::DetSetVector< PixelDigiSimLink >> &pixelSimLinks, const DetId &detId, unsigned int channel)

◆ getSimTrackId()

std::vector< unsigned int > Phase2OTValidateCluster::getSimTrackId ( const edm::Handle< edm::DetSetVector< PixelDigiSimLink >> &  pixelSimLinks,
const DetId detId,
unsigned int  channel 
)
private

Definition at line 327 of file Phase2OTValidateCluster.cc.

Referenced by fillOTHistos().

328  {
329  std::vector<unsigned int> retvec;
330  edm::DetSetVector<PixelDigiSimLink>::const_iterator DSViter(pixelSimLinks->find(detId));
331  if (DSViter == pixelSimLinks->end())
332  return retvec;
333  for (edm::DetSet<PixelDigiSimLink>::const_iterator it = DSViter->data.begin(); it != DSViter->data.end(); ++it) {
334  if (channel == it->channel()) {
335  retvec.push_back(it->SimTrackId());
336  }
337  }
338  return retvec;
339 }
iterator find(det_id_type id)
Definition: DetSetVector.h:264
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102

Member Data Documentation

◆ clustersToken_

edm::EDGetTokenT<Phase2TrackerCluster1DCollectionNew> Phase2OTValidateCluster::clustersToken_
private

Definition at line 90 of file Phase2OTValidateCluster.cc.

Referenced by fillOTHistos().

◆ config_

edm::ParameterSet Phase2OTValidateCluster::config_
private

Definition at line 84 of file Phase2OTValidateCluster.cc.

Referenced by bookHistograms(), and bookLayerHistos().

◆ geomToken_

const edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> Phase2OTValidateCluster::geomToken_
private

Definition at line 92 of file Phase2OTValidateCluster.cc.

Referenced by dqmBeginRun().

◆ layerMEs_

std::map<std::string, ClusterMEs> Phase2OTValidateCluster::layerMEs_
private

Definition at line 82 of file Phase2OTValidateCluster.cc.

Referenced by bookLayerHistos(), and fillOTHistos().

◆ pSimHitSrc_

std::vector<edm::InputTag> Phase2OTValidateCluster::pSimHitSrc_
private

Definition at line 91 of file Phase2OTValidateCluster.cc.

Referenced by Phase2OTValidateCluster().

◆ simHitTokens_

std::vector<edm::EDGetTokenT<edm::PSimHitContainer> > Phase2OTValidateCluster::simHitTokens_
private

Definition at line 86 of file Phase2OTValidateCluster.cc.

Referenced by analyze(), and Phase2OTValidateCluster().

◆ simITLinksToken_

edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > Phase2OTValidateCluster::simITLinksToken_
private

Definition at line 88 of file Phase2OTValidateCluster.cc.

◆ simOTLinksToken_

edm::EDGetTokenT<edm::DetSetVector<PixelDigiSimLink> > Phase2OTValidateCluster::simOTLinksToken_
private

Definition at line 87 of file Phase2OTValidateCluster.cc.

Referenced by fillOTHistos().

◆ simtrackminpt_

double Phase2OTValidateCluster::simtrackminpt_
private

Definition at line 85 of file Phase2OTValidateCluster.cc.

Referenced by analyze().

◆ simTracksToken_

edm::EDGetTokenT<edm::SimTrackContainer> Phase2OTValidateCluster::simTracksToken_
private

Definition at line 89 of file Phase2OTValidateCluster.cc.

Referenced by analyze().

◆ tkGeom_

const TrackerGeometry* Phase2OTValidateCluster::tkGeom_ = nullptr
private

◆ topoToken_

const edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> Phase2OTValidateCluster::topoToken_
private

Definition at line 93 of file Phase2OTValidateCluster.cc.

Referenced by dqmBeginRun().

◆ tTopo_

const TrackerTopology* Phase2OTValidateCluster::tTopo_ = nullptr
private

Definition at line 95 of file Phase2OTValidateCluster.cc.

Referenced by bookLayerHistos(), dqmBeginRun(), and fillOTHistos().