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
21  edm::ESHandle<TrackerTopology> tTopoHandle = iSetup.getHandle(tTopoToken);
22  const TrackerTopology* const tTopo = tTopoHandle.product();
23 
24  edm::ESHandle<TrackerGeometry> tGeomHandle = iSetup.getHandle(tGeomToken);
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 }
83 
85 template <>
87  std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>& mRawHits, const edm::Event& iEvent) {
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 }
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:428
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::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:565
edmNew::DetSetVector::push_back
Item & push_back(id_type iid)
Definition: DetSetVectorNew.h:482
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
edm::EventSetup
Definition: EventSetup.h:58
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
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
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
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