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
TTClusterBuilder< T > Class Template Reference

Plugin to load the Clustering algorithm and produce the collection of Clusters that goes in the event content. More...

#include <TTClusterBuilder.h>

Inheritance diagram for TTClusterBuilder< T >:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TTClusterBuilder (const edm::ParameterSet &iConfig)
 Constructors. More...
 
 ~TTClusterBuilder ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- 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 beginRun (const edm::Run &run, const edm::EventSetup &iSetup)
 Mandatory methods. More...
 
virtual void endRun (const edm::Run &run, const edm::EventSetup &iSetup)
 End run. More...
 
template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void RetrieveRawHits (std::map< DetId, std::vector< T > > &mRawHits, const edm::Event &iEvent)
 Get hits. More...
 
template<>
void RetrieveRawHits (std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &mRawHits, const edm::Event &iEvent)
 
template<>
void RetrieveRawHits (std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &mRawHits, const edm::Event &iEvent)
 

Private Attributes

unsigned int ADCThreshold
 
std::vector< edm::EDGetTokenT
< edm::DetSetVector
< Phase2TrackerDigi > > > 
rawHitTokens
 
bool storeLocalCoord
 
edm::ESHandle
< TTClusterAlgorithm< T > > 
theClusterFindingAlgoHandle
 Data members. More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
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)
 
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

template<typename T>
class TTClusterBuilder< T >

Plugin to load the Clustering algorithm and produce the collection of Clusters that goes in the event content.

After moving from SimDataFormats to DataFormats, the template structure of the class was maintained in order to accomodate any types other than PixelDigis in case there is such a need in the future.

Author
Nicola Pozzobon
Date
2013, Jul 12

Definition at line 41 of file TTClusterBuilder.h.

Constructor & Destructor Documentation

template<typename T >
TTClusterBuilder< T >::TTClusterBuilder ( const edm::ParameterSet iConfig)
explicit

Constructors.

Close class.

NOTE since pattern hit correlation must be performed within a stacked module, one must store Clusters in a proper way, providing easy access to them in a detector/member-wise way

Implementation of methods

Here, in the header file, the methods which do not depend on the specific type <T> that can fit the template. Other methods, with type-specific features, are implemented in the source file.Constructors

Definition at line 78 of file TTClusterBuilder.h.

References edm::ParameterSet::getParameter().

79 {
80  ADCThreshold = iConfig.getParameter< unsigned int >("ADCThreshold");
81  storeLocalCoord = iConfig.getParameter< bool >("storeLocalCoord");
82 
83  std::vector< edm::InputTag > rawHitInputTags = iConfig.getParameter< std::vector< edm::InputTag > >("rawHits");
84  for ( auto it = rawHitInputTags.begin(); it != rawHitInputTags.end(); ++it ) {
86  }
87 
88  produces< edmNew::DetSetVector< TTCluster< T > > >( "ClusterInclusive" );
89 }
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
unsigned int ADCThreshold
template<typename T >
TTClusterBuilder< T >::~TTClusterBuilder ( )

Destructor.

Definition at line 93 of file TTClusterBuilder.h.

93 {}

Member Function Documentation

template<typename T >
void TTClusterBuilder< T >::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
privatevirtual

Mandatory methods.

Begin run.

Get the clustering algorithm

Reimplemented from edm::EDProducer.

Definition at line 97 of file TTClusterBuilder.h.

References edm::EventSetup::get().

98 {
101 
102 }
edm::ESHandle< TTClusterAlgorithm< T > > theClusterFindingAlgoHandle
Data members.
const T & get() const
Definition: EventSetup.h:56
Class to store the TTClusterAlgorithm used in TTClusterBuilder.
template<typename T >
void TTClusterBuilder< T >::endRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
privatevirtual

End run.

Reimplemented from edm::EDProducer.

Definition at line 106 of file TTClusterBuilder.h.

106 {}
template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Here, in the source file, the methods which do depend on the specific type <T> that can fit the template.

Author
Nicola
Date
2013, Jul 12Implement the producer

Prepare output

Temp vectors containing the vectors of the hits used to build each cluster

Find the hits in each stack member

If there are hits, cluster them It is the TTClusterAlgorithm::Cluster method which calls the constructor to the Cluster class!

Create TTCluster objects and store them Use the FastFiller with edmNew::DetSetVector

End of loop over detector elements

Put output in the event

Implements edm::EDProducer.

Definition at line 14 of file TTClusterBuilder.cc.

References TrackerGeometry::dets(), edmNew::DetSetVector< T >::empty(), edm::EventSetup::get(), TrackerGeometry::getDetectorType(), i, TrackerTopology::isLower(), eostools::move(), TrackerTopology::partnerDetId(), TrackerGeometry::Ph2PSP, edm::ESHandle< class >::product(), edmNew::DetSetVector< T >::push_back(), edm::Event::put(), TrackerTopology::stack(), DetId::subdetId(), and groupFilesInBlocks::temp.

