CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTSegtoRPC Class Reference

#include <DTSegtoRPC.h>

Public Member Functions

 DTSegtoRPC (edm::ConsumesCollector iC)
 
std::unique_ptr< RPCRecHitCollectionthePoints (DTRecSegment4DCollection const *all4DSegments, edm::EventSetup const &iSetup, bool debug, double eyr)
 

Private Attributes

edm::ESGetToken< DTGeometry, MuonGeometryRecorddtGeoToken_
 
edm::ESGetToken< DTObjectMap, MuonGeometryRecorddtMapToken_
 
bool incldt
 
bool incldtMB4
 
double MaxD
 
double MaxDistanceBetweenSegments
 
double MaxDrb4
 
double MinCosAng
 
edm::ESGetToken< RPCGeometry, MuonGeometryRecordrpcGeoToken_
 

Detailed Description

Definition at line 17 of file DTSegtoRPC.h.

Constructor & Destructor Documentation

◆ DTSegtoRPC()

DTSegtoRPC::DTSegtoRPC ( edm::ConsumesCollector  iC)
explicit

Definition at line 39 of file DTSegtoRPC.cc.

41  /*
42  MinCosAng=iConfig.getUntrackedParameter<double>("MinCosAng",0.95);
43  MaxD=iConfig.getUntrackedParameter<double>("MaxD",80.);
44  MaxDrb4=iConfig.getUntrackedParameter<double>("MaxDrb4",150.);
45  */
46  incldt = true;
47  incldtMB4 = true;
48 
49  //By now hard coded parameters
50  MinCosAng = 0.85;
51  MaxD = 80.;
52  MaxDrb4 = 150.;
54  /*
55 
56  //These should be always true expect for debuggin porpouses
57  incldt=true;
58  incldtMB4=true;
59  */
60 }

References incldt, incldtMB4, MaxD, MaxDistanceBetweenSegments, MaxDrb4, and MinCosAng.

Member Function Documentation

◆ thePoints()

std::unique_ptr< RPCRecHitCollection > DTSegtoRPC::thePoints ( DTRecSegment4DCollection const *  all4DSegments,
edm::EventSetup const &  iSetup,
bool  debug,
double  eyr 
)

Definition at line 62 of file DTSegtoRPC.cc.

