CMS 3D CMS Logo

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

#include <RPCEfficiency.h>

Inheritance diagram for RPCEfficiency:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
void bookDetUnitSeg (RPCDetId &detId, int nstrips, std::string folder, std::map< std::string, MonitorElement * > &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &r, const edm::EventSetup &iSetup)
 
 RPCEfficiency (const edm::ParameterSet &)
 
 ~RPCEfficiency ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

MonitorElementhGlobalResClu1La [6]
 
MonitorElementhGlobalResClu1R2A
 
MonitorElementhGlobalResClu1R2B
 
MonitorElementhGlobalResClu1R2C
 
MonitorElementhGlobalResClu1R3A
 
MonitorElementhGlobalResClu1R3B
 
MonitorElementhGlobalResClu1R3C
 
MonitorElementhGlobalResClu2La [6]
 
MonitorElementhGlobalResClu2R2A
 
MonitorElementhGlobalResClu2R2B
 
MonitorElementhGlobalResClu2R2C
 
MonitorElementhGlobalResClu2R3A
 
MonitorElementhGlobalResClu2R3B
 
MonitorElementhGlobalResClu2R3C
 
MonitorElementhGlobalResClu3La [6]
 
MonitorElementhGlobalResClu3R2A
 
MonitorElementhGlobalResClu3R2B
 
MonitorElementhGlobalResClu3R2C
 
MonitorElementhGlobalResClu3R3A
 
MonitorElementhGlobalResClu3R3B
 
MonitorElementhGlobalResClu3R3C
 
std::map< CSCStationIndex,
std::set< RPCDetId > > 
rollstoreCSC
 
std::map< DTStationIndex,
std::set< RPCDetId > > 
rollstoreDT
 
MonitorElementstatistics
 

Private Attributes

std::vector< std::map
< RPCDetId, int > > 
counter
 
edm::EDGetTokenT
< CSCSegmentCollection
cscSegments
 
DQMStoredbe
 
bool debug
 
edm::EDGetTokenT
< DTRecSegment4DCollection
dt4DSegments
 
int dupli
 
std::string EffRootFileName
 
bool EffSaveRootFile
 
std::string folderPath
 
bool inclcsc
 
bool incldt
 
bool incldtMB4
 
bool inves
 
double MaxD
 
double MaxDrb4
 
std::map< int, std::map
< std::string, MonitorElement * > > 
meCollection
 
double MinCosAng
 
double rangestrips
 
double rangestripsRB4
 
std::string rollseff
 
edm::EDGetTokenT
< RPCRecHitCollection
RPCRecHitLabel_
 
std::vector< int > totalcounter
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Class for RPC Monitoring using RPCDigi and DT and CSC Segments.

Author
Camilo Carrillo (Uniandes)

Definition at line 101 of file RPCEfficiency.h.

Constructor & Destructor Documentation

RPCEfficiency::RPCEfficiency ( const edm::ParameterSet iConfig)
explicit

Definition at line 39 of file RPCEfficiency.cc.

References cscSegments, debug, dt4DSegments, dupli, EffRootFileName, EffSaveRootFile, folderPath, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), inclcsc, incldt, incldtMB4, MaxD, MaxDrb4, MinCosAng, rangestrips, rangestripsRB4, RPCRecHitLabel_, and AlCaHLTBitMon_QueryRunRegistry::string.

39  {
40  incldt=iConfig.getUntrackedParameter<bool>("incldt",true);
41  incldtMB4=iConfig.getUntrackedParameter<bool>("incldtMB4",true);
42  inclcsc=iConfig.getUntrackedParameter<bool>("inclcsc",true);
43  debug=iConfig.getUntrackedParameter<bool>("debug",false);
44 
45  rangestrips = iConfig.getUntrackedParameter<double>("rangestrips",4.);
46  rangestripsRB4=iConfig.getUntrackedParameter<double>("rangestripsRB4",4.);
47  dupli = iConfig.getUntrackedParameter<int>("DuplicationCorrection",2);
48  MinCosAng=iConfig.getUntrackedParameter<double>("MinCosAng",0.96);
49  MaxD=iConfig.getUntrackedParameter<double>("MaxD",80.);
50  MaxDrb4=iConfig.getUntrackedParameter<double>("MaxDrb4",150.);
51 
52 
53  cscSegments= consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("cscSegments"));
54  dt4DSegments = consumes<DTRecSegment4DCollection>(iConfig.getParameter<edm::InputTag>("dt4DSegments"));
55  RPCRecHitLabel_ = consumes<RPCRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitLabel"));
56 
57  folderPath=iConfig.getUntrackedParameter<std::string>("folderPath","RPC/RPCEfficiency/");
58 
59  EffSaveRootFile = iConfig.getUntrackedParameter<bool>("EffSaveRootFile", false);
60  EffRootFileName = iConfig.getUntrackedParameter<std::string>("EffRootFileName", "RPCEfficiency.root");
61 
62 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
std::string EffRootFileName
edm::EDGetTokenT< RPCRecHitCollection > RPCRecHitLabel_
std::string folderPath
double rangestripsRB4
edm::EDGetTokenT< CSCSegmentCollection > cscSegments
edm::EDGetTokenT< DTRecSegment4DCollection > dt4DSegments
double rangestrips
RPCEfficiency::~RPCEfficiency ( )

Definition at line 251 of file RPCEfficiency.cc.

251 {}

Member Function Documentation

void RPCEfficiency::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 253 of file RPCEfficiency.cc.

References CSCDetId::chamber(), cscSegments, distsector_tmp(), dt4DSegments, dupli, CSCDetId::endcap(), MonitorElement::Fill(), edm::EventSetup::get(), edm::Event::getByToken(), hGlobalResClu1La, hGlobalResClu1R2A, hGlobalResClu1R2B, hGlobalResClu1R2C, hGlobalResClu1R3A, hGlobalResClu1R3B, hGlobalResClu1R3C, hGlobalResClu2La, hGlobalResClu2R2A, hGlobalResClu2R2B, hGlobalResClu2R2C, hGlobalResClu2R3A, hGlobalResClu2R3B, hGlobalResClu2R3C, hGlobalResClu3La, hGlobalResClu3R2A, hGlobalResClu3R2B, hGlobalResClu3R2C, hGlobalResClu3R3A, hGlobalResClu3R3B, hGlobalResClu3R3C, RPCRoll::id(), CSCChamber::id(), inclcsc, incldt, incldtMB4, edm::HandleBase::isValid(), RPCDetId::layer(), LogDebug, MaxD, MaxDrb4, meCollection, MinCosAng, RPCGeomServ::name(), RPCRoll::nstrips(), rangestrips, DetId::rawId(), RPCDetId::ring(), CSCDetId::ring(), RPCDetId::roll(), rollstoreCSC, rollstoreDT, RPCRecHitLabel_, DTChamberId::sector(), mathSSE::sqrt(), DTChamberId::station(), CSCDetId::station(), RPCDetId::station(), statistics, AlCaHLTBitMon_QueryRunRegistry::string, RPCRoll::strip(), GeomDet::surface(), GeomDet::toGlobal(), GeomDet::toLocal(), RPCRoll::topology(), DTChamberId::wheel(), X, PV3DBase< T, PVType, FrameType >::x(), SiStripMonitorClusterAlca_cfi::xmax, SiStripMonitorClusterAlca_cfi::xmin, PV3DBase< T, PVType, FrameType >::y(), Gflash::Z, and PV3DBase< T, PVType, FrameType >::z().

