CMS 3D CMS Logo

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

#include <SiPixelPhase1TrackEfficiency.h>

Inheritance diagram for SiPixelPhase1TrackEfficiency:
SiPixelPhase1Base DQMEDAnalyzer HistogramManagerHolder edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 SiPixelPhase1TrackEfficiency (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 beginRun (edm::Run const &, edm::EventSetup const &) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDAnalyzerBase () 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  {
  VALID, MISSING, INACTIVE, EFFICIENCY,
  VERTICES
}
 

Private Attributes

bool applyVertexCut_
 
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > clustersToken_
 
edm::EDGetTokenT< reco::TrackCollectiontracksToken_
 
edm::EDGetTokenT< reco::VertexCollectionvtxToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
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
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr< dqmDetails::NoCacheglobalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr< dqmDetails::NoCacheglobalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
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 HistogramManagerHolder
GeometryInterface geometryInterface
 
std::vector< HistogramManagerhisto
 

Detailed Description

Definition at line 16 of file SiPixelPhase1TrackEfficiency.h.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

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

Definition at line 24 of file SiPixelPhase1TrackEfficiency.cc.

References applyVertexCut_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), tracksToken_, and vtxToken_.

24  :
25  SiPixelPhase1Base(iConfig)
26 {
27  tracksToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"));
28  vtxToken_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("primaryvertices"));
29  applyVertexCut_=iConfig.getUntrackedParameter<bool>("VertexCut",true);
30 
31 }
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
SiPixelPhase1Base(const edm::ParameterSet &iConfig)
edm::EDGetTokenT< reco::VertexCollection > vtxToken_

Member Function Documentation

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

Definition at line 33 of file SiPixelPhase1TrackEfficiency.cc.

References funct::abs(), applyVertexCut_, SiPixelPhase1Base::checktrigger(), SiPixelPhase1Base::DCS, DEFINE_FWK_MODULE, EFFICIENCY, edm::EventSetup::get(), edm::Event::getByToken(), h, hcalSimParameters_cfi::hb, HistogramManagerHolder::histo, iEvent, INACTIVE, TrackingRecHit::inactive, edm::ESHandleBase::isValid(), edm::HandleBase::isValid(), MISSING, TrackingRecHit::missing, PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, HiIsolationCommonParameters_cff::track, mixOne_simraw_on_sim_cfi::tracker, l1t::tracks, tracksToken_, VALID, TrackingRecHit::valid, electrons_cff::vertices, VERTICES, and vtxToken_.

