CMS 3D CMS Logo

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

#include <Phase2OTValidateRecHit.cc>

Inheritance diagram for Phase2OTValidateRecHit:
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
 
 Phase2OTValidateRecHit (const edm::ParameterSet &)
 
 ~Phase2OTValidateRecHit () 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

std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
 
const double simtrackminpt_
 
const edm::EDGetTokenT< edm::SimTrackContainersimTracksToken_
 
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNewtokenRecHitsOT_
 
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 49 of file Phase2OTValidateRecHit.cc.

Constructor & Destructor Documentation

◆ Phase2OTValidateRecHit()

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

Definition at line 73 of file Phase2OTValidateRecHit.cc.

74  : Phase2OTValidateRecHitBase(iConfig),
75  trackerHitAssociatorConfig_(iConfig, consumesCollector()),
76  simtrackminpt_(iConfig.getParameter<double>("SimTrackMinPt")),
77  tokenRecHitsOT_(consumes<Phase2TrackerRecHit1DCollectionNew>(iConfig.getParameter<edm::InputTag>("rechitsSrc"))),
78  simTracksToken_(consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("simTracksSrc"))) {
79  edm::LogInfo("Phase2OTValidateRecHit") << ">>> Construct Phase2OTValidateRecHit ";
80  for (const auto& itag : config_.getParameter<std::vector<edm::InputTag>>("PSimHitSource"))
81  simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
82 }

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

◆ ~Phase2OTValidateRecHit()

Phase2OTValidateRecHit::~Phase2OTValidateRecHit ( )
override

Definition at line 87 of file Phase2OTValidateRecHit.cc.

87  {
88  // do anything here that needs to be done at desctruction time
89  // (e.g. close files, deallocate resources etc.)
90  edm::LogInfo("Phase2OTValidateRecHit") << ">>> Destroy Phase2OTValidateRecHit ";
91 }

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 96 of file Phase2OTValidateRecHit.cc.

96  {
97  std::vector<edm::Handle<edm::PSimHitContainer>> simHits;
98  for (const auto& itoken : simHitTokens_) {
99  const auto& simHitHandle = iEvent.getHandle(itoken);
100  if (!simHitHandle.isValid())
101  continue;
102  simHits.emplace_back(simHitHandle);
103  }
104  // Get the SimTracks and push them in a map of id, SimTrack
105  const auto& simTracks = iEvent.getHandle(simTracksToken_);
106  std::map<unsigned int, SimTrack> selectedSimTrackMap;
107  for (const auto& simTrackIt : *simTracks)
108  if (simTrackIt.momentum().pt() > simtrackminpt_) {
109  selectedSimTrackMap.insert(std::make_pair(simTrackIt.trackId(), simTrackIt));
110  }
112  fillOTHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap);
113 }

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

◆ fillDescriptions()

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

Definition at line 189 of file Phase2OTValidateRecHit.cc.

189  {
191  // call the base fillPsetDescription for the plots bookings
193 
194  //for macro-pixel sensors
196  desc.add<edm::InputTag>("SimVertexSource", edm::InputTag("g4SimHits"));
197  desc.add<bool>("associatePixel", false);
198  desc.add<std::string>("TopFolderName", "TrackerPhase2OTRecHitV");
199  desc.add<bool>("associateHitbySimTrack", true);
200  desc.add<bool>("Verbosity", false);
201  desc.add<bool>("associateStrip", true);
202  desc.add<edm::InputTag>("phase2TrackerSimLinkSrc", edm::InputTag("simSiPixelDigis", "Tracker"));
203  desc.add<bool>("associateRecoTracks", false);
204  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel"));
205  desc.add<bool>("usePhase2Tracker", true);
206  desc.add<edm::InputTag>("rechitsSrc", edm::InputTag("siPhase2RecHits"));
207  desc.add<edm::InputTag>("simTracksSrc", edm::InputTag("g4SimHits"));
208  desc.add<double>("SimTrackMinPt", 2.0);
209  desc.add<std::vector<edm::InputTag>>("PSimHitSource",
210  {
211  edm::InputTag("g4SimHits:TrackerHitsTIBLowTof"),
212  edm::InputTag("g4SimHits:TrackerHitsTIBHighTof"),
213  edm::InputTag("g4SimHits:TrackerHitsTIDLowTof"),
214  edm::InputTag("g4SimHits:TrackerHitsTIDHighTof"),
215  edm::InputTag("g4SimHits:TrackerHitsTOBLowTof"),
216  edm::InputTag("g4SimHits:TrackerHitsTOBHighTof"),
217  edm::InputTag("g4SimHits:TrackerHitsTECLowTof"),
218  edm::InputTag("g4SimHits:TrackerHitsTECHighTof"),
219  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelLowTof"),
220  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelHighTof"),
221  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapLowTof"),
222  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapHighTof"),
223  });
224 
225  desc.add<std::vector<std::string>>("ROUList",
226  {"TrackerHitsPixelBarrelLowTof",
227  "TrackerHitsPixelBarrelHighTof",
228  "TrackerHitsTIBLowTof",
229  "TrackerHitsTIBHighTof",
230  "TrackerHitsTIDLowTof",
231  "TrackerHitsTIDHighTof",
232  "TrackerHitsTOBLowTof",
233  "TrackerHitsTOBHighTof",
234  "TrackerHitsPixelEndcapLowTof",
235  "TrackerHitsPixelEndcapHighTof",
236  "TrackerHitsTECLowTof",
237  "TrackerHitsTECHighTof"});
238 
239  descriptions.add("Phase2OTValidateRecHit", desc);
240 }

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

