CMS 3D CMS Logo

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

RPCEventSummary Class Reference

#include <RPCEventSummary.h>

Inheritance diagram for RPCEventSummary:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &c)
 Analyze.
void beginJob ()
 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 endLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
 End Lumi Block.
void endRun (const edm::Run &r, const edm::EventSetup &c)
 RPCEventSummary (const edm::ParameterSet &ps)
 Constructor.
virtual ~RPCEventSummary ()
 Destructor.

Private Types

enum  RPCQualityFlags { DEAD = 6, PARTIALLY_DEAD = 5 }

Private Member Functions

void clientOperation ()

Private Attributes

DQMStoredbe_
bool doEndcapCertification_
bool enableReportSummary_
std::string eventInfoPath_
std::pair< int, int > FEDRange_
std::string globalFolder_
bool init_
int lumiCounter_
int minimumEvents_
int numberDisk_
int NumberOfFeds_
bool offlineDQM_
std::string prefixDir_
std::string prefixFolder_
int prescaleFactor_
MonitorElementRPCEvents

Detailed Description

Definition at line 14 of file RPCEventSummary.h.


Member Enumeration Documentation

Enumerator:
DEAD 
PARTIALLY_DEAD 

Definition at line 61 of file RPCEventSummary.h.

{DEAD = 6, PARTIALLY_DEAD=5};

Constructor & Destructor Documentation

RPCEventSummary::RPCEventSummary ( const edm::ParameterSet ps)

Constructor.

Definition at line 16 of file RPCEventSummary.cc.

References doEndcapCertification_, enableReportSummary_, eventInfoPath_, FEDRange_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, minimumEvents_, numberDisk_, NumberOfFeds_, offlineDQM_, prefixFolder_, and prescaleFactor_.

                                                          {
  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Constructor";

  enableReportSummary_ = ps.getUntrackedParameter<bool>("EnableSummaryReport",true);
  prescaleFactor_ =  ps.getUntrackedParameter<int>("PrescaleFactor", 1);
  eventInfoPath_ = ps.getUntrackedParameter<std::string>("EventInfoPath", "RPC/EventInfo");


  std::string subsystemFolder = ps.getUntrackedParameter<std::string>("RPCFolder", "RPC");
  std::string recHitTypeFolder = ps.getUntrackedParameter<std::string>("RecHitTypeFolder", "AllHits");
  std::string summaryFolder = ps.getUntrackedParameter<std::string>("SummaryFolder", "SummaryHistograms");

  globalFolder_  =  subsystemFolder +"/"+  recHitTypeFolder +"/"+ summaryFolder ;
  prefixFolder_  =  subsystemFolder +"/"+  recHitTypeFolder ;

  minimumEvents_= ps.getUntrackedParameter<int>("MinimumRPCEvents", 10000);
  numberDisk_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
  doEndcapCertification_ = ps.getUntrackedParameter<bool>("EnableEndcapSummary", false);

  FEDRange_.first  = ps.getUntrackedParameter<unsigned int>("MinimumRPCFEDId", 790);
  FEDRange_.second = ps.getUntrackedParameter<unsigned int>("MaximumRPCFEDId", 792);
  
  NumberOfFeds_ =FEDRange_.second -  FEDRange_.first +1;

  offlineDQM_ = ps.getUntrackedParameter<bool> ("OfflineDQM",true); 


}
RPCEventSummary::~RPCEventSummary ( ) [virtual]

Destructor.

Definition at line 45 of file RPCEventSummary.cc.

References dbe_.

                                 {
  edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Destructor ";
  dbe_=0;
}

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 187 of file RPCEventSummary.cc.

