CMS 3D CMS Logo

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

#include <Phase2OTValidateTrackingRecHit.cc>

Inheritance diagram for Phase2OTValidateTrackingRecHit:
Phase2OTValidateRecHitBase 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
 
 Phase2OTValidateTrackingRecHit (const edm::ParameterSet &)
 
 ~Phase2OTValidateTrackingRecHit () override
 
- Public Member Functions inherited from Phase2OTValidateRecHitBase
void bookHistograms (DQMStore::IBooker &ibooker, edm::Run const &iRun, edm::EventSetup const &iSetup) override
 
void bookLayerHistos (DQMStore::IBooker &ibooker, unsigned int det_id, std::string &subdir)
 
void dqmBeginRun (const edm::Run &iRun, const edm::EventSetup &iSetup) override
 
void fillOTRecHitHistos (const PSimHit *simhitClosest, const Phase2TrackerRecHit1D *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMapP_primary, std::map< std::string, unsigned int > &nrechitLayerMapS_primary)
 
 Phase2OTValidateRecHitBase (const edm::ParameterSet &)
 
 ~Phase2OTValidateRecHitBase () 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 Phase2OTValidateRecHitBase
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 fillOTHistos (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 DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from Phase2OTValidateRecHitBase
edm::ParameterSet config_
 
const edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordgeomToken_
 
std::string geomType_
 
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: Standalone Plugin for Phase2 RecHit validation

Definition at line 51 of file Phase2OTValidateTrackingRecHit.cc.

Constructor & Destructor Documentation

◆ Phase2OTValidateTrackingRecHit()

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

Definition at line 76 of file Phase2OTValidateTrackingRecHit.cc.

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

77  : Phase2OTValidateRecHitBase(iConfig),
78  config_(iConfig),
79  trackerHitAssociatorConfig_(iConfig, consumesCollector()),
80  simtrackminpt_(iConfig.getParameter<double>("SimTrackMinPt")),
81  tokenTracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracksSrc"))),
82  simTracksToken_(consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("simTracksSrc"))) {
83  edm::LogInfo("Phase2OTValidateTrackingRecHit") << ">>> Construct Phase2OTValidateTrackingRecHit ";
84  for (const auto& itag : config_.getParameter<std::vector<edm::InputTag>>("PSimHitSource"))
85  simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
86 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Phase2OTValidateRecHitBase(const edm::ParameterSet &)
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
Log< level::Info, false > LogInfo

◆ ~Phase2OTValidateTrackingRecHit()

Phase2OTValidateTrackingRecHit::~Phase2OTValidateTrackingRecHit ( )
override

Definition at line 91 of file Phase2OTValidateTrackingRecHit.cc.

91  {
92  // do anything here that needs to be done at desctruction time
93  // (e.g. close files, deallocate resources etc.)
94  edm::LogInfo("Phase2OTValidateTrackingRecHit") << ">>> Destroy Phase2OTValidateTrackingRecHit ";
95 }
Log< level::Info, false > LogInfo

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 100 of file Phase2OTValidateTrackingRecHit.cc.

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

100  {
101  std::vector<edm::Handle<edm::PSimHitContainer>> simHits;
102  for (const auto& itoken : simHitTokens_) {
103  const auto& simHitHandle = iEvent.getHandle(itoken);
104  if (!simHitHandle.isValid())
105  continue;
106  simHits.emplace_back(simHitHandle);
107  }
108  // Get the SimTracks and push them in a map of id, SimTrack
109  const auto& simTracks = iEvent.getHandle(simTracksToken_);
110  std::map<unsigned int, SimTrack> selectedSimTrackMap;
111  for (edm::SimTrackContainer::const_iterator simTrackIt(simTracks->begin()); simTrackIt != simTracks->end();
112  ++simTrackIt) {
113  if (simTrackIt->momentum().pt() > simtrackminpt_) {
114  selectedSimTrackMap.insert(std::make_pair(simTrackIt->trackId(), *simTrackIt));
115  }
116  }
118  fillOTHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap);
119 }
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
void fillOTHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
int iEvent
Definition: GenABIO.cc:224
TrackerHitAssociator::Config trackerHitAssociatorConfig_

