CMS 3D CMS Logo

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

#include <DTSegtoRPC.h>

Public Member Functions

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

Private Attributes

std::unique_ptr< RPCRecHitCollection_ThePoints
 
std::vector< uint32_t > extrapolatedRolls
 
bool incldt
 
bool incldtMB4
 
double MaxD
 
double MaxDistanceBetweenSegments
 
double MaxDrb4
 
double MinCosAng
 
edm::OwnVector< RPCRecHitRPCPointVector
 

Detailed Description

Definition at line 13 of file DTSegtoRPC.h.

Constructor & Destructor Documentation

◆ DTSegtoRPC()

DTSegtoRPC::DTSegtoRPC ( DTRecSegment4DCollection const *  all4DSegments,
edm::EventSetup const &  iSetup,
bool  debug,
double  eyr 
)

Definition at line 39 of file DTSegtoRPC.cc.

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

References _ThePoints, cms::cuda::assert(), edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::clear(), gather_cfg::cout, debug, distsector(), distwheel(), PVValHelper::dx, PVValHelper::dy, PixelTestBeamValidation_cfi::Dy, PVValHelper::dz, edm::OwnVector< T, P >::end(), extrapolatedRolls, spr::find(), edm::EventSetup::get(), get, 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(), RPCPointVector, 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, DOFs::Y, PV3DBase< T, PVType, FrameType >::y(), DOFs::Z, and PV3DBase< T, PVType, FrameType >::z().

◆ ~DTSegtoRPC()

DTSegtoRPC::~DTSegtoRPC ( )

Definition at line 613 of file DTSegtoRPC.cc.

613 {}

Member Function Documentation

◆ thePoints()

std::unique_ptr<RPCRecHitCollection>&& DTSegtoRPC::thePoints ( )
inline

Definition at line 17 of file DTSegtoRPC.h.

17 { return std::move(_ThePoints); }

References _ThePoints, and eostools::move().

Member Data Documentation

◆ _ThePoints

std::unique_ptr<RPCRecHitCollection> DTSegtoRPC::_ThePoints
private

Definition at line 20 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

◆ extrapolatedRolls

std::vector<uint32_t> DTSegtoRPC::extrapolatedRolls
private

Definition at line 28 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ incldt

bool DTSegtoRPC::incldt
private

Definition at line 22 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ incldtMB4

bool DTSegtoRPC::incldtMB4
private

Definition at line 23 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ MaxD

double DTSegtoRPC::MaxD
private

Definition at line 25 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ MaxDistanceBetweenSegments

double DTSegtoRPC::MaxDistanceBetweenSegments
private

Definition at line 27 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ MaxDrb4

double DTSegtoRPC::MaxDrb4
private

Definition at line 26 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ MinCosAng

double DTSegtoRPC::MinCosAng
private

Definition at line 24 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

◆ RPCPointVector

edm::OwnVector<RPCRecHit> DTSegtoRPC::RPCPointVector
private

Definition at line 21 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

Vector3DBase< float, LocalTag >
DTSegtoRPC::_ThePoints
std::unique_ptr< RPCRecHitCollection > _ThePoints
Definition: DTSegtoRPC.h:20
RPCRoll
Definition: RPCRoll.h:12
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
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:26
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:90
DTSegtoRPC::incldtMB4
bool incldtMB4
Definition: DTSegtoRPC.h:23
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
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:22
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:24
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:27
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
RPCRoll::nstrips
int nstrips() const
Definition: RPCRoll.cc:24
DOFs::Z
Definition: AlignPCLThresholdsWriter.cc:37
PVValHelper::dy
Definition: PVValidationHelpers.h:49
get
#define get
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
DTSegtoRPC::RPCPointVector
edm::OwnVector< RPCRecHit > RPCPointVector
Definition: DTSegtoRPC.h:21
DTChamberId::sector
int sector() const
Definition: DTChamberId.h:49
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
DOFs::Y
Definition: AlignPCLThresholdsWriter.cc:37
PVValHelper::dz
Definition: PVValidationHelpers.h:50
TrackerOfflineValidation_Dqm_cff.xmax
xmax
Definition: TrackerOfflineValidation_Dqm_cff.py:11
DTSegtoRPC::MaxD
double MaxD
Definition: DTSegtoRPC.h:25
BoundPlane
edm::OwnVector::push_back
void push_back(D *&d)
Definition: OwnVector.h:326
DTChamberId
Definition: DTChamberId.h:14
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
MuonGeometryRecord
Definition: MuonGeometryRecord.h:34
DTChamberId::wheel
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:39
PVValHelper::dx
Definition: PVValidationHelpers.h:48
DTChamberId::station
int station() const
Return the station number.
Definition: DTChamberId.h:42
DTSegtoRPC::extrapolatedRolls
std::vector< uint32_t > extrapolatedRolls
Definition: DTSegtoRPC.h:28