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());
132 for (Trajectories::const_iterator trajectory = trajectories.begin(); trajectory != trajectories.end();
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());
185 for (Trajectories::const_iterator trajectory = trajectories.begin(); trajectory != trajectories.end();
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) {
278 distance = distanceN;
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) {
300 distance = distanceN;
302 std::cout <<
"2\t CSC " << dtcscid <<
" region : " << En <<
" station : " << St <<
" Ring : " << Ri
303 <<
" chamber : " << Ch << std::endl;
308 if (dtcscid != 0 && distance < MaxD) {
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];
332 for (Trajectories::const_iterator trajectory = trajectories.begin(); trajectory != trajectories.end();
347 if (tInX > rpcGPX || tOuX < rpcGPX)
349 if (tInY > rpcGPY || tOuY < rpcGPY)
351 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
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);
388 for (Trajectories::const_iterator trajectory = trajectories.begin(); trajectory != trajectories.end();
403 if (tInX > rpcGPX || tOuX < rpcGPX)
405 if (tInY > rpcGPY || tOuY < rpcGPY)
407 if (tInZ > rpcGPZ || tOuZ < rpcGPZ)
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;
std::vector< Trajectory > Trajectories
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
edm::ESHandle< Propagator > thePropagator
virtual float length() const =0
Point3DBase< Scalar, LocalTag > LocalPoint
LocalPoint localPosition(float strip) const override
edm::OwnVector< RPCRecHit > RPCPointVector
const GeomDet * idToDet(DetId) const override
LocalPoint localPosition() const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
constexpr uint32_t rawId() const
get the raw id
std::vector< Track > TrackCollection
collection of Tracks
LocalPoint localPosition(float strip) const override
GlobalPoint globalPosition() const
const Bounds & bounds() const
std::set< RPCDetId > const & getRolls(CSCStationIndex index) const
TracktoRPC(reco::TrackCollection const *alltracks, edm::EventSetup const &iSetup, bool debug, const edm::ParameterSet &iConfig, const edm::InputTag &tracklabel)
const Topology & topology() const override
const Plane & surface() const
The nominal surface of the GeomDet.
std::set< RPCDetId > const & getRolls(DTStationIndex index) const
TrackTransformerBase * theTrackTransformer
virtual float width() const =0
std::unique_ptr< RPCRecHitCollection > _ThePoints
virtual std::string name()
bool ValidRPCSurface(RPCDetId rpcid, LocalPoint LocalP, const edm::EventSetup &iSetup)
DetId geographicalId() const
The label of this GeomDet.
float stripLength() const override
det heigth (strip length in the middle)
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
const GeomDet * idToDet(DetId) const override
const GeomDet * idToDet(DetId) const override
int wheel() const
Return the wheel number.
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
float stripLength() const override