{}
void RPCEventSummary::beginJob ( void  ) [virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 50 of file RPCEventSummary.cc.

References dbe_, and cmsCodeRules::cppFunctionSkipper::operator.

                              {
 edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Begin job ";
 dbe_ = edm::Service<DQMStore>().operator->();
}
void RPCEventSummary::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [virtual]

Begin Lumi block.

Reimplemented from edm::EDAnalyzer.

Definition at line 185 of file RPCEventSummary.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 55 of file RPCEventSummary.cc.

References DQMStore::book2D(), DQMStore::bookFloat(), dbe_, eventInfoPath_, f, FEDRange_, MonitorElement::Fill(), edm::EventSetup::find(), edm::eventsetup::heterocontainer::HCTypeTag::findType(), edm::EventSetup::get(), DQMStore::get(), MonitorElement::getName(), i, init_, j, lumiCounter_, numberDisk_, prescaleFactor_, DQMStore::removeElement(), MonitorElement::setBinContent(), MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

                                                                         {
 edm::LogVerbatim ("rpceventsummary") << "[RPCEventSummary]: Begin run";
  
  init_ = false;  
  lumiCounter_ = prescaleFactor_ ;

 edm::eventsetup::EventSetupRecordKey recordKey(edm::eventsetup::EventSetupRecordKey::TypeTag::findType("RunInfoRcd"));
 
 int defaultValue = 1;
 
 if(0 != setup.find( recordKey ) ) {
   defaultValue = -1;
   //get fed summary information
   edm::ESHandle<RunInfo> sumFED;
   setup.get<RunInfoRcd>().get(sumFED);    
   std::vector<int> FedsInIds= sumFED->m_fed_in;   
   unsigned int f = 0;
   bool flag = false;
   while(!flag && f < FedsInIds.size()) {
     int fedID=FedsInIds[f];
     //make sure fed id is in allowed range  
     if(fedID>=FEDRange_.first && fedID<=FEDRange_.second) {
       defaultValue = 1;
       flag = true;
     } 
     f++;
   }   
 }   
 

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

 //a global summary float [0,1] providing a global summary of the status 
 //and showing the goodness of the data taken by the the sub-system 
 std::string histoName="reportSummary";
 me =0;
 me = dbe_->get(eventInfoPath_ +"/"+ histoName);
 if ( 0!=me) {
    dbe_->removeElement(me->getName());
  }

  me = dbe_->bookFloat(histoName);
  me->Fill(defaultValue);

  //TH2F ME providing a mapof values[0-1] to show if problems are localized or distributed
  me =0;
  me = dbe_->get(eventInfoPath_ +"/reportSummaryMap");
  if ( 0!=me) {
    dbe_->removeElement(me->getName());
  }
 
  me = dbe_->book2D("reportSummaryMap", "RPC Report Summary Map", 15, -7.5, 7.5, 12, 0.5 ,12.5);
 
  //customize the 2d histo
  std::stringstream BinLabel;
  for (int i= 1 ; i<=15; i++){
    BinLabel.str("");
    if(i<13){
      BinLabel<<"Sec"<<i;
       me->setBinLabel(i,BinLabel.str(),2);
    } 

    BinLabel.str("");
    if(i<5)
      BinLabel<<"Disk"<<i-5;
    else if(i>11)
      BinLabel<<"Disk"<<i-11;
    else if(i==11 || i==5)
      BinLabel.str("");
    else
      BinLabel<<"Wheel"<<i-8;
 
     me->setBinLabel(i,BinLabel.str(),1);
  }

  //fill the histo with "1" --- just for the moment
  for(int i=1; i<=15; i++){
     for (int j=1; j<=12; j++ ){
       if(i==5 || i==11 || (j>6 && (i<6 || i>10)))    
         me->setBinContent(i,j,-1);//bins that not correspond to subdetector parts
       else
         me->setBinContent(i,j,defaultValue);
     }
   }

  if(numberDisk_ < 4)
    for (int j=1; j<=12; j++ ){
        me->setBinContent(1,j,-1);//bins that not correspond to subdetector parts
        me->setBinContent(15,j,-1);
    }

 //the reportSummaryContents folder containins a collection of ME floats [0-1] (order of 5-10)
 // which describe the behavior of the respective subsystem sub-components.
  dbe_->setCurrentFolder(eventInfoPath_+ "/reportSummaryContents");
  
  std::stringstream segName;
  std::vector<std::string> segmentNames;
  for(int i=-4; i<=4; i++){
    if(i>-3 && i<3) {
      segName.str("");
      segName<<"RPC_Wheel"<<i;
      segmentNames.push_back(segName.str());
    }
    if(i==0) continue;
    segName.str("");
    segName<<"RPC_Disk"<<i;
    segmentNames.push_back(segName.str());
  }
  

  for(unsigned int i=0; i<segmentNames.size(); i++){
    me =0;
    me = dbe_->get(eventInfoPath_ + "/reportSummaryContents/" +segmentNames[i]);
    if ( 0!=me) {
      dbe_->removeElement(me->getName());
    }
    me = dbe_->bookFloat(segmentNames[i]);
    me->Fill(defaultValue);
  }

  //excluded endcap parts
  if(numberDisk_ < 4){
    me=dbe_->get(eventInfoPath_ + "/reportSummaryContents/RPC_Disk4");
    if(me)  me->Fill(-1);
    me=dbe_->get(eventInfoPath_ + "/reportSummaryContents/RPC_Disk-4");
    if(me)  me->Fill(-1);
  }
}
void RPCEventSummary::clientOperation ( ) [private]

Definition at line 211 of file RPCEventSummary.cc.

References dbe_, DEAD, doEndcapCertification_, eventInfoPath_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), globalFolder_, i, init_, minimumEvents_, numberDisk_, PARTIALLY_DEAD, prefixFolder_, alignCSCRings::r, RPCEvents, alignCSCRings::s, MonitorElement::setBinContent(), w(), and detailsBasic3DVector::y.

