CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Attributes

RPCNoisyStripTest Class Reference

#include <RPCNoisyStripTest.h>

Inheritance diagram for RPCNoisyStripTest:
RPCClient

List of all members.

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &c)
void beginJob (DQMStore *, std::string)
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
void beginRun (const edm::Run &, const edm::EventSetup &)
void clientOperation (edm::EventSetup const &c)
void endJob ()
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
void endRun (const edm::Run &, const edm::EventSetup &)
void getMonitorElements (std::vector< MonitorElement * > &, std::vector< RPCDetId > &)
 RPCNoisyStripTest (const edm::ParameterSet &ps)
virtual ~RPCNoisyStripTest ()

Protected Member Functions

void fillGlobalME (RPCDetId &, MonitorElement *, edm::EventSetup const &)

Private Attributes

DQMStoredbe_
MonitorElementDEVDDisk [10]
MonitorElementDEVDWheel [5]
std::string globalFolder_
std::vector< RPCDetIdmyDetIds_
std::vector< MonitorElement * > myOccupancyMe_
MonitorElementNOISEDDisk [10]
MonitorElementNOISEDisk [10]
MonitorElementNOISEDWheel [5]
MonitorElementNOISEWheel [5]
int numberOfDisks_
int numberOfRings_
int prescaleFactor_
bool testMode_
bool useRollInfo_

Detailed Description

Definition at line 10 of file RPCNoisyStripTest.h.


Constructor & Destructor Documentation

RPCNoisyStripTest::RPCNoisyStripTest ( const edm::ParameterSet ps)

Definition at line 15 of file RPCNoisyStripTest.cc.

References edm::ParameterSet::getUntrackedParameter(), numberOfDisks_, numberOfRings_, prescaleFactor_, testMode_, and useRollInfo_.

                                                              {
  edm::LogVerbatim ("rpcnoisetest") << "[RPCNoisyStripTest]: Constructor";
 
  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);

}
RPCNoisyStripTest::~RPCNoisyStripTest ( ) [virtual]

Definition at line 26 of file RPCNoisyStripTest.cc.

References dbe_.

{dbe_=0;}

Member Function Documentation

void RPCNoisyStripTest::analyze ( const edm::Event iEvent,
const edm::EventSetup c 
) [virtual]

Implements RPCClient.

Definition at line 42 of file RPCNoisyStripTest.cc.

{}
void RPCNoisyStripTest::beginJob ( DQMStore dbe,
std::string  workingFolder 
) [virtual]

Implements RPCClient.

Definition at line 28 of file RPCNoisyStripTest.cc.

References dbe_, and globalFolder_.

                                                                       {
 edm::LogVerbatim ("rpcnoisetest") << "[RPCNoisyStripTest]: Begin job ";
 dbe_ = dbe;

 globalFolder_ = workingFolder;
}
void RPCNoisyStripTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [virtual]

Implements RPCClient.

Definition at line 40 of file RPCNoisyStripTest.cc.

{} 
void RPCNoisyStripTest::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Implements RPCClient.

