]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDAnaESD.cxx
Example macros for Kr cluster finding
[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()
29{
30 // Constructor
31 // Parameters:
32 // lower cut.
33 //
34 AddLoad(kESD);
35 for (size_t i = 0; i < 5; i++) fRing[i] = 0;
36}
37//____________________________________________________________________
38Bool_t
39AliFMDAnaESD::Init()
40{
41 // Called at beginning of run
42 // Parameters:
43 // Return
44 // @c false on error
45 //
46 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Init();
47 return AliFMDInput::Init();
48}
49//____________________________________________________________________
50Bool_t
51AliFMDAnaESD::Begin(Int_t ev)
52{
53 // Begining of event
54 // Parameters:
55 // ev Event number
56 // Return
57 // @c false on error
58 //
59 fNEvents++;
60 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Begin();
61 Bool_t ret = AliFMDInput::Begin(ev);
62 return ret;
63}
64//____________________________________________________________________
65Bool_t
66AliFMDAnaESD::ProcessESDs()
67{
68 // Loop over all ESD data, and call ProcessESD for each entry.
69 // Parameters:
70 // Return
71 // @c false on error
72 //
73
74 // Process event summary data
75 if (!fESD) return kFALSE;
76 for (UShort_t det = 1; det <= 3; det++) {
77 Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' };
78 for (Char_t* rng = rings; *rng != '\0'; rng++) {
79 UShort_t nsec = (*rng == 'I' ? 20 : 40);
80 UShort_t nstr = (*rng == 'I' ? 512 : 256);
81 Int_t ridx = FindRing(det, *rng);
82 if (ridx < 0 || !fRing[ridx]) continue;
83 for (UShort_t sec = 0; sec < nsec; sec++) {
84 for (UShort_t str = 0; str < nstr; str++) {
85 Float_t eta = fESD->Eta(det,*rng,sec,str);
86 Float_t mult = fESD->Multiplicity(det,*rng,sec,str);
87 Float_t multp1 = (str == nstr-1 ? 0 :
88 fESD->Multiplicity(det,*rng,sec,str+1));
89 if (!fESD->IsAngleCorrected()) {
90 double c=TMath::Abs(TMath::Cos(2.*TMath::ATan(TMath::Exp(-eta))));
91 mult *= c;
92 multp1 *= c;
93 }
94
95 // Check signal isn't pedestal
96 if (mult < 0.001) continue;
97
98 // Phi
99 Double_t dPhi = 2*TMath::Pi() / fRing[ridx]->NSeq();
100 Double_t phi;
101 if (det == 3) phi = TMath::Pi() - (sec + .5) * dPhi;
102 else phi = (sec + .5) * dPhi;
103 if (phi < 0) phi += 2 * TMath::Pi();
104
105 if (fRing[ridx]->ProcessESD(phi, eta, mult, multp1)) str++;
106 // "mult" possibly updated
107 Fill(phi, eta, mult);
108 }
109 }
110 }
111 }
112 return kTRUE;
113}
114//____________________________________________________________________
115Bool_t
116AliFMDAnaESD::End()
117{
118 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->End();
119 return AliFMDInput::End();
120}
121//____________________________________________________________________
122Bool_t
123AliFMDAnaESD::Finish()
124{
125 // Called at the end of run
126 // Parameters:
127 // Return
128 // @c false in case of errors
129 //
130 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Finish();
131 return AliFMDInput::Finish();
132}
133//__________________________________________________________________
134void
135AliFMDAnaESD::AddRing(AliFMDAnaRing* ring)
136{
137 // Add a ring
138 // Parameters:
139 // ring Ring object
140 //
141 fRing[FindRing(ring->Detector(),ring->Ring())] = ring;
142}
143//____________________________________________________________________
144Int_t
145AliFMDAnaESD::FindRing(UShort_t det, Char_t ring) const
146{
147 // Find a ring index
148 // Parameters:
149 // det Detector number
150 // ring Ring id
151 // Return
152 // Index of ring object
153 //
154 Int_t idx = -1;
155 switch (det) {
156 case 1: idx = 0; break;
157 case 2: idx = 1 + (ring == 'O' || ring == 'o' ? 1 : 0); break;
158 case 3: idx = 3 + (ring == 'O' || ring == 'o' ? 1 : 0); break;
159 }
160 return idx;
161}
162
163//____________________________________________________________________
164void
165AliFMDAnaESD::Browse(TBrowser* b)
166{
167 for (size_t i = 0; i < 5; i++)
168 if (fRing[i]) b->Add(fRing[i], fRing[i]->Name());
169}
170
171//____________________________________________________________________
172//
173// EOF
174//