15 {
17  auto ttClusterDSVForOutput = std::make_unique<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>();
18  std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > rawHits;
19  this->RetrieveRawHits( rawHits, iEvent );
20 
21  // Retrieve tracker topology from geometry
23  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
24  const TrackerTopology* const tTopo = tTopoHandle.product();
25 
27  iSetup.get< TrackerDigiGeometryRecord >().get( tGeomHandle );
28  const TrackerGeometry* const theTrackerGeom = tGeomHandle.product();
29 
30  // Loop on the OT stacks
31  for (auto gd=theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
32  DetId detid = (*gd)->geographicalId();
33  if(detid.subdetId()==1 || detid.subdetId()==2 ) continue; // only run on OT
34  if(!tTopo->isLower(detid) ) continue; // loop on the stacks: choose the lower arbitrarily
35  DetId lowerDetid = detid;
36  DetId upperDetid = tTopo->partnerDetId(detid);
37  DetId stackDetid = tTopo->stack(detid);
38 
41  std::vector< std::vector< Ref_Phase2TrackerDigi_ > > lowerHits, upperHits;
42 
44  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator lowerHitFind = rawHits.find(lowerDetid);
45  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator upperHitFind = rawHits.find(upperDetid);
46 
50  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid)==TrackerGeometry::ModuleType::Ph2PSP);
51  if ( lowerHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( lowerHits, lowerHitFind->second, isPSP );
52  if ( upperHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( upperHits, upperHitFind->second, false );
53 
56  {
57  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller lowerOutputFiller( *ttClusterDSVForOutput, lowerDetid );
58  for ( unsigned int i = 0; i < lowerHits.size(); i++ )
59  {
60  TTCluster< Ref_Phase2TrackerDigi_ > temp( lowerHits.at(i), stackDetid, 0, storeLocalCoord );
61  lowerOutputFiller.push_back( temp );
62  }
63  if ( lowerOutputFiller.empty() )
64  lowerOutputFiller.abort();
65  }
66  {
67  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller upperOutputFiller( *ttClusterDSVForOutput, upperDetid );
68  for ( unsigned int i = 0; i < upperHits.size(); i++ )
69  {
70  TTCluster< Ref_Phase2TrackerDigi_ > temp( upperHits.at(i), stackDetid, 1, storeLocalCoord );
71  upperOutputFiller.push_back( temp );
72  }
73  if ( upperOutputFiller.empty() )
74  upperOutputFiller.abort();
75  }
76  }
77 
79  iEvent.put( std::move(ttClusterDSVForOutput), "ClusterInclusive" );
80 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
edm::ESHandle< TTClusterAlgorithm< T > > theClusterFindingAlgoHandle
Data members.
void RetrieveRawHits(std::map< DetId, std::vector< T > > &mRawHits, const edm::Event &iEvent)
Get hits.
DetId partnerDetId(const DetId &id) const
bool isLower(const DetId &id) const
def move
Definition: eostools.py:510
ModuleType getDetectorType(DetId) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
uint32_t stack(const DetId &id) const
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
template<typename T >
virtual void TTClusterBuilder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

template<typename T >
void TTClusterBuilder< T >::RetrieveRawHits ( std::map< DetId, std::vector< T > > &  mRawHits,
const edm::Event iEvent 
)
private

Get hits.

template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::RetrieveRawHits ( std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &  mRawHits,
const edm::Event iEvent 
)
private

Loop over the tags used to identify hits in the cfg file

For each tag, get the corresponding handle

Loop over detector elements identifying Digis

Definition at line 84 of file TTClusterBuilder.cc.

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), edm::Event::getByToken(), and edm::makeRefTo().

86 {
87  mRawHits.clear();
89  std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > >::iterator it;
90  for ( it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it ) {
91 
94  iEvent.getByToken( *it, HitHandle );
97 
99  for ( detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++ ) {
100  DetId id = detsIter->id;
101  for ( hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++ ) {
102  mRawHits[id].push_back( edm::makeRefTo( HitHandle, id , hitsIter ) );
103  }
104  }
105 
106  }
107 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
Ref< typename HandleT::element_type, typename HandleT::element_type::value_type::value_type > makeRefTo(const HandleT &iHandle, det_id_type iDetID, typename HandleT::element_type::value_type::const_iterator itIter)
Definition: DetSetVector.h:473
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
Definition: DetId.h:18
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104
template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::RetrieveRawHits ( std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &  mRawHits,
const edm::Event iEvent 
)
private

Member Data Documentation

template<typename T >
unsigned int TTClusterBuilder< T >::ADCThreshold
private

Definition at line 55 of file TTClusterBuilder.h.

template<typename T >
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > TTClusterBuilder< T >::rawHitTokens
private

Definition at line 54 of file TTClusterBuilder.h.

template<typename T >
bool TTClusterBuilder< T >::storeLocalCoord
private

Definition at line 56 of file TTClusterBuilder.h.

template<typename T >
edm::ESHandle< TTClusterAlgorithm< T > > TTClusterBuilder< T >::theClusterFindingAlgoHandle
private

Data members.

Definition at line 53 of file TTClusterBuilder.h.