35 enable_me21_ge21_(ps.getParameter<
bool>(
"enableME21GE21")),
39 <<
"[GEMCSCSegmentBuilder :: ctor] algorithm name: " << ps.getParameter<
std::string>(
"algo_name");
43 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: dstor] deleted the algorithm";
47 for (TrackingGeometry::DetContainer::const_iterator it = gemGeo->
dets().begin(); it < gemGeo->
dets().end(); it++) {
50 std::vector<const GEMEtaPartition*> rolls = (ch->
etaPartitions());
51 for (std::vector<const GEMEtaPartition*>::const_iterator
r = rolls.begin();
r != rolls.end(); ++
r) {
57 int gemchamber = gemId.
chamber();
61 int cscchamber = gemchamber;
64 std::set<GEMDetId> myrolls;
67 myrolls.insert(gemId);
79 std::set<GEMDetId> map_secnd = mapit->second;
80 std::stringstream GEMRollsstream;
81 for (std::set<GEMDetId>::iterator setit = map_secnd.begin(); setit != map_secnd.end(); ++setit) {
82 GEMRollsstream <<
"[ GEM Id: " << setit->rawId() <<
" (" << *setit <<
")" 87 <<
"[GEMCSCSegmentBuilder :: LinkGEMRollsToCSCChamberIndex] CSC Station Index :: [" << map_first.
region() <<
"," 89 <<
"] has following GEM rolls: [" << GEMRollsstr <<
"]" << std::endl;
97 <<
"[GEMCSCSegmentBuilder :: build] Total number of GEM rechits in this event: " <<
recHits->size()
98 <<
" Total number of CSC segments in this event: " << cscsegments->size();
114 std::map<uint32_t, std::vector<GEMRecHit*> > gemRecHitCollection;
115 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_GEM11;
116 std::map<uint32_t, std::vector<const CSCSegment*> > cscSegColl_noGEM;
121 CSCDetId CSCId = segmIt->cscDetId();
129 <<
"[GEMCSCSegmentBuilder :: build] Found " << (CSCId.
isME11() ?
"ME1/1" :
"ME2/1") <<
" Segment in " 130 << CSCId.
rawId() <<
" = " << CSCId;
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;
223 <<
"[GEMCSCSegmentBuilder :: build] Found a Segment in " << CSCId.
rawId() <<
" = " << CSCId;
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;
258 <<
"[GEMCSCSegmentBuilder :: build] Run over the gemRecHitCollection (size = " << gemRecHitCollection.size()
259 <<
") and build GEMCSC Segments";
260 for (
auto gemHitIt = gemRecHitCollection.begin(); gemHitIt != gemRecHitCollection.end(); ++gemHitIt) {
264 std::vector<const CSCSegment*>
cscSegments = cscSegColl_GEM11[cscId.
rawId()];
267 std::map<uint32_t, const CSCLayer*> cscLayers;
268 std::map<uint32_t, const GEMEtaPartition*> gemEtaPartitions;
272 for (std::vector<const CSCLayer*>::const_iterator layIt = cscLayerVector.begin(); layIt != cscLayerVector.end();
278 for (
auto rechit = gemHitIt->second.begin(); rechit != gemHitIt->second.end(); ++rechit) {
279 GEMDetId gemid = (*rechit)->gemId();
286 <<
"[GEMCSCSegmentBuilder :: build] ask SegmentAlgo to be run :: CSC DetId " << cscId.
rawId() <<
" = " << cscId
293 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: build] SegmentAlgo ran, now trying to add " 294 "the segments from the returned GEMCSCSegment vector (with size = " 295 << segmentvector.size() <<
") to the master collection";
296 std::stringstream segmentvectorss;
297 segmentvectorss <<
"[GEMCSCSegmentBuilder :: build] :: GEMCSC segmentvector :: elements [" << std::endl;
298 for (std::vector<GEMCSCSegment>::const_iterator segIt = segmentvector.begin(); segIt != segmentvector.end();
300 segmentvectorss <<
"[GEMCSC Segment details: \n" << *segIt <<
"]," << std::endl;
302 segmentvectorss <<
"]";
303 std::string segmentvectorstr = segmentvectorss.str();
309 <<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments created, now try to add to the collection :: CSC " 311 << cscId.
rawId() <<
" = " << cscId <<
" added " << segmentvector.size() <<
" GEMCSC Segments";
312 oc.put(cscId, segmentvector.begin(), segmentvector.end());
314 <<
"[GEMCSCSegmentBuilder :: build] |--> GEMCSC Segments added to the collection";
324 <<
"[GEMCSCSegmentBuilder :: build] Run over the CSC Segment collection without GEM (size = " 325 << cscSegColl_noGEM.size() <<
" CSC chambers with segments) and wrap GEMCSC Segments";
326 for (
auto cscSegIt = cscSegColl_noGEM.begin(); cscSegIt != cscSegColl_noGEM.end(); ++cscSegIt) {
329 std::vector<const GEMRecHit*> gemRecHits_noGEM;
330 std::vector<const CSCSegment*> cscSegments_noGEM = cscSegColl_noGEM[cscSegIt->first];
331 std::vector<GEMCSCSegment> segmentvector;
334 <<
"[GEMCSCSegmentBuilder :: build] |--> Run over the CSC Segment vector without GEM (size = " 335 << cscSegments_noGEM.size() <<
" CSC segments) and wrap GEMCSC Segments";
336 for (std::vector<const CSCSegment*>::iterator it = cscSegments_noGEM.begin(); it != cscSegments_noGEM.end(); ++it) {
340 (*it)->localPosition(),
341 (*it)->localDirection(),
342 (*it)->parametersError(),
344 segmentvector.push_back(
tmp);
349 <<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments wrapped, now try to add to the collection :: CSC DetId: " 350 << cscId.
rawId() <<
" = " << cscId <<
" added " << segmentvector.size() <<
" GEMCSC Segments";
351 oc.put(cscId, segmentvector.begin(), segmentvector.end());
353 <<
"[GEMCSCSegmentBuilder :: build] |--> CSC Segments added to the collection";
356 edm::LogVerbatim(
"GEMCSCSegmentBuilder") <<
"[GEMCSCSegmentBuilder :: build] job done !!!";
Log< level::Info, true > LogVerbatim
constexpr int station() const
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
T getParameter(std::string const &) const
constexpr int region() const
const CSCChamber * chamber(CSCDetId id) const
Return the chamber corresponding to given DetId.
void LinkGEMRollsToCSCChamberIndex(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)
const CSCGeometry * cscgeom_
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
constexpr int layer() const
constexpr int chamber() const
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer
std::unique_ptr< GEMCSCSegmentAlgorithm > algo
C::const_iterator const_iterator
constant access iterator type
GEMCSCSegmentBuilder(const edm::ParameterSet &)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
std::map< CSCStationIndex, std::set< GEMDetId > > rollstoreCSC
constexpr int ring() const
void build(const GEMRecHitCollection *rechits, const CSCSegmentCollection *cscsegments, GEMCSCSegmentCollection &oc)
constexpr uint32_t rawId() const
get the raw id
const GEMGeometry * gemgeom_
void setGeometry(const GEMGeometry *gemgeom, const CSCGeometry *cscgeom)
const CSCLayer * layer(CSCDetId id) const
Return the layer corresponding to given DetId.
const bool enable_me21_ge21_
const std::vector< const GEMEtaPartition * > & etaPartitions() const
Return the eta partitions.