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::stream::EDProducer<>

Public Member Functions

 TTClusterBuilder (const edm::ParameterSet &iConfig)
 Constructors. More...
 
 ~TTClusterBuilder () override
 Destructor. More...
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtGeomToken
 
edm::ESHandle< TTClusterAlgorithm< T > > theClusterFindingAlgoHandle
 Data members. More...
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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

79  {
80  ADCThreshold = iConfig.getParameter<unsigned int>("ADCThreshold");
81  storeLocalCoord = iConfig.getParameter<bool>("storeLocalCoord");
82  tTopoToken = esConsumes<TrackerTopology, TrackerTopologyRcd>();
83  tGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
84 
85  std::vector<edm::InputTag> rawHitInputTags = iConfig.getParameter<std::vector<edm::InputTag> >("rawHits");
86  for (auto it = rawHitInputTags.begin(); it != rawHitInputTags.end(); ++it) {
87  rawHitTokens.push_back(consumes<edm::DetSetVector<Phase2TrackerDigi> >(*it));
88  }
89 
90  produces<edmNew::DetSetVector<TTCluster<T> > >("ClusterInclusive");
91 }

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

◆ ~TTClusterBuilder()

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

Destructor.

Definition at line 95 of file TTClusterBuilder.h.

95 {}

Member Function Documentation

◆ beginRun()

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

Mandatory methods.

Begin run.

Get the clustering algorithm

Definition at line 99 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 
)
overrideprivate

End run.

Definition at line 106 of file TTClusterBuilder.h.

106 {}

◆ produce() [1/3]

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 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

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  const TrackerTopology* const tTopo = tTopoHandle.product();
23 
25  const TrackerGeometry* const theTrackerGeom = tGeomHandle.product();
26 
27  // Loop on the OT stacks
28  for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
29  DetId detid = (*gd)->geographicalId();
30  if (detid.subdetId() == 1 || detid.subdetId() == 2)
31  continue; // only run on OT
32  if (!tTopo->isLower(detid))
33  continue; // loop on the stacks: choose the lower arbitrarily
34  DetId lowerDetid = detid;
35  DetId upperDetid = tTopo->partnerDetId(detid);
36 
39  std::vector<std::vector<Ref_Phase2TrackerDigi_>> lowerHits, upperHits;
40 
42  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator lowerHitFind =
43  rawHits.find(lowerDetid);
44  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator upperHitFind =
45  rawHits.find(upperDetid);
46 
50  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid) == TrackerGeometry::ModuleType::Ph2PSP);
51  if (lowerHitFind != rawHits.end())
52  theClusterFindingAlgoHandle->Cluster(lowerHits, lowerHitFind->second, isPSP);
53  if (upperHitFind != rawHits.end())
54  theClusterFindingAlgoHandle->Cluster(upperHits, upperHitFind->second, false);
55 
58  {
59  edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller lowerOutputFiller(*ttClusterDSVForOutput,
60  lowerDetid);
61  for (unsigned int i = 0; i < lowerHits.size(); i++) {
62  TTCluster<Ref_Phase2TrackerDigi_> temp(lowerHits.at(i), lowerDetid, 0, storeLocalCoord);
63  lowerOutputFiller.push_back(temp);
64  }
65  if (lowerOutputFiller.empty())
66  lowerOutputFiller.abort();
67  }
68  {
69  edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller upperOutputFiller(*ttClusterDSVForOutput,
70  upperDetid);
71  for (unsigned int i = 0; i < upperHits.size(); i++) {
72  TTCluster<Ref_Phase2TrackerDigi_> temp(upperHits.at(i), upperDetid, 1, storeLocalCoord);
73  upperOutputFiller.push_back(temp);
74  }
75  if (upperOutputFiller.empty())
76  upperOutputFiller.abort();
77  }
78  }
79 
81  iEvent.put(std::move(ttClusterDSVForOutput), "ClusterInclusive");
82 }

References TrackerGeometry::dets(), edmNew::DetSetVector< T >::empty(), TrackerGeometry::getDetectorType(), edm::EventSetup::getHandle(), 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 
)
private

Implement the producer.

◆ produce() [3/3]

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

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

87  {
88  mRawHits.clear();
90  std::vector<edm::EDGetTokenT<edm::DetSetVector<Phase2TrackerDigi>>>::iterator it;
91  for (it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it) {
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 }

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

◆ rawHitTokens

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

Definition at line 56 of file TTClusterBuilder.h.

◆ storeLocalCoord

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

Definition at line 58 of file TTClusterBuilder.h.

◆ tGeomToken

template<typename T >
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TTClusterBuilder< T >::tGeomToken
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 53 of file TTClusterBuilder.h.

◆ tTopoToken

template<typename T >
edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> TTClusterBuilder< T >::tTopoToken
private

Definition at line 54 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:428
TTClusterAlgorithmRecord
Class to store the TTClusterAlgorithm used in TTClusterBuilder.
Definition: TTClusterAlgorithmRecord.h:20
TTClusterBuilder::ADCThreshold
unsigned int ADCThreshold
Definition: TTClusterBuilder.h:57
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:56
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:53
edm::EventSetup::get
T get() const
Definition: EventSetup.h:87
TTClusterBuilder::tTopoToken
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
Definition: TTClusterBuilder.h:54
TTClusterBuilder::tGeomToken
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken
Definition: TTClusterBuilder.h:55
TTClusterBuilder::storeLocalCoord
bool storeLocalCoord
Definition: TTClusterBuilder.h:58
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.
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:155
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
get
#define get
edmNew::DetSetVector
Definition: DetSetNew.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TTCluster_cfi.rawHits
rawHits
Definition: TTCluster_cfi.py:4
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
TrackerGeometry::ModuleType::Ph2PSP
TrackerGeometry
Definition: TrackerGeometry.h:14
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31