CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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::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)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 Mandatory methods. More...
 
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::ESGetToken
< TrackerGeometry,
TrackerDigiGeometryRecord
tGeomToken
 
edm::ESGetToken
< TTClusterAlgorithm< T >
, TTClusterAlgorithmRecord
theClusterFindingAlgoToken
 Data members. More...
 
edm::ESGetToken
< TrackerTopology,
TrackerTopologyRcd
tTopoToken
 

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

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_FULL_cff::ADCThreshold, DeDxTools::esConsumes(), and edm::ParameterSet::getParameter().

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) {
86  rawHitTokens.push_back(consumes<edm::DetSetVector<Phase2TrackerDigi> >(*it));
87  }
88 
89  produces<edmNew::DetSetVector<TTCluster<T> > >("ClusterInclusive");
90 }
edm::ESGetToken< TTClusterAlgorithm< T >, TTClusterAlgorithmRecord > theClusterFindingAlgoToken
Data members.
unsigned int ADCThreshold
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken
template<typename T >
TTClusterBuilder< T >::~TTClusterBuilder ( )
override

Destructor.

Definition at line 94 of file TTClusterBuilder.h.

94 {}

Member Function Documentation

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

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, TrackerTopology::isLower(), eostools::move(), TrackerTopology::partnerDetId(), TrackerGeometry::Ph2PSP, edmNew::DetSetVector< T >::push_back(), edm::Event::put(), 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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
edm::ESGetToken< TTClusterAlgorithm< T >, TTClusterAlgorithmRecord > theClusterFindingAlgoToken
Data members.
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.
DetId partnerDetId(const DetId &id) const
bool isLower(const DetId &id) const
bool getData(T &iHolder) const
Definition: EventSetup.h:122
def move
Definition: eostools.py:511
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
ModuleType getDetectorType(DetId) const
Definition: DetId.h:17
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tGeomToken
template<typename T >
void TTClusterBuilder< T >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Mandatory methods.

template<>
void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
private
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(), gpuClustering::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) {
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 }
uint16_t *__restrict__ id
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > > rawHitTokens
Definition: DetId.h:17
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:314
collection_type::const_iterator const_iterator
Definition: DetSet.h:31
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:102
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 57 of file TTClusterBuilder.h.

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

Definition at line 56 of file TTClusterBuilder.h.

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

Definition at line 58 of file TTClusterBuilder.h.

template<typename T >
edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> TTClusterBuilder< T >::tGeomToken
private

Definition at line 55 of file TTClusterBuilder.h.

template<typename T >
edm::ESGetToken<TTClusterAlgorithm<T>, TTClusterAlgorithmRecord> TTClusterBuilder< T >::theClusterFindingAlgoToken
private

Data members.

Definition at line 53 of file TTClusterBuilder.h.

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

Definition at line 54 of file TTClusterBuilder.h.