CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
DTSegtoRPC Class Reference

#include <DTSegtoRPC.h>

Public Member Functions

 DTSegtoRPC (edm::Handle< DTRecSegment4DCollection > all4DSegments, const edm::EventSetup &iSetup, const edm::Event &iEvent, bool debug, double eyr)
 
RPCRecHitCollectionthePoints ()
 
 ~DTSegtoRPC ()
 

Private Attributes

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 10 of file DTSegtoRPC.h.

Constructor & Destructor Documentation

DTSegtoRPC::DTSegtoRPC ( edm::Handle< DTRecSegment4DCollection all4DSegments,
const edm::EventSetup iSetup,
const edm::Event iEvent,
bool  debug,
double  eyr 
)
explicit

Definition at line 70 of file DTSegtoRPC.cc.

References _ThePoints, edm::OwnVector< T, P >::begin(), edm::OwnVector< T, P >::clear(), gather_cfg::cout, distsector(), distwheel(), edm::OwnVector< T, P >::end(), extrapolatedRolls, spr::find(), edm::EventSetup::get(), ObjectMap::GetInstance(), ObjectMap::GetRolls(), RPCRoll::id(), incldt, incldtMB4, RectangularStripTopology::localPosition(), m, mag(), MaxD, MaxDistanceBetweenSegments, MaxDrb4, MinCosAng, RPCGeomServ::name(), RPCRoll::nstrips(), RectangularStripTopology::pitch(), edm::OwnVector< T, P >::push_back(), DetId::rawId(), RPCPointVector, DTChamberId::sector(), edm::OwnVector< T, P >::size(), mathSSE::sqrt(), DTChamberId::station(), RectangularStripTopology::stripLength(), GeomDet::surface(), Surface::toGlobal(), GloballyPositioned< T >::toLocal(), RPCRoll::topology(), DTChamberId::wheel(), X, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), Gflash::Z, and PV3DBase< T, PVType, FrameType >::z().

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

Definition at line 537 of file DTSegtoRPC.cc.

537  {
538 }

Member Function Documentation

RPCRecHitCollection* DTSegtoRPC::thePoints ( )
inline

Definition at line 14 of file DTSegtoRPC.h.

References _ThePoints.

Referenced by RPCPointProducer::produce().

14 {return _ThePoints;}
RPCRecHitCollection * _ThePoints
Definition: DTSegtoRPC.h:17

Member Data Documentation

RPCRecHitCollection* DTSegtoRPC::_ThePoints
private

Definition at line 17 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC(), and thePoints().

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

Definition at line 25 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

bool DTSegtoRPC::incldt
private

Definition at line 19 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

bool DTSegtoRPC::incldtMB4
private

Definition at line 20 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

double DTSegtoRPC::MaxD
private

Definition at line 22 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

double DTSegtoRPC::MaxDistanceBetweenSegments
private

Definition at line 24 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

double DTSegtoRPC::MaxDrb4
private

Definition at line 23 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

double DTSegtoRPC::MinCosAng
private

Definition at line 21 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().

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

Definition at line 18 of file DTSegtoRPC.h.

Referenced by DTSegtoRPC().