CMS 3D CMS Logo

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

#include <RPCEfficiency.h>

Inheritance diagram for RPCEfficiency:
DQMEDAnalyzer edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > > edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 RPCEfficiency (const edm::ParameterSet &)
 
 ~RPCEfficiency ()
 
- Public Member Functions inherited from DQMEDAnalyzer
virtual void beginRun (edm::Run const &, edm::EventSetup const &) final
 
virtual void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer (void)
 
virtual void endLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
virtual void endRunSummary (edm::Run const &, edm::EventSetup const &, dqmDetails::NoCache *) const final
 
uint32_t streamId () const
 
- Public Member Functions inherited from edm::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
void bookDetUnitSeg (DQMStore::IBooker &, RPCDetId &detId, int nstrips, std::string folder, std::map< std::string, MonitorElement * > &)
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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)
 

Protected 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
 
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::stream::EDAnalyzer< edm::RunSummaryCache< dqmDetails::NoCache >, edm::LuminosityBlockSummaryCache< dqmDetails::NoCache > >
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static std::shared_ptr
< dqmDetails::NoCache
globalBeginLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *)
 
static std::shared_ptr
< dqmDetails::NoCache
globalBeginRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *)
 
static void globalEndLuminosityBlockSummary (edm::LuminosityBlock const &, edm::EventSetup const &, LuminosityBlockContext const *, dqmDetails::NoCache *)
 
static void globalEndRunSummary (edm::Run const &, edm::EventSetup const &, RunContext const *, dqmDetails::NoCache *)
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Detailed Description

Class for RPC Monitoring using RPCDigi and DT and CSC Segments. author Camilo Carrillo (Uniandes)

Definition at line 95 of file RPCEfficiency.h.

Constructor & Destructor Documentation

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

Definition at line 33 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.

33  {
34  incldt=iConfig.getUntrackedParameter<bool>("incldt",true);
35  incldtMB4=iConfig.getUntrackedParameter<bool>("incldtMB4",true);
36  inclcsc=iConfig.getUntrackedParameter<bool>("inclcsc",true);
37  debug=iConfig.getUntrackedParameter<bool>("debug",false);
38 
39  rangestrips = iConfig.getUntrackedParameter<double>("rangestrips",4.);
40  rangestripsRB4=iConfig.getUntrackedParameter<double>("rangestripsRB4",4.);
41  dupli = iConfig.getUntrackedParameter<int>("DuplicationCorrection",2);
42  MinCosAng=iConfig.getUntrackedParameter<double>("MinCosAng",0.96);
43  MaxD=iConfig.getUntrackedParameter<double>("MaxD",80.);
44  MaxDrb4=iConfig.getUntrackedParameter<double>("MaxDrb4",150.);
45 
46 
47  cscSegments= consumes<CSCSegmentCollection>(iConfig.getParameter<edm::InputTag>("cscSegments"));
48  dt4DSegments = consumes<DTRecSegment4DCollection>(iConfig.getParameter<edm::InputTag>("dt4DSegments"));
49  RPCRecHitLabel_ = consumes<RPCRecHitCollection>(iConfig.getParameter<edm::InputTag>("RecHitLabel"));
50 
51  folderPath=iConfig.getUntrackedParameter<std::string>("folderPath","RPC/RPCEfficiency/");
52 
53  EffSaveRootFile = iConfig.getUntrackedParameter<bool>("EffSaveRootFile", false);
54  EffRootFileName = iConfig.getUntrackedParameter<std::string>("EffRootFileName", "RPCEfficiency.root");
55 
56 }
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 244 of file RPCEfficiency.cc.

244 {}

Member Function Documentation

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

Implements edm::stream::EDAnalyzerBase.