33  {
34  if( !checktrigger(iEvent,iSetup,DCS) ) return;
35 
36  // get geometry
38  iSetup.get<TrackerDigiGeometryRecord>().get(tracker);
39  assert(tracker.isValid());
40 
41  // get primary vertex
43  iEvent.getByToken( vtxToken_, vertices);
44 
45  if (!vertices.isValid()) return;
46 
47  histo[VERTICES].fill(vertices->size(),DetId(0),&iEvent);
48 
49  if (applyVertexCut_ && vertices->empty()) return;
50 
51  // should be used for weird cuts
52  //const auto primaryVertex = vertices->at(0);
53 
54  // get the map
56  iEvent.getByToken( tracksToken_, tracks);
57  if (!tracks.isValid()) return;
58 
59  for (auto const & track : *tracks) {
60 
61  //this cut is needed to be consisten with residuals calculation
62  if (applyVertexCut_ && (track.pt() < 0.75 || std::abs( track.dxy(vertices->at(0).position()) ) > 5*track.dxyError())) continue;
63 
64  bool isBpixtrack = false, isFpixtrack = false;
65  int nStripHits = 0;
66 
67  // first, look at the full track to see whether it is good
68  // auto const & trajParams = track.extra()->trajParams();
69  auto hb = track.recHitsBegin();
70  for(unsigned int h=0;h<track.recHitsSize();h++){
71 
72  auto hit = *(hb+h);
73  if(!hit->isValid()) continue;
74 
75  DetId id = hit->geographicalId();
76  uint32_t subdetid = (id.subdetId());
77 
78  // count strip hits
79  if(subdetid==StripSubdetector::TIB) nStripHits++;
80  if(subdetid==StripSubdetector::TOB) nStripHits++;
81  if(subdetid==StripSubdetector::TID) nStripHits++;
82  if(subdetid==StripSubdetector::TEC) nStripHits++;
83 
84  // check that we are in the pixel
85  if (subdetid == PixelSubdetector::PixelBarrel) isBpixtrack = true;
86  if (subdetid == PixelSubdetector::PixelEndcap) isFpixtrack = true;
87  }
88 
89  if (!isBpixtrack && !isFpixtrack) continue;
90 
91  // then, look at each hit
92  for(unsigned int h=0;h<track.recHitsSize();h++){
93  auto hit = *(hb+h);
94 
95  DetId id = hit->geographicalId();
96  uint32_t subdetid = (id.subdetId());
97  if ( subdetid != PixelSubdetector::PixelBarrel
98  && subdetid != PixelSubdetector::PixelEndcap) continue;
99 
100  bool isHitValid = hit->getType()==TrackingRecHit::valid;
101  bool isHitMissing = hit->getType()==TrackingRecHit::missing;
102  bool isHitInactive = hit->getType()==TrackingRecHit::inactive;
103 
104  /*
105  const SiPixelRecHit* pixhit = dynamic_cast<const SiPixelRecHit*>(hit);
106  const PixelGeomDetUnit* geomdetunit = dynamic_cast<const PixelGeomDetUnit*> ( tracker->idToDet(id) );
107  const PixelTopology& topol = geomdetunit->specificTopology();
108 
109  // this commented part is useful if one wants ROC level maps of hits, however the local position may fall out of a ROC and the ROC maps will look very strange (with no white cross)
110  LocalPoint lp;
111 
112  if (pixhit) {
113  lp = pixhit->localPosition();
114  } else {
115  lp = trajParams[h].position();
116  }
117 
118  MeasurementPoint mp = topol.measurementPosition(lp);
119  int row = (int) mp.x();
120  int col = (int) mp.y();
121  */
122 
123  if (isHitValid) {
124  histo[VALID].fill(id, &iEvent);
125  histo[EFFICIENCY].fill(1, id, &iEvent);
126  }
127  if (isHitMissing) {
128  histo[MISSING].fill(id, &iEvent);
129  histo[EFFICIENCY].fill(0, id, &iEvent);
130  }
131  if (isHitInactive) {
132  histo[INACTIVE].fill(id, &iEvent);
133  }
134  }
135  }
136  histo[VALID ].executePerEventHarvesting(&iEvent);
137  histo[MISSING ].executePerEventHarvesting(&iEvent);
138  histo[INACTIVE].executePerEventHarvesting(&iEvent);
139 }
edm::EDGetTokenT< reco::TrackCollection > tracksToken_
FWCore Framework interface EventSetupRecordImplementation h
Helper function to determine trigger accepts.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
bool checktrigger(const edm::Event &iEvent, const edm::EventSetup &iSetup, const unsigned trgidx) const
int iEvent
Definition: GenABIO.cc:230
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool isValid() const
Definition: HandleBase.h:74
Definition: DetId.h:18
edm::EDGetTokenT< reco::VertexCollection > vtxToken_
const T & get() const
Definition: EventSetup.h:58
std::vector< HistogramManager > histo
bool isValid() const
Definition: ESHandle.h:47

Member Data Documentation

bool SiPixelPhase1TrackEfficiency::applyVertexCut_
private

Definition at line 34 of file SiPixelPhase1TrackEfficiency.h.

Referenced by analyze(), and SiPixelPhase1TrackEfficiency().

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > SiPixelPhase1TrackEfficiency::clustersToken_
private

Definition at line 30 of file SiPixelPhase1TrackEfficiency.h.

edm::EDGetTokenT<reco::TrackCollection> SiPixelPhase1TrackEfficiency::tracksToken_
private

Definition at line 31 of file SiPixelPhase1TrackEfficiency.h.

Referenced by analyze(), and SiPixelPhase1TrackEfficiency().

edm::EDGetTokenT<reco::VertexCollection> SiPixelPhase1TrackEfficiency::vtxToken_
private

Definition at line 32 of file SiPixelPhase1TrackEfficiency.h.

Referenced by analyze(), and SiPixelPhase1TrackEfficiency().