CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
GEMSegmentBuilder Class Reference

#include <GEMSegmentBuilder.h>

Public Member Functions

void build (const GEMRecHitCollection *rechits, GEMSegmentCollection &oc)
 
 GEMSegmentBuilder (const edm::ParameterSet &)
 
void setGeometry (const GEMGeometry *g)
 
 ~GEMSegmentBuilder ()
 Destructor. More...
 

Private Attributes

std::unique_ptr< GEMSegmentAlgorithmBasege0Algo
 
std::string ge0AlgoName
 
edm::ParameterSet ge0AlgoPSet
 
const GEMGeometrygeom_
 
std::unique_ptr< GEMSegmentAlgorithmBasesegAlgo
 
std::string segAlgoName
 
edm::ParameterSet segAlgoPSet
 

Detailed Description

CSCSegmentBuilder Algorithm to build GEMSegment's from GEMRecHit collection by implementing a 'build' function required by GEMSegmentProducer.

Implementation notes:
Configured via the Producer's ParameterSet.
Presume this might become an abstract base class one day.

Author
Piet Verwilligen

Definition at line 23 of file GEMSegmentBuilder.h.

Constructor & Destructor Documentation

◆ GEMSegmentBuilder()

GEMSegmentBuilder::GEMSegmentBuilder ( const edm::ParameterSet ps)
explicit

Configure the algorithm via ctor. Receives ParameterSet percolated down from EDProducer which owns this Builder.

Definition at line 12 of file GEMSegmentBuilder.cc.

12  : geom_(nullptr) {
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 }

References ge0Algo, ge0AlgoName, ge0AlgoPSet, get, edm::ParameterSet::getParameter(), segAlgo, segAlgoName, segAlgoPSet, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~GEMSegmentBuilder()

GEMSegmentBuilder::~GEMSegmentBuilder ( )

Destructor.

Definition at line 28 of file GEMSegmentBuilder.cc.

28 {}

Member Function Documentation

◆ build()

void GEMSegmentBuilder::build ( const GEMRecHitCollection rechits,
GEMSegmentCollection oc 
)

Find rechits in each ensemble of 6 GEM layers, build GEMSegment's , and fill into output collection.

Definition at line 30 of file GEMSegmentBuilder.cc.

30  {
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 }

References relativeConstraints::chamber, GEMGeometry::etaPartition(), ge0Algo, gemRecHits_cfi::gemRecHits, geom_, triggerObjects_cff::id, LogTrace, FastTrackerRecHitMaskProducer_cfi::recHits, segAlgo, and GEMGeometry::superChamber().

◆ setGeometry()

void GEMSegmentBuilder::setGeometry ( const GEMGeometry g)

Cache pointer to geometry for current event

Definition at line 118 of file GEMSegmentBuilder.cc.

118 { geom_ = geom; }

References relativeConstraints::geom, and geom_.

Member Data Documentation

◆ ge0Algo

std::unique_ptr<GEMSegmentAlgorithmBase> GEMSegmentBuilder::ge0Algo
private

Definition at line 48 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ ge0AlgoName

std::string GEMSegmentBuilder::ge0AlgoName
private

Definition at line 44 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ ge0AlgoPSet

edm::ParameterSet GEMSegmentBuilder::ge0AlgoPSet
private

Definition at line 46 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ geom_

const GEMGeometry* GEMSegmentBuilder::geom_
private

Definition at line 49 of file GEMSegmentBuilder.h.

Referenced by build(), and setGeometry().

◆ segAlgo

std::unique_ptr<GEMSegmentAlgorithmBase> GEMSegmentBuilder::segAlgo
private

Definition at line 47 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ segAlgoName

std::string GEMSegmentBuilder::segAlgoName
private

Definition at line 43 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ segAlgoPSet

edm::ParameterSet GEMSegmentBuilder::segAlgoPSet
private

Definition at line 45 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

GEMSegmentBuilder::segAlgoPSet
edm::ParameterSet segAlgoPSet
Definition: GEMSegmentBuilder.h:45
GEMSegmentBuilder::geom_
const GEMGeometry * geom_
Definition: GEMSegmentBuilder.h:49
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMSegmentBuilder::ge0AlgoName
std::string ge0AlgoName
Definition: GEMSegmentBuilder.h:44
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
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDetId
Definition: GEMDetId.h:18
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
GEMSegmentBuilder::ge0Algo
std::unique_ptr< GEMSegmentAlgorithmBase > ge0Algo
Definition: GEMSegmentBuilder.h:48
get
#define get
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMSegmentBuilder::ge0AlgoPSet
edm::ParameterSet ge0AlgoPSet
Definition: GEMSegmentBuilder.h:46
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
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
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