CMS 3D CMS Logo

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 
40  std::vector< std::vector< Ref_Phase2TrackerDigi_ > > lowerHits, upperHits;
41 
43  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator lowerHitFind = rawHits.find(lowerDetid);
44  typename std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > >::const_iterator upperHitFind = rawHits.find(upperDetid);
45 
49  bool isPSP = (theTrackerGeom->getDetectorType(lowerDetid)==TrackerGeometry::ModuleType::Ph2PSP);
50  if ( lowerHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( lowerHits, lowerHitFind->second, isPSP );
51  if ( upperHitFind != rawHits.end() ) theClusterFindingAlgoHandle->Cluster( upperHits, upperHitFind->second, false );
52 
55  {
56  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller lowerOutputFiller( *ttClusterDSVForOutput, lowerDetid );
57  for ( unsigned int i = 0; i < lowerHits.size(); i++ )
58  {
59  TTCluster< Ref_Phase2TrackerDigi_ > temp( lowerHits.at(i), lowerDetid, 0, storeLocalCoord );
60  lowerOutputFiller.push_back( temp );
61  }
62  if ( lowerOutputFiller.empty() )
63  lowerOutputFiller.abort();
64  }
65  {
66  edmNew::DetSetVector< TTCluster< Ref_Phase2TrackerDigi_ > >::FastFiller upperOutputFiller( *ttClusterDSVForOutput, upperDetid );
67  for ( unsigned int i = 0; i < upperHits.size(); i++ )
68  {
69  TTCluster< Ref_Phase2TrackerDigi_ > temp( upperHits.at(i), upperDetid, 1, storeLocalCoord );
70  upperOutputFiller.push_back( temp );
71  }
72  if ( upperOutputFiller.empty() )
73  upperOutputFiller.abort();
74  }
75  }
76 
78  iEvent.put( std::move(ttClusterDSVForOutput), "ClusterInclusive" );
79 }
80 
82 template< >
83 void TTClusterBuilder< Ref_Phase2TrackerDigi_ >::RetrieveRawHits( std::map< DetId, std::vector< Ref_Phase2TrackerDigi_ > > &mRawHits,
84  const edm::Event& iEvent )
85 {
86  mRawHits.clear();
88  std::vector< edm::EDGetTokenT< edm::DetSetVector< Phase2TrackerDigi > > >::iterator it;
89  for ( it = rawHitTokens.begin(); it != rawHitTokens.end(); ++it ) {
90 
93  iEvent.getByToken( *it, HitHandle );
96 
98  for ( detsIter = HitHandle->begin(); detsIter != HitHandle->end(); detsIter++ ) {
99  DetId id = detsIter->id;
100  for ( hitsIter = detsIter->data.begin(); hitsIter != detsIter->data.end(); hitsIter++ ) {
101  mRawHits[id].push_back( edm::makeRefTo( HitHandle, id , hitsIter ) );
102  }
103  }
104 
105  }
106 }
107 
virtual void produce(edm::Event &iEvent, const edm::EventSetup &iSetup)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
Item & push_back(id_type iid)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
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
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
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
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
const T & get() const
Definition: EventSetup.h:55
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
T const * product() const
Definition: ESHandle.h:86
def move(src, dest)
Definition: eostools.py:510