CMS 3D CMS Logo

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

#include <trackCount/DuplicateRecHits/src/DuplicateRecHits.cc>

Inheritance diagram for DuplicateRecHits:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DuplicateRecHits (const edm::ParameterSet &)
 
 ~DuplicateRecHits () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void beginRun (const edm::Run &, const edm::EventSetup &) override
 
void endJob () override
 
void endRun (const edm::Run &, const edm::EventSetup &) override
 

Private Attributes

const TransientTrackingRecHitBuilderm_builder = nullptr
 
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecordm_builderToken
 
TH1F * m_nduplicate
 
TH1F * m_nduplmod
 
edm::EDGetTokenT< reco::TrackCollectionm_trkcollToken
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 62 of file DuplicateRecHits.cc.

Constructor & Destructor Documentation

◆ DuplicateRecHits()

DuplicateRecHits::DuplicateRecHits ( const edm::ParameterSet iConfig)
explicit

Definition at line 95 of file DuplicateRecHits.cc.

96  : m_trkcollToken(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackCollection"))),
97  m_builderToken(esConsumes<edm::Transition::BeginRun>(
98  edm::ESInputTag{"", iConfig.getParameter<std::string>("TTRHBuilder")})) {
99  //now do what ever initialization is needed
100 
101  // histogram parameters
102 
103  edm::LogInfo("TrackCollection") << "Using collection "
104  << iConfig.getParameter<edm::InputTag>("trackCollection").label().c_str();
105 
107 
108  m_nduplicate = tfserv->make<TH1F>("nduplicate", "Number of duplicated clusters per track", 10, -0.5, 9.5);
109  m_nduplmod = tfserv->make<TH1F>("nduplmod", "Number of duplicated clusters per module", 10, -0.5, 9.5);
110  m_nduplmod->SetCanExtend(TH1::kXaxis);
111 }

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~DuplicateRecHits()

DuplicateRecHits::~DuplicateRecHits ( )
override

Definition at line 113 of file DuplicateRecHits.cc.

113  {
114  // do anything here that needs to be done at desctruction time
115  // (e.g. close files, deallocate resources etc.)
116 }

Member Function Documentation

◆ analyze()

void DuplicateRecHits::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDAnalyzer.

Definition at line 123 of file DuplicateRecHits.cc.

123  {
124  using namespace edm;
126 
128  iEvent.getByToken(m_trkcollToken, tracks);
129 
130  for (reco::TrackCollection::const_iterator it = tracks->begin(); it != tracks->end(); it++) {
131  std::set<SiPixelRecHit::ClusterRef::key_type> clusters;
132  int nduplicate = 0;
133  for (trackingRecHit_iterator rh = it->recHitsBegin(); rh != it->recHitsEnd(); ++rh) {
135  const SiPixelRecHit* pxrh = dynamic_cast<const SiPixelRecHit*>(ttrh->hit());
136  if (pxrh) {
137  // LogTrace("DuplicateHitFinder") << ttrh->det()->geographicalId() << " " << pxrh->cluster().index();
138  if (clusters.find(pxrh->cluster().index()) != clusters.end()) {
139  nduplicate++;
140  std::stringstream detidstr;
141  detidstr << ttrh->det()->geographicalId().rawId();
142  m_nduplmod->Fill(detidstr.str().c_str(), 1.);
143  LogDebug("DuplicateHitFinder") << "Track with " << it->recHitsSize() << " RecHits";
144  LogTrace("DuplicateHitFinder") << "Duplicate found " << ttrh->det()->geographicalId().rawId() << " "
145  << pxrh->cluster().index();
146  }
147  clusters.insert(pxrh->cluster().index());
148  }
149  m_nduplicate->Fill(nduplicate);
150  }
151  }
152 }

References TransientTrackingRecHitBuilder::build(), SiPixelRecHit::cluster(), bsc_activity_cfg::clusters, TrackingRecHit::det(), GeomDet::geographicalId(), iEvent, edm::Ref< C, T, F >::index(), LogDebug, LogTrace, m_builder, m_nduplicate, m_nduplmod, m_trkcollToken, DetId::rawId(), and PDWG_EXOHSCP_cff::tracks.

◆ beginJob()

void DuplicateRecHits::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 161 of file DuplicateRecHits.cc.

161 {}

◆ beginRun()

void DuplicateRecHits::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 154 of file DuplicateRecHits.cc.

154  {
155  m_builder = &iSetup.getData(m_builderToken);
156 }

References edm::EventSetup::getData(), m_builder, and m_builderToken.

◆ endJob()

void DuplicateRecHits::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 164 of file DuplicateRecHits.cc.

164 {}

◆ endRun()

void DuplicateRecHits::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 158 of file DuplicateRecHits.cc.

158 {}

Member Data Documentation

◆ m_builder

const TransientTrackingRecHitBuilder* DuplicateRecHits::m_builder = nullptr
private

Definition at line 78 of file DuplicateRecHits.cc.

Referenced by analyze(), and beginRun().

◆ m_builderToken

edm::ESGetToken<TransientTrackingRecHitBuilder, TransientRecHitRecord> DuplicateRecHits::m_builderToken
private

Definition at line 77 of file DuplicateRecHits.cc.

Referenced by beginRun().

◆ m_nduplicate

TH1F* DuplicateRecHits::m_nduplicate
private

Definition at line 80 of file DuplicateRecHits.cc.

Referenced by analyze().

◆ m_nduplmod

TH1F* DuplicateRecHits::m_nduplmod
private

Definition at line 81 of file DuplicateRecHits.cc.

Referenced by analyze().

◆ m_trkcollToken

edm::EDGetTokenT<reco::TrackCollection> DuplicateRecHits::m_trkcollToken
private

Definition at line 76 of file DuplicateRecHits.cc.

Referenced by analyze().

PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
edm::ESInputTag
Definition: ESInputTag.h:87
DuplicateRecHits::m_builder
const TransientTrackingRecHitBuilder * m_builder
Definition: DuplicateRecHits.cc:78
DuplicateRecHits::m_builderToken
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > m_builderToken
Definition: DuplicateRecHits.cc:77
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackingRecHit::det
const GeomDet * det() const
Definition: TrackingRecHit.h:122
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
TrackingRecHit::RecHitPointer
std::shared_ptr< TrackingRecHit const > RecHitPointer
Definition: TrackingRecHit.h:24
TransientTrackingRecHitBuilder::build
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
edm::Ref::index
key_type index() const
Definition: Ref.h:253
edm::Handle< reco::TrackCollection >
SiPixelRecHit::cluster
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
SiPixelRecHit
Our base class.
Definition: SiPixelRecHit.h:23
DuplicateRecHits::m_nduplicate
TH1F * m_nduplicate
Definition: DuplicateRecHits.cc:80
edm::OwnVector::const_iterator
Definition: OwnVector.h:41
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
bsc_activity_cfg.clusters
clusters
Definition: bsc_activity_cfg.py:36
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
LogDebug
#define LogDebug(id)
Definition: MessageLogger.h:223
edm::Service< TFileService >
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
DuplicateRecHits::m_trkcollToken
edm::EDGetTokenT< reco::TrackCollection > m_trkcollToken
Definition: DuplicateRecHits.cc:76
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
DuplicateRecHits::m_nduplmod
TH1F * m_nduplmod
Definition: DuplicateRecHits.cc:81
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:224
edm::InputTag
Definition: InputTag.h:15
label
const char * label
Definition: PFTauDecayModeTools.cc:11
TFileService::make
T * make(const Args &... args) const
make new ROOT object
Definition: TFileService.h:64