CMS 3D CMS Logo

Public Member Functions | Private Types | Private Member Functions | Private Attributes

RPCClusterSizeTest Class Reference

#include <RPCClusterSizeTest.h>

Inheritance diagram for RPCClusterSizeTest:
RPCClient

List of all members.

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &c)
 Analyze.
void beginJob (DQMStore *, std::string)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 Begin Lumi block.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void clientOperation (edm::EventSetup const &c)
void endJob (void)
void endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 End Lumi Block.
void endRun (const edm::Run &r, const edm::EventSetup &c)
void getMonitorElements (std::vector< MonitorElement * > &, std::vector< RPCDetId > &)
 RPCClusterSizeTest (const edm::ParameterSet &ps)
 Constructor.
virtual ~RPCClusterSizeTest ()
 Destructor.

Private Types

enum  MEArraySizes { kWheels = 5, kDisks = 10 }

Private Member Functions

void resetMEArrays (void)

Private Attributes

MonitorElementCLSDDisk [kDisks]
MonitorElementCLSDisk [kDisks]
MonitorElementCLSDWheel [kWheels]
MonitorElementCLSWheel [kWheels]
DQMStoredbe_
std::string globalFolder_
MonitorElementMEANDDisk [kDisks]
MonitorElementMEANDisk [kDisks]
MonitorElementMEANDWheel [kWheels]
MonitorElementMEANWheel [kWheels]
std::vector< MonitorElement * > myClusterMe_
std::vector< RPCDetIdmyDetIds_
int numberOfDisks_
int numberOfRings_
int prescaleFactor_
bool testMode_
bool useRollInfo_

Detailed Description

Definition at line 13 of file RPCClusterSizeTest.h.


Member Enumeration Documentation

Enumerator:
kWheels 
kDisks 

Definition at line 57 of file RPCClusterSizeTest.h.

                    {
    kWheels = 5,
    kDisks = 10
  };

Constructor & Destructor Documentation

RPCClusterSizeTest::RPCClusterSizeTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 10 of file RPCClusterSizeTest.cc.

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

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

  resetMEArrays();
}
RPCClusterSizeTest::~RPCClusterSizeTest ( ) [virtual]

Destructor.

Definition at line 23 of file RPCClusterSizeTest.cc.

References dbe_.

{ dbe_=0;}

Member Function Documentation

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

Analyze.

Implements RPCClient.

Definition at line 65 of file RPCClusterSizeTest.cc.

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

BeginJob.

Implements RPCClient.

Definition at line 25 of file RPCClusterSizeTest.cc.

