ATLAS Offline Software
Loading...
Searching...
No Matches
AverageMinBias.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5// Macro to average MinBias hits energies in the EMB strips
6
7
8#ifndef AverageMinBias_h
9#define AverageMinBias_h
10
11#include <TROOT.h>
12#include <TChain.h>
13#include <TFile.h>
14
16public :
17 TTree *fChain;
18 Int_t fCurrent;
19
20 static const unsigned nindex=1833;
21 // Declaration of leaf types
22 Int_t ncell;
24 Int_t identifier[nindex]; //[ncell]
25 Int_t layer[nindex]; //[ncell]
26 Int_t region[nindex]; //[ncell]
27 Int_t ieta[nindex]; //[ncell]
28 Float_t eta[nindex]; //[ncell]
29 Float_t phi[nindex]; //[ncell]
30 Double_t nevt[nindex]; //[ncell]
31 Double_t average[nindex]; //[ncell]
32 Double_t rms[nindex]; //[ncell]
33 Double_t reference[nindex]; //[ncell]
34
35 // List of branches
36 TBranch *b_ncell;
37 TBranch *b_nevt_total;
38 TBranch *b_identifier;
39 TBranch *b_layer;
40 TBranch *b_region;
41 TBranch *b_ieta;
42 TBranch *b_eta;
43 TBranch *b_phi;
44 TBranch *b_nevt;
45 TBranch *b_average;
46 TBranch *b_rms;
47 TBranch *b_reference;
48
50 virtual ~AverageMinBias();
51 virtual Int_t Cut(Long64_t entry);
52 virtual Int_t GetEntry(Long64_t entry);
53 virtual Long64_t LoadTree(Long64_t entry);
54 virtual void Init(TTree *tree);
55 virtual void Loop();
56 virtual Bool_t Notify();
57 virtual void Show(Long64_t entry = -1);
58
61};
62
63#endif
64
65#ifdef AverageMinBias_cxx
66AverageMinBias::AverageMinBias(TTree *tree) : fChain(0)
67{
68// if parameter tree is not specified (or zero), connect the file
69// used to generate this class and read the Tree.
70 if (tree == 0) {
71 TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject("ntuple.root");
72 if (!f || !f->IsOpen()) {
73 f = new TFile("ntuple.root");
74 }
75 f->GetObject("m_tree",tree);
76
77 }
78 Init(tree);
79}
80
82{
83 if (!fChain) return;
84 delete fChain->GetCurrentFile();
85}
86
87Int_t AverageMinBias::GetEntry(Long64_t entry)
88{
89// Read contents of entry.
90 if (!fChain) return 0;
91 return fChain->GetEntry(entry);
92}
93Long64_t AverageMinBias::LoadTree(Long64_t entry)
94{
95// Set the environment to read one entry
96 if (!fChain) return -5;
97 Long64_t centry = fChain->LoadTree(entry);
98 if (centry < 0) return centry;
99 if (fChain->GetTreeNumber() != fCurrent) {
100 fCurrent = fChain->GetTreeNumber();
101 Notify();
102 }
103 return centry;
104}
105
106void AverageMinBias::Init(TTree *tree)
107{
108 // Set branch addresses and branch pointers
109 if (!tree) return;
110 fChain = tree;
111 fCurrent = -1;
112 fChain->SetMakeClass(1);
113
114 fChain->SetBranchAddress("ncell", &ncell, &b_ncell);
115 fChain->SetBranchAddress("nevt_total", &nevt_total, &b_nevt_total);
116 fChain->SetBranchAddress("identifier", identifier, &b_identifier);
117 fChain->SetBranchAddress("layer", layer, &b_layer);
118 fChain->SetBranchAddress("region", region, &b_region);
119 fChain->SetBranchAddress("ieta", ieta, &b_ieta);
120 fChain->SetBranchAddress("eta", eta, &b_eta);
121 fChain->SetBranchAddress("phi", phi, &b_phi);
122 fChain->SetBranchAddress("nevt", nevt, &b_nevt);
123 fChain->SetBranchAddress("average", average, &b_average);
124 fChain->SetBranchAddress("rms", rms, &b_rms);
125 fChain->SetBranchAddress("reference", reference, &b_reference);
126 Notify();
127}
128
130{
131 return kTRUE;
132}
133
134void AverageMinBias::Show(Long64_t entry)
135{
136 if (!fChain) return;
137 fChain->Show(entry);
138}
139Int_t AverageMinBias::Cut(Long64_t entry)
140{
141 return 1;
142}
143#endif // #ifdef AverageMinBias_cxx
virtual void Loop()
AverageMinBias(TTree *tree=0)
virtual Bool_t Notify()
AverageMinBias(const AverageMinBias &)=delete
TBranch * b_nevt_total
TBranch * b_region
Double_t nevt[nindex]
Int_t region[nindex]
virtual ~AverageMinBias()
Int_t layer[nindex]
virtual Int_t Cut(Long64_t entry)
virtual void Init(TTree *tree)
Int_t ieta[nindex]
Int_t identifier[nindex]
Double_t rms[nindex]
virtual void Show(Long64_t entry=-1)
Double_t reference[nindex]
TBranch * b_reference
static const unsigned nindex
current Tree number in a TChain
TBranch * b_ncell
virtual Long64_t LoadTree(Long64_t entry)
virtual Int_t GetEntry(Long64_t entry)
Float_t phi[nindex]
TBranch * b_average
Float_t eta[nindex]
Int_t fCurrent
pointer to the analyzed TTree or TChain
AverageMinBias & operator=(const AverageMinBias &)=delete
TBranch * b_identifier
Double_t average[nindex]
TBranch * b_layer
TChain * tree