CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
tmtt::InputData Class Reference

#include <InputData.h>

Public Member Functions

const std::list< Stub > & allStubs () const
 
const std::list< TP > & getTPs () const
 
 InputData (const edm::Event &iEvent, const edm::EventSetup &iSetup, const Settings *settings, StubWindowSuggest *stubWindowSuggest, const DegradeBend *degradeBend, const TrackerGeometry *trackerGeometry, const TrackerTopology *trackerTopology, const std::list< TrackerModule > &listTrackerModule, const edm::EDGetTokenT< TrackingParticleCollection > tpToken, const edm::EDGetTokenT< TTStubDetSetVec > stubToken, const edm::EDGetTokenT< TTStubAssMap > stubTruthToken, const edm::EDGetTokenT< TTClusterAssMap > clusterTruthToken, const edm::EDGetTokenT< reco::GenJetCollection > genJetToken)
 
const std::list< Stub * > & stubs () const
 
const std::list< const Stub * > & stubsConst () const
 
const std::list< TrackerModule > & trackerModules () const
 

Private Attributes

const DegradeBenddegradeBend_
 
bool enableMCtruth_
 
StubWindowSuggeststubWindowSuggest_
 
std::list< TrackerModuletrackerModules_
 
std::list< StubvAllStubs_
 
std::list< Stub * > vStubs_
 
std::list< const Stub * > vStubsConst_
 
std::list< TPvTPs_
 

Detailed Description

Definition at line 21 of file InputData.h.

Constructor & Destructor Documentation

◆ InputData()

tmtt::InputData::InputData ( const edm::Event iEvent,
const edm::EventSetup iSetup,
const Settings settings,
StubWindowSuggest stubWindowSuggest,
const DegradeBend degradeBend,
const TrackerGeometry trackerGeometry,
const TrackerTopology trackerTopology,
const std::list< TrackerModule > &  listTrackerModule,
const edm::EDGetTokenT< TrackingParticleCollection tpToken,
const edm::EDGetTokenT< TTStubDetSetVec stubToken,
const edm::EDGetTokenT< TTStubAssMap stubTruthToken,
const edm::EDGetTokenT< TTClusterAssMap clusterTruthToken,
const edm::EDGetTokenT< reco::GenJetCollection genJetToken 
)

Definition at line 28 of file InputData.cc.

