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::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelPhase1TrackingParticleV (const edm::ParameterSet &conf)
 
- Public Member Functions inherited from SiPixelPhase1Base
void analyze (edm::Event const &e, edm::EventSetup const &eSetup) override=0
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &iSetup) override
 
 SiPixelPhase1Base (const edm::ParameterSet &iConfig)
 
 ~SiPixelPhase1Base () override
 
- Public Member Functions inherited from DQMEDAnalyzer
void accumulate (edm::Event const &ev, edm::EventSetup const &es) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
 DQMEDAnalyzer (DQMEDAnalyzer const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer &&)=delete
 
void endLuminosityBlock (edm::LuminosityBlock const &, edm::EventSetup const &) override
 
void endLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) override
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) override
 
 ~DQMEDAnalyzer () override=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::Accumulator, edm::EndLuminosityBlockProducer, edm::EndRunProducer, edm::one::WatchLuminosityBlocks, edm::one::WatchRuns >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 
- Public Member Functions inherited from HistogramManagerHolder
 HistogramManagerHolder (const edm::ParameterSet &iConfig)
 

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 edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Types inherited from SiPixelPhase1Base
enum  { DCS }
 
- Protected Member Functions inherited from SiPixelPhase1Base
bool checktrigger (const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
- 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
private

Constructor & Destructor Documentation

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

Definition at line 40 of file SiPixelPhase1TrackingParticleV.cc.

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

40  :
41  SiPixelPhase1Base(iConfig),
42  vec_TrackingParticle_Token_( consumes<TrackingParticleCollection>( iConfig.getParameter<edm::InputTag>( "src" ) ) )
43 {
44  for(const auto& tag: iConfig.getParameter<std::vector<edm::InputTag>>("simHitToken")) {
45  simHitTokens_.push_back(consumes<std::vector<PSimHit>>(tag));
46  }
47 }
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< TrackingParticleCollection > vec_TrackingParticle_Token_
std::vector< edm::EDGetTokenT< std::vector< PSimHit > > > simHitTokens_

Member Function Documentation

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

Definition at line 49 of file SiPixelPhase1TrackingParticleV.cc.

References begin, CHARGE, DEFINE_FWK_MODULE, PSimHit::detUnitId(), end, ETA, PSimHit::eventId(), edm::Event::getByToken(), HistogramManagerHolder::histo, ID, triggerObjects_cff::id, iEvent, LIP, MASS, MATCHED, NHITS, PHI, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, edm::Handle< T >::product(), PT, rpcPointValidation_cfi::simHit, SiPixelPhase1TrackingParticleV_cfi::simHitToken, simHitTokens_, simTrackMatching_cfi::simTrack, mathSSE::sqrt(), lumiQTWidget::t, TIP, vec_TrackingParticle_Token_, VTX, VTY, and VYZ.

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

Member Data Documentation

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

Definition at line 44 of file SiPixelPhase1TrackingParticleV.h.

Referenced by analyze(), and SiPixelPhase1TrackingParticleV().

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

Definition at line 43 of file SiPixelPhase1TrackingParticleV.h.

Referenced by analyze().