CMS 3D CMS Logo

List of all members | Public Member Functions | Static 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...
 

Static Public Member Functions

static void fillDescription (edm::ParameterSetDescription &descriptions)
 

Private Attributes

bool enableGE0
 
bool enableGE12
 
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 24 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.

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

12  : geom_(nullptr) {
13  // Segment building selection
14  enableGE0 = ps.getParameter<bool>("enableGE0");
15  enableGE12 = ps.getParameter<bool>("enableGE12");
16 
17  // Algo name
18  segAlgoName = ps.getParameter<std::string>("algo_name");
19  ge0AlgoName = ps.getParameter<std::string>("ge0_name");
20 
21  edm::LogVerbatim("GEMSegmentBuilder") << "GEMSegmentBuilder algorithm : ge0 name : " << ge0AlgoName
22  << " name: " << segAlgoName;
23 
24  // SegAlgo parameter set
25  segAlgoPSet = ps.getParameter<edm::ParameterSet>("algo_pset");
26  ge0AlgoPSet = ps.getParameter<edm::ParameterSet>("ge0_pset");
27 
28  // Ask factory to build these algorithms, giving them the appropriate ParameterSets
31 }
Log< level::Info, true > LogVerbatim
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const GEMGeometry * geom_
std::string segAlgoName
std::unique_ptr< GEMSegmentAlgorithmBase > ge0Algo
edm::ParameterSet ge0AlgoPSet
#define get
edm::ParameterSet segAlgoPSet
std::unique_ptr< GEMSegmentAlgorithmBase > segAlgo
std::string ge0AlgoName

◆ ~GEMSegmentBuilder()

GEMSegmentBuilder::~GEMSegmentBuilder ( )

Destructor.

Definition at line 32 of file GEMSegmentBuilder.cc.

32 {}

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

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

