CMS 3D CMS Logo

FourVectorHLTClient Class Reference

#include <DQMOffline/Trigger/interface/FourVectorHLTClient.h>

Inheritance diagram for FourVectorHLTClient:

edm::EDAnalyzer

List of all members.

Public Member Functions

 FourVectorHLTClient (const edm::ParameterSet &ps)
 Constructor.
virtual ~FourVectorHLTClient ()
 Destructor.

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Fake Analyze.
void beginJob (const edm::EventSetup &c)
 BeginJob.
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 BeginRun.
void endJob ()
 Endjob.
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 DQM Client Diagnostic.
void endRun (const edm::Run &r, const edm::EventSetup &c)
 EndRun.

Private Member Functions

TH1F * get1DHisto (string meName, DQMStore *dbi)
TProfile * get1DProfile (string meName, DQMStore *dbi)
TH2F * get2DHisto (string meName, DQMStore *dbi)
TProfile2D * get2DProfile (string meName, DQMStore *dbi)
void initialize ()

Private Attributes

TString clientDir_
int counterEvt_
 counter
int counterLS_
DQMStoredbe_
vector< TString > hltMEName
vector< MonitorElement * > hltMEs
vector< TString > hltPathName
MonitorElementklmgrvTest_
int nChannels
 prescale on number of events
edm::ParameterSet parameters_
int prescaleEvt_
 units of lumi sections
int prescaleLS_
 counter
Float_t reportSummary
MonitorElementreportSummary_
MonitorElementreportSummaryContent_ [20]
MonitorElementreportSummaryMap_
TString sourceDir_
Float_t summaryContent [20]
Float_t summarySum
MonitorElementtestHLTEff_


Detailed Description

Definition at line 31 of file FourVectorHLTClient.h.


Constructor & Destructor Documentation

FourVectorHLTClient::FourVectorHLTClient ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 41 of file FourVectorHLTClient.cc.

References initialize(), and parameters_.

00042 {
00043   parameters_=ps;
00044   initialize();
00045 
00046 }

FourVectorHLTClient::~FourVectorHLTClient (  )  [virtual]

Destructor.

Definition at line 48 of file FourVectorHLTClient.cc.

References LogDebug.

00048                                          {
00049   LogDebug("FourVectorHLTClient")<< "FourVectorHLTClient: ending...." ;
00050 }


Member Function Documentation

void FourVectorHLTClient::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Fake Analyze.

Implements edm::EDAnalyzer.

Definition at line 130 of file FourVectorHLTClient.cc.

References counterEvt_, lat::endl(), LogDebug, and prescaleEvt_.

00130                                                                           {
00131    
00132   counterEvt_++;
00133   if (prescaleEvt_<1) return;
00134   if (prescaleEvt_>0 && counterEvt_%prescaleEvt_ != 0) return;
00135   
00136   LogDebug("FourVectorHLTClient")<<"analyze..." << endl;
00137 
00138   
00139 
00140 
00141   //reportSummary = average of report summaries of each system
00142   
00143  
00144 }

void FourVectorHLTClient::beginJob ( const edm::EventSetup c  )  [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 80 of file FourVectorHLTClient.cc.

References dbe_, lat::endl(), and LogDebug.

00080                                                            {
00081 
00082 
00083   LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient]: beginJob" << endl;
00084   // get backendinterface  
00085   dbe_ = Service<DQMStore>().operator->();
00086 
00087 
00088 
00089   
00090 
00091 }

void FourVectorHLTClient::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
) [protected, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 118 of file FourVectorHLTClient.cc.

00118                                                                                                         {
00119    // optionally reset histograms here
00120 }

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 94 of file FourVectorHLTClient.cc.

References lat::endl(), and LogDebug.

00094                                                                           {
00095 
00096   LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient]: beginRun" << endl;
00097         /*
00098   TString summaryFolder = clientDir_ + TString("/reportSummaryContents/");
00099   TString summaryPath = summaryFolder + TString("reportSummary");
00100 
00101   dbe_->setCurrentFolder(summaryFolder.Data());
00102   
00103 
00104   reportSummary_ = dbe_->get(summaryPath.Data());
00105   if ( reportSummary_ ) {
00106       dbe_->removeElement(reportSummary_->getName()); 
00107   }
00108 
00109   reportSummary_ = dbe_->bookFloat("reportSummary");
00110 
00111   //initialize reportSummary to 1
00112   if (reportSummary_) reportSummary_->Fill(-999);
00113         */
00114 
00115 }

