CMS 3D CMS Logo

GEMSegmentBuilder.cc
Go to the documentation of this file.
8 
11 
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 }
33 
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 }
73 
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 }
161 
static void fillDescription(edm::ParameterSetDescription &descriptions)
Log< level::Info, true > LogVerbatim
void setComment(std::string const &value)
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
Definition: GEMGeometry.cc:77
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
const GEMGeometry * geom_
void build(const GEMRecHitCollection *rechits, GEMSegmentCollection &oc)
std::pair< const GEMSuperChamber *, std::map< uint32_t, const GEMEtaPartition * > > GEMEnsemble
GEMSegmentBuilder(const edm::ParameterSet &)
std::string segAlgoName
#define LogTrace(id)
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::unique_ptr< GEMSegmentAlgorithmBase > ge0Algo
~GEMSegmentBuilder()
Destructor.
edm::ParameterSet ge0AlgoPSet
#define get
edm::ParameterSet segAlgoPSet
std::unique_ptr< GEMSegmentAlgorithmBase > segAlgo
const GEMSuperChamber * superChamber(GEMDetId id) const
Definition: GEMGeometry.cc:69
void setGeometry(const GEMGeometry *g)
std::string ge0AlgoName