Definition at line 246 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(), RectangularStripTopology::localPosition(), TrapezoidalStripTopology::localPosition(), LogDebug, MaxD, MaxDrb4, meCollection, MinCosAng, RPCGeomServ::name(), RPCRoll::nstrips(), RectangularStripTopology::pitch(), TrapezoidalStripTopology::pitch(), rangestrips, DetId::rawId(), RPCDetId::ring(), CSCDetId::ring(), RPCDetId::roll(), rollstoreCSC, rollstoreDT, RPCRecHitLabel_, DTChamberId::sector(), mathSSE::sqrt(), DTChamberId::station(), RPCDetId::station(), CSCDetId::station(), statistics, AlCaHLTBitMon_QueryRunRegistry::string, RPCRoll::strip(), RectangularStripTopology::stripLength(), TrapezoidalStripTopology::stripLength(), 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().

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

Definition at line 4 of file RPCEfficiencyBook.cc.

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

Referenced by bookHistograms().

4  {
5 
6  ibooker.setCurrentFolder(folder);
7 
8  char meId [128];
9  char meTitle [128];
10  int rawId = detId.rawId();
11 
12  //Begin booking DT
13  if(detId.region()==0) {
14 
15  sprintf(meId,"ExpectedOccupancyFromDT_%d",rawId);
16  sprintf(meTitle,"ExpectedOccupancyFromDT_for_%d",rawId);
17  meMap[meId] = ibooker.book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
18 
19  sprintf(meId,"RPCDataOccupancyFromDT_%d",rawId);
20  sprintf(meTitle,"RPCDataOccupancyFromDT_for_%d",rawId);
21  meMap[meId] = ibooker.book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
22 
23  }else{ //Begin booking CSC
24 
25  sprintf(meId,"ExpectedOccupancyFromCSC_%d",rawId);
26  sprintf(meTitle,"ExpectedOccupancyFromCSC_for_%d",rawId);
27  meMap[meId] = ibooker.book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
28 
29  sprintf(meId,"RPCDataOccupancyFromCSC_%d",rawId);
30  sprintf(meTitle,"RPCDataOccupancyFromCSC_for_%d",rawId);
31  meMap[meId] = ibooker.book1D(meId, meTitle, nstrips, 0.5, nstrips+0.5);
32 
33  }
34 }
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
void RPCEfficiency::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  run,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 59 of file RPCEfficiency.cc.

References DQMStore::IBooker::book1D(), bookDetUnitSeg(), DQMStore::IBooker::cd(), 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, alignCSCRings::r, DetId::rawId(), RPCDetId::region(), relativeConstraints::ring, RPCDetId::ring(), RPCChamber::rolls(), rollstoreCSC, rollstoreDT, RPCDetId::sector(), RPCGeomServ::segment(), MonitorElement::setBinLabel(), DQMStore::IBooker::setCurrentFolder(), relativeConstraints::station, RPCDetId::station(), statistics, and AlCaHLTBitMon_QueryRunRegistry::string.

