ATLAS Offline Software
Loading...
Searching...
No Matches
ZmumuValidationExample.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef ZMUMUVALIDATIONEXAMPLE_h
6#define ZMUMUVALIDATIONEXAMPLE_h
7
8#include <vector>
9#include <list>
10#include <string>
11
12#include "TROOT.h"
13#include "TChain.h"
14#include "TFile.h"
15#include "TH1.h"
16#include "TH2.h"
17#include "TH3.h"
18#include "TProfile2D.h"
19#include "TLorentzVector.h"
20#include "TCanvas.h"
21
23{
24 private:
25
26 const std::list<std::string> m_fileNames;
27 std::string m_outfilename;
28
29 TFile m_file;
30
33
36 int m_EtaBins{};
37 int m_PhiBins{};
38
39
40 bool m_isMC{};
42 double m_shift{};
43 double m_factor{};
44
46 // Declaration of leafs for the track tree
48 double m_px_pos{};
49 double m_py_pos{};
50 double m_pz_pos{};
51
52 double m_px_neg{};
53 double m_py_neg{};
54 double m_pz_neg{};
55
56 double m_z0_pos{};
57 double m_z0_neg{};
58 double m_d0_pos{};
59 double m_d0_neg{};
60
62 double m_truth_py_pos{};
64
68
70 // List of branches for track tree
72 TBranch * b_px_pos{};
73 TBranch * b_py_pos{};
74 TBranch * b_pz_pos{};
75
76 TBranch * b_px_neg{};
77 TBranch * b_py_neg{};
78 TBranch * b_pz_neg{};
79
80 TBranch * b_z0_pos{};
81 TBranch * b_z0_neg{};
82 TBranch * b_d0_pos{};
83 TBranch * b_d0_neg{};
84
85 TBranch * b_truth_px_pos{};
86 TBranch * b_truth_py_pos{};
87 TBranch * b_truth_pz_pos{};
88
89 TBranch * b_truth_px_neg{};
90 TBranch * b_truth_py_neg{};
91 TBranch * b_truth_pz_neg{};
92
94 // Root histograms
96
97 TH1 * h_DELTA{};
98
99 TH1 * h_pt{};
100 TH1 * h_pt_pos{};
101 TH1 * h_pt_neg{};
102
103 TH1 * h_pt_truth{};
106
107 TH1 * h_z0{};
108 TH1 * h_z0_pos{};
109 TH1 * h_z0_neg{};
110 TH1 * h_d0{};
111 TH1 * h_d0_pos{};
112 TH1 * h_d0_neg{};
113
114 TH1 * h_mass{};
117
120
121 TH2 * etaphi_pos{};
122 TH2 * etaphi_neg{};
123
124 TProfile2D * prof_pt_vs_etaphi{};
125
126 //delta corrections p->p(1+delta) - charge symmetric
128
130
132
133 //lambda corrections p->p(1+Q*lambda*pT) - charge anti-symmetric
135
139
143
145
146 TH1 * lambda{};
147 TH1 * lambda_pos{};
148 TH1 * lambda_neg{};
149
153
154 TH1 * lambda_eta{};
157
158 //z0 histograms
159 TH2 * entries{};
160
162
165
166 TH1 * z0delta{};
167 TH1 * z0delta_pos{};
168 TH1 * z0delta_neg{};
169
173
174 //d0 histograms
176
179
180 TH1 * d0delta{};
181 TH1 * d0delta_pos{};
182 TH1 * d0delta_neg{};
183
187
188 //truth histograms
192
196
199
202
205
209
211
213
216
219
220 // q/Pt histograms
221 TH2* h_QoverPt{};
222 TH3* h_QoverPt3D{};
223
225 // canvas to show fit resutls
228
230 // more helper methods
231 //
232 // these methods are used to initialize
233 // histograms, perform cuts, and fill
234 // histograms
236 void loadChains();
237 void setBranchAddresses();
238 void bookHistograms();
239
240 void loopThroughEvents( unsigned int maxItr );
241 void fillHistograms();
242
243 void correctMomentum(TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, int use_lambda);
244
245 void fillEtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda);
246 void fillEtaHistogram(TH2* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int use_lambda, int charge=0);
247 void fillHistogram(TH1* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, int fill_lambda, int charge=0);
248
249 void fillZd0EtaPhiHistogram(TH3* hist, TLorentzVector* v_pos, TLorentzVector* v_neg, double z0_muon_p, double z0_muon_n);
250 void fillZd0Histogram(TH1* hist, double z0_muon_p, double z0_muon_n, int pn);
251 void correctZd0( TH1* h_corrections, TLorentzVector* muon_pos, TLorentzVector* muon_neg, double& zd0_muon_p, double& zd0_muon_n);
252
253 void profileZwithIterativeGaussFit(TH3* hist, TH2* mu_graph, TH2* sigma_graph, int num_bins, TH2* mu_err_graph=0, TH2* sigma_err_graph=0);
254 void profileYwithIterativeGaussFit(TH2* hist, TH1* mu_graph = 0, TH1* sigma_graph = 0, int num_bins = 1);
255
256 int IterativeGaussFit(TH1* hist, double &mu, double &mu_err, double &sigma, double &sigma_err);
257
258 //
259 void fillQoverPtHistograms(TLorentzVector* v_pos, TLorentzVector* v_neg);
260 void HistogramConditioning (TH1* hist);
261 void ResetHistograms ();
262 void SymmetrizeHisto (TH2* hist);
263
264 public:
265 ZmumuValidationExample( std::list<std::string> const & s_fileNames
266 , string s_treeName = "DefaultParams"
267 , std::string const & s_outFileName = "ZmumuValidationExampleOutput.root"
268 , bool isMC = false
269 );
271
272 void loop( unsigned maxEvents = 0 );
273 void SetPrintLevel (int newprintlevel=0);
274 void SetEtaBins (int newbins=20);
275 void SetPhiBins (int newbins=20);
276 void writeToFile(int iteration);
277 void DrawMap();
278};
279#endif
280
double charge(const T &p)
Definition AtlasPID.h:997
void loop(unsigned maxEvents=0)
void correctZd0(TH1 *h_corrections, TLorentzVector *muon_pos, TLorentzVector *muon_neg, double &zd0_muon_p, double &zd0_muon_n)
void profileZwithIterativeGaussFit(TH3 *hist, TH2 *mu_graph, TH2 *sigma_graph, int num_bins, TH2 *mu_err_graph=0, TH2 *sigma_err_graph=0)
void fillQoverPtHistograms(TLorentzVector *v_pos, TLorentzVector *v_neg)
void correctMomentum(TH1 *h_corrections, TLorentzVector *muon_pos, TLorentzVector *muon_neg, int use_lambda)
int IterativeGaussFit(TH1 *hist, double &mu, double &mu_err, double &sigma, double &sigma_err)
void fillHistogram(TH1 *hist, TLorentzVector *v_pos, TLorentzVector *v_neg, int fill_lambda, int charge=0)
void fillEtaHistogram(TH2 *hist, TLorentzVector *v_pos, TLorentzVector *v_neg, int use_lambda, int charge=0)
const std::list< std::string > m_fileNames
ZmumuValidationExample(std::list< std::string > const &s_fileNames, string s_treeName="DefaultParams", std::string const &s_outFileName="ZmumuValidationExampleOutput.root", bool isMC=false)
void loopThroughEvents(unsigned int maxItr)
void profileYwithIterativeGaussFit(TH2 *hist, TH1 *mu_graph=0, TH1 *sigma_graph=0, int num_bins=1)
void SetPrintLevel(int newprintlevel=0)
void fillZd0EtaPhiHistogram(TH3 *hist, TLorentzVector *v_pos, TLorentzVector *v_neg, double z0_muon_p, double z0_muon_n)
void fillEtaPhiHistogram(TH3 *hist, TLorentzVector *v_pos, TLorentzVector *v_neg, int use_lambda)
void fillZd0Histogram(TH1 *hist, double z0_muon_p, double z0_muon_n, int pn)