CMS 3D CMS Logo

TTClusterBuilder.cc
Go to the documentation of this file.
1 
11 
13 template <>
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 }
85 
87 template <>
89  std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>& mRawHits, const edm::Event& iEvent) {
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 }
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
TTClusterBuilder::produce
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
mps_fire.i
i
Definition: mps_fire.py:355
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
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
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:15
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
edmNew::DetSetVector::empty
bool empty() const
Definition: DetSetVectorNew.h:592
edmNew::DetSetVector::push_back
Item & push_back(id_type iid)
Definition: DetSetVectorNew.h:509
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
Definition: EventSetup.h:57
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:31
TTCluster_cfi.rawHits
rawHits
Definition: TTCluster_cfi.py:4
TTCluster
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
genParticles_cff.map
map
Definition: genParticles_cff.py:11
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
edm::Event
Definition: Event.h:73
TTCluster_cfi.storeLocalCoord
storeLocalCoord
Definition: TTCluster_cfi.py:6
TrackerGeometry::ModuleType::Ph2PSP
TTClusterBuilder.h
TrackerGeometry
Definition: TrackerGeometry.h:14
edm::DetSet::const_iterator
collection_type::const_iterator const_iterator
Definition: DetSet.h:31