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
 
 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
 
- 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 >
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
 
- 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

Constructor & Destructor Documentation

◆ SiPixelPhase1TrackingParticleV()

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

Definition at line 45 of file SiPixelPhase1TrackingParticleV.cc.

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

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 }
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_

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.

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

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 }
T const * product() const
Definition: Handle.h:70
int iEvent
Definition: GenABIO.cc:224
T sqrt(T t)
Definition: SSEVec.h:23
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
Definition: DetId.h:17
std::vector< HistogramManager > histo
std::vector< TrackingParticle > TrackingParticleCollection
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_

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().