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 () override
 Destructor. More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- 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 ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
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, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) 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
 
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 beginRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 Mandatory methods. More...
 
void endRun (const edm::Run &run, const edm::EventSetup &iSetup) override
 End run. More...
 
template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 Implementation of methods of TTClusterBuilder.h. More...
 
template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 Implement the producer. More...
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
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...
 
void RetrieveRawHits (std::map< DetId, std::vector< T > > &mRawHits, const edm::Event &iEvent)
 Get hits. 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
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
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)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- 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>
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)
 
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

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

◆ TTClusterBuilder()

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 76 of file TTClusterBuilder.h.

76  {
77  ADCThreshold = iConfig.getParameter<unsigned int>("ADCThreshold");
78  storeLocalCoord = iConfig.getParameter<bool>("storeLocalCoord");
79 
80  std::vector<edm::InputTag> rawHitInputTags = iConfig.getParameter<std::vector<edm::InputTag> >("rawHits");
81  for (auto it = rawHitInputTags.begin(); it != rawHitInputTags.end(); ++it) {
83  }
84 
85  produces<edmNew::DetSetVector<TTCluster<T> > >("ClusterInclusive");
86 }

References TTCluster_cfi::ADCThreshold, edm::ParameterSet::getParameter(), and TTCluster_cfi::storeLocalCoord.

◆ ~TTClusterBuilder()

template<typename T >
TTClusterBuilder< T >::~TTClusterBuilder ( )
override

Destructor.

Definition at line 90 of file TTClusterBuilder.h.

90 {}

Member Function Documentation

◆ beginRun()

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

Mandatory methods.

Begin run.

Get the clustering algorithm

Reimplemented from edm::EDProducer.

Definition at line 94 of file TTClusterBuilder.h.

References edm::EventSetup::get(), and get.

◆ endRun()

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

End run.

Reimplemented from edm::EDProducer.

Definition at line 101 of file TTClusterBuilder.h.

101 {}

◆ produce() [1/3]

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

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 12 Implement 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.

14  {
16  auto ttClusterDSVForOutput = std::make_unique<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>();
17  std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>> rawHits;
18  this->RetrieveRawHits(rawHits, iEvent);
19 
20  // Retrieve tracker topology from geometry
22  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
23  const TrackerTopology* const tTopo = tTopoHandle.product();
24 
26  iSetup.get<TrackerDigiGeometryRecord>().get(tGeomHandle);
27  const TrackerGeometry* const theTrackerGeom = tGeomHandle.product();
28 
29  // Loop on the OT stacks
30  for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
31  DetId detid = (*gd)->geographicalId();
32  if (detid.subdetId() == 1 || detid.subdetId() == 2)
33  continue; // only run on OT
34  if (!tTopo->isLower(detid))
35  continue; // loop on the stacks: choose the lower arbitrarily
36  DetId lowerDetid = detid;
37  DetId upperDetid = tTopo->partnerDetId(detid);
38 
41  std::vector<std::vector<Ref_Phase2TrackerDigi_>> lowerHits, upperHits;
42 
44  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator lowerHitFind =
45  rawHits.find(lowerDetid);
46  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator upperHitFind =
47  rawHits.find(upperDetid);
48 
52  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid) == TrackerGeometry::ModuleType::Ph2PSP);
53  if (lowerHitFind != rawHits.end())
54  theClusterFindingAlgoHandle->Cluster(lowerHits, lowerHitFind->second, isPSP);
55  if (upperHitFind != rawHits.end())
56  theClusterFindingAlgoHandle->Cluster(upperHits, upperHitFind->second, false);
57 
60  {
61  edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller lowerOutputFiller(*ttClusterDSVForOutput,
62  lowerDetid);
63  for (unsigned int i = 0; i < lowerHits.size(); i++) {
64  TTCluster<Ref_Phase2TrackerDigi_> temp(lowerHits.at(i), lowerDetid, 0, storeLocalCoord);
65  lowerOutputFiller.push_back(temp);
66  }
67  if (lowerOutputFiller.empty())
68  lowerOutputFiller.abort();
69  }
70  {
71  edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller upperOutputFiller(*ttClusterDSVForOutput,
72  upperDetid);
73  for (unsigned int i = 0; i < upperHits.size(); i++) {
74  TTCluster<Ref_Phase2TrackerDigi_> temp(upperHits.at(i), upperDetid, 1, storeLocalCoord);
75  upperOutputFiller.push_back(temp);
76  }
77  if (upperOutputFiller.empty())
78  upperOutputFiller.abort();
79  }
80  }
81 
83  iEvent.put(std::move(ttClusterDSVForOutput), "ClusterInclusive");
84 }

