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