CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
Phase2ITValidateTrackingRecHit Class Reference

#include <Phase2ITValidateTrackingRecHit.cc>

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

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 Phase2ITValidateTrackingRecHit (const edm::ParameterSet &)
 
 ~Phase2ITValidateTrackingRecHit () override
 
- Public Member Functions inherited from Phase2ITValidateRecHitBase
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
void dqmBeginRun (const edm::Run &, const edm::EventSetup &) override
 
 Phase2ITValidateRecHitBase (const edm::ParameterSet &)
 
 ~Phase2ITValidateRecHitBase () 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 Phase2ITValidateRecHitBase
static void fillPSetDescription (edm::ParameterSetDescription &desc)
 
- 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 fillITHistos (const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
 

Private Attributes

edm::ParameterSet config_
 
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
 
const double simtrackminpt_
 
const edm::EDGetTokenT< edm::SimTrackContainersimTracksToken_
 
const edm::EDGetTokenT< reco::TrackCollectiontokenTracks_
 
TrackerHitAssociator::Config trackerHitAssociatorConfig_
 

Additional Inherited Members

- 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
 
- Protected Member Functions inherited from Phase2ITValidateRecHitBase
void bookLayerHistos (DQMStore::IBooker &ibooker, unsigned int det_id, std::string &subdir)
 
void fillRechitHistos (const PSimHit *simhitClosest, const SiPixelRecHit *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMap_primary)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from Phase2ITValidateRecHitBase
edm::ParameterSet config_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::map< std::string, RecHitMElayerMEs_
 
const TrackerGeometrytkGeom_ = nullptr
 
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtopoToken_
 
const TrackerTopologytTopo_ = nullptr
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Description: Plugin for Phase2 TrackingRecHit validation

Definition at line 52 of file Phase2ITValidateTrackingRecHit.cc.

Constructor & Destructor Documentation

◆ Phase2ITValidateTrackingRecHit()

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

Definition at line 72 of file Phase2ITValidateTrackingRecHit.cc.

References config_, edm::ParameterSet::getParameter(), and simHitTokens_.

73  : Phase2ITValidateRecHitBase(iConfig),
74  config_(iConfig),
75  trackerHitAssociatorConfig_(iConfig, consumesCollector()),
76  simtrackminpt_(iConfig.getParameter<double>("SimTrackMinPt")),
77  tokenTracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
78  simTracksToken_(consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("simTracksSrc"))) {
79  edm::LogInfo("Phase2ITValidateRecHit") << ">>> Construct Phase2ITValidateRecHit ";
80  for (const auto& itName : config_.getParameter<std::vector<std::string>>("ROUList")) {
81  simHitTokens_.push_back(consumes<std::vector<PSimHit>>(edm::InputTag("g4SimHits", itName)));
82  }
83 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
TrackerHitAssociator::Config trackerHitAssociatorConfig_
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Log< level::Info, false > LogInfo
Phase2ITValidateRecHitBase(const edm::ParameterSet &)
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_

◆ ~Phase2ITValidateTrackingRecHit()

Phase2ITValidateTrackingRecHit::~Phase2ITValidateTrackingRecHit ( )
override

Definition at line 85 of file Phase2ITValidateTrackingRecHit.cc.

85  {
86  edm::LogInfo("Phase2ITValidateTrackingRecHit") << ">>> Destroy Phase2ITValidateTrackingRecHit ";
87 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 89 of file Phase2ITValidateTrackingRecHit.cc.

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

89  {
90  std::vector<edm::Handle<edm::PSimHitContainer>> simHits;
91  for (const auto& itoken : simHitTokens_) {
92  const auto& simHitHandle = iEvent.getHandle(itoken);
93  if (!simHitHandle.isValid())
94  continue;
95  simHits.emplace_back(simHitHandle);
96  }
97  // Get the SimTracks and push them in a map of id, SimTrack
98  const auto& simTracks = iEvent.getHandle(simTracksToken_);
99 
100  std::map<unsigned int, SimTrack> selectedSimTrackMap;
101  for (const auto& simTrackIt : *simTracks) {
102  if (simTrackIt.momentum().pt() > simtrackminpt_) {
103  selectedSimTrackMap.emplace(simTrackIt.trackId(), simTrackIt);
104  }
105  }
107  fillITHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap);
108 }
TrackerHitAssociator::Config trackerHitAssociatorConfig_
int iEvent
Definition: GenABIO.cc:224
void fillITHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_

◆ fillDescriptions()

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

Definition at line 182 of file Phase2ITValidateTrackingRecHit.cc.

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

182  {
183  // rechitValidIT
185 
186  // call the base fillPsetDescription for the plots bookings
188 
189  //to be used in TrackerHitAssociator
190  desc.add<bool>("associatePixel", true);
191  desc.add<bool>("associateStrip", false);
192  desc.add<bool>("usePhase2Tracker", true);
193  desc.add<bool>("associateRecoTracks", false);
194  desc.add<bool>("associateHitbySimTrack", true);
195  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel"));
196  desc.add<std::vector<std::string>>("ROUList",
197  {
198  "TrackerHitsPixelBarrelLowTof",
199  "TrackerHitsPixelBarrelHighTof",
200  "TrackerHitsPixelEndcapLowTof",
201  "TrackerHitsPixelEndcapHighTof",
202  });
203  //
204  desc.add<edm::InputTag>("simTracksSrc", edm::InputTag("g4SimHits"));
205  desc.add<edm::InputTag>("SimVertexSource", edm::InputTag("g4SimHits"));
206  desc.add<double>("SimTrackMinPt", 2.0);
207  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"));
208  desc.add<std::string>("TopFolderName", "TrackerPhase2ITTrackingRecHitV");
209  desc.add<bool>("Verbosity", false);
210  descriptions.add("Phase2ITValidateTrackingRecHit", desc);
211 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillITHistos()

void Phase2ITValidateTrackingRecHit::fillITHistos ( const edm::Event iEvent,
const TrackerHitAssociator associateRecHit,
const std::vector< edm::Handle< edm::PSimHitContainer >> &  simHits,
const std::map< unsigned int, SimTrack > &  selectedSimTrackMap 
)
private

Definition at line 110 of file Phase2ITValidateTrackingRecHit.cc.

References funct::abs(), TrackerHitAssociator::associateHitId(), Phase2ITValidateRecHitBase::fillRechitHistos(), phase2tkutil::getITHistoId(), TrackerGeometry::idToDetUnit(), iEvent, submitPVResolutionJobs::key, Phase2ITValidateRecHitBase::layerMEs_, BaseTrackerRecHit::localPosition(), ALPAKA_ACCELERATOR_NAMESPACE::brokenline::mId, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, nano_mu_digi_cff::rawId, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, Phase2ITValidateRecHitBase::tkGeom_, tokenTracks_, HLT_2024v12_cff::track, DiMuonV_cfg::tracks, Phase2ITValidateRecHitBase::tTopo_, and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

113  {
114  const auto& tracks = iEvent.getHandle(tokenTracks_);
115  if (!tracks.isValid())
116  return;
117 
118  std::map<std::string, unsigned int> nrechitLayerMap_primary;
119 
120  // loop over tracks
121  for (const auto& track : *tracks) {
122  // loop over hits
123  for (auto const& hit : track.recHits()) {
124  if (!hit->isValid())
125  continue;
126 
127  auto id = hit->geographicalId();
128  // check that we are in the pixel
129  auto subdetid = (id.subdetId());
130  if (!(subdetid == PixelSubdetector::PixelBarrel) && !(subdetid == PixelSubdetector::PixelEndcap))
131  continue;
132 
133  const GeomDetUnit* geomDetunit(tkGeom_->idToDetUnit(id));
134  if (!geomDetunit)
135  continue;
136  // determine the detector we are in
138  if (nrechitLayerMap_primary.find(key) == nrechitLayerMap_primary.end()) {
139  nrechitLayerMap_primary.emplace(key, 1);
140  } else {
141  nrechitLayerMap_primary[key] += 1;
142  }
143 
144  const SiPixelRecHit* rechit = dynamic_cast<const SiPixelRecHit*>(hit);
145  if (!rechit)
146  continue;
147 
148  const std::vector<SimHitIdpr>& matchedId = associateRecHit.associateHitId(*rechit);
149  const PSimHit* simhitClosest = nullptr;
150  float minx = 10000;
151  LocalPoint lp = rechit->localPosition();
152  for (const auto& simHitCol : simHits) {
153  for (const auto& simhitIt : *simHitCol) {
154  if (id.rawId() != simhitIt.detUnitId())
155  continue;
156  for (const auto& mId : matchedId) {
157  if (simhitIt.trackId() == mId.first) {
158  if (!simhitClosest || std::abs(simhitIt.localPosition().x() - lp.x()) < minx) {
159  minx = std::abs(simhitIt.localPosition().x() - lp.x());
160  simhitClosest = &simhitIt;
161  }
162  }
163  }
164  } //end loop over PSimhitcontainers
165  } //end loop over simHits
166 
167  if (!simhitClosest)
168  continue;
169 
170  // call the base class method to fill the plots
171  fillRechitHistos(simhitClosest, rechit, selectedSimTrackMap, nrechitLayerMap_primary);
172 
173  } // loop over tracking rechits
174  } // loop over tracks
175 
176  //fill nRecHit counter per layer
177  for (const auto& lme : nrechitLayerMap_primary) {
178  layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]);
179  }
180 }
std::map< std::string, RecHitME > layerMEs_
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
std::string getITHistoId(uint32_t det_id, const TrackerTopology *tTopo)
T x() const
Definition: PV3DBase.h:59
int iEvent
Definition: GenABIO.cc:224
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
key
prepare the HTCondor submission files and eventually submit them
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
LocalPoint localPosition() const override
void fillRechitHistos(const PSimHit *simhitClosest, const SiPixelRecHit *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMap_primary)
Our base class.
Definition: SiPixelRecHit.h:23

Member Data Documentation

◆ config_

edm::ParameterSet Phase2ITValidateTrackingRecHit::config_
private

Definition at line 64 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by Phase2ITValidateTrackingRecHit().

◆ simHitTokens_

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

Definition at line 69 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by analyze(), and Phase2ITValidateTrackingRecHit().

◆ simtrackminpt_

const double Phase2ITValidateTrackingRecHit::simtrackminpt_
private

Definition at line 66 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by analyze().

◆ simTracksToken_

const edm::EDGetTokenT<edm::SimTrackContainer> Phase2ITValidateTrackingRecHit::simTracksToken_
private

Definition at line 68 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by analyze().

◆ tokenTracks_

const edm::EDGetTokenT<reco::TrackCollection> Phase2ITValidateTrackingRecHit::tokenTracks_
private

Definition at line 67 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by fillITHistos().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config Phase2ITValidateTrackingRecHit::trackerHitAssociatorConfig_
private

Definition at line 65 of file Phase2ITValidateTrackingRecHit.cc.

Referenced by analyze().