59  {
60 
61  std::string folder;
62  ibooker.cd();
64  statistics = ibooker.book1D("Statistics","All Statistics",33,0.5,33.5);
65 
66 
67  statistics->setBinLabel(1,"Events ",1);
68  statistics->setBinLabel(2,"Events with DT seg",1);
69 
70  std::stringstream sstr;
71  for( int i = 1; i<=15; i++ ){ //DT form bin 3 to bin 17
72  sstr.str("");
73  sstr<<i<<" DT seg";
74  statistics->setBinLabel(i+2, sstr.str() ,1);
75  }
76 
77  statistics->setBinLabel(18,"Events with CSC seg",1);
78  for( int i = 1; i<=15; i++ ){ //CSC form bin 19 to bin 33
79  sstr.str("");
80  sstr<<i<<" CSC seg";
81  statistics->setBinLabel(i+18, sstr.str(),1);
82  }
83 
84 
85  LogDebug("rpcefficiency")<<"booking Global histograms with "<<folderPath;
86 
87  folder = folderPath+"MuonSegEff/"+"Residuals/Barrel";
88  ibooker.setCurrentFolder(folder);
89 
90  //Barrel
91  std::stringstream histoName, histoTitle;
92 
93  for (int layer = 1 ; layer<= 6 ;layer++){
94  histoName.str("");
95  histoTitle.str("");
96  histoName<<"GlobalResidualsClu1La"<<layer;
97  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 1";
98  hGlobalResClu1La[layer-1] = ibooker.book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
99 
100  histoName.str("");
101  histoTitle.str("");
102  histoName<<"GlobalResidualsClu2La"<<layer;
103  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 2";
104  hGlobalResClu2La[layer-1] = ibooker.book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
105 
106  histoName.str("");
107  histoTitle.str("");
108  histoName<<"GlobalResidualsClu3La"<<layer;
109  histoTitle<<"RPC Residuals Layer "<<layer<<" Cluster Size 3";
110  hGlobalResClu3La[layer-1] = ibooker.book1D(histoName.str(), histoTitle.str(),101,-10.,10.);
111 
112  }
113 
114  LogDebug("rpcefficiency")<<"Booking Residuals for EndCap";
115  folder = folderPath+"MuonSegEff/Residuals/EndCap";
116  ibooker.setCurrentFolder(folder);
117 
118  //Endcap
119  hGlobalResClu1R3C = ibooker.book1D("GlobalResidualsClu1R3C","RPC Residuals Ring 3 Roll C Cluster Size 1",101,-10.,10.);
120  hGlobalResClu1R3B = ibooker.book1D("GlobalResidualsClu1R3B","RPC Residuals Ring 3 Roll B Cluster Size 1",101,-10.,10.);
121  hGlobalResClu1R3A = ibooker.book1D("GlobalResidualsClu1R3A","RPC Residuals Ring 3 Roll A Cluster Size 1",101,-10.,10.);
122  hGlobalResClu1R2C = ibooker.book1D("GlobalResidualsClu1R2C","RPC Residuals Ring 2 Roll C Cluster Size 1",101,-10.,10.);
123  hGlobalResClu1R2B = ibooker.book1D("GlobalResidualsClu1R2B","RPC Residuals Ring 2 Roll B Cluster Size 1",101,-10.,10.);
124  hGlobalResClu1R2A = ibooker.book1D("GlobalResidualsClu1R2A","RPC Residuals Ring 2 Roll A Cluster Size 1",101,-10.,10.);
125 
126  hGlobalResClu2R3C = ibooker.book1D("GlobalResidualsClu2R3C","RPC Residuals Ring 3 Roll C Cluster Size 2",101,-10.,10.);
127  hGlobalResClu2R3B = ibooker.book1D("GlobalResidualsClu2R3B","RPC Residuals Ring 3 Roll B Cluster Size 2",101,-10.,10.);
128  hGlobalResClu2R3A = ibooker.book1D("GlobalResidualsClu2R3A","RPC Residuals Ring 3 Roll A Cluster Size 2",101,-10.,10.);
129  hGlobalResClu2R2C = ibooker.book1D("GlobalResidualsClu2R2C","RPC Residuals Ring 2 Roll C Cluster Size 2",101,-10.,10.);
130  hGlobalResClu2R2B = ibooker.book1D("GlobalResidualsClu2R2B","RPC Residuals Ring 2 Roll B Cluster Size 2",101,-10.,10.);
131  hGlobalResClu2R2A = ibooker.book1D("GlobalResidualsClu2R2A","RPC Residuals Ring 2 Roll A Cluster Size 2",101,-10.,10.);
132 
133  hGlobalResClu3R3C = ibooker.book1D("GlobalResidualsClu3R3C","RPC Residuals Ring 3 Roll C Cluster Size 3",101,-10.,10.);
134  hGlobalResClu3R3B = ibooker.book1D("GlobalResidualsClu3R3B","RPC Residuals Ring 3 Roll B Cluster Size 3",101,-10.,10.);
135  hGlobalResClu3R3A = ibooker.book1D("GlobalResidualsClu3R3A","RPC Residuals Ring 3 Roll A Cluster Size 3",101,-10.,10.);
136  hGlobalResClu3R2C = ibooker.book1D("GlobalResidualsClu3R2C","RPC Residuals Ring 2 Roll C Cluster Size 3",101,-10.,10.);
137  hGlobalResClu3R2B = ibooker.book1D("GlobalResidualsClu3R2B","RPC Residuals Ring 2 Roll B Cluster Size 3",101,-10.,10.);
138  hGlobalResClu3R2A = ibooker.book1D("GlobalResidualsClu3R2A","RPC Residuals Ring 2 Roll A Cluster Size 3",101,-10.,10.);
139 
140 
142  iSetup.get<MuonGeometryRecord>().get(rpcGeo);
143 
144 
145  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
146  if(dynamic_cast< const RPCChamber* >( *it ) != 0 ){
147  const RPCChamber* ch = dynamic_cast< const RPCChamber* >( *it );
148  std::vector< const RPCRoll*> roles = (ch->rolls());
149 
150  for(std::vector<const RPCRoll*>::const_iterator r = roles.begin();r != roles.end(); ++r){
151 
152  RPCDetId rpcId = (*r)->id();
153  int region=rpcId.region();
154 
155  LogDebug("rpcefficiency")<<"Booking for "<<rpcId.rawId();
156 
157  bookDetUnitSeg(ibooker, rpcId,(*r)->nstrips(),folderPath+"MuonSegEff/", meCollection[rpcId.rawId()] );
158 
159  if(region==0&&(incldt||incldtMB4)){
160  //LogDebug("rpcefficiency")<<"--Filling the dtstore"<<rpcId;
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  }else if(region!=0 && inclcsc){
171  int station=rpcId.station();
172  int ring=rpcId.ring();
173  int cscring=ring;
174  int cscstation=station;
175  RPCGeomServ rpcsrv(rpcId);
176  int rpcsegment = rpcsrv.segment();
177  int cscchamber = rpcsegment;
178 
179  if((station==2||station==3||station==4)&&ring==3){
180  cscring = 2;
181  }
182 
183  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
184  std::set<RPCDetId> myrolls;
185  if (rollstoreCSC.find(ind)!=rollstoreCSC.end()){
186  myrolls=rollstoreCSC[ind];
187  }
188  myrolls.insert(rpcId);
189  rollstoreCSC[ind]=myrolls;
190  }
191  }
192  }
193  }
194 
195  for (TrackingGeometry::DetContainer::const_iterator it=rpcGeo->dets().begin();it<rpcGeo->dets().end();it++){
196  if( dynamic_cast< const RPCChamber* >( *it ) != 0 ){
197 
198  const RPCChamber* ch = dynamic_cast< const 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 && inclcsc && (rpcId.ring()==2 || rpcId.ring()==3)){
206  int region=rpcId.region();
207  int station=rpcId.station();
208  int ring=rpcId.ring();
209  int cscring = ring;
210 
211  if((station==2||station==3||station==4)&&ring==3) cscring = 2; //CSC Ring 2 covers rpc ring 2 & 3
212 
213 
214  int cscstation=station;
215  RPCGeomServ rpcsrv(rpcId);
216  int rpcsegment = rpcsrv.segment();
217 
218  int cscchamber = rpcsegment+1;
219  if(cscchamber==37)cscchamber=1;
220  CSCStationIndex ind(region,cscstation,cscring,cscchamber);
221  std::set<RPCDetId> myrolls;
222  if (rollstoreCSC.find(ind)!=rollstoreCSC.end())myrolls=rollstoreCSC[ind];
223  myrolls.insert(rpcId);
224  rollstoreCSC[ind]=myrolls;
225 
226  cscchamber = rpcsegment-1;
227  if(cscchamber==0)cscchamber=36;
228  CSCStationIndex indDos(region,cscstation,cscring,cscchamber);
229  std::set<RPCDetId> myrollsDos;
230  if (rollstoreCSC.find(indDos)!=rollstoreCSC.end()) myrollsDos=rollstoreCSC[indDos];
231  myrollsDos.insert(rpcId);
232  rollstoreCSC[indDos]=myrollsDos;
233  }
234  }
235  }
236  }
237 }//beginRun
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
MonitorElement * hGlobalResClu1R2A
void cd(void)
Definition: DQMStore.cc:266
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
void bookDetUnitSeg(DQMStore::IBooker &, RPCDetId &detId, int nstrips, std::string folder, std::map< std::string, MonitorElement * > &)
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
MonitorElement * hGlobalResClu3La[6]
int ring() const
Definition: RPCDetId.h:72
std::string folderPath
MonitorElement * hGlobalResClu3R2A
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
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
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
MonitorElement * hGlobalResClu2R3A
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
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