Referenced by endLuminosityBlock(), and endRun().

                                     {

  float  rpcevents = minimumEvents_;
  RPCEvents = dbe_->get( prefixFolder_  +"/RPCEvents");  

  if(RPCEvents) {
    rpcevents = RPCEvents ->getBinContent(1);
  }
  

  if(rpcevents < minimumEvents_) return;
  init_ = true;
  std::stringstream meName;
  MonitorElement * myMe;
   
  meName.str("");
  meName<<eventInfoPath_ + "/reportSummaryMap";
  MonitorElement * reportMe = dbe_->get(meName.str());
  
  MonitorElement * globalMe;
  
  //BARREL
  float barrelFactor = 0;
  
  for(int w = -2 ; w<3; w++){
    
    meName.str("");
    meName<<globalFolder_<<"/RPCChamberQuality_Roll_vs_Sector_Wheel"<<w;
    myMe = dbe_->get(meName.str());
    
       if(myMe){      
         float wheelFactor = 0;
         
         for(int s = 1; s<=myMe->getNbinsX() ; s++){
           float sectorFactor = 0;
           int rollInSector = 0;
         
           
         for(int r = 1;r<=myMe->getNbinsY(); r++){
           if((s!=4 && r > 17 ) || ((s ==9 ||s ==10)  && r >15 ) )  continue;
           rollInSector++;
           
           
           if(myMe->getBinContent(s,r) == PARTIALLY_DEAD) sectorFactor+=0.8;
           else if(myMe->getBinContent(s,r) == DEAD )sectorFactor+=0;
           else sectorFactor+=1;        
           
         }
         if(rollInSector!=0)
           sectorFactor = sectorFactor/rollInSector;
         
         if(reportMe)   reportMe->setBinContent(w+8, s, sectorFactor);
         wheelFactor += sectorFactor;
         
         }//end loop on sectors
         
         wheelFactor = wheelFactor/myMe->getNbinsX();
         
         meName.str("");
         meName<<eventInfoPath_ + "/reportSummaryContents/RPC_Wheel"<<w; 
         globalMe=dbe_->get(meName.str());
         if(globalMe) globalMe->Fill(wheelFactor);
         
         barrelFactor += wheelFactor;
       }//
     }//end loop on wheel
  
     barrelFactor = barrelFactor/5;
  

     float endcapFactor = 0;
     
     if(doEndcapCertification_){
       
       //Endcap
       for(int d = -numberDisk_ ; d<= numberDisk_; d++){
         if (d==0) continue;
         
         meName.str("");
         meName<<globalFolder_<<"/RPCChamberQuality_Ring_vs_Segment_Disk"<<d;
         myMe = dbe_->get(meName.str());
         
         if(myMe){      
           float diskFactor = 0;
           
           float sectorFactor[6]= {0,0,0,0,0,0};
           
           for (int i = 0 ;i <6;i++){
             int firstSeg = (i *6 )+1;
             int lastSeg = firstSeg +6;
             int rollInSector = 0; 
             for(int seg = firstSeg; seg< lastSeg ; seg++){
               
               for(int y = 1;y<=myMe->getNbinsY(); y++){
                 rollInSector++;
                 if(myMe->getBinContent(seg,y) == PARTIALLY_DEAD) sectorFactor[i]+=0.8;
                 else if(myMe->getBinContent(seg,y) == DEAD )sectorFactor[i]+=0;
                 else sectorFactor[i]+=1;       
                 
               }
             }
             sectorFactor[i] = sectorFactor[i]/rollInSector;
           }//end loop on Sectors
           
           
           for (int sec = 0 ; sec<6; sec++){
             diskFactor += sectorFactor[sec];   
             if(reportMe)       {
               if (d<0) reportMe->setBinContent(d+5, sec+1 , sectorFactor[sec]);
               else  reportMe->setBinContent(d+11, sec+1 , sectorFactor[sec]);
             }   
           }
           
           diskFactor = diskFactor/6;
           
           meName.str("");
           meName<<eventInfoPath_ + "/reportSummaryContents/RPC_Disk"<<d; 
           globalMe=dbe_->get(meName.str());
           if(globalMe) globalMe->Fill(diskFactor);
           
           endcapFactor += diskFactor;
         }//end loop on disks
         
       }
       
       endcapFactor=endcapFactor/ (numberDisk_ * 2);
       
     } 
     
     //Fill repor summary
     float rpcFactor = barrelFactor;
     if(doEndcapCertification_){ rpcFactor =  ( barrelFactor + endcapFactor)/2; }
     
     globalMe = dbe_->get(eventInfoPath_ +"/reportSummary"); 
     if(globalMe) globalMe->Fill(rpcFactor);
     
     
}
void RPCEventSummary::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

