CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
MTVHistoProducerAlgo.cc
Go to the documentation of this file.
2 
4  if (th2->GetNbinsX()==me->getNbinsX()){
5  TProfile * p1 = (TProfile*) th2->ProfileX();
6  p1->Copy(*me->getTProfile());
7  delete p1;
8  } else {
9  throw cms::Exception("MultiTrackValidator") << "Different number of bins!";
10  }
11 }
12 
13 
15  for (unsigned int j=0; j<vec.size(); j++){
16  h->setBinContent(j+1, vec[j]);
17  }
18 }
19 
21  std::vector<int>& numerator,
22  std::vector<int>& denominator,
23  std::string type){
24  double value,err;
25  for (unsigned int j=0; j<numerator.size(); j++){
26  if (denominator[j]!=0){
27  if (type=="effic"){
28  value = ((double) numerator[j])*1./((double) denominator[j]);
29  err = sqrt( value*(1-value)/(double) denominator[j] );
30  } else if (type=="fakerate"){
31  value = 1-((double) numerator[j])*1./((double) denominator[j]);
32  err = sqrt( value*(1-value)/(double) denominator[j] );
33  } else if (type=="pileup"){
34  value = ((double) numerator[j])*1./((double) denominator[j]);
35  err = sqrt( value*(1+value)/(double) denominator[j] );
36  } else return;
37  h->setBinContent(j+1, value);
38  h->setBinError(j+1, err);
39  }
40  else {
41  h->setBinContent(j+1, 0.);
42  h->setBinError(j+1, 0.);
43  }
44  }
45 }
46 
47 
48 
49 
51  TAxis *axis = h->GetXaxis();
52  int bins = axis->GetNbins();
53 
54  float from = axis->GetXmin();
55  float to = axis->GetXmax();
56  float width = (to - from) / bins;
57  float *new_bins = new float[bins + 1];
58 
59  for (int i = 0; i <= bins; i++) {
60  new_bins[i] = TMath::Power(10, from + i * width);
61 
62  }
63  axis->Set(bins, new_bins);
64  delete[] new_bins;
65 }
66 
67 
68 //void MTVHistoProducerAlgo::
69 //void MTVHistoProducerAlgo::
70 
type
Definition: HCALResponse.h:22
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
void fillPlotFromVectors(MonitorElement *h, std::vector< int > &numerator, std::vector< int > &denominator, std::string type)
void doProfileX(TH2 *th2, MonitorElement *me)
void fillPlotFromVector(MonitorElement *h, std::vector< int > &vec)
T sqrt(T t)
Definition: SSEVec.h:46
int j
Definition: DBlmapReader.cc:9
void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
static std::string from(" from ")
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
double p1[4]
Definition: TauolaWrapper.h:89
TProfile * getTProfile(void) const
int getNbinsX(void) const
get # of bins in X-axis