CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCEfficiency.cc
Go to the documentation of this file.
1 /***************************************
2 Author:
3 Camilo Carrillo
4 Universidad de los Andes Bogota Colombia
5 camilo.carrilloATcern.ch
6 ****************************************/
7 
9 
10 #include <memory>
22 
23 #include <cmath>
24 #include "TFile.h"
25 #include "TH1F.h"
26 #include "TH2F.h"
27 #include "TCanvas.h"
28 #include "TAxis.h"
29 #include "TString.h"
30 
32 
33 }
34 
35 int distsector(int sector1,int sector2){
36 
37  if(sector1==13) sector1=4;
38  if(sector1==14) sector1=10;
39 
40  if(sector2==13) sector2=4;
41  if(sector2==14) sector2=10;
42 
43  int distance = abs(sector1 - sector2);
44  if(distance>6) distance = 12-distance;
45  return distance;
46 }
47 
48 
50  incldt=iConfig.getUntrackedParameter<bool>("incldt",true);
51  incldtMB4=iConfig.getUntrackedParameter<bool>("incldtMB4",true);
52  inclcsc=iConfig.getUntrackedParameter<bool>("inclcsc",true);
53  debug=iConfig.getUntrackedParameter<bool>("debug",false);
54 
55  rangestrips = iConfig.getUntrackedParameter<double>("rangestrips",4.);
56  rangestripsRB4=iConfig.getUntrackedParameter<double>("rangestripsRB4",4.);
57  dupli = iConfig.getUntrackedParameter<int>("DuplicationCorrection",2);
58  MinCosAng=iConfig.getUntrackedParameter<double>("MinCosAng",0.96);
59  MaxD=iConfig.getUntrackedParameter<double>("MaxD",80.);
60  MaxDrb4=iConfig.getUntrackedParameter<double>("MaxDrb4",150.);
61  muonRPCDigis=iConfig.getUntrackedParameter<std::string>("muonRPCDigis","muonRPCDigis");
62  RPCRecHitLabel_ = iConfig.getParameter<edm::InputTag>("RecHitLabel");
63  cscSegments=iConfig.getUntrackedParameter<std::string>("cscSegments","cscSegments");
64  dt4DSegments=iConfig.getUntrackedParameter<std::string>("dt4DSegments","dt4DSegments");
65 
66  folderPath=iConfig.getUntrackedParameter<std::string>("folderPath","RPC/RPCEfficiency/");
67 
68  nameInLog = iConfig.getUntrackedParameter<std::string>("moduleLogName", "RPC_Eff");
69  EffSaveRootFile = iConfig.getUntrackedParameter<bool>("EffSaveRootFile", false);
70  EffRootFileName = iConfig.getUntrackedParameter<std::string>("EffRootFileName", "RPCEfficiency.root");
71 
72  //Interface
73 
75 
76  std::string folder = folderPath+"MuonSegEff";
77  dbe->setCurrentFolder(folder);
78  statistics = dbe->book1D("Statistics","All Statistics",33,0.5,33.5);
79 
80  if(debug) std::cout<<"booking Global histograms with "<<folderPath<<std::endl;
81 
82  folder = folderPath+"MuonSegEff/"+"Residuals/Barrel";
83  dbe->setCurrentFolder(folder);
84 
85  //Barrel
86  hGlobalResClu1La1 = dbe->book1D("GlobalResidualsClu1La1","RPC Residuals Layer 1 Cluster Size 1",101,-10.,10.);
87  hGlobalResClu1La2 = dbe->book1D("GlobalResidualsClu1La2","RPC Residuals Layer 2 Cluster Size 1",101,-10.,10.);
88  hGlobalResClu1La3 = dbe->book1D("GlobalResidualsClu1La3","RPC Residuals Layer 3 Cluster Size 1",101,-10.,10.);
89  hGlobalResClu1La4 = dbe->book1D("GlobalResidualsClu1La4","RPC Residuals Layer 4 Cluster Size 1",101,-10.,10.);
90  hGlobalResClu1La5 = dbe->book1D("GlobalResidualsClu1La5","RPC Residuals Layer 5 Cluster Size 1",101,-10.,10.);
91  hGlobalResClu1La6 = dbe->book1D("GlobalResidualsClu1La6","RPC Residuals Layer 6 Cluster Size 1",101,-10.,10.);
92 
93  hGlobalResClu2La1 = dbe->book1D("GlobalResidualsClu2La1","RPC Residuals Layer 1 Cluster Size 2",101,-10.,10.);
94  hGlobalResClu2La2 = dbe->book1D("GlobalResidualsClu2La2","RPC Residuals Layer 2 Cluster Size 2",101,-10.,10.);
95  hGlobalResClu2La3 = dbe->book1D("GlobalResidualsClu2La3","RPC Residuals Layer 3 Cluster Size 2",101,-10.,10.);
96  hGlobalResClu2La4 = dbe->book1D("GlobalResidualsClu2La4","RPC Residuals Layer 4 Cluster Size 2",101,-10.,10.);
97  hGlobalResClu2La5 = dbe->book1D("GlobalResidualsClu2La5","RPC Residuals Layer 5 Cluster Size 2",101,-10.,10.);
98  hGlobalResClu2La6 = dbe->book1D("GlobalResidualsClu2La6","RPC Residuals Layer 6 Cluster Size 2",101,-10.,10.);
99 
100  hGlobalResClu3La1 = dbe->book1D("GlobalResidualsClu3La1","RPC Residuals Layer 1 Cluster Size 3",101,-10.,10.);
101  hGlobalResClu3La2 = dbe->book1D("GlobalResidualsClu3La2","RPC Residuals Layer 2 Cluster Size 3",101,-10.,10.);
102  hGlobalResClu3La3 = dbe->book1D("GlobalResidualsClu3La3","RPC Residuals Layer 3 Cluster Size 3",101,-10.,10.);
103  hGlobalResClu3La4 = dbe->book1D("GlobalResidualsClu3La4","RPC Residuals Layer 4 Cluster Size 3",101,-10.,10.);
104  hGlobalResClu3La5 = dbe->book1D("GlobalResidualsClu3La5","RPC Residuals Layer 5 Cluster Size 3",101,-10.,10.);
105  hGlobalResClu3La6 = dbe->book1D("GlobalResidualsClu3La6","RPC Residuals Layer 6 Cluster Size 3",101,-10.,10.);
106 
107  if(debug) std::cout<<"Booking Residuals for EndCap"<<std::endl;
108  folder = folderPath+"MuonSegEff/Residuals/EndCap";
109  dbe->setCurrentFolder(folder);
110 
111  //Endcap
112  hGlobalResClu1R3C = dbe->book1D("GlobalResidualsClu1R3C","RPC Residuals Ring 3 Roll C Cluster Size 1",101,-10.,10.);
113  hGlobalResClu1R3B = dbe->book1D("GlobalResidualsClu1R3B","RPC Residuals Ring 3 Roll B Cluster Size 1",101,-10.,10.);
114  hGlobalResClu1R3A = dbe->book1D("GlobalResidualsClu1R3A","RPC Residuals Ring 3 Roll A Cluster Size 1",101,-10.,10.);
115  hGlobalResClu1R2C = dbe->book1D("GlobalResidualsClu1R2C","RPC Residuals Ring 2 Roll C Cluster Size 1",101,-10.,10.);
116  hGlobalResClu1R2B = dbe->book1D("GlobalResidualsClu1R2B","RPC Residuals Ring 2 Roll B Cluster Size 1",101,-10.,10.);
117  hGlobalResClu1R2A = dbe->book1D("GlobalResidualsClu1R2A","RPC Residuals Ring 2 Roll A Cluster Size 1",101,-10.,10.);
118 
119  hGlobalResClu2R3C = dbe->book1D("GlobalResidualsClu2R3C","RPC Residuals Ring 3 Roll C Cluster Size 2",101,-10.,10.);
120  hGlobalResClu2R3B = dbe->book1D("GlobalResidualsClu2R3B","RPC Residuals Ring 3 Roll B Cluster Size 2",101,-10.,10.);
121  hGlobalResClu2R3A = dbe->book1D("GlobalResidualsClu2R3A","RPC Residuals Ring 3 Roll A Cluster Size 2",101,-10.,10.);
122  hGlobalResClu2R2C = dbe->book1D("GlobalResidualsClu2R2C","RPC Residuals Ring 2 Roll C Cluster Size 2",101,-10.,10.);
123  hGlobalResClu2R2B = dbe->book1D("GlobalResidualsClu2R2B","RPC Residuals Ring 2 Roll B Cluster Size 2",101,-10.,10.);
124  hGlobalResClu2R2A = dbe->book1D("GlobalResidualsClu2R2A","RPC Residuals Ring 2 Roll A Cluster Size 2",101,-10.,10.);
125 
126  hGlobalResClu3R3C = dbe->book1D("GlobalResidualsClu3R3C","RPC Residuals Ring 3 Roll C Cluster Size 3",101,-10.,10.);
127  hGlobalResClu3R3B = dbe->book1D("GlobalResidualsClu3R3B","RPC Residuals Ring 3 Roll B Cluster Size 3",101,-10.,10.);
128  hGlobalResClu3R3A = dbe->book1D("GlobalResidualsClu3R3A","RPC Residuals Ring 3 Roll A Cluster Size 3",101,-10.,10.);
129  hGlobalResClu3R2C = dbe->book1D("GlobalResidualsClu3R2C","RPC Residuals Ring 2 Roll C Cluster Size 3",101,-10.,10.);
130  hGlobalResClu3R2B = dbe->book1D("GlobalResidualsClu3R2B","RPC Residuals Ring 2 Roll B Cluster Size 3",101,-10.,10.);
131  hGlobalResClu3R2A = dbe->book1D("GlobalResidualsClu3R2A","RPC Residuals Ring 2 Roll A Cluster Size 3",101,-10.,10.);
132 
133 
134  if(debug) ofrej.open("rejected.txt");
135 
136  if(debug) std::cout<<"Rejected done"<<std::endl;
137 
138 }
139 
141 
142  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
143  iSetup.get<MuonGeometryRecord>().get(dtGeo);
144  iSetup.get<MuonGeometryRecord>().get(cscGeo);
145 
146  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
147  if(dynamic_cast< RPCChamber* >( *it ) != 0 ){
148  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
149  std::vector< const RPCRoll*> roles = (ch->rolls());
150  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
151  RPCDetId rpcId = (*r)->id();
152  int region=rpcId.region();
153  //booking all histograms
154  RPCGeomServ rpcsrv(rpcId);
155  std::string nameRoll = rpcsrv.name();
156  if(debug) std::cout<<"Booking for "<<rpcId.rawId()<<std::endl;
157  meCollection[rpcId.rawId()] = bookDetUnitSeg(rpcId,(*r)->nstrips(),folderPath+"MuonSegEff/");
158 
159  if(region==0&&(incldt||incldtMB4)){
160  //std::cout<<"--Filling the dtstore"<<rpcId<<std::endl;
161  int wheel=rpcId.ring();
162  int sector=rpcId.sector();
163  int station=rpcId.station();
164  DTStationIndex ind(region,wheel,sector,station);
165  std::set<RPCDetId> myrolls;
166  if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind];
167  myrolls.insert(rpcId);
168  rollstoreDT[ind]=myrolls;
169 
170  }
171  if(region!=0 && inclcsc){
172  int region=rpcId.region();
173  int station=rpcId.station();
174  int ring=rpcId.ring();
175  int cscring=ring;
176  int cscstation=station;
177  RPCGeomServ rpcsrv(rpcId);
178  int rpcsegment = rpcsrv.segment();
179  int cscchamber = rpcsegment;
180  if((station==2||station==3)&&ring==3){
181  cscring = 2;
182  }
183 
184  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
185  std::set<RPCDetId> myrolls;
186  if (rollstoreCSC.find(ind)!=rollstoreCSC.end()){
187  myrolls=rollstoreCSC[ind];
188  }
189  myrolls.insert(rpcId);
190  rollstoreCSC[ind]=myrolls;
191  }
192  }
193  }
194  }
195  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
196  if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
197 
198  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
199  std::vector< const RPCRoll*> roles = (ch->rolls());
200  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
201  RPCDetId rpcId = (*r)->id();
202 
203  int region=rpcId.region();
204 
205  /*if(region==0&&(incldt||incldtMB4)&&rpcId.ring()!=0&&rpcId.station()!=4){
206  //std::cout<<"--Filling the dtstore for statistics"<<rpcId<<std::endl;
207 
208  int sidewheel = 0;
209 
210  if(rpcId.ring()==-2){
211  sidewheel=-1;
212  }
213  else if(rpcId.ring()==-1){
214  sidewheel=0;
215  }
216  else if(rpcId.ring()==1){
217  sidewheel=0;
218  }
219  else if(rpcId.ring()==2){
220  sidewheel=1;
221  }
222  int wheel= sidewheel;
223  int sector=rpcId.sector();
224  int station=rpcId.station();
225  DTStationIndex ind(region,wheel,sector,station);
226  std::set<RPCDetId> myrolls;
227  if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind];
228  myrolls.insert(rpcId);
229  rollstoreDT[ind]=myrolls;
230  }*/
231 
232  if(region!=0 && inclcsc && (rpcId.ring()==2 || rpcId.ring()==3)){
233  int region=rpcId.region();
234  int station=rpcId.station();
235  int ring=rpcId.ring();
236  int cscring = ring;
237 
238  if((station==2||station==3)&&ring==3) cscring = 2; //CSC Ring 2 covers rpc ring 2 & 3
239 
240 
241  int cscstation=station;
242  RPCGeomServ rpcsrv(rpcId);
243  int rpcsegment = rpcsrv.segment();
244 
245 
246  int cscchamber = rpcsegment+1;
247  if(cscchamber==37)cscchamber=1;
248  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
249  std::set<RPCDetId> myrolls;
250  if (rollstoreCSC.find(ind)!=rollstoreCSC.end())myrolls=rollstoreCSC[ind];
251  myrolls.insert(rpcId);
252  rollstoreCSC[ind]=myrolls;
253 
254  cscchamber = rpcsegment-1;
255  if(cscchamber==0)cscchamber=36;
256  CSCStationIndex indDos(region,cscstation,cscring,cscchamber);
257  std::set<RPCDetId> myrollsDos;
258  if (rollstoreCSC.find(indDos)!=rollstoreCSC.end()) myrollsDos=rollstoreCSC[indDos];
259  myrollsDos.insert(rpcId);
260  rollstoreCSC[indDos]=myrollsDos;
261  }
262  }
263  }
264  }
265 }//beginRun
266 
268 {
269 
270 }
271 
273 {
274 
275  statistics->Fill(1);
276 
277  char meIdRPC [128];
278  char meIdDT [128];
279  char meIdCSC [128];
280 
281  if(debug) std::cout <<"\t Getting the RPC RecHits"<<std::endl;
283  iEvent.getByLabel(RPCRecHitLabel_,rpcHits);
284 
285 
286  if(rpcHits.isValid()){
287  if(incldt){
288  if(debug) std::cout<<"\t Getting the DT Segments"<<std::endl;
290 
291  iEvent.getByLabel(dt4DSegments, all4DSegments);
292 
293  if(all4DSegments.isValid()){
294  if(all4DSegments->size()>0){
295  if(all4DSegments->size()<=16) statistics->Fill(2);
296 
297  if(debug) std::cout<<"\t Number of DT Segments in this event = "<<all4DSegments->size()<<std::endl;
298 
299  std::map<DTChamberId,int> DTSegmentCounter;
301 
302  for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){
303  DTSegmentCounter[segment->chamberId()]++;
304  }
305 
306  statistics->Fill(all4DSegments->size()+2);
307 
308  if(debug) std::cout<<"\t Loop over all the 4D Segments"<<std::endl;
309  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){
310 
311  DTChamberId DTId = segment->chamberId();
312 
313 
314  if(debug) std::cout<<"DT \t \t This Segment is in Chamber id: "<<DTId<<std::endl;
315  if(debug) std::cout<<"DT \t \t Number of segments in this DT = "<<DTSegmentCounter[DTId]<<std::endl;
316  if(debug) std::cout<<"DT \t \t Is the only one in this DT? and is not in the 4th Station?"<<std::endl;
317 
318 
319  if(DTSegmentCounter[DTId]==1 && DTId.station()!=4){
320 
321  int dtWheel = DTId.wheel();
322  int dtStation = DTId.station();
323  int dtSector = DTId.sector();
324 
325  LocalPoint segmentPosition= segment->localPosition();
326  LocalVector segmentDirection=segment->localDirection();
327 
328  const GeomDet* gdet=dtGeo->idToDet(segment->geographicalId());
329  const BoundPlane & DTSurface = gdet->surface();
330 
331  //check if the dimension of the segment is 4
332 
333  if(debug) std::cout<<"DT \t \t Is the segment 4D?"<<std::endl;
334 
335  if(segment->dimension()==4){
336 
337  if(debug) std::cout<<"DT \t \t yes"<<std::endl;
338  if(debug) std::cout<<"DT \t \t DT Segment Dimension "<<segment->dimension()<<std::endl;
339 
340  float Xo=segmentPosition.x();
341  float Yo=segmentPosition.y();
342  float Zo=segmentPosition.z();
343  float dx=segmentDirection.x();
344  float dy=segmentDirection.y();
345  float dz=segmentDirection.z();
346 
347  std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,dtStation)];
348 
349  if(debug) std::cout<<"DT \t \t Number of rolls for this DT = "<<rollsForThisDT.size()<<std::endl;
350 
351  assert(rollsForThisDT.size()>=1);
352 
353  if(debug) std::cout<<"DT \t \t Loop over all the rolls asociated to this DT"<<std::endl;
354  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){
355  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll);
356  RPCDetId rpcId = rollasociated->id();
357  const BoundPlane & RPCSurface = rollasociated->surface();
358 
359  RPCGeomServ rpcsrv(rpcId);
360  std::string nameRoll = rpcsrv.name();
361 
362  if(debug) std::cout<<"DT \t \t \t RollName: "<<nameRoll<<std::endl;
363  if(debug) std::cout<<"DT \t \t \t Doing the extrapolation to this roll"<<std::endl;
364  if(debug) std::cout<<"DT \t \t \t DT Segment Direction in DTLocal "<<segmentDirection<<std::endl;
365  if(debug) std::cout<<"DT \t \t \t DT Segment Point in DTLocal "<<segmentPosition<<std::endl;
366 
367  GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0));
368 
369  LocalPoint CenterRollinDTFrame = DTSurface.toLocal(CenterPointRollGlobal);
370 
371  if(debug) std::cout<<"DT \t \t \t Center (0,0,0) Roll In DTLocal"<<CenterRollinDTFrame<<std::endl;
372  if(debug) std::cout<<"DT \t \t \t Center (0,0,0) of the Roll in Global"<<CenterPointRollGlobal<<std::endl;
373 
374  float D=CenterRollinDTFrame.z();
375 
376  float X=Xo+dx*D/dz;
377  float Y=Yo+dy*D/dz;
378  float Z=D;
379 
380  const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(rollasociated->topology()));
381  LocalPoint xmin = top_->localPosition(0.);
382  if(debug) std::cout<<"DT \t \t \t xmin of this Roll "<<xmin<<"cm"<<std::endl;
383  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
384  if(debug) std::cout<<"DT \t \t \t xmax of this Roll "<<xmax<<"cm"<<std::endl;
385  float rsize = fabs( xmax.x()-xmin.x() );
386  if(debug) std::cout<<"DT \t \t \t Roll Size "<<rsize<<"cm"<<std::endl;
387  float stripl = top_->stripLength();
388  float stripw = top_->pitch();
389 
390  if(debug) std::cout<<"DT \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl;
391  if(debug) std::cout<<"DT \t \t \t Strip Width "<<stripw<<"cm"<<std::endl;
392  if(debug) std::cout<<"DT \t \t \t X Predicted in DTLocal= "<<X<<"cm"<<std::endl;
393  if(debug) std::cout<<"DT \t \t \t Y Predicted in DTLocal= "<<Y<<"cm"<<std::endl;
394  if(debug) std::cout<<"DT \t \t \t Z Predicted in DTLocal= "<<Z<<"cm"<<std::endl;
395 
396  float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo));
397 
398  if(debug) std::cout<<"DT \t \t \t Is the distance of extrapolation less than MaxD? ="<<extrapolatedDistance<<"cm"<<"MaxD="<<MaxD<<"cm"<<std::endl;
399 
400  if(extrapolatedDistance<=MaxD){
401  if(debug) std::cout<<"DT \t \t \t yes"<<std::endl;
402  GlobalPoint GlobalPointExtrapolated = DTSurface.toGlobal(LocalPoint(X,Y,Z));
403  if(debug) std::cout<<"DT \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl;
404  LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
405 
406  if(debug) std::cout<<"DT \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl;
407  if(debug) std::cout<<"DT \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl;
408  if(debug) std::cout<<"DT \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<","
409  <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl;
410  if(debug) std::cout<<"DT \t \t \t Does the extrapolation go inside this roll?"<<std::endl;
411 
412  if(fabs(PointExtrapolatedRPCFrame.z()) < 10. &&
413  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
414  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
415 
416  if(debug) std::cout<<"DT \t \t \t \t yes"<<std::endl;
417 
418  RPCDetId rollId = rollasociated->id();
419 
420  RPCGeomServ rpcsrv(rollId);
421  std::string nameRoll = rpcsrv.name();
422  if(debug) std::cout<<"DT \t \t \t \t The RPCName is "<<nameRoll<<std::endl;
423  const float stripPredicted =
424  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
425 
426  if(debug) std::cout<<"DT \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl;
427  //---- HISTOGRAM STRIP PREDICTED FROM DT ----
428 
429  std::map<std::string, MonitorElement*> meMap=meCollection[rpcId.rawId()];
430 
431  sprintf(meIdDT,"ExpectedOccupancyFromDT_%d",rollId.rawId());
432  if(debug) std::cout<<"DT \t \t \t \t Filling Expected for "<<meIdDT<<" with "<<stripPredicted<<std::endl;
433  if(fabs(stripPredicted-rollasociated->nstrips())<1.) if(debug) std::cout<<"DT \t \t \t \t Extrapolating near last strip, Event"<<iEvent.id()<<" stripPredicted="<<stripPredicted<<" Number of strips="<<rollasociated->nstrips()<<std::endl;
434  if(fabs(stripPredicted)<1.) if(debug) std::cout<<"DT \t \t \t \t Extrapolating near first strip, Event"<<iEvent.id()<<" stripPredicted="<<stripPredicted<<" Number of strips="<<rollasociated->nstrips()<<std::endl;
435  meMap[meIdDT]->Fill(stripPredicted);
436  //-----------------------------------------------------
437 
438 
439  //-------RecHitPart Just For Residual--------
440  int countRecHits = 0;
441  int cluSize = 0;
442  float minres = 3000.;
443 
444  if(debug) std::cout<<"DT \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl;
445  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
446  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
448 
449  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
450  countRecHits++;
451 
452  sprintf(meIdRPC,"BXDistribution_%d",rollasociated->id().rawId());
453  meMap[meIdRPC]->Fill(recHit->BunchX());
454 
455  LocalPoint recHitPos=recHit->localPosition();
456  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
457  if(debug) std::cout<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl;
458  if(fabs(res)<fabs(minres)){
459  minres=res;
460  cluSize = recHit->clusterSize();
461  if(debug) std::cout<<"DT \t \t \t \t \t \t New Min Res "<<res<<"cm."<<std::endl;
462  }
463  }
464 
465  bool anycoincidence=false;
466 
467  if(countRecHits==0){
468  if(debug) std::cout <<"DT \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl;
469  }else{
470  assert(minres!=3000);
471 
472  if(debug) std::cout<<"DT \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual="<<minres<<std::endl;
473  if(debug) std::cout<<"DT \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl;
474  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
475  if(debug) std::cout<<"DT \t \t \t \t \t \t True!"<<std::endl;
476  anycoincidence=true;
477  }
478  }
479  if(anycoincidence){
480  if(debug) std::cout<<"DT \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl;
481  if(debug) std::cout<<"DT \t \t \t \t \t Norm of Cosine Directors="<<dx*dx+dy*dy+dz*dz<<"~1?"<<std::endl;
482 
483  float cosal = dx/sqrt(dx*dx+dz*dz);
484  if(debug) std::cout<<"DT \t \t \t \t \t Angle="<<acos(cosal)*180/3.1415926<<" degree"<<std::endl;
485  if(debug) std::cout<<"DT \t \t \t \t \t Filling the Residuals Histogram for globals with "<<minres<<"And the angular incidence with Cos Alpha="<<cosal<<std::endl;
486  if(rollId.station()==1&&rollId.layer()==1) { if(cluSize==1*dupli) {hGlobalResClu1La1->Fill(minres);}if(cluSize==2*dupli){ hGlobalResClu2La1->Fill(minres);} else if(cluSize==3*dupli){ hGlobalResClu3La1->Fill(minres);}}
487  else if(rollId.station()==1&&rollId.layer()==2){ if(cluSize==1*dupli) {hGlobalResClu1La2->Fill(minres);}if(cluSize==2*dupli){ hGlobalResClu2La2->Fill(minres);} else if(cluSize==3*dupli){ hGlobalResClu3La2->Fill(minres);}}
488  else if(rollId.station()==2&&rollId.layer()==1){ if(cluSize==1*dupli) {hGlobalResClu1La3->Fill(minres);}if(cluSize==2*dupli){ hGlobalResClu2La3->Fill(minres);} else if(cluSize==3*dupli){ hGlobalResClu3La3->Fill(minres);}}
489  else if(rollId.station()==2&&rollId.layer()==2){ if(cluSize==1*dupli) {hGlobalResClu1La4->Fill(minres);}if(cluSize==2*dupli){ hGlobalResClu2La4->Fill(minres);} else if(cluSize==3*dupli){ hGlobalResClu3La4->Fill(minres);}}
490  else if(rollId.station()==3) { if(cluSize==1*dupli) {hGlobalResClu1La5->Fill(minres);}if(cluSize==2*dupli){ hGlobalResClu2La5->Fill(minres);} else if(cluSize==3*dupli){ hGlobalResClu3La5->Fill(minres);}}
491 
492  sprintf(meIdRPC,"RPCDataOccupancyFromDT_%d",rollId.rawId());
493  if(debug) std::cout<<"DT \t \t \t \t \t COINCIDENCE!!! Event="<<iEvent.id()<<" Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl;
494  meMap[meIdRPC]->Fill(stripPredicted);
495  }
496  else{
497  RPCGeomServ rpcsrv(rollasociated->id());
498  std::string nameRoll = rpcsrv.name();
499  if(debug) std::cout<<"DT \t \t \t \t \t A roll was ineficient in event "<<iEvent.id().event()<<std::endl;
500  if(debug) ofrej<<"DTs \t Wh "<<dtWheel
501  <<"\t St "<<dtStation
502  <<"\t Se "<<dtSector
503  <<"\t Roll "<<nameRoll
504  <<"\t Event "
505  <<iEvent.id().event()
506  <<"\t Run "
507  <<iEvent.id().run()
508  <<std::endl;
509  }
510  }else{
511  if(debug) std::cout<<"DT \t \t \t \t No the prediction is outside of this roll"<<std::endl;
512  }//Condition for the right match
513  }else{
514  if(debug) std::cout<<"DT \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl;
515  }//D so big
516  }//loop over all the rolls asociated
517  }//Is the segment 4D?
518  }else {
519  if(debug) std::cout<<"DT \t \t More than one segment in this chamber, or we are in Station 4"<<std::endl;
520  }
521  }
522  } else {
523  if(debug) std::cout<<"DT This Event doesn't have any DT4DDSegment"<<std::endl; //is ther more than 1 segment in this event?
524  }
525  }
526  }
527 
528  if(incldtMB4){
529  if(debug) std::cout <<"MB4 \t Getting ALL the DT Segments"<<std::endl;
531  iEvent.getByLabel(dt4DSegments, all4DSegments);
532 
533  iEvent.getByLabel(dt4DSegments, all4DSegments);
534 
535  if(all4DSegments.isValid()){
536  if(all4DSegments->size()>0){
537  std::map<DTChamberId,int> DTSegmentCounter;
539 
540  for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){
541  DTSegmentCounter[segment->chamberId()]++;
542  }
543 
544  if(debug) std::cout<<"MB4 \t \t Loop Over all4DSegments"<<std::endl;
545  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){
546 
547  DTChamberId DTId = segment->chamberId();
548 
549  if(debug) std::cout<<"MB4 \t \t This Segment is in Chamber id: "<<DTId<<std::endl;
550  if(debug) std::cout<<"MB4 \t \t Number of segments in this DT = "<<DTSegmentCounter[DTId]<<std::endl;
551  if(debug) std::cout<<"MB4 \t \t \t Is the only one in this DT? and is in the Station 4?"<<std::endl;
552 
553  if(DTSegmentCounter[DTId] == 1 && DTId.station()==4){
554 
555  if(debug) std::cout<<"MB4 \t \t \t yes"<<std::endl;
556  int dtWheel = DTId.wheel();
557  int dtStation = DTId.station();
558  int dtSector = DTId.sector();
559 
560  LocalPoint segmentPosition= segment->localPosition();
561  LocalVector segmentDirection=segment->localDirection();
562 
563  //check if the dimension of the segment is 2 and the station is 4
564 
565 
566  if(debug) std::cout<<"MB4 \t \t \t \t The Segment in MB4 is 2D?"<<std::endl;
567  if(segment->dimension()==2){
568  if(debug) std::cout<<"MB4 \t \t \t \t yes"<<std::endl;
569  LocalVector segmentDirectionMB4=segmentDirection;
570  LocalPoint segmentPositionMB4=segmentPosition;
571 
572  bool compatiblesegments=false;
573 
574  const BoundPlane& DTSurface4 = dtGeo->idToDet(DTId)->surface();
575 
577 
578  if(debug) std::cout<<"MB4 \t \t \t \t Loop on segments in =sector && MB3 && adjacent sectors && y dim=4"<<std::endl;
579  for(segMB3=all4DSegments->begin();segMB3!=all4DSegments->end();++segMB3){
580 
581  DTChamberId dtid3 = segMB3->chamberId();
582 
583  if(distsector(dtid3.sector(),DTId.sector())<=1
584  && dtid3.station()==3
585  && dtid3.wheel()==DTId.wheel()
586  && DTSegmentCounter[dtid3] == 1
587  && segMB3->dimension()==4){
588 
589  if(debug) std::cout<<"MB4 \t \t \t \t distsector ="<<distsector(dtid3.sector(),DTId.sector())<<std::endl;
590 
591  const GeomDet* gdet3=dtGeo->idToDet(segMB3->geographicalId());
592  const BoundPlane & DTSurface3 = gdet3->surface();
593 
594  LocalVector segmentDirectionMB3 = segMB3->localDirection();
595  GlobalPoint segmentPositionMB3inGlobal = DTSurface3.toGlobal(segMB3->localPosition());
596 
597 
598  LocalVector segDirMB4inMB3Frame=DTSurface3.toLocal(DTSurface4.toGlobal(segmentDirectionMB4));
599  LocalVector segDirMB3inMB4Frame=DTSurface4.toLocal(DTSurface3.toGlobal(segmentDirectionMB3));
600 
601  GlobalVector segDirMB4inGlobalFrame=DTSurface4.toGlobal(segmentDirectionMB4);
602  GlobalVector segDirMB3inGlobalFrame=DTSurface3.toGlobal(segmentDirectionMB3);
603 
604  float dx=segDirMB4inGlobalFrame.x();
605  float dy=segDirMB4inGlobalFrame.y();
606  float dz=segDirMB4inGlobalFrame.z();
607 
608  float dx3=segDirMB3inGlobalFrame.x();
609  float dy3=segDirMB3inGlobalFrame.y();
610  float dz3=segDirMB3inGlobalFrame.z();
611 
612  double cosAng=fabs(dx*dx3+dy*dy3/sqrt((dx3*dx3+dy3*dy3)*(dx*dx+dy*dy)));
613 
614  if(debug) std::cout<<"MB4 \t \t \t \t cosAng"<<cosAng<<"Beetween "<<dtid3<<" and "<<DTId<<std::endl;
615 
616  if(fabs(cosAng)>1.){
617  if(debug) std::cout<<"dx="<<dx<<" dz="<<dz<<std::endl;
618  if(debug) std::cout<<"dx3="<<dx3<<" dz3="<<dz<<std::endl;
619  if(debug) std::cout<<cosAng<<std::endl;
620  }
621 
622  if(cosAng>MinCosAng){
623  compatiblesegments=true;
624  if(dtSector==13){
625  dtSector=4;
626  }
627  if(dtSector==14){
628  dtSector=10;
629  }
630 
631  std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,dtStation)]; //It should be always 4
632 
633  if(debug) std::cout<<"MB4 \t \t Number of rolls for this DT = "<<rollsForThisDT.size()<<std::endl;
634 
635  assert(rollsForThisDT.size()>=1);
636 
637  if(debug) std::cout<<"MB4 \t \t Loop over all the rolls asociated to this DT"<<std::endl;
638 
639  for (std::set<RPCDetId>::iterator iteraRoll=rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){
640  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); //roll asociado a MB4
641  RPCDetId rpcId = rollasociated->id();
642  const BoundPlane & RPCSurfaceRB4 = rollasociated->surface(); //surface MB4
643 
644  RPCGeomServ rpcsrv(rpcId);
645  std::string nameRoll = rpcsrv.name();
646 
647  if(debug) std::cout<<"MB4 \t \t \t RollName: "<<nameRoll<<std::endl;
648  if(debug) std::cout<<"MB4 \t \t \t Doing the extrapolation to this roll"<<std::endl;
649 
650  GlobalPoint CenterPointRollGlobal=RPCSurfaceRB4.toGlobal(LocalPoint(0,0,0));
651  LocalPoint CenterRollinMB4Frame = DTSurface4.toLocal(CenterPointRollGlobal); //In MB4
652  LocalPoint segmentPositionMB3inMB4Frame = DTSurface4.toLocal(segmentPositionMB3inGlobal); //In MB4
653  LocalPoint segmentPositionMB3inRB4Frame = RPCSurfaceRB4.toLocal(segmentPositionMB3inGlobal); //In MB4
654  LocalVector segmentDirectionMB3inMB4Frame = DTSurface4.toLocal(segDirMB3inGlobalFrame); //In MB4
655 
656  //The exptrapolation is done in MB4 frame. for local x and z is done from MB4,
657  float Dxz=CenterRollinMB4Frame.z();
658  float Xo4=segmentPositionMB4.x();
659  float dxl=segmentDirectionMB4.x(); //dx local for MB4 segment in MB4 Frame
660  float dzl=segmentDirectionMB4.z(); //dx local for MB4 segment in MB4 Frame
661 
662  float X=Xo4+dxl*Dxz/dzl; //In MB4 frame
663  float Z=Dxz;//In MB4 frame
664 
665  //for local y is done from MB3
666  float Yo34=segmentPositionMB3inMB4Frame.y();
667  float dy34 = segmentDirectionMB3inMB4Frame.y();
668  float dz34 = segmentDirectionMB3inMB4Frame.z();
669  float Dy=Dxz-(segmentPositionMB3inMB4Frame.z()); //Distance beetween the segment in MB3 and the RB4 surface
670 
671  if(debug) std::cout<<"MB4 \t \t \t The distance to extrapolate in Y from MB3 is "<<Dy<<"cm"<<std::endl;
672 
673  float Y=Yo34+dy34*Dy/dz34;//In MB4 Frame
674 
675  const RectangularStripTopology* top_
676  =dynamic_cast<const RectangularStripTopology*>(&(rollasociated->topology())); //Topology roll asociated MB4
677  LocalPoint xmin = top_->localPosition(0.);
678  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
679  float rsize = fabs( xmax.x()-xmin.x() );
680  float stripl = top_->stripLength();
681  float stripw = top_->pitch();
682 
683 
684  if(debug) std::cout<<"MB4 \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl;
685  if(debug) std::cout<<"MB4 \t \t \t Strip Width "<<stripw<<"cm"<<std::endl;
686 
687  if(debug) std::cout<<"MB4 \t \t \t X Predicted in MB4DTLocal= "<<X<<"cm"<<std::endl;
688  if(debug) std::cout<<"MB4 \t \t \t Y Predicted in MB4DTLocal= "<<Y<<"cm"<<std::endl;
689  if(debug) std::cout<<"MB4 \t \t \t Z Predicted in MB4DTLocal= "<<Z<<"cm"<<std::endl;
690 
691  float extrapolatedDistance = sqrt((Y-Yo34)*(Y-Yo34)+Dy*Dy);
692 
693  if(debug) std::cout<<"MB4 \t \t \t segmentPositionMB3inMB4Frame"<<segmentPositionMB3inMB4Frame<<std::endl;
694  if(debug) std::cout<<"MB4 \t \t \t segmentPositionMB4inMB4Frame"<<segmentPosition<<std::endl;
695 
696  if(debug) std::cout<<"MB4 \t \t \t segmentDirMB3inMB4Frame"<<segDirMB3inMB4Frame<<std::endl;
697  if(debug) std::cout<<"MB4 \t \t \t segmentDirMB4inMB4Frame"<<segmentDirectionMB4<<std::endl;
698 
699  if(debug) std::cout<<"MB4 \t \t \t CenterRB4PositioninMB4Frame"<<CenterRollinMB4Frame<<std::endl;
700 
701  if(debug) std::cout<<"MB4 \t \t \t Is the extrapolation distance ="<<extrapolatedDistance<<"less than "<<MaxDrb4<<std::endl;
702 
703 
704  if(extrapolatedDistance<=MaxDrb4){
705  if(debug) std::cout<<"MB4 \t \t \t yes"<<std::endl;
706 
707  GlobalPoint GlobalPointExtrapolated = DTSurface4.toGlobal(LocalPoint(X,Y,Z));
708 
709  if(debug) std::cout<<"MB4 \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl;
710 
711  LocalPoint PointExtrapolatedRPCFrame = RPCSurfaceRB4.toLocal(GlobalPointExtrapolated);
712 
713  if(debug) std::cout<<"MB4 \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl;
714  if(debug) std::cout<<"MB4 \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl;
715  if(debug) std::cout<<"MB4 \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<","
716  <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl;
717 
718  if(debug) std::cout<<"MB4 \t \t \t Does the extrapolation go inside this roll?"<<std::endl;
719 
720  if(fabs(PointExtrapolatedRPCFrame.z()) < 5. &&
721  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
722  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
723 
724  if(debug) std::cout<<"MB4 \t \t \t \t yes"<<std::endl;
725 
726  RPCDetId rollId = rollasociated->id();
727 
728  RPCGeomServ rpcsrv(rollId);
729  std::string nameRoll = rpcsrv.name();
730  if(debug) std::cout<<"MB4 \t \t \t \t \t The RPCName is "<<nameRoll<<std::endl;
731  const float stripPredicted=
732  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
733 
734  if(debug) std::cout<<"MB4 \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl;
735  //--------- HISTOGRAM STRIP PREDICTED FROM DT MB4 -------------------
736 
737  std::map<std::string, MonitorElement*> meMap=meCollection[rollId.rawId()];
738 
739  if(debug) std::cout<<"MB4 \t \t \t \t \t Filling Expected"<<std::endl;
740  sprintf(meIdDT,"ExpectedOccupancyFromDT_%d",rollId.rawId());
741  meMap[meIdDT]->Fill(stripPredicted);
742  //-------------------------------------------------
743 
744 
745  //-------RecHitPart Just For Residual--------
746  int countRecHits = 0;
747  int cluSize = 0;
748  float minres = 3000.;
749 
750  if(debug) std::cout<<"MB4 \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl;
751  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
752  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
754 
755  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
756  countRecHits++;
757  LocalPoint recHitPos=recHit->localPosition();
758  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
759  if(debug) std::cout<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl;
760  if(fabs(res)<fabs(minres)){
761  minres=res;
762  cluSize = recHit->clusterSize();
763  }
764  }
765 
766  bool anycoincidence=false;
767 
768  if(countRecHits==0){
769  if(debug) std::cout <<"MB4 \t \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl;
770  }else{
771  assert(minres!=3000);
772 
773  if(debug) std::cout<<"MB4 \t \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual ="<<minres<<std::endl;
774  if(debug) std::cout<<"MB4 \t \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl;
775  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
776  if(debug) std::cout<<"MB4 \t \t \t \t \t \t \t True!"<<std::endl;
777  anycoincidence=true;
778  }
779  }
780  if(anycoincidence){
781  if(debug) std::cout<<"MB4 \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl;
782  if(debug) std::cout<<"MB4 \t \t \t \t \t Norm of Cosine Directors="<<dx3*dx3+dy3*dy3+dz3*dz3<<"~1?"<<std::endl;
783 
784  float cosal = dx/sqrt(dx*dx+dz*dz);
785  if(debug) std::cout<<"MB4 \t \t \t \t \t Angle="<<acos(cosal)*180/3.1415926<<" degree"<<std::endl;
786  if(debug) std::cout<<"MB4 \t \t \t \t \t Filling the Residuals Histogram for globals with "<<minres<<"And the angular incidence with Cos Theta="<<-1*dz<<std::endl;
787  assert(rollId.station()==4);
788  if(cluSize==1*dupli){ hGlobalResClu1La6->Fill(minres);}
789  else if(cluSize==2*dupli){ hGlobalResClu2La6->Fill(minres);}
790  else if(cluSize==3*dupli){ hGlobalResClu3La6->Fill(minres);}
791 
792  sprintf(meIdRPC,"RPCDataOccupancyFromDT_%d",rollId.rawId());
793  if(debug) std::cout<<"MB4 \t \t \t \t \t \t COINCIDENCE!!! Event="<<iEvent.id()<<"Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl;
794  meMap[meIdRPC]->Fill(stripPredicted);
795  }
796  else{
797  RPCGeomServ rpcsrv(rollasociated->id());
798  std::string nameRoll = rpcsrv.name();
799  if(debug) std::cout<<"MB4 \t \t \t \t \t \t A roll was ineficient in event"<<iEvent.id().event()<<std::endl;
800  if(debug) ofrej<<"MB4 \t Wh "<<dtWheel
801  <<"\t St "<<dtStation
802  <<"\t Se "<<dtSector
803  <<"\t Roll "<<nameRoll
804  <<"\t Event "
805  <<iEvent.id().event()
806  <<"\t Run "
807  <<iEvent.id().run()
808  <<std::endl;
809  }
810  }else{
811  if(debug) std::cout<<"MB4 \t \t \t \t No the prediction is outside of this roll"<<std::endl;
812  }
813  }//Condition for the right match
814  else{
815  if(debug) std::cout<<"MB4 \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl;
816  }
817  }//loop over all the rollsasociated
818  }else{
819  compatiblesegments=false;
820  if(debug) std::cout<<"MB4 \t \t \t \t I found segments in MB4 and MB3 adjacent or same wheel and sector but not compatibles Diferent Directions"<<std::endl;
821  }
822  }else{//if dtid3.station()==3&&dtid3.sector()==DTId.sector()&&dtid3.wheel()==DTId.wheel()&&segMB3->dim()==4
823  if(debug) std::cout<<"MB4 \t \t \t No the same station or same wheel or segment dim in mb3 not 4D"<<std::endl;
824  }
825  }//loop over all the segments looking for one in MB3
826  }else{
827  if(debug) std::cout<<"MB4 \t \t \t Is NOT a 2D Segment"<<std::endl;
828  }
829  }else{
830  if(debug) std::cout<<"MB4 \t \t \t \t There is not just one segment or is not in station 4"<<std::endl;
831  }//De aca para abajo esta en dtpart.inl
832  }
833  }else{
834  if(debug) std::cout<<"MB4 \t This event doesn't have 4D Segment"<<std::endl;
835  }
836  }
837  }
838 
839 
840  if(inclcsc){
841  if(debug) std::cout <<"\t Getting the CSC Segments"<<std::endl;
842  edm::Handle<CSCSegmentCollection> allCSCSegments;
843 
844  iEvent.getByLabel(cscSegments, allCSCSegments);
845 
846  if(allCSCSegments.isValid()){
847  if(allCSCSegments->size()>0){
848  statistics->Fill(18);
849 
850  if(debug) std::cout<<"CSC \t Number of CSC Segments in this event = "<<allCSCSegments->size()<<std::endl;
851 
852  std::map<CSCDetId,int> CSCSegmentsCounter;
854 
855  int segmentsInThisEventInTheEndcap=0;
856 
857  for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){
858  CSCSegmentsCounter[segment->cscDetId()]++;
859  segmentsInThisEventInTheEndcap++;
860  }
861 
862  statistics->Fill(allCSCSegments->size()+18);
863 
864  if(debug) std::cout<<"CSC \t loop over all the CSCSegments "<<std::endl;
865  for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){
866  CSCDetId CSCId = segment->cscDetId();
867 
868  if(debug) std::cout<<"CSC \t \t This Segment is in Chamber id: "<<CSCId<<std::endl;
869  if(debug) std::cout<<"CSC \t \t Number of segments in this CSC = "<<CSCSegmentsCounter[CSCId]<<std::endl;
870  if(debug) std::cout<<"CSC \t \t Is the only one in this CSC? is not ind the ring 1 or station 4? Are there more than 2 segments in the event?"<<std::endl;
871 
872  if(CSCSegmentsCounter[CSCId]==1 && CSCId.station()!=4 && CSCId.ring()!=1 && allCSCSegments->size()>=2){
873  if(debug) std::cout<<"CSC \t \t yes"<<std::endl;
874  int cscEndCap = CSCId.endcap();
875  int cscStation = CSCId.station();
876  int cscRing = CSCId.ring();
877  int cscChamber = CSCId.chamber();
878  int rpcRegion = 1; if(cscEndCap==2) rpcRegion= -1;//Relacion entre las endcaps
879  int rpcRing = cscRing;
880  if(cscRing==4)rpcRing =1;
881  int rpcStation = cscStation;
882  int rpcSegment = CSCId.chamber();
883 
884  LocalPoint segmentPosition= segment->localPosition();
885  LocalVector segmentDirection=segment->localDirection();
886  float dz=segmentDirection.z();
887 
888  if(debug) std::cout<<"CSC \t \t Is a good Segment? dim = 4, 4 <= nRecHits <= 10 Incident angle int range 45 < "<<acos(dz)*180/3.1415926<<" < 135? "<<std::endl;
889 
890  if(segment->dimension()==4 && (segment->nRecHits()<=10 && segment->nRecHits()>=4)&& acos(dz)*180/3.1415926 > 45. && acos(dz)*180/3.1415926 < 160. ){
891 
892  //&& segment->chi2()< ??)Add 3 segmentes in the endcaps???
893 
894  if(debug) std::cout<<"CSC \t \t yes"<<std::endl;
895  if(debug) std::cout<<"CSC \t \t CSC Segment Dimension "<<segment->dimension()<<std::endl;
896 
897  float Xo=segmentPosition.x();
898  float Yo=segmentPosition.y();
899  float Zo=segmentPosition.z();
900  float dx=segmentDirection.x();
901  float dy=segmentDirection.y();
902  float dz=segmentDirection.z();
903 
904 
905  if(debug) std::cout<<"CSC \t \t Getting chamber from Geometry"<<std::endl;
906  const CSCChamber* TheChamber=cscGeo->chamber(CSCId);
907  if(debug) std::cout<<"CSC \t \t Getting ID from Chamber"<<std::endl;
908  const CSCDetId TheId=TheChamber->id();
909  if(debug) std::cout<<"CSC \t \t Printing The Id"<<TheId<<std::endl;
910  std::set<RPCDetId> rollsForThisCSC = rollstoreCSC[CSCStationIndex(rpcRegion,rpcStation,rpcRing,rpcSegment)];
911  if(debug) std::cout<<"CSC \t \t Number of rolls for this CSC = "<<rollsForThisCSC.size()<<std::endl;
912 
913  if(debug) std::cout<<"CSC \t \t Loop over all the rolls asociated to this CSC"<<std::endl;
914 
915  if(rpcRing!=1&&rpcStation!=4){
916 
917  if(rollsForThisCSC.size()==0){
918  if(debug) std::cout<<"CSC Fail for CSCId="<<TheId<<" rpcRegion="<<rpcRegion<<" rpcStation="<<rpcStation<<" rpcRing="<<rpcRing<<" rpcSegment="<<rpcSegment<<std::endl;
919  }
920 
921  assert(rollsForThisCSC.size()>=1);
922 
923  //Loop over all the rolls
924  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin();iteraRoll != rollsForThisCSC.end(); iteraRoll++){
925  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll);
926  RPCDetId rpcId = rollasociated->id();
927 
928  if(debug) std::cout<<"CSC \t \t \t We are in the roll getting the surface"<<rpcId<<std::endl;
929  const BoundPlane & RPCSurface = rollasociated->surface();
930 
931  if(debug) std::cout<<"CSC \t \t \t RollID: "<<rpcId<<std::endl;
932 
933  if(debug) std::cout<<"CSC \t \t \t Doing the extrapolation to this roll"<<std::endl;
934  if(debug) std::cout<<"CSC \t \t \t CSC Segment Direction in CSCLocal "<<segmentDirection<<std::endl;
935  if(debug) std::cout<<"CSC \t \t \t CSC Segment Point in CSCLocal "<<segmentPosition<<std::endl;
936 
937  GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0));
938  if(debug) std::cout<<"CSC \t \t \t Center (0,0,0) of the Roll in Global"<<CenterPointRollGlobal<<std::endl;
939  GlobalPoint CenterPointCSCGlobal = TheChamber->toGlobal(LocalPoint(0,0,0));
940  if(debug) std::cout<<"CSC \t \t \t Center (0,0,0) of the CSC in Global"<<CenterPointCSCGlobal<<std::endl;
941  GlobalPoint segmentPositionInGlobal=TheChamber->toGlobal(segmentPosition); //new way to convert to global
942  if(debug) std::cout<<"CSC \t \t \t Segment Position in Global"<<segmentPositionInGlobal<<std::endl;
943  LocalPoint CenterRollinCSCFrame = TheChamber->toLocal(CenterPointRollGlobal);
944 
945  if(debug){//to check CSC RPC phi relation!
946  float rpcphi=0;
947  float cscphi=0;
948 
949  (CenterPointRollGlobal.barePhi()<0)?
950  rpcphi = 2*3.141592+CenterPointRollGlobal.barePhi():rpcphi=CenterPointRollGlobal.barePhi();
951 
952  (CenterPointCSCGlobal.barePhi()<0)?
953  cscphi = 2*3.1415926536+CenterPointCSCGlobal.barePhi():cscphi=CenterPointCSCGlobal.barePhi();
954 
955  float df=fabs(cscphi-rpcphi);
956  float dr=fabs(CenterPointRollGlobal.perp()-CenterPointCSCGlobal.perp());
957  float diffz=CenterPointRollGlobal.z()-CenterPointCSCGlobal.z();
958  float dfg=df*180./3.14159265;
959 
960  if(debug) std::cout<<"CSC \t \t \t z of RPC="<<CenterPointRollGlobal.z()<<"z of CSC"<<CenterPointCSCGlobal.z()<<" dfg="<<dfg<<std::endl;
961 
962 
963  RPCGeomServ rpcsrv(rpcId);
964 
965 
966  if(dr>200.||fabs(dz)>55.||dfg>1.){
967  //if(rpcRegion==1&&dfg>1.&&dr>100.){
968  if (debug) std::cout
969  <<"\t \t \t CSC Station= "<<CSCId.station()
970  <<" Ring= "<<CSCId.ring()
971  <<" Chamber= "<<CSCId.chamber()
972  <<" cscphi="<<cscphi*180/3.14159265
973  <<"\t RPC Station= "<<rpcId.station()
974  <<" ring= "<<rpcId.ring()
975  <<" segment =-> "<<rpcsrv.name()
976  <<" rollphi="<<rpcphi*180/3.14159265
977  <<"\t dfg="<<dfg
978  <<" dz="<<diffz
979  <<" dr="<<dr
980  <<std::endl;
981 
982  }
983  }
984 
985 
986 
987 
988  float D=CenterRollinCSCFrame.z();
989 
990  float X=Xo+dx*D/dz;
991  float Y=Yo+dy*D/dz;
992  float Z=D;
993 
994  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(rollasociated->topology()));
995  LocalPoint xmin = top_->localPosition(0.);
996  if(debug) std::cout<<"CSC \t \t \t xmin of this Roll "<<xmin<<"cm"<<std::endl;
997  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
998  if(debug) std::cout<<"CSC \t \t \t xmax of this Roll "<<xmax<<"cm"<<std::endl;
999  float rsize = fabs( xmax.x()-xmin.x() );
1000  if(debug) std::cout<<"CSC \t \t \t Roll Size "<<rsize<<"cm"<<std::endl;
1001  float stripl = top_->stripLength();
1002  float stripw = top_->pitch();
1003 
1004  if(debug) std::cout<<"CSC \t \t \t Strip Lenght "<<stripl<<"cm"<<std::endl;
1005  if(debug) std::cout<<"CSC \t \t \t Strip Width "<<stripw<<"cm"<<std::endl;
1006 
1007  if(debug) std::cout<<"CSC \t \t \t X Predicted in CSCLocal= "<<X<<"cm"<<std::endl;
1008  if(debug) std::cout<<"CSC \t \t \t Y Predicted in CSCLocal= "<<Y<<"cm"<<std::endl;
1009  if(debug) std::cout<<"CSC \t \t \t Z Predicted in CSCLocal= "<<Z<<"cm"<<std::endl;
1010 
1011  float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo));
1012 
1013  if(debug) std::cout<<"CSC \t \t \t Is the distance of extrapolation less than MaxD? ="<<extrapolatedDistance<<"cm"<<"MaxD="<<MaxD<<"cm"<<std::endl;
1014 
1015  if(extrapolatedDistance<=MaxD){
1016 
1017  if(debug) std::cout<<"CSC \t \t \t yes"<<std::endl;
1018 
1019  GlobalPoint GlobalPointExtrapolated=TheChamber->toGlobal(LocalPoint(X,Y,Z));
1020  if(debug) std::cout<<"CSC \t \t \t Point ExtraPolated in Global"<<GlobalPointExtrapolated<< std::endl;
1021 
1022 
1023  LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
1024 
1025  if(debug) std::cout<<"CSC \t \t \t Point Extrapolated in RPCLocal"<<PointExtrapolatedRPCFrame<< std::endl;
1026  if(debug) std::cout<<"CSC \t \t \t Corner of the Roll = ("<<rsize*0.5<<","<<stripl*0.5<<")"<<std::endl;
1027  if(debug) std::cout<<"CSC \t \t \t Info About the Point Extrapolated in X Abs ("<<fabs(PointExtrapolatedRPCFrame.x())<<","
1028  <<fabs(PointExtrapolatedRPCFrame.y())<<","<<fabs(PointExtrapolatedRPCFrame.z())<<")"<<std::endl;
1029  if(debug) std::cout<<"CSC \t \t \t dz="
1030  <<fabs(PointExtrapolatedRPCFrame.z())<<" dx="
1031  <<fabs(PointExtrapolatedRPCFrame.x())<<" dy="
1032  <<fabs(PointExtrapolatedRPCFrame.y())<<std::endl;
1033 
1034  if(debug) std::cout<<"CSC \t \t \t Does the extrapolation go inside this roll????"<<std::endl;
1035 
1036  if(fabs(PointExtrapolatedRPCFrame.z()) < 10. &&
1037  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
1038  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
1039 
1040  if(debug) std::cout<<"CSC \t \t \t \t yes"<<std::endl;
1041 
1042  RPCDetId rollId = rollasociated->id();
1043 
1044  RPCGeomServ rpcsrv(rollId);
1045  std::string nameRoll = rpcsrv.name();
1046  if(debug) std::cout<<"CSC \t \t \t \t The RPCName is "<<nameRoll<<std::endl;
1047 
1048  const float stripPredicted =
1049  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
1050 
1051  if(debug) std::cout<<"CSC \t \t \t \t \t Candidate"<<rollId<<" "<<"(from CSC Segment) STRIP---> "<<stripPredicted<< std::endl;
1052  //--------- HISTOGRAM STRIP PREDICTED FROM CSC -------------------
1053 
1054  std::map<std::string, MonitorElement*> meMap=meCollection[rpcId.rawId()];
1055 
1056  if(debug) std::cout<<"CSC \t \t \t \t Filling Expected"<<std::endl;
1057  sprintf(meIdCSC,"ExpectedOccupancyFromCSC_%d",rollId.rawId());
1058  meMap[meIdCSC]->Fill(stripPredicted);
1059  //--------------------------------------------------------------------
1060 
1061 
1062  //-------RecHitPart Just For Residual--------
1063  int cluSize = 0;
1064  int countRecHits = 0;
1065  float minres = 3000.;
1066 
1067  if(debug) std::cout<<"CSC \t \t \t \t \t Getting RecHits in Roll Asociated"<<std::endl;
1068  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
1069  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
1071 
1072  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
1073 
1074  sprintf(meIdRPC,"BXDistribution_%d",rollasociated->id().rawId());
1075  meMap[meIdRPC]->Fill(recHit->BunchX());
1076 
1077  countRecHits++;
1078  LocalPoint recHitPos=recHit->localPosition();
1079  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
1080  if(debug) std::cout<<"CSC \t \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction."<<std::endl;
1081  if(fabs(res)<fabs(minres)){
1082  minres=res;
1083  cluSize = recHit->clusterSize();
1084  if(debug) std::cout<<"CSC \t \t \t \t \t \t \t New Min Res "<<res<<"cm."<<std::endl;
1085  }
1086  }
1087 
1088  bool anycoincidence = false;
1089 
1090  if(countRecHits==0){
1091  if(debug) std::cout <<"CSC \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT"<<std::endl;
1092  }else{
1093  assert(minres!=3000);
1094 
1095  if(debug) std::cout<<"CSC \t \t \t \t \t PointExtrapolatedRPCFrame.x="<<PointExtrapolatedRPCFrame.x()<<" Minimal Residual"<<minres<<std::endl;
1096  if(debug) std::cout<<"CSC \t \t \t \t \t Minimal Residual less than stripw*rangestrips? minres="<<minres<<" range="<<rangestrips<<" stripw="<<stripw<<" cluSize"<<cluSize<<" <=compare minres with"<<(rangestrips+cluSize*0.5)*stripw<<std::endl;
1097  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
1098  if(debug) std::cout<<"CSC \t \t \t \t \t \t True!"<<std::endl;
1099  anycoincidence=true;
1100  }
1101  }
1102  if(anycoincidence){
1103  if(debug) std::cout<<"CSC \t \t \t \t \t At least one RecHit inside the range, Predicted="<<stripPredicted<<" minres="<<minres<<"cm range="<<rangestrips<<"strips stripw="<<stripw<<"cm"<<std::endl;
1104  if(debug) std::cout<<"CSC \t \t \t \t \t Norm of Cosine Directors="<<dx*dx+dy*dy+dz*dz<<"~1?"<<std::endl;
1105 
1106  float cosal = dx/sqrt(dx*dx+dz*dz);
1107  if(debug) std::cout<<"CSC \t \t \t \t \t Angle="<<acos(cosal)*180/3.1415926<<" degree"<<std::endl;
1108  if(debug) std::cout<<"CSC \t \t \t \t \t Filling the Residuals Histogram for globals with "<<minres<<"And the angular incidence with Cos Theta="<<-1*dz<<std::endl;
1109  if(rollId.ring()==2&&rollId.roll()==1){if(cluSize==1*dupli) hGlobalResClu1R2A->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2A->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2A->Fill(minres);}
1110  if(rollId.ring()==2&&rollId.roll()==2){if(cluSize==1*dupli) hGlobalResClu1R2B->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2B->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2B->Fill(minres);}
1111  if(rollId.ring()==2&&rollId.roll()==3){if(cluSize==1*dupli) hGlobalResClu1R2C->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R2C->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R2C->Fill(minres);}
1112  if(rollId.ring()==3&&rollId.roll()==1){if(cluSize==1*dupli) hGlobalResClu1R3A->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3A->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3A->Fill(minres);}
1113  if(rollId.ring()==3&&rollId.roll()==2){if(cluSize==1*dupli) hGlobalResClu1R3B->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3B->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3B->Fill(minres);}
1114  if(rollId.ring()==3&&rollId.roll()==3){if(cluSize==1*dupli) hGlobalResClu1R3C->Fill(minres); if(cluSize==2*dupli) hGlobalResClu2R3C->Fill(minres); if(cluSize==3*dupli) hGlobalResClu3R3C->Fill(minres);}
1115 
1116  sprintf(meIdRPC,"RPCDataOccupancyFromCSC_%d",rollId.rawId());
1117  if(debug) std::cout <<"CSC \t \t \t \t \t \t COINCEDENCE!!! Event="<<iEvent.id()<<"Filling RPC Data Occupancy for "<<meIdRPC<<" with "<<stripPredicted<<std::endl;
1118  meMap[meIdRPC]->Fill(stripPredicted);
1119  }
1120  else{
1121  RPCGeomServ rpcsrv(rollasociated->id());
1122  std::string nameRoll = rpcsrv.name();
1123  if(debug) std::cout<<"CSC \t \t \t \t \t \t A roll was ineficient in event"<<iEvent.id().event()<<std::endl;
1124  if(debug) ofrej<<"CSC \t EndCap "<<rpcRegion
1125  <<"\t cscStation "<<cscStation
1126  <<"\t cscRing "<<cscRing
1127  <<"\t cscChamber "<<cscChamber
1128  <<"\t Roll "<<nameRoll
1129  <<"\t Event "<<iEvent.id().event()
1130  <<"\t CSCId "<<CSCId
1131  <<"\t Event "
1132  <<iEvent.id().event()
1133  <<"\t Run "
1134  <<iEvent.id().run()
1135  <<std::endl;
1136  }
1137  }else{
1138  if(debug) std::cout<<"CSC \t \t \t \t No the prediction is outside of this roll"<<std::endl;
1139  }//Condition for the right match
1140  }else{//if extrapolation distance D is not too long
1141  if(debug) std::cout<<"CSC \t \t \t No, Exrtrapolation too long!, canceled"<<std::endl;
1142  }//D so big
1143  }//loop over the rolls asociated
1144  }//Condition over the startup geometry!!!!
1145  }//Is the segment 4D?
1146  }else{
1147  if(debug) std::cout<<"CSC \t \t More than one segment in this chamber, or we are in Station Ring 1 or in Station 4"<<std::endl;
1148  }
1149  }
1150  }else{
1151  if(debug) std::cout<<"CSC This Event doesn't have any CSCSegment"<<std::endl;
1152  }
1153  }
1154  }
1155  }
1156 }
1157 
1158 
1159 void RPCEfficiency::endRun(const edm::Run& r, const edm::EventSetup& iSetup){
1160  if (EffSaveRootFile){
1162  }
1163 }
1164 
1165 
1167  dbe =0;
1168 }
const double Z[kNumberCalorimeter]
RunNumber_t run() const
Definition: EventID.h:42
int chamber() const
Definition: CSCDetId.h:70
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T getParameter(std::string const &) const
EventNumber_t event() const
Definition: EventID.h:44
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
T getUntrackedParameter(std::string const &, T const &) const
MonitorElement * hGlobalResClu1La3
const Topology & topology() const
Definition: RPCRoll.cc:30
virtual void endJob()
edm::ESHandle< RPCGeometry > rpcGeo
T perp() const
Definition: PV3DBase.h:66
MonitorElement * hGlobalResClu1R2A
virtual float stripLength() const
RPCEfficiency(const edm::ParameterSet &)
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
MonitorElement * hGlobalResClu1R3A
std::string muonRPCDigis
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:49
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:1883
std::map< std::string, MonitorElement * > bookDetUnitSeg(RPCDetId &detId, int nstrips, std::string folder)
int nstrips() const
Definition: RPCRoll.cc:46
MonitorElement * hGlobalResClu3R2C
T y() const
Definition: PV3DBase.h:57
#define X(str)
Definition: MuonsGrabber.cc:49
#define abs(x)
Definition: mlp_lapack.h:159
MonitorElement * hGlobalResClu3La1
MonitorElement * hGlobalResClu3R3C
MonitorElement * hGlobalResClu2La2
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:64
virtual void beginJob()
std::map< int, std::map< std::string, MonitorElement * > > meCollection
std::ofstream ofrej
int distsector(int sector1, int sector2)
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int endcap() const
Definition: CSCDetId.h:95
T barePhi() const
Definition: PV3DBase.h:62
DQMStore * dbe
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
std::string EffRootFileName
RPCDetId id() const
Definition: RPCRoll.cc:24
int iEvent
Definition: GenABIO.cc:243
virtual std::string name()
Definition: RPCGeomServ.cc:15
MonitorElement * hGlobalResClu3La3
int roll() const
Definition: RPCDetId.h:122
edm::ESHandle< DTGeometry > dtGeo
MonitorElement * hGlobalResClu1La6
virtual void endRun(const edm::Run &r, const edm::EventSetup &iSetup)
int ring() const
Definition: RPCDetId.h:74
T sqrt(T t)
Definition: SSEVec.h:28
LocalPoint toLocal(const GlobalPoint &gp) const
std::string dt4DSegments
std::string folderPath
T z() const
Definition: PV3DBase.h:58
MonitorElement * hGlobalResClu3R2A
MonitorElement * hGlobalResClu2La5
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:70
double rangestripsRB4
MonitorElement * hGlobalResClu1La4
MonitorElement * hGlobalResClu1R3B
MonitorElement * hGlobalResClu1R2C
MonitorElement * hGlobalResClu2R3C
MonitorElement * hGlobalResClu3R3A
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:359
std::map< CSCStationIndex, std::set< RPCDetId > > rollstoreCSC
MonitorElement * statistics
MonitorElement * hGlobalResClu2La4
std::string nameInLog
std::map< DTStationIndex, std::set< RPCDetId > > rollstoreDT
MonitorElement * hGlobalResClu1La1
edm::ESHandle< CSCGeometry > cscGeo
int ring() const
Definition: CSCDetId.h:77
MonitorElement * hGlobalResClu2La6
int layer() const
Definition: RPCDetId.h:110
virtual int segment()
Definition: RPCGeomServ.cc:375
MonitorElement * hGlobalResClu2R2A
MonitorElement * hGlobalResClu2R3A
const T & get() const
Definition: EventSetup.h:55
edm::InputTag RPCRecHitLabel_
virtual LocalPoint localPosition(float strip) const
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:104
double rangestrips
edm::EventID id() const
Definition: EventBase.h:56
MonitorElement * hGlobalResClu3La2
int sector() const
Definition: DTChamberId.h:63
MonitorElement * hGlobalResClu3La5
MonitorElement * hGlobalResClu2La1
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
MonitorElement * hGlobalResClu2La3
MonitorElement * hGlobalResClu3La6
virtual void analyze(const edm::Event &, const edm::EventSetup &)
int station() const
Definition: CSCDetId.h:88
tuple cout
Definition: gather_cfg.py:41
MonitorElement * hGlobalResClu1R3C
MonitorElement * hGlobalResClu2R2B
virtual LocalPoint localPosition(float strip) const
int station() const
Return the station number.
Definition: DTChamberId.h:53
MonitorElement * hGlobalResClu3R3B
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
T x() const
Definition: PV3DBase.h:56
virtual void beginRun(const edm::Run &, const edm::EventSetup &)
virtual float stripLength() const
det heigth (strip length in the middle)
MonitorElement * hGlobalResClu1La5
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
MonitorElement * hGlobalResClu3R2B
std::string cscSegments
MonitorElement * hGlobalResClu2R3B
MonitorElement * hGlobalResClu3La4
MonitorElement * hGlobalResClu1R2B
MonitorElement * hGlobalResClu2R2C
MonitorElement * hGlobalResClu1La2
Definition: Run.h:31
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:65
int station() const
Definition: RPCDetId.h:98