CMS 3D CMS Logo

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
 
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
 
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)
 Implementation of methods of TTClusterBuilder.h. More...
 
virtual void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 Implement the producer. More...
 
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)
 Retrieve hits from the event. More...
 
template<>
void RetrieveRawHits (std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &mRawHits, const edm::Event &iEvent)
 Retrieve hits from the event. More...
 

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 TTClusterBuilder< T >::ADCThreshold, edm::EDConsumerBase::consumes(), edm::ParameterSet::getParameter(), TTClusterBuilder< T >::rawHitTokens, and TTClusterBuilder< T >::storeLocalCoord.

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

Definition at line 97 of file TTClusterBuilder.h.

References edm::EventSetup::get(), and TTClusterBuilder< T >::theClusterFindingAlgoHandle.

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

Implementation of methods of TTClusterBuilder.h.

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

Definition at line 14 of file TTClusterBuilder.cc.

References TrackerGeometry::dets(), edmNew::DetSetVector< T >::empty(), edm::EventSetup::get(), TrackerGeometry::getDetectorType(), mps_fire::i, TrackerTopology::isLower(), eostools::move(), TrackerTopology::partnerDetId(), TrackerGeometry::Ph2PSP, edm::ESHandle< T >::product(), edmNew::DetSetVector< T >::push_back(), edm::Event::put(), 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 
40  std::vector< std::vector< Ref_Phase2TrackerDigi_ > > lowerHits, upperHits;
41 
43  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator lowerHitFind = rawHits.find(lowerDetid);
44  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator upperHitFind = rawHits.find(upperDetid);
45 
49  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid)==TrackerGeometry::ModuleType::Ph2PSP);
50  if ( lowerHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( lowerHits, lowerHitFind->second, isPSP );
51  if ( upperHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( upperHits, upperHitFind->second, false );
52 
55  {
56  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller lowerOutputFiller( *ttClusterDSVForOutput, lowerDetid );
57  for ( unsigned int i = 0; i < lowerHits.size(); i++ )
58  {
59  TTCluster< Ref_Phase2TrackerDigi_ > temp( lowerHits.at(i), lowerDetid, 0, storeLocalCoord );
60  lowerOutputFiller.push_back( temp );
61  }
62  if ( lowerOutputFiller.empty() )
63  lowerOutputFiller.abort();
64  }
65  {
66  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller upperOutputFiller( *ttClusterDSVForOutput, upperDetid );
67  for ( unsigned int i = 0; i < upperHits.size(); i++ )
68  {
69  TTCluster< Ref_Phase2TrackerDigi_ > temp( upperHits.at(i), upperDetid, 1, storeLocalCoord );
70  upperOutputFiller.push_back( temp );
71  }
72  if ( upperOutputFiller.empty() )
73  upperOutputFiller.abort();
74  }
75  }
76 
78  iEvent.put( std::move(ttClusterDSVForOutput), "ClusterInclusive" );
79 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
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
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
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
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510
template<typename T >
virtual void TTClusterBuilder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual
template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Implement the producer.

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

Get hits.

Referenced by TTClusterBuilder< T >::endRun().

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

Retrieve hits from the event.

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 83 of file TTClusterBuilder.cc.

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

85 {
86  mRawHits.clear();
88  std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > >::iterator it;
89  for ( it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it ) {
90 
93  iEvent.getByToken( *it, HitHandle );
96 
98  for ( detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++ ) {
99  DetId id = detsIter->id;
100  for ( hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++ ) {
101  mRawHits[id].push_back( edm::makeRefTo( HitHandle, id , hitsIter ) );
102  }
103  }
104 
105  }
106 }
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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

Retrieve hits from the event.

Member Data Documentation

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

Definition at line 55 of file TTClusterBuilder.h.

Referenced by TTClusterBuilder< T >::TTClusterBuilder().

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

Definition at line 54 of file TTClusterBuilder.h.

Referenced by TTClusterBuilder< T >::TTClusterBuilder().

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

Definition at line 56 of file TTClusterBuilder.h.

Referenced by TTClusterBuilder< T >::TTClusterBuilder().

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

Data members.

Definition at line 53 of file TTClusterBuilder.h.

Referenced by TTClusterBuilder< T >::beginRun().