74  {
75  edm::LogVerbatim("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] Total number of rechits in this event: "
76  << recHits->size();
77 
78  // Let's define the ensemble of GEM devices having the same region, chambers number (phi)
79  // different eta partitions and different layers are allowed
80 
81  std::map<uint32_t, std::vector<const GEMRecHit*> > ensembleRH;
82 
83  // Loop on the GEM rechit and select the different GEM Ensemble
84  for (GEMRecHitCollection::const_iterator it2 = recHits->begin(); it2 != recHits->end(); ++it2) {
85  // GEM Ensemble is defined by assigning all the GEMDetIds of the same "superchamber"
86  // (i.e. region same, chamber same) to the DetId of the first layer
87 
88  // here a reference GEMDetId is created: named "id"
89  // - Ring 1 (no other rings available for GEM)
90  // - Layer 1 = reference layer (effective layermask)
91  // - Roll 0 = reference roll (effective rollmask)
92  // - Station == 1 (GE1/1) or == 2 (GE2/1)
93  // this reference id serves to link all GEMEtaPartitions
94  // and will also be used to determine the GEMSuperChamber
95  // to which the GEMSegment is assigned (done inside GEMSegAlgoXX)
96  GEMDetId id(it2->gemId().superChamberId());
97  // save current GEMRecHit in vector associated to the reference id
98  ensembleRH[id.rawId()].push_back(&(*it2));
99  }
100 
101  // Loop on the entire map <ref id, vector of GEMRecHits>
102  for (auto enIt = ensembleRH.begin(); enIt != ensembleRH.end(); ++enIt) {
103  std::vector<const GEMRecHit*> gemRecHits;
104  std::map<uint32_t, const GEMEtaPartition*> ens;
105 
106  // all detIds have been assigned to the to chamber
107  const GEMSuperChamber* chamber = geom_->superChamber(enIt->first);
108  for (auto rechit = enIt->second.begin(); rechit != enIt->second.end(); ++rechit) {
109  gemRecHits.push_back(*rechit);
110  ens[(*rechit)->gemId()] = geom_->etaPartition((*rechit)->gemId());
111  }
112 
113 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
114  LogTrace("GEMSegmentBuilder")
115  << "[GEMSegmentBuilder::build] -----------------------------------------------------------------------------";
116  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << gemRecHits.size()
117  << " rechits in GEM Super Chamber " << chamber->id() << " ::";
118  for (auto rh = gemRecHits.begin(); rh != gemRecHits.end(); ++rh) {
119  auto gemid = (*rh)->gemId();
120  // auto rhr = gemGeom->etaPartition(gemid);
121  auto rhLP = (*rh)->localPosition();
122  // auto rhGP = rhr->toGlobal(rhLP);
123  // no sense to print local y because local y here is in the roll reference frame
124  // in the roll reference frame the local y of a rechit is always the middle of the roll, and hence equal to 0.0
125  LogTrace("GEMSegmentBuilder") << "[RecHit :: Loc x = " << std::showpos << std::setw(9)
126  << rhLP.x() /*<<" Loc y = "<<std::showpos<<std::setw(9)<<rhLP.y()*/
127  << " BX = " << (*rh)->BunchX() << " -- " << gemid.rawId() << " = " << gemid << " ]";
128  }
129 #endif
130 
132  std::pair<const GEMSuperChamber*, std::map<uint32_t, const GEMEtaPartition*> >(chamber, ens));
133 
134 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
135  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] run the segment reconstruction algorithm now";
136 #endif
137 
138  // given the superchamber select the appropriate algo... and run it
139  std::vector<GEMSegment> segv;
140  if (enableGE0 and chamber->id().station() == 0)
141  segv = ge0Algo->run(ensemble, gemRecHits);
142  else if (enableGE12)
143  segv = segAlgo->run(ensemble, gemRecHits);
144 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
145  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << segv.size();
146 #endif
147 
148  GEMDetId mid(enIt->first);
149 
150 #ifdef EDM_ML_DEBUG // have lines below only compiled when in debug mode
151  LogTrace("GEMSegmentBuilder") << "[GEMSegmentBuilder::build] found " << segv.size()
152  << " segments in GEM Super Chamber " << mid;
153  LogTrace("GEMSegmentBuilder")
154  << "[GEMSegmentBuilder::build] -----------------------------------------------------------------------------";
155 #endif
156 
157  // Add the segments to master collection
158  oc.put(mid, segv.begin(), segv.end());
159  }
160 }
Log< level::Info, true > LogVerbatim
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
const GEMGeometry * geom_
std::pair< const GEMSuperChamber *, std::map< uint32_t, const GEMEtaPartition * > > GEMEnsemble
#define LogTrace(id)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::unique_ptr< GEMSegmentAlgorithmBase > ge0Algo
std::unique_ptr< GEMSegmentAlgorithmBase > segAlgo
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69

◆ fillDescription()

void GEMSegmentBuilder::fillDescription ( edm::ParameterSetDescription descriptions)
static

Definition at line 34 of file GEMSegmentBuilder.cc.

