101 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Total number of GEM rechits in this event: " << recHits->size()
102 <<
" Total number of CSC segments in this event: " << cscsegments->size();
119 std::map<uint32_t, std::vector<GEMRecHit*> > gemRecHitCollection;
120 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_GEM11;
121 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_noGEM;
129 CSCDetId CSCId = segmIt->cscDetId();
141 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Found ME1/1 Segment in "<<CSCId.
rawId()<<
" = "<<CSCId<<std::endl;
149 std::vector<const CSCSegment* > cscsegmentvector = cscSegColl_GEM11[CSCId.
rawId()];
150 cscsegmentvector.push_back(segmIt->clone());
151 cscSegColl_GEM11[CSCId.
rawId()]=cscsegmentvector;
155 std::vector<GEMDetId> rollsForThisCSCvector;
157 int cscRegion = CSCId.
endcap();
158 int cscStation = CSCId.
station();
159 int cscChamber = CSCId.
chamber();
160 int gemRegion = 1;
if(cscRegion==2) gemRegion= -1;
162 int gemStation = cscStation;
164 int gem1stChamber = cscChamber;
171 std::vector<CSCStationIndex> indexvector;
174 indexvector.push_back(index11); indexvector.push_back(index12);
181 for(std::vector<CSCStationIndex>::iterator cscIndexIt=indexvector.begin(); cscIndexIt!=indexvector.end(); ++cscIndexIt)
183 std::set<GEMDetId> rollsForThisCSC =
rollstoreCSC[*cscIndexIt];
184 for (std::set<GEMDetId>::iterator gemRollIt = rollsForThisCSC.begin(); gemRollIt != rollsForThisCSC.end(); ++gemRollIt)
186 rollsForThisCSCvector.push_back(*gemRollIt);
193 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Start Loop over GEM Rechits :: size = "<<recHits->size()
194 <<
" and number of Rolls for this CSC :: "<<rollsForThisCSCvector.size()<<std::endl;
197 GEMDetId gemIdfromHit = hitIt->gemId();
200 for (std::vector<GEMDetId>::iterator gemRollIt = rollsForThisCSCvector.begin(); gemRollIt != rollsForThisCSCvector.end(); ++gemRollIt)
204 if(gemIdfromHit == gemIdfromCSC.
rawId())
210 std::vector<GEMRecHit* > gemrechitvector = gemRecHitCollection[CSCId.
rawId()];
212 bool hitfound =
false;
213 for(std::vector<GEMRecHit*>::const_iterator it=gemrechitvector.begin(); it!=gemrechitvector.end(); ++it)
215 if(hitIt->gemId()==(*it)->gemId() && hitIt->localPosition()==(*it)->localPosition()) hitfound=
true;
217 if(!hitfound) gemrechitvector.push_back(hitIt->clone());
218 gemRecHitCollection[CSCId.
rawId()]=gemrechitvector;
219 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] GEM Rechit in "<<hitIt->gemId()<<
"["<<hitIt->gemId().rawId()
220 <<
"] added to CSC segment found in "<<CSCId<<
" ["<<CSCId.
rawId()<<
"]"<<std::endl;
232 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Found non-ME1/1 Segment in "<<CSCId.
rawId()<<
" = "<<CSCId<<std::endl;
238 std::vector<const CSCSegment* > cscsegmentvector_noGEM = cscSegColl_noGEM[CSCId.
rawId()];
239 cscsegmentvector_noGEM.push_back(segmIt->clone());
240 cscSegColl_noGEM[CSCId.
rawId()]=cscsegmentvector_noGEM;
271 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Run over the gemRecHitCollection (size = "<<gemRecHitCollection.size()<<
") and build GEMCSC Segments";
272 for(
auto gemHitIt=gemRecHitCollection.begin(); gemHitIt != gemRecHitCollection.end(); ++gemHitIt)
278 std::vector<const CSCSegment*>
cscSegments = cscSegColl_GEM11[cscId.rawId()];
281 std::map<uint32_t, const CSCLayer* > cscLayers;
282 std::map<uint32_t, const GEMEtaPartition* > gemEtaPartitions;
286 for(std::vector<const CSCLayer*>::const_iterator layIt = cscLayerVector.begin(); layIt != cscLayerVector.end(); ++layIt)
292 for(
auto rechit = gemHitIt->second.begin(); rechit != gemHitIt->second.end(); ++rechit)
294 GEMDetId gemid = (*rechit)->gemId();
295 gemRecHits.push_back(*rechit);
300 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] ask SegmentAlgo to be run :: CSC DetId "<<cscId.rawId()<<
" = "<<cscId
301 <<
" with "<<cscSegments.size()<<
" CSC segments and "<<gemRecHits.size()<<
" GEM rechits";
304 std::vector<GEMCSCSegment> segmentvector =
algo->run(cscLayers, gemEtaPartitions, cscSegments, gemRecHits);
307 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] SegmentAlgo ran, now trying to add the segments from the returned GEMCSCSegment vector (with size = " 308 <<segmentvector.size()<<
") to the master collection";
309 std::stringstream segmentvectorss; segmentvectorss<<
"[GEMCSCSegmentBuilder :: build] :: GEMCSC segmentvector :: elements ["<<std::endl;
310 for(std::vector<GEMCSCSegment>::const_iterator segIt = segmentvector.begin(); segIt != segmentvector.end(); ++segIt)
312 segmentvectorss<<
"[GEMCSC Segment details: \n"<<*segIt<<
"],"<<std::endl;
314 segmentvectorss<<
"]";
315 std::string segmentvectorstr = segmentvectorss.str();
321 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments created, now try to add to the collection :: CSC DetId: "<<cscId.rawId()<<
" = "<<cscId
322 <<
" added "<<segmentvector.size()<<
" GEMCSC Segments";
323 oc.put(cscId, segmentvector.begin(), segmentvector.end());
324 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments added to the collection";
334 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] Run over the CSC Segment collection without GEM (size = "<<cscSegColl_noGEM.size()
335 <<
" CSC chambers with segments) and wrap GEMCSC Segments";
336 for(
auto cscSegIt=cscSegColl_noGEM.begin(); cscSegIt != cscSegColl_noGEM.end(); ++cscSegIt)
341 std::vector<const GEMRecHit*> gemRecHits_noGEM;
342 std::vector<const CSCSegment*> cscSegments_noGEM = cscSegColl_noGEM[cscSegIt->first];
343 std::vector<GEMCSCSegment> segmentvector;
345 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] |--> Run over the CSC Segment vector without GEM (size = "<<cscSegments_noGEM.size()
346 <<
" CSC segments) and wrap GEMCSC Segments";
347 for (std::vector<const CSCSegment*>::iterator it=cscSegments_noGEM.begin(); it!=cscSegments_noGEM.end(); ++it)
350 GEMCSCSegment tmp(*it, gemRecHits_noGEM, (*it)->localPosition(), (*it)->localDirection(), (*it)->parametersError(), (*it)->chi2());
351 segmentvector.push_back(
tmp);
355 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments wrapped, now try to add to the collection :: CSC DetId: "<<cscId.rawId()<<
" = "<<cscId
356 <<
" added "<<segmentvector.size()<<
" GEMCSC Segments";
357 oc.put(cscId, segmentvector.begin(), segmentvector.end());
358 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments added to the collection";
361 edm::LogVerbatim(
"GEMCSCSegmentBuilder")<<
"[GEMCSCSegmentBuilder :: build] job done !!!";
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
const CSCGeometry * cscgeom_
constexpr uint32_t rawId() const
get the raw id
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
std::unique_ptr< GEMCSCSegmentAlgorithm > algo
C::const_iterator const_iterator
constant access iterator type
std::map< CSCStationIndex, std::set< GEMDetId > > rollstoreCSC
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
const GEMGeometry * gemgeom_
std::vector< std::vector< double > > tmp
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.