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 TTask that constructs ReconstParticles (reconstructed particles)
20 //-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia
21 //////////////////////////////////////////////////////////////////////////////
23 // --- ROOT system ---
30 #include <Riostream.h>
32 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliFMDdigit.h"
38 #include "AliFMDReconstParticles.h"
41 #include "AliFMDReconstruction.h"
43 ClassImp(AliFMDReconstruction)
46 //____________________________________________________________________________
48 AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","")
50 fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file
51 // add Task to //root/Tasks folder
52 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
53 roottasks->Add(this) ;
55 //____________________________________________________________________________
57 AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","")
59 fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file
60 fReconstParticlesFile=ReconstParticlesFile ;
61 fHeadersFile=HeaderFile ;
62 //add Task to //root/Tasks folder
63 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
64 roottasks->Add(this) ;
67 //____________________________________________________________________________
69 AliFMDReconstruction::~AliFMDReconstruction()
72 //----------------------------------------------------------------------------
74 void AliFMDReconstruction::Exec(Option_t *option)
76 printf (" AliFMDReconstruction starting \n");
77 //Collects all digits in the same active volume into number of particles
79 Int_t const NumVolums=5;
80 Int_t const NumSectors=40;
81 Int_t const NumRings=768;
82 Int_t PadADC[10][50][800];
83 Int_t ivol, iSector, iRing;
85 //Int_t NumberOfRings[5]= {256,128,256,128,256};
86 Int_t NumberOfSectors[5]= {20,40,20,40,20};
87 // number of ring for boundary 0.1 eta
88 Int_t EtaIntervalInner []=
89 {0, 55, 110, 165, 221, 276, 331, 386, 442,
90 497, 552, 607, 663, 718, 767 };
93 92, 110, 128, 147, 165,
94 184, 202, 221, 239, 255};*/
95 Int_t EtaIntervalOuter []= //{0, 21, 43, 65, 86, 108, 127};
96 {0, 65, 130, 195, 260, 325, 383};
97 Int_t EtaInterval[20];
100 Int_t size_EtaIntervalInner=sizeof (EtaIntervalInner)/sizeof(EtaIntervalInner[0]);
102 Int_t size_EtaIntervalOuter=sizeof (EtaIntervalOuter)/sizeof(EtaIntervalOuter[0]);
104 AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD");
105 TClonesArray *fReconParticles=FMD->ReconParticles();
106 if(fNevents == 0) fNevents=(Int_t)gAlice->TreeE()->GetEntries();
107 for(Int_t ievent=0;ievent<fNevents;ievent++)
109 for (Int_t i=0; i<NumVolums; i++)
110 for(Int_t j=0; j<NumSectors; j++)
111 for(Int_t ij=0; ij<NumRings; ij++)
112 PadADC[i][j][ij]=0; //zhachem ???
113 gAlice->GetEvent(ievent) ;
114 if(gAlice->TreeH()==0) return;
115 if(gAlice->TreeR()==0) gAlice->MakeTree("R");
117 AliFMDdigit *fmdDigit;
118 FMD->MakeBranch("R");
121 // Int_t threshold_array_size=30;
123 // cout<<" AliFMDdigit "<<AliFMDdigit<<endl;
126 gAlice->TreeD()->GetEvent(0);
127 TClonesArray *FMDdigits=FMD->Digits();
128 Int_t nDigits=FMDdigits->GetEntries();
129 Int_t RecParticles[6];
132 Int_t NumberOfPads=0; //To avoid warning
134 Float_t channelWidth=(22400*50)/1024;
135 for (Int_t digit=0;digit<nDigits;digit++)
137 fmdDigit=(AliFMDdigit*)FMDdigits->UncheckedAt(digit);
138 ivol=fmdDigit->Volume();
139 iSector=fmdDigit->NumberOfSector();
140 iRing=fmdDigit->NumberOfRing();
141 pedestal=Int_t(gRandom->Gaus(500,250));
142 PadADC[ivol-1][iSector-1][iRing-1]=
143 fmdDigit->ADCsignal()
144 -Int_t(Float_t(pedestal)/channelWidth);
145 if (PadADC[ivol-1][iSector-1][iRing-1]<0)
146 PadADC[ivol-1][iSector-1][iRing-1]=0;
148 Int_t Rmin=0; Int_t Rmax=0; //To avoid warning
149 Int_t Smin=0; Int_t Smax=0; //To avoid warning
151 for (ivol=1; ivol<=NumVolums; ivol++)
153 if (ivol==1||ivol==3||ivol==5)
155 Ne1=size_EtaIntervalInner;
156 for(Int_t ieta=0; ieta<Ne1; ieta++)
157 EtaInterval[ieta]=EtaIntervalInner[ieta];
159 if (ivol==2||ivol==4)
161 Ne1=size_EtaIntervalOuter;
162 for( Int_t ieta=0; ieta<Ne1; ieta++)
163 EtaInterval[ieta]=EtaIntervalOuter[ieta];
167 for (Int_t e1=0;e1<Ne1-1;e1++) // vol<=NumVolums
169 Rmin=EtaInterval[e1];
170 Rmax=EtaInterval[e1+1];
173 Smax=NumberOfSectors[ivol-1];
174 for (Int_t iring=Rmin; iring<Rmax; iring++)
176 NumberOfPads=(Rmax-Rmin)*(Smax-Smin);
179 isector<=NumberOfSectors[ivol-1];
181 if(PadADC[ivol-1][isector-1][iring-1]<zeroADC)
185 cout<<"\nRmin="<<Rmin;
186 cout<<"\nRmax="<<Rmax;
187 cout<<"\nSmin="<<Smin;
188 cout<<"\nSmax="<<Smax;
190 cout<<"\nvolume "<<ivol<<" zero "<<ZeroPads<<
191 " NumberOfPads "<<NumberOfPads<<endl;
194 (Float_t)ZeroPads/(Float_t)NumberOfPads;
195 // cout<<"\nzerosRatio="<<zerosRatio;
196 RecParticles[0]=ivol;
197 RecParticles[1]=Smin;
198 RecParticles[2]=Smax;
199 RecParticles[3]=Rmin;
200 RecParticles[4]=Rmax;
201 if (zerosRatio>0.1 ||(ivol==2||ivol==4))
203 Determination_by_Poisson
204 (PadADC,ivol,Rmin,Rmax,Smin,Smax);
207 Determination_by_thresholds
208 (PadADC,ivol,Rmin,Rmax,Smin,Smax);
209 // cout<<" nDeterm "<<RecParticles[5]<<endl;
210 new((*fReconParticles)[nRecPart++])
211 AliFMDReconstParticles(RecParticles);
215 // if(zerosRatio<0.01) Determination_by_counting (ZeroPads) ;
217 gAlice->TreeR()->Reset();
218 gAlice->TreeR()->Fill();
219 gAlice->TreeR()->Write(0,TObject::kOverwrite);
221 // cout<<"\nAliFMDReconstruction::Exec finished"<<endl;
224 //------------------------------------------------------------
225 Int_t AliFMDReconstruction::Determination_by_thresholds
226 (Int_t PadADC[][50][800],Int_t volume, Int_t Rmin, Int_t Rmax,
227 Int_t Smin, Int_t Smax)
230 Int_t thresholdInner[30]={
232 72, 89, 104, 124, 129,
233 164, 174, 179, 208, 228,
234 248, 268, 317, 337, 357,
235 392, 407, 416, 426, 436,
236 461, 468, 493, 506, 515};
238 Int_t thresholdOuter[30]={0, 18, 48, 77, 105,
245 for (Int_t it=0; it<30; it++) {
246 if(volume==1||volume==3||volume==5) threshold[it]=thresholdInner[it];
247 if(volume==2||volume==4) threshold[it]=thresholdOuter[it];
249 Int_t threshold_array_size = 30;
252 for (Int_t iring=Rmin; iring<Rmax; iring++)
254 for (Int_t isector=Smin; isector<Smax; isector++)
256 for (int i=0;i<threshold_array_size-1;i++)
258 if(PadADC[volume-1][isector][iring]>threshold[i]
259 &&PadADC[volume-1][isector][iring]<=threshold[i+1])
263 }; // if in threshol interval
264 }; //threshold_array_size
267 // cout<<"\nEnd threshol method"<<endl;
272 //__________________________________________________________________
274 Int_t AliFMDReconstruction::Determination_by_Poisson (Int_t PadADC[][50][800],
275 Int_t vol, Int_t rmin, Int_t rmax,
276 Int_t secmin, Int_t secmax)
278 Int_t threshold_adc=1;
280 for (Int_t i=rmin;i<rmax;i++)
282 for (Int_t j=secmin;j<secmax;j++)
284 if (PadADC[vol-1][j][i]<threshold_adc) zeropads++;
287 Float_t lambda=-TMath::Log(Float_t(zeropads)/
288 ( Float_t(secmax-secmin)*
289 Float_t(rmax-rmin))); //+1 zdes' ne nado
290 Int_t Recon=(Int_t)(lambda*(secmax-secmin)*(rmax-rmin)); //+1 zdes' ne nado
291 // cout<<"\nEnd Poisson method"<<endl;
295 //------------------------------------------------------------------