253  {
254 
255 
259 
260  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
261  iSetup.get<MuonGeometryRecord>().get(dtGeo);
262  iSetup.get<MuonGeometryRecord>().get(cscGeo);
263 
264  statistics->Fill(1);
265 
266  std::stringstream meIdRPC, meIdDT, meIdCSC;
267 
268  LogDebug("rpcefficiency") <<"\t Getting the RPC RecHits";
270  iEvent.getByToken(RPCRecHitLabel_,rpcHits);
271 
272  if(!rpcHits.isValid()) return;
273 
274  if(incldt){
275  LogDebug("rpcefficiency")<<"\t Getting the DT Segments";
277 
278  iEvent.getByToken(dt4DSegments, all4DSegments);
279 
280  if(all4DSegments.isValid()){
281 
282  if(all4DSegments->size()>0){
283 
284  if(all4DSegments->size()<=16) statistics->Fill(2);
285 
286  LogDebug("rpcefficiency")<<"\t Number of DT Segments in this event = "<<all4DSegments->size();
287 
288  std::map<DTChamberId,int> DTSegmentCounter;
290 
291  for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){
292  DTSegmentCounter[segment->chamberId()]++;
293  }
294 
295  statistics->Fill(all4DSegments->size()+2);
296 
297  LogDebug("rpcefficiency")<<"\t Loop over all the 4D Segments";
298  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){
299 
300  DTChamberId DTId = segment->chamberId();
301 
302 
303  if(DTSegmentCounter[DTId]==1 && DTId.station()!=4){
304 
305  int dtWheel = DTId.wheel();
306  int dtStation = DTId.station();
307  int dtSector = DTId.sector();
308 
309  LocalPoint segmentPosition= segment->localPosition();
310  LocalVector segmentDirection=segment->localDirection();
311 
312  const GeomDet* gdet=dtGeo->idToDet(segment->geographicalId());
313  const BoundPlane & DTSurface = gdet->surface();
314 
315  //check if the dimension of the segment is 4
316 
317  if(segment->dimension()==4){
318 
319  float Xo=segmentPosition.x();
320  float Yo=segmentPosition.y();
321  float Zo=segmentPosition.z();
322  float dx=segmentDirection.x();
323  float dy=segmentDirection.y();
324  float dz=segmentDirection.z();
325 
326  std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,dtStation)];
327 
328  LogDebug("rpcefficiency")<<"DT \t \t Loop over all the rolls asociated to this DT";
329  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){
330  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll);
331  RPCDetId rpcId = rollasociated->id();
332  const BoundPlane & RPCSurface = rollasociated->surface();
333 
334 // RPCGeomServ rpcsrv(rpcId);
335 // std::string nameRoll = rpcsrv.name();
336 
337  GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0));
338 
339  LocalPoint CenterRollinDTFrame = DTSurface.toLocal(CenterPointRollGlobal);
340 
341  float D=CenterRollinDTFrame.z();
342 
343  float X=Xo+dx*D/dz;
344  float Y=Yo+dy*D/dz;
345  float Z=D;
346 
347  const RectangularStripTopology* top_= dynamic_cast<const RectangularStripTopology*> (&(rollasociated->topology()));
348  LocalPoint xmin = top_->localPosition(0.);
349  LogDebug("rpcefficiency")<<"DT \t \t \t xmin of this Roll "<<xmin<<"cm";
350  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
351  LogDebug("rpcefficiency")<<"DT \t \t \t xmax of this Roll "<<xmax<<"cm";
352  float rsize = fabs( xmax.x()-xmin.x() );
353  LogDebug("rpcefficiency")<<"DT \t \t \t Roll Size "<<rsize<<"cm";
354  float stripl = top_->stripLength();
355  float stripw = top_->pitch();
356 
357  float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo));
358 
359  if(extrapolatedDistance<=MaxD){
360 
361  GlobalPoint GlobalPointExtrapolated = DTSurface.toGlobal(LocalPoint(X,Y,Z));
362  LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
363 
364  if(fabs(PointExtrapolatedRPCFrame.z()) < 10. &&
365  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
366  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
367 
368  RPCDetId rollId = rollasociated->id();
369  RPCGeomServ rpcsrv(rollId);
370  std::string nameRoll = rpcsrv.name();
371  LogDebug("rpcefficiency")<<"DT \t \t \t \t The RPCName is "<<nameRoll;
372  const float stripPredicted =
373  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
374 
375  LogDebug("rpcefficiency")<<"DT \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl;
376  //---- HISTOGRAM STRIP PREDICTED FROM DT ----
377 
378  std::map<std::string, MonitorElement*> meMap=meCollection[rpcId.rawId()];
379  meIdDT.str("");
380  meIdDT<<"ExpectedOccupancyFromDT_"<<rollId.rawId();
381  meMap[meIdDT.str()]->Fill(stripPredicted);
382  //-----------------------------------------------------
383 
384 
385  //-------RecHitPart Just For Residual--------
386  int countRecHits = 0;
387  int cluSize = 0;
388  float minres = 3000.;
389 
390  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
391  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
393 
394  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
395  countRecHits++;
396 
397  // sprintf(meIdRPC,"BXDistribution_%d",rollasociated->id().rawId());
398 // meMap[meIdRPC]->Fill(recHit->BunchX());
399 
400  LocalPoint recHitPos=recHit->localPosition();
401  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
402  LogDebug("rpcefficiency")<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction.";
403  if(fabs(res)<fabs(minres)){
404  minres=res;
405  cluSize = recHit->clusterSize();
406  LogDebug("rpcefficiency")<<"DT \t \t \t \t \t \t New Min Res "<<res<<"cm.";
407  }
408  }
409 
410  if(countRecHits==0){
411  LogDebug("rpcefficiency") <<"DT \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT";
412  }else{
413  assert(minres!=3000);
414 
415  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
416  LogDebug("rpcefficiency")<<"DT \t \t \t \t \t \t True!";
417 
418  // float cosal = dx/sqrt(dx*dx+dz*dz);
419 
420  if(rollId.station()==1&&rollId.layer()==1) {
421  if(cluSize==1*dupli) {hGlobalResClu1La[0]->Fill(minres);}
422  else if(cluSize==2*dupli){ hGlobalResClu2La[0]->Fill(minres);}
423  else if(cluSize==3*dupli){ hGlobalResClu3La[0]->Fill(minres);}}
424  else if(rollId.station()==1&&rollId.layer()==2){
425  if(cluSize==1*dupli) {hGlobalResClu1La[1]->Fill(minres);}
426  else if(cluSize==2*dupli){ hGlobalResClu2La[1]->Fill(minres);}
427  else if(cluSize==3*dupli){ hGlobalResClu3La[1]->Fill(minres);}}
428  else if(rollId.station()==2&&rollId.layer()==1){
429  if(cluSize==1*dupli) {hGlobalResClu1La[2]->Fill(minres);}
430  else if(cluSize==2*dupli){ hGlobalResClu2La[2]->Fill(minres);}
431  else if(cluSize==3*dupli){ hGlobalResClu3La[2]->Fill(minres);}
432  }
433  else if(rollId.station()==2&&rollId.layer()==2){
434  if(cluSize==1*dupli) {hGlobalResClu1La[3]->Fill(minres);}
435  if(cluSize==2*dupli){ hGlobalResClu2La[3]->Fill(minres);}
436  else if(cluSize==3*dupli){ hGlobalResClu3La[3]->Fill(minres);}
437  }
438  else if(rollId.station()==3){
439  if(cluSize==1*dupli) {hGlobalResClu1La[4]->Fill(minres);}
440  else if(cluSize==2*dupli){ hGlobalResClu2La[4]->Fill(minres);}
441  else if(cluSize==3*dupli){ hGlobalResClu3La[4]->Fill(minres);}
442  }
443  meIdRPC.str("");
444  meIdRPC<<"RPCDataOccupancyFromDT_"<<rollId.rawId();
445  meMap[meIdRPC.str()]->Fill(stripPredicted);
446  }
447  }
448  }else{
449  LogDebug("rpcefficiency")<<"DT \t \t \t \t No the prediction is outside of this roll";
450  }//Condition for the right match
451  }else{
452  LogDebug("rpcefficiency")<<"DT \t \t \t No, Exrtrapolation too long!, canceled";
453  }//D so big
454  }//loop over all the rolls asociated
455  }//Is the segment 4D?
456  }else {
457  LogDebug("rpcefficiency")<<"DT \t \t More than one segment in this chamber, or we are in Station 4";
458  }
459  }
460  } else {
461  LogDebug("rpcefficiency")<<"DT This Event doesn't have any DT4DDSegment"; //is ther more than 1 segment in this event?
462  }
463  }
464  }
465 
466  if(incldtMB4){
468  iEvent.getByToken(dt4DSegments, all4DSegments);
469 
470  if(all4DSegments.isValid() && all4DSegments->size()>0){
471 
472  std::map<DTChamberId,int> DTSegmentCounter;
474 
475  for (segment = all4DSegments->begin();segment!=all4DSegments->end(); ++segment){
476  DTSegmentCounter[segment->chamberId()]++;
477  }
478 
479  LogDebug("rpcefficiency")<<"MB4 \t \t Loop Over all4DSegments";
480  for (segment = all4DSegments->begin(); segment != all4DSegments->end(); ++segment){
481 
482  DTChamberId DTId = segment->chamberId();
483 
484  if(DTSegmentCounter[DTId] == 1 && DTId.station()==4){
485  int dtWheel = DTId.wheel();
486  int dtStation = DTId.station();
487  int dtSector = DTId.sector();
488 
489  LocalPoint segmentPosition= segment->localPosition();
490  LocalVector segmentDirection=segment->localDirection();
491 
492  //check if the dimension of the segment is 2 and the station is 4
493 
494  if(segment->dimension()==2){
495  LocalVector segmentDirectionMB4=segmentDirection;
496  LocalPoint segmentPositionMB4=segmentPosition;
497 
498 
499  const BoundPlane& DTSurface4 = dtGeo->idToDet(DTId)->surface();
500 
502 
503  for(segMB3=all4DSegments->begin();segMB3!=all4DSegments->end();++segMB3){
504 
505  DTChamberId dtid3 = segMB3->chamberId();
506 
507  if(distsector_tmp(dtid3.sector(),DTId.sector())<=1
508  && dtid3.station()==3
509  && dtid3.wheel()==DTId.wheel()
510  && DTSegmentCounter[dtid3] == 1
511  && segMB3->dimension()==4){
512 
513  const GeomDet* gdet3=dtGeo->idToDet(segMB3->geographicalId());
514  const BoundPlane & DTSurface3 = gdet3->surface();
515 
516  LocalVector segmentDirectionMB3 = segMB3->localDirection();
517  GlobalPoint segmentPositionMB3inGlobal = DTSurface3.toGlobal(segMB3->localPosition());
518 
519  GlobalVector segDirMB4inGlobalFrame=DTSurface4.toGlobal(segmentDirectionMB4);
520  GlobalVector segDirMB3inGlobalFrame=DTSurface3.toGlobal(segmentDirectionMB3);
521 
522  float dx=segDirMB4inGlobalFrame.x();
523  float dy=segDirMB4inGlobalFrame.y();
524  // float dz=segDirMB4inGlobalFrame.z();
525 
526  float dx3=segDirMB3inGlobalFrame.x();
527  float dy3=segDirMB3inGlobalFrame.y();
528  // float dz3=segDirMB3inGlobalFrame.z();
529 
530  double cosAng=fabs(dx*dx3+dy*dy3/sqrt((dx3*dx3+dy3*dy3)*(dx*dx+dy*dy)));
531 
532  if(cosAng>MinCosAng){
533  if(dtSector==13){
534  dtSector=4;
535  }
536  if(dtSector==14){
537  dtSector=10;
538  }
539 
540  std::set<RPCDetId> rollsForThisDT = rollstoreDT[DTStationIndex(0,dtWheel,dtSector,dtStation)]; //It should be always 4
541 
542  assert(rollsForThisDT.size()>=1);
543 
544  for (std::set<RPCDetId>::iterator iteraRoll=rollsForThisDT.begin();iteraRoll != rollsForThisDT.end(); iteraRoll++){
545  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll); //roll asociado a MB4
546  const BoundPlane & RPCSurfaceRB4 = rollasociated->surface(); //surface MB4
547 
548  // RPCGeomServ rpcsrv(rpcId);
549  // std::string nameRoll = rpcsrv.name();
550 
551  GlobalPoint CenterPointRollGlobal=RPCSurfaceRB4.toGlobal(LocalPoint(0,0,0));
552  LocalPoint CenterRollinMB4Frame = DTSurface4.toLocal(CenterPointRollGlobal); //In MB4
553  LocalPoint segmentPositionMB3inMB4Frame = DTSurface4.toLocal(segmentPositionMB3inGlobal); //In MB4
554  LocalVector segmentDirectionMB3inMB4Frame = DTSurface4.toLocal(segDirMB3inGlobalFrame); //In MB4
555 
556  //The exptrapolation is done in MB4 frame. for local x and z is done from MB4,
557  float Dxz=CenterRollinMB4Frame.z();
558  float Xo4=segmentPositionMB4.x();
559  float dxl=segmentDirectionMB4.x(); //dx local for MB4 segment in MB4 Frame
560  float dzl=segmentDirectionMB4.z(); //dx local for MB4 segment in MB4 Frame
561 
562  float X=Xo4+dxl*Dxz/dzl; //In MB4 frame
563  float Z=Dxz;//In MB4 frame
564 
565  //for local y is done from MB3
566  float Yo34=segmentPositionMB3inMB4Frame.y();
567  float dy34 = segmentDirectionMB3inMB4Frame.y();
568  float dz34 = segmentDirectionMB3inMB4Frame.z();
569  float Dy=Dxz-(segmentPositionMB3inMB4Frame.z()); //Distance beetween the segment in MB3 and the RB4 surface
570 
571  float Y=Yo34+dy34*Dy/dz34;//In MB4 Frame
572 
573  const RectangularStripTopology* top_
574  =dynamic_cast<const RectangularStripTopology*>(&(rollasociated->topology())); //Topology roll asociated MB4
575  LocalPoint xmin = top_->localPosition(0.);
576  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
577  float rsize = fabs( xmax.x()-xmin.x() );
578  float stripl = top_->stripLength();
579  float stripw = top_->pitch();
580 
581  float extrapolatedDistance = sqrt((Y-Yo34)*(Y-Yo34)+Dy*Dy);
582 
583  if(extrapolatedDistance<=MaxDrb4){
584 
585  GlobalPoint GlobalPointExtrapolated = DTSurface4.toGlobal(LocalPoint(X,Y,Z));
586  LocalPoint PointExtrapolatedRPCFrame = RPCSurfaceRB4.toLocal(GlobalPointExtrapolated);
587 
588  if(fabs(PointExtrapolatedRPCFrame.z()) < 5. &&
589  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
590  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
591 
592  RPCDetId rollId = rollasociated->id();
593 
594  // RPCGeomServ rpcsrv(rollId);
595 // std::string nameRoll = rpcsrv.name();
596 // LogDebug("rpcefficiency")<<"MB4 \t \t \t \t \t The RPCName is "<<nameRoll;
597  const float stripPredicted=
598  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
599 
600  LogDebug("rpcefficiency")<<"MB4 \t \t \t \t Candidate (from DT Segment) STRIP---> "<<stripPredicted<< std::endl;
601  //--------- HISTOGRAM STRIP PREDICTED FROM DT MB4 -------------------
602 
603  std::map<std::string, MonitorElement*> meMap=meCollection[rollId.rawId()];
604 
605  meIdDT.str("");
606  meIdDT<<"ExpectedOccupancyFromDT_"<<rollId.rawId();
607  meMap[meIdDT.str()]->Fill(stripPredicted);
608  //-------------------------------------------------
609 
610 
611  //-------RecHitPart Just For Residual--------
612  int countRecHits = 0;
613  int cluSize = 0;
614  float minres = 3000.;
615 
616  LogDebug("rpcefficiency")<<"MB4 \t \t \t \t Getting RecHits in Roll Asociated";
617  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
618  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
620 
621  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
622  countRecHits++;
623  LocalPoint recHitPos=recHit->localPosition();
624  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
625  LogDebug("rpcefficiency")<<"DT \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction.";
626  if(fabs(res)<fabs(minres)){
627  minres=res;
628  cluSize = recHit->clusterSize();
629  }
630  }
631 
632  if(countRecHits==0){
633  LogDebug("rpcefficiency") <<"MB4 \t \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT";
634  }else{
635  assert(minres!=3000);
636 
637  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
638  assert(rollId.station()==4);
639  if(cluSize==1*dupli){ hGlobalResClu1La[5]->Fill(minres);}
640  else if(cluSize==2*dupli){ hGlobalResClu2La[5]->Fill(minres);}
641  else if(cluSize==3*dupli){ hGlobalResClu3La[5]->Fill(minres);}
642 
643  meIdRPC.str("");
644  meIdRPC<<"RPCDataOccupancyFromDT_"<<rollId.rawId();
645  meMap[meIdRPC.str()]->Fill(stripPredicted);
646  }
647  }
648  }else{
649  LogDebug("rpcefficiency")<<"MB4 \t \t \t \t No the prediction is outside of this roll";
650  }
651  }//Condition for the right match
652  else{
653  LogDebug("rpcefficiency")<<"MB4 \t \t \t No, Exrtrapolation too long!, canceled";
654  }
655  }//loop over all the rollsasociated
656  }else{
657  LogDebug("rpcefficiency")<<"MB4 \t \t \t \t I found segments in MB4 and MB3 adjacent or same wheel and sector but not compatibles Diferent Directions";
658  }
659  }else{//if dtid3.station()==3&&dtid3.sector()==DTId.sector()&&dtid3.wheel()==DTId.wheel()&&segMB3->dim()==4
660  LogDebug("rpcefficiency")<<"MB4 \t \t \t No the same station or same wheel or segment dim in mb3 not 4D";
661  }
662  }//loop over all the segments looking for one in MB3
663  }else{
664  LogDebug("rpcefficiency")<<"MB4 \t \t \t Is NOT a 2D Segment";
665  }
666  }else{
667  LogDebug("rpcefficiency")<<"MB4 \t \t \t \t There is not just one segment or is not in station 4";
668  }//De aca para abajo esta en dtpart.inl
669  }
670  }else{
671  LogDebug("rpcefficiency")<<"MB4 \t This event doesn't have 4D Segment";
672  }
673 
674  }
675 
676 
677  if(inclcsc){
678  LogDebug("rpcefficiency") <<"\t Getting the CSC Segments";
679  edm::Handle<CSCSegmentCollection> allCSCSegments;
680 
681  iEvent.getByToken(cscSegments, allCSCSegments);
682 
683  if(allCSCSegments.isValid()){
684  if(allCSCSegments->size()>0){
685  statistics->Fill(18);
686 
687  LogDebug("rpcefficiency")<<"CSC \t Number of CSC Segments in this event = "<<allCSCSegments->size();
688 
689  std::map<CSCDetId,int> CSCSegmentsCounter;
691 
692  int segmentsInThisEventInTheEndcap=0;
693 
694  for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){
695  CSCSegmentsCounter[segment->cscDetId()]++;
696  segmentsInThisEventInTheEndcap++;
697  }
698 
699  statistics->Fill(allCSCSegments->size()+18);
700 
701  LogDebug("rpcefficiency")<<"CSC \t loop over all the CSCSegments ";
702  for (segment = allCSCSegments->begin();segment!=allCSCSegments->end(); ++segment){
703  CSCDetId CSCId = segment->cscDetId();
704 
705  if(CSCSegmentsCounter[CSCId]==1 && CSCId.station()!=4 && CSCId.ring()!=1 && allCSCSegments->size()>=2){
706  LogDebug("rpcefficiency")<<"CSC \t \t yes";
707  int cscEndCap = CSCId.endcap();
708  int cscStation = CSCId.station();
709  int cscRing = CSCId.ring();
710  // int cscChamber = CSCId.chamber();
711  int rpcRegion = 1; if(cscEndCap==2) rpcRegion= -1;//Relacion entre las endcaps
712  int rpcRing = cscRing;
713  if(cscRing==4)rpcRing =1;
714  int rpcStation = cscStation;
715  int rpcSegment = CSCId.chamber();
716 
717  LocalPoint segmentPosition= segment->localPosition();
718  LocalVector segmentDirection=segment->localDirection();
719  float dz=segmentDirection.z();
720 
721  LogDebug("rpcefficiency")<<"CSC \t \t Is a good Segment? dim = 4, 4 <= nRecHits <= 10 Incident angle int range 45 < "<<acos(dz)*180/3.1415926<<" < 135? ";
722 
723  if(segment->dimension()==4 && (segment->nRecHits()<=10 && segment->nRecHits()>=4)&& acos(dz)*180/3.1415926 > 45. && acos(dz)*180/3.1415926 < 160. ){
724 
725  float Xo=segmentPosition.x();
726  float Yo=segmentPosition.y();
727  float Zo=segmentPosition.z();
728  float dx=segmentDirection.x();
729  float dy=segmentDirection.y();
730  float dz=segmentDirection.z();
731 
732 
733  LogDebug("rpcefficiency")<<"CSC \t \t Getting chamber from Geometry";
734  const CSCChamber* TheChamber=cscGeo->chamber(CSCId);
735  LogDebug("rpcefficiency")<<"CSC \t \t Getting ID from Chamber";
736  const CSCDetId TheId=TheChamber->id();
737  LogDebug("rpcefficiency")<<"CSC \t \t Printing The Id"<<TheId;
738  std::set<RPCDetId> rollsForThisCSC = rollstoreCSC[CSCStationIndex(rpcRegion,rpcStation,rpcRing,rpcSegment)];
739  LogDebug("rpcefficiency")<<"CSC \t \t Number of rolls for this CSC = "<<rollsForThisCSC.size();
740 
741  if(rpcRing!=1&&rpcStation!=4){
742 
743  //Loop over all the rolls
744  for (std::set<RPCDetId>::iterator iteraRoll = rollsForThisCSC.begin();iteraRoll != rollsForThisCSC.end(); iteraRoll++){
745 
746  const RPCRoll* rollasociated = rpcGeo->roll(*iteraRoll);
747  RPCDetId rpcId = rollasociated->id();
748 
749  const BoundPlane & RPCSurface = rollasociated->surface();
750 
751  GlobalPoint CenterPointRollGlobal = RPCSurface.toGlobal(LocalPoint(0,0,0));
752  LocalPoint CenterRollinCSCFrame = TheChamber->toLocal(CenterPointRollGlobal);
753 
754  float D=CenterRollinCSCFrame.z();
755 
756  float X=Xo+dx*D/dz;
757  float Y=Yo+dy*D/dz;
758  float Z=D;
759 
760  const TrapezoidalStripTopology* top_=dynamic_cast<const TrapezoidalStripTopology*>(&(rollasociated->topology()));
761  LocalPoint xmin = top_->localPosition(0.);
762  LogDebug("rpcefficiency")<<"CSC \t \t \t xmin of this Roll "<<xmin<<"cm";
763  LocalPoint xmax = top_->localPosition((float)rollasociated->nstrips());
764  LogDebug("rpcefficiency")<<"CSC \t \t \t xmax of this Roll "<<xmax<<"cm";
765  float rsize = fabs( xmax.x()-xmin.x() );
766  LogDebug("rpcefficiency")<<"CSC \t \t \t Roll Size "<<rsize<<"cm";
767  float stripl = top_->stripLength();
768  float stripw = top_->pitch();
769 
770 
771  float extrapolatedDistance = sqrt((X-Xo)*(X-Xo)+(Y-Yo)*(Y-Yo)+(Z-Zo)*(Z-Zo));
772 
773 
774  if(extrapolatedDistance<=MaxD){
775 
776  GlobalPoint GlobalPointExtrapolated=TheChamber->toGlobal(LocalPoint(X,Y,Z));
777  LocalPoint PointExtrapolatedRPCFrame = RPCSurface.toLocal(GlobalPointExtrapolated);
778 
779 
780  if(fabs(PointExtrapolatedRPCFrame.z()) < 10. &&
781  fabs(PointExtrapolatedRPCFrame.x()) < rsize*0.5 &&
782  fabs(PointExtrapolatedRPCFrame.y()) < stripl*0.5){
783 
784  RPCDetId rollId = rollasociated->id();
785  RPCGeomServ rpcsrv(rollId);
786  std::string nameRoll = rpcsrv.name();
787 
788  LogDebug("rpcefficiency")<<"CSC \t \t \t \t The RPCName is "<<nameRoll;
789 
790  const float stripPredicted =
791  rollasociated->strip(LocalPoint(PointExtrapolatedRPCFrame.x(),PointExtrapolatedRPCFrame.y(),0.));
792 
793  LogDebug("rpcefficiency")<<"CSC \t \t \t \t \t Candidate"<<rollId<<" "<<"(from CSC Segment) STRIP---> "<<stripPredicted<< std::endl;
794  //--------- HISTOGRAM STRIP PREDICTED FROM CSC -------------------
795 
796  std::map<std::string, MonitorElement*> meMap=meCollection[rpcId.rawId()];
797  meIdCSC.str("");
798  meIdCSC<<"ExpectedOccupancyFromCSC_"<<rollId.rawId();
799  meMap[meIdCSC.str()]->Fill(stripPredicted);
800  //--------------------------------------------------------------------
801 
802 
803  //-------RecHitPart Just For Residual--------
804  int cluSize = 0;
805  int countRecHits = 0;
806  float minres = 3000.;
807 
808  LogDebug("rpcefficiency")<<"CSC \t \t \t \t \t Getting RecHits in Roll Asociated";
809  typedef std::pair<RPCRecHitCollection::const_iterator, RPCRecHitCollection::const_iterator> rangeRecHits;
810  rangeRecHits recHitCollection = rpcHits->get(rollasociated->id());
812 
813  for (recHit = recHitCollection.first; recHit != recHitCollection.second ; recHit++) {
814 
815  countRecHits++;
816  LocalPoint recHitPos=recHit->localPosition();
817  float res=PointExtrapolatedRPCFrame.x()- recHitPos.x();
818  LogDebug("rpcefficiency")<<"CSC \t \t \t \t \t \t Found Rec Hit at "<<res<<"cm of the prediction.";
819  if(fabs(res)<fabs(minres)){
820  minres=res;
821  cluSize = recHit->clusterSize();
822  LogDebug("rpcefficiency")<<"CSC \t \t \t \t \t \t \t New Min Res "<<res<<"cm.";
823  }
824  }
825 
826  if(countRecHits==0){
827  LogDebug("rpcefficiency") <<"CSC \t \t \t \t \t THIS ROLL DOESN'T HAVE ANY RECHIT";
828  }else{
829  assert(minres!=3000);
830 
831  if(fabs(minres)<=(rangestrips+cluSize*0.5)*stripw){
832  LogDebug("rpcefficiency")<<"CSC \t \t \t \t \t \t True!";
833 
834  if(rollId.ring()==2&&rollId.roll()==1){
835  if(cluSize==1*dupli) hGlobalResClu1R2A->Fill(minres);
836  else if(cluSize==2*dupli) hGlobalResClu2R2A->Fill(minres);
837  else if(cluSize==3*dupli) hGlobalResClu3R2A->Fill(minres);
838  }
839  else if(rollId.ring()==2&&rollId.roll()==2){
840  if(cluSize==1*dupli) hGlobalResClu1R2B->Fill(minres);
841  else if(cluSize==2*dupli) hGlobalResClu2R2B->Fill(minres);
842  else if(cluSize==3*dupli) hGlobalResClu3R2B->Fill(minres);
843  }
844  else if(rollId.ring()==2&&rollId.roll()==3){
845  if(cluSize==1*dupli) hGlobalResClu1R2C->Fill(minres);
846  else if(cluSize==2*dupli) hGlobalResClu2R2C->Fill(minres);
847  else if(cluSize==3*dupli) hGlobalResClu3R2C->Fill(minres);
848  }
849  else if(rollId.ring()==3&&rollId.roll()==1){
850  if(cluSize==1*dupli) hGlobalResClu1R3A->Fill(minres);
851  else if(cluSize==2*dupli) hGlobalResClu2R3A->Fill(minres);
852  else if(cluSize==3*dupli) hGlobalResClu3R3A->Fill(minres);
853  }
854  else if(rollId.ring()==3&&rollId.roll()==2){
855  if(cluSize==1*dupli) hGlobalResClu1R3B->Fill(minres);
856  else if(cluSize==2*dupli) hGlobalResClu2R3B->Fill(minres);
857  else if(cluSize==3*dupli) hGlobalResClu3R3B->Fill(minres);
858  }
859  else 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);
860  }
861  meIdRPC.str("");
862  meIdRPC<<"RPCDataOccupancyFromCSC_"<<rollId.rawId();
863  meMap[meIdRPC.str()]->Fill(stripPredicted);
864  }
865  }
866 
867  }else{
868  LogDebug("rpcefficiency")<<"CSC \t \t \t \t No the prediction is outside of this roll";
869  }//Condition for the right match
870  }else{//if extrapolation distance D is not too long
871  LogDebug("rpcefficiency")<<"CSC \t \t \t No, Exrtrapolation too long!, canceled";
872  }//D so big
873  }//loop over the rolls asociated
874  }//Condition over the startup geometry!!!!
875  }//Is the segment 4D?
876  }else{
877  LogDebug("rpcefficiency")<<"CSC \t \t More than one segment in this chamber, or we are in Station Ring 1 or in Station 4";
878  }
879  }
880  }else{
881  LogDebug("rpcefficiency")<<"CSC This Event doesn't have any CSCSegment";
882  }
883  }
884  }
885 
886 }
#define LogDebug(id)
const double Z[kNumberCalorimeter]
int chamber() const
Definition: CSCDetId.h:70
float strip(const LocalPoint &lp) const
Definition: RPCRoll.cc:71
const Topology & topology() const
Definition: RPCRoll.cc:30
int distsector_tmp(int sector1, int sector2)
MonitorElement * hGlobalResClu1R2A
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
CSCDetId id() const
Get the (concrete) DetId.
Definition: CSCChamber.h:37
MonitorElement * hGlobalResClu1R3A
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
int nstrips() const
Definition: RPCRoll.cc:46
MonitorElement * hGlobalResClu3R2C
MonitorElement * hGlobalResClu2La[6]
T y() const
Definition: PV3DBase.h:63
#define X(str)
Definition: MuonsGrabber.cc:48
MonitorElement * hGlobalResClu3R3C
LocalPoint toLocal(const GlobalPoint &gp) const
Conversion to the R.F. of the GeomDet.
Definition: GeomDet.h:62
std::map< int, std::map< std::string, MonitorElement * > > meCollection
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
void Fill(long long x)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
int endcap() const
Definition: CSCDetId.h:95
RPCDetId id() const
Definition: RPCRoll.cc:24
int roll() const
Definition: RPCDetId.h:120
edm::EDGetTokenT< RPCRecHitCollection > RPCRecHitLabel_
MonitorElement * hGlobalResClu3La[6]
int ring() const
Definition: RPCDetId.h:72
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
MonitorElement * hGlobalResClu3R2A
MonitorElement * hGlobalResClu1R3B
MonitorElement * hGlobalResClu1R2C
MonitorElement * hGlobalResClu2R3C
MonitorElement * hGlobalResClu3R3A
bool isValid() const
Definition: HandleBase.h:76
std::map< CSCStationIndex, std::set< RPCDetId > > rollstoreCSC
MonitorElement * statistics
edm::EDGetTokenT< CSCSegmentCollection > cscSegments
std::map< DTStationIndex, std::set< RPCDetId > > rollstoreDT
edm::EDGetTokenT< DTRecSegment4DCollection > dt4DSegments
int ring() const
Definition: CSCDetId.h:77
int layer() const
Definition: RPCDetId.h:108
MonitorElement * hGlobalResClu2R2A
MonitorElement * hGlobalResClu2R3A
const T & get() const
Definition: EventSetup.h:55
MonitorElement * hGlobalResClu1La[6]
double rangestrips
int sector() const
Definition: DTChamberId.h:61
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
int station() const
Definition: CSCDetId.h:88
MonitorElement * hGlobalResClu1R3C
MonitorElement * hGlobalResClu2R2B
int station() const
Return the station number.
Definition: DTChamberId.h:51
MonitorElement * hGlobalResClu3R3B
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
T x() const
Definition: PV3DBase.h:62
MonitorElement * hGlobalResClu3R2B
DecomposeProduct< arg, typename Div::arg > D
Definition: Factorize.h:150
MonitorElement * hGlobalResClu2R3B
MonitorElement * hGlobalResClu1R2B
MonitorElement * hGlobalResClu2R2C
int station() const
Definition: RPCDetId.h:96
void RPCEfficiency::beginJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 23 of file RPCEfficiency.cc.

