1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 //____________________________________________________________________
17 // Utility class for analysing ESD data.
18 // This class does sharing and background correction
20 #include <AliESDFMD.h>
21 #include "AliFMDAnaESD.h"
22 #include "AliFMDAnaRing.h"
27 //____________________________________________________________________
28 AliFMDAnaESD::AliFMDAnaESD()
36 for (size_t i = 0; i < 5; i++) fRing[i] = 0;
38 //____________________________________________________________________
42 // Called at beginning of run
47 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Init();
48 return AliFMDInput::Init();
50 //____________________________________________________________________
52 AliFMDAnaESD::Begin(Int_t ev)
61 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Begin();
62 Bool_t ret = AliFMDInput::Begin(ev);
65 //____________________________________________________________________
67 AliFMDAnaESD::ProcessESDs()
69 // Loop over all ESD data, and call ProcessESD for each entry.
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))));
96 // Check signal isn't pedestal
97 if (mult < 0.001) continue;
100 Double_t dPhi = 2*TMath::Pi() / fRing[ridx]->NSeq();
102 if (det == 3) phi = TMath::Pi() - (sec + .5) * dPhi;
103 else phi = (sec + .5) * dPhi;
104 if (phi < 0) phi += 2 * TMath::Pi();
106 if (fRing[ridx]->ProcessESD(phi, eta, mult, multp1)) str++;
107 // "mult" possibly updated
108 Fill(phi, eta, mult);
115 //____________________________________________________________________
119 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->End();
120 return AliFMDInput::End();
122 //____________________________________________________________________
124 AliFMDAnaESD::Finish()
126 // Called at the end of run
129 // @c false in case of errors
131 for (int i = 0; i < 5; i++) if (fRing[i]) fRing[i]->Finish();
132 return AliFMDInput::Finish();
134 //__________________________________________________________________
136 AliFMDAnaESD::AddRing(AliFMDAnaRing* ring)
142 fRing[FindRing(ring->Detector(),ring->Ring())] = ring;
144 //____________________________________________________________________
146 AliFMDAnaESD::FindRing(UShort_t det, Char_t ring) const
150 // det Detector number
153 // Index of ring object
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;
164 //____________________________________________________________________
166 AliFMDAnaESD::Browse(TBrowser* b)
168 for (size_t i = 0; i < 5; i++)
169 if (fRing[i]) b->Add(fRing[i], fRing[i]->Name());
172 //____________________________________________________________________