References dbe_, and globalFolder_.

                                                                         {
  edm::LogVerbatim ("rpceventsummary") << "[RPCClusterSizeTest]: Begin job ";

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

Begin Lumi block.

Implements RPCClient.

Definition at line 63 of file RPCClusterSizeTest.cc.

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

Implements RPCClient.

Definition at line 175 of file RPCClusterSizeTest.cc.

References DQMStore::book1D(), DQMStore::book2D(), CLSDDisk, CLSDisk, CLSDWheel, CLSWheel, dbe_, DQMStore::get(), MonitorElement::getName(), globalFolder_, rpcdqm::utils::labelXAxisSector(), rpcdqm::utils::labelXAxisSegment(), rpcdqm::utils::labelYAxisRing(), rpcdqm::utils::labelYAxisRoll(), MEANDDisk, MEANDisk, MEANDWheel, MEANWheel, numberOfDisks_, numberOfRings_, evf::evtn::offset(), DQMStore::removeElement(), resetMEArrays(), DQMStore::setCurrentFolder(), testMode_, useRollInfo_, and w().

                                                                          {

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

  std::stringstream histoName;

  rpcdqm::utils rpcUtils;

  // Loop over wheels
  for (int w = -2; w <= 2; w++) {
    histoName.str("");   
    histoName<<"ClusterSizeIn1Bin_Roll_vs_Sector_Wheel"<<w;       // ClusterSize in first bin norm. by Entries (2D Roll vs Sector)       
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me ) {
      dbe_->removeElement(me->getName());
    }
    
    CLSWheel[w+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(),  12, 0.5, 12.5, 21, 0.5, 21.5);
    rpcUtils.labelXAxisSector(  CLSWheel[w+2]);
    rpcUtils.labelYAxisRoll(   CLSWheel[w+2], 0, w ,useRollInfo_);
    
    
    histoName.str("");
    histoName<<"ClusterSizeMean_Roll_vs_Sector_Wheel"<<w;       // Avarage ClusterSize (2D Roll vs Sector)   
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me) {
      dbe_->removeElement(me->getName());
    }
    
    MEANWheel[w+2] = dbe_->book2D(histoName.str().c_str(), histoName.str().c_str(),  12, 0.5, 12.5, 21, 0.5, 21.5);
    
    rpcUtils.labelXAxisSector(  MEANWheel[w+2]);
    rpcUtils.labelYAxisRoll(MEANWheel[w+2], 0, w,useRollInfo_ );
    
    if(testMode_){
      histoName.str("");
      histoName<<"ClusterSizeIn1Bin_Distribution_Wheel"<<w;       //  ClusterSize in first bin, distribution
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me ) {
        dbe_->removeElement(me->getName());
      }
      CLSDWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  20, 0.0, 1.0);
      
      
      histoName.str("");
      histoName<<"ClusterSizeMean_Distribution_Wheel"<<w;       //  Avarage ClusterSize Distribution
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me){
        dbe_->removeElement(me->getName());
      }
      MEANDWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  100, 0.5, 10.5);
    }
  }//end loop on wheels


  for (int d = -numberOfDisks_;  d <= numberOfDisks_; d++) {
    if (d == 0)
      continue;
  //Endcap
    int offset = numberOfDisks_;
    if (d>0) offset--;

    histoName.str("");   
    histoName<<"ClusterSizeIn1Bin_Ring_vs_Segment_Disk"<<d;       // ClusterSize in first bin norm. by Entries (2D Roll vs Sector)   
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me){
      dbe_->removeElement(me->getName());
    }
    
    CLSDisk[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(CLSDisk[d+offset]);
    rpcUtils.labelYAxisRing(CLSDisk[d+offset], numberOfRings_,useRollInfo_ );
   
    if(testMode_){
      histoName.str("");
      histoName<<"ClusterSizeIn1Bin_Distribution_Disk"<<d;       //  ClusterSize in first bin, distribution
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me){
        dbe_->removeElement(me->getName());
      }
      CLSDDisk[d+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  20, 0.0, 1.0);
      
      histoName.str("");
      histoName<<"ClusterSizeMean_Distribution_Disk"<<d;       //  Avarage ClusterSize Distribution
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me){
        dbe_->removeElement(me->getName());
      }
      MEANDDisk[d+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),  100, 0.5, 10.5);
      
    }
    
    histoName.str("");
    histoName<<"ClusterSizeMean_Ring_vs_Segment_Disk"<<d;       // Avarage ClusterSize (2D Roll vs Sector)   
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me){
      dbe_->removeElement(me->getName());
    }
    
    MEANDisk[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(MEANDisk[d+offset]);
    rpcUtils.labelYAxisRing(MEANDisk[d+offset], numberOfRings_ ,useRollInfo_);
 }
}
void RPCClusterSizeTest::clientOperation ( edm::EventSetup const &  c) [virtual]

Implements RPCClient.

Definition at line 69 of file RPCClusterSizeTest.cc.

References CLSDDisk, CLSDisk, CLSDWheel, CLSWheel, rpcdqm::utils::detId2RollNr(), MonitorElement::Fill(), MonitorElement::getBinContent(), MonitorElement::getEntries(), MonitorElement::getMean(), i, MEANDDisk, MEANDisk, MEANDWheel, MEANWheel, myClusterMe_, myDetIds_, NULL, numberOfDisks_, numberOfRings_, RPCDetId::region(), RPCDetId::ring(), RPCDetId::roll(), RPCDetId::sector(), RPCGeomServ::segment(), RPCDetId::station(), testMode_, and cuy::yBin.

                                                                    {
  
  edm::LogVerbatim ("rpceventsummary") <<"[RPCClusterSizeTest]:Client Operation";
  
  //check some statements and prescale Factor
  if(myClusterMe_.size()==0 || myDetIds_.size()==0)return;
        
  MonitorElement * CLS   = NULL;  // ClusterSize in 1 bin, Roll vs Sector
  MonitorElement * CLSD  = NULL;  // ClusterSize in 1 bin, Distribution
  MonitorElement * MEAN  = NULL;  // Mean ClusterSize, Roll vs Sector
  MonitorElement * MEAND = NULL;  // Mean ClusterSize, Distribution
  
  
  std::stringstream meName;
  RPCDetId detId;
  MonitorElement * myMe;

  
  //Loop on chambers
  for (unsigned int  i = 0 ; i<myClusterMe_.size();i++){
    
    myMe = myClusterMe_[i];
    if (!myMe || myMe->getEntries()==0 )continue;

    
    detId=myDetIds_[i];
    
    
    if (detId.region()==0){

      CLS = CLSWheel[detId.ring()+2];
      MEAN = MEANWheel[detId.ring()+2];
      if(testMode_){
        CLSD = CLSDWheel[detId.ring()+2];
        MEAND = MEANDWheel[detId.ring()+2];
      }
    }else {
      
      if(((detId.station() * detId.region() ) + numberOfDisks_) >= 0 ){
        
        if(detId.region()<0){
          CLS=CLSDisk[(detId.station() * detId.region() ) + numberOfDisks_];
          MEAN=  MEANDisk[(detId.station() * detId.region() ) + numberOfDisks_];
          if(testMode_){
            CLSD = CLSDDisk[(detId.station() * detId.region() ) + numberOfDisks_];
            MEAND= MEANDDisk[(detId.station() * detId.region() ) + numberOfDisks_];
          }
        }else{
          CLS=CLSDisk[(detId.station() * detId.region() ) + numberOfDisks_ -1];
          MEAN= MEANDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
          if(testMode_){
            CLSD = CLSDDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
            MEAND= MEANDDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
          }
        }
      }
      
    }

  
    int xBin,yBin;
    
    if (detId.region()==0){//Barrel
      
      rpcdqm::utils rollNumber;
      yBin = rollNumber.detId2RollNr(detId);
      xBin = detId.sector();
    }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);
    }
    
    // Normalization -> # of Entries in first Bin normalaized by total Entries
    
    float NormCLS = myMe->getBinContent(1)/myMe->getEntries();
    float meanCLS = myMe->getMean();
    
    if (CLS)  CLS -> setBinContent(xBin,yBin, NormCLS);
    if(MEAN)   MEAN -> setBinContent(xBin, yBin, meanCLS);
 
    if(testMode_){
      if(MEAND) MEAND->Fill(meanCLS);
      if(CLSD)   CLSD->Fill(NormCLS);
    }
    
  }//End loop on chambers
} 
void RPCClusterSizeTest::endJob ( void  ) [virtual]