◆ fillOTHistos()

void Phase2OTValidateRecHit::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 115 of file Phase2OTValidateRecHit.cc.

118  {
119  // Get the RecHits
120  const auto& rechits = iEvent.getHandle(tokenRecHitsOT_);
121  if (!rechits.isValid())
122  return;
123  std::map<std::string, unsigned int> nrechitLayerMapP_primary;
124  std::map<std::string, unsigned int> nrechitLayerMapS_primary;
125  // Loop over modules
127  for (const auto& DSViter : *rechits) {
128  // Get the detector unit's id
129  unsigned int rawid(DSViter.detId());
130  DetId detId(rawid);
131  // determine the detector we are in
135  if (nrechitLayerMapP_primary.find(key) == nrechitLayerMapP_primary.end()) {
136  nrechitLayerMapP_primary.insert(std::make_pair(key, DSViter.size()));
137  } else {
138  nrechitLayerMapP_primary[key] += DSViter.size();
139  }
141  if (nrechitLayerMapS_primary.find(key) == nrechitLayerMapS_primary.end()) {
142  nrechitLayerMapS_primary.insert(std::make_pair(key, DSViter.size()));
143  } else {
144  nrechitLayerMapS_primary[key] += DSViter.size();
145  }
146  }
147  //loop over rechits for a single detId
148  for (const auto& rechit : DSViter) {
149  //GetSimHits
150  const std::vector<SimHitIdpr>& matchedId = associateRecHit.associateHitId(rechit);
151  const PSimHit* simhitClosest = nullptr;
152  LocalPoint lp = rechit.localPosition();
153  float mind = 1e4;
154  for (const auto& simHitCol : simHits) {
155  for (const auto& simhitIt : *simHitCol) {
156  if (detId.rawId() != simhitIt.detUnitId())
157  continue;
158  for (auto& mId : matchedId) {
159  if (simhitIt.trackId() == mId.first) {
160  float dx = simhitIt.localPosition().x() - lp.x();
161  float dy = simhitIt.localPosition().y() - lp.y();
162  float dist = dx * dx + dy * dy;
163  if (!simhitClosest || dist < mind) {
164  mind = dist;
165  simhitClosest = &simhitIt;
166  }
167  }
168  }
169  } //end loop over PSimhitcontainers
170  } //end loop over simHits
171  if (!simhitClosest)
172  continue;
174  simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
175 
176  } //end loop over rechits of a detId
177  } //End loop over DetSetVector
178 
179  //fill nRecHits per event
180  //fill nRecHit counter per layer
181  for (auto& lme : nrechitLayerMapP_primary) {
182  layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
183  }
184  for (auto& lme : nrechitLayerMapS_primary) {
185  layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
186  }
187 }

References TrackerHitAssociator::associateHitId(), PVValHelper::dx, PVValHelper::dy, vertexPlots::e4, Phase2OTValidateRecHitBase::fillOTRecHitHistos(), TrackerGeometry::getDetectorType(), phase2tkutil::getOTHistoId(), iEvent, crabWrapper::key, Phase2OTValidateRecHitBase::layerMEs_, TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2SS, HI_PhotonSkim_cff::rechits, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, Phase2OTValidateRecHitBase::tkGeom_, tokenRecHitsOT_, Phase2OTValidateRecHitBase::tTopo_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

Member Data Documentation

◆ simHitTokens_

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

Definition at line 67 of file Phase2OTValidateRecHit.cc.

