CMS 3D CMS Logo

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