23 {}
void RPCEfficiency::beginRun ( const edm::Run run,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 64 of file RPCEfficiency.cc.

References DQMStore::book1D(), bookDetUnitSeg(), dbe, folderPath, edm::EventSetup::get(), hGlobalResClu1La, hGlobalResClu1R2A, hGlobalResClu1R2B, hGlobalResClu1R2C, hGlobalResClu1R3A, hGlobalResClu1R3B, hGlobalResClu1R3C, hGlobalResClu2La, hGlobalResClu2R2A, hGlobalResClu2R2B, hGlobalResClu2R2C, hGlobalResClu2R3A, hGlobalResClu2R3B, hGlobalResClu2R3C, hGlobalResClu3La, hGlobalResClu3R2A, hGlobalResClu3R2B, hGlobalResClu3R2C, hGlobalResClu3R3A, hGlobalResClu3R3B, hGlobalResClu3R3C, i, inclcsc, incldt, incldtMB4, LogDebug, meCollection, cppFunctionSkipper::operator, alignCSCRings::r, DetId::rawId(), RPCDetId::region(), relativeConstraints::ring, RPCDetId::ring(), RPCChamber::rolls(), rollstoreCSC, rollstoreDT, RPCDetId::sector(), RPCGeomServ::segment(), MonitorElement::setBinLabel(), DQMStore::setCurrentFolder(), relativeConstraints::station, RPCDetId::station(), statistics, and AlCaHLTBitMon_QueryRunRegistry::string.

64  {
65 
66 
67  //Interface
68 
70 
71  std::string folder;
73  statistics = dbe->book1D("Statistics","All Statistics",33,0.5,33.5);
74 
75 
76  statistics->setBinLabel(1,"Events ",1);
77 
78  statistics->setBinLabel(2,"Events with DT seg",1);
79  std::stringstream sstr;
80  for( int i = 1; i<=15; i++ ){ //DT form bin 3 to bin 17
81  sstr.str("");
82  sstr<<i<<" DT seg";
83  statistics->setBinLabel(i+2, sstr.str() ,1);
84  }
85 
86  statistics->setBinLabel(18,"Events with CSC seg",1);
87  for( int i = 1; i<=15; i++ ){ //CSC form bin 19 to bin 33
88  sstr.str("");
89  sstr<<i<<" CSC seg";
90  statistics->setBinLabel(i+18, sstr.str(),1);
91  }
92 
93 
94  LogDebug("rpcefficiency")<<"booking Global histograms with "<<folderPath;
95 
96  folder = folderPath+"MuonSegEff/"+"Residuals/Barrel";
97  dbe->setCurrentFolder(folder);
98 
99  //Barrel
100  std::stringstream histoName, histoTitle;
101 
102  for (int layer = 1 ; layer<= 6 ;layer++){
103  histoName.str("");
104  histoTitle.str("");
105  histoName<<"GlobalResidualsClu1La"<<layer;
106  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 1";
107  hGlobalResClu1La[layer-1] = dbe->book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
108 
109  histoName.str("");
110  histoTitle.str("");
111  histoName<<"GlobalResidualsClu2La"<<layer;
112  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 2";
113  hGlobalResClu2La[layer-1] = dbe->book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
114 
115  histoName.str("");
116  histoTitle.str("");
117  histoName<<"GlobalResidualsClu3La"<<layer;
118  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 3";
119  hGlobalResClu3La[layer-1] = dbe->book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
120 
121  }
122 
123  LogDebug("rpcefficiency")<<"Booking Residuals for EndCap";
124  folder = folderPath+"MuonSegEff/Residuals/EndCap";
125  dbe->setCurrentFolder(folder);
126 
127  //Endcap
128 
129 
130  hGlobalResClu1R3C = dbe->book1D("GlobalResidualsClu1R3C","RPC Residuals Ring 3 Roll C Cluster Size 1",101,-10.,10.);
131  hGlobalResClu1R3B = dbe->book1D("GlobalResidualsClu1R3B","RPC Residuals Ring 3 Roll B Cluster Size 1",101,-10.,10.);
132  hGlobalResClu1R3A = dbe->book1D("GlobalResidualsClu1R3A","RPC Residuals Ring 3 Roll A Cluster Size 1",101,-10.,10.);
133  hGlobalResClu1R2C = dbe->book1D("GlobalResidualsClu1R2C","RPC Residuals Ring 2 Roll C Cluster Size 1",101,-10.,10.);
134  hGlobalResClu1R2B = dbe->book1D("GlobalResidualsClu1R2B","RPC Residuals Ring 2 Roll B Cluster Size 1",101,-10.,10.);
135  hGlobalResClu1R2A = dbe->book1D("GlobalResidualsClu1R2A","RPC Residuals Ring 2 Roll A Cluster Size 1",101,-10.,10.);
136 
137  hGlobalResClu2R3C = dbe->book1D("GlobalResidualsClu2R3C","RPC Residuals Ring 3 Roll C Cluster Size 2",101,-10.,10.);
138  hGlobalResClu2R3B = dbe->book1D("GlobalResidualsClu2R3B","RPC Residuals Ring 3 Roll B Cluster Size 2",101,-10.,10.);
139  hGlobalResClu2R3A = dbe->book1D("GlobalResidualsClu2R3A","RPC Residuals Ring 3 Roll A Cluster Size 2",101,-10.,10.);
140  hGlobalResClu2R2C = dbe->book1D("GlobalResidualsClu2R2C","RPC Residuals Ring 2 Roll C Cluster Size 2",101,-10.,10.);
141  hGlobalResClu2R2B = dbe->book1D("GlobalResidualsClu2R2B","RPC Residuals Ring 2 Roll B Cluster Size 2",101,-10.,10.);
142  hGlobalResClu2R2A = dbe->book1D("GlobalResidualsClu2R2A","RPC Residuals Ring 2 Roll A Cluster Size 2",101,-10.,10.);
143 
144  hGlobalResClu3R3C = dbe->book1D("GlobalResidualsClu3R3C","RPC Residuals Ring 3 Roll C Cluster Size 3",101,-10.,10.);
145  hGlobalResClu3R3B = dbe->book1D("GlobalResidualsClu3R3B","RPC Residuals Ring 3 Roll B Cluster Size 3",101,-10.,10.);
146  hGlobalResClu3R3A = dbe->book1D("GlobalResidualsClu3R3A","RPC Residuals Ring 3 Roll A Cluster Size 3",101,-10.,10.);
147  hGlobalResClu3R2C = dbe->book1D("GlobalResidualsClu3R2C","RPC Residuals Ring 2 Roll C Cluster Size 3",101,-10.,10.);
148  hGlobalResClu3R2B = dbe->book1D("GlobalResidualsClu3R2B","RPC Residuals Ring 2 Roll B Cluster Size 3",101,-10.,10.);
149  hGlobalResClu3R2A = dbe->book1D("GlobalResidualsClu3R2A","RPC Residuals Ring 2 Roll A Cluster Size 3",101,-10.,10.);
150 
151 
152 
154  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
155 
156 
157  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
158  if(dynamic_cast< RPCChamber* >( *it ) != 0 ){
159  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
160  std::vector< const RPCRoll*> roles = (ch->rolls());
161  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
162 
163  RPCDetId rpcId = (*r)->id();
164  int region=rpcId.region();
165  //booking all histograms
166 
167  // std::string nameRoll = rpcsrv.name();
168 
169  LogDebug("rpcefficiency")<<"Booking for "<<rpcId.rawId();
170 
171  bookDetUnitSeg(rpcId,(*r)->nstrips(),folderPath+"MuonSegEff/", meCollection[rpcId.rawId()] );
172 
173  if(region==0&&(incldt||incldtMB4)){
174  //LogDebug("rpcefficiency")<<"--Filling the dtstore"<<rpcId;
175  int wheel=rpcId.ring();
176  int sector=rpcId.sector();
177  int station=rpcId.station();
178  DTStationIndex ind(region,wheel,sector,station);
179  std::set<RPCDetId> myrolls;
180  if (rollstoreDT.find(ind)!=rollstoreDT.end()) myrolls=rollstoreDT[ind];
181  myrolls.insert(rpcId);
182  rollstoreDT[ind]=myrolls;
183 
184  }else if(region!=0 && inclcsc){
185  int station=rpcId.station();
186  int ring=rpcId.ring();
187  int cscring=ring;
188  int cscstation=station;
189  RPCGeomServ rpcsrv(rpcId);
190  int rpcsegment = rpcsrv.segment();
191  int cscchamber = rpcsegment;
192  if((station==2||station==3)&&ring==3){
193  cscring = 2;
194  }
195 
196  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
197  std::set<RPCDetId> myrolls;
198  if (rollstoreCSC.find(ind)!=rollstoreCSC.end()){
199  myrolls=rollstoreCSC[ind];
200  }
201  myrolls.insert(rpcId);
202  rollstoreCSC[ind]=myrolls;
203  }
204  }
205  }
206  }
207  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
208  if( dynamic_cast< RPCChamber* >( *it ) != 0 ){
209 
210  RPCChamber* ch = dynamic_cast< RPCChamber* >( *it );
211  std::vector< const RPCRoll*> roles = (ch->rolls());
212  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
213  RPCDetId rpcId = (*r)->id();
214 
215  int region=rpcId.region();
216 
217  if(region!=0 && inclcsc && (rpcId.ring()==2 || rpcId.ring()==3)){
218  int region=rpcId.region();
219  int station=rpcId.station();
220  int ring=rpcId.ring();
221  int cscring = ring;
222 
223  if((station==2||station==3)&&ring==3) cscring = 2; //CSC Ring 2 covers rpc ring 2 & 3
224 
225 
226  int cscstation=station;
227  RPCGeomServ rpcsrv(rpcId);
228  int rpcsegment = rpcsrv.segment();
229 
230  int cscchamber = rpcsegment+1;
231  if(cscchamber==37)cscchamber=1;
232  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
233  std::set<RPCDetId> myrolls;
234  if (rollstoreCSC.find(ind)!=rollstoreCSC.end())myrolls=rollstoreCSC[ind];
235  myrolls.insert(rpcId);
236  rollstoreCSC[ind]=myrolls;
237 
238  cscchamber = rpcsegment-1;
239  if(cscchamber==0)cscchamber=36;
240  CSCStationIndex indDos(region,cscstation,cscring,cscchamber);
241  std::set<RPCDetId> myrollsDos;
242  if (rollstoreCSC.find(indDos)!=rollstoreCSC.end()) myrollsDos=rollstoreCSC[indDos];
243  myrollsDos.insert(rpcId);
244  rollstoreCSC[indDos]=myrollsDos;
245  }
246  }
247  }
248  }
249 }//beginRun
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
MonitorElement * hGlobalResClu1R2A
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
MonitorElement * hGlobalResClu1R3A
MonitorElement * hGlobalResClu3R2C
MonitorElement * hGlobalResClu2La[6]
void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * hGlobalResClu3R3C
std::map< int, std::map< std::string, MonitorElement * > > meCollection
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DQMStore * dbe
MonitorElement * hGlobalResClu3La[6]
void bookDetUnitSeg(RPCDetId &detId, int nstrips, std::string folder, std::map< std::string, MonitorElement * > &)
int ring() const
Definition: RPCDetId.h:72
std::string folderPath
MonitorElement * hGlobalResClu3R2A
const std::vector< const RPCRoll * > & rolls() const
Return the Rolls.
Definition: RPCChamber.cc:68
MonitorElement * hGlobalResClu1R3B
MonitorElement * hGlobalResClu1R2C
MonitorElement * hGlobalResClu2R3C
MonitorElement * hGlobalResClu3R3A
std::map< CSCStationIndex, std::set< RPCDetId > > rollstoreCSC
MonitorElement * statistics
std::map< DTStationIndex, std::set< RPCDetId > > rollstoreDT
MonitorElement * hGlobalResClu2R2A
MonitorElement * hGlobalResClu2R3A
const T & get() const
Definition: EventSetup.h:55
MonitorElement * hGlobalResClu1La[6]
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
MonitorElement * hGlobalResClu1R3C
MonitorElement * hGlobalResClu2R2B
MonitorElement * hGlobalResClu3R3B
MonitorElement * hGlobalResClu3R2B
MonitorElement * hGlobalResClu2R3B
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
MonitorElement * hGlobalResClu1R2B
MonitorElement * hGlobalResClu2R2C
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
void RPCEfficiency::bookDetUnitSeg ( RPCDetId detId,
int  nstrips,
std::string  folder,
std::map< std::string, MonitorElement * > &  meMap 
)

