CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

L1THcalClient Class Reference

#include <DQM/L1THcalClient/src/L1THcalClient.cc>

Inheritance diagram for L1THcalClient:
edm::EDAnalyzer

List of all members.

Public Member Functions

TH1F * get1DHisto (std::string meName, DQMStore *dbi)
TH2F * get2DHisto (std::string meName, DQMStore *dbi)
 L1THcalClient (const edm::ParameterSet &)
 ~L1THcalClient ()

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
virtual void beginJob (void)
void calcEff (TH1F *num, TH1F *den, MonitorElement *me)
virtual void endJob ()

Private Attributes

DQMStoredbe
MonitorElementhcalEff_1_
MonitorElementhcalEff_2_
MonitorElementhcalEff_3_
MonitorElementhcalEff_4_
MonitorElementhcalEff_HBHE [56][72]
MonitorElementhcalEff_HF [8][18]
MonitorElementhcalPlateau_
MonitorElementhcalThreshold_
MonitorElementhcalWidth_
std::string input_dir
int minEventsforFit
int nevents
int nupdates
std::string output_dir

Detailed Description

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>="">

Definition at line 43 of file L1THcalClient.h.


Constructor & Destructor Documentation

L1THcalClient::L1THcalClient ( const edm::ParameterSet iConfig) [explicit]

Definition at line 53 of file L1THcalClient.cc.

References edm::ParameterSet::getUntrackedParameter(), cmsCodeRules::cppFunctionSkipper::operator, and o2o::output_dir.

{
  minEventsforFit = iConfig.getUntrackedParameter<int>("minEventsforFit",1000);
  input_dir = "L1T/L1THCALTPGXAna/";
  output_dir = "L1T/L1THCALTPGXAna/Tests/";

  dbe = edm::Service<DQMStore>().operator->();
  //  dbe->showDirStructure();
  //  dbe->setVerbose(1); 

  LogInfo( "TriggerDQM");
}
L1THcalClient::~L1THcalClient ( )

Definition at line 68 of file L1THcalClient.cc.

{
 
 LogInfo("TriggerDQM")<<"[TriggerDQM]: ending... ";

}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 163 of file L1THcalClient.cc.

References gather_cfg::cout, i, j, nevents, o2o::output_dir, dtT0WireCalibration_cfg::threshold, and tablePrinter::width.

{
   using namespace edm;
  nevents++;
  if (nevents%10 == 0)    LogInfo("TriggerDQM")<<"[TriggerDQM]: event analyzed "<<nevents;

  //}
  //  //void L1THcalClient::endLuminosityBlock(const edm::LuminosityBlock & iLumiSection, const edm::EventSetup & iSetup) {
  //  LogInfo("TriggerDQM")<<"[TriggerDQM]: end Lumi Section.";
  //dbe->setCurrentFolder("L1T/QTests");
  TF1 *turnon = new TF1("turnon","[0]*0.5*(TMath::Erf((x -[1])*0.5/[2])+1.)",0,30);
  TH1F *eff_histo;

  //efficiency by region
  //std::cout << "before eff calc \n";
  TH1F *hcalEff_num = this->get1DHisto(input_dir+"HcalTP1",dbe);
  if (!hcalEff_num) std::cout << "numerator not found\n";
  TH1F *hcalEff_den = this->get1DHisto(input_dir+"HcalAll1",dbe);
  if (!hcalEff_den) std::cout << "denominator not found\n";
  //hcalEff_1_ =
  //  dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE);
  calcEff(hcalEff_num, hcalEff_den, hcalEff_1_);
  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
    {
      eff_histo = this->get1DHisto(output_dir+"HcalEff1",dbe);
      turnon->SetParameter(0,1);
      turnon->SetParameter(1,2);
      turnon->SetParameter(2,6);
      eff_histo->Fit("turnon","LL,E");
    }
  hcalEff_num = this->get1DHisto(input_dir+"HcalTP2",dbe);
  if (!hcalEff_num) std::cout << "numerator not found\n";
  hcalEff_den = this->get1DHisto(input_dir+"HcalAll2",dbe);
  if (!hcalEff_den) std::cout << "denominator not found\n";
  //hcalEff_2_ =
  // dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE);
  calcEff(hcalEff_num, hcalEff_den, hcalEff_2_);
    if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
      {
        eff_histo = this->get1DHisto(output_dir+"HcalEff2",dbe);
        turnon->SetParameter(0,1);
        turnon->SetParameter(1,2);
        turnon->SetParameter(2,6);
        eff_histo->Fit("turnon","LL,E");
      }
  hcalEff_num = this->get1DHisto(input_dir+"HcalTP3",dbe);
  if (!hcalEff_num) std::cout << "numerator not found\n";
  hcalEff_den = this->get1DHisto(input_dir+"HcalAll3",dbe);
  if (!hcalEff_den) std::cout << "denominator not found\n";
  //hcalEff_3_ =
  //dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE);
  calcEff(hcalEff_num, hcalEff_den, hcalEff_3_);
  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
    {
      eff_histo = this->get1DHisto(output_dir+"HcalEff3",dbe);
      turnon->SetParameter(0,1);
      turnon->SetParameter(1,3);
      turnon->SetParameter(2,6);
      eff_histo->Fit("turnon","LL,E");
    }
  hcalEff_num = this->get1DHisto(input_dir+"HcalTP4",dbe);
  if (!hcalEff_num) std::cout << "numerator not found\n";
  hcalEff_den = this->get1DHisto(input_dir+"HcalAll4",dbe);
  if (!hcalEff_den) std::cout << "denominator not found\n";
  // hcalEff_4_ =
  //dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF);
  calcEff(hcalEff_num, hcalEff_den, hcalEff_4_);
  if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
    {
      eff_histo = this->get1DHisto(output_dir+"HcalEff4",dbe);
      turnon->SetParameter(0,1);
      turnon->SetParameter(1,1);
      turnon->SetParameter(2,6);
      eff_histo->Fit("turnon","LL,E");
    }
  double plateau, threshold, width;

  
  if (0){
  //efficiency histos for HBHE
  for (int i=0; i < 56; i++)
    {
      char hname[20],htitle[30];
      int ieta, iphi;
      char subdirname[80];
      for (int j=0; j < 72; j++)
        {
          iphi = j+1;
          if (i<28) ieta = i-28;
          else ieta = i-27;
          sprintf(hname,"eff_%d_%d",ieta,iphi);
          sprintf(htitle,"Eff  <%d,%d>",ieta,iphi);
          //hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE);
          sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta);
          hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe);
          hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe);
     if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n";
          if (!hcalEff_num) std::cout << "numerator not found\n";
          if (!hcalEff_den) std::cout << "denominator not found\n";
          calcEff(hcalEff_num, hcalEff_den, hcalEff_HBHE[i][j]);

          if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
            {
              sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta);
              eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe);
              turnon->SetParameter(0,1);
              turnon->SetParameter(1,3);
              turnon->SetParameter(2,6);
              eff_histo->Fit("turnon","LL,E");
              plateau = turnon->GetParameter(0);
              threshold = turnon->GetParameter(1);
              width = turnon->GetParameter(2);
              hcalPlateau_->Fill(ieta,iphi,plateau);
              hcalThreshold_->Fill(ieta,iphi,threshold);
              hcalWidth_->Fill(ieta,iphi,width);
            }
        }
    }
  //efficiency histos for HF
  for (int i=0; i < 8; i++)
    {
      char hname[20],htitle[30];
      int ieta, iphi;
      char subdirname[80];
      for (int j=0; j < 18; j++)
        {
          iphi = j*4+1;
          if (i<4) ieta = i-32;
          else ieta = i+25;
          sprintf(hname,"eff_%d_%d",ieta,iphi);
          sprintf(htitle,"Eff  <%d,%d>",ieta,iphi);
          //hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF);
          sprintf(subdirname,"%sEffByChannel/EtaTower%d/",input_dir.c_str(),ieta);
          hcalEff_num = this->get1DHisto((string)subdirname+(string)hname+"_num",dbe);
          hcalEff_den = this->get1DHisto((string)subdirname+(string)hname+"_den",dbe);
          if (!hcalEff_num) std::cout <<(string)subdirname+(string)hname+"_num" << "numerator not found\n";
          if (!hcalEff_den) std::cout << "denominator not found\n";
          calcEff(hcalEff_num, hcalEff_den, hcalEff_HF[i][j]);
          if (hcalEff_num->GetEntries() > minEventsforFit && nevents%1000 == 0)
            {
              sprintf(subdirname,"%sEffByChannel/EtaTower%d/",output_dir.c_str(),ieta);
              eff_histo = this->get1DHisto((string)subdirname+(string)hname,dbe);
              turnon->SetParameter(0,1);
              turnon->SetParameter(1,1);
              turnon->SetParameter(2,6);
              eff_histo->Fit("turnon","LL,E");
              plateau = turnon->GetParameter(0);
              threshold = turnon->GetParameter(1);
              width = turnon->GetParameter(2);
              hcalPlateau_->Fill(ieta,iphi,plateau);
              hcalThreshold_->Fill(ieta,iphi,threshold);
              hcalWidth_->Fill(ieta,iphi,width);
            }
        }
    }
  }
}
void L1THcalClient::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file L1THcalClient.cc.

References effBins, effMaxHBHE, effMaxHF, effMinHBHE, effMinHF, i, j, nevents, o2o::output_dir, TPETABINS, TPETAMAX, TPETAMIN, TPPHIBINS, TPPHIMAX, and TPPHIMIN.

{
  LogInfo("TriggerDQM")<<"[TriggerDQM]: Begin Job";
  //  LogInfo("TriggerDQM")<<"[TriggerDQM]: Standalone = "<<stdalone;
  nevents = 0;
  dbe->setCurrentFolder(output_dir);
  //2-D plots
  hcalPlateau_ =
    dbe->book2D("FitPlateau","HCAL Fit Plateau",TPETABINS,TPETAMIN,TPETAMAX,
                TPPHIBINS,TPPHIMIN,TPPHIMAX);
  hcalThreshold_ =
    dbe->book2D("FitThreshold","HCAL Fit Threshold",TPETABINS,TPETAMIN,TPETAMAX,
                TPPHIBINS,TPPHIMIN,TPPHIMAX);
  hcalWidth_ =
    dbe->book2D("FitWidth","HCAL Fit Width",TPETABINS,TPETAMIN,TPETAMAX,
                TPPHIBINS,TPPHIMIN,TPPHIMAX);
  hcalEff_1_ =
    dbe->book1D("HcalEff1","HCAL Efficiency - 1",effBins,effMinHBHE,effMaxHBHE);
  hcalEff_2_ =
    dbe->book1D("HcalEff2","HCAL Efficiency - 2",effBins,effMinHBHE,effMaxHBHE);
  hcalEff_3_ =
    dbe->book1D("HcalEff3","HCAL Efficiency - 3",effBins,effMinHBHE,effMaxHBHE);
  hcalEff_4_ =
    dbe->book1D("HcalEff4","HCAL Efficiency - 4",effBins,effMinHF,effMaxHF);



           
  if (0){ 
      //efficiency histos for HBHE
      for (int i=0; i < 56; i++)
        {      
          char hname[20],htitle[20];
          char dirname[80];
          int ieta, iphi;
          if (i<28) ieta = i-28;
          else ieta = i-27;
          sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta);
          dbe->setCurrentFolder(dirname);
          for (int j=0; j < 72; j++) 
            {
              iphi = j+1;
              if (i<28) ieta = i-28;
              else ieta = i-27;
              sprintf(hname,"eff_%d_%d",ieta,iphi);
              sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
              hcalEff_HBHE[i][j] = dbe->book1D(hname, htitle, effBins,effMinHBHE,effMaxHBHE);
            }        
        }
      //efficiency histos for HF
      for (int i=0; i < 8; i++)
        {
          char hname[20],htitle[20];
          char dirname[80];
          int ieta, iphi;
          if (i<4) ieta = i-32;
          else ieta = i+25;
          sprintf(dirname,"%sEffByChannel/EtaTower%d",output_dir.c_str(),ieta);
          dbe->setCurrentFolder(dirname);
          for (int j=0; j < 18; j++)
            {
              iphi = j*4+1;
              if (i<4) ieta = i-32;
              else ieta = i+25;
              sprintf(hname,"eff_%d_%d",ieta,iphi);
              sprintf(htitle,"Eff <%d,%d>",ieta,iphi);
              hcalEff_HF[i][j] = dbe->book1D(hname, htitle, effBins,effMinHF,effMaxHF);
            }
        }
     }

}
void L1THcalClient::calcEff ( TH1F *  num,
TH1F *  den,
MonitorElement me 
) [private]

Definition at line 321 of file L1THcalClient.cc.

References newFWLiteAna::bin, gather_cfg::cout, and MonitorElement::setBinContent().

{
  if (num->GetNbinsX() != den->GetNbinsX()) 
    {
      std::cout << "numerator and denominator do not have the same number of bins!\n";
      return;
    }
  double eff;
  for (int bin = 0; bin <= num->GetNbinsX(); bin++)
    {
      if (den->GetBinContent(bin) != 0) eff = num->GetBinContent(bin)/den->GetBinContent(bin);
      else eff = 0;
      me->setBinContent(bin,eff);
    }
}
void L1THcalClient::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 156 of file L1THcalClient.cc.

                           {

   LogInfo("TriggerDQM")<<"[TriggerDQM]: endJob";

}
TH1F* L1THcalClient::get1DHisto ( std::string  meName,
DQMStore dbi 
)
TH2F* L1THcalClient::get2DHisto ( std::string  meName,
DQMStore dbi 
)

Member Data Documentation

Definition at line 61 of file L1THcalClient.h.

Definition at line 76 of file L1THcalClient.h.

Definition at line 77 of file L1THcalClient.h.

Definition at line 78 of file L1THcalClient.h.

Definition at line 79 of file L1THcalClient.h.

Definition at line 80 of file L1THcalClient.h.

Definition at line 81 of file L1THcalClient.h.

Definition at line 73 of file L1THcalClient.h.

Definition at line 74 of file L1THcalClient.h.

Definition at line 75 of file L1THcalClient.h.

std::string L1THcalClient::input_dir [private]

Definition at line 64 of file L1THcalClient.h.

Definition at line 66 of file L1THcalClient.h.

int L1THcalClient::nevents [private]

Definition at line 59 of file L1THcalClient.h.

int L1THcalClient::nupdates [private]

Definition at line 59 of file L1THcalClient.h.

std::string L1THcalClient::output_dir [private]

Definition at line 65 of file L1THcalClient.h.