41  : // Note if job will use MC truth info (or skip it to save CPU).
42  enableMCtruth_(settings->enableMCtruth()) {
44  edm::Handle<TTStubDetSetVec> ttStubHandle;
45  edm::Handle<TTStubAssMap> mcTruthTTStubHandle;
46  edm::Handle<TTClusterAssMap> mcTruthTTClusterHandle;
48  iEvent.getByToken(stubToken, ttStubHandle);
49  if (enableMCtruth_) {
50  iEvent.getByToken(tpToken, tpHandle);
51  iEvent.getByToken(stubTruthToken, mcTruthTTStubHandle);
52  iEvent.getByToken(clusterTruthToken, mcTruthTTClusterHandle);
53  iEvent.getByToken(genJetToken, genJetHandle);
54  }
55 
56  // Get TrackingParticle info
57 
58  if (enableMCtruth_) {
59  unsigned int tpCount = 0;
60  for (unsigned int i = 0; i < tpHandle->size(); i++) {
61  const TrackingParticle& tPart = tpHandle->at(i);
62  // Creating Ptr uses CPU, so apply Pt cut here, copied from TP::fillUse(), to avoid doing it too often.
63  constexpr float ptMinScale = 0.7;
64  const float ptMin = min(settings->genMinPt(), ptMinScale * settings->houghMinPt());
65  if (tPart.pt() > ptMin) {
66  TrackingParticlePtr tpPtr(tpHandle, i);
67  // Store the TrackingParticle info, using class TP to provide easy access to the most useful info.
68  TP tp(tpPtr, tpCount, settings);
69  // Only bother storing tp if it could be useful for tracking efficiency or fake rate measurements.
70  if (tp.use()) {
71  if (genJetHandle.isValid()) {
72  tp.fillNearestJetInfo(genJetHandle.product());
73  }
74 
75  vTPs_.push_back(tp);
76  tpCount++;
77  }
78  }
79  }
80  }
81 
82  // Also create map relating edm::Ptr<TrackingParticle> to TP.
83 
84  map<edm::Ptr<TrackingParticle>, const TP*> translateTP;
85 
86  if (enableMCtruth_) {
87  for (const TP& tp : vTPs_) {
88  const TrackingParticlePtr& tpPtr = tp.trackingParticlePtr();
89  translateTP[tpPtr] = &tp;
90  }
91  }
92 
93  // Initialize code for killing some stubs to model detector problems.
94  const StubKiller::KillOptions killOpt = static_cast<StubKiller::KillOptions>(settings->killScenario());
95  std::unique_ptr<const StubKiller> stubKiller;
96  if (killOpt != StubKiller::KillOptions::none) {
97  stubKiller = std::make_unique<StubKiller>(killOpt, trackerTopology, trackerGeometry, iEvent);
98  }
99 
100  // Loop over tracker modules to get module info & stubs.
101 
102  for (const TrackerModule& trackerModule : listTrackerModule) {
103  const DetId& stackedDetId = trackerModule.stackedDetId();
104  TTStubDetSetVec::const_iterator p_module = ttStubHandle->find(stackedDetId);
105  if (p_module != ttStubHandle->end()) {
106  for (TTStubDetSet::const_iterator p_ttstub = p_module->begin(); p_ttstub != p_module->end(); p_ttstub++) {
107  TTStubRef ttStubRef = edmNew::makeRefTo(ttStubHandle, p_ttstub);
108  const unsigned int stubIndex = vAllStubs_.size();
109 
110  // Store the Stub info, using class Stub to provide easy access to the most useful info.
111  vAllStubs_.emplace_back(
112  ttStubRef, stubIndex, settings, trackerTopology, &trackerModule, degradeBend, stubKiller.get());
113 
114  // Also fill truth associating stubs to tracking particles.
115  if (enableMCtruth_) {
116  Stub& stub = vAllStubs_.back();
117  stub.fillTruth(translateTP, mcTruthTTStubHandle, mcTruthTTClusterHandle);
118  }
119  }
120  }
121  }
122 
123  // Produced reduced list containing only the subset of stubs that the user has declared will be
124  // output by the front-end readout electronics.
125  for (Stub& s : vAllStubs_) {
126  if (s.frontendPass()) {
127  vStubs_.push_back(&s);
128  vStubsConst_.push_back(&s);
129  }
130  }
131  // Optionally sort stubs according to bend, so highest Pt ones are sent from DTC to GP first.
132  if (settings->orderStubsByBend()) {
133  auto orderStubsByBend = [](const Stub* a, const Stub* b) { return (std::abs(a->bend()) < std::abs(b->bend())); };
134  vStubs_.sort(orderStubsByBend);
135  }
136 
137  // Note list of stubs produced by each tracking particle.
138  // (By passing vAllStubs_ here instead of vStubs_, it means that any algorithmic efficiencies
139  // measured will be reduced if the tightened frontend electronics cuts, specified in section StubCuts
140  // of Analyze_Defaults_cfi.py, are not 100% efficient).
141  if (enableMCtruth_) {
142  for (TP& tp : vTPs_) {
143  tp.fillTruth(vAllStubs_);
144  }
145  }
146 
147  // If requested, recommend better FE stub window cuts.
148  if (settings->printStubWindows()) {
149  for (const Stub& s : vAllStubs_) {
150  stubWindowSuggest->process(trackerTopology, &s);
151  }
152  }
153  }

References a, funct::abs(), b, enableMCtruth_, edmNew::DetSetVector< T >::end(), tmtt::Stub::fillTruth(), edmNew::DetSetVector< T >::find(), genTree_cfi::genJetToken, tmtt::Settings::genMinPt(), tmtt::Settings::houghMinPt(), mps_fire::i, iEvent, edm::HandleBase::isValid(), tmtt::Settings::killScenario(), edmNew::makeRefTo(), min(), tmtt::StubKiller::none, tmtt::Settings::orderStubsByBend(), tmtt::Settings::printStubWindows(), tmtt::StubWindowSuggest::process(), edm::Handle< T >::product(), TrackingParticle::pt(), ptMin, alignCSCRings::s, cmsswSequenceInfo::tp, vAllStubs_, vStubs_, vStubsConst_, and vTPs_.

Member Function Documentation

◆ allStubs()

const std::list<Stub>& tmtt::InputData::allStubs ( ) const
inline

Definition at line 50 of file InputData.h.

50 { return vAllStubs_; }

References vAllStubs_.

Referenced by tmtt::Histos::fillInputData().

◆ getTPs()

const std::list<TP>& tmtt::InputData::getTPs ( ) const
inline

Definition at line 41 of file InputData.h.

41 { return vTPs_; }

References vTPs_.

Referenced by tmtt::Histos::fillInputData(), tmtt::Histos::fillTrackFitting(), and tmtt::TMTrackProducer::produce().

◆ stubs()

const std::list<Stub*>& tmtt::InputData::stubs ( ) const
inline