Referenced by analyze(), and Phase2OTValidateRecHit().

◆ simtrackminpt_

const double Phase2OTValidateRecHit::simtrackminpt_
private

Definition at line 64 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().

◆ simTracksToken_

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

Definition at line 66 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().

◆ tokenRecHitsOT_

const edm::EDGetTokenT<Phase2TrackerRecHit1DCollectionNew> Phase2OTValidateRecHit::tokenRecHitsOT_
private

Definition at line 65 of file Phase2OTValidateRecHit.cc.

Referenced by fillOTHistos().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config Phase2OTValidateRecHit::trackerHitAssociatorConfig_
private

Definition at line 63 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().

Phase2OTValidateRecHitBase::layerMEs_
std::map< std::string, RecHitME > layerMEs_
Definition: Phase2OTValidateRecHitBase.h:102
TrackerGeometry::ModuleType::Ph2SS
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
Phase2OTValidateRecHitBase::tTopo_
const TrackerTopology * tTopo_
Definition: Phase2OTValidateRecHitBase.h:65
Phase2OTValidateRecHit::tokenRecHitsOT_
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > tokenRecHitsOT_
Definition: Phase2OTValidateRecHit.cc:65
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89301
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:197
Phase2OTValidateRecHitBase::fillPSetDescription
static void fillPSetDescription(edm::ParameterSetDescription &desc)
Definition: Phase2OTValidateRecHitBase.cc:254
FastTrackerRecHitCombiner_cfi.simHits
simHits
Definition: FastTrackerRecHitCombiner_cfi.py:5
TrackCandidateProducer_cfi.simTracks
simTracks
Definition: TrackCandidateProducer_cfi.py:15
Phase2OTValidateRecHitBase::fillOTRecHitHistos
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)
Definition: Phase2OTValidateRecHitBase.cc:52
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TrackerGeometry::getDetectorType
ModuleType getDetectorType(DetId) const
Definition: TrackerGeometry.cc:247
DetId
Definition: DetId.h:17
Phase2OTValidateRecHit::fillOTHistos
void fillOTHistos(const edm::Event &iEvent, const TrackerHitAssociator &associateRecHit, const std::vector< edm::Handle< edm::PSimHitContainer >> &simHits, const std::map< unsigned int, SimTrack > &selectedSimTrackMap)
Definition: Phase2OTValidateRecHit.cc:115
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TrackerGeometry::ModuleType
ModuleType
Definition: TrackerGeometry.h:29
HI_PhotonSkim_cff.rechits
rechits
Definition: HI_PhotonSkim_cff.py:76
Point3DBase< float, LocalTag >
Phase2OTValidateRecHitBase::tkGeom_
const TrackerGeometry * tkGeom_
Definition: Phase2OTValidateRecHitBase.h:64
Phase2OTValidateRecHit::simTracksToken_
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Definition: Phase2OTValidateRecHit.cc:66
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
iEvent
int iEvent
Definition: GenABIO.cc:224
PVValHelper::dy
Definition: PVValidationHelpers.h:50
Phase2OTValidateRecHit::simHitTokens_
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
Definition: Phase2OTValidateRecHit.cc:67
TrackerGeometry::ModuleType::Ph2PSS
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
Phase2OTValidateRecHit::trackerHitAssociatorConfig_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Definition: Phase2OTValidateRecHit.cc:63
TrackerHitAssociator
Definition: TrackerHitAssociator.h:55
Phase2OTValidateRecHit::simtrackminpt_
const double simtrackminpt_
Definition: Phase2OTValidateRecHit.cc:64
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Phase2OTValidateRecHitBase::Phase2OTValidateRecHitBase
Phase2OTValidateRecHitBase(const edm::ParameterSet &)
Definition: Phase2OTValidateRecHitBase.cc:30
PSimHit
Definition: PSimHit.h:15
crabWrapper.key
key
Definition: crabWrapper.py:19
TrackerHitAssociator::associateHitId
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
Definition: TrackerHitAssociator.cc:332
edm::InputTag
Definition: InputTag.h:15
PVValHelper::dx
Definition: PVValidationHelpers.h:49
vertexPlots.e4
e4
Definition: vertexPlots.py:64
phase2tkutil::getOTHistoId
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
Definition: TrackerPhase2DQMUtil.cc:25
TrackerGeometry::ModuleType::Ph2PSP
Phase2OTValidateRecHitBase::config_
edm::ParameterSet config_
Definition: Phase2OTValidateRecHitBase.h:60