Definition at line 4 of file RPCEfficiencyBook.cc.

References DQMStore::book1D(), dbe, DetId::rawId(), RPCDetId::region(), and DQMStore::setCurrentFolder().

Referenced by beginRun().

4  {
5 
6  dbe->setCurrentFolder(folder);
7 
8  char meId [128];
9  char meTitle [128];
10 
11  int rawId = detId.rawId();
12 
13  //Begin booking DT
14  if(detId.region()==0) {
15 
16  sprintf(meId,"ExpectedOccupancyFromDT_%d",rawId);
17  sprintf(meTitle,"ExpectedOccupancyFromDT_for_%d",rawId);
18  meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
19 
20  sprintf(meId,"RPCDataOccupancyFromDT_%d",rawId);
21  sprintf(meTitle,"RPCDataOccupancyFromDT_for_%d",rawId);
22  meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
23 
24  // sprintf(meId,"BXDistribution_%d",rawId);
25 // sprintf(meTitle,"BXDistribution_for_%d",rawId);
26 // meMap[meId] = dbe->book1D(meId, meTitle, 11,-5.5, 5.5);
27  }else{
28 
29  sprintf(meId,"ExpectedOccupancyFromCSC_%d",rawId);
30  sprintf(meTitle,"ExpectedOccupancyFromCSC_for_%d",rawId);
31  meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
32 
33  sprintf(meId,"RPCDataOccupancyFromCSC_%d",rawId);
34  sprintf(meTitle,"RPCDataOccupancyFromCSC_for_%d",rawId);
35  meMap[meId] = dbe->book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
36 
37  // sprintf(meId,"BXDistribution_%d",rawId);
38 // sprintf(meTitle,"BXDistribution_for_%d",rawId);
39 // meMap[meId] = dbe->book1D(meId, meTitle, 11,-5.5, 5.5);
40  }
41  //return meMap;
42 }
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
DQMStore * dbe
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
void RPCEfficiency::endJob ( void  )
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 896 of file RPCEfficiency.cc.

