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