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< GEMSegmentAlgorithmBasealgo
 
std::string algoName
 
const GEMGeometrygeom_
 
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  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 }

References algo, algoName, get, edm::ParameterSet::getParameter(), segAlgoPSet, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ ~GEMSegmentBuilder()

GEMSegmentBuilder::~GEMSegmentBuilder ( )

Destructor.

Definition at line 24 of file GEMSegmentBuilder.cc.

24 {}

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 26 of file GEMSegmentBuilder.cc.

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

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

◆ setGeometry()

void GEMSegmentBuilder::setGeometry ( const GEMGeometry g)

Cache pointer to geometry for current event

Definition at line 110 of file GEMSegmentBuilder.cc.

110 { geom_ = geom; }

References relativeConstraints::geom, and geom_.

Member Data Documentation

◆ algo

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

Definition at line 45 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ algoName

std::string GEMSegmentBuilder::algoName
private

Definition at line 43 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ geom_

const GEMGeometry* GEMSegmentBuilder::geom_
private

Definition at line 46 of file GEMSegmentBuilder.h.

Referenced by build(), and setGeometry().

◆ segAlgoPSet

edm::ParameterSet GEMSegmentBuilder::segAlgoPSet
private

Definition at line 44 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

GEMSegmentBuilder::segAlgoPSet
edm::ParameterSet segAlgoPSet
Definition: GEMSegmentBuilder.h:44
GEMSegmentBuilder::geom_
const GEMGeometry * geom_
Definition: GEMSegmentBuilder.h:46
GEMSuperChamber
Definition: GEMSuperChamber.h:19
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:47
GEMDetId
Definition: GEMDetId.h:18
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
get
#define get
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
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:224
GEMGeometry::superChamber
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69
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