◆ fillDescriptions()

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

Definition at line 204 of file Phase2OTValidateTrackingRecHit.cc.

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

204  {
206  // call the base fillPsetDescription for the plots bookings
208 
209  //for macro-pixel sensors
211  desc.add<edm::InputTag>("SimVertexSource", edm::InputTag("g4SimHits"));
212  desc.add<bool>("associatePixel", false);
213  desc.add<bool>("associateHitbySimTrack", true);
214  desc.add<bool>("Verbosity", false);
215  desc.add<bool>("associateStrip", true);
216  desc.add<edm::InputTag>("phase2TrackerSimLinkSrc", edm::InputTag("simSiPixelDigis", "Tracker"));
217  desc.add<bool>("associateRecoTracks", false);
218  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel"));
219  desc.add<bool>("usePhase2Tracker", true);
220  desc.add<edm::InputTag>("rechitsSrc", edm::InputTag("siPhase2RecHits"));
221  desc.add<edm::InputTag>("simTracksSrc", edm::InputTag("g4SimHits"));
222  desc.add<double>("SimTrackMinPt", 2.0);
223  desc.add<std::vector<edm::InputTag>>("PSimHitSource",
224  {
225  edm::InputTag("g4SimHits:TrackerHitsTIBLowTof"),
226  edm::InputTag("g4SimHits:TrackerHitsTIBHighTof"),
227  edm::InputTag("g4SimHits:TrackerHitsTIDLowTof"),
228  edm::InputTag("g4SimHits:TrackerHitsTIDHighTof"),
229  edm::InputTag("g4SimHits:TrackerHitsTOBLowTof"),
230  edm::InputTag("g4SimHits:TrackerHitsTOBHighTof"),
231  edm::InputTag("g4SimHits:TrackerHitsTECLowTof"),
232  edm::InputTag("g4SimHits:TrackerHitsTECHighTof"),
233  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelLowTof"),
234  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelHighTof"),
235  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapLowTof"),
236  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapHighTof"),
237  });
238 
239  desc.add<std::vector<std::string>>("ROUList",
240  {"TrackerHitsPixelBarrelLowTof",
241  "TrackerHitsPixelBarrelHighTof",
242  "TrackerHitsTIBLowTof",
243  "TrackerHitsTIBHighTof",
244  "TrackerHitsTIDLowTof",
245  "TrackerHitsTIDHighTof",
246  "TrackerHitsTOBLowTof",
247  "TrackerHitsTOBHighTof",
248  "TrackerHitsPixelEndcapLowTof",
249  "TrackerHitsPixelEndcapHighTof",
250  "TrackerHitsTECLowTof",
251  "TrackerHitsTECHighTof"});
252  desc.add<edm::InputTag>("tracksSrc", edm::InputTag("generalTracks"));
253  desc.add<std::string>("TopFolderName", "TrackerPhase2OTTrackingRecHitV");
254  descriptions.add("Phase2OTValidateTrackingRecHit", desc);
255 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillOTHistos()

void Phase2OTValidateTrackingRecHit::fillOTHistos ( 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 121 of file Phase2OTValidateTrackingRecHit.cc.

References TrackerHitAssociator::associateHitId(), PVValHelper::dx, PVValHelper::dy, vertexPlots::e4, Phase2OTValidateRecHitBase::fillOTRecHitHistos(), TrackerGeometry::getDetectorType(), phase2tkutil::getOTHistoId(), iEvent, crabWrapper::key, Phase2OTValidateRecHitBase::layerMEs_, BaseTrackerRecHit::localPosition(), TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2SS, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, Phase2OTValidateRecHitBase::tkGeom_, tokenTracks_, HLT_2022v14_cff::track, tracks, Phase2OTValidateRecHitBase::tTopo_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

124  {
125  const auto& tracks = iEvent.getHandle(tokenTracks_);
126  if (!tracks.isValid())
127  return;
128  std::map<std::string, unsigned int> nrechitLayerMapP_primary;
129  std::map<std::string, unsigned int> nrechitLayerMapS_primary;
130  // Loop over tracks
131  for (const auto& track : *tracks) {
132  for (const auto& hit : track.recHits()) {
133  // Get the detector unit's id
134  if (!hit->isValid())
135  continue;
136  auto detId = hit->geographicalId();
137  // check that we are in the pixel
138  auto subdetid = (detId.subdetId());
139  if (subdetid == PixelSubdetector::PixelBarrel || subdetid == PixelSubdetector::PixelEndcap)
140  continue;
141 
142  // determine the detector we are in
146  if (nrechitLayerMapP_primary.find(key) == nrechitLayerMapP_primary.end()) {
147  nrechitLayerMapP_primary.emplace(key, 1);
148  } else {
149  nrechitLayerMapP_primary[key] += 1;
150  }
152  if (nrechitLayerMapS_primary.find(key) == nrechitLayerMapS_primary.end()) {
153  nrechitLayerMapS_primary.emplace(key, 1);
154  } else {
155  nrechitLayerMapS_primary[key] += 1;
156  }
157  }
158  //GetSimHits
159  const Phase2TrackerRecHit1D* rechit = dynamic_cast<const Phase2TrackerRecHit1D*>(hit);
160  if (!rechit) {
161  edm::LogError("Phase2OTValidateTrackingRecHit")
162  << "Cannot cast tracking rechit to Phase2TrackerRecHit1D!" << std::endl;
163  continue;
164  }
165  const std::vector<SimHitIdpr>& matchedId = associateRecHit.associateHitId(*rechit);
166  const PSimHit* simhitClosest = nullptr;
167  LocalPoint lp = rechit->localPosition();
168  float mind = 1e4;
169  for (const auto& simHitCol : simHits) {
170  for (const auto& simhitIt : *simHitCol) {
171  if (detId.rawId() != simhitIt.detUnitId())
172  continue;
173  for (auto& mId : matchedId) {
174  if (simhitIt.trackId() == mId.first) {
175  float dx = simhitIt.localPosition().x() - lp.x();
176  float dy = simhitIt.localPosition().y() - lp.y();
177  float dist = dx * dx + dy * dy;
178  if (!simhitClosest || dist < mind) {
179  mind = dist;
180  simhitClosest = &simhitIt;
181  }
182  }
183  }
184  } //end loop over PSimhitcontainers
185  } //end loop over simHits
186  if (!simhitClosest)
187  continue;
189  simhitClosest, rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
190 
191  } //end loop over rechits of a track
192  } //End loop over tracks
193 
194  //fill nRecHits per event
195  //fill nRecHit counter per layer
196  for (auto& lme : nrechitLayerMapP_primary) {
197  layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
198  }
199  for (auto& lme : nrechitLayerMapS_primary) {
200  layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
201  }
202 }
void fillOTRecHitHistos(const PSimHit *simhitClosest, const Phase2TrackerRecHit1D *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMapP_primary, std::map< std::string, unsigned int > &nrechitLayerMapS_primary)
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
Log< level::Error, false > LogError
T x() const
Definition: PV3DBase.h:59
T y() const
Definition: PV3DBase.h:60
int iEvent
Definition: GenABIO.cc:224
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
ModuleType getDetectorType(DetId) const
const edm::EDGetTokenT< reco::TrackCollection > tokenTracks_
auto const & tracks
cannot be loose
LocalPoint localPosition() const override
std::map< std::string, RecHitME > layerMEs_

Member Data Documentation

◆ config_

edm::ParameterSet Phase2OTValidateTrackingRecHit::config_
private

Definition at line 65 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by Phase2OTValidateTrackingRecHit().

◆ simHitTokens_

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

Definition at line 70 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by analyze(), and Phase2OTValidateTrackingRecHit().

◆ simtrackminpt_

const double Phase2OTValidateTrackingRecHit::simtrackminpt_
private

Definition at line 67 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by analyze().

◆ simTracksToken_

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

Definition at line 69 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by analyze().

◆ tokenTracks_

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

Definition at line 68 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by fillOTHistos().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config Phase2OTValidateTrackingRecHit::trackerHitAssociatorConfig_
private

Definition at line 66 of file Phase2OTValidateTrackingRecHit.cc.

Referenced by analyze().