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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

template<>
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 Implementation of methods of TTClusterBuilder.h. More...
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 Mandatory methods. More...
 
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::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtGeomToken
 
edm::ESGetToken< TTClusterAlgorithm< T >, TTClusterAlgorithmRecordtheClusterFindingAlgoToken
 Data members. More...
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtTopoToken
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::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 77 of file TTClusterBuilder.h.

References HLT_2024v10_cff::ADCThreshold, deDxTools::esConsumes(), edm::ParameterSet::getParameter(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and TTCluster_cfi::storeLocalCoord.

77  {
78  ADCThreshold = iConfig.getParameter<unsigned int>("ADCThreshold");
79  storeLocalCoord = iConfig.getParameter<bool>("storeLocalCoord");
81  tTopoToken = esConsumes<TrackerTopology, TrackerTopologyRcd>();
82  tGeomToken = esConsumes<TrackerGeometry, TrackerDigiGeometryRecord>();
83 
84  std::vector<edm::InputTag> rawHitInputTags = iConfig.getParameter<std::vector<edm::InputTag> >("rawHits");
85  for (auto it = rawHitInputTags.begin(); it != rawHitInputTags.end(); ++it) {
87  }
88 
89  produces<edmNew::DetSetVector<TTCluster<T> > >("ClusterInclusive");
90 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::ESGetToken< TTClusterAlgorithm< T >, TTClusterAlgorithmRecord > theClusterFindingAlgoToken
Data members.
unsigned int ADCThreshold
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken

◆ ~TTClusterBuilder()

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

Destructor.

Definition at line 94 of file TTClusterBuilder.h.

94 {}

Member Function Documentation

◆ 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 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::getData(), TrackerGeometry::getDetectorType(), mps_fire::i, iEvent, TrackerTopology::isLower(), eostools::move(), TrackerTopology::partnerDetId(), TrackerGeometry::Ph2PSP, edmNew::DetSetVector< T >::push_back(), TTCluster_cfi::rawHits, TTCluster_cfi::storeLocalCoord, DetId::subdetId(), and groupFilesInBlocks::temp.

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
21  const TrackerTopology* const tTopo = &iSetup.getData(tTopoToken);
22  const TrackerGeometry* const theTrackerGeom = &iSetup.getData(tGeomToken);
23  auto const& theClusterFindingAlgo = iSetup.getData(theClusterFindingAlgoToken);
24 
25  // Loop on the OT stacks
26  for (auto gd = theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
27  DetId detid = (*gd)->geographicalId();
28  if (detid.subdetId() == 1 || detid.subdetId() == 2)
29  continue; // only run on OT
30  if (!tTopo->isLower(detid))
31  continue; // loop on the stacks: choose the lower arbitrarily
32  DetId lowerDetid = detid;
33  DetId upperDetid = tTopo->partnerDetId(detid);
34 
37  std::vector<std::vector<Ref_Phase2TrackerDigi_>> lowerHits, upperHits;
38 
40  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator lowerHitFind =
41  rawHits.find(lowerDetid);
42  typename std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>::const_iterator upperHitFind =
43  rawHits.find(upperDetid);
44 
48  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid) == TrackerGeometry::ModuleType::Ph2PSP);
49  if (lowerHitFind != rawHits.end())
50  theClusterFindingAlgo.Cluster(lowerHits, lowerHitFind->second, isPSP);
51  if (upperHitFind != rawHits.end())
52  theClusterFindingAlgo.Cluster(upperHits, upperHitFind->second, false);
53 
56  {
57  edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>::FastFiller lowerOutputFiller(*ttClusterDSVForOutput,
58  lowerDetid);
59  for (unsigned int i = 0; i < lowerHits.size(); i++) {
60  TTCluster<Ref_Phase2TrackerDigi_> temp(lowerHits.at(i), lowerDetid, 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,
68  upperDetid);
69  for (unsigned int i = 0; i < upperHits.size(); i++) {
70  TTCluster<Ref_Phase2TrackerDigi_> temp(upperHits.at(i), upperDetid, 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 }
edm::ESGetToken< TTClusterAlgorithm< T >, TTClusterAlgorithmRecord > theClusterFindingAlgoToken
Data members.
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
void RetrieveRawHits(std::map< DetId, std::vector< T > > &mRawHits, const edm::Event &iEvent)
Get hits.
int iEvent
Definition: GenABIO.cc:224
ModuleType getDetectorType(DetId) const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
DetId partnerDetId(const DetId &id) const
Definition: DetId.h:17
bool isLower(const DetId &id) const
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
def move(src, dest)
Definition: eostools.py:511
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken

◆ produce() [2/3]

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

Mandatory methods.

◆ produce() [3/3]

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

Implement the producer.

◆ RetrieveRawHits() [1/3]

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

Get hits.

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

References edm::DetSetVector< T >::begin(), edm::DetSetVector< T >::end(), l1ctLayer2EG_cff::id, iEvent, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, 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) {
92  iEvent.getByToken(*it, HitHandle);
95 
97  for (detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++) {
98  DetId id = detsIter->id;
99  for (hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++) {
100  mRawHits[id].push_back(edm::makeRefTo(HitHandle, id, hitsIter));
101  }
102  }
103  }
104 }
int iEvent
Definition: GenABIO.cc:224
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:409
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:316
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
Definition: DetId.h:17
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:305
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102

◆ RetrieveRawHits() [3/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.

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.

◆ theClusterFindingAlgoToken

template<typename T >
edm::ESGetToken<TTClusterAlgorithm<T>, TTClusterAlgorithmRecord> TTClusterBuilder< T >::theClusterFindingAlgoToken
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.