CMS 3D CMS Logo

Public Member Functions | Public Attributes | Private Attributes

RPCEfficiencyShiftHisto Class Reference

#include <RPCEfficiencyShiftHisto.h>

Inheritance diagram for RPCEfficiencyShiftHisto:
edm::EDAnalyzer

List of all members.

Public Member Functions

void analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 Analyze.
void beginJob ()
 BeginJob.
void beginRun (const edm::Run &r, const edm::EventSetup &c)
void endRun (const edm::Run &r, const edm::EventSetup &c)
 RPCEfficiencyShiftHisto (const edm::ParameterSet &iConfig)
 Constructor.
virtual ~RPCEfficiencyShiftHisto ()
 Destructor.

Public Attributes

MonitorElementEffBarrelRoll
MonitorElementEffEndcapMinusRoll
MonitorElementEffEndcapPlusRoll
MonitorElementRollPercentage

Private Attributes

DQMStoredbe_
int effCut_
std::string globalFolder_
std::string NameFile
int numberOfDisks_
bool SaveFile

Detailed Description

* RPCEfficiencyShiftHisto

Date:
2010/08/16 10:16:09
Revision:
1.1
Author:
Cesare Calabria

Definition at line 31 of file RPCEfficiencyShiftHisto.h.


Constructor & Destructor Documentation

RPCEfficiencyShiftHisto::RPCEfficiencyShiftHisto ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 25 of file RPCEfficiencyShiftHisto.cc.

References effCut_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, NameFile, numberOfDisks_, and SaveFile.

                                                                          {

  globalFolder_ = ps.getUntrackedParameter<std::string>("GlobalFolder", "RPC/RPCEfficiency/");
  effCut_= ps.getUntrackedParameter<int>("EffCut", 90);
  SaveFile  = ps.getUntrackedParameter<bool>("SaveFile", false);
  NameFile  = ps.getUntrackedParameter<std::string>("NameFile","RPCEfficiency.root");
  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
}
RPCEfficiencyShiftHisto::~RPCEfficiencyShiftHisto ( ) [virtual]

Destructor.

Definition at line 35 of file RPCEfficiencyShiftHisto.cc.

{ }

Member Function Documentation

void RPCEfficiencyShiftHisto::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 37 of file RPCEfficiencyShiftHisto.cc.

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

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 39 of file RPCEfficiencyShiftHisto.cc.

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

void RPCEfficiencyShiftHisto::beginRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 44 of file RPCEfficiencyShiftHisto.cc.

References DQMStore::book1D(), DQMStore::book2D(), dbe_, EffBarrelRoll, EffEndcapMinusRoll, EffEndcapPlusRoll, globalFolder_, RollPercentage, MonitorElement::setBinLabel(), and DQMStore::setCurrentFolder().

                                                                             {

  if(dbe_ == 0) return;

  dbe_->setCurrentFolder(globalFolder_);
  EffBarrelRoll = dbe_->book1D("EffBarrelRoll", "Barrel Efficiency",101,-0.5, 100.5);
  EffEndcapPlusRoll = dbe_->book1D("EffEndcapPlusRoll", "Endcap + Efficiency",101,-0.5, 100.5);
  EffEndcapMinusRoll = dbe_->book1D("EffEndcapMinusRoll", "Endcap - Efficiency",101,-0.5, 100.5);
  RollPercentage = dbe_->book2D("RollPercentage", "RollPercentage",1,0.,1.,3,0.,3.);

  RollPercentage->setBinLabel(1,"%",1);
  RollPercentage->setBinLabel(1,"E+",2);
  RollPercentage->setBinLabel(2,"B",2);
  RollPercentage->setBinLabel(3,"E-",2);
}
void RPCEfficiencyShiftHisto::endRun ( const edm::Run r,
const edm::EventSetup c 
) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 60 of file RPCEfficiencyShiftHisto.cc.

