CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
< DQMEDAnalyzerGlobalCache
initializeGlobalCache (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::SimTrackContainer
simTracksToken_
 
const edm::EDGetTokenT
< Phase2TrackerRecHit1DCollectionNew
tokenRecHitsOT_
 
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,
TrackerDigiGeometryRecord
geomToken_
 
std::string geomType_
 
std::map< std::string, RecHitMElayerMEs_
 
const TrackerGeometrytkGeom_ = nullptr
 
const edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
topoToken_
 
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 48 of file Phase2OTValidateRecHit.cc.

Constructor & Destructor Documentation

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

Definition at line 72 of file Phase2OTValidateRecHit.cc.

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

73  : Phase2OTValidateRecHitBase(iConfig),
74  trackerHitAssociatorConfig_(iConfig, consumesCollector()),
75  simtrackminpt_(iConfig.getParameter<double>("SimTrackMinPt")),
76  tokenRecHitsOT_(consumes<Phase2TrackerRecHit1DCollectionNew>(iConfig.getParameter<edm::InputTag>("rechitsSrc"))),
77  simTracksToken_(consumes<edm::SimTrackContainer>(iConfig.getParameter<edm::InputTag>("simTracksSrc"))) {
78  edm::LogInfo("Phase2OTValidateRecHit") << ">>> Construct Phase2OTValidateRecHit ";
79  for (const auto& itag : config_.getParameter<std::vector<edm::InputTag>>("PSimHitSource"))
80  simHitTokens_.push_back(consumes<edm::PSimHitContainer>(itag));
81 }
Phase2OTValidateRecHitBase(const edm::ParameterSet &)
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Log< level::Info, false > LogInfo
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > tokenRecHitsOT_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< edm::SimTrackContainer > simTracksToken_
Phase2OTValidateRecHit::~Phase2OTValidateRecHit ( )
override

Definition at line 86 of file Phase2OTValidateRecHit.cc.

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

Member Function Documentation

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

Reimplemented from DQMEDAnalyzer.

Definition at line 95 of file Phase2OTValidateRecHit.cc.

References fillOTHistos(), edm::Event::getHandle(), trackerHits::simHits, simHitTokens_, simtrackminpt_, simTracksToken_, and trackerHitAssociatorConfig_.

95  {
96  std::vector<edm::Handle<edm::PSimHitContainer>> simHits;
97  for (const auto& itoken : simHitTokens_) {
98  const auto& simHitHandle = iEvent.getHandle(itoken);
99  if (!simHitHandle.isValid())
100  continue;
101  simHits.emplace_back(simHitHandle);
102  }
103  // Get the SimTracks and push them in a map of id, SimTrack
104  const auto& simTracks = iEvent.getHandle(simTracksToken_);
105  std::map<unsigned int, SimTrack> selectedSimTrackMap;
106  for (const auto& simTrackIt : *simTracks)
107  if (simTrackIt.momentum().pt() > simtrackminpt_) {
108  selectedSimTrackMap.insert(std::make_pair(simTrackIt.trackId(), simTrackIt));
109  }
110  TrackerHitAssociator associateRecHit(iEvent, trackerHitAssociatorConfig_);
111  fillOTHistos(iEvent, associateRecHit, simHits, selectedSimTrackMap);
112 }
std::vector< edm::EDGetTokenT< edm::PSimHitContainer > > simHitTokens_
TrackerHitAssociator::Config trackerHitAssociatorConfig_
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
tuple simHits
Definition: trackerHits.py:16
void fillOTHistos(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_
void Phase2OTValidateRecHit::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 188 of file Phase2OTValidateRecHit.cc.

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

188  {
190  // call the base fillPsetDescription for the plots bookings
192 
193  //for macro-pixel sensors
195  desc.add<edm::InputTag>("SimVertexSource", edm::InputTag("g4SimHits"));
196  desc.add<bool>("associatePixel", false);
197  desc.add<std::string>("TopFolderName", "TrackerPhase2OTRecHitV");
198  desc.add<bool>("associateHitbySimTrack", true);
199  desc.add<bool>("Verbosity", false);
200  desc.add<bool>("associateStrip", true);
201  desc.add<edm::InputTag>("phase2TrackerSimLinkSrc", edm::InputTag("simSiPixelDigis", "Tracker"));
202  desc.add<bool>("associateRecoTracks", false);
203  desc.add<edm::InputTag>("pixelSimLinkSrc", edm::InputTag("simSiPixelDigis", "Pixel"));
204  desc.add<bool>("usePhase2Tracker", true);
205  desc.add<edm::InputTag>("rechitsSrc", edm::InputTag("siPhase2RecHits"));
206  desc.add<edm::InputTag>("simTracksSrc", edm::InputTag("g4SimHits"));
207  desc.add<double>("SimTrackMinPt", 2.0);
208  desc.add<std::vector<edm::InputTag>>("PSimHitSource",
209  {
210  edm::InputTag("g4SimHits:TrackerHitsTIBLowTof"),
211  edm::InputTag("g4SimHits:TrackerHitsTIBHighTof"),
212  edm::InputTag("g4SimHits:TrackerHitsTIDLowTof"),
213  edm::InputTag("g4SimHits:TrackerHitsTIDHighTof"),
214  edm::InputTag("g4SimHits:TrackerHitsTOBLowTof"),
215  edm::InputTag("g4SimHits:TrackerHitsTOBHighTof"),
216  edm::InputTag("g4SimHits:TrackerHitsTECLowTof"),
217  edm::InputTag("g4SimHits:TrackerHitsTECHighTof"),
218  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelLowTof"),
219  edm::InputTag("g4SimHits:TrackerHitsPixelBarrelHighTof"),
220  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapLowTof"),
221  edm::InputTag("g4SimHits:TrackerHitsPixelEndcapHighTof"),
222  });
223 
224  desc.add<std::vector<std::string>>("ROUList",
225  {"TrackerHitsPixelBarrelLowTof",
226  "TrackerHitsPixelBarrelHighTof",
227  "TrackerHitsTIBLowTof",
228  "TrackerHitsTIBHighTof",
229  "TrackerHitsTIDLowTof",
230  "TrackerHitsTIDHighTof",
231  "TrackerHitsTOBLowTof",
232  "TrackerHitsTOBHighTof",
233  "TrackerHitsPixelEndcapLowTof",
234  "TrackerHitsPixelEndcapHighTof",
235  "TrackerHitsTECLowTof",
236  "TrackerHitsTECHighTof"});
237 
238  descriptions.add("Phase2OTValidateRecHit", desc);
239 }
static void fillPSetDescription(edm::ParameterSetDescription &desc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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 114 of file Phase2OTValidateRecHit.cc.

References TrackerHitAssociator::associateHitId(), PVValHelper::dx, PVValHelper::dy, Phase2OTValidateRecHitBase::fillOTRecHitHistos(), TrackerGeometry::getDetectorType(), edm::Event::getHandle(), phase2tkutil::getOTHistoId(), submitPVResolutionJobs::key, Phase2OTValidateRecHitBase::layerMEs_, TrackerGeometry::Ph2PSP, TrackerGeometry::Ph2PSS, TrackerGeometry::Ph2SS, HI_PhotonSkim_cff::rechits, trackerHits::simHits, AlCaHLTBitMon_QueryRunRegistry::string, Phase2OTValidateRecHitBase::tkGeom_, tokenRecHitsOT_, Phase2OTValidateRecHitBase::tTopo_, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by analyze().

117  {
118  // Get the RecHits
119  const auto& rechits = iEvent.getHandle(tokenRecHitsOT_);
120  if (!rechits.isValid())
121  return;
122  std::map<std::string, unsigned int> nrechitLayerMapP_primary;
123  std::map<std::string, unsigned int> nrechitLayerMapS_primary;
124  // Loop over modules
126  for (const auto& DSViter : *rechits) {
127  // Get the detector unit's id
128  unsigned int rawid(DSViter.detId());
129  DetId detId(rawid);
130  // determine the detector we are in
134  if (nrechitLayerMapP_primary.find(key) == nrechitLayerMapP_primary.end()) {
135  nrechitLayerMapP_primary.insert(std::make_pair(key, DSViter.size()));
136  } else {
137  nrechitLayerMapP_primary[key] += DSViter.size();
138  }
140  if (nrechitLayerMapS_primary.find(key) == nrechitLayerMapS_primary.end()) {
141  nrechitLayerMapS_primary.insert(std::make_pair(key, DSViter.size()));
142  } else {
143  nrechitLayerMapS_primary[key] += DSViter.size();
144  }
145  }
146  //loop over rechits for a single detId
147  for (const auto& rechit : DSViter) {
148  //GetSimHits
149  const std::vector<SimHitIdpr>& matchedId = associateRecHit.associateHitId(rechit);
150  const PSimHit* simhitClosest = nullptr;
151  LocalPoint lp = rechit.localPosition();
152  float mind = 1e4;
153  for (const auto& simHitCol : simHits) {
154  for (const auto& simhitIt : *simHitCol) {
155  if (detId.rawId() != simhitIt.detUnitId())
156  continue;
157  for (auto& mId : matchedId) {
158  if (simhitIt.trackId() == mId.first) {
159  float dx = simhitIt.localPosition().x() - lp.x();
160  float dy = simhitIt.localPosition().y() - lp.y();
161  float dist = dx * dx + dy * dy;
162  if (!simhitClosest || dist < mind) {
163  mind = dist;
164  simhitClosest = &simhitIt;
165  }
166  }
167  }
168  } //end loop over PSimhitcontainers
169  } //end loop over simHits
170  if (!simhitClosest)
171  continue;
173  simhitClosest, &rechit, selectedSimTrackMap, nrechitLayerMapP_primary, nrechitLayerMapS_primary);
174 
175  } //end loop over rechits of a detId
176  } //End loop over DetSetVector
177 
178  //fill nRecHits per event
179  //fill nRecHit counter per layer
180  for (auto& lme : nrechitLayerMapP_primary) {
181  layerMEs_[lme.first].numberRecHitsprimary_P->Fill(nrechitLayerMapP_primary[lme.first]);
182  }
183  for (auto& lme : nrechitLayerMapS_primary) {
184  layerMEs_[lme.first].numberRecHitsprimary_S->Fill(nrechitLayerMapS_primary[lme.first]);
185  }
186 }
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)
T y() const
Definition: PV3DBase.h:60
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
Definition: Event.h:563
std::string getOTHistoId(uint32_t det_id, const TrackerTopology *tTopo)
tuple key
prepare the HTCondor submission files and eventually submit them
ModuleType getDetectorType(DetId) const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetId.h:17
const edm::EDGetTokenT< Phase2TrackerRecHit1DCollectionNew > tokenRecHitsOT_
tuple simHits
Definition: trackerHits.py:16
std::vector< SimHitIdpr > associateHitId(const TrackingRecHit &thit) const
T x() const
Definition: PV3DBase.h:59
std::map< std::string, RecHitME > layerMEs_

Member Data Documentation

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

Definition at line 66 of file Phase2OTValidateRecHit.cc.

Referenced by analyze(), and Phase2OTValidateRecHit().

const double Phase2OTValidateRecHit::simtrackminpt_
private

Definition at line 63 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().

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

Definition at line 65 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().

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

Definition at line 64 of file Phase2OTValidateRecHit.cc.

Referenced by fillOTHistos().

TrackerHitAssociator::Config Phase2OTValidateRecHit::trackerHitAssociatorConfig_
private

Definition at line 62 of file Phase2OTValidateRecHit.cc.

Referenced by analyze().