CMS 3D CMS Logo

List of all members | Public Member Functions | Private Types | Private Attributes
SiPixelPhase1TrackingParticleV Class Reference

#include <SiPixelPhase1TrackingParticleV.h>

Inheritance diagram for SiPixelPhase1TrackingParticleV:
SiPixelPhase1Base DQMEDAnalyzer HistogramManagerHolder edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelPhase1TrackingParticleV (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from SiPixelPhase1Base
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &) override
 
 SiPixelPhase1Base (const edm::ParameterSet &iConfig)
 
 ~SiPixelPhase1Base () 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
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
- Public Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig, edm::ConsumesCollector &&iC, edm::Transition transition=edm::Transition::BeginRun)
 

Private Types

enum  {
  MASS, CHARGE, ID, NHITS,
  MATCHED, PT, PHI, ETA,
  VTX, VTY, VYZ, TIP,
  LIP
}
 

Private Attributes

std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
 
edm::EDGetTokenT< TrackingParticleCollectionvec_TrackingParticle_Token_
 

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 >
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- 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 &)
 
- Protected Types inherited from SiPixelPhase1Base
enum  { DCS }
 
- Protected Member Functions inherited from SiPixelPhase1Base
bool checktrigger (const edm::Event &iEvent, const edm::EventSetup &, const unsigned trgidx) const
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 
- Protected Attributes inherited from HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Detailed Description

Definition at line 21 of file SiPixelPhase1TrackingParticleV.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
private
Enumerator
MASS 
CHARGE 
ID 
NHITS 
MATCHED 
PT 
PHI 
ETA 
VTX 
VTY 
VYZ 
TIP 
LIP 

Definition at line 22 of file SiPixelPhase1TrackingParticleV.h.

22  {
23  MASS,
24  CHARGE,
25  ID,
26  NHITS,
27  MATCHED,
28  PT,
29  PHI,
30  ETA,
31  VTX,
32  VTY,
33  VYZ,
34  TIP,
35  LIP,
36  };

Constructor & Destructor Documentation

◆ SiPixelPhase1TrackingParticleV()

SiPixelPhase1TrackingParticleV::SiPixelPhase1TrackingParticleV ( const edm::ParameterSet conf)
explicit

Definition at line 45 of file SiPixelPhase1TrackingParticleV.cc.

46  : SiPixelPhase1Base(iConfig),
47  vec_TrackingParticle_Token_(consumes<TrackingParticleCollection>(iConfig.getParameter<edm::InputTag>("src"))) {
48  for (const auto &tag : iConfig.getParameter<std::vector<edm::InputTag>>("simHitToken")) {
49  simHitTokens_.push_back(consumes<std::vector<PSimHit>>(tag));
50  }
51 }

References edm::ParameterSet::getParameter(), simHitTokens_, and GlobalPosition_Frontier_DevDB_cff::tag.

Member Function Documentation

◆ analyze()

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

Implements SiPixelPhase1Base.

Definition at line 53 of file SiPixelPhase1TrackingParticleV.cc.

53  {
54  edm::Handle<TrackingParticleCollection> TruthTrackContainer;
55  iEvent.getByToken(vec_TrackingParticle_Token_, TruthTrackContainer);
56  const TrackingParticleCollection *tPC = TruthTrackContainer.product();
57  std::vector<std::pair<unsigned int, const PSimHit *>> trackIdToHitPtr;
58 
59  // A multimap linking SimTrack::trackId() to a pointer to PSimHit
60  // Similar to TrackingTruthAccumulator
61  for (const auto &simHitToken : simHitTokens_) {
63  iEvent.getByToken(simHitToken, hsimhits);
64  trackIdToHitPtr.reserve(trackIdToHitPtr.size() + hsimhits->size());
65  for (const auto &simHit : *hsimhits) {
66  trackIdToHitPtr.emplace_back(simHit.trackId(), &simHit);
67  }
68  }
69  std::stable_sort(trackIdToHitPtr.begin(), trackIdToHitPtr.end(), trackIdHitPairLessSort);
70 
71  // Loop over TrackingParticle's
72  for (TrackingParticleCollection::const_iterator t = tPC->begin(); t != tPC->end(); ++t) {
73  // histo manager requires a det ID, use first tracker hit
74 
75  bool isBpixtrack = false, isFpixtrack = false;
76  DetId id;
77 
78  for (const SimTrack &simTrack : t->g4Tracks()) {
79  // Logic is from TrackingTruthAccumulator
80  auto range = std::equal_range(trackIdToHitPtr.begin(),
81  trackIdToHitPtr.end(),
82  std::pair<unsigned int, const PSimHit *>(simTrack.trackId(), nullptr),
83  trackIdHitPairLess);
84  if (range.first == range.second)
85  continue;
86 
87  auto iHitPtr = range.first;
88  for (; iHitPtr != range.second; ++iHitPtr) {
89  const PSimHit &simHit = *(iHitPtr->second);
90  if (simHit.eventId() != t->eventId())
91  continue;
92  id = DetId(simHit.detUnitId());
93 
94  // check we are in pixel
95  uint32_t subdetid = (id.subdetId());
96  if (subdetid == PixelSubdetector::PixelBarrel)
97  isBpixtrack = true;
98  if (subdetid == PixelSubdetector::PixelEndcap)
99  isFpixtrack = true;
100  if (subdetid != PixelSubdetector::PixelBarrel && subdetid != PixelSubdetector::PixelEndcap)
101  continue;
102  }
103  }
104 
105  if (isBpixtrack || isFpixtrack) {
106  histo[MASS].fill(t->mass(), id, &iEvent);
107  histo[CHARGE].fill(t->charge(), id, &iEvent);
108  histo[ID].fill(t->pdgId(), id, &iEvent);
109  histo[NHITS].fill(t->numberOfTrackerHits(), id, &iEvent);
110  histo[MATCHED].fill(t->numberOfTrackerLayers(), id, &iEvent);
111  histo[PT].fill(sqrt(t->momentum().perp2()), id, &iEvent);
112  histo[PHI].fill(t->momentum().Phi(), id, &iEvent);
113  histo[ETA].fill(t->momentum().eta(), id, &iEvent);
114  histo[VTX].fill(t->vx(), id, &iEvent);
115  histo[VTY].fill(t->vy(), id, &iEvent);
116  histo[VYZ].fill(t->vz(), id, &iEvent);
117  histo[TIP].fill(sqrt(t->vertex().perp2()), id, &iEvent);
118  histo[LIP].fill(t->vz(), id, &iEvent);
119  }
120  }
121 }

