CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  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 }
81 
83 template <>
85  std::map<DetId, std::vector<Ref_Phase2TrackerDigi_>>& mRawHits, const edm::Event& iEvent) {
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 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
uint16_t *__restrict__ id
Item & push_back(id_type iid)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
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:128
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:418
def move
Definition: eostools.py:511
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
Mandatory methods.
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
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:325
Definition: DetId.h:17
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
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