void FourVectorHLTClient::endJob ( void   )  [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 365 of file FourVectorHLTClient.cc.

00365                                 {
00366 }

void FourVectorHLTClient::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
) [protected, virtual]

DQM Client Diagnostic.

Reimplemented from edm::EDAnalyzer.

Definition at line 122 of file FourVectorHLTClient.cc.

00122                                                                                                      {   
00123 
00124 
00125 } 

void FourVectorHLTClient::endRun ( const edm::Run r,
const edm::EventSetup c 
) [protected, virtual]

EndRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 147 of file FourVectorHLTClient.cc.

References DQMStore::book1D(), DQMStore::book2D(), clientDir_, DQMStore::containsAnyMonitorable(), dbe_, MonitorElement::DQM_KIND_TH1F, MonitorElement::DQM_KIND_TH2F, lat::endl(), DQMStore::get(), DQMStore::getContents(), edm::getName(), MonitorElement::getPathname(), MonitorElement::getTH1F(), MonitorElement::getTH2F(), hltMEName, hltMEs, hltPathName, i, j, k, MonitorElement::kind(), LogDebug, DQMStore::removeElement(), Comp2RefKolmogorov::runTest(), DQMStore::setCurrentFolder(), and sourceDir_.

00147                                                                        {
00148  LogDebug("FourVectorHLTClient")<<"FourVectorHLTClient:: endLuminosityBlock "  << endl;
00149 
00150  // QTests
00152  Comp2RefKolmogorov * kl_test_ = new Comp2RefKolmogorov("my_kolm");
00153 
00154  // HLT paths
00155  TObjArray *hltPathNameColl = new TObjArray(100);
00156  hltPathNameColl->SetOwner();
00157 
00158  if(! dbe_->containsAnyMonitorable(sourceDir_.Data())) {
00159 
00160    LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient] endLuminosityBlock: sourceDir_(" << sourceDir_.Data() << ") has no MEs " << endl;
00161     return;
00162  }
00163 
00164  LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient] endLuminosityBlock: Interesting dir has MEs " << endl;
00165 
00166   hltMEs = dbe_->getContents(sourceDir_.Data());
00167   
00168  // For easier work, build vector<TString> to hold HLT ME names
00169  for(unsigned int i=0;i<hltMEs.size();i++) {
00170 
00171    if(hltMEs[i]->getName().find("HLT") == 0) hltMEName.push_back(TString(hltMEs[i]->getName()));
00172 
00173  }
00174 
00175  // loop over all HLT DQM MEs to get HLT path names
00177  LogDebug("FourVectorHLTClient")<<"[FourVectorHLTClient] HLT DQM MEs are: "  << endl;
00178 
00179  for(unsigned int i=0;i<hltMEName.size();i++) {
00180 
00181    LogDebug("FourVectorHLTClient")<< hltMEName[i]  << endl;
00182 
00183    // collect HLT path names from MEs names, removing "_*" from the end
00185    TString tempName = hltMEName[i];
00186    tempName.Remove(tempName.Last('_'),tempName.Length());
00187    hltPathName.push_back(tempName);
00188 
00189    TObjString *tempHltName = new TObjString(tempName.Data());
00190 
00191    if( !hltPathNameColl->Contains(tempHltName)) {
00192 
00193      hltPathNameColl->Add(tempHltName);
00194 
00195    } 
00196 
00197  } //end for
00198   
00199  LogDebug("FourVectorHLTClient")<< "Number of derived HLT paths from DQM source directory: " << hltPathNameColl->GetEntriesFast()  << endl;
00200  
00202  // Loop over all path names
00204  for (int j=0;j<hltPathNameColl->GetEntriesFast();j++) {
00205 
00206 
00207    TObjString *curHltPath = (TObjString*)hltPathNameColl->At(j);
00208    TString pathPrefis = curHltPath->String() + TString("_");
00209     LogDebug("FourVectorHLTClient")<< " path " << curHltPath->String() << endl;
00210 
00211    TString pathFolder = clientDir_ + TString("/paths/") + curHltPath->String() + TString("/distributions");
00212 
00213    dbe_->setCurrentFolder(pathFolder.Data());
00214 
00216    // KolmogorovTest for each DQM histogram
00218    for(unsigned int i=0;i<hltMEName.size();i++) {
00219 
00220      TString tempHistName = hltMEName[i];
00221 
00222      // only consider histos belonging to current HLT path
00223      if( !tempHistName.Contains(curHltPath->String()) ) continue;
00224 
00225      // Some string gymnastics:
00226      //
00227      // there are paths like HLT_Jet180 and HLT_Jet180_MET60
00228      // make sure we dont cross use histograms of such paths
00229      // histogram name can only have one character "_" in addition to the pathname
00230      TString radical = tempHistName;
00231      radical.ReplaceAll(curHltPath->String()+"_","");
00232       LogDebug("FourVectorHLTClient")<< " tempHistName is " << tempHistName << "     radical is: " << radical << endl;
00233 
00234      if(radical.CountChar('_')>0) continue;
00235      
00236      TString histName = sourceDir_+TString("/")+tempHistName;
00237      TString klmgrvName = tempHistName+TString("_klmgrTest");
00238 
00239      //klmgrvTest_ = dbe_->bookFloat(klmgrvName.Data());
00240      //if (klmgrvTest_) klmgrvTest_->Fill(-999);
00241 
00242      MonitorElement *histME = dbe_->get(histName.Data());
00243 
00244 
00245      //std::cout << " Running test " << chi2_test_->getName() 
00246                //<< " (Algorithm: " << chi2_test_->getAlgoName() << ") "
00247                //<< std::endl;
00248      //float prob = chi2_test_->runTest(my_test);
00249 
00250 
00251       LogDebug("FourVectorHLTClient")<< " histME pathName:" << histME->getPathname() << ",   kind: " << histME->kind() << "  (TH1F=" << MonitorElement::DQM_KIND_TH1F << ")" << endl;
00252 
00253      if(histME->kind() == MonitorElement::DQM_KIND_TH1F) {
00254 
00255        TH1F *hist = new TH1F();
00256        hist = histME->getTH1F();
00257        dbe_->book1D(hist->GetName(),hist);
00258 
00259        // must be non empty hist to do KolmogorovTest
00260        if(hist->GetEntries() == 0) continue;
00261        if(hist->Integral() == 0) continue;
00262 
00263        LogDebug("FourVectorHLTClient")<< "endRun:   histName " << hist->GetName() << endl;
00264        LogDebug("FourVectorHLTClient")<< "endRun:   hist entries:" << hist->GetEntries() << endl;
00265 
00266        float kl_prob = kl_test_->runTest(histME);
00267 
00268        LogDebug("FourVectorHLTClient")<< "endRun:   KLMGRV test = " << kl_prob << endl;
00269      
00270        //if (klmgrvTest_) klmgrvTest_->Fill(kl_prob);
00271 
00272                  }
00273 
00274      if(histME->kind() == MonitorElement::DQM_KIND_TH2F) {
00275 
00276        TH2F *hist = new TH2F();
00277        hist = histME->getTH2F();
00278        dbe_->book2D(hist->GetName(),hist);
00279 
00280                          /*
00281        // must be non empty hist to do KolmogorovTest
00282        if(hist->GetEntries() == 0) continue;
00283        if(hist->Integral() == 0) continue;
00284 
00285        LogDebug("FourVectorHLTClient")<< "endRun:   histName " << hist->GetName() << endl;
00286        LogDebug("FourVectorHLTClient")<< "endRun:   hist entries:" << hist->GetEntries() << endl;
00287 
00288        float kl_prob = kl_test_->runTest(histME);
00289 
00290        LogDebug("FourVectorHLTClient")<< "endRun:   KLMGRV test = " << kl_prob << endl;
00291      
00292        if (klmgrvTest_) klmgrvTest_->Fill(kl_prob);
00293                          */
00294 
00295                  }
00296 
00297 
00298 
00299    } // end for
00300 
00302     // Efficiencies
00304     pathFolder = clientDir_ + TString("/paths/") + curHltPath->String() + TString("/efficiencies");
00305 
00306     dbe_->setCurrentFolder(pathFolder.Data());
00307 
00308     vector<TString> vObj;
00309     vObj.push_back(TString("phi"));
00310     vObj.push_back(TString("eta"));
00311 
00312     for (unsigned int k=0; k<vObj.size();k++) {
00313 
00314 
00315       TString oldHistPathNum = sourceDir_+TString("/")+curHltPath->String()+TString("_")+vObj[k]+TString("On"); 
00316       TString oldHistPathDen = sourceDir_+TString("/")+curHltPath->String()+TString("_")+vObj[k]+TString("L1"); 
00317   
00318   
00319       TString newHistName = curHltPath->String()+TString("_"+vObj[k]+"_Eff-OnToL1");
00320       TString newHistPath = pathFolder+newHistName;
00321   
00322       MonitorElement *numME = dbe_->get(oldHistPathNum.Data());
00323       MonitorElement *denME = dbe_->get(oldHistPathDen.Data());
00324   
00325       //check if HLTOffline histogram exist
00326       if ( numME &&  denME ) {
00327       
00328         //check if booked HLTClient histogram exist
00329         if ( dbe_->get(newHistPath.Data()) ) {
00330           dbe_->removeElement(newHistPath.Data());
00331         }
00332       
00333       
00334         TH1F* numHist = numME->getTH1F();
00335         TH1F* denHist = denME->getTH1F();
00336   
00337         TH1F* effHist = (TH1F*) numHist->Clone(newHistName.Data());
00338         effHist->SetTitle(newHistName.Data());
00339         effHist->Sumw2();
00340         effHist->Divide(denHist);
00341         
00342   
00343         //reportSummaryMap_ = dbe_->book1D(numHist->Divide(denHist));
00344         
00345         dbe_->book1D(newHistName.Data(), effHist);
00346   
00347       } // end if
00348       else {
00349   
00350         LogWarning("FourVectorHLTClient")<< "Cannot find NUM and DEN histograms to derive " << newHistName <<  "."<< endl;
00351   
00352 
00353       }
00354     } //end for obj k
00355 
00356   } //end for 
00357 
00358   hltPathNameColl->Delete();
00359   delete kl_test_;
00360 
00361 
00362 }