References edm::ParameterSetDescription::add(), edm::ParameterSetDescription::addUntracked(), submitPVResolutionJobs::desc, edm::ParameterDescriptionNode::setComment(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by GEMSegmentProducer::fillDescriptions().

34  {
35  desc.add<bool>("enableGE0", true);
36  desc.add<bool>("enableGE12", false);
37  desc.add<std::string>("ge0_name", "GE0SegAlgoRU");
38  desc.add<std::string>("algo_name", "GEMSegmentAlgorithm");
39 
40  edm::ParameterSetDescription ge0AlgoConfigDesc;
41  ge0AlgoConfigDesc.add<bool>("allowWideSegments", true);
42  ge0AlgoConfigDesc.add<bool>("doCollisions", true);
43  ge0AlgoConfigDesc.add<double>("maxChi2Additional", 100);
44  ge0AlgoConfigDesc.add<double>("maxChi2Prune", 50);
45  ge0AlgoConfigDesc.add<double>("maxChi2GoodSeg", 50);
46  ge0AlgoConfigDesc.add<double>("maxPhiSeeds", 0.001096605744)->setComment("Assuming 384 strips");
47  ge0AlgoConfigDesc.add<double>("maxPhiAdditional", 0.001096605744)->setComment("Assuming 384 strips");
48  ge0AlgoConfigDesc.add<double>("maxETASeeds", 0.1)->setComment("Assuming 8 eta partitions");
49  ge0AlgoConfigDesc.add<double>("maxTOFDiff", 25);
50  ge0AlgoConfigDesc.add<bool>("requireCentralBX", true)
51  ->setComment("require that a majority of hits come from central BX");
52  ge0AlgoConfigDesc.add<unsigned int>("minNumberOfHits", 4);
53  ge0AlgoConfigDesc.add<unsigned int>("maxNumberOfHits", 300);
54  ge0AlgoConfigDesc.add<unsigned int>("maxNumberOfHitsPerLayer", 100);
55  desc.add<edm::ParameterSetDescription>("ge0_pset", ge0AlgoConfigDesc);
56 
57  edm::ParameterSetDescription recAlgoConfigDesc;
58  recAlgoConfigDesc.addUntracked<bool>("GEMDebug", false);
59  recAlgoConfigDesc.add<unsigned int>("minHitsPerSegment", 2);
60  recAlgoConfigDesc.add<bool>("preClustering", true)
61  ->setComment("False => all hits in chamber are given to the fitter");
62  recAlgoConfigDesc.add<double>("dXclusBoxMax", 1)->setComment("Clstr Hit dPhi");
63  recAlgoConfigDesc.add<double>("dYclusBoxMax", 5)->setComment("Clstr Hit dEta");
64  recAlgoConfigDesc.add<bool>("preClusteringUseChaining", true)
65  ->setComment("True ==> use Chaining() , False ==> use Clustering() Fnct");
66  recAlgoConfigDesc.add<double>("dPhiChainBoxMax", .02)->setComment("Chain Hit dPhi");
67  recAlgoConfigDesc.add<double>("dEtaChainBoxMax", .05)->setComment("Chain Hit dEta");
68  recAlgoConfigDesc.add<int>("maxRecHitsInCluster", 4)->setComment("Does 4 make sense here?");
69  recAlgoConfigDesc.add<bool>("clusterOnlySameBXRecHits", true)
70  ->setComment("only working for (preClustering && preClusteringUseChaining)");
71  desc.add<edm::ParameterSetDescription>("algo_pset", recAlgoConfigDesc);
72 }
void setComment(std::string const &value)
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
ParameterDescriptionBase * add(U const &iLabel, T const &value)

◆ setGeometry()

void GEMSegmentBuilder::setGeometry ( const GEMGeometry g)

Cache pointer to geometry for current event

Definition at line 162 of file GEMSegmentBuilder.cc.

References relativeConstraints::geom, and geom_.

Member Data Documentation

◆ enableGE0

bool GEMSegmentBuilder::enableGE0
private

Definition at line 46 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ enableGE12

bool GEMSegmentBuilder::enableGE12
private

Definition at line 47 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ ge0Algo

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

Definition at line 53 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ ge0AlgoName

std::string GEMSegmentBuilder::ge0AlgoName
private

Definition at line 49 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ ge0AlgoPSet

edm::ParameterSet GEMSegmentBuilder::ge0AlgoPSet
private

Definition at line 51 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ geom_

const GEMGeometry* GEMSegmentBuilder::geom_
private

Definition at line 54 of file GEMSegmentBuilder.h.

Referenced by build(), and setGeometry().

◆ segAlgo

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

Definition at line 52 of file GEMSegmentBuilder.h.

Referenced by build(), and GEMSegmentBuilder().

◆ segAlgoName

std::string GEMSegmentBuilder::segAlgoName
private

Definition at line 48 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().

◆ segAlgoPSet

edm::ParameterSet GEMSegmentBuilder::segAlgoPSet
private

Definition at line 50 of file GEMSegmentBuilder.h.

Referenced by GEMSegmentBuilder().