CMS 3D CMS Logo

Public Member Functions | Private Types | 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 Attributes

DQMStoredbe_
bool doEndcapCertification_
bool enableReportSummary_
std::string eventInfoPath_
std::pair< int, int > FEDRange_
std::string globalFolder_
bool init_
int minimumEvents_
int nLumiSegs_
int numberDisk_
int NumberOfFeds_
std::string prefixDir_
int prescaleFactor_
bool tier0_

Detailed Description

* DQM Event Summary module for RPCs

Date:
2010/06/25 14:46:41
Revision:
1.19
Author:
Anna Cimmino

Definition at line 31 of file RPCEventSummary.h.


Member Enumeration Documentation

Enumerator:
DEAD 
PARTIALLY_DEAD 

Definition at line 79 of file RPCEventSummary.h.

{DEAD = 6, PARTIALLY_DEAD=5};

Constructor & Destructor Documentation

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

Constructor.

Definition at line 17 of file RPCEventSummary.cc.

References doEndcapCertification_, enableReportSummary_, eventInfoPath_, FEDRange_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, minimumEvents_, numberDisk_, NumberOfFeds_, 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");
  globalFolder_ = ps.getUntrackedParameter<std::string>("RPCSummaryFolder", "RPC/RecHits/SummaryHistograms");
  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;

}
RPCEventSummary::~RPCEventSummary ( ) [virtual]

Destructor.

Definition at line 35 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 176 of file RPCEventSummary.cc.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 40 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 174 of file RPCEventSummary.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 45 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, numberDisk_, DQMStore::removeElement(), MonitorElement::setBinContent(), MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

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


 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++;
   }   
 }   
 
 init_=false;

 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::endLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  c 
) [virtual]

End Lumi Block.

Reimplemented from edm::EDAnalyzer.

Definition at line 178 of file RPCEventSummary.cc.

                                                                                                       {  
  edm::LogVerbatim ("rpceventsummary") <<"[RPCEventSummary]: End of LS transition, performing DQM client operation";
}
void RPCEventSummary::endRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 182 of file RPCEventSummary.cc.

References dbe_, DEAD, doEndcapCertification_, eventInfoPath_, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), globalFolder_, i, minimumEvents_, numberDisk_, PARTIALLY_DEAD, asciidump::s, MonitorElement::setBinContent(), and ExpressReco_HICollisions_FallBack::y.

                                                                   {


  float  rpcevents = 0;
   MonitorElement * RPCEvents = dbe_->get(globalFolder_ +"/RPCEvents");  

  if(RPCEvents) {
    rpcevents = RPCEvents -> getEntries();
   }

  if(rpcevents < minimumEvents_) return;

   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);
     
     
}

Member Data Documentation

Definition at line 69 of file RPCEventSummary.h.

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

Definition at line 75 of file RPCEventSummary.h.

Referenced by endRun(), and RPCEventSummary().

Definition at line 65 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

std::string RPCEventSummary::eventInfoPath_ [private]

Definition at line 62 of file RPCEventSummary.h.

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

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

Definition at line 76 of file RPCEventSummary.h.

Referenced by beginRun(), and RPCEventSummary().

std::string RPCEventSummary::globalFolder_ [private]

Definition at line 72 of file RPCEventSummary.h.

Referenced by endRun(), and RPCEventSummary().

bool RPCEventSummary::init_ [private]

Definition at line 68 of file RPCEventSummary.h.

Referenced by beginRun().

Definition at line 66 of file RPCEventSummary.h.

Referenced by endRun(), and RPCEventSummary().

Definition at line 71 of file RPCEventSummary.h.

Definition at line 74 of file RPCEventSummary.h.

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

Definition at line 77 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

std::string RPCEventSummary::prefixDir_ [private]

Definition at line 62 of file RPCEventSummary.h.

Definition at line 66 of file RPCEventSummary.h.

Referenced by RPCEventSummary().

bool RPCEventSummary::tier0_ [private]

Definition at line 64 of file RPCEventSummary.h.