CMS 3D CMS Logo

Public Member Functions | Private Attributes

RPCBxTest Class Reference

#include <RPCBxTest.h>

Inheritance diagram for RPCBxTest:
RPCClient

List of all members.

Public Member Functions

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

Private Attributes

MonitorElementBXEntriesBarrel
MonitorElementBXEntriesEndcapN
MonitorElementBXEntriesEndcapP
MonitorElementBXMeanBarrel
MonitorElementBXMeanDisk [10]
MonitorElementBXMeanEndcapN
MonitorElementBXMeanEndcapP
MonitorElementBXMeanWheel [5]
MonitorElementBXRmsBarrel
MonitorElementBXRmsDisk [10]
MonitorElementBXRmsEndcapN
MonitorElementBXRmsEndcapP
MonitorElementBXRmsWheel [5]
DQMStoredbe_
double distanceMean_
int entriesCut_
std::string globalFolder_
std::vector< MonitorElement * > myBXMe_
std::vector< RPCDetIdmyDetIds_
int nLumiSegs_
int numberOfDisks_
int numberOfRings_
int prescaleFactor_
double rmsCut_

Detailed Description

Definition at line 13 of file RPCBxTest.h.


Constructor & Destructor Documentation

RPCBxTest::RPCBxTest ( const edm::ParameterSet ps)

Constructor.

Definition at line 13 of file RPCBxTest.cc.

References distanceMean_, entriesCut_, edm::ParameterSet::getUntrackedParameter(), globalFolder_, numberOfDisks_, numberOfRings_, prescaleFactor_, and rmsCut_.

                                              {
  edm::LogVerbatim ("rpcbxtest") << "[RPCBxTest]: Constructor";
  
  prescaleFactor_ =  ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
  
  //Nome della dir per gli istogrammi nuovi . Cominciare sempre con RPC/RecHits/
  globalFolder_ = ps.getUntrackedParameter<std::string>("RPCGlobalFolder", "RPC/RecHits/SummaryHistograms/");
  
  entriesCut_ = ps.getUntrackedParameter<int>("EntriesCut");
  rmsCut_ = ps.getUntrackedParameter<double>("RMSCut");
  distanceMean_ = ps.getUntrackedParameter<double>("DistanceFromZeroBx");

  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 3);
  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
}
RPCBxTest::~RPCBxTest ( ) [virtual]

Destructor.

Definition at line 29 of file RPCBxTest.cc.

References dbe_.

{ dbe_=0;}

Member Function Documentation

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

Analyze.

Implements RPCClient.

Definition at line 164 of file RPCBxTest.cc.

{}
void RPCBxTest::beginJob ( DQMStore dbe)

BeginJob.

Definition at line 31 of file RPCBxTest.cc.

References dbe_.

                                       {
  edm::LogVerbatim ("rpcbxtest") << "[RPCBxTest]: Begin job ";
  dbe_ = dbe;
}
void RPCBxTest::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [virtual]

Begin Lumi block.

Implements RPCClient.

Definition at line 161 of file RPCBxTest.cc.

                                                                                                   {
} 
void RPCBxTest::beginRun ( const edm::Run r,
const edm::EventSetup c,
std::vector< MonitorElement * >  meVector,
std::vector< RPCDetId detIdVector 
)

Definition at line 37 of file RPCBxTest.cc.