Implements RPCClient.

Definition at line 160 of file RPCClusterSizeTest.cc.

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

End Lumi Block.

Implements RPCClient.

Definition at line 67 of file RPCClusterSizeTest.cc.

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

Implements RPCClient.

Definition at line 32 of file RPCClusterSizeTest.cc.

                                                                      {
  edm::LogVerbatim ("rpceventsummary") << "[RPCClusterSizeTest]: End run";
}
void RPCClusterSizeTest::getMonitorElements ( std::vector< MonitorElement * > &  meVector,
std::vector< RPCDetId > &  detIdVector 
) [virtual]

Implements RPCClient.

Definition at line 36 of file RPCClusterSizeTest.cc.

References rpcdqm::CLUSTERSIZE, i, myClusterMe_, myDetIds_, and packageDocSplitter::tagList.

                                                                                                                    {
    
 
 //Get  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::CLUSTERSIZE)
       flag= true;
   
     tagItr++;
   }
   
   if(flag){
     myClusterMe_.push_back(meVector[i]);
     myDetIds_.push_back(detIdVector[i]);
   }
 }

}
void RPCClusterSizeTest::resetMEArrays ( void  ) [private]

Definition at line 162 of file RPCClusterSizeTest.cc.

References CLSDDisk, CLSDisk, CLSDWheel, CLSWheel, kDisks, kWheels, MEANDDisk, MEANDisk, MEANDWheel, and MEANWheel.

Referenced by beginRun(), and RPCClusterSizeTest().

                                           {
  memset((void*) CLSWheel, 0, sizeof(MonitorElement*)*kWheels);
  memset((void*) CLSDWheel, 0, sizeof(MonitorElement*)*kWheels);
  memset((void*) MEANWheel, 0, sizeof(MonitorElement*)*kWheels);
  memset((void*) MEANDWheel, 0, sizeof(MonitorElement*)*kWheels);

  memset((void*) CLSDisk, 0, sizeof(MonitorElement*)*kDisks);
  memset((void*) CLSDDisk, 0, sizeof(MonitorElement*)*kDisks);
  memset((void*) MEANDisk, 0, sizeof(MonitorElement*)*kDisks);
  memset((void*) MEANDDisk, 0, sizeof(MonitorElement*)*kDisks);
}

Member Data Documentation

Definition at line 68 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 67 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 63 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 62 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 53 of file RPCClusterSizeTest.h.

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

std::string RPCClusterSizeTest::globalFolder_ [private]

Definition at line 48 of file RPCClusterSizeTest.h.

Referenced by beginJob(), and beginRun().

Definition at line 70 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 69 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 65 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 64 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and resetMEArrays().

Definition at line 55 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), and getMonitorElements().

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

Definition at line 56 of file RPCClusterSizeTest.h.

Referenced by clientOperation(), and getMonitorElements().

Definition at line 49 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and RPCClusterSizeTest().

Definition at line 50 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and RPCClusterSizeTest().

Definition at line 51 of file RPCClusterSizeTest.h.

Referenced by RPCClusterSizeTest().

Definition at line 52 of file RPCClusterSizeTest.h.

Referenced by beginRun(), clientOperation(), and RPCClusterSizeTest().

Definition at line 54 of file RPCClusterSizeTest.h.

Referenced by beginRun(), and RPCClusterSizeTest().