TH1F * FourVectorHLTClient::get1DHisto ( string  meName,
DQMStore dbi 
) [private]

Definition at line 370 of file FourVectorHLTClient.cc.

References lat::endl(), DQMStore::get(), MonitorElement::getTH1F(), LogDebug, and NULL.

00371 {
00372 
00373   MonitorElement * me_ = dbi->get(meName);
00374 
00375   if (!me_) { 
00376     LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
00377     return NULL;
00378   }
00379 
00380   return me_->getTH1F();
00381 }

TProfile * FourVectorHLTClient::get1DProfile ( string  meName,
DQMStore dbi 
) [private]

Definition at line 414 of file FourVectorHLTClient.cc.

References lat::endl(), DQMStore::get(), MonitorElement::getTProfile(), LogDebug, and NULL.

00415 {
00416 
00417 
00418   MonitorElement * me_ = dbi->get(meName);
00419 
00420   if (!me_) { 
00421     LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
00422     return NULL;
00423   }
00424 
00425   return me_->getTProfile();
00426 }

TH2F * FourVectorHLTClient::get2DHisto ( string  meName,
DQMStore dbi 
) [private]

Definition at line 383 of file FourVectorHLTClient.cc.

References lat::endl(), DQMStore::get(), MonitorElement::getTH2F(), LogDebug, and NULL.