65  {
66  /*
67  struct timespec start_time, stop_time;
68  time_t fs;
69  time_t fn;
70  time_t ls;
71  time_t ln;
72  clock_gettime(CLOCK_REALTIME, &start_time);
73  */
74 
75  auto _ThePoints = std::make_unique<RPCRecHitCollection>();
76  edm::OwnVector<RPCRecHit> RPCPointVector;
77  std::vector<uint32_t> extrapolatedRolls;
78 
79  if (all4DSegments->size() > 8) {
80  if (debug)
81  std::cout << "Too many segments in this event we are not doing the extrapolation" << std::endl;
82  } else {
83  edm::ESHandle<RPCGeometry> rpcGeo = iSetup.getHandle(rpcGeoToken_);
84  edm::ESHandle<DTGeometry> dtGeo = iSetup.getHandle(dtGeoToken_);
85  edm::ESHandle<DTObjectMap> dtMap = iSetup.getHandle(dtMapToken_);
86 
87  /*
88  clock_gettime(CLOCK_REALTIME, &stop_time);
89  fs=start_time.tv_sec;
90  fn=start_time.tv_nsec;
91  ls=stop_time.tv_sec;
92  ln=stop_time.tv_nsec;
93  std::cout <<" =================|| "<<ls-fs<<" sec "<<ln-fn<<" us"<<std::endl;
94  clock_gettime(CLOCK_REALTIME, &start_time);
95  */
96 
97  std::map<DTChamberId, int> DTSegmentCounter;
99 
100  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment) {
101  DTSegmentCounter[segment->chamberId()]++;
102  }
103 
104  /*
105  clock_gettime(CLOCK_REALTIME, &stop_time);
106  fs=start_time.tv_sec;
107  fn=start_time.tv_nsec;
108  ls=stop_time.tv_sec;
109  ln=stop_time.tv_nsec;
110  if(debug) std::cout <<" =================||| "<<ls-fs<<" sec "<<ln-fn<<" us"<<std::endl;
111  clock_gettime(CLOCK_REALTIME, &start_time);
112  */
113 
114  if (incldt) {
115  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment) {
116  DTChamberId DTId = segment->chamberId();
117 
118  if (debug)
119  std::cout << "DT \t \t This Segment is in Chamber id: " << DTId << std::endl;
120  if (debug)
121  std::cout << "DT \t \t Number of segments in this DT = " << DTSegmentCounter[DTId] << std::endl;
122  if (debug)
123  std::cout << "DT \t \t Is the only one in this DT? and is not in the 4th Station?" << std::endl;
124 
125  if (DTSegmentCounter[DTId] != 1 || DTId.station() == 4) {
126  if (debug)
127  std::cout << "DT \t \t More than one segment in this chamber, or we are in Station 4" << std::endl;
128  continue;
129  }
130 
131  int dtWheel = DTId.wheel();
132  int dtStation = DTId.station();
133  int dtSector = DTId.sector();
134 
135  LocalPoint segmentPosition = segment->localPosition();
136  LocalVector segmentDirection = segment->localDirection();
137 
138  const GeomDet* gdet = dtGeo->idToDet(segment->geographicalId());
139  const BoundPlane& DTSurface = gdet->surface();
140 
141  //check if the dimension of the segment is 4
142 
143  if (debug)
144  std::cout << "DT \t \t Is the segment 4D?" << std::endl;
145 
146  if (segment->dimension() != 4) {
147  if (debug)
148  std::cout << "DT \t \t no" << std::endl;
149  continue;
150  }
151 
152  if (debug)
153  std::cout << "DT \t \t yes" << std::endl;
154  if (debug)
155  std::cout << "DT \t \t DT Segment Dimension " << segment->dimension() << std::endl;
156 
157  float Xo = segmentPosition.x();
158  float Yo = segmentPosition.y();
159  float Zo = segmentPosition.z();
160  float dx = segmentDirection.x();
161  float dy = segmentDirection.y();
162  float dz = segmentDirection.z();
163 
164  if (debug)
165  std::cout << "Creating the DTIndex" << std::endl;
166  DTStationIndex theindex(0, dtWheel, dtSector, dtStation);
167  if (debug)
168  std::cout << "Getting the Rolls for the given index" << std::endl;
169  std::set<RPCDetId> rollsForThisDT = dtMap->getRolls(theindex);
170 
171  if (debug)
172  std::cout << "DT \t \t Number of rolls for this DT = " << rollsForThisDT.size() << std::endl;
173 
174  assert(!rollsForThisDT.empty());
175 
176  if (debug)
177  std::cout << "DT \t \t Loop over all the rolls asociated to this DT" << std::endl;
178  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin(); iteraRoll != rollsForThisDT.end();
179  iteraRoll++) {
180  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll);
181  RPCDetId rpcId = rollasociated->id();
182  const BoundPlane& RPCSurface = rollasociated->surface();
183 
184  RPCGeomServ rpcsrv(rpcId);
185  std::string nameRoll = rpcsrv.name();
186 
187  if (debug)
188  std::cout << "DT \t \t \t RollName: " << nameRoll << std::endl;
189  if (debug)
190  std::cout << "DT \t \t \t Doing the extrapolation to this roll" << std::endl;
191  if (debug)
192  std::cout << "DT \t \t \t DT Segment Direction in DTLocal " << segmentDirection << std::endl;
193  if (debug)
194  std::cout << "DT \t \t \t DT Segment Point in DTLocal " << segmentPosition << std::endl;
195 
196  GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0, 0, 0));
197 
198  LocalPoint CenterRollinDTFrame = DTSurface.toLocal(CenterPointRollGlobal);
199 
200  if (debug)
201  std::cout << "DT \t \t \t Center (0,0,0) Roll In DTLocal" << CenterRollinDTFrame << std::endl;
202  if (debug)
203  std::cout << "DT \t \t \t Center (0,0,0) of the Roll in Global" << CenterPointRollGlobal << std::endl;
204 
205  float D = CenterRollinDTFrame.z();
206 
207  float X = Xo + dx * D / dz;
208  float Y = Yo + dy * D / dz;
209  float Z = D;
210 
211  const RectangularStripTopology* top_ =
212  dynamic_cast<const RectangularStripTopology*>(&(rollasociated->topology()));
213  LocalPoint xmin = top_->localPosition(0.);
214  if (debug)
215  std::cout << "DT \t \t \t xmin of this Roll " << xmin << "cm" << std::endl;
216  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
217  if (debug)
218  std::cout << "DT \t \t \t xmax of this Roll " << xmax << "cm" << std::endl;
219  float rsize = fabs(xmax.x() - xmin.x());
220  if (debug)
221  std::cout << "DT \t \t \t Roll Size " << rsize << "cm" << std::endl;
222  float stripl = top_->stripLength();
223 
224  float stripw = top_->pitch();
225 
226  if (debug)
227  std::cout << "DT \t \t \t Strip Lenght " << stripl << "cm" << std::endl;
228  if (debug)
229  std::cout << "DT \t \t \t Strip Width " << stripw << "cm" << std::endl;
230  if (debug)
231  std::cout << "DT \t \t \t X Predicted in DTLocal= " << X << "cm" << std::endl;
232  if (debug)
233  std::cout << "DT \t \t \t Y Predicted in DTLocal= " << Y << "cm" << std::endl;
234  if (debug)
235  std::cout << "DT \t \t \t Z Predicted in DTLocal= " << Z << "cm" << std::endl;
236 
237  float extrapolatedDistance = sqrt((X - Xo) * (X - Xo) + (Y - Yo) * (Y - Yo) + (Z - Zo) * (Z - Zo));
238 
239  if (debug)
240  std::cout << "DT \t \t \t Is the distance of extrapolation less than MaxD? =" << extrapolatedDistance
241  << "cm"
242  << "MaxD=" << MaxD << "cm" << std::endl;
243 
244  if (extrapolatedDistance <= MaxD) {
245  if (debug)
246  std::cout << "DT \t \t \t yes" << std::endl;
247  GlobalPoint GlobalPointExtrapolated = DTSurface.toGlobal(LocalPoint(X, Y, Z));
248  if (debug)
249  std::cout << "DT \t \t \t Point ExtraPolated in Global" << GlobalPointExtrapolated << std::endl;
250  LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
251 
252  if (debug)
253  std::cout << "DT \t \t \t Point Extrapolated in RPCLocal" << PointExtrapolatedRPCFrame << std::endl;
254  if (debug)
255  std::cout << "DT \t \t \t Corner of the Roll = (" << rsize * eyr << "," << stripl * eyr << ")"
256  << std::endl;
257  if (debug)
258  std::cout << "DT \t \t \t Info About the Point Extrapolated in X Abs ("
259  << fabs(PointExtrapolatedRPCFrame.x()) << "," << fabs(PointExtrapolatedRPCFrame.y()) << ","
260  << fabs(PointExtrapolatedRPCFrame.z()) << ")" << std::endl;
261  if (debug)
262  std::cout << "DT \t \t \t Does the extrapolation go inside this roll?" << std::endl;
263 
264  if (fabs(PointExtrapolatedRPCFrame.z()) < 1. && fabs(PointExtrapolatedRPCFrame.x()) < rsize * eyr &&
265  fabs(PointExtrapolatedRPCFrame.y()) < stripl * eyr) {
266  if (debug)
267  std::cout << "DT \t \t \t \t yes" << std::endl;
268  if (debug)
269  std::cout << "DT \t \t \t \t Creating the RecHit" << std::endl;
270  RPCRecHit RPCPoint(rpcId, 0, PointExtrapolatedRPCFrame);
271  if (debug)
272  std::cout << "DT \t \t \t \t Clearing the vector" << std::endl;
273  RPCPointVector.clear();
274  if (debug)
275  std::cout << "DT \t \t \t \t Pushing back" << std::endl;
276  RPCPointVector.push_back(RPCPoint);
277  if (debug)
278  std::cout << "DT \t \t \t \t Putting the vector" << std::endl;
279  _ThePoints->put(rpcId, RPCPointVector.begin(), RPCPointVector.end());
280 
281  if (debug)
282  std::cout << "DT \t \t \t \t Filling container with " << nameRoll
283  << " Point.x=" << PointExtrapolatedRPCFrame.x()
284  << " Point.y=" << PointExtrapolatedRPCFrame.y() << " size=" << RPCPointVector.size()
285  << std::endl;
286 
287  } else {
288  if (debug)
289  std::cout << "DT \t \t \t \t No the prediction is outside of this roll" << std::endl;
290  } //Condition for the right match
291  } else {
292  if (debug)
293  std::cout << "DT \t \t \t No, Exrtrapolation too long!, canceled" << std::endl;
294  } //D so big
295  } //loop over all the rolls asociated
296  }
297  }
298 
299  if (incldtMB4) {
300  if (all4DSegments->size() > 0) {
301  if (debug)
302  std::cout << "MB4 \t \t Loop Over all4DSegments " << all4DSegments->size() << std::endl;
303  extrapolatedRolls.clear();
304  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment) {
305  DTChamberId DTId = segment->chamberId();
306 
307  if (debug)
308  std::cout << "MB4 \t \t This Segment is in Chamber id: " << DTId << std::endl;
309  if (debug)
310  std::cout << "MB4 \t \t Number of segments in this DT = " << DTSegmentCounter[DTId] << std::endl;
311  if (debug)
312  std::cout << "MB4 \t \t \t Is the only one in this DT? and is in the Station 4?" << std::endl;
313 
314  if (DTSegmentCounter[DTId] == 1 && DTId.station() == 4) {
315  if (debug)
316  std::cout << "MB4 \t \t \t yes" << std::endl;
317  int dtWheel = DTId.wheel();
318  int dtStation = DTId.station();
319  int dtSector = DTId.sector();
320 
321  LocalPoint segmentPosition = segment->localPosition();
322  LocalVector segmentDirection = segment->localDirection();
323 
324  if (debug)
325  std::cout << "MB4 \t \t \t \t The Segment in MB4 is 2D?" << std::endl;
326  if (segment->dimension() == 2) {
327  if (debug)
328  std::cout << "MB4 \t \t \t \t yes" << std::endl;
329  const LocalVector& segmentDirectionMB4 = segmentDirection;
330  const LocalPoint& segmentPositionMB4 = segmentPosition;
331 
332  const BoundPlane& DTSurface4 = dtGeo->idToDet(DTId)->surface();
333 
335 
336  if (debug)
337  std::cout << "MB4 \t \t \t \t Loop on segments in =sector && MB3 && adjacent sectors && y dim=4"
338  << std::endl;
339  for (segMB3 = all4DSegments->begin(); segMB3 != all4DSegments->end(); ++segMB3) {
340  DTChamberId dtid3 = segMB3->chamberId();
341 
342  if (debug)
343  std::cout << "MB4 \t \t \t \t Segment in Chamber =" << dtid3 << std::endl;
344 
345  if (distsector(dtid3.sector(), DTId.sector()) <=
346  1 //The DT sector could be 13 or 14 and because is corrected in the calculation of the distance.
347  && distwheel(dtid3.wheel(), DTId.wheel()) <=
348  1 //The we could have segments in neighbohr wheels in pp collisions
349  && dtid3.station() == 3 && DTSegmentCounter[dtid3] == 1 && segMB3->dimension() == 4) {
350  if (debug)
351  std::cout << "MB4 \t \t \t \t distsector =" << distsector(dtid3.sector(), DTId.sector())
352  << std::endl;
353  if (debug)
354  std::cout << "MB4 \t \t \t \t distwheel =" << distwheel(dtid3.wheel(), DTId.wheel()) << std::endl;
355 
356  const GeomDet* gdet3 = dtGeo->idToDet(segMB3->geographicalId());
357  const BoundPlane& DTSurface3 = gdet3->surface();
358 
359  LocalVector segmentDirectionMB3 = segMB3->localDirection();
360  GlobalPoint segmentPositionMB3inGlobal = DTSurface3.toGlobal(segMB3->localPosition());
361  GlobalPoint segmentPositionMB4inGlobal = DTSurface4.toGlobal(segmentPosition);
362 
363  //LocalVector segDirMB4inMB3Frame=DTSurface3.toLocal(DTSurface4.toGlobal(segmentDirectionMB4));
364  LocalVector segDirMB3inMB4Frame = DTSurface4.toLocal(DTSurface3.toGlobal(segmentDirectionMB3));
365 
366  GlobalVector segDirMB4inGlobalFrame = DTSurface4.toGlobal(segmentDirectionMB4);
367  GlobalVector segDirMB3inGlobalFrame = DTSurface3.toGlobal(segmentDirectionMB3);
368 
369  float dx = segDirMB4inGlobalFrame.x();
370  float dy = segDirMB4inGlobalFrame.y();
371 
372  float dx3 = segDirMB3inGlobalFrame.x();
373  float dy3 = segDirMB3inGlobalFrame.y();
374 
375  double cosAng = fabs(dx * dx3 + dy * dy3 / sqrt((dx3 * dx3 + dy3 * dy3) * (dx * dx + dy * dy)));
376 
377  if (debug)
378  std::cout << "MB4 \t \t \t \t cosAng" << cosAng << "Beetween " << dtid3 << " and " << DTId
379  << std::endl;
380 
381  if (debug) {
382  std::cout << "MB4 \t \t \t \t dx=" << dx << " dy=" << dy << std::endl;
383  std::cout << "MB4 \t \t \t \t dx3=" << dx3 << " dy3=" << dy << std::endl;
384  std::cout << "MB4 \t \t \t \t cosAng=" << cosAng << std::endl;
385  }
386 
387  float DistanceBetweenSegments = ((segmentPositionMB3inGlobal) - (segmentPositionMB4inGlobal)).mag();
388 
389  if (cosAng > MinCosAng && DistanceBetweenSegments < MaxDistanceBetweenSegments) {
390  if (debug)
391  std::cout << "MB4 \t \t \t \t Distance between segments=" << DistanceBetweenSegments << std::endl;
392 
393  if (debug)
394  std::cout << "MB4 \t \t We found compatible Segments (similar direction and close enough) in "
395  << dtid3 << " and " << DTId << std::endl;
396 
397  if (dtSector == 13) {
398  dtSector = 4;
399  }
400  if (dtSector == 14) {
401  dtSector = 10;
402  }
403 
404  if (debug)
405  std::cout << "Creating the DTIndex" << std::endl;
406  DTStationIndex theindex(0, dtWheel, dtSector, dtStation);
407  if (debug)
408  std::cout << "Getting the Rolls for the given index" << std::endl;
409  std::set<RPCDetId> rollsForThisDT = dtMap->getRolls(theindex);
410 
411  if (debug)
412  std::cout << "MB4 \t \t Number of rolls for this DT = " << rollsForThisDT.size() << std::endl;
413 
414  assert(!rollsForThisDT.empty());
415 
416  if (debug)
417  std::cout << "MB4 \t \t Loop over all the rolls asociated to this DT" << std::endl;
418  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin();
419  iteraRoll != rollsForThisDT.end();
420  iteraRoll++) {
421  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); //roll asociado a MB4
422  RPCDetId rpcId = rollasociated->id();
423  const BoundPlane& RPCSurfaceRB4 = rollasociated->surface(); //surface MB4
424 
425  RPCGeomServ rpcsrv(rpcId);
426  std::string nameRoll = rpcsrv.name();
427 
428  if (debug)
429  std::cout << "MB4 \t \t \t RollName: " << nameRoll << std::endl;
430  if (debug)
431  std::cout << "MB4 \t \t \t Doing the extrapolation to this roll" << std::endl;
432 
433  GlobalPoint CenterPointRollGlobal = RPCSurfaceRB4.toGlobal(LocalPoint(0, 0, 0));
434  LocalPoint CenterRollinMB4Frame = DTSurface4.toLocal(CenterPointRollGlobal); //In MB4
435  LocalPoint segmentPositionMB3inMB4Frame =
436  DTSurface4.toLocal(segmentPositionMB3inGlobal); //In MB4
437  //LocalPoint segmentPositionMB3inRB4Frame = RPCSurfaceRB4.toLocal(segmentPositionMB3inGlobal); //In MB4
438  LocalVector segmentDirectionMB3inMB4Frame = DTSurface4.toLocal(segDirMB3inGlobalFrame); //In MB4
439 
440  //The exptrapolation is done in MB4 frame. for local x and z is done from MB4,
441  float Dxz = CenterRollinMB4Frame.z();
442  float Xo4 = segmentPositionMB4.x();
443  float dxl = segmentDirectionMB4.x(); //dx local for MB4 segment in MB4 Frame
444  float dzl = segmentDirectionMB4.z(); //dx local for MB4 segment in MB4 Frame
445 
446  float X = Xo4 + dxl * Dxz / dzl; //In MB4 frame
447  float Z = Dxz; //In MB4 frame
448 
449  //for local y is done from MB3
450  float Yo34 = segmentPositionMB3inMB4Frame.y();
451  float dy34 = segmentDirectionMB3inMB4Frame.y();
452  float dz34 = segmentDirectionMB3inMB4Frame.z();
453  float Dy =
454  Dxz -
455  (segmentPositionMB3inMB4Frame.z()); //Distance beetween the segment in MB3 and the RB4 surface
456 
457  if (debug)
458  std::cout << "MB4 \t \t \t The distance to extrapolate in Y from MB3 is " << Dy << "cm"
459  << std::endl;
460 
461  float Y = Yo34 + dy34 * Dy / dz34; //In MB4 Frame
462 
463  const RectangularStripTopology* top_ = dynamic_cast<const RectangularStripTopology*>(
464  &(rollasociated->topology())); //Topology roll asociated MB4
465  LocalPoint xmin = top_->localPosition(0.);
466  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
467  float rsize = fabs(xmax.x() - xmin.x());
468  float stripl = top_->stripLength();
469  float stripw = top_->pitch();
470 
471  if (debug)
472  std::cout << "MB4 \t \t \t Strip Lenght " << stripl << "cm" << std::endl;
473  if (debug)
474  std::cout << "MB4 \t \t \t Strip Width " << stripw << "cm" << std::endl;
475 
476  if (debug)
477  std::cout << "MB4 \t \t \t X Predicted in MB4DTLocal= " << X << "cm" << std::endl;
478  if (debug)
479  std::cout << "MB4 \t \t \t Y Predicted in MB4DTLocal= " << Y << "cm" << std::endl;
480  if (debug)
481  std::cout << "MB4 \t \t \t Z Predicted in MB4DTLocal= " << Z << "cm" << std::endl;
482 
483  float extrapolatedDistance = sqrt((Y - Yo34) * (Y - Yo34) + Dy * Dy);
484 
485  if (debug)
486  std::cout << "MB4 \t \t \t segmentPositionMB3inMB4Frame" << segmentPositionMB3inMB4Frame
487  << std::endl;
488  if (debug)
489  std::cout << "MB4 \t \t \t segmentPositionMB4inMB4Frame" << segmentPosition << std::endl;
490 
491  if (debug)
492  std::cout << "MB4 \t \t \t segmentDirMB3inMB4Frame" << segDirMB3inMB4Frame << std::endl;
493  if (debug)
494  std::cout << "MB4 \t \t \t segmentDirMB4inMB4Frame" << segmentDirectionMB4 << std::endl;
495 
496  if (debug)
497  std::cout << "MB4 \t \t \t CenterRB4PositioninMB4Frame" << CenterRollinMB4Frame << std::endl;
498 
499  if (debug)
500  std::cout << "MB4 \t \t \t Is the extrapolation distance =" << extrapolatedDistance
501  << "less than " << MaxDrb4 << std::endl;
502 
503  if (extrapolatedDistance <= MaxDrb4) {
504  if (debug)
505  std::cout << "MB4 \t \t \t yes" << std::endl;
506 
507  GlobalPoint GlobalPointExtrapolated = DTSurface4.toGlobal(LocalPoint(X, Y, Z));
508 
509  if (debug)
510  std::cout << "MB4 \t \t \t Point ExtraPolated in Global" << GlobalPointExtrapolated
511  << std::endl;
512 
513  LocalPoint PointExtrapolatedRPCFrame = RPCSurfaceRB4.toLocal(GlobalPointExtrapolated);
514 
515  if (debug)
516  std::cout << "MB4 \t \t \t Point Extrapolated in RPCLocal" << PointExtrapolatedRPCFrame
517  << std::endl;
518  if (debug)
519  std::cout << "MB4 \t \t \t Corner of the Roll = (" << rsize * eyr << "," << stripl * eyr
520  << ")" << std::endl;
521  if (debug)
522  std::cout << "MB4 \t \t \t Info About the Point Extrapolated in X Abs ("
523  << fabs(PointExtrapolatedRPCFrame.x()) << "," << fabs(PointExtrapolatedRPCFrame.y())
524  << "," << fabs(PointExtrapolatedRPCFrame.z()) << ")" << std::endl;
525 
526  if (debug)
527  std::cout << "MB4 \t \t \t Does the extrapolation go inside this roll?" << std::endl;
528 
529  if (fabs(PointExtrapolatedRPCFrame.z()) < 5. &&
530  fabs(PointExtrapolatedRPCFrame.x()) < rsize * eyr &&
531  fabs(PointExtrapolatedRPCFrame.y()) < stripl * eyr) {
532  if (debug)
533  std::cout << "MB4 \t \t \t \t yes" << std::endl;
534  if (debug)
535  std::cout << "MB4 \t \t \t \t Creating the RecHit" << std::endl;
536  RPCRecHit RPCPointMB4(rpcId, 0, PointExtrapolatedRPCFrame);
537  if (debug)
538  std::cout << "MB4 \t \t \t \t Clearing the RPCPointVector" << std::endl;
539  RPCPointVector.clear();
540  if (debug)
541  std::cout << "MB4 \t \t \t \t Pushing Back" << std::endl;
542  RPCPointVector.push_back(RPCPointMB4);
543  if (debug)
544  std::cout << "MB4 \t \t \t \t Putting for " << rpcId << std::endl;
545  if (debug)
546  std::cout << "MB4 \t \t \t \t Filling container with " << nameRoll
547  << " Point.x=" << PointExtrapolatedRPCFrame.x()
548  << " Point.y=" << PointExtrapolatedRPCFrame.y()
549  << " size=" << RPCPointVector.size() << std::endl;
550  if (debug)
551  std::cout << "MB4 \t \t \t \t Number of rolls already extrapolated in RB4 = "
552  << extrapolatedRolls.size() << std::endl;
553  if (find(extrapolatedRolls.begin(), extrapolatedRolls.end(), rpcId.rawId()) ==
554  extrapolatedRolls.end()) {
555  extrapolatedRolls.push_back(rpcId.rawId());
556  _ThePoints->put(rpcId, RPCPointVector.begin(), RPCPointVector.end());
557  } else {
558  if (debug)
559  std::cout << "MB4 \t \t \t \t roll already extrapolated " << rpcId << std::endl;
560  }
561  if (debug)
562  std::cout << "MB4 \t \t \t \t Extrapolations done after this point = "
563  << extrapolatedRolls.size() << std::endl;
564  if (debug)
565  for (uint32_t m = 0; m < extrapolatedRolls.size(); m++)
566  std::cout << "MB4 \t \t \t \t" << extrapolatedRolls.at(m) << std::endl;
567  } else {
568  if (debug)
569  std::cout << "MB4 \t \t \t \t No the prediction is outside of this roll" << std::endl;
570  }
571  } //Condition for the right match
572  else {
573  if (debug)
574  std::cout << "MB4 \t \t \t No, Exrtrapolation too long!, canceled" << std::endl;
575  }
576  } //loop over all the rollsasociated
577  } else {
578  if (debug)
579  std::cout << "MB4 \t \t \t \t I found segments in MB4 and MB3 adjacent wheel and/or sector but "
580  "not compatibles, Diferent Directions"
581  << std::endl;
582  }
583  } else { //if dtid3.station()==3&&dtid3.sector()==DTId.sector()&&dtid3.wheel()==DTId.wheel()&&segMB3->dim()==4
584  if (debug)
585  std::cout << "MB4 \t \t \t No the same station or same wheel or segment dim in mb3 not 4D"
586  << std::endl;
587  }
588  } //loop over all the segments looking for one in MB3
589  } else {
590  if (debug)
591  std::cout << "MB4 \t \t \t Is NOT a 2D Segment" << std::endl;
592  }
593  } else {
594  if (debug)
595  std::cout << "MB4 \t \t \t \t There is not just one segment or is not in station 4" << std::endl;
596  } //De aca para abajo esta en dtpart.inl
597  }
598  } else {
599  if (debug)
600  std::cout << "MB4 \t This event doesn't have 4D Segment" << std::endl;
601  }
602  }
603  }
604 
605  /*
606  clock_gettime(CLOCK_REALTIME, &stop_time);
607  fs=start_time.tv_sec;
608  fn=start_time.tv_nsec;
609  ls=stop_time.tv_sec;
610  ln=stop_time.tv_nsec;
611  std::cout <<" =================|||| "<<ls-fs<<" sec "<<ln-fn<<" us"<<std::endl;
612  */
613 
614  return _ThePoints;
615 }

