]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSReconstructioner.cxx
New Get Index functions (Emc et ppsd for the analysis of reconstructed events
[u/mrichter/AliRoot.git] / PHOS / AliPHOSReconstructioner.cxx
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 /* $Id$ */
17
18 //_________________________________________________________________________
19 //  Algorithm class for the reconstruction: clusterizer
20 //                                          track segment maker
21 //                                          particle identifier   
22 //                  
23 //*-- Author: Gines Martinez & Yves Schutz (SUBATECH)
24
25
26 // --- ROOT system ---
27
28 #include "TClonesArray.h"
29
30 // --- Standard library ---
31
32 #include <iomanip.h>
33
34 // --- AliRoot header files ---
35
36 #include "AliPHOSReconstructioner.h"
37 #include "AliPHOSClusterizer.h"
38
39 ClassImp(AliPHOSReconstructioner)
40
41 //____________________________________________________________________________
42 AliPHOSReconstructioner::AliPHOSReconstructioner(AliPHOSClusterizer * Clusterizer, 
43                                                  AliPHOSTrackSegmentMaker * Tracker,
44                                                  AliPHOSPID * Pid)
45 {
46   // ctor
47   
48   fClusterizer        = Clusterizer ;
49   fTrackSegmentMaker  = Tracker ;
50   fPID                = Pid ; 
51   fDebugReconstruction = kFALSE ;
52
53
54
55 //____________________________________________________________________________
56  void AliPHOSReconstructioner::Init(AliPHOSClusterizer * Clusterizer, 
57                                                  AliPHOSTrackSegmentMaker * Tracker,
58                                                  AliPHOSPID * Pid)
59 {
60   fClusterizer        = Clusterizer ;
61   fTrackSegmentMaker  = Tracker ;
62   fPID                = Pid ; 
63   fDebugReconstruction = kFALSE ;
64
65
66 //____________________________________________________________________________
67  void AliPHOSReconstructioner::Make(DigitsList * dl, RecPointsList * emccl, RecPointsList * ppsdl, 
68                                      TrackSegmentsList * trsl, RecParticlesList * rpl)
69 {
70   // Launches the Reconstruction process in the sequence: Make the reconstructed poins (clusterize)
71   //                                                      Make the track segments 
72   //                                                      Make the reconstructed particles
73   Int_t index ; 
74   // Digit Debuging
75   if  (fDebugReconstruction)     {
76     cout << ">>>>>>>>>>>>>>>>>>>>>> DebugReconstruction  <<<<<<<<<<<<<<<<<<<<<<<<<<"  << endl ;
77     cout << "DebugReconstruction>>> Digit list entries is " <<    dl->GetEntries() << endl ;
78     AliPHOSDigit * digit;
79     Bool_t calorimeter ;
80     Float_t factor;
81     cout << "DebugReconstruction>>>    Vol Id " << 
82       " Ene(MeV, KeV) "             <<                         
83       " Index "                    << 
84       " Nprim "                     << 
85       " Prim1 "                      << 
86       " Prim2 "                      << 
87       " Prim3 "                      <<  endl;      
88     for (index = 0 ; index < dl->GetEntries() ; index++) {
89       digit = (AliPHOSDigit * )  dl->At(index) ;
90       calorimeter = fClusterizer->IsInEmc(digit);
91       if (calorimeter) factor =1000. ; else factor=1000000.;
92       cout << "DebugReconstruction>>>  " << 
93         setw(8)  <<  digit->GetId() << " "  <<
94         setw(3)  <<  calorimeter <<  
95         setw(10) <<  factor*fClusterizer->Calibrate(digit->GetAmp()) <<       "  "  <<                   
96         setw(6)  <<  digit->GetIndexInList() << "  "  << 
97         setw(5)  <<  digit->GetNprimary() <<"  "  << 
98         setw(5)  <<  digit->GetPrimary(1) <<"  "  << 
99         setw(5)  <<  digit->GetPrimary(2) <<"  "  << 
100         setw(5)  <<  digit->GetPrimary(3) << endl;       
101     }
102     
103   }
104
105
106
107   // Making Clusters
108   if  (fDebugReconstruction)  cout << "DebugReconstruction>>> Start making reconstructed points (clusterizing)" << endl;
109   fClusterizer->MakeClusters(dl, emccl, ppsdl);
110
111   // mark the position of the RecPoints in the array
112   AliPHOSEmcRecPoint * emcrp ; 
113   for (index = 0 ; index < emccl->GetEntries() ; index++) {
114     emcrp = (AliPHOSEmcRecPoint * )emccl->At(index) ; 
115     emcrp->SetIndexInList(index) ; 
116   }
117   AliPHOSPpsdRecPoint * ppsdrp ; 
118   for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
119     ppsdrp = (AliPHOSPpsdRecPoint * )ppsdl->At(index) ; 
120     ppsdrp->SetIndexInList(index) ; 
121   }
122   
123   if  (fDebugReconstruction) 
124     {
125       cout << "DebugReconstruction>>> Cluster emc list entries is " <<    emccl->GetEntries() << endl ;
126       AliPHOSEmcRecPoint * recpoint;
127       cout << "DebugReconstruction>>> Module "  << 
128         "Ene(MeV) "             <<                         
129         "Index "                    << 
130         "Multi "                    << 
131         "   X     "                      << 
132         "   Y     "                      << 
133         "   Z    "                      << 
134         " Lambda 1   "                     <<  
135         " Lambda 2   "                     <<
136         "MaxEnergy(MeV) "                 <<
137         "Nprim "                 <<
138         "Prim1 "                 <<
139         "Prim2 "                 <<
140         "Prim3 "                 << endl;  
141       for (index = 0 ; index < emccl->GetEntries() ; index++) {
142         recpoint = (AliPHOSEmcRecPoint * )emccl->At(index) ; 
143         TVector3  locpos;  recpoint->GetLocalPosition(locpos);
144         Float_t lambda[2]; recpoint->GetElipsAxis(lambda);
145         Int_t * primaries; 
146         Int_t nprimaries;
147         primaries = recpoint->GetPrimaries(nprimaries);
148         cout << "DebugReconstruction>>>  " << 
149           setw(2) <<recpoint->GetPHOSMod() << " "  << 
150           setw(9) << 1000.*recpoint->GetTotalEnergy() <<       " "  <<                   
151           setw(6) <<  recpoint->GetIndexInList() << " "  << 
152           setw(5) <<  recpoint->GetMultiplicity() <<" "  << 
153           setw(8) <<  locpos.X() <<" "  << 
154           setw(8) <<  locpos.Y() <<" "  << 
155           setw(8) <<  locpos.Z() << " " <<
156           setw(10) << lambda[0] << "  " <<
157           setw(10) << lambda[1] << "  " <<
158           setw(9) << 1000*recpoint->GetMaximalEnergy() << "  " << 
159           setw(9) << nprimaries << "  "  <<
160           setw(4) << primaries[0] << "  "  <<
161           setw(4) << primaries[1] << "  "  <<
162           setw(4) << primaries[2] << "  "  << endl;              
163       }
164       
165       cout << "DebugReconstruction>>> Cluster ppsd list entries is " <<    ppsdl->GetEntries() << endl ;
166       AliPHOSPpsdRecPoint * ppsdrecpoint;
167       Text_t detector[4];
168       cout << "DebugReconstruction>>> Module "  << 
169         "Det     "             <<      
170         "Ene(KeV) "             <<                         
171         "Index "                    << 
172         "Multi "                    << 
173         "   X     "                      << 
174         "   Y     "                      << 
175         "   Z         "                      << 
176         "Nprim "                 <<
177         "Prim1 "                 <<
178         "Prim2 "                 <<
179         "Prim3 "                 << endl;  
180       for (index = 0 ; index < ppsdl->GetEntries() ; index++) {
181         ppsdrecpoint = (AliPHOSPpsdRecPoint * ) ppsdl->At(index) ; 
182         TVector3  locpos; ppsdrecpoint->GetLocalPosition(locpos);
183         Int_t * primaries; 
184         Int_t nprimaries;
185         if (ppsdrecpoint->GetUp()) 
186           strcpy(detector, "CPV"); 
187         else 
188           strcpy(detector, "PC ");
189         primaries = ppsdrecpoint->GetPrimaries(nprimaries);
190         cout << "DebugReconstruction>>> " << 
191           setw(4) << ppsdrecpoint->GetPHOSMod() << "  "  << 
192           setw(4)  << detector << " "      <<
193           setw(9) << 1000000.*ppsdrecpoint->GetTotalEnergy() <<       " "  <<             
194           setw(6) <<  ppsdrecpoint->GetIndexInList() << " "  << 
195           setw(5) <<  ppsdrecpoint->GetMultiplicity() <<" "  << 
196           setw(8) <<  locpos.X() <<" "  << 
197           setw(8) <<  locpos.Y() <<" "  << 
198           setw(8) <<  locpos.Z() << " " <<
199           setw(9) << nprimaries << "  "  <<
200           setw(4) << primaries[0] << "  "  <<
201           setw(4) << primaries[1] << "  "  <<
202           setw(4) << primaries[2] << "  "  << endl;              
203       }
204     }  
205   
206   
207   if  (fDebugReconstruction)  cout << "DebugReconstruction>>>> Start making track segments(unfolding+tracksegments)" << endl;
208   fTrackSegmentMaker->MakeTrackSegments(dl, emccl, ppsdl, trsl) ;   
209   
210   // mark the position of the TrackSegments in the array
211   AliPHOSTrackSegment * trs ; 
212   for (index = 0 ; index < trsl->GetEntries() ; index++) {
213     trs = (AliPHOSTrackSegment * )trsl->At(index) ; 
214     trs->SetIndexInList(index) ; 
215   }
216   if  (fDebugReconstruction){
217     cout << "DebugReconstruction>>> Track segment list entries is " <<    trsl->GetEntries() << endl ;
218     cout << "DebugReconstruction>>> Module "  << 
219       "Ene(KeV) "             <<                         
220       "Index "                    << 
221       "   X      "                      << 
222       "   Y      "                      << 
223       "   Z       "                      <<
224       " rX        "                      << 
225       " rY        "                      << 
226       " rZ      "                               << 
227       "Nprim "                 <<
228       "Prim1 "                 <<
229       "Prim2 "                 <<
230       "Prim3 "                 << endl;  
231     
232     for (index = 0 ; index < trsl->GetEntries() ; index++) {
233       trs = (AliPHOSTrackSegment * )trsl->At(index) ; 
234       TVector3 locpos; trs->GetPosition(locpos);
235       Int_t * primaries; 
236       Int_t nprimaries;
237       primaries = trs->GetPrimariesEmc(nprimaries);
238       cout << "DebugReconstruction>>> " << 
239         setw(4) << trs->GetPHOSMod() << "  "  << 
240         setw(9) << 1000.*trs->GetEnergy() <<       " "  <<             
241         setw(3) <<  trs->GetIndexInList() << " "  <<  
242         setw(9) <<  locpos.X() <<" "  << 
243         setw(9) <<  locpos.Y() <<" "  << 
244         setw(9) <<  locpos.Z() << " " <<
245         setw(10) <<  (trs->GetMomentumDirection()).X() << " " <<
246         setw(10) <<  (trs->GetMomentumDirection()).Y() << " " <<
247         setw(10) <<  (trs->GetMomentumDirection()).Z() << " " <<
248         setw(4) << nprimaries << "  "  <<
249         setw(4) << primaries[0] << "  "  <<
250         setw(4) << primaries[1] << "  "  <<
251         setw(4) << primaries[2] << "  "  << endl;
252     }
253     
254   }
255   if  (fDebugReconstruction)  cout << "DebugReconstruction>>>> Start making reconstructed particles" << endl;
256   
257   fPID->MakeParticles(trsl, rpl) ; 
258   
259   // mark the position of the RecParticles in the array
260   AliPHOSRecParticle * rp ; 
261   for (index = 0 ; index < rpl->GetEntries() ; index++) {
262     rp = (AliPHOSRecParticle * )rpl->At(index) ; 
263     rp->SetIndexInList(index) ; 
264   }
265   //Debugger of RecParticles
266  if  (fDebugReconstruction){
267     cout << "DebugReconstruction>>>  Reconstructed particle list entries is " <<    rpl->GetEntries() << endl ;
268     cout << "DebugReconstruction>>> Module "  << 
269       "    PARTICLE     "   <<
270       "Ene(KeV) "             <<                         
271       "Index "                    << 
272       "   X      "                      << 
273       "   Y      "                      << 
274       "   Z       "                      <<
275       "Nprim "                 <<
276       "Prim1 "                 <<
277       "Prim2 "                 <<
278       "Prim3 "                 << endl;  
279     for (index = 0 ; index < rpl->GetEntries() ; index++) {
280       rp = (AliPHOSRecParticle * ) rpl->At(index) ;       
281       TVector3 locpos; (rp->GetPHOSTrackSegment())->GetPosition(locpos);
282       Int_t * primaries; 
283       Int_t nprimaries;
284       Text_t particle[11];
285       primaries = (rp->GetPHOSTrackSegment())->GetPrimariesEmc(nprimaries);
286       switch(rp->GetType())
287         {
288         case kNEUTRAL_EM:
289           strcpy( particle, "NEUTRAL_EM");
290           break;
291         case kNEUTRAL_HA:
292           strcpy(particle, "NEUTRAL_HA");
293           break;
294         case kGAMMA:
295           strcpy(particle, "GAMMA");
296           break ;
297         case kGAMMA_HA: 
298           strcpy(particle, "GAMMA_H");
299           break ;
300         case kABSURD_EM:
301           strcpy(particle, "ABSURD_EM") ;
302           break ;
303         case kABSURD_HA:
304           strcpy(particle, "ABSURD_HA") ;
305           break ;       
306         case kELECTRON:
307           strcpy(particle, "ELECTRON") ;
308           break ;
309         case kCHARGED_HA:
310           strcpy(particle, "CHARGED_HA") ;
311           break ; 
312         }
313       
314       cout << "DebugReconstruction>>> " << 
315         setw(4) << (rp->GetPHOSTrackSegment())->GetPHOSMod() << "  "  <<
316         setw(15) << particle << "  " <<
317         setw(9) << 1000.*(rp->GetPHOSTrackSegment())->GetEnergy() <<       " "  <<             
318         setw(3) <<  rp->GetIndexInList() << " "  <<  
319         setw(9) <<  locpos.X() <<" "  << 
320         setw(9) <<  locpos.Y() <<" "  << 
321         setw(9) <<  locpos.Z() << " " <<
322         setw(4) << nprimaries << "  "  <<
323         setw(4) << primaries[0] << "  "  <<
324         setw(4) << primaries[1] << "  "  <<
325         setw(4) << primaries[2] << "  "  << endl;
326     }
327     
328   }
329
330
331 }