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 ---
31 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliFMDdigit.h"
38 #include "AliFMDReconstParticles.h"
41 #include "AliFMDReconstruction.h"
44 ClassImp(AliFMDReconstruction)
47 //____________________________________________________________________________
49 AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","")
51 fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file
52 // add Task to //root/Tasks folder
53 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
54 roottasks->Add(this) ;
56 //____________________________________________________________________________
58 AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","")
60 fNevents = 0 ; // Number of events to rreconnstraction, 0 means all events in current file
61 fReconstParticlesFile=ReconstParticlesFile ;
62 fHeadersFile=HeaderFile ;
63 //add Task to //root/Tasks folder
64 TTask * roottasks = (TTask*)gROOT->GetRootFolder()->FindObject("Tasks") ;
65 roottasks->Add(this) ;
68 //____________________________________________________________________________
70 AliFMDReconstruction::~AliFMDReconstruction()
75 //____________________________________________________________________________
77 void AliFMDReconstruction::Exec(Option_t *option)
79 //Collects all digits in the same active volume into number of particles
81 AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD");
82 TClonesArray *fReconParticles=FMD->ReconParticles();
83 if(fNevents == 0) fNevents=(Int_t)gAlice->TreeD()->GetEntries();
84 for(Int_t ievent=0;ievent<fNevents;ievent++)
86 gAlice->GetEvent(ievent) ;
87 if(gAlice->TreeH()==0) return;
88 if(gAlice->TreeR()==0) gAlice->MakeTree("R");
92 Int_t threshold[]={ 0, 14, 28, 42, 57,
93 72, 89, 104, 124, 129,
94 164, 174, 179, 208, 228,
95 248, 268, 317, 337, 357,
96 392, 407, 416, 426, 436,
97 461, 468, 493, 506, 515,
98 541, 566, 592, 617, 642,
99 668, 693, 719, 744, 770,
100 795, 821, 846, 871, 897,
101 922, 948, 973, 999, 1024};
105 Int_t threshold[]={ 0, 18, 37, 56, 76,
106 96, 119, 138, 165, 172,
107 218, 231, 238, 277, 304,
108 330, 357, 423, 449, 476,
109 522, 542, 555, 568, 581,
110 614, 624, 657, 674, 687,
111 700, 713, 720, 727, 733,
112 740, 759, 778, 797, 816,
113 834, 853, 872, 891, 910,
114 929, 948, 967, 986, 1024};
117 int threshold_array_size=sizeof(threshold)/sizeof(threshold[0]);
118 AliFMDdigit *fmdDigit;
119 // cout<<" AliFMDdigit "<<AliFMDdigit<<endl;
122 gAlice->TreeD()->GetEvent(0);
123 TClonesArray *FMDdigits=FMD->Digits();
124 Int_t nDigits=FMDdigits->GetEntries();
125 Int_t RecParticles[4];
127 for (Int_t digit=0;digit<nDigits;digit++)
129 fmdDigit=(AliFMDdigit*)FMDdigits->UncheckedAt(digit);
130 RecParticles[0] = fmdDigit->Volume();
131 RecParticles[1] = fmdDigit->NumberOfSector();
132 RecParticles[2] = fmdDigit->NumberOfRing();
133 Int_t ADC=fmdDigit->ADCsignal();
134 RecParticles[3]=0; //case when fmdDigit->ADCsignal()==0
135 for (int i=0;i<threshold_array_size-1;i++)
137 if(ADC>threshold[i]&&ADC<=threshold[i+1])
140 new((*fReconParticles)[nRecPart++]) AliFMDReconstParticles(RecParticles);
143 gAlice->TreeR()->Reset();
144 gAlice->TreeR()->Fill();
145 gAlice->TreeR()->Write(0,TObject::kOverwrite);
147 cout<<"\nAliFMDReconstruction::Exec finished"<<endl;
149 //__________________________________________________________________
151 void AliFMDReconstruction::SetReconstParticlesFile(char * file )
153 if (!fReconstParticlesFile.IsNull())
154 cout<<"\nChanging reconstructed particles file from "<<
155 (char *) fReconstParticlesFile.Data()<< " to "<<file<<endl;
156 fReconstParticlesFile=file;
158 //__________________________________________________________________
159 void AliFMDReconstruction::Print(Option_t* option)const
161 cout<<"------------------- "<<GetName() <<" -------------"<< endl ;
162 if(fReconstParticlesFile.IsNull())
163 cout<<"\nWriting reconstructed particles to file"<<endl ;
165 cout<<"\nWriting reconstructed particles to file "<<
166 (char*) fReconstParticlesFile.Data() << endl ;