References cms::cuda::assert(), edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::clear(), gather_cfg::cout, debug, distsector(), distwheel(), dtGeoToken_, dtMapToken_, PVValHelper::dx, PVValHelper::dy, PixelTestBeamValidation_cfi::Dy, PVValHelper::dz, edm::OwnVector< T, P >::end(), spr::find(), edm::EventSetup::getHandle(), DTObjectMap::getRolls(), RPCRoll::id(), DTGeometry::idToDet(), incldt, incldtMB4, RectangularStripTopology::localPosition(), visualization-live-secondInstance_cfg::m, mag(), MaxD, MaxDistanceBetweenSegments, MaxDrb4, MinCosAng, RPCGeomServ::name(), RPCRoll::nstrips(), RectangularStripTopology::pitch(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), RPCGeometry::roll(), rpcGeoToken_, DTChamberId::sector(), edm::OwnVector< T, P >::size(), mathSSE::sqrt(), DTChamberId::station(), AlCaHLTBitMon_QueryRunRegistry::string, RectangularStripTopology::stripLength(), GeomDet::surface(), RPCRoll::topology(), DTChamberId::wheel(), X, PV3DBase< T, PVType, FrameType >::x(), TrackerOfflineValidation_Dqm_cff::xmax, TrackerOfflineValidation_Dqm_cff::xmin, BeamSpotPI::Y, PV3DBase< T, PVType, FrameType >::y(), BeamSpotPI::Z, and PV3DBase< T, PVType, FrameType >::z().

