CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
BTagValidator Class Reference

#include <BTagValidator.h>

Inheritance diagram for BTagValidator:
edm::EDAnalyzer

Public Member Functions

 BTagValidator (const edm::ParameterSet &)
 
 ~BTagValidator ()
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Types

typedef std::vector< std::string > vstring
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void endJob ()
 

Private Attributes

std::string algorithm_
 
bool doCompare_
 
std::string DQMFile_
 
vstring histogramList_
 
std::string referenceFilename_
 
std::string rootFile_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description


class: BTagValidator.h package: Validation/RecoB

author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)

version

Id:
BTagValidator.h,v 1.7 2009/12/18 20:45:12 wmtan Exp

Definition at line 33 of file BTagValidator.h.

Member Typedef Documentation

typedef std::vector<std::string> BTagValidator::vstring
private

Definition at line 47 of file BTagValidator.h.

Constructor & Destructor Documentation

BTagValidator::BTagValidator ( const edm::ParameterSet iConfig)
explicit

class: BTagValidator.cc package: Validation/RecoB

author: Victor Bazterra, UIC Francisco Yumiceva, Fermilab (yumic.nosp@m.eva@.nosp@m.fnal..nosp@m.gov)

version

Id:
BTagValidator.cc,v 1.16 2010/07/20 02:58:37 wmtan Exp

Definition at line 33 of file BTagValidator.cc.

References algorithm_, doCompare_, DQMFile_, edm::ParameterSet::getParameter(), edm::getReleaseVersion(), histogramList_, referenceFilename_, and rootFile_.

33  {
34 
35 
36  algorithm_ = iConfig.getParameter<std::string>( "algorithm" );
37  rootFile_ = iConfig.getParameter<std::string>( "rootfile" );
38  DQMFile_ = iConfig.getParameter<std::string>( "DQMFile" );
39  TString tversion(edm::getReleaseVersion());
40  tversion = tversion.Remove(0,1);
41  tversion = tversion.Remove(tversion.Length()-1,tversion.Length());
42  DQMFile_ = std::string(tversion)+"_"+DQMFile_;
43  histogramList_ = iConfig.getParameter<vstring>( "histogramList" );
44  referenceFilename_ = iConfig.getParameter<std::string>( "referenceFilename" );
45  doCompare_ = iConfig.getParameter<bool>( "compareHistograms");
46 }
T getParameter(std::string const &) const
std::string algorithm_
Definition: BTagValidator.h:49
vstring histogramList_
Definition: BTagValidator.h:53
std::string rootFile_
Definition: BTagValidator.h:50
std::string getReleaseVersion()
std::vector< std::string > vstring
std::string DQMFile_
Definition: BTagValidator.h:51
std::string referenceFilename_
Definition: BTagValidator.h:52
BTagValidator::~BTagValidator ( )

Definition at line 49 of file BTagValidator.cc.

49  {
50 
51 }

Member Function Documentation

void BTagValidator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 60 of file BTagValidator.cc.

61 { }
virtual void BTagValidator::beginJob ( void  )
inlineprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 42 of file BTagValidator.h.

42 {}
void BTagValidator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file BTagValidator.cc.

References algorithm_, DQMStore::book1D(), DQMStore::book2D(), DQMStore::book3D(), HistoCompare::Compare(), doCompare_, DQMFile_, edm::hlt::Exception, mergeVDriftHistosByStation::file, histogramList_, i, cppFunctionSkipper::operator, referenceFilename_, rootFile_, DQMStore::save(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), MonitorElement::setBinError(), DQMStore::setCurrentFolder(), HistoCompare::SetReferenceFilename(), DQMStore::showDirStructure(), vdt::x, detailsBasic3DVector::y, and detailsBasic3DVector::z.

