CMS 3D CMS Logo

GEMSegmentBuilder.cc
Go to the documentation of this file.
8 
11 
13  // Algo name
14  segAlgoName = ps.getParameter<std::string>("algo_name");
15  ge0AlgoName = ps.getParameter<std::string>("ge0_name");
16 
17  edm::LogVerbatim("GEMSegmentBuilder") << "GEMSegmentBuilder algorithm : ge0 name : " << ge0AlgoName
18  << " name: " << segAlgoName;
19 
20  // SegAlgo parameter set
21  segAlgoPSet = ps.getParameter<edm::ParameterSet>("algo_pset");
22  ge0AlgoPSet = ps.getParameter<edm::ParameterSet>("ge0_pset");
23 
24  // Ask factory to build these algorithms, giving them the appropriate ParameterSets
27 }
29 
31  edm::LogVerbatim("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] Total number of rechits in this event: "
32  << recHits->size();
33 
34  // Let's define the ensemble of GEM devices having the same region, chambers number (phi)
35  // different eta partitions and different layers are allowed
36 
37  std::map<uint32_t, std::vector<const GEMRecHit*> > ensembleRH;
38 
39  // Loop on the GEM rechit and select the different GEM Ensemble
40  for (GEMRecHitCollection::const_iterator it2 = recHits->begin(); it2 != recHits->end(); ++it2) {
41  // GEM Ensemble is defined by assigning all the GEMDetIds of the same "superchamber"
42  // (i.e. region same, chamber same) to the DetId of the first layer
43 
44  // here a reference GEMDetId is created: named "id"
45  // - Ring 1 (no other rings available for GEM)
46  // - Layer 1 = reference layer (effective layermask)
47  // - Roll 0 = reference roll (effective rollmask)
48  // - Station == 1 (GE1/1) or == 2 (GE2/1)
49  // this reference id serves to link all GEMEtaPartitions
50  // and will also be used to determine the GEMSuperChamber
51  // to which the GEMSegment is assigned (done inside GEMSegAlgoXX)
52  GEMDetId id(it2->gemId().superChamberId());
53  // save current GEMRecHit in vector associated to the reference id
54  ensembleRH[id.rawId()].push_back(&(*it2));
55  }
56 
57  // Loop on the entire map <ref id, vector of GEMRecHits>
58  for (auto enIt = ensembleRH.begin(); enIt != ensembleRH.end(); ++enIt) {
59  std::vector<const GEMRecHit*> gemRecHits;
60  std::map<uint32_t, const GEMEtaPartition*> ens;
61 
62  // all detIds have been assigned to the to chamber
63  const GEMSuperChamber* chamber = geom_->superChamber(enIt->first);
64  for (auto rechit = enIt->second.begin(); rechit != enIt->second.end(); ++rechit) {
65  gemRecHits.push_back(*rechit);
66  ens[(*rechit)->gemId()] = geom_->etaPartition((*rechit)->gemId());
67  }
68 
69 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
70  LogTrace("GEMSegmentBuilder")
71  << "[GEMSegmentBuilder::build] -----------------------------------------------------------------------------";
72  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << gemRecHits.size()
73  << " rechits in GEM Super Chamber " << chamber->id() << " ::";
74  for (auto rh = gemRecHits.begin(); rh != gemRecHits.end(); ++rh) {
75  auto gemid = (*rh)->gemId();
76  // auto rhr = gemGeom->etaPartition(gemid);
77  auto rhLP = (*rh)->localPosition();
78  // auto rhGP = rhr->toGlobal(rhLP);
79  // no sense to print local y because local y here is in the roll reference frame
80  // in the roll reference frame the local y of a rechit is always the middle of the roll, and hence equal to 0.0
81  LogTrace("GEMSegmentBuilder") << "[RecHit :: Loc x = " << std::showpos << std::setw(9)
82  << rhLP.x() /*<<" Loc y = "<<std::showpos<<std::setw(9)<<rhLP.y()*/
83  << " BX = " << (*rh)->BunchX() << " -- " << gemid.rawId() << " = " << gemid << " ]";
84  }
85 #endif
86 
88  std::pair<const GEMSuperChamber*, std::map<uint32_t, const GEMEtaPartition*> >(chamber, ens));
89 
90 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
91  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] run the segment reconstruction algorithm now";
92 #endif
93 
94  // given the superchamber select the appropriate algo... and run it
95  std::vector<GEMSegment> segv;
96  if (chamber->id().station() == 0)
97  segv = ge0Algo->run(ensemble, gemRecHits);
98  else
99  segv = segAlgo->run(ensemble, gemRecHits);
100 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
101  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << segv.size();
102 #endif
103 
104  GEMDetId mid(enIt->first);
105 
106 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
107  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << segv.size()
108  << " segments in GEM Super Chamber " << mid;
109  LogTrace("GEMSegmentBuilder")
110  << "[GEMSegmentBuilder::build] -----------------------------------------------------------------------------";
111 #endif
112 
113  // Add the segments to master collection
114  oc.put(mid, segv.begin(), segv.end());
115  }
116 }
117 
GEMRecHitCollection
GEMSegmentBuilder::segAlgoPSet
edm::ParameterSet segAlgoPSet
Definition: GEMSegmentBuilder.h:45
MessageLogger.h
GEMSegmentBuilder::geom_
const GEMGeometry * geom_
Definition: GEMSegmentBuilder.h:49
GEMRecHit.h
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMSegmentBuilder::setGeometry
void setGeometry(const GEMGeometry *g)
Definition: GEMSegmentBuilder.cc:118
GEMSegmentBuilder::ge0AlgoName
std::string ge0AlgoName
Definition: GEMSegmentBuilder.h:44
GEMSegmentBuilder::build
void build(const GEMRecHitCollection *rechits, GEMSegmentCollection &oc)
Definition: GEMSegmentBuilder.cc:30
GEMSegmentBuilder::GEMSegmentBuilder
GEMSegmentBuilder(const edm::ParameterSet &)
Definition: GEMSegmentBuilder.cc:12
GEMEtaPartition.h
GEMSegmentBuilder::segAlgoName
std::string segAlgoName
Definition: GEMSegmentBuilder.h:43
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
GEMSegmentAlgorithmBase::GEMEnsemble
std::pair< const GEMSuperChamber *, std::map< uint32_t, const GEMEtaPartition * > > GEMEnsemble
Definition: GEMSegmentAlgorithmBase.h:25
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
edm::ParameterSet
Definition: ParameterSet.h:47
GEMSegmentBuilder::~GEMSegmentBuilder
~GEMSegmentBuilder()
Destructor.
Definition: GEMSegmentBuilder.cc:28
GEMDetId
Definition: GEMDetId.h:18
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
GEMSegmentCollection
GEMSegmentBuilder::ge0Algo
std::unique_ptr< GEMSegmentAlgorithmBase > ge0Algo
Definition: GEMSegmentBuilder.h:48
GEMSegmentBuilderPluginFactory.h
get
#define get
GEMSegmentBuilder::ge0AlgoPSet
edm::ParameterSet ge0AlgoPSet
Definition: GEMSegmentBuilder.h:46
GEMGeometry.h
GEMDetId.h
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
GEMGeometry
Definition: GEMGeometry.h:24
GEMSegmentBuilder.h
gemRecHits_cfi.gemRecHits
gemRecHits
Definition: gemRecHits_cfi.py:7
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
GEMGeometry::superChamber
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69
GEMSegmentAlgorithmBase.h
GEMSegmentBuilder::segAlgo
std::unique_ptr< GEMSegmentAlgorithmBase > segAlgo
Definition: GEMSegmentBuilder.h:47
GEMGeometry::etaPartition
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77