References dbe.

896  {
897  dbe =0;
898 }
DQMStore * dbe
void RPCEfficiency::endRun ( const edm::Run r,
const edm::EventSetup iSetup 
)
virtual

Reimplemented from edm::EDAnalyzer.

Definition at line 889 of file RPCEfficiency.cc.

References dbe, EffRootFileName, EffSaveRootFile, and DQMStore::save().

889  {
890  if (EffSaveRootFile){
892  }
893 }
DQMStore * dbe
std::string EffRootFileName
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296

Member Data Documentation

std::vector<std::map<RPCDetId, int> > RPCEfficiency::counter
private

Definition at line 152 of file RPCEfficiency.h.

edm::EDGetTokenT<CSCSegmentCollection> RPCEfficiency::cscSegments
private

Definition at line 168 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

DQMStore* RPCEfficiency::dbe
private

Definition at line 179 of file RPCEfficiency.h.

Referenced by beginRun(), bookDetUnitSeg(), endJob(), and endRun().

bool RPCEfficiency::debug
private
edm::EDGetTokenT<DTRecSegment4DCollection> RPCEfficiency::dt4DSegments
private

Definition at line 169 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

int RPCEfficiency::dupli
private

Definition at line 166 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

std::string RPCEfficiency::EffRootFileName
private