66 {
67  // Validation section
68  TObject * tObject ;
69 
70  // DQM element
71  MonitorElement* monElement ;
72  MonitorElement* monElementRes;
73 
74  TFile * file = new TFile ( TString ( rootFile_ ) ) ;
75 
76  // comparison
77  HistoCompare hcompare;
78 
79  if (doCompare_) hcompare.SetReferenceFilename(TString(referenceFilename_) );
80 
81  file->cd();
82 
83  // get hold of back-end interface
85 
86  dbe->setCurrentFolder( "RecoBV/"+algorithm_ );
87 
88  for (std::size_t i=0; i<histogramList_.size(); ++i) {
89 
90  tObject = gDirectory->Get( TString( histogramList_[i] ) ) ;
91 
92  if ( tObject == 0 )
93  throw cms::Exception("BTagValidator") << "Histogram " << histogramList_[i] << " was not produced in the analysis. ";
94 
95  if ( tObject->IsA()->InheritsFrom( "TH1" ) ) {
96 
97  TH1 * histogram = (TH1*) tObject ;
98 
99  TH1* hresiduals = 0;
100 
101  if (doCompare_)
102  hresiduals = hcompare.Compare(histogram, "/DQMData/"+TString(algorithm_)+"/"+TString(histogram->GetName()) );
103 
104  file->cd();
105 
106  monElement = dbe->book1D (
107  std::string( histogram->GetName() ),
108  std::string( histogram->GetTitle() ),
109  histogram->GetXaxis()->GetNbins(),
110  histogram->GetXaxis()->GetXmin(),
111  histogram->GetXaxis()->GetXmax()
112  );
113 
114  monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1);
115  monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2);
116 
117 
118  for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++) {
119  monElement->setBinContent ( x, histogram->GetBinContent( x ) ) ;
120  monElement->setBinError ( x, histogram->GetBinError( x ) ) ;
121  }
122 
123  if (doCompare_ && hresiduals!= 0 ) {
124  monElementRes = dbe->book1D (
125  std::string( hresiduals->GetName() ),
126  std::string( hresiduals->GetTitle() ),
127  hresiduals->GetXaxis()->GetNbins(),
128  hresiduals->GetXaxis()->GetXmin(),
129  hresiduals->GetXaxis()->GetXmax()
130  );
131 
132 
133  for(Int_t x=0; x<hresiduals->GetXaxis()->GetNbins(); x++) {
134  monElementRes->setBinContent ( x, hresiduals->GetBinContent( x ) ) ;
135  monElementRes->setBinError ( x, hresiduals->GetBinError( x ) ) ;
136  }
137  }
138  }
139  else if ( tObject->IsA()->InheritsFrom( "TH2" ) ) {
140 
141  TH2 * histogram = (TH2*) tObject ;
142 
143  monElement = dbe->book2D (
144  std::string( histogram->GetName() ),
145  std::string( histogram->GetTitle() ),
146  histogram->GetXaxis()->GetNbins(),
147  histogram->GetXaxis()->GetXmin(),
148  histogram->GetXaxis()->GetXmax(),
149  histogram->GetYaxis()->GetNbins(),
150  histogram->GetYaxis()->GetXmin(),
151  histogram->GetYaxis()->GetXmax()
152  );
153 
154  monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1);
155  monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2);
156 
157  for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++)
158  for(Int_t y=0; y<histogram->GetYaxis()->GetNbins(); y++) {
159  monElement->setBinContent ( x, y, histogram->GetBinContent( x, y ) ) ;
160  monElement->setBinError ( x, y, histogram->GetBinError( x, y ) ) ;
161  }
162  }
163  else if ( tObject->IsA()->InheritsFrom( "TH3" ) ) {
164 
165  TH3 * histogram = (TH3*) tObject ;
166 
167  monElement = dbe->book3D (
168  std::string( histogram->GetName() ),
169  std::string( histogram->GetTitle() ),
170  histogram->GetXaxis()->GetNbins(),
171  histogram->GetXaxis()->GetXmin(),
172  histogram->GetXaxis()->GetXmax(),
173  histogram->GetYaxis()->GetNbins(),
174  histogram->GetYaxis()->GetXmin(),
175  histogram->GetYaxis()->GetXmax(),
176  histogram->GetZaxis()->GetNbins(),
177  histogram->GetZaxis()->GetXmin(),
178  histogram->GetZaxis()->GetXmax()
179  );
180 
181  monElement->setAxisTitle( std::string ( histogram->GetXaxis()->GetTitle()) , 1);
182  monElement->setAxisTitle( std::string ( histogram->GetYaxis()->GetTitle()) , 2);
183 
184  for(Int_t x=0; x<histogram->GetXaxis()->GetNbins(); x++)
185  for(Int_t y=0; y<histogram->GetYaxis()->GetNbins(); y++)
186  for(Int_t z=0; z<histogram->GetZaxis()->GetNbins(); z++) {
187  monElement->setBinContent ( x, y, z, histogram->GetBinContent( x, y, z ) ) ;
188  monElement->setBinError ( x, y, z, histogram->GetBinError( x, y, z ) ) ;
189  }
190  }
191  }
192 
193  dbe->showDirStructure() ;
194  dbe->save(DQMFile_) ;
195  file->Close() ;
196 
197 }
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
std::string algorithm_
Definition: BTagValidator.h:49
double double double z
vstring histogramList_
Definition: BTagValidator.h:53
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
std::string rootFile_
Definition: BTagValidator.h:50
void SetReferenceFilename(TString filename)
Definition: HistoCompare.h:35
std::string DQMFile_
Definition: BTagValidator.h:51
std::string referenceFilename_
Definition: BTagValidator.h:52
x
Definition: VDTMath.h:216
TH1 * Compare(TH1 *h, TString hname)
Definition: HistoCompare.cc:44
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

Member Data Documentation

std::string BTagValidator::algorithm_
private

Definition at line 49 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().

bool BTagValidator::doCompare_
private

Definition at line 54 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().

std::string BTagValidator::DQMFile_
private

Definition at line 51 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().

vstring BTagValidator::histogramList_
private

Definition at line 53 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().

std::string BTagValidator::referenceFilename_
private

Definition at line 52 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().

std::string BTagValidator::rootFile_
private

Definition at line 50 of file BTagValidator.h.

Referenced by BTagValidator(), and endJob().