ATLAS Offline Software
Namespaces | Functions | Variables
MonitoringFile_MuonTrackPostProcess.cxx File Reference
#include "DataQualityUtils/MonitoringFile.h"
#include <iostream>
#include <algorithm>
#include <fstream>
#include <cmath>
#include <cstdlib>
#include <sstream>
#include <stdio.h>
#include <map>
#include <iomanip>
#include <set>
#include "TH1F.h"
#include "TH2F.h"
#include "TFile.h"
#include "TClass.h"
#include "TKey.h"
#include "TMath.h"
#include "TF1.h"
#include "TTree.h"
#include "TBranch.h"
#include "TList.h"
#include "TProfile.h"
#include "TMinuit.h"

Go to the source code of this file.

Namespaces

 dqutils
 

Functions

double breitgausfun (double *x, double *par)
 
void TwoDto2D_Eff (TH2 *Numerator, TH2 *Denominator, TH2 *Efficiency, bool rebin2d=false)
 
void TwoDto1D_Mean (TH2 *h_parent, TH1 *h_child, int rebinning=1)
 
void TwoDto1D_Sum (TH2 *h_parent, TH1 *h_child, int rebinning=2)
 
void SetMassInfo (int iBin, TH1 *InputHist, TH1 *OutMean, TH1 *OutSigma, TString recalg_path)
 

Variables

const char *const SegStationName [17]
 

Function Documentation

◆ breitgausfun()

double breitgausfun ( double *  x,
double *  par 
)

Definition at line 45 of file MonitoringFile_MuonTrackPostProcess.cxx.

45  {
46  //Fit parameters:
47  //par[0]=Width (scale) Breit-Wigner
48  //par[1]=Most Probable (MP, location) Breit mean
49  //par[2]=Total area (integral -inf to inf, normalization constant)
50  //par[3]=Width (sigma) of convoluted Gaussian function
51 
52  // Numeric constants
53  double invsq2pi = 0.3989422804014; // (2 pi)^(-1/2)
54  // Control constants
55  double np = 100.0; // number of convolution steps
56  double sc = 4; // convolution extends to +-sc Gaussian sigmas
57 
58  // Variables
59  double xx;
60  double fland;
61  double sum = 0.0;
62  double xlow, xupp;
63  double step;
64  double i;
65 
66  // Range of convolution integral
67  xlow = x[0] - sc * par[3];
68  xupp = x[0] + sc * par[3];
69  step = (xupp - xlow) / np;
70 
71  // Convolution integral of Breit and Gaussian by sum
72  for (i = 1.0; i <= np / 2; i++) {
73  xx = xlow + (i - .5) * step;
74  fland = TMath::BreitWigner(xx, par[1], par[0]);
75  sum += fland * TMath::Gaus(x[0], xx, par[3]);
76 
77  xx = xupp - (i - .5) * step;
78  fland = TMath::BreitWigner(xx, par[1], par[0]);
79  sum += fland * TMath::Gaus(x[0], xx, par[3]);
80  }
81  return(par[2] * step * sum * invsq2pi / par[3]);
82 }

◆ SetMassInfo()

void SetMassInfo ( int  iBin,
TH1 *  InputHist,
TH1 *  OutMean,
TH1 *  OutSigma,
TString  recalg_path 
)

Definition at line 168 of file MonitoringFile_MuonTrackPostProcess.cxx.

168  {
169  if (InputHist == NULL || OutMean == NULL || OutSigma == NULL) {
170  return;
171  }
172  if (InputHist->GetMaximum() > 10.0) {
173  if (recalg_path == "Z") {//only for Z
174  TF1* fit1 = new TF1("fit1", breitgausfun, 76, 106, 4);
175  fit1->SetLineColor(kRed);
176  fit1->SetParameter(0, 3.0);//par[0]=Width (scale) Breit-Wigner
177  fit1->SetParameter(1, 91.2);//par[1]=Most Probable (MP, location) Breit mean
178  fit1->SetParameter(2, InputHist->GetEntries());//par[2]=Total area (integral -inf to inf, normalization constant)
179  fit1->SetParameter(3, 1.0);//par[3]=Width (sigma) of convoluted Gaussian function
180  InputHist->Fit("fit1", "q", "", 77, 105);
181  fit1->Draw();
182  OutMean->SetBinContent(iBin, fit1->GetParameter(1));
183  OutMean->SetBinError(iBin, fit1->GetParError(1));
184  OutSigma->SetBinContent(iBin, fit1->GetParameter(0));
185  OutSigma->SetBinError(iBin, fit1->GetParError(0));
186  }
187  if (recalg_path == "Jpsi") {
188  InputHist->Fit("gaus", "q", "", 2.95, 3.25);
189  TF1* fit1 = (TF1*) InputHist->GetFunction("gaus");
190  fit1->Draw();
191  OutMean->SetBinContent(iBin, fit1->GetParameter(1));
192  OutMean->SetBinError(iBin, fit1->GetParError(1));
193  OutSigma->SetBinContent(iBin, fit1->GetParameter(2));
194  OutSigma->SetBinError(iBin, fit1->GetParError(2));
195  }
196  } else {
197  OutMean->SetBinContent(iBin, InputHist->GetMean(1));
198  OutMean->SetBinError(iBin, InputHist->GetMeanError(1));
199  OutSigma->SetBinContent(iBin, InputHist->GetRMS(1));
200  OutSigma->SetBinError(iBin, InputHist->GetRMSError(1));
201  }
202  return;
203 }