References CHARGE, ETA, HistogramManagerHolder::histo, ID, triggerObjects_cff::id, iEvent, LIP, MASS, MATCHED, NHITS, PHI, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::Handle< T >::product(), PT, FastTimerService_cff::range, rpcPointValidation_cfi::simHit, SiPixelPhase1TrackingParticleV_cfi::simHitToken, simHitTokens_, muonSimHitMatcherPSet::simTrack, mathSSE::sqrt(), OrderedSet::t, TIP, vec_TrackingParticle_Token_, VTX, VTY, and VYZ.

Member Data Documentation

◆ simHitTokens_

std::vector<edm::EDGetTokenT<std::vector<PSimHit> > > SiPixelPhase1TrackingParticleV::simHitTokens_
private

Definition at line 44 of file SiPixelPhase1TrackingParticleV.h.

Referenced by analyze(), and SiPixelPhase1TrackingParticleV().

◆ vec_TrackingParticle_Token_

edm::EDGetTokenT<TrackingParticleCollection> SiPixelPhase1TrackingParticleV::vec_TrackingParticle_Token_
private

Definition at line 43 of file SiPixelPhase1TrackingParticleV.h.

Referenced by analyze().

SiPixelPhase1TrackingParticleV::TIP
Definition: SiPixelPhase1TrackingParticleV.h:34
SiPixelPhase1TrackingParticleV::VTY
Definition: SiPixelPhase1TrackingParticleV.h:32
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
PixelSubdetector::PixelEndcap
Definition: PixelSubdetector.h:11
PixelSubdetector::PixelBarrel
Definition: PixelSubdetector.h:11
edm::Handle::product
T const * product() const
Definition: Handle.h:70
SiPixelPhase1TrackingParticleV_cfi.simHitToken
simHitToken
Definition: SiPixelPhase1TrackingParticleV_cfi.py:122
SiPixelPhase1TrackingParticleV::VTX
Definition: SiPixelPhase1TrackingParticleV.h:31
SiPixelPhase1TrackingParticleV::PT
Definition: SiPixelPhase1TrackingParticleV.h:28
SiPixelPhase1TrackingParticleV::CHARGE
Definition: SiPixelPhase1TrackingParticleV.h:24
SiPixelPhase1TrackingParticleV::vec_TrackingParticle_Token_
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
Definition: SiPixelPhase1TrackingParticleV.h:43
HistogramManagerHolder::histo
std::vector< HistogramManager > histo
Definition: SiPixelPhase1Base.h:37
SiPixelPhase1TrackingParticleV::VYZ
Definition: SiPixelPhase1TrackingParticleV.h:33
SiPixelPhase1TrackingParticleV::MASS
Definition: SiPixelPhase1TrackingParticleV.h:23
edm::Handle< TrackingParticleCollection >
SiPixelPhase1Base::SiPixelPhase1Base
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
Definition: SiPixelPhase1Base.cc:14
DetId
Definition: DetId.h:17
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
rpcPointValidation_cfi.simHit
simHit
Definition: rpcPointValidation_cfi.py:24
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
SiPixelPhase1TrackingParticleV::simHitTokens_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_
Definition: SiPixelPhase1TrackingParticleV.h:44
SiPixelPhase1TrackingParticleV::NHITS
Definition: SiPixelPhase1TrackingParticleV.h:26
OrderedSet.t
t
Definition: OrderedSet.py:90
SiPixelPhase1TrackingParticleV::ETA
Definition: SiPixelPhase1TrackingParticleV.h:30
SiPixelPhase1TrackingParticleV::PHI
Definition: SiPixelPhase1TrackingParticleV.h:29
muonSimHitMatcherPSet.simTrack
simTrack
Definition: muonSimHitMatcherPSet.py:4
SiPixelPhase1TrackingParticleV::LIP
Definition: SiPixelPhase1TrackingParticleV.h:35
iEvent
int iEvent
Definition: GenABIO.cc:224
SimTrack
Definition: SimTrack.h:6
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
SiPixelPhase1TrackingParticleV::MATCHED
Definition: SiPixelPhase1TrackingParticleV.h:27
SiPixelPhase1TrackingParticleV::ID
Definition: SiPixelPhase1TrackingParticleV.h:25
TrackingParticleCollection
std::vector< TrackingParticle > TrackingParticleCollection
Definition: TrackingParticleFwd.h:8
PSimHit
Definition: PSimHit.h:15
edm::InputTag
Definition: InputTag.h:15