Definition at line 178 of file RPCEfficiency.h.

Referenced by endRun(), and RPCEfficiency().

bool RPCEfficiency::EffSaveRootFile
private

Definition at line 177 of file RPCEfficiency.h.

Referenced by endRun(), and RPCEfficiency().

std::string RPCEfficiency::folderPath
private

Definition at line 172 of file RPCEfficiency.h.

Referenced by beginRun(), and RPCEfficiency().

MonitorElement* RPCEfficiency::hGlobalResClu1La[6]

Definition at line 125 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R2A

Definition at line 135 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R2B

Definition at line 134 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R2C

Definition at line 133 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R3A

Definition at line 132 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R3B

Definition at line 131 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu1R3C

Definition at line 130 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2La[6]

Definition at line 126 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R2A

Definition at line 142 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R2B

Definition at line 141 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R2C

Definition at line 140 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R3A

Definition at line 139 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R3B

Definition at line 138 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu2R3C

Definition at line 137 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3La[6]

Definition at line 127 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R2A

Definition at line 149 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R2B

Definition at line 148 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R2C

Definition at line 147 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R3A

Definition at line 146 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R3B

Definition at line 145 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCEfficiency::hGlobalResClu3R3C

Definition at line 144 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

bool RPCEfficiency::inclcsc
private