◆ TwoDto1D_Mean()

void TwoDto1D_Mean ( TH2 *  h_parent,
TH1 *  h_child,
int  rebinning = 1 
)

Definition at line 116 of file MonitoringFile_MuonTrackPostProcess.cxx.

116  {
117  //the input histograms must have the same dimension!
118  if (h_parent == NULL || h_child == NULL) {
119  return;
120  }
121  if (h_parent->GetNbinsX() != h_child->GetNbinsX()) {
122  return;
123  }
124  //after protection
125  for (int bin_itrX = 1; bin_itrX < h_parent->GetNbinsX() + 1; bin_itrX++) {
126  double parent_event = 0;
127  double parent_sum = 0;
128  for (int bin_itrY = 1; bin_itrY < h_parent->GetNbinsY() + 1; bin_itrY++) {
129  parent_event += h_parent->GetBinContent(bin_itrX, bin_itrY);
130  parent_sum += h_parent->GetBinContent(bin_itrX, bin_itrY) * h_parent->GetYaxis()->GetBinCenter(bin_itrY);
131  }
132  if (parent_event == 0) {
133  continue;
134  }
135  h_child->SetBinContent(bin_itrX, parent_sum / parent_event);
136  }
137  TString sHistTitle = h_child->GetTitle();
138  h_child->Rebin(rebinning);
139  h_child->SetTitle(sHistTitle + " per event");
140  h_child->Write("", TObject::kOverwrite);
141  return;
142 }

◆ TwoDto1D_Sum()

void TwoDto1D_Sum ( TH2 *  h_parent,
TH1 *  h_child,
int  rebinning = 2 
)

Definition at line 144 of file MonitoringFile_MuonTrackPostProcess.cxx.

144  {
145  //the input histograms must have the same dimension!
146  if (h_parent == NULL || h_child == NULL) {
147  return;
148  }
149  if (h_parent->GetNbinsX() != h_child->GetNbinsX()) {
150  return;
151  }
152  //after protection
153  for (int bin_itrX = 1; bin_itrX < h_parent->GetNbinsX() + 1; bin_itrX++) {
154  double parent_sum = 0;
155  for (int bin_itrY = 1; bin_itrY < h_parent->GetNbinsY() + 1; bin_itrY++) {
156  parent_sum += h_parent->GetBinContent(bin_itrX, bin_itrY) * h_parent->GetYaxis()->GetBinCenter(bin_itrY);
157  }
158  if (parent_sum == 0) {
159  continue;
160  }
161  h_child->SetBinContent(bin_itrX, parent_sum);
162  }
163  h_child->Rebin(rebinning);
164  h_child->Write("", TObject::kOverwrite);
165  return;
166 }

◆ TwoDto2D_Eff()

void TwoDto2D_Eff ( TH2 *  Numerator,
TH2 *  Denominator,
TH2 *  Efficiency,
bool  rebin2d = false 
)

Definition at line 84 of file MonitoringFile_MuonTrackPostProcess.cxx.

84  {
85  //the input histograms must have the same dimension!
86  if (Numerator == NULL || Denominator == NULL || Efficiency == NULL) {
87  return;
88  }
89  if (rebin2d) {
90  Numerator->Rebin2D();//here change the default binnning of eta-phi
91  Efficiency->Rebin2D();//here change the default binnning of eta-phi
92  }
93  //then check the dimensions
94  int n_xbins = Numerator->GetNbinsX();
95  if (Denominator->GetNbinsX() != n_xbins || Efficiency->GetNbinsX() != n_xbins) {
96  return;
97  }
98  int n_ybins = Numerator->GetNbinsY();
99  if (Denominator->GetNbinsY() != n_ybins || Efficiency->GetNbinsY() != n_ybins) {
100  return;
101  }
102 
103  //after protection
104  for (int bin_itrX = 1; bin_itrX < Efficiency->GetNbinsX() + 1; bin_itrX++) {
105  for (int bin_itrY = 1; bin_itrY < Efficiency->GetNbinsY() + 1; bin_itrY++) {
106  if (Denominator->GetBinContent(bin_itrX, bin_itrY) == 0) continue;
107  Efficiency->SetBinContent(bin_itrX, bin_itrY,
108  Numerator->GetBinContent(bin_itrX,
109  bin_itrY) / Denominator->GetBinContent(bin_itrX, bin_itrY));
110  }
111  }
112  Efficiency->Write("", TObject::kOverwrite);
113  return;
114 }

Variable Documentation

◆ SegStationName

const char* const SegStationName[17]
Initial value:
= {
"BIS", "BIL", "BMS", "BML", "BOS", "BOL", "BEE",
"EIS", "EIL", "EMS", "EML", "EOS", "EOL", "EES",
"EEL", "CSS", "CSL"
}

Definition at line 39 of file MonitoringFile_MuonTrackPostProcess.cxx.

input_HIST.InputHist
InputHist
Definition: input_HIST.py:1
PlotPulseshapeFromCool.np
np
Definition: PlotPulseshapeFromCool.py:64
x
#define x
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
convertTimingResiduals.sum
sum
Definition: convertTimingResiduals.py:55
lumiFormat.i
int i
Definition: lumiFormat.py:85
breitgausfun
double breitgausfun(double *x, double *par)
Definition: MonitoringFile_MuonTrackPostProcess.cxx:45
createCoolChannelIdFile.par
par
Definition: createCoolChannelIdFile.py:29
LArCellBinning.step
step
Definition: LArCellBinning.py:158