Member Data Documentation

◆ dtGeoToken_

edm::ESGetToken<DTGeometry, MuonGeometryRecord> DTSegtoRPC::dtGeoToken_
private

Definition at line 27 of file DTSegtoRPC.h.

Referenced by thePoints().

◆ dtMapToken_

edm::ESGetToken<DTObjectMap, MuonGeometryRecord> DTSegtoRPC::dtMapToken_
private

Definition at line 28 of file DTSegtoRPC.h.

Referenced by thePoints().

◆ incldt

bool DTSegtoRPC::incldt
private

Definition at line 30 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ incldtMB4

bool DTSegtoRPC::incldtMB4
private

Definition at line 31 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ MaxD

double DTSegtoRPC::MaxD
private

Definition at line 33 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ MaxDistanceBetweenSegments

double DTSegtoRPC::MaxDistanceBetweenSegments
private

Definition at line 35 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ MaxDrb4

double DTSegtoRPC::MaxDrb4
private

Definition at line 34 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ MinCosAng

double DTSegtoRPC::MinCosAng
private

Definition at line 32 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ rpcGeoToken_

edm::ESGetToken<RPCGeometry, MuonGeometryRecord> DTSegtoRPC::rpcGeoToken_
private

Definition at line 26 of file DTSegtoRPC.h.