00384 {
00385 
00386 
00387   MonitorElement * me_ = dbi->get(meName);
00388 
00389   if (!me_) { 
00390     LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
00391     return NULL;
00392   }
00393 
00394   return me_->getTH2F();
00395 }

TProfile2D * FourVectorHLTClient::get2DProfile ( string  meName,
DQMStore dbi 
) [private]

Definition at line 399 of file FourVectorHLTClient.cc.

References lat::endl(), DQMStore::get(), MonitorElement::getTProfile2D(), LogDebug, and NULL.

00400 {
00401 
00402 
00403   MonitorElement * me_ = dbi->get(meName);
00404 
00405   if (!me_) { 
00406     LogDebug("FourVectorHLTClient")<< "ME NOT FOUND." << endl;
00407    return NULL;
00408   }
00409 
00410   return me_->getTProfile2D();
00411 }

void FourVectorHLTClient::initialize (  )  [private]

Definition at line 53 of file FourVectorHLTClient.cc.

References clientDir_, counterEvt_, counterLS_, dbe_, lat::endl(), edm::ParameterSet::getUntrackedParameter(), LogDebug, parameters_, prescaleEvt_, prescaleLS_, and sourceDir_.

Referenced by FourVectorHLTClient().

00053                                     { 
00054 
00055   counterLS_=0; 
00056   counterEvt_=0; 
00057   
00058   // get back-end interface
00059   dbe_ = Service<DQMStore>().operator->();
00060   
00061 
00062   // base folder for the contents of this job
00063   sourceDir_ = TString(parameters_.getUntrackedParameter<string>("hltSourceDir",""));
00064   LogDebug("FourVectorHLTClient")<< "Monitor dir = " << sourceDir_ << endl;
00065     
00066   clientDir_ = TString(parameters_.getUntrackedParameter<string>("hltClientDir",""));
00067   LogDebug("FourVectorHLTClient")<< "Client dir = " << clientDir_ << endl;
00068     
00069   prescaleLS_ = parameters_.getUntrackedParameter<int>("prescaleLS", -1);
00070   LogDebug("FourVectorHLTClient")<< "DQM lumi section prescale = " << prescaleLS_ << " lumi section(s)"<< endl;
00071   
00072   prescaleEvt_ = parameters_.getUntrackedParameter<int>("prescaleEvt", -1);
00073   LogDebug("FourVectorHLTClient")<< "DQM event prescale = " << prescaleEvt_ << " events(s)"<< endl;
00074   
00075 
00076       
00077 }


