test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DuplicateRecHits (const edm::ParameterSet &)
 
 ~DuplicateRecHits ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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 & 
itemsToGetFromEvent () 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

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

Private Attributes

const
TransientTrackingRecHitBuilder
m_builder
 
std::string m_buildername
 
TH1F * m_nduplicate
 
TH1F * m_nduplmod
 
edm::EDGetTokenT
< reco::TrackCollection
m_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 &)
 
- 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)
 

Detailed Description

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

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

Definition at line 63 of file DuplicateRecHits.cc.

Constructor & Destructor Documentation

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

Definition at line 98 of file DuplicateRecHits.cc.

References edm::ParameterSet::getParameter(), diffTwoXMLs::label, m_nduplicate, m_nduplmod, and TFileService::make().

98  :
99  m_trkcollToken(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackCollection"))),
100  m_buildername(iConfig.getParameter<std::string>("TTRHBuilder"))
101 
102 {
103  //now do what ever initialization is needed
104 
105  // histogram parameters
106 
107  edm::LogInfo("TrackCollection") << "Using collection " << iConfig.getParameter<edm::InputTag>("trackCollection").label().c_str() ;
108 
109 
111 
112  m_nduplicate = tfserv->make<TH1F>("nduplicate","Number of duplicated clusters per track",10,-0.5,9.5);
113  m_nduplmod = tfserv->make<TH1F>("nduplmod","Number of duplicated clusters per module",10,-0.5,9.5);
114  m_nduplmod->SetCanExtend(TH1::kXaxis);
115 }
T getParameter(std::string const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
std::string m_buildername
edm::EDGetTokenT< reco::TrackCollection > m_trkcollToken
DuplicateRecHits::~DuplicateRecHits ( )

Definition at line 118 of file DuplicateRecHits.cc.

119 {
120 
121  // do anything here that needs to be done at desctruction time
122  // (e.g. close files, deallocate resources etc.)
123 
124 }

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 133 of file DuplicateRecHits.cc.

References TransientTrackingRecHitBuilder::build(), SiPixelRecHit::cluster(), HLT_25ns10e33_v2_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 testEve_cfg::tracks.

134 {
135  using namespace edm;
137 
140 
141 
142  for(reco::TrackCollection::const_iterator it = tracks->begin();it!=tracks->end();it++) {
143 
144  std::set<SiPixelRecHit::ClusterRef::key_type> clusters;
145  int nduplicate=0;
146  for(trackingRecHit_iterator rh= it->recHitsBegin(); rh!=it->recHitsEnd();++rh) {
148  const SiPixelRecHit * pxrh = dynamic_cast<const SiPixelRecHit*>(ttrh->hit());
149  if (pxrh) {
150  // LogTrace("DuplicateHitFinder") << ttrh->det()->geographicalId() << " " << pxrh->cluster().index();
151  if(clusters.find(pxrh->cluster().index())!=clusters.end()) {
152  nduplicate++;
153  std::stringstream detidstr;
154  detidstr << ttrh->det()->geographicalId().rawId();
155  m_nduplmod->Fill(detidstr.str().c_str(),1.);
156  LogDebug("DuplicateHitFinder") << "Track with " << it->recHitsSize() << " RecHits";
157  LogTrace("DuplicateHitFinder") << "Duplicate found " << ttrh->det()->geographicalId().rawId() << " " << pxrh->cluster().index();
158  }
159  clusters.insert(pxrh->cluster().index());
160  }
161  m_nduplicate->Fill(nduplicate);
162  }
163 
164  }
165 
166 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
key_type index() const
Definition: Ref.h:267
const TransientTrackingRecHitBuilder * m_builder
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
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:79
#define LogTrace(id)
std::shared_ptr< TrackingRecHit const > RecHitPointer
tuple tracks
Definition: testEve_cfg.py:39
ClusterRef cluster() const
Definition: SiPixelRecHit.h:49
edm::EDGetTokenT< reco::TrackCollection > m_trkcollToken
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
Our base class.
Definition: SiPixelRecHit.h:23
void DuplicateRecHits::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 185 of file DuplicateRecHits.cc.

186 {
187 }
void DuplicateRecHits::beginRun ( const edm::Run iRun,
const edm::EventSetup iSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 169 of file DuplicateRecHits.cc.

References edm::EventSetup::get(), m_builder, m_buildername, and edm::ESHandle< class >::product().

170 {
172  iSetup.get<TransientRecHitRecord>().get(m_buildername, theBuilder);
173  m_builder = theBuilder.product();
174 }
std::string m_buildername
const TransientTrackingRecHitBuilder * m_builder
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
void DuplicateRecHits::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 191 of file DuplicateRecHits.cc.

192 {
193 }
void DuplicateRecHits::endRun ( const edm::Run iRun,
const edm::EventSetup  
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 177 of file DuplicateRecHits.cc.

178 {
179 }

Member Data Documentation

const TransientTrackingRecHitBuilder* DuplicateRecHits::m_builder
private

Definition at line 80 of file DuplicateRecHits.cc.

Referenced by analyze(), and beginRun().

std::string DuplicateRecHits::m_buildername
private

Definition at line 79 of file DuplicateRecHits.cc.

Referenced by beginRun().

TH1F* DuplicateRecHits::m_nduplicate
private

Definition at line 82 of file DuplicateRecHits.cc.

Referenced by analyze(), and DuplicateRecHits().

TH1F* DuplicateRecHits::m_nduplmod
private

Definition at line 83 of file DuplicateRecHits.cc.

Referenced by analyze(), and DuplicateRecHits().

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

Definition at line 78 of file DuplicateRecHits.cc.

Referenced by analyze().