Referenced by thePoints().

Vector3DBase< float, LocalTag >
RPCRoll
Definition: RPCRoll.h:12
DTSegtoRPC::dtGeoToken_
edm::ESGetToken< DTGeometry, MuonGeometryRecord > dtGeoToken_
Definition: DTSegtoRPC.h:27
RPCGeomServ
Definition: RPCGeomServ.h:8
GeomDet
Definition: GeomDet.h:27
edm::OwnVector::end
iterator end()
Definition: OwnVector.h:285
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
X
#define X(str)
Definition: MuonsGrabber.cc:38
DTSegtoRPC::rpcGeoToken_
edm::ESGetToken< RPCGeometry, MuonGeometryRecord > rpcGeoToken_
Definition: DTSegtoRPC.h:26
RPCDetId
Definition: RPCDetId.h:16
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
distwheel
int distwheel(int wheel1, int wheel2)
Definition: DTSegtoRPC.cc:34
DTSegtoRPC::MaxDrb4
double MaxDrb4
Definition: DTSegtoRPC.h:34
RPCGeometry::roll
const RPCRoll * roll(RPCDetId id) const
Return a roll given its id.
Definition: RPCGeometry.cc:50
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
PixelTestBeamValidation_cfi.Dy
Dy
Definition: PixelTestBeamValidation_cfi.py:103
DTSegtoRPC::incldtMB4
bool incldtMB4
Definition: DTSegtoRPC.h:31
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
DTStationIndex
Definition: DTStationIndex.h:4
RectangularStripTopology::localPosition
LocalPoint localPosition(float strip) const override
Definition: RectangularStripTopology.cc:17
RPCRoll::topology
const Topology & topology() const override
Definition: RPCRoll.cc:18
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
RPCRoll::id
RPCDetId id() const
Definition: RPCRoll.cc:16
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
debug
#define debug
Definition: HDRShower.cc:19
DTObjectMap::getRolls
std::set< RPCDetId > const & getRolls(DTStationIndex index) const
Definition: DTObjectMap.cc:36
RectangularStripTopology
Definition: RectangularStripTopology.h:11
DTSegtoRPC::incldt
bool incldt
Definition: DTSegtoRPC.h:30
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:72
RPCRecHit
Definition: RPCRecHit.h:14
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
edm::ESHandle< RPCGeometry >
DTSegtoRPC::MinCosAng
double MinCosAng
Definition: DTSegtoRPC.h:32
Point3DBase< float, LocalTag >
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
RectangularStripTopology::stripLength
float stripLength() const override
Definition: RectangularStripTopology.h:44
edm::RangeMap::const_iterator
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
DTSegtoRPC::MaxDistanceBetweenSegments
double MaxDistanceBetweenSegments
Definition: DTSegtoRPC.h:35
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
DTSegtoRPC::dtMapToken_
edm::ESGetToken< DTObjectMap, MuonGeometryRecord > dtMapToken_
Definition: DTSegtoRPC.h:28
RPCRoll::nstrips
int nstrips() const
Definition: RPCRoll.cc:24
PVValHelper::dy
Definition: PVValidationHelpers.h:50
RectangularStripTopology::pitch
float pitch() const override
Definition: RectangularStripTopology.h:36
mag
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
Definition: Basic3DVectorLD.h:127
funct::D
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:141
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
PVValHelper::dz
Definition: PVValidationHelpers.h:51
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
DTSegtoRPC::MaxD
double MaxD
Definition: DTSegtoRPC.h:33
BoundPlane
BeamSpotPI::Y
Definition: BeamSpotPayloadInspectorHelper.h:32
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
DTChamberId
Definition: DTChamberId.h:14
BeamSpotPI::Z
Definition: BeamSpotPayloadInspectorHelper.h:33
distsector
int distsector(int sector1, int sector2)
Definition: DTSegtoRPC.cc:17
TrackerOfflineValidation_Dqm_cff.xmin
xmin
Definition: TrackerOfflineValidation_Dqm_cff.py:10
edm::OwnVector::begin
iterator begin()
Definition: OwnVector.h:280
DTGeometry::idToDet
const GeomDet * idToDet(DetId) const override
Definition: DTGeometry.cc:77
edm::OwnVector::size
size_type size() const
Definition: OwnVector.h:300
edm::OwnVector::clear
void clear()
Definition: OwnVector.h:481
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
PVValHelper::dx
Definition: PVValidationHelpers.h:49
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
edm::OwnVector
Definition: OwnVector.h:24