]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDAnaESD.cxx
Adding a class to create dN/deta from FMD analysis output
[u/mrichter/AliRoot.git] / FMD / AliFMDAnaESD.cxx
CommitLineData
9b98d361 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15//____________________________________________________________________
16//
17// Utility class for analysing ESD data.
18// This class does sharing and background correction
19//
20#include <AliESDFMD.h>
21#include "AliFMDAnaESD.h"
22#include "AliFMDAnaRing.h"
23#include <TMath.h>
24#include <TBrowser.h>
25// clude <AliLog.h>
26
27//____________________________________________________________________
28AliFMDAnaESD::AliFMDAnaESD()
17e542eb 29 : fNEvents(0)
9b98d361 30{
31 // Constructor
32 // Parameters:
33 // lower cut.
34 //
35 AddLoad(kESD);
36 for (size_t i = 0; i < 5; i++) fRing[i] = 0;
37}
38//____________________________________________________________________
39Bool_t
40AliFMDAnaESD::Init()
41{
42 // Called at beginning of run
43 // Parameters:
44 // Return
45 // @c false on error
46 //
47 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Init();
48 return AliFMDInput::Init();
49}
50//____________________________________________________________________
51Bool_t
52AliFMDAnaESD::Begin(Int_t ev)
53{
54 // Begining of event
55 // Parameters:
56 // ev Event number
57 // Return
58 // @c false on error
59 //
60 fNEvents++;
61 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Begin();
62 Bool_t ret = AliFMDInput::Begin(ev);
63 return ret;
64}
65//____________________________________________________________________
66Bool_t
67AliFMDAnaESD::ProcessESDs()
68{
69 // Loop over all ESD data, and call ProcessESD for each entry.
70 // Parameters:
71 // Return
72 // @c false on error
73 //
74
75 // Process event summary data
76 if (!fESD) return kFALSE;
77 for (UShort_t det = 1; det <= 3; det++) {
78 Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' };
79 for (Char_t* rng = rings; *rng != '\0'; rng++) {
80 UShort_t nsec = (*rng == 'I' ? 20 : 40);
81 UShort_t nstr = (*rng == 'I' ? 512 : 256);
82 Int_t ridx = FindRing(det, *rng);
83 if (ridx < 0 || !fRing[ridx]) continue;
84 for (UShort_t sec = 0; sec < nsec; sec++) {
85 for (UShort_t str = 0; str < nstr; str++) {
86 Float_t eta = fESD->Eta(det,*rng,sec,str);
87 Float_t mult = fESD->Multiplicity(det,*rng,sec,str);
88 Float_t multp1 = (str == nstr-1 ? 0 :
89 fESD->Multiplicity(det,*rng,sec,str+1));
90 if (!fESD->IsAngleCorrected()) {
91 double c=TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta))));
92 mult *= c;
93 multp1 *= c;
94 }
95
96 // Check signal isn't pedestal
97 if (mult < 0.001) continue;
98
99 // Phi
100 Double_t dPhi = 2*TMath::Pi() / fRing[ridx]->NSeq();
101 Double_t phi;
102 if (det == 3) phi = TMath::Pi() - (sec + .5) * dPhi;
103 else phi = (sec + .5) * dPhi;
104 if (phi < 0) phi += 2 * TMath::Pi();
105
106 if (fRing[ridx]->ProcessESD(phi, eta, mult, multp1)) str++;
107 // "mult" possibly updated
108 Fill(phi, eta, mult);
109 }
110 }
111 }
112 }
113 return kTRUE;
114}
115//____________________________________________________________________
116Bool_t
117AliFMDAnaESD::End()
118{
119 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->End();
120 return AliFMDInput::End();
121}
122//____________________________________________________________________
123Bool_t
124AliFMDAnaESD::Finish()
125{
126 // Called at the end of run
127 // Parameters:
128 // Return
129 // @c false in case of errors
130 //
131 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Finish();
132 return AliFMDInput::Finish();
133}
134//__________________________________________________________________
135void
136AliFMDAnaESD::AddRing(AliFMDAnaRing* ring)
137{
138 // Add a ring
139 // Parameters:
140 // ring Ring object
141 //
142 fRing[FindRing(ring->Detector(),ring->Ring())] = ring;
143}
144//____________________________________________________________________
145Int_t
146AliFMDAnaESD::FindRing(UShort_t det, Char_t ring) const
147{
148 // Find a ring index
149 // Parameters:
150 // det Detector number
151 // ring Ring id
152 // Return
153 // Index of ring object
154 //
155 Int_t idx = -1;
156 switch (det) {
157 case 1: idx = 0; break;
158 case 2: idx = 1 + (ring == 'O' || ring == 'o' ? 1 : 0); break;
159 case 3: idx = 3 + (ring == 'O' || ring == 'o' ? 1 : 0); break;
160 }
161 return idx;
162}
163
164//____________________________________________________________________
165void
166AliFMDAnaESD::Browse(TBrowser* b)
167{
168 for (size_t i = 0; i < 5; i++)
169 if (fRing[i]) b->Add(fRing[i], fRing[i]->Name());
170}
171
172//____________________________________________________________________
173//
174// EOF
175//