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])/((double) denominator[j]);
29  else if (type=="fakerate")
30  value = 1-((double) numerator[j])/((double) denominator[j]);
31  else return;
32  err = sqrt( value*(1-value)/(double) denominator[j] );
33  h->setBinContent(j+1, value);
34  h->setBinError(j+1,err);
35  }
36  else {
37  h->setBinContent(j+1, 0);
38  }
39  }
40 }
41 
42 
43 
44 
46  TAxis *axis = h->GetXaxis();
47  int bins = axis->GetNbins();
48 
49  float from = axis->GetXmin();
50  float to = axis->GetXmax();
51  float width = (to - from) / bins;
52  float *new_bins = new float[bins + 1];
53 
54  for (int i = 0; i <= bins; i++) {
55  new_bins[i] = TMath::Power(10, from + i * width);
56 
57  }
58  axis->Set(bins, new_bins);
59  delete[] new_bins;
60 }
61 
62 
63 //void MTVHistoProducerAlgo::
64 //void MTVHistoProducerAlgo::
65 
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:28
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 ")
double p1[4]
Definition: TauolaWrapper.h:89
TProfile * getTProfile(void) const
int getNbinsX(void) const
get # of bins in X-axis
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4