Member Data Documentation

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

Definition at line 139 of file RPCEfficiency.h.

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

Definition at line 155 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

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

Definition at line 156 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

int RPCEfficiency::dupli
private

Definition at line 153 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

std::string RPCEfficiency::EffRootFileName
private

Definition at line 165 of file RPCEfficiency.h.

Referenced by RPCEfficiency().

bool RPCEfficiency::EffSaveRootFile
private

Definition at line 164 of file RPCEfficiency.h.

Referenced by RPCEfficiency().

std::string RPCEfficiency::folderPath
private

Definition at line 159 of file RPCEfficiency.h.

Referenced by bookHistograms(), and RPCEfficiency().

MonitorElement* RPCEfficiency::hGlobalResClu1La[6]
protected

Definition at line 112 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R2A
protected

Definition at line 122 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R2B
protected

Definition at line 121 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R2C
protected

Definition at line 120 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R3A
protected

Definition at line 119 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R3B
protected

Definition at line 118 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu1R3C
protected

Definition at line 117 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2La[6]
protected

Definition at line 113 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R2A
protected

Definition at line 129 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R2B
protected

Definition at line 128 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R2C
protected

Definition at line 127 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R3A
protected

Definition at line 126 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R3B
protected

Definition at line 125 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu2R3C
protected