Definition at line 57 of file RPCNoisyStripTest.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, DEVDDisk, DEVDWheel, DQMStore::get(), MonitorElement::getName(), globalFolder_, rpcdqm::utils::labelXAxisSector(), rpcdqm::utils::labelXAxisSegment(), rpcdqm::utils::labelYAxisRing(), rpcdqm::utils::labelYAxisRoll(), NOISEDDisk, NOISEDisk, NOISEDWheel, NOISEWheel, numberOfDisks_, numberOfRings_, evf::evtn::offset(), DQMStore::removeElement(), DQMStore::setCurrentFolder(), testMode_, useRollInfo_, and w().

                                                                        {


 MonitorElement* me;
 dbe_->setCurrentFolder( globalFolder_);

 std::stringstream histoName;

 rpcdqm::utils rpcUtils;

 for (int w = -2; w<= 2;w++ ){//loop on wheels and disks
  
   if(testMode_){
     histoName.str("");
     histoName<<"RPCNoisyStrips_Distribution_Wheel"<<w;     
     me =0;
     me = dbe_->get( globalFolder_ +"/"+ histoName.str());
     if ( 0!=me ) {
       dbe_->removeElement(me->getName());
     }
     NOISEDWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  6, -0.5, 5.5);
     
     
     histoName.str("");
     histoName<<"RPCStripsDeviation_Distribution_Wheel"<<w; 
     me =0;
     me = dbe_->get( globalFolder_ +"/"+ histoName.str());
     if ( 0!=me ) {
       dbe_->removeElement(me->getName());
     }
     DEVDWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  101, -0.01, 10.01);
   }

   histoName.str("");
   histoName<<"RPCNoisyStrips_Roll_vs_Sector_Wheel"<<w;
   me =0;
   me = dbe_->get( globalFolder_ +"/"+ histoName.str());
   if ( 0!=me ) {
     dbe_->removeElement(me->getName());
   }
   
   NOISEWheel[w+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str() , 12, 0.5, 12.5, 21, 0.5, 21.5);
   rpcUtils.labelXAxisSector(NOISEWheel[w+2]);
   rpcUtils.labelYAxisRoll(NOISEWheel[w+2], 0, w, useRollInfo_);
 }

 
 
 for(int d = -numberOfDisks_; d<=numberOfDisks_; d++ ){//ENDCAP

   if (d == 0) continue; 

   int offset = numberOfDisks_;
   if (d>0) offset --;

   if (testMode_){
     histoName.str("");
     histoName<<"RPCNoisyStrips_Distribution_Disk"<<d;      
     me =0;
     me = dbe_->get( globalFolder_ +"/"+ histoName.str());
     if ( 0!=me ) {
       dbe_->removeElement(me->getName());
     }
     NOISEDDisk[d+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  6, -0.5, 5.5);
     
     
     histoName.str("");
     histoName<<"RPCStripsDeviation_Distribution_Disk"<<d;  
     me =0;
     me = dbe_->get( globalFolder_ +"/"+ histoName.str());
     if ( 0!=me ) {
       dbe_->removeElement(me->getName());
     }
     DEVDDisk[d+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  101, -0.01, 10.01);
   }

   histoName.str("");
   histoName<<"RPCNoisyStrips_Ring_vs_Segment_Disk"<<d;
   me =0;
   me = dbe_->get( globalFolder_ +"/"+ histoName.str());
   if ( 0!=me ) {
     dbe_->removeElement(me->getName());
   }
   
   NOISEDisk[d+offset] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str() , 36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
   rpcUtils.labelXAxisSegment(NOISEDisk[d+offset]);
   rpcUtils.labelYAxisRing(NOISEDisk[d+offset], numberOfRings_, useRollInfo_);

 }
   
}
void RPCNoisyStripTest::clientOperation ( edm::EventSetup const &  c) [virtual]

Implements RPCClient.

Definition at line 46 of file RPCNoisyStripTest.cc.

References fillGlobalME(), i, myDetIds_, and myOccupancyMe_.

                                                                   {  

  edm::LogVerbatim ("rpcnoisetest") <<"[RPCNoisyStripTest]: Client Operation";
    
 //Loop on MEs
  for (unsigned int  i = 0 ; i<myOccupancyMe_.size();i++){
    this->fillGlobalME(myDetIds_[i],myOccupancyMe_[i], iSetup);
  }//End loop on MEs

}
void RPCNoisyStripTest::endJob ( void  ) [virtual]

Implements RPCClient.

Definition at line 176 of file RPCNoisyStripTest.cc.

{}
void RPCNoisyStripTest::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

Implements RPCClient.

Definition at line 44 of file RPCNoisyStripTest.cc.

{}
void RPCNoisyStripTest::endRun ( const edm::Run r,
const edm::EventSetup iSetup 
) [virtual]

Implements RPCClient.

Definition at line 35 of file RPCNoisyStripTest.cc.

                                                                          {
 edm::LogVerbatim ("rpcnoisetest") << "[RPCNoisyStripTest]: End run";
}
void RPCNoisyStripTest::fillGlobalME ( RPCDetId detId,
MonitorElement myMe,
edm::EventSetup const &  iSetup 
) [protected]

Definition at line 178 of file RPCNoisyStripTest.cc.

References rpcdqm::utils::detId2RollNr(), DEVDDisk, DEVDWheel, python::tagInventory::entries, MonitorElement::Fill(), HcalObjRepresent::Fill(), MonitorElement::getBinContent(), i, sistrip::NOISE, NOISEDDisk, NOISEDisk, NOISEDWheel, NOISEWheel, NULL, numberOfDisks_, numberOfRings_, RPCDetId::region(), RPCDetId::ring(), RPCDetId::roll(), RPCDetId::sector(), RPCGeomServ::segment(), MonitorElement::setBinContent(), RPCDetId::station(), and testMode_.