Definition at line 43 of file InputData.h.

43 { return vStubs_; }

References vStubs_.

◆ stubsConst()

const std::list<const Stub*>& tmtt::InputData::stubsConst ( ) const
inline

Definition at line 45 of file InputData.h.

45 { return vStubsConst_; }

References vStubsConst_.

Referenced by tmtt::Histos::fillEtaPhiSectors(), and tmtt::Histos::fillInputData().

◆ trackerModules()

const std::list<TrackerModule>& tmtt::InputData::trackerModules ( ) const
inline

Definition at line 38 of file InputData.h.

38 { return trackerModules_; };

References trackerModules_.

Member Data Documentation

◆ degradeBend_

const DegradeBend* tmtt::InputData::degradeBend_
private

Definition at line 69 of file InputData.h.

◆ enableMCtruth_

bool tmtt::InputData::enableMCtruth_
private

Definition at line 53 of file InputData.h.

Referenced by InputData().

◆ stubWindowSuggest_

StubWindowSuggest* tmtt::InputData::stubWindowSuggest_
private

Definition at line 67 of file InputData.h.

◆ trackerModules_

std::list<TrackerModule> tmtt::InputData::trackerModules_
private

Definition at line 55 of file InputData.h.

Referenced by trackerModules().

◆ vAllStubs_

std::list<Stub> tmtt::InputData::vAllStubs_
private

Definition at line 64 of file InputData.h.

Referenced by allStubs(), and InputData().

◆ vStubs_

std::list<Stub*> tmtt::InputData::vStubs_
private

Definition at line 58 of file InputData.h.

Referenced by InputData(), and stubs().

◆ vStubsConst_

std::list<const Stub*> tmtt::InputData::vStubsConst_
private

Definition at line 59 of file InputData.h.

Referenced by InputData(), and stubsConst().

◆ vTPs_

std::list<TP> tmtt::InputData::vTPs_
private

Definition at line 57 of file InputData.h.

Referenced by getTPs(), and InputData().

tmtt::InputData::vTPs_
std::list< TP > vTPs_
Definition: InputData.h:57
mps_fire.i
i
Definition: mps_fire.py:355
edm::Handle::product
T const * product() const
Definition: Handle.h:70
min
T min(T a, T b)
Definition: MathUtil.h:58
edmNew::makeRefTo
edm::Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, typename HandleT::element_type::value_type::const_iterator itIter)
Definition: DetSetVectorNew.h:735
ptMin
constexpr float ptMin
Definition: PhotonIDValueMapProducer.cc:153
edmNew::DetSetVector::const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Definition: DetSetVectorNew.h:231
DigiToRawDM_cff.TP
TP
Definition: DigiToRawDM_cff.py:51
edm::Handle< TrackingParticleCollection >
edm::Ref< TTStubDetSetVec, TTStub< Ref_Phase2TrackerDigi_ > >
tmtt::InputData::vStubsConst_
std::list< const Stub * > vStubsConst_
Definition: InputData.h:59
DetId
Definition: DetId.h:17
alignCSCRings.s
s
Definition: alignCSCRings.py:92
edmNew::DetSetVector::find
const_iterator find(id_type i, bool update=false) const
Definition: DetSetVectorNew.h:560
TrackingParticle::pt
double pt() const
Transverse momentum. Note this is taken from the first SimTrack only.
Definition: TrackingParticle.h:142
TrackingParticle
Monte Carlo truth information used for tracking validation.
Definition: TrackingParticle.h:29
b
double b
Definition: hdecay.h:118
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
tmtt::InputData::trackerModules_
std::list< TrackerModule > trackerModules_
Definition: InputData.h:55
a
double a
Definition: hdecay.h:119
tmtt::StubKiller::KillOptions
KillOptions
Definition: StubKiller.h:22
tmtt::StubKiller::KillOptions::none
iEvent
int iEvent
Definition: GenABIO.cc:224
tmtt::InputData::enableMCtruth_
bool enableMCtruth_
Definition: InputData.h:53
genTree_cfi.genJetToken
genJetToken
Definition: genTree_cfi.py:5
tmtt::InputData::vStubs_
std::list< Stub * > vStubs_
Definition: InputData.h:58
tmtt::TrackingParticlePtr
edm::Ptr< TrackingParticle > TrackingParticlePtr
Definition: TP.h:19
edmNew::DetSetVector::end
const_iterator end(bool update=false) const
Definition: DetSetVectorNew.h:577
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
tmtt::InputData::vAllStubs_
std::list< Stub > vAllStubs_
Definition: InputData.h:64
edmNew::DetSet::const_iterator
const data_type * const_iterator
Definition: DetSetNew.h:31