Definition at line 124 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3La[6]
protected

Definition at line 114 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R2A
protected

Definition at line 136 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R2B
protected

Definition at line 135 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R2C
protected

Definition at line 134 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R3A
protected

Definition at line 133 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R3B
protected

Definition at line 132 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCEfficiency::hGlobalResClu3R3C
protected

Definition at line 131 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

bool RPCEfficiency::inclcsc
private

Definition at line 144 of file RPCEfficiency.h.

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

bool RPCEfficiency::incldt
private

Definition at line 142 of file RPCEfficiency.h.

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

bool RPCEfficiency::incldtMB4
private

Definition at line 143 of file RPCEfficiency.h.

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

bool RPCEfficiency::inves
private

Definition at line 147 of file RPCEfficiency.h.

double RPCEfficiency::MaxD
private

Definition at line 151 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::MaxDrb4
private

Definition at line 152 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

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

Definition at line 162 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

double RPCEfficiency::MinCosAng
private

Definition at line 150 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::rangestrips
private

Definition at line 148 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

double RPCEfficiency::rangestripsRB4
private

Definition at line 149 of file RPCEfficiency.h.

Referenced by RPCEfficiency().

std::string RPCEfficiency::rollseff
private

Definition at line 160 of file RPCEfficiency.h.

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

Definition at line 107 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 106 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 157 of file RPCEfficiency.h.

Referenced by analyze(), and RPCEfficiency().

MonitorElement* RPCEfficiency::statistics
protected

Definition at line 109 of file RPCEfficiency.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 140 of file RPCEfficiency.h.