Referenced by clientOperation().

                                                                                                        {

 //   ESHandle<RPCGeometry> rpcgeo;
//     iSetup.get<MuonGeometryRecord>().get(rpcgeo);
 
    std::stringstream meName;
    
    MonitorElement *  NOISE=NULL;
    MonitorElement * DEVD=NULL;
    MonitorElement * NOISED=NULL;

    if (detId.region()==0) { //BARREL
      NOISE = NOISEWheel[detId.ring()+2];
      if(testMode_) {
        DEVD = DEVDWheel[detId.ring()+2];
        NOISED= NOISEDWheel[detId.ring()+2];
      }
    }else if(detId.region()<0 && (-detId.station() + numberOfDisks_) >= 0 ){//ENDCAP-
      NOISE = NOISEDisk[ -detId.station() + numberOfDisks_];
      if(testMode_) {
        DEVD = DEVDDisk[ -detId.station()  + numberOfDisks_];
        NOISED= NOISEDDisk[-detId.station() + numberOfDisks_];
      }
    }else if((-detId.station() + numberOfDisks_)>= 0 ){//ENDCAP +
      NOISE = NOISEDisk[detId.station() + numberOfDisks_-1];
      if(testMode_) {
        DEVD = DEVDDisk[detId.station()  + numberOfDisks_-1];
        NOISED= NOISEDDisk[detId.station() + numberOfDisks_-1];
      }
    }
    
    
    int entries = (int) myMe -> getEntries();
    int bins = (int) myMe ->getNbinsX();
      
    std::vector<float> myvector;
        
    // count alive strips and alive strip values put in the vector
    for(int xbin =1 ; xbin <= bins ; xbin++) {    
      float binContent = myMe->getBinContent(xbin);  
      if (binContent > 0) myvector.push_back(binContent);
    }
                
    
    int noisyStrips=0;
    // calculate mean on YAxis and check diff between bins and mean
    if (myvector.size()>0) {
      float ymean = entries/myvector.size(); //mean on Yaxis
      for(unsigned int i=0; i<myvector.size(); i++) {
        float deviation = myvector[i]/ymean;
        if(deviation > 3.5)  noisyStrips++;
        if(deviation > 5) deviation = 5; //overflow 
        if(DEVD) DEVD-> Fill(deviation);
      }
        
      
      int xBin,yBin;
      if(detId.region()==0){//Barrel
        xBin= detId.sector();
        rpcdqm::utils rollNumber;
        yBin = rollNumber.detId2RollNr(detId);
      }else{//Endcap
        //get segment number
        RPCGeomServ RPCServ(detId);
        xBin = RPCServ.segment();
        (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
      }
      
      if(NOISE)  NOISE->setBinContent(xBin,yBin,noisyStrips); 
      if(NOISED) NOISED ->Fill(noisyStrips);
      
    }

}
void RPCNoisyStripTest::getMonitorElements ( std::vector< MonitorElement * > &  meVector,
std::vector< RPCDetId > &  detIdVector 
) [virtual]

Implements RPCClient.

Definition at line 150 of file RPCNoisyStripTest.cc.

References i, myDetIds_, myOccupancyMe_, rpcdqm::OCCUPANCY, and packageDocSplitter::tagList.

                                                                                                                    {

 //Get NumberOfDigi ME for each roll
 for (unsigned int i = 0 ; i<meVector.size(); i++){
   
   bool flag= false;
   
   DQMNet::TagList tagList;
   tagList = meVector[i]->getTags();
   DQMNet::TagList::iterator tagItr = tagList.begin();
   
   while (tagItr != tagList.end() && !flag ) {
     if((*tagItr) ==  rpcdqm::OCCUPANCY)
       flag= true;
     
     tagItr++;
   }
   
   if(flag){
     myOccupancyMe_.push_back(meVector[i]);
     myDetIds_.push_back(detIdVector[i]);
   }
 }

}

Member Data Documentation

Definition at line 36 of file RPCNoisyStripTest.h.

Referenced by beginJob(), beginRun(), and ~RPCNoisyStripTest().

Definition at line 47 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

Definition at line 43 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

std::string RPCNoisyStripTest::globalFolder_ [private]

Definition at line 32 of file RPCNoisyStripTest.h.

Referenced by beginJob(), and beginRun().

std::vector<RPCDetId> RPCNoisyStripTest::myDetIds_ [private]

Definition at line 39 of file RPCNoisyStripTest.h.

Referenced by clientOperation(), and getMonitorElements().

Definition at line 38 of file RPCNoisyStripTest.h.

Referenced by clientOperation(), and getMonitorElements().

Definition at line 46 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

Definition at line 45 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

Definition at line 42 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

Definition at line 41 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and fillGlobalME().

Definition at line 48 of file RPCNoisyStripTest.h.

Referenced by beginRun(), fillGlobalME(), and RPCNoisyStripTest().

Definition at line 33 of file RPCNoisyStripTest.h.

Referenced by beginRun(), fillGlobalME(), and RPCNoisyStripTest().

Definition at line 34 of file RPCNoisyStripTest.h.

Referenced by RPCNoisyStripTest().

Definition at line 35 of file RPCNoisyStripTest.h.

Referenced by beginRun(), fillGlobalME(), and RPCNoisyStripTest().

Definition at line 40 of file RPCNoisyStripTest.h.

Referenced by beginRun(), and RPCNoisyStripTest().