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 **************************************************************************/
16 //_________________________________________________________________________
17 // This is a class that constructs ReconstParticles (reconstructed particles)
20 //-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia
21 //////////////////////////////////////////////////////////////////////////////
23 // --- ROOT system ---
33 // --- Standard library ---
35 #include <Riostream.h>
37 // --- AliRoot header files ---
39 #include "AliRunLoader.h"
40 #include "AliLoader.h"
42 #include "AliFMDdigit.h"
43 #include "AliFMDReconstParticles.h"
44 #include "AliFMDReconstructor.h"
46 #include "AliConfig.h"
47 #include "AliHeader.h"
48 #include "AliGenEventHeader.h"
50 ClassImp(AliFMDReconstructor)
53 //____________________________________________________________________________
55 void AliFMDReconstructor::Reconstruct(AliRunLoader* runLoader) const
57 //Collects all digits in the same active volume into number of particles
59 Reconstruct number of particles
60 in given group of pads for given FMDvolume
61 determine by numberOfVolume ,
62 numberOfMinSector,numberOfMaxSector,
63 numberOfMinRing, numberOgMaxRing
64 Reconstructor method choose dependence on number of empty pads
69 Info("Exec ","Start");
72 Int_t const knumVolumes=5;
74 Float_t eta, etain,etaout,rad,theta;
75 Int_t ivol, iSector, iRing;
76 Float_t rin[5]={4.2,15.4,4.2,15.4,4.2};
77 Float_t rout[5]={17.4,28.4,17.4,28.4,17.4};
78 Float_t z[5]={-62.8, -75.2, 83.4, 75.2, 340.};
79 Int_t numberOfRings[5]={512,256,512,256,512};
80 Int_t numberOfSectors[5]= {20,40,20,40,20};
81 Int_t numberOfEtaIntervals[5];
82 // number of ring for boundary 0.1 eta
87 Error("Exec","Run Loader loader is NULL - Session not opened");
91 AliLoader* plFMD = runLoader->GetLoader("FMDLoader");
94 Fatal("AliFMDReconstructor","Can not find FMD (loader) in specified event");
95 return;//never reached
98 if (!runLoader->GetAliRun()) runLoader->LoadgAlice();
99 if (!runLoader->TreeE()) runLoader->LoadHeader();
101 TDirectory* cwd = gDirectory;
105 for (Int_t j=1; j<=5; j++){
106 sprintf(buf1,"hTotal%d",j);
108 hTotal[j] = new TH2F(buf1," Number of primary particles ",
109 numberOfSectors[j-1],1,numberOfSectors[j-1],
110 numberOfRings[j-1],1,numberOfRings[j-1]);
114 plFMD->LoadRecPoints("RECREATE");
115 TClonesArray* reconParticles = new TClonesArray("AliFMDReconstParticles");
116 TClonesArray* digits = new TClonesArray("AliFMDdigit");
119 Int_t nevents=Int_t (runLoader->TreeE()->GetEntries());
121 cout<<" nevents "<<nevents<<endl;
123 for(Int_t ievent=0;ievent<nevents;ievent++)
126 cout<<" *** event "<<ievent<<endl;
128 runLoader->GetEvent(ievent) ;
129 //event z-vertex for correction eta-rad dependence
130 AliHeader *header = runLoader->GetHeader();
131 AliGenEventHeader* genHeader = header->GenEventHeader();
132 TArrayF *o = new TArrayF(3);
133 if (genHeader) genHeader->PrimaryVertex(*o);
134 Float_t zVertex=o->At(2);
136 for (Int_t i=0; i<5; i++)
137 hTotal[i+1]->Reset();
139 retval = plFMD->LoadDigits("READ");
142 Error("Exec","Error occured while loading digits. Exiting.");
146 TTree* treeD = plFMD->TreeD();
149 Error("Exec","Can not get Tree with Digits. Nothing to reconstruct - Exiting");
155 brDigits=treeD->GetBranch("FMD");
158 brDigits->SetAddress(&digits);
160 cerr<<"EXEC Branch FMD digits not found"<<endl;
164 if(plFMD->TreeR()==0) plFMD->MakeTree("R");
167 const Int_t kBufferSize = 16000;
168 plFMD->TreeR()->Branch("FMD", &reconParticles, kBufferSize);
173 AliFMDdigit *fmdDigit;
174 if (plFMD->TreeD()->GetEvent(0))
176 Int_t nDigits=digits->GetEntries();
177 Int_t recParticles[6];
180 Int_t numberOfPads=0;
182 Float_t channelWidth=(22400*50)/1024;
183 for (Int_t digit=0;digit<nDigits;digit++)
185 fmdDigit=(AliFMDdigit*)digits->UncheckedAt(digit);
186 ivol=fmdDigit->Volume();
187 iSector=fmdDigit->NumberOfSector();
188 iRing=fmdDigit->NumberOfRing();
189 pedestal=Int_t(gRandom->Gaus(500,250));
190 padADC= fmdDigit->ADCsignal()
191 -Int_t(Float_t(pedestal)/channelWidth);
192 if (padADC<0) padADC=0;
193 hTotal[ivol]->Fill(iSector,iRing,padADC);
196 //reconstruct multiplicity in 0.1 eta according Poisson distribution
198 Int_t rmin=0; Int_t rmax=0;
199 Int_t smin=0; Int_t smax=0;
200 for (ivol=0; ivol<knumVolumes; ivol++)
202 Float_t ring2number=Float_t (numberOfRings[ivol])/
203 (rout[ivol]-rin[ivol]);
204 Float_t realZ=zVertex+z[ivol];
205 theta=TMath::ATan(rout[ivol]/TMath::Abs(realZ));
206 etain = - TMath::Log( TMath::Tan(theta/2.));
207 theta=TMath::ATan(rin[ivol]/TMath::Abs(realZ));
208 etaout=- TMath::Log( TMath::Tan(theta/2.));
209 numberOfEtaIntervals[ivol]=Int_t((etaout-etain)*10)-1;
211 for (Int_t e1=0;e1<=numberOfEtaIntervals[ivol];e1++)
213 theta = 2.*TMath::ATan (TMath::Exp (-eta));
214 Float_t radmin = TMath::Abs(realZ) * (TMath::Tan (theta));
215 rmax= Int_t ( (radmin-rin[ivol])*ring2number+0.5);
217 theta = 2.*TMath::ATan (TMath::Exp (-eta));
218 rad = TMath::Abs(realZ) * (TMath::Tan (theta));
219 rmin=Int_t( (rad-rin[ivol])*ring2number+0.5);
223 smax=numberOfSectors[ivol];
224 numberOfPads=(rmax-rmin)*(smax-smin);
225 for (Int_t iring=rmin; iring<rmax; iring++)
229 isector<numberOfSectors[ivol];
232 if(hTotal[ivol+1]->GetBinContent(isector+1,iring+1)
233 <zeroADC) zeroPads++;}
236 Float_t numberOfPads=Float_t(smax-smin)*Float_t(rmax-rmin);
238 Double_t lambda=-TMath::Log(Double_t(zeroPads)/numberOfPads);
239 Int_t fRecon=Int_t (lambda*numberOfPads+0.5);
240 recParticles[0]=ivol+1;
241 recParticles[1]=smin;
242 recParticles[2]=smax;
243 recParticles[3]=rmin;
244 recParticles[4]=rmax;
245 recParticles[5]= fRecon;
246 new((*reconParticles)[nRecPart++]) AliFMDReconstParticles(recParticles);
252 }//if (plFMD->TreeD()->GetEvent(0))
253 plFMD->TreeR()->Reset();
254 plFMD->TreeR()->Fill();
255 plFMD->WriteRecPoints("OVERWRITE");
256 plFMD->UnloadDigits();
258 plFMD->UnloadRecPoints();
260 Info(" Exec"," finished");
262 // delete hTotal[10];
267 //_____________________________________________________________________________
268 void AliFMDReconstructor::FillESD(AliRunLoader* /*runLoader*/,
269 AliESD* /*esd*/) const
271 // nothing to be done