End Lumi Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 189 of file RPCEventSummary.cc.

References clientOperation(), init_, lumiCounter_, offlineDQM_, and prescaleFactor_.

                                                                                                       {  
  edm::LogVerbatim ("rpceventsummary") <<"[RPCEventSummary]: End of LS transition, performing DQM client operation";

  if(offlineDQM_) return;

  if(!init_){
    this->clientOperation();
    return;
  }

  lumiCounter_++;
  if(lumiCounter_%prescaleFactor_ != 0) return;

  this->clientOperation();

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

Reimplemented from edm::EDAnalyzer.

Definition at line 206 of file RPCEventSummary.cc.

References clientOperation().

                                                                   {
  
  this->clientOperation();
}

Member Data Documentation

Definition at line 51 of file RPCEventSummary.h.

Referenced by beginJob(), beginRun(), clientOperation(), and ~RPCEventSummary().

Definition at line 57 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

Definition at line 47 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

std::string RPCEventSummary::eventInfoPath_ [private]

Definition at line 44 of file RPCEventSummary.h.

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

std::pair<int, int> RPCEventSummary::FEDRange_ [private]

Definition at line 58 of file RPCEventSummary.h.

Referenced by beginRun(), and RPCEventSummary().

std::string RPCEventSummary::globalFolder_ [private]

Definition at line 54 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

bool RPCEventSummary::init_ [private]

Definition at line 50 of file RPCEventSummary.h.

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

Definition at line 53 of file RPCEventSummary.h.

Referenced by beginRun(), and endLuminosityBlock().

Definition at line 48 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

Definition at line 56 of file RPCEventSummary.h.

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

Definition at line 59 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

Definition at line 52 of file RPCEventSummary.h.

Referenced by endLuminosityBlock(), and RPCEventSummary().

std::string RPCEventSummary::prefixDir_ [private]

Definition at line 44 of file RPCEventSummary.h.

std::string RPCEventSummary::prefixFolder_ [private]

Definition at line 54 of file RPCEventSummary.h.

Referenced by clientOperation(), and RPCEventSummary().

Definition at line 48 of file RPCEventSummary.h.

Referenced by beginRun(), endLuminosityBlock(), and RPCEventSummary().

Definition at line 49 of file RPCEventSummary.h.

Referenced by clientOperation().