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