37c55dc0 |
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 | // This is a TTask that constructs ReconstParticles (reconstructed particles) |
18 | // out of Digits |
19 | // |
20 | //-- Authors: Evgeny Karpechev(INR) and Alla Maevsksia |
21 | ////////////////////////////////////////////////////////////////////////////// |
22 | |
dc8af42e |
23 | // --- ROOT system --- |
24 | #include "TTask.h" |
25 | #include "TTree.h" |
26 | #include "TSystem.h" |
27 | #include "TFile.h" |
37c55dc0 |
28 | #include "TROOT.h" |
29 | #include "TFolder.h" |
30 | |
dc8af42e |
31 | // --- Standard library --- |
37c55dc0 |
32 | #include <stdlib.h> |
93bdec82 |
33 | #include <Riostream.h> |
dc8af42e |
34 | |
35 | // --- AliRoot header files --- |
36 | |
37 | #include "AliFMDdigit.h" |
38 | #include "AliFMDReconstParticles.h" |
39 | #include "AliFMD.h" |
40 | #include "AliFMDv1.h" |
41 | #include "AliFMDReconstruction.h" |
42 | #include "AliRun.h" |
dc8af42e |
43 | |
44 | ClassImp(AliFMDReconstruction) |
45 | |
46 | |
47 | //____________________________________________________________________________ |
48 | |
49 | AliFMDReconstruction::AliFMDReconstruction():TTask("AliFMDReconstruction","") |
50 | { |
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) ; |
55 | } |
56 | //____________________________________________________________________________ |
57 | |
58 | AliFMDReconstruction::AliFMDReconstruction(char* HeaderFile, char *ReconstParticlesFile):TTask("AliFMDReconstruction","") |
59 | { |
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) ; |
66 | } |
67 | |
68 | //____________________________________________________________________________ |
69 | |
70 | AliFMDReconstruction::~AliFMDReconstruction() |
71 | { |
72 | |
73 | } |
74 | |
75 | //____________________________________________________________________________ |
76 | |
37c55dc0 |
77 | void AliFMDReconstruction::Exec(Option_t *option) |
dc8af42e |
78 | { |
79 | //Collects all digits in the same active volume into number of particles |
80 | |
81 | AliFMD * FMD = (AliFMD *) gAlice->GetDetector("FMD"); |
37c55dc0 |
82 | TClonesArray *fReconParticles=FMD->ReconParticles(); |
dc8af42e |
83 | if(fNevents == 0) fNevents=(Int_t)gAlice->TreeD()->GetEntries(); |
84 | for(Int_t ievent=0;ievent<fNevents;ievent++) |
85 | { |
86 | gAlice->GetEvent(ievent) ; |
87 | if(gAlice->TreeH()==0) return; |
88 | if(gAlice->TreeR()==0) gAlice->MakeTree("R"); |
89 | //Make branches |
90 | FMD->MakeBranch("R"); |
37c55dc0 |
91 | |
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}; |
102 | |
103 | |
104 | /* |
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}; |
115 | */ |
dc8af42e |
116 | |
117 | int threshold_array_size=sizeof(threshold)/sizeof(threshold[0]); |
118 | AliFMDdigit *fmdDigit; |
37c55dc0 |
119 | // cout<<" AliFMDdigit "<<AliFMDdigit<<endl; |
dc8af42e |
120 | if (FMD) |
121 | { |
122 | gAlice->TreeD()->GetEvent(0); |
123 | TClonesArray *FMDdigits=FMD->Digits(); |
37c55dc0 |
124 | Int_t nDigits=FMDdigits->GetEntries(); |
dc8af42e |
125 | Int_t RecParticles[4]; |
126 | Int_t nRecPart=0 ; |
127 | for (Int_t digit=0;digit<nDigits;digit++) |
128 | { |
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++) |
136 | { |
137 | if(ADC>threshold[i]&&ADC<=threshold[i+1]) |
138 | RecParticles[3]=i; |
139 | } |
140 | new((*fReconParticles)[nRecPart++]) AliFMDReconstParticles(RecParticles); |
141 | } //digit loop |
142 | }//if FMD |
143 | gAlice->TreeR()->Reset(); |
144 | gAlice->TreeR()->Fill(); |
37c55dc0 |
145 | gAlice->TreeR()->Write(0,TObject::kOverwrite); |
dc8af42e |
146 | } //event loop |
37c55dc0 |
147 | cout<<"\nAliFMDReconstruction::Exec finished"<<endl; |
dc8af42e |
148 | } |
149 | //__________________________________________________________________ |
150 | |
151 | void AliFMDReconstruction::SetReconstParticlesFile(char * file ) |
152 | { |
153 | if (!fReconstParticlesFile.IsNull()) |
154 | cout<<"\nChanging reconstructed particles file from "<< |
155 | (char *) fReconstParticlesFile.Data()<< " to "<<file<<endl; |
156 | fReconstParticlesFile=file; |
157 | } |
158 | //__________________________________________________________________ |
159 | void AliFMDReconstruction::Print(Option_t* option)const |
160 | { |
161 | cout<<"------------------- "<<GetName() <<" -------------"<< endl ; |
162 | if(fReconstParticlesFile.IsNull()) |
163 | cout<<"\nWriting reconstructed particles to file"<<endl ; |
164 | else |
165 | cout<<"\nWriting reconstructed particles to file "<< |
166 | (char*) fReconstParticlesFile.Data() << endl ; |
167 | } |
168 | |
169 | |
170 | |
37c55dc0 |
171 | |
172 | |
173 | |
174 | |
175 | |
176 | |
177 | |
178 | |
179 | |
180 | |
181 | |
182 | |
183 | |
184 | |
185 | |
186 | |
187 | |
188 | |
dc8af42e |
189 | |
190 | |