Definition at line 157 of file RPCEfficiency.h.

Referenced by analyze(), beginRun(), and RPCEfficiency().

bool RPCEfficiency::incldt
private

Definition at line 155 of file RPCEfficiency.h.

Referenced by analyze(), beginRun(), and RPCEfficiency().

bool RPCEfficiency::incldtMB4
private

Definition at line 156 of file RPCEfficiency.h.

Referenced by analyze(), beginRun(), and RPCEfficiency().

bool RPCEfficiency::inves
private

Definition at line 160 of file RPCEfficiency.h.

double RPCEfficiency::MaxD
private

Definition at line 164 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::MaxDrb4
private

Definition at line 165 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

std::map<int, std::map<std::string, MonitorElement*> > RPCEfficiency::meCollection
private

Definition at line 175 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

double RPCEfficiency::MinCosAng
private

Definition at line 163 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::rangestrips
private

Definition at line 161 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::rangestripsRB4
private

Definition at line 162 of file RPCEfficiency.h.

Referenced by RPCEfficiency().

std::string RPCEfficiency::rollseff
private

Definition at line 173 of file RPCEfficiency.h.

std::map<CSCStationIndex,std::set<RPCDetId> > RPCEfficiency::rollstoreCSC

Definition at line 112 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

std::map<DTStationIndex,std::set<RPCDetId> > RPCEfficiency::rollstoreDT

Definition at line 111 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

edm::EDGetTokenT<RPCRecHitCollection> RPCEfficiency::RPCRecHitLabel_
private

Definition at line 170 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

MonitorElement* RPCEfficiency::statistics

Definition at line 118 of file RPCEfficiency.h.

Referenced by analyze(), and beginRun().

std::vector<int> RPCEfficiency::totalcounter
private

Definition at line 153 of file RPCEfficiency.h.