References TrackerGeometry::dets(), edmNew::DetSetVector< T >::empty(), edm::EventSetup::get(), get, TrackerGeometry::getDetectorType(), mps_fire::i, iEvent, TrackerTopology::isLower(), eostools::move(), TrackerTopology::partnerDetId(), TrackerGeometry::Ph2PSP, edm::ESHandle< T >::product(), edmNew::DetSetVector< T >::push_back(), TTCluster_cfi::rawHits, TTCluster_cfi::storeLocalCoord, DetId::subdetId(), and groupFilesInBlocks::temp.

◆ produce() [2/3]

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

Implement the producer.

Implements edm::EDProducer.

◆ produce() [3/3]

template<typename T >
void TTClusterBuilder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

◆ RetrieveRawHits() [1/3]

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

Retrieve hits from the event.

◆ RetrieveRawHits() [2/3]

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

89  {
90  mRawHits.clear();
92  std::vector<edm::EDGetTokenT<edm::DetSetVector<Phase2TrackerDigi>>>::iterator it;
93  for (it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it) {
96  iEvent.getByToken(*it, HitHandle);
99 
101  for (detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++) {
102  DetId id = detsIter->id;
103  for (hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++) {
104  mRawHits[id].push_back(edm::makeRefTo(HitHandle, id, hitsIter));
105  }
106  }
107  }
108 }

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), triggerObjects_cff::id, iEvent, and edm::makeRefTo().

◆ RetrieveRawHits() [3/3]

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

Get hits.

Member Data Documentation

◆ ADCThreshold

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

Definition at line 54 of file TTClusterBuilder.h.

◆ rawHitTokens

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

Definition at line 53 of file TTClusterBuilder.h.

◆ storeLocalCoord

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

Definition at line 55 of file TTClusterBuilder.h.

◆ theClusterFindingAlgoHandle

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

Data members.

Definition at line 52 of file TTClusterBuilder.h.

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
edm::DetSetVector
Definition: DetSetVector.h:61
mps_fire.i
i
Definition: mps_fire.py:355
TTClusterAlgorithmRecord
Class to store the TTClusterAlgorithm used in TTClusterBuilder.
Definition: TTClusterAlgorithmRecord.h:20
TTClusterBuilder::ADCThreshold
unsigned int ADCThreshold
Definition: TTClusterBuilder.h:54
edm::DetSetVector::end
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
TrackerTopology::isLower
bool isLower(const DetId &id) const
Definition: TrackerTopology.cc:195
TrackerTopology
Definition: TrackerTopology.h:16
TTClusterBuilder::rawHitTokens
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
Definition: TTClusterBuilder.h:53
edm::makeRefTo
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:418
edm::DetSetVector::begin
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
TrackerGeometry::getDetectorType
ModuleType getDetectorType(DetId) const
Definition: TrackerGeometry.cc:247
edm::Handle
Definition: AssociativeIterator.h:50
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
DetId
Definition: DetId.h:17
TTClusterBuilder::theClusterFindingAlgoHandle
edm::ESHandle< TTClusterAlgorithm< T > > theClusterFindingAlgoHandle
Data members.
Definition: TTClusterBuilder.h:52
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
TTClusterBuilder::storeLocalCoord
bool storeLocalCoord
Definition: TTClusterBuilder.h:55
edm::ESHandle< TrackerTopology >
TrackerTopology::partnerDetId
DetId partnerDetId(const DetId &id) const
Definition: TrackerTopology.cc:233
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
edm::DetSetVector::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
iEvent
int iEvent
Definition: GenABIO.cc:224
TTClusterBuilder::RetrieveRawHits
void RetrieveRawHits(std::map< DetId, std::vector< T > > &mRawHits, const edm::Event &iEvent)
Get hits.
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
get
#define get
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
TTCluster_cfi.rawHits
rawHits
Definition: TTCluster_cfi.py:4
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::EDConsumerBase::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: EDConsumerBase.h:126
TrackerGeometry::ModuleType::Ph2PSP
TrackerGeometry
Definition: TrackerGeometry.h:14
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31