References DQMStore::book1D(), BXEntriesBarrel, BXEntriesEndcapN, BXEntriesEndcapP, BXMeanBarrel, BXMeanDisk, BXMeanEndcapN, BXMeanEndcapP, BXMeanWheel, BXRmsBarrel, BXRmsDisk, BXRmsEndcapN, BXRmsEndcapP, BXRmsWheel, dbe_, DQMStore::get(), MonitorElement::getName(), globalFolder_, i, MessageLogger_cff::limit, myBXMe_, myDetIds_, numberOfDisks_, rpcdqm::OCCUPANCY, evf::evtn::offset(), DQMStore::removeElement(), MonitorElement::setAxisTitle(), DQMStore::setCurrentFolder(), packageDocSplitter::tagList, and w().

                                                                                                                                      {
  edm::LogVerbatim ("rpcbxtest") << "[RPCBxTest]: Begin run";
  
  MonitorElement* me;
  dbe_->setCurrentFolder(globalFolder_);

  std::stringstream histoName;

  histoName.str("");
  histoName<<"BX_Mean_Distribution_Barrel";  
  BXMeanBarrel = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 11, -5.5, 5.5);
  BXMeanBarrel->setAxisTitle("Bx",1);

  histoName.str("");
  histoName<<"BX_Mean_Distribution_EndcapP";  
  BXMeanEndcapP = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 11, -5.5, 5.5);

  histoName.str("");
  histoName<<"BX_Mean_Distribution_EndcapN";  
  BXMeanEndcapN = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 11, -5.5, 5.5);


  histoName.str("");
  histoName<<"BX_Entries_Distribution_Barrel";  
  BXEntriesBarrel = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 1000, -0.5, 999.5);

  histoName.str("");
  histoName<<"BX_Entries_Distribution_EndcapP";  
  BXEntriesEndcapP = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),1000, -0.5, 999.5); 

  histoName.str("");
  histoName<<"BX_Entries_Distribution_EndcapN";  
  BXEntriesEndcapN = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 1000, -0.5, 999.5);


  histoName.str("");
  histoName<<"BX_RMS_Distribution_Barrel"; 
  BXRmsBarrel = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 21, -0.1, 4.1);

  histoName.str("");
  histoName<<"BX_RMS_Distribution_EndcapP"; 
  BXRmsEndcapP = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 21, -0.1, 4.1);

  histoName.str("");
  histoName<<"BX_RMS_Distribution_EndcapN"; 
  BXRmsEndcapN = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 21, -0.1, 4.1);

  rpcdqm::utils rpcUtils;

  int limit = numberOfDisks_;
  if(numberOfDisks_ < 2) limit = 2;
  
  for (int w = -1 * limit; w<=limit;w++ ){//loop on wheels and disks
    if (w>-3 && w<3){//wheels
      histoName.str("");
      histoName<<"BX_Mean_Distribution_Wheel"<<w;     
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me ) {
        dbe_->removeElement(me->getName());
      }
      BXMeanWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 10, -0.5, 9.5);
  
      histoName.str("");
      histoName<<"BX_RMS_Distribution_Wheel"<<w;     
      me = 0;
      me = dbe_->get(globalFolder_ + histoName.str()) ;
      if ( 0!=me){
        dbe_->removeElement(me->getName());
      }
      BXRmsWheel[w+2] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 50, -0.5, 4.5);
    }//end loop on wheels

    if (w == 0 || w< (-1 * numberOfDisks_) || w > numberOfDisks_)continue;
    //Endcap
    int offset = numberOfDisks_;
    if (w>0) offset --; //used to skip case equale to zero
      
    histoName.str("");
    histoName<<"BX_Mean_Distribution_Disk"<<w;     
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me){
      dbe_->removeElement(me->getName());
    }
    BXMeanDisk[w+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(),10, -0.5, 9.5);
    
   
    histoName.str("");
    histoName<<"BX_RMS_Distribution_Disk"<<w;    
    me = 0;
    me = dbe_->get(globalFolder_ + histoName.str()) ;
    if ( 0!=me){
      dbe_->removeElement(me->getName());
    }
    BXRmsDisk[w+offset] = dbe_->book1D(histoName.str().c_str(), histoName.str().c_str(), 50, -0.5, 4.5);
 }


  //Qui prende gli isto del BX per roll definiti nel client
  //crea due vettore ordinati myBXMe_(istogrammi) e myDetIds_(rpcDetId)
 //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::OCCUPANCY)
       flag= true;
     tagItr++;
   }
   
   if(flag){
     myBXMe_.push_back(meVector[i]);
     myDetIds_.push_back(detIdVector[i]);
   }
 }

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

Implements RPCClient.

