CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns > edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 DuplicateRecHits (const edm::ParameterSet &)
 
 ~DuplicateRecHits () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer< edm::one::SharedResources, edm::one::WatchRuns >
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () 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
 
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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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
TransientTrackingRecHitBuilder
m_builder = nullptr
 
edm::ESGetToken
< TransientTrackingRecHitBuilder,
TransientRecHitRecord
m_builderToken
 
TH1F * m_nduplicate
 
TH1F * m_nduplmod
 
edm::EDGetTokenT
< reco::TrackCollection
m_trkcollToken
 

Additional Inherited Members

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

Detailed Description

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

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

Definition at line 62 of file DuplicateRecHits.cc.

Constructor & Destructor Documentation

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

Definition at line 95 of file DuplicateRecHits.cc.

References edm::ParameterSet::getParameter(), TFileService::kSharedResource, label, m_nduplicate, m_nduplmod, TFileService::make(), and AlCaHLTBitMon_QueryRunRegistry::string.

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  usesResource(TFileService::kSharedResource);
103 
104  edm::LogInfo("TrackCollection") << "Using collection "
105  << iConfig.getParameter<edm::InputTag>("trackCollection").label().c_str();
106 
108 
109  m_nduplicate = tfserv->make<TH1F>("nduplicate", "Number of duplicated clusters per track", 10, -0.5, 9.5);
110  m_nduplmod = tfserv->make<TH1F>("nduplmod", "Number of duplicated clusters per module", 10, -0.5, 9.5);
111  m_nduplmod->SetCanExtend(TH1::kXaxis);
112 }
static const std::string kSharedResource
Definition: TFileService.h:76
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > m_builderToken
char const * label
Log< level::Info, false > LogInfo
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< reco::TrackCollection > m_trkcollToken
DuplicateRecHits::~DuplicateRecHits ( )
override

Definition at line 114 of file DuplicateRecHits.cc.

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

Member Function Documentation

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

Implements edm::one::EDAnalyzerBase.

Definition at line 124 of file DuplicateRecHits.cc.

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

124  {
125  using namespace edm;
127 
130 
131  for (reco::TrackCollection::const_iterator it = tracks->begin(); it != tracks->end(); it++) {
132  std::set<SiPixelRecHit::ClusterRef::key_type> clusters;
133  int nduplicate = 0;
134  for (trackingRecHit_iterator rh = it->recHitsBegin(); rh != it->recHitsEnd(); ++rh) {
136  const SiPixelRecHit* pxrh = dynamic_cast<const SiPixelRecHit*>(ttrh->hit());
137  if (pxrh) {
138  // LogTrace("DuplicateHitFinder") << ttrh->det()->geographicalId() << " " << pxrh->cluster().index();
139  if (clusters.find(pxrh->cluster().index()) != clusters.end()) {
140  nduplicate++;
141  std::stringstream detidstr;
142  detidstr << ttrh->det()->geographicalId().rawId();
143  m_nduplmod->Fill(detidstr.str().c_str(), 1.);
144  LogDebug("DuplicateHitFinder") << "Track with " << it->recHitsSize() << " RecHits";
145  LogTrace("DuplicateHitFinder") << "Duplicate found " << ttrh->det()->geographicalId().rawId() << " "
146  << pxrh->cluster().index();
147  }
148  clusters.insert(pxrh->cluster().index());
149  }
150  m_nduplicate->Fill(nduplicate);
151  }
152  }
153 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
key_type index() const
Definition: Ref.h:253
auto const & tracks
cannot be loose
const TransientTrackingRecHitBuilder * m_builder
#define LogTrace(id)
const GeomDet * det() const
virtual RecHitPointer build(const TrackingRecHit *p) const =0
build a tracking rechit from an existing rechit
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
std::shared_ptr< TrackingRecHit const > RecHitPointer
ClusterRef cluster() const
Definition: SiPixelRecHit.h:47
edm::EDGetTokenT< reco::TrackCollection > m_trkcollToken
Our base class.
Definition: SiPixelRecHit.h:23
#define LogDebug(id)
void DuplicateRecHits::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 162 of file DuplicateRecHits.cc.

162 {}
void DuplicateRecHits::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 155 of file DuplicateRecHits.cc.

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

155  {
156  m_builder = &iSetup.getData(m_builderToken);
157 }
edm::ESGetToken< TransientTrackingRecHitBuilder, TransientRecHitRecord > m_builderToken
const TransientTrackingRecHitBuilder * m_builder
bool getData(T &iHolder) const
Definition: EventSetup.h:122
void DuplicateRecHits::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 165 of file DuplicateRecHits.cc.

165 {}
void DuplicateRecHits::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
overrideprivate

Definition at line 159 of file DuplicateRecHits.cc.

159 {}

Member Data Documentation

const TransientTrackingRecHitBuilder* DuplicateRecHits::m_builder = nullptr
private

Definition at line 78 of file DuplicateRecHits.cc.

Referenced by analyze(), and beginRun().

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

Definition at line 77 of file DuplicateRecHits.cc.

Referenced by beginRun().

TH1F* DuplicateRecHits::m_nduplicate
private

Definition at line 80 of file DuplicateRecHits.cc.

Referenced by analyze(), and DuplicateRecHits().

TH1F* DuplicateRecHits::m_nduplmod
private

Definition at line 81 of file DuplicateRecHits.cc.

Referenced by analyze(), and DuplicateRecHits().

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

Definition at line 76 of file DuplicateRecHits.cc.

Referenced by analyze().