26 const RPCRoll *aroll = dynamic_cast<const RPCRoll *>(whichdet3);
27 float locx = LocalP.
x(), locy = LocalP.
y();
30 float boundlength = rollbound.
length();
31 float boundwidth = rollbound.
width();
33 if (fabs(locx) < boundwidth / 2 && fabs(locy) < boundlength / 2 && locy > -boundlength / 2)
40 float boundlength = rollbound.
length();
41 float boundwidth = rollbound.
width();
44 float ylimit = ((boundlength) / (boundwidth / 2 - nminx / 2)) * fabs(locx) + boundlength / 2 -
45 ((boundlength) / (boundwidth / 2 - nminx / 2)) * (boundwidth / 2);
46 if (ylimit < -boundlength / 2)
47 ylimit = -boundlength / 2;
49 if (fabs(locx) < boundwidth / 2 && fabs(locy) < boundlength / 2 && locy > ylimit)
62 _ThePoints = std::make_unique<RPCRecHitCollection>();
65 if (tracklabel.
label().find(
"cosmic") == 0)
67 else if (tracklabel.
label().find(
"globalCosmic") == 0)
86 std::vector<uint32_t> rpcput;
89 for (TrackCollection::const_iterator
track = alltracks->begin();
track != alltracks->end();
track++) {
92 std::cout <<
"Building Trajectory from Track. " << std::endl;
94 std::vector<uint32_t> rpcrolls;
95 std::vector<uint32_t> rpcrolls2;
96 std::map<uint32_t, int> rpcNdtcsc;
97 std::map<uint32_t, int> rpcrollCounter;
99 float tInX =
track->innerPosition().X(), tInY =
track->innerPosition().Y(), tInZ =
track->innerPosition().Z();
100 float tOuX =
track->outerPosition().X(), tOuY =
track->outerPosition().Y(), tOuZ =
track->outerPosition().Z();
118 std::cout <<
"in (x,y,z): (" << tInX <<
", " << tInY <<
", " << tInZ <<
")" << std::endl;
120 std::cout <<
"out (x,y,z): (" << tOuX <<
", " << tOuY <<
", " << tOuZ <<
")" << std::endl;
123 std::cout <<
"1. Search expeted RPC roll detid !!" << std::endl;
125 if ((*hit)->isValid()) {
126 DetId id = (*hit)->geographicalId();
129 const GeomDet *geomDet = dtGeo->
idToDet((*hit)->geographicalId());
130 const DTLayer *dtlayer = dynamic_cast<const DTLayer *>(geomDet);
142 float dx = trajLP.
x() - trackLP.
x(),
dy = trajLP.
y() - trackLP.
y();
143 if (
dx > 10. &&
dy > 10.)
147 int dtW = dtid.
wheel(), dtS = dtid.sector(), dtT = dtid.station();
153 std::set<RPCDetId> rollsForThisDT = dtMap->
getRolls(theindex);
154 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin(); iteraRoll != rollsForThisDT.end();
156 const RPCRoll *rollasociated = rpcGeo->
roll(*iteraRoll);
162 rpcrollCounter[rollasociated->
id().
rawId()]++;
164 std::vector<uint32_t>::iterator rpcroll;
165 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++)
166 if (rollasociated->
id().
rawId() == *rpcroll)
169 rpcrolls.push_back(rollasociated->
id().
rawId());
173 << servId.name().c_str() << std::endl;
180 const GeomDet *geomDet = cscGeo->
idToDet((*hit)->geographicalId());
181 const CSCLayer *csclayer = dynamic_cast<const CSCLayer *>(geomDet);
193 if (upd2.
isValid() && cscid.station() != 4 && cscid.ring() != 1) {
196 float dx = trajLP.
x() - trackLP.
x(),
dy = trajLP.
y() - trackLP.
y();
197 if (
dx > 10. &&
dy > 10.)
200 int En = cscid.endcap(), St = cscid.station(), Ri = cscid.ring();
201 int rpcSegment = cscid.chamber();
208 std::set<RPCDetId> rollsForThisCSC = cscMap->
getRolls(theindex);
209 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin();
210 iteraRoll != rollsForThisCSC.end();
212 const RPCRoll *rollasociated = rpcGeo->
roll(*iteraRoll);
218 rpcrollCounter[rollasociated->
id().
rawId()]++;
220 std::vector<uint32_t>::iterator rpcroll;
221 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++)
222 if (rollasociated->
id().
rawId() == *rpcroll)
225 rpcrolls.push_back(rollasociated->
id().
rawId());
229 << servId.name().c_str() << std::endl;
237 std::cout <<
"1\t The hit is not DT/CSC's. " << std::endl;
242 std::cout <<
"First step OK!!\n2. Search nearest DT/CSC sufrace!!" << std::endl;
243 std::vector<uint32_t>::iterator rpcroll;
244 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++) {
250 if (rpcrollCounter[*rpcroll] < 3)
253 uint32_t dtcscid = 0;
260 if ((*hit)->isValid()) {
261 DetId id = (*hit)->geographicalId();
263 const GeomDet *geomDet = dtGeo->
idToDet((*hit)->geographicalId());
266 double dx = rGP.
x() - dtGP.
x(),
dy = rGP.
y() - dtGP.
y(),
dz = rGP.
z() - dtGP.
z();
270 int Se = dtid.
sector(), Wh = dtid.wheel(), St = dtid.station();
276 if (rEn == 0 && (rSe - Se) == 0 && (rWr - Wh) == 0 && (rSt - St) == 0 && distanceN <
distance) {
280 std::cout <<
"2\t DT " << dtcscid <<
" Wheel : " << Wh <<
" station : " << St <<
" sector : " << Se
284 const GeomDet *geomDet = cscGeo->
idToDet((*hit)->geographicalId());
288 double dx = rGP.
x() - cscGP.
x(),
dy = rGP.
y() - cscGP.
y(),
dz = rGP.
z() - cscGP.
z();
292 int En = cscid.
endcap(), Ri = cscid.ring(), St = cscid.station(), Ch = cscid.chamber();
298 if ((rEn - En) == 0 && (rSt - St) == 0 && (Ch - rCh) == 0 && rWr != 1 && rSt != 4 && distanceN <
distance) {
302 std::cout <<
"2\t CSC " << dtcscid <<
" region : " << En <<
" station : " << St <<
" Ring : " << Ri
303 <<
" chamber : " << Ch << std::endl;
309 rpcrolls2.push_back(*rpcroll);
310 rpcNdtcsc[*rpcroll] = dtcscid;
314 std::cout <<
"Second step OK!! \n3. Propagate to RPC from DT/CSC!!" << std::endl;
316 std::vector<uint32_t>::iterator rpcroll2;
317 for (rpcroll2 = rpcrolls2.begin(); rpcroll2 < rpcrolls2.end(); rpcroll2++) {
319 std::vector<uint32_t>::iterator rpcput_;
320 for (rpcput_ = rpcput.begin(); rpcput_ < rpcput.end(); rpcput_++)
321 if (*rpcroll2 == *rpcput_)
325 uint32_t dtcscid = rpcNdtcsc[*rpcroll2];
329 const DTLayer *dtlayer = dynamic_cast<const DTLayer *>(geomDet);
347 if (tInX > rpcGPX || tOuX < rpcGPX)
349 if (tInY > rpcGPY || tOuY < rpcGPY)
351 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
355 const RPCRoll *aroll = dynamic_cast<const RPCRoll *>(geomDet2);
357 dynamic_cast<const RectangularStripTopology *>(&(aroll->
topology()));
360 float rsize = fabs(
xmax.x() -
xmin.x());
367 if (locx < rsize * eyr && locy < stripl * eyr && locz < 1.) {
372 std::cout <<
"3\t Barrel Expected RPC " << servId.
name().c_str()
373 <<
" \tLocalposition X: " << locx <<
", Y: " << locy <<
" GlobalPosition(x,y,z) ("
374 << rpcGPX <<
", " << rpcGPY <<
", " << rpcGPZ <<
")" << std::endl;
378 rpcput.push_back(*rpcroll2);
385 const CSCLayer *csclayer = dynamic_cast<const CSCLayer *>(geomDet4);
403 if (tInX > rpcGPX || tOuX < rpcGPX)
405 if (tInY > rpcGPY || tOuY < rpcGPY)
407 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
412 const RPCRoll *aroll = dynamic_cast<const RPCRoll *>(geomDet3);
414 dynamic_cast<const TrapezoidalStripTopology *>(&(aroll->
topology()));
417 float rsize = fabs(
xmax.x() -
xmin.x());
425 if (locx < rsize * eyr && locy < stripl * eyr && locz < 1.) {
429 std::cout <<
"3\t Forward Expected RPC " << servId.
name().c_str()
430 <<
" \tLocalposition X: " << locx <<
", Y: " << locy <<
" GlobalPosition(x,y,z) ("
431 << rpcGPX <<
", " << rpcGPY <<
", " << rpcGPZ <<
")" << std::endl;
435 rpcput.push_back(*rpcroll2);
444 std::cout <<
"last steps OK!! " << std::endl;