]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/AliPHOSReconstructioner.cxx
Compilation warnings fixed
[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 //*--
20 //*-- Author: Gines Martinez & Yves Schutz (SUBATECH) 
21 //*-- Compleetely redesigned by Dmitri Peressounko (SUBATECH & RRC KI) March 2001
22 /////////////////////////////////////////////////////////////////////////////////////
23 //  Wrapping class for reconstruction. Allows to produce reconstruction from 
24 //  different steps: from previously produced hits,sdigits, etc. Each new reconstruction
25 //  flow (e.g. digits, made from them RecPoints, subsequently made TrackSegments, 
26 //  subsequently made RecParticles) are distinguished by the title of created branches. One can 
27 //  use this title as a comment, see use case below. 
28 //  Thanks to getters, one can set 
29 //  parameters to reconstruction briks. The full set of parameters is saved in the 
30 //  corresponding branch: e.g. parameters of clusterizer are stored in branch 
31 //  TreeR::AliPHOSClusterizer with the same title as the branch containing the RecPoints. //  TTree does not support overwriting, therefore one can not produce several 
32 //  branches with the same names and titles - use different titles.
33 //
34 //  Use case: 
35 //
36 //  root [0] AliPHOSReconstructioner * r = new AliPHOSReconstructioner("galice.root")
37 //              //  Set the header file
38 //  root [1] r->ExecuteTask() 
39 //              //  Make full chain of reconstruction
40 //
41 //              // One can specify the title for each branch 
42 //  root [2] r->SetBranchFileName("RecPoints","RecPoints1") ;
43 //      
44 //             // One can change parameters of reconstruction algorithms
45 //  root [3] r->GetClusterizer()->SetEmcLocalMaxCut(0.02)
46 //
47 //             // One can specify the starting point of the reconstruction and title of all 
48 //             // branches produced in this pass
49 //  root [4] r->StartFrom("AliPHOSClusterizer","Local max cut 0.02") 
50 //             // means that will use already generated Digits and produce only RecPoints, 
51 //             // TS and RecParticles 
52 //
53 //             // And finally one can call ExecuteTask() with the following options
54 //  root [5] r->ExecuteTask("debug all timing")
55 //             // deb     - prints the numbers of produced SDigits, Digits etc.
56 //             // deb all - prints in addition list of made SDigits, digits etc.
57 //             // timing  - prints benchmarking results
58 ///////////////////////////////////////////////////////////////////////////////////////////////////
59
60 // --- ROOT system ---
61
62 #include "TClonesArray.h"
63 #include "TROOT.h"
64 #include "TTree.h"
65 #include "TFile.h"
66
67 // --- Standard library ---
68
69 // --- AliRoot header files ---
70 #include "AliRun.h"
71 #include "AliRunLoader.h"
72 #include "AliPHOSReconstructioner.h"
73 #include "AliPHOSClusterizerv1.h"
74 #include "AliPHOSDigitizer.h"
75 #include "AliPHOSSDigitizer.h"
76 #include "AliPHOSTrackSegmentMakerv1.h"
77 #include "AliPHOSPIDv1.h"
78 #include "AliPHOSFastRecParticle.h"
79 #include "AliPHOSCpvRecPoint.h"
80 #include "AliPHOSLoader.h"
81
82 ClassImp(AliPHOSReconstructioner)
83
84 //____________________________________________________________________________
85   AliPHOSReconstructioner::AliPHOSReconstructioner():TTask("AliPHOSReconstructioner","")
86 {
87   // ctor
88   fDigitizer   = 0 ;
89   fClusterizer = 0 ;
90   fTSMaker     = 0 ;
91   fPID         = 0 ; 
92   fSDigitizer  = 0 ;
93
94   fIsInitialized = kFALSE ;
95
96
97
98 //____________________________________________________________________________
99 AliPHOSReconstructioner::AliPHOSReconstructioner(const char* evFoldName,const char * branchName):
100 TTask("AliPHOSReconstructioner",evFoldName)
101 {
102   // ctor
103   AliRunLoader* rl = AliRunLoader::GetRunLoader(evFoldName);
104   if (rl == 0x0)
105    {
106      Fatal("AliPHOSReconstructioner","Can not get Run Loader from folder %s.",evFoldName);
107    } 
108   if (rl->GetAliRun() == 0x0)
109    {
110      delete gAlice;
111      gAlice = 0x0;
112      rl->LoadgAlice();
113      gAlice = rl->GetAliRun();
114    }
115
116   AliPHOSLoader* gime = dynamic_cast<AliPHOSLoader*>(rl->GetLoader("PHOSLoader"));
117   if (gime == 0x0)
118    {
119      Error("AliPHOSReconstructioner","Can not get PHOS Loader");
120      return;  
121    }
122   
123   TString galicefn = rl->GetFileName();
124   TString method("AliPHOSReconstructioner::AliPHOSReconstructioner(");
125   method = (((method + evFoldName)+",")+branchName)+"): ";
126   
127   fSDigitsBranch= branchName; 
128   
129   //P.Skowronski remark
130   // Tasks has default fixed names
131   // other tasks can be added, even runtime
132   // with arbitrary name. See AliDataLoader::
133   cout<<"\n\n\n";
134   cout<<method<<"\n\nCreating SDigitizer\n";
135   fSDigitizer  = new AliPHOSSDigitizer(galicefn,GetTitle());
136   Add(fSDigitizer);
137   gime->PostSDigitizer(fSDigitizer);
138
139   fDigitsBranch=branchName ;
140   cout<<"\n\n\n";
141   cout<<method<<"\n\nCreating Digitizer\n";
142   fDigitizer   = new AliPHOSDigitizer(galicefn,GetTitle()) ;
143   Add(fDigitizer) ;
144   gime->PostDigitizer(fDigitizer);
145
146   fRecPointBranch=branchName ; 
147   cout<<"\n\n\n";
148   cout<<method<<"Creating Clusterizer\n";
149   fClusterizer = new AliPHOSClusterizerv1(galicefn,GetTitle());
150   Add(fClusterizer);
151   gime->PostReconstructioner(fClusterizer);
152   
153   fTSBranch=branchName ; 
154   fTSMaker     = new AliPHOSTrackSegmentMakerv1(galicefn,GetTitle());
155   Add(fTSMaker) ;
156   gime->PostTracker(fTSMaker);
157
158   
159   fRecPartBranch=branchName ; 
160   cout<<"\n\n\n";
161   cout<<method<<"Creating PID\n";
162   fPID         = new AliPHOSPIDv1(galicefn,GetTitle());
163   Add(fPID);
164   cout<<"\nFINISHED \n\n"<<method;
165   
166   fIsInitialized = kTRUE ;
167
168 //____________________________________________________________________________
169 void AliPHOSReconstructioner::Exec(Option_t)
170 {
171   //check, if the names of branches, which should be made conicide with already
172   //existing
173   if(!fIsInitialized)
174     Init() ;
175 }
176 //____________________________________________________________________________
177  void AliPHOSReconstructioner::Init()
178 {
179   // initiliaze Reconstructioner if necessary: we can not do this in default constructor
180
181   if(!fIsInitialized){
182     // Initialisation
183
184     fSDigitsBranch="Default" ; 
185     fSDigitizer  = new AliPHOSSDigitizer(GetTitle(),fSDigitsBranch.Data()) ; 
186     Add(fSDigitizer) ;
187
188     fDigitsBranch="Default" ; 
189     fDigitizer   = new AliPHOSDigitizer(GetTitle(),fDigitsBranch.Data());
190     Add(fDigitizer) ;
191
192     fRecPointBranch="Default" ; 
193     fClusterizer = new AliPHOSClusterizerv1(GetTitle(),fRecPointBranch.Data());
194     Add(fClusterizer) ;
195
196     fTSBranch="Default" ; 
197     fTSMaker     = new AliPHOSTrackSegmentMakerv1(GetTitle(),fTSBranch.Data());
198     Add(fTSMaker) ;
199
200
201     fRecPartBranch="Default"; 
202     fPID         = new AliPHOSPIDv1(GetTitle(),fRecPartBranch.Data()) ;
203     Add(fPID) ;
204     
205     fIsInitialized = kTRUE ;
206     
207   }
208
209 //____________________________________________________________________________
210 AliPHOSReconstructioner::~AliPHOSReconstructioner()
211 {
212   // Delete data members if any
213
214
215 void AliPHOSReconstructioner::Print()const {
216   // Print reconstructioner data  
217
218   TString message ; 
219   message  = "-----------------AliPHOSReconstructioner---------------\n" ;
220   message += " Reconstruction of the header file %s\n" ;
221   message += " with the following modules:\n" ;
222
223   if(fSDigitizer->IsActive()){
224     message += "   (+)   %s to branch %s\n" ; 
225   }
226   if(fDigitizer->IsActive()){
227     message += "   (+)   %s to branch %s\n" ; 
228   }
229   
230   if(fClusterizer->IsActive()){
231     message += "   (+)   %s to branch %s\n" ;
232   }
233
234   if(fTSMaker->IsActive()){
235     message += "   (+)   %s to branch %s\n" ; 
236   }
237
238   if(fPID->IsActive()){
239     message += "   (+)   %s to branch %s\n" ;  
240   }
241   Info("Print", message.Data(), 
242        GetTitle(), 
243        fSDigitizer->GetName(), fSDigitsBranch.Data(), 
244        fDigitizer->GetName(), fDigitsBranch.Data() , 
245        fClusterizer->GetName(), fRecPointBranch.Data(), 
246        fTSMaker->GetName(), fTSBranch.Data() , 
247        fPID->GetName(), fRecPartBranch.Data() ) ; 
248 }