References dbe_, EffBarrelRoll, effCut_, EffEndcapMinusRoll, EffEndcapPlusRoll, MonitorElement::Fill(), DQMStore::get(), MonitorElement::getBinContent(), MonitorElement::getNbinsX(), MonitorElement::getNbinsY(), globalFolder_, NameFile, numberOfDisks_, RollPercentage, alignCSCRings::s, DQMStore::save(), SaveFile, MonitorElement::setBinContent(), w(), x, and detailsBasic3DVector::y.

                                                                           {

   std::stringstream meName;
   MonitorElement * myMe;
   
   meName.str("");
   meName<<globalFolder_;

   //Barrel

   int entriesBarrel = 0;
   int entriesBarrelBeyondEff = 0;
   float percBarrel = 0;

   for(int w = -2 ; w<3; w++){
     
       meName.str("");
       if(w <= 0) meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_"<<w;
       else meName<<globalFolder_<<"Efficiency_Roll_vs_Sector_Wheel_+"<<w;

       myMe = dbe_->get(meName.str());
         
       if(myMe){
         for(int s = 1; s <= myMe->getNbinsX(); s++){
           for(int r = 1;r <= myMe->getNbinsY(); r++){
           
                double effBarrel = myMe->getBinContent(s,r);

                if(effBarrel >= 0){//5

                  if (EffBarrelRoll) EffBarrelRoll->Fill(effBarrel);
                        entriesBarrel++;

                        if(effBarrel >= effCut_) entriesBarrelBeyondEff++;
                }
           }
         }
       }
     }

     if(entriesBarrel != 0){
        percBarrel = 100*entriesBarrelBeyondEff/entriesBarrel;
        if(RollPercentage)RollPercentage->setBinContent(1,2,percBarrel);}


   //EndcapMinus

   int entriesEndcapMinus = 0;
   int entriesEndcapMinusBeyondEff = 0;
   float percEndcapMinus = 0;
   int entriesEndcapPlus = 0;
   int entriesEndcapPlusBeyondEff = 0;
   float percEndcapPlus = 0;
     for(int d = -numberOfDisks_ ; d <= numberOfDisks_; d++){
         
       if(d == 0) continue;

         meName.str("");
         meName<<globalFolder_<<"Efficiency_Roll_vs_Segment_Disk_"<<d;
         myMe = dbe_->get(meName.str());

       
       if(myMe){    

         for (int x = 1 ;x <= myMe->getNbinsX();x++){
           for(int y = 1;y<=myMe->getNbinsY(); y++){

                double effEndcap = myMe->getBinContent(x,y);
        
                if(d<0 ){
                  entriesEndcapMinus++; 
                  if(EffEndcapMinusRoll)EffEndcapMinusRoll->Fill(effEndcap);
                  if(effEndcap >= effCut_) entriesEndcapMinusBeyondEff++;
                }else {
                  entriesEndcapPlus++;
                  if(EffEndcapPlusRoll)EffEndcapPlusRoll->Fill(effEndcap);
                  if(effEndcap >= effCut_) entriesEndcapPlusBeyondEff++;
                }
           }
         }
       }
     }


     if(entriesEndcapMinus != 0){
       percEndcapMinus = 100*entriesEndcapMinusBeyondEff/entriesEndcapMinus;
       if( RollPercentage) RollPercentage->setBinContent(1,3,percEndcapMinus);}


     if(entriesEndcapPlus != 0){
        percEndcapPlus = 100*entriesEndcapPlusBeyondEff/entriesEndcapPlus;
        if(RollPercentage)      RollPercentage->setBinContent(1,1,percEndcapPlus);
     }

     if(SaveFile) dbe_->save(NameFile);

}

Member Data Documentation

Definition at line 65 of file RPCEfficiencyShiftHisto.h.

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

Definition at line 52 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

Definition at line 63 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

Definition at line 54 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

Definition at line 53 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

Definition at line 67 of file RPCEfficiencyShiftHisto.h.

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

std::string RPCEfficiencyShiftHisto::NameFile [private]

Definition at line 61 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

Definition at line 62 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().

Definition at line 55 of file RPCEfficiencyShiftHisto.h.

Referenced by beginRun(), and endRun().

Definition at line 59 of file RPCEfficiencyShiftHisto.h.

Referenced by endRun(), and RPCEfficiencyShiftHisto().