Definition at line 168 of file RPCBxTest.cc.

                            {
  edm::LogVerbatim ("rpcbxtest") << "[RPCBxTest]: end job ";

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

End Lumi Block.

Implements RPCClient.

Definition at line 166 of file RPCBxTest.cc.

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

Implements RPCClient.

Definition at line 184 of file RPCBxTest.cc.

References BXEntriesBarrel, BXEntriesEndcapN, BXEntriesEndcapP, BXMeanBarrel, BXMeanDisk, BXMeanEndcapN, BXMeanEndcapP, BXMeanWheel, BXRmsBarrel, BXRmsDisk, BXRmsEndcapN, BXRmsEndcapP, BXRmsWheel, python::tagInventory::entries, entriesCut_, MonitorElement::Fill(), MonitorElement::getTH1F(), i, timingPdfMaker::mean, myBXMe_, myDetIds_, NULL, RPCDetId::region(), RPCDetId::ring(), plotscripts::rms(), rmsCut_, and RPCDetId::station().

                                                               {

  MonitorElement * myMe;
  RPCDetId detId;
  TH1F * myTH1F;

  MonitorElement * ENTRIES =NULL; 
  MonitorElement * MEAN =NULL;  
  MonitorElement * MEANRing =NULL;  
  MonitorElement * RMS =NULL; 
  MonitorElement * RMSRing =NULL;  

  for (unsigned int  i = 0 ; i<myBXMe_.size();i++){

    myMe = myBXMe_[i];
    detId = myDetIds_[i];

    //Prendi TH1F corrispondente al Monitor Element
    myTH1F = myMe->getTH1F();
   //  //Spegni Overflow
//     myTH1F->StatOverflows(false); // per accendere overflow mettere true
//     //Ricalcola la media e l'RMS  //commentare le 3 righe seguenti. Ricorda di ricompilare
//     myTH1F->GetXaxis()->SetRangeUser(-9.5,9.5);
//     Double_t stat[4];
//     myTH1F->GetStats(stat);


    float mean = myTH1F->GetMean();
    float rms = myTH1F->GetRMS();
    float entries = myTH1F->GetEntries();

    //Get Occupancy ME for roll
    RPCGeomServ RPCname(detId);
    //  if(rms==0) cout<<RPCname.name()<<endl;

    if(detId.region()== 0){
      ENTRIES =  BXEntriesBarrel;
      MEAN = BXMeanBarrel; //nome istogramma definito in beginRun
      MEANRing = BXMeanWheel[detId.ring()+2];
      RMS = BXRmsBarrel;
      RMSRing = BXRmsWheel[detId.ring()+2];
    }else if(detId.region()==1){
      ENTRIES =  BXEntriesEndcapP;
      MEAN = BXMeanEndcapP;
      MEANRing = BXMeanDisk[detId.station()+2];
      RMS = BXRmsEndcapP;
      RMSRing = BXRmsDisk[detId.station()+2];
    }else if(detId.region()==-1){
      ENTRIES =  BXEntriesEndcapN;
      MEAN = BXMeanEndcapN;
      MEANRing = BXMeanDisk[3-detId.station()];
      RMS = BXRmsEndcapN;
      RMSRing = BXRmsDisk[3-detId.station()];
    }

    ENTRIES->Fill(entries);

    if(entries  >= entriesCut_){
      RMSRing->Fill(rms);
      RMS->Fill(rms);
      
      if(rms <= rmsCut_){

        //if(mean> distanceMean_ || mean<-distanceMean_ )  cout<<RPCname.name()<<endl;

        MEAN->Fill(mean);
        MEANRing->Fill(mean);
      }
    }
    
  }
}

Member Data Documentation

Definition at line 57 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 55 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 56 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 61 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 63 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 59 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 60 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 62 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 67 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 68 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 65 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 66 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 69 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

Definition at line 49 of file RPCBxTest.h.

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

double RPCBxTest::distanceMean_ [private]

Definition at line 43 of file RPCBxTest.h.

Referenced by RPCBxTest().

int RPCBxTest::entriesCut_ [private]

Definition at line 48 of file RPCBxTest.h.

Referenced by endRun(), and RPCBxTest().

std::string RPCBxTest::globalFolder_ [private]

Definition at line 44 of file RPCBxTest.h.

Referenced by beginRun(), and RPCBxTest().

std::vector<MonitorElement *> RPCBxTest::myBXMe_ [private]

Definition at line 52 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

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

Definition at line 53 of file RPCBxTest.h.

Referenced by beginRun(), and endRun().

int RPCBxTest::nLumiSegs_ [private]

Definition at line 50 of file RPCBxTest.h.

Definition at line 45 of file RPCBxTest.h.

Referenced by beginRun(), and RPCBxTest().

Definition at line 45 of file RPCBxTest.h.

Referenced by RPCBxTest().

Definition at line 46 of file RPCBxTest.h.

Referenced by RPCBxTest().

double RPCBxTest::rmsCut_ [private]

Definition at line 47 of file RPCBxTest.h.

Referenced by endRun(), and RPCBxTest().