CMS 3D CMS Logo

Public Member Functions | Private Attributes

CalibClosureTest Class Reference

Inheritance diagram for CalibClosureTest:
ManipHist FitHist CompHist

List of all members.

Public Member Functions

 CalibClosureTest ()
void configBlockSpecific (ConfigFile &)
void drawCorrel ()
void drawEff ()
TString output (const char *, std::string &, std::string &, const char *)
TString output (const char *, std::string &, const char *)
virtual void readConfig (std::string)
 ~CalibClosureTest ()

Private Attributes

std::vector< std::string > cmpObjLabelList_
std::vector< std::string > corrAxesLabelList_
std::vector< std::string > corrHistNameList_
std::vector< std::string > effAxesLabelList_
std::vector< std::string > effHistNameList_

Detailed Description

Definition at line 14 of file CalibClosureTest.cc.


Constructor & Destructor Documentation

CalibClosureTest::CalibClosureTest ( ) [inline]

Definition at line 16 of file CalibClosureTest.cc.

{};
CalibClosureTest::~CalibClosureTest ( ) [inline]

Definition at line 17 of file CalibClosureTest.cc.

{};

Member Function Documentation

void CalibClosureTest::configBlockSpecific ( ConfigFile cfg)

Definition at line 48 of file CalibClosureTest.cc.

References dtNoiseDBValidation_cfg::cerr, cmsRelvalreport::exit, ConfigFile::read(), and readVector().

{
  //-----------------------------------------------
  // read all configurables defined in CompHisto-
  // grams from config file. Throw human readable 
  // exception when misspellings occure
  //-----------------------------------------------
  try{
    //-----------------------------------------------
    // input/output files
    //-----------------------------------------------
    readVector ( cfg.read<std::string>( "corrHistNames" ), corrHistNameList_ );
    readLabels ( cfg.read<std::string>( "corrAxesLabels"), corrAxesLabelList_);
    readVector ( cfg.read<std::string>( "effHistNames"  ), effHistNameList_  );
    readLabels ( cfg.read<std::string>( "effAxesLabels" ), effAxesLabelList_ );
    readVector ( cfg.read<std::string>( "cmpObjectLabels"), cmpObjLabelList_ );
  }
  catch(...){
    std::cerr << "ERROR during reading of config file" << std::endl;
    std::cerr << "      misspelled variables in cfg ?" << std::endl;
    std::cerr << "      [--called in configBlockSpecific--]" << std::endl;
    std::exit(1);
  }
}
void CalibClosureTest::drawCorrel ( )

Definition at line 162 of file CalibClosureTest.cc.

References estimatePileup::hist, UserOptions_cff::idx, and convertSQLitetoXML_cfg::output.

Referenced by main().

{
  std::vector<TObjArray> corrSampleList;
  loadHistograms(corrHistNameList_, corrSampleList);

  TCanvas *canv = new TCanvas("canv", "histograms", 600, 600);
  setCanvasStyle( *canv  );
  canv->SetGridx( 1 );
  canv->SetGridy( 1 );

  //---------------------------------------------
  // loop histograms via the list of histogram 
  // names stored in corrHistNameList_, open a 
  // new file for each histogram and each sample
  //---------------------------------------------
  for(unsigned int jdx=0; jdx<corrHistNameList_.size(); ++jdx){  
    //---------------------------------------------
    // loop all available samples, open a new file
    // for each sample
    //---------------------------------------------
    std::vector<TObjArray>::const_iterator hist = corrSampleList.begin();
    for(unsigned int idx=0; hist!=corrSampleList.end(); ++hist, ++idx){  
      TLegend* leg = new TLegend(legXLeft_,legYLower_,legXRight_,legYUpper_);
      setLegendStyle( *leg ); 
      
      TPostScript psFile(output("/inspectCorrel_", corrHistNameList_[jdx], outputLabelList_[idx], "eps"), 113);
      psFile.NewPage();
      
      TH2F& hcmp = *((TH2F*)(*hist)[jdx]);
      hcmp.SetLineColor  ( histColor_[idx] );
      hcmp.SetFillColor  ( histColor_[idx] );
      hcmp.SetMarkerColor( histColor_[idx] );
      char xstring[100], ystring[100];
      if( jdx<corrAxesLabelList_.size() ){
        sprintf(xstring, corrAxesLabelList_[jdx].c_str(), cmpObjLabelList_[0].c_str() );
        sprintf(ystring, corrAxesLabelList_[jdx].c_str(), cmpObjLabelList_[1].c_str() );
      }
      setAxesStyle( hcmp, xstring, ystring );
      leg->AddEntry( &hcmp, legend( idx ).c_str(), "FL" );
      hcmp.Draw("box");
      leg->Draw( "same" );
      canv->RedrawAxis( );
      canv->Update( );
      psFile.Close();
      delete leg;
    }
  }
  canv->Close();
  delete canv;
}
void CalibClosureTest::drawEff ( )

