CMS 3D CMS Logo

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

#include <Phase2ITValidateRecHit.cc>

Inheritance diagram for Phase2ITValidateRecHit:
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
 
 Phase2ITValidateRecHit (const edm::ParameterSet &)
 
 ~Phase2ITValidateRecHit () 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< SiPixelRecHitCollectiontokenRecHitsIT_
 
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 RecHit validation

Definition at line 49 of file Phase2ITValidateRecHit.cc.

Constructor & Destructor Documentation

◆ Phase2ITValidateRecHit()

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

Definition at line 71 of file Phase2ITValidateRecHit.cc.

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

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

◆ ~Phase2ITValidateRecHit()

Phase2ITValidateRecHit::~Phase2ITValidateRecHit ( )
override

Definition at line 84 of file Phase2ITValidateRecHit.cc.

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

Member Function Documentation

◆ analyze()

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

Reimplemented from DQMEDAnalyzer.

Definition at line 88 of file Phase2ITValidateRecHit.cc.

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

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

◆ fillDescriptions()

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

Definition at line 166 of file Phase2ITValidateRecHit.cc.

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

166  {
167  // rechitValidIT
169 
170  // call the base fillPsetDescription for the plots bookings
172 
173  //to be used in TrackerHitAssociator
174  desc.add<bool>("associatePixel", true);
175  desc.add<bool>("associateStrip", false);
176  desc.add<bool>("usePhase2Tracker", true);
177  desc.add<bool>("associateRecoTracks", false);
178  desc.add<bool>("associateHitbySimTrack", true);
179  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel"));
180  desc.add<std::vector<std::string>>("ROUList",
181  {
182  "TrackerHitsPixelBarrelLowTof",
183  "TrackerHitsPixelBarrelHighTof",
184  "TrackerHitsPixelEndcapLowTof",
185  "TrackerHitsPixelEndcapHighTof",
186  });
187  //
188  desc.add<edm::InputTag>("simTracksSrc", edm::InputTag("g4SimHits"));
189  desc.add<edm::InputTag>("SimVertexSource", edm::InputTag("g4SimHits"));
190  desc.add<double>("SimTrackMinPt", 2.0);
191  desc.add<edm::InputTag>("rechitsSrc", edm::InputTag("siPixelRecHits"));
192  desc.add<std::string>("TopFolderName", "TrackerPhase2ITRecHitV");
193  desc.add<bool>("Verbosity", false);
194  descriptions.add("Phase2ITValidateRecHit", desc);
195 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillITHistos()

void Phase2ITValidateRecHit::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 109 of file Phase2ITValidateRecHit.cc.

References funct::abs(), TrackerHitAssociator::associateHitId(), hcalRecHitTable_cff::detId, Phase2ITValidateRecHitBase::fillRechitHistos(), phase2tkutil::getITHistoId(), iEvent, submitPVResolutionJobs::key, Phase2ITValidateRecHitBase::layerMEs_, ALPAKA_ACCELERATOR_NAMESPACE::brokenline::mId, FastTrackerRecHitCombiner_cfi::simHits, AlCaHLTBitMon_QueryRunRegistry::string, tokenRecHitsIT_, Phase2ITValidateRecHitBase::tTopo_, and PV3DBase< T, PVType, FrameType >::x().

Referenced by analyze().

112  {
113  // Get the RecHits
114  const auto& rechits = iEvent.getHandle(tokenRecHitsIT_);
115  if (!rechits.isValid())
116  return;
117  std::map<std::string, unsigned int> nrechitLayerMap_primary;
118  // Loop over modules
119  for (const auto& DSViter : *rechits) {
120  // Get the detector unit's id
121  unsigned int rawid(DSViter.detId());
122  DetId detId(rawid);
123  // determine the detector we are in
125  if (nrechitLayerMap_primary.find(key) == nrechitLayerMap_primary.end()) {
126  nrechitLayerMap_primary.emplace(key, DSViter.size());
127  } else {
128  nrechitLayerMap_primary[key] += DSViter.size();
129  }
130  //loop over rechits for a single detId
131  for (const auto& rechit : DSViter) {
132  //GetSimHits
133  const std::vector<SimHitIdpr>& matchedId = associateRecHit.associateHitId(rechit);
134  const PSimHit* simhitClosest = nullptr;
135  float minx = 10000;
136  LocalPoint lp = rechit.localPosition();
137  for (const auto& simHitCol : simHits) {
138  for (const auto& simhitIt : *simHitCol) {
139  if (detId.rawId() != simhitIt.detUnitId())
140  continue;
141  for (const auto& mId : matchedId) {
142  if (simhitIt.trackId() == mId.first) {
143  if (!simhitClosest || abs(simhitIt.localPosition().x() - lp.x()) < minx) {
144  minx = std::abs(simhitIt.localPosition().x() - lp.x());
145  simhitClosest = &simhitIt;
146  }
147  }
148  }
149  } //end loop over PSimhitcontainers
150  } //end loop over simHits
151  if (!simhitClosest)
152  continue;
153 
154  // call the base class method to fill the plots
155  fillRechitHistos(simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMap_primary);
156 
157  } //end loop over rechits of a detId
158  } //End loop over DetSetVector
159 
160  //fill nRecHit counter per layer
161  for (const auto& lme : nrechitLayerMap_primary) {
162  layerMEs_[lme.first].numberRecHitsprimary->Fill(nrechitLayerMap_primary[lme.first]);
163  }
164 }
std::map< std::string, RecHitME > layerMEs_
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< SiPixelRecHitCollection > tokenRecHitsIT_
Definition: DetId.h:17
void fillRechitHistos(const PSimHit *simhitClosest, const SiPixelRecHit *rechit, const std::map< unsigned int, SimTrack > &selectedSimTrackMap, std::map< std::string, unsigned int > &nrechitLayerMap_primary)

Member Data Documentation

◆ config_

edm::ParameterSet Phase2ITValidateRecHit::config_
private

Definition at line 63 of file Phase2ITValidateRecHit.cc.

Referenced by Phase2ITValidateRecHit().

◆ simHitTokens_

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

Definition at line 68 of file Phase2ITValidateRecHit.cc.

Referenced by analyze(), and Phase2ITValidateRecHit().

◆ simtrackminpt_

const double Phase2ITValidateRecHit::simtrackminpt_
private

Definition at line 65 of file Phase2ITValidateRecHit.cc.

Referenced by analyze().

◆ simTracksToken_

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

Definition at line 67 of file Phase2ITValidateRecHit.cc.

Referenced by analyze().

◆ tokenRecHitsIT_

const edm::EDGetTokenT<SiPixelRecHitCollection> Phase2ITValidateRecHit::tokenRecHitsIT_
private

Definition at line 66 of file Phase2ITValidateRecHit.cc.

Referenced by fillITHistos().

◆ trackerHitAssociatorConfig_

TrackerHitAssociator::Config Phase2ITValidateRecHit::trackerHitAssociatorConfig_
private

Definition at line 64 of file Phase2ITValidateRecHit.cc.

Referenced by analyze().