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