Member Data Documentation

TString FourVectorHLTClient::clientDir_ [private]

Definition at line 76 of file FourVectorHLTClient.h.

Referenced by endRun(), and initialize().

int FourVectorHLTClient::counterEvt_ [private]

counter

Definition at line 84 of file FourVectorHLTClient.h.

Referenced by analyze(), and initialize().

int FourVectorHLTClient::counterLS_ [private]

Definition at line 83 of file FourVectorHLTClient.h.

Referenced by initialize().

DQMStore* FourVectorHLTClient::dbe_ [private]

Definition at line 74 of file FourVectorHLTClient.h.

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

vector<TString> FourVectorHLTClient::hltMEName [private]

Definition at line 78 of file FourVectorHLTClient.h.

Referenced by endRun().

vector<MonitorElement*> FourVectorHLTClient::hltMEs [private]

Definition at line 81 of file FourVectorHLTClient.h.

Referenced by endRun().

vector<TString> FourVectorHLTClient::hltPathName [private]

Definition at line 79 of file FourVectorHLTClient.h.

Referenced by endRun().

MonitorElement* FourVectorHLTClient::klmgrvTest_ [private]

Definition at line 97 of file FourVectorHLTClient.h.

int FourVectorHLTClient::nChannels [private]

prescale on number of events

Definition at line 87 of file FourVectorHLTClient.h.

edm::ParameterSet FourVectorHLTClient::parameters_ [private]

Definition at line 72 of file FourVectorHLTClient.h.

Referenced by FourVectorHLTClient(), and initialize().

int FourVectorHLTClient::prescaleEvt_ [private]

units of lumi sections

Definition at line 86 of file FourVectorHLTClient.h.

Referenced by analyze(), and initialize().

int FourVectorHLTClient::prescaleLS_ [private]

counter

Definition at line 85 of file FourVectorHLTClient.h.

Referenced by initialize().

Float_t FourVectorHLTClient::reportSummary [private]

Definition at line 88 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummary_ [private]

Definition at line 93 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryContent_[20] [private]

Definition at line 94 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::reportSummaryMap_ [private]

Definition at line 95 of file FourVectorHLTClient.h.

TString FourVectorHLTClient::sourceDir_ [private]

Definition at line 75 of file FourVectorHLTClient.h.

Referenced by endRun(), and initialize().

Float_t FourVectorHLTClient::summaryContent[20] [private]

Definition at line 90 of file FourVectorHLTClient.h.

Float_t FourVectorHLTClient::summarySum [private]

Definition at line 89 of file FourVectorHLTClient.h.

MonitorElement* FourVectorHLTClient::testHLTEff_ [private]

Definition at line 96 of file FourVectorHLTClient.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:21:00 2009 for CMSSW by  doxygen 1.5.4