CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TTClusterBuilder.cc
Go to the documentation of this file.
1 
11 
13 template< >
15 {
17  auto ttClusterDSVForOutput = std::make_unique<edmNew::DetSetVector<TTCluster<Ref_Phase2TrackerDigi_>>>();
18  std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > rawHits;
19  this->RetrieveRawHits( rawHits, iEvent );
20 
21  // Retrieve tracker topology from geometry
23  iSetup.get<TrackerTopologyRcd>().get(tTopoHandle);
24  const TrackerTopology* const tTopo = tTopoHandle.product();
25 
27  iSetup.get< TrackerDigiGeometryRecord >().get( tGeomHandle );
28  const TrackerGeometry* const theTrackerGeom = tGeomHandle.product();
29 
30  // Loop on the OT stacks
31  for (auto gd=theTrackerGeom->dets().begin(); gd != theTrackerGeom->dets().end(); gd++) {
32  DetId detid = (*gd)->geographicalId();
33  if(detid.subdetId()==1 || detid.subdetId()==2 ) continue; // only run on OT
34  if(!tTopo->isLower(detid) ) continue; // loop on the stacks: choose the lower arbitrarily
35  DetId lowerDetid = detid;
36  DetId upperDetid = tTopo->partnerDetId(detid);
37  DetId stackDetid = tTopo->stack(detid);
38 
41  std::vector< std::vector< Ref_Phase2TrackerDigi_ > > lowerHits, upperHits;
42 
44  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator lowerHitFind = rawHits.find(lowerDetid);
45  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator upperHitFind = rawHits.find(upperDetid);
46 
50  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid)==TrackerGeometry::ModuleType::Ph2PSP);
51  if ( lowerHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( lowerHits, lowerHitFind->second, isPSP );
52  if ( upperHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( upperHits, upperHitFind->second, false );
53 
56  {
57  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller lowerOutputFiller( *ttClusterDSVForOutput, lowerDetid );
58  for ( unsigned int i = 0; i < lowerHits.size(); i++ )
59  {
60  TTCluster< Ref_Phase2TrackerDigi_ > temp( lowerHits.at(i), stackDetid, 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, upperDetid );
68  for ( unsigned int i = 0; i < upperHits.size(); i++ )
69  {
70  TTCluster< Ref_Phase2TrackerDigi_ > temp( upperHits.at(i), stackDetid, 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< >
84 void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::RetrieveRawHits( std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &mRawHits,
85  const edm::Event& iEvent )
86 {
87  mRawHits.clear();
89  std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > >::iterator it;
90  for ( it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it ) {
91 
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  }
107 }
108 
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
Item & push_back(id_type iid)
const DetContainer & dets() const
Returm a vector of all GeomDet (including all GeomDetUnits)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
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
int iEvent
Definition: GenABIO.cc:230
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:473
def move
Definition: eostools.py:510
ModuleType getDetectorType(DetId) const
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
iterator end()
Return the off-the-end iterator.
Definition: DetSetVector.h:361
Definition: DetId.h:18
NOTE: this is needed even if it seems not.
Definition: TTCluster.h:27
uint32_t stack(const DetId &id) const
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
iterator begin()
Return an iterator to the first DetSet.
Definition: DetSetVector.h:346
collection_type::const_iterator const_iterator
Definition: DetSet.h:33
collection_type::const_iterator const_iterator
Definition: DetSetVector.h:104