38 <<
"[GEMCSCSegmentBuilder :: ctor] algorithm name: " << ps.getParameter<
std::string>(
"algo_name");
42 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: dstor] deleted the algorithm";
46 for (TrackingGeometry::DetContainer::const_iterator it = gemGeo->
dets().begin(); it < gemGeo->
dets().end(); it++) {
49 std::vector<const GEMEtaPartition*> rolls = (ch->
etaPartitions());
50 for (std::vector<const GEMEtaPartition*>::const_iterator
r = rolls.begin();
r != rolls.end(); ++
r) {
56 int gemchamber = gemId.
chamber();
60 int cscchamber = gemchamber;
63 std::set<GEMDetId> myrolls;
66 myrolls.insert(gemId);
78 std::set<GEMDetId> map_secnd = mapit->second;
79 std::stringstream GEMRollsstream;
80 for (std::set<GEMDetId>::iterator setit = map_secnd.begin(); setit != map_secnd.end(); ++setit) {
81 GEMRollsstream <<
"[ GEM Id: " << setit->rawId() <<
" (" << *setit <<
")"
86 <<
"[GEMCSCSegmentBuilder :: LinkGEMRollsToCSCChamberIndex] CSC Station Index :: [" << map_first.
region() <<
","
88 <<
"] has following GEM rolls: [" << GEMRollsstr <<
"]" << std::endl;
96 <<
"[GEMCSCSegmentBuilder :: build] Total number of GEM rechits in this event: " << recHits->size()
97 <<
" Total number of CSC segments in this event: " << cscsegments->size();
113 std::map<uint32_t, std::vector<GEMRecHit*> > gemRecHitCollection;
114 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_GEM11;
115 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_noGEM;
120 CSCDetId CSCId = segmIt->cscDetId();
128 if (CSCId.
station() == 1 && (CSCId.
ring() == 1 || CSCId.
ring() == 4)) {
130 <<
"[GEMCSCSegmentBuilder :: build] Found ME1/1 Segment in " << CSCId.
rawId() <<
" = " << CSCId << std::endl;
138 std::vector<const CSCSegment*> cscsegmentvector = cscSegColl_GEM11[CSCId.
rawId()];
139 cscsegmentvector.push_back(segmIt->clone());
140 cscSegColl_GEM11[CSCId.
rawId()] = cscsegmentvector;
144 std::vector<GEMDetId> rollsForThisCSCvector;
146 int cscRegion = CSCId.
endcap();
147 int cscStation = CSCId.
station();
148 int cscChamber = CSCId.
chamber();
153 int gemStation = cscStation;
155 int gem1stChamber = cscChamber;
162 std::vector<CSCStationIndex> indexvector;
163 CSCStationIndex index11(gemRegion, gemStation, gemRing, gem1stChamber, 1);
164 CSCStationIndex index12(gemRegion, gemStation, gemRing, gem1stChamber, 2);
165 indexvector.push_back(index11);
166 indexvector.push_back(index12);
173 for (std::vector<CSCStationIndex>::iterator cscIndexIt = indexvector.begin(); cscIndexIt != indexvector.end();
175 std::set<GEMDetId> rollsForThisCSC =
rollstoreCSC[*cscIndexIt];
176 for (std::set<GEMDetId>::iterator gemRollIt = rollsForThisCSC.begin(); gemRollIt != rollsForThisCSC.end();
178 rollsForThisCSCvector.push_back(*gemRollIt);
185 <<
"[GEMCSCSegmentBuilder :: build] Start Loop over GEM Rechits :: size = " << recHits->size()
186 <<
" and number of Rolls for this CSC :: " << rollsForThisCSCvector.size() << std::endl;
188 GEMDetId gemIdfromHit = hitIt->gemId();
191 for (std::vector<GEMDetId>::iterator gemRollIt = rollsForThisCSCvector.begin();
192 gemRollIt != rollsForThisCSCvector.end();
200 std::vector<GEMRecHit*> gemrechitvector = gemRecHitCollection[CSCId.
rawId()];
202 bool hitfound =
false;
203 for (std::vector<GEMRecHit*>::const_iterator it = gemrechitvector.begin(); it != gemrechitvector.end();
205 if (hitIt->gemId() == (*it)->gemId() && hitIt->localPosition() == (*it)->localPosition())
209 gemrechitvector.push_back(hitIt->clone());
210 gemRecHitCollection[CSCId.
rawId()] = gemrechitvector;
212 <<
"[GEMCSCSegmentBuilder :: build] GEM Rechit in " << hitIt->gemId() <<
"[" << hitIt->gemId().rawId()
213 <<
"] added to CSC segment found in " << CSCId <<
" [" << CSCId.
rawId() <<
"]" << std::endl;
221 else if (!(CSCId.
station() == 1 && (CSCId.
ring() == 1 || CSCId.
ring() == 4))) {
222 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: build] Found non-ME1/1 Segment in "
223 << CSCId.
rawId() <<
" = " << CSCId << std::endl;
229 std::vector<const CSCSegment*> cscsegmentvector_noGEM = cscSegColl_noGEM[CSCId.
rawId()];
230 cscsegmentvector_noGEM.push_back(segmIt->clone());
231 cscSegColl_noGEM[CSCId.
rawId()] = cscsegmentvector_noGEM;
262 <<
"[GEMCSCSegmentBuilder :: build] Run over the gemRecHitCollection (size = " << gemRecHitCollection.size()
263 <<
") and build GEMCSC Segments";
264 for (
auto gemHitIt = gemRecHitCollection.begin(); gemHitIt != gemRecHitCollection.end(); ++gemHitIt) {
268 std::vector<const CSCSegment*>
cscSegments = cscSegColl_GEM11[cscId.
rawId()];
271 std::map<uint32_t, const CSCLayer*> cscLayers;
272 std::map<uint32_t, const GEMEtaPartition*> gemEtaPartitions;
276 for (std::vector<const CSCLayer*>::const_iterator layIt = cscLayerVector.begin(); layIt != cscLayerVector.end();
282 for (
auto rechit = gemHitIt->second.begin(); rechit != gemHitIt->second.end(); ++rechit) {
283 GEMDetId gemid = (*rechit)->gemId();
284 gemRecHits.push_back(*rechit);
290 <<
"[GEMCSCSegmentBuilder :: build] ask SegmentAlgo to be run :: CSC DetId " << cscId.
rawId() <<
" = " << cscId
291 <<
" with " << cscSegments.size() <<
" CSC segments and " << gemRecHits.size() <<
" GEM rechits";
294 std::vector<GEMCSCSegment> segmentvector =
algo->run(cscLayers, gemEtaPartitions, cscSegments, gemRecHits);
297 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: build] SegmentAlgo ran, now trying to add "
298 "the segments from the returned GEMCSCSegment vector (with size = "
299 << segmentvector.size() <<
") to the master collection";
300 std::stringstream segmentvectorss;
301 segmentvectorss <<
"[GEMCSCSegmentBuilder :: build] :: GEMCSC segmentvector :: elements [" << std::endl;
302 for (std::vector<GEMCSCSegment>::const_iterator segIt = segmentvector.begin(); segIt != segmentvector.end();
304 segmentvectorss <<
"[GEMCSC Segment details: \n" << *segIt <<
"]," << std::endl;
306 segmentvectorss <<
"]";
307 std::string segmentvectorstr = segmentvectorss.str();
313 <<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments created, now try to add to the collection :: CSC "
315 << cscId.
rawId() <<
" = " << cscId <<
" added " << segmentvector.size() <<
" GEMCSC Segments";
316 oc.put(cscId, segmentvector.begin(), segmentvector.end());
318 <<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments added to the collection";
328 <<
"[GEMCSCSegmentBuilder :: build] Run over the CSC Segment collection without GEM (size = "
329 << cscSegColl_noGEM.size() <<
" CSC chambers with segments) and wrap GEMCSC Segments";
330 for (
auto cscSegIt = cscSegColl_noGEM.begin(); cscSegIt != cscSegColl_noGEM.end(); ++cscSegIt) {
333 std::vector<const GEMRecHit*> gemRecHits_noGEM;
334 std::vector<const CSCSegment*> cscSegments_noGEM = cscSegColl_noGEM[cscSegIt->first];
335 std::vector<GEMCSCSegment> segmentvector;
338 <<
"[GEMCSCSegmentBuilder :: build] |--> Run over the CSC Segment vector without GEM (size = "
339 << cscSegments_noGEM.size() <<
" CSC segments) and wrap GEMCSC Segments";
340 for (std::vector<const CSCSegment*>::iterator it = cscSegments_noGEM.begin(); it != cscSegments_noGEM.end(); ++it) {
344 (*it)->localPosition(),
345 (*it)->localDirection(),
346 (*it)->parametersError(),
348 segmentvector.push_back(
tmp);
353 <<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments wrapped, now try to add to the collection :: CSC DetId: "
354 << cscId.
rawId() <<
" = " << cscId <<
" added " << segmentvector.size() <<
" GEMCSC Segments";
355 oc.put(cscId, segmentvector.begin(), segmentvector.end());
357 <<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments added to the collection";
360 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: build] job done !!!";
Log< level::Info, true > LogVerbatim
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
void LinkGEMRollsToCSCChamberIndex(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)
const CSCGeometry * cscgeom_
constexpr uint32_t rawId() const
get the raw id
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
constexpr std::array< uint8_t, layerIndexSize > layer
std::unique_ptr< GEMCSCSegmentAlgorithm > algo
C::const_iterator const_iterator
constant access iterator type
GEMCSCSegmentBuilder(const edm::ParameterSet &)
constexpr int region() const
std::map< CSCStationIndex, std::set< GEMDetId > > rollstoreCSC
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return the eta partitions.
void build(const GEMRecHitCollection *rechits, const CSCSegmentCollection *cscsegments, GEMCSCSegmentCollection &oc)
constexpr int chamber() const
constexpr int ring() const
constexpr int layer() const
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
T getParameter(std::string const &) const
constexpr int station() const
const GEMGeometry * gemgeom_
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
void setGeometry(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)