72 auto _ThePoints = std::make_unique<RPCRecHitCollection>();
85 std::vector<uint32_t> rpcput;
88 for (TrackCollection::const_iterator
track = alltracks->begin();
track != alltracks->end();
track++) {
91 std::cout <<
"Building Trajectory from Track. " << std::endl;
93 std::vector<uint32_t> rpcrolls;
94 std::vector<uint32_t> rpcrolls2;
95 std::map<uint32_t, int> rpcNdtcsc;
96 std::map<uint32_t, int> rpcrollCounter;
98 float tInX =
track->innerPosition().X(), tInY =
track->innerPosition().Y(), tInZ =
track->innerPosition().Z();
99 float tOuX =
track->outerPosition().X(), tOuY =
track->outerPosition().Y(), tOuZ =
track->outerPosition().Z();
117 std::cout <<
"in (x,y,z): (" << tInX <<
", " << tInY <<
", " << tInZ <<
")" << std::endl;
119 std::cout <<
"out (x,y,z): (" << tOuX <<
", " << tOuY <<
", " << tOuZ <<
")" << std::endl;
122 std::cout <<
"1. Search expeted RPC roll detid !!" << std::endl;
124 if ((*hit)->isValid()) {
125 DetId id = (*hit)->geographicalId();
128 const GeomDet *geomDet = dtGeo->
idToDet((*hit)->geographicalId());
141 float dx = trajLP.
x() - trackLP.
x(),
dy = trajLP.
y() - trackLP.
y();
142 if (
dx > 10. &&
dy > 10.)
146 int dtW = dtid.
wheel(), dtS = dtid.sector(), dtT = dtid.station();
152 const std::set<RPCDetId> &rollsForThisDT = dtMap->
getRolls(theindex);
153 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin(); iteraRoll != rollsForThisDT.end();
155 const RPCRoll *rollasociated = rpcGeo->
roll(*iteraRoll);
161 rpcrollCounter[rollasociated->
id().
rawId()]++;
163 std::vector<uint32_t>::iterator rpcroll;
164 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++)
165 if (rollasociated->
id().
rawId() == *rpcroll)
168 rpcrolls.push_back(rollasociated->
id().
rawId());
172 << servId.name().c_str() << std::endl;
179 const GeomDet *geomDet = cscGeo->
idToDet((*hit)->geographicalId());
192 if (upd2.
isValid() && cscid.station() != 4 && cscid.ring() != 1) {
195 float dx = trajLP.
x() - trackLP.
x(),
dy = trajLP.
y() - trackLP.
y();
196 if (
dx > 10. &&
dy > 10.)
199 int En = cscid.endcap(), St = cscid.station(), Ri = cscid.ring();
200 int rpcSegment = cscid.chamber();
207 const std::set<RPCDetId> &rollsForThisCSC = cscMap->
getRolls(theindex);
208 for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin();
209 iteraRoll != rollsForThisCSC.end();
211 const RPCRoll *rollasociated = rpcGeo->
roll(*iteraRoll);
217 rpcrollCounter[rollasociated->
id().
rawId()]++;
219 std::vector<uint32_t>::iterator rpcroll;
220 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++)
221 if (rollasociated->
id().
rawId() == *rpcroll)
224 rpcrolls.push_back(rollasociated->
id().
rawId());
228 << servId.name().c_str() << std::endl;
236 std::cout <<
"1\t The hit is not DT/CSC's. " << std::endl;
241 std::cout <<
"First step OK!!\n2. Search nearest DT/CSC sufrace!!" << std::endl;
242 std::vector<uint32_t>::iterator rpcroll;
243 for (rpcroll = rpcrolls.begin(); rpcroll < rpcrolls.end(); rpcroll++) {
247 int rEn = rpcid.region(), rSe = rpcid.sector(), rWr = rpcid.ring(), rSt = rpcid.station(), rCh = servId.segment();
249 if (rpcrollCounter[*rpcroll] < 3)
252 uint32_t dtcscid = 0;
259 if ((*hit)->isValid()) {
260 DetId id = (*hit)->geographicalId();
262 const GeomDet *geomDet = dtGeo->
idToDet((*hit)->geographicalId());
265 double dx = rGP.
x() - dtGP.
x(),
dy = rGP.
y() - dtGP.
y(),
dz = rGP.
z() - dtGP.
z();
269 int Se = dtid.
sector(), Wh = dtid.wheel(), St = dtid.station();
275 if (rEn == 0 && (rSe - Se) == 0 && (rWr - Wh) == 0 && (rSt - St) == 0 && distanceN <
distance) {
279 std::cout <<
"2\t DT " << dtcscid <<
" Wheel : " << Wh <<
" station : " << St <<
" sector : " << Se
283 const GeomDet *geomDet = cscGeo->
idToDet((*hit)->geographicalId());
287 double dx = rGP.
x() - cscGP.
x(),
dy = rGP.
y() - cscGP.
y(),
dz = rGP.
z() - cscGP.
z();
291 int En = cscid.
endcap(), Ri = cscid.ring(), St = cscid.station(), Ch = cscid.chamber();
297 if ((rEn - En) == 0 && (rSt - St) == 0 && (Ch - rCh) == 0 && rWr != 1 && rSt != 4 && distanceN <
distance) {
301 std::cout <<
"2\t CSC " << dtcscid <<
" region : " << En <<
" station : " << St <<
" Ring : " << Ri
302 <<
" chamber : " << Ch << std::endl;
308 rpcrolls2.push_back(*rpcroll);
309 rpcNdtcsc[*rpcroll] = dtcscid;
313 std::cout <<
"Second step OK!! \n3. Propagate to RPC from DT/CSC!!" << std::endl;
315 std::vector<uint32_t>::iterator rpcroll2;
316 for (rpcroll2 = rpcrolls2.begin(); rpcroll2 < rpcrolls2.end(); rpcroll2++) {
318 std::vector<uint32_t>::iterator rpcput_;
319 for (rpcput_ = rpcput.begin(); rpcput_ < rpcput.end(); rpcput_++)
320 if (*rpcroll2 == *rpcput_)
324 uint32_t dtcscid = rpcNdtcsc[*rpcroll2];
346 if (tInX > rpcGPX || tOuX < rpcGPX)
348 if (tInY > rpcGPY || tOuY < rpcGPY)
350 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
359 float rsize = fabs(
xmax.x() -
xmin.x());
366 if (locx < rsize * eyr && locy < stripl * eyr && locz < 1.) {
371 std::cout <<
"3\t Barrel Expected RPC " << servId.name().c_str()
372 <<
" \tLocalposition X: " << locx <<
", Y: " << locy <<
" GlobalPosition(x,y,z) (" 373 << rpcGPX <<
", " << rpcGPY <<
", " << rpcGPZ <<
")" << std::endl;
374 RPCPointVector.
clear();
376 _ThePoints->put(*rpcroll2, RPCPointVector.
begin(), RPCPointVector.
end());
377 rpcput.push_back(*rpcroll2);
402 if (tInX > rpcGPX || tOuX < rpcGPX)
404 if (tInY > rpcGPY || tOuY < rpcGPY)
406 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
416 float rsize = fabs(
xmax.x() -
xmin.x());
424 if (locx < rsize * eyr && locy < stripl * eyr && locz < 1.) {
428 std::cout <<
"3\t Forward Expected RPC " << servId.name().c_str()
429 <<
" \tLocalposition X: " << locx <<
", Y: " << locy <<
" GlobalPosition(x,y,z) (" 430 << rpcGPX <<
", " << rpcGPY <<
", " << rpcGPZ <<
")" << std::endl;
431 RPCPointVector.
clear();
433 _ThePoints->put(*rpcroll2, RPCPointVector.
begin(), RPCPointVector.
end());
434 rpcput.push_back(*rpcroll2);
443 std::cout <<
"last steps OK!! " << std::endl;
std::vector< Trajectory > Trajectories
LocalPoint localPosition(float strip) const override
edm::ESGetToken< DTObjectMap, MuonGeometryRecord > dtMapToken_
Point3DBase< Scalar, LocalTag > LocalPoint
edm::ESGetToken< CSCObjectMap, MuonGeometryRecord > cscMapToken_
LocalPoint localPosition() const
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
std::unique_ptr< TrackTransformerBase > theTrackTransformer
std::set< RPCDetId > const & getRolls(DTStationIndex index) const
float stripLength() const override
GlobalPoint globalPosition() const
const GeomDet * idToDet(DetId) const override
edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
edm::ESGetToken< CSCGeometry, MuonGeometryRecord > cscGeoToken_
DetId geographicalId() const
The label of this GeomDet.
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const RPCGeometry *rpcGeo)
const Plane & surface() const
The nominal surface of the GeomDet.
constexpr uint32_t rawId() const
get the raw id
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeoToken_
int wheel() const
Return the wheel number.
const Topology & topology() const override
float stripLength() const override
det heigth (strip length in the middle)
const GeomDet * idToDet(DetId) const override
std::set< RPCDetId > const & getRolls(CSCStationIndex index) const
LocalPoint localPosition(float strip) const override
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeoToken_
const GeomDet * idToDet(DetId) const override