Definition at line 101 of file CalibClosureTest.cc.

References estimatePileup::hist, cmsDownloadME::href, UserOptions_cff::idx, and convertSQLitetoXML_cfg::output.

Referenced by main().

{
  std::vector<TObjArray> effSampleList;
  loadHistograms(effHistNameList_, effSampleList);

  TCanvas *canv = new TCanvas("canv", "histograms", 600, 600);
  setCanvasStyle( *canv  );
  canv->SetGridx( 1 );
  canv->SetGridy( 1 );

  //---------------------------------------------
  // loop histograms via the list of histogram 
  // names stored in effHistNameList_, open a 
  // new page for each histogram; histograms are
  // expected in order ref(0)/sample(1),... 
  //---------------------------------------------
  for(unsigned int jdx=0; jdx<effHistNameList_.size()/2; ++jdx){
    TPostScript psFile(output("/inspectMatch_", effHistNameList_[2*jdx], "eps"), 113);
    psFile.NewPage();

    TLegend* leg = new TLegend(legXLeft_,legYLower_,legXRight_,legYUpper_);
    setLegendStyle( *leg ); 
    //-----------------------------------------------
    // loop each sample, draw all sample for a given 
    // histogram name in one plot 
    //-----------------------------------------------
    std::vector<TObjArray>::const_iterator hist = effSampleList.begin();
    for(unsigned int idx=0; hist!=effSampleList.end(); ++hist, ++idx){  
      TH1F& href = *((TH1F*)(*hist)[2*jdx]); //recieve histograms
      TH1F& hcmp = *((TH1F*)(*hist)[2*jdx+1]);
      setHistStyles( hcmp, jdx, idx );

      if(idx==0){
        // prepare axes labels
        char xstring[100], ystring[100];
        if( idx<effAxesLabelList_.size() )
          sprintf(xstring, effAxesLabelList_[jdx].c_str(),  cmpObjLabelList_[1].c_str());
        sprintf(ystring, "match^{%s}/match^{%s}", cmpObjLabelList_[0].c_str(), cmpObjLabelList_[1].c_str());
        hcmp.GetXaxis()->SetTitle( xstring );
        hcmp.GetYaxis()->SetTitle( ystring );
        hcmp.SetMinimum(0.85*hcmp.GetMinimum());
        hcmp.SetMaximum(1.25*hcmp.GetMaximum());
        divideHistograms(hcmp, href, 1);
        hcmp.Draw();
      }
      else{
        divideHistograms(hcmp, href, 1);
        hcmp.Draw("same");
      }
      leg->AddEntry( &hcmp, legend( idx ).c_str(), "PL" );
    }
    leg->Draw( "same" );
    canv->RedrawAxis( );
    canv->Update( );
    psFile.Close();
    delete leg;
  }
  canv->Close();
  delete canv;
}
TString CalibClosureTest::output ( const char *  pre,
std::string &  name,
std::string &  label,
const char *  post 
)

Definition at line 74 of file CalibClosureTest.cc.

References label, and convertSQLitetoXML_cfg::output.

{
  TString buffer( output(pre, name, post) );
  buffer.Remove(buffer.Last('.'), buffer.Length());
  buffer+="_";
  buffer+=label;
  buffer+=".";
  buffer+=post;
  return buffer;
}
TString CalibClosureTest::output ( const char *  pre,
std::string &  name,
const char *  post 
)

Definition at line 86 of file CalibClosureTest.cc.

References convertSQLitetoXML_cfg::output.

{
  // prepare name of the output file
  TString buffer( name );
  if( ((TString)buffer(buffer.Last('_')+1, buffer.Length())).IsDigit() )
    buffer.Remove(buffer.Last('_'), buffer.Length()); // chop off everything before the 
  buffer.Remove(0, buffer.Last ('_')+1);              // second to last and last '_'
  TString output( writeTo_.c_str() );
  output+=pre;
  output+=buffer;
  output+= ".";
  output+=post;  
  return output;
}
void CalibClosureTest::readConfig ( std::string  name) [virtual]

Implements CompHist.

Definition at line 38 of file CalibClosureTest.cc.

Referenced by main().

{
  ConfigFile cfg( name, "=", "$" ); 
  configBlockIO  ( cfg );
  configBlockHist( cfg );
  configBlockFit ( cfg );
  configBlockSpecific( cfg );
}

Member Data Documentation

std::vector<std::string> CalibClosureTest::cmpObjLabelList_ [private]

Definition at line 32 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::corrAxesLabelList_ [private]

Definition at line 31 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::corrHistNameList_ [private]

Definition at line 30 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::effAxesLabelList_ [private]

Definition at line 34 of file CalibClosureTest.cc.

std::vector<std::string> CalibClosureTest::effHistNameList_ [private]

Definition at line 33 of file CalibClosureTest.cc.