1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.3.6.2 2002/10/14 13:14:08 hristov
19 Updating VirtualMC to v3-09-02
21 Revision 1.6 2002/09/09 17:30:02 nilsen
22 Added new creator which passes a pointer to type AliRun. Can now use either
23 gAlice or a local instance of AliRun.
25 Revision 1.5 2002/05/13 14:27:57 hristov
26 TreeC created once per event (M.Masera)
28 Revision 1.4 2002/05/10 22:31:30 nilsen
29 Changes by Massimo Masera to allow Recpoints and Clusters to be written
32 Revision 1.3 2002/02/06 13:52:27 barbera
33 gAlice deletion corrected (from M. Masera)
35 Revision 1.2 2002/01/31 18:52:09 nilsen
36 Minor change to allow the use of files that are already open. grun.C macro
37 that also does ITS digitizationa and Reconstruction all in one go.
39 Revision 1.1 2002/01/30 22:20:22 nilsen
40 New TTask based method to do Digits To clusters. Works with files of multiple
41 events in the file. Macro added to show how to use. Also the changes made
42 in the nessesary complilation files.
47 #include <TSeqCollection.h>
49 #include <TClonesArray.h>
54 #include "AliITSDetType.h"
55 #include "AliITSreconstruction.h"
56 #include "AliITSsegmentationSPD.h"
57 #include "AliITSsegmentationSDD.h"
58 #include "AliITSsegmentationSSD.h"
59 #include "AliITSClusterFinderSPD.h"
60 #include "AliITSClusterFinderSDD.h"
61 #include "AliITSClusterFinderSSD.h"
62 #include "AliITSresponseSDD.h"
63 #include "AliITSgeom.h"
65 ClassImp(AliITSreconstruction)
67 //______________________________________________________________________
68 AliITSreconstruction::AliITSreconstruction(){
69 // Default constructor.
75 // A zero-ed constructed AliITSreconstruction class.
81 fDet[0] = fDet[1] = fDet[2] = kTRUE;
86 //______________________________________________________________________
87 AliITSreconstruction::AliITSreconstruction(AliRun *ar){
88 // Standard constructor.
90 // AliRun *ar Pointer to an existing AliRun object. Assumed that
91 // this AliRun object will not be deleted by this distructor.
95 // A standardly constructed AliITSreconstruction class.
101 fDet[0] = fDet[1] = fDet[2] = kTRUE;
106 //______________________________________________________________________
107 AliITSreconstruction::AliITSreconstruction(const char* filename){
108 // Standard constructor.
110 // const char* filename filename containing the digits to be
111 // reconstructed. If filename = 0 (nil)
112 // then no file is opened but a file is
113 // assumed to already be opened. This
114 // already opened file will be used.
118 // A standardly constructed AliITSreconstruction class.
120 fFilename = filename;
126 fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data());
127 if(fFile) fFile->Close();
128 fFile = new TFile(fFilename.Data(),"UPDATE");
133 fArp = (AliRun*)fFile->Get("gAlice");
135 cout << "gAlice not found on file. Aborting." << endl;
139 } // end if !filename.
141 //______________________________________________________________________
142 AliITSreconstruction::~AliITSreconstruction(){
143 // Default constructor.
149 // A destroyed AliITSreconstruction class.
151 if(fFile) fFile->Close();
155 if(fArp) delete fArp;
158 //______________________________________________________________________
159 Bool_t AliITSreconstruction::Init(){
166 // kTRUE if no errors initilizing this class occurse else kFALSE
168 fITS = (AliITS*) fArp->GetDetector("ITS");
170 cout << "ITS not found aborting. fITS=" << fITS << endl;
174 if(!(fITS->GetITSgeom())){
175 cout << "ITSgeom not found aborting."<< endl;
178 } // end if !GetITSgeom()
179 // Now ready to init.
181 fDet[0] = fDet[1] = fDet[2] = kTRUE;
183 fEnt = fArp->GetEventsPerRun();
185 nparticles = fArp->GetEvent(fEnt0);
191 //______________________________________________________________________
192 Bool_t AliITSreconstruction::InitRec(){
193 // Sets up Reconstruction part of AliITSDetType..
204 idt = fITS->DetType(kSPD);
205 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)
206 idt->GetSegmentationModel();
207 TClonesArray *digSPD = fITS->DigitsAddress(kSPD);
208 TClonesArray *recpSPD = fITS->ClustersAddress(kSPD);
209 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,
212 fITS->SetReconstructionModel(kSPD,recSPD);
213 } // end if fDet[kSPD].
216 idt = fITS->DetType(kSDD);
217 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
218 idt->GetSegmentationModel();
219 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
220 idt->GetResponseModel();
221 TClonesArray *digSDD = fITS->DigitsAddress(kSDD);
222 TClonesArray *recpSDD = fITS->ClustersAddress(kSDD);
223 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
226 fITS->SetReconstructionModel(kSDD,recSDD);
227 } // end if fDet[kSDD]
230 idt = fITS->DetType(kSSD);
231 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
232 idt->GetSegmentationModel();
233 TClonesArray *digSSD = fITS->DigitsAddress(kSSD);
234 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
236 fITS->SetReconstructionModel(kSSD,recSSD);
237 } // end if fDet[kSSD]
241 //______________________________________________________________________
242 void AliITSreconstruction::Exec(const Option_t *opt){
243 // Main reconstruction function.
245 // Option_t * opt list of subdetector to digitize. =0 all.
251 Int_t nparticles,evnt;
253 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
254 fDet[0] = fDet[1] = fDet[2] = kTRUE;
257 fDet[0] = fDet[1] = fDet[2] = kFALSE;
258 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
259 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
260 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
261 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
263 } // end if strstr(opt,...)
266 cout << "Initilization Failed, Can't run Exec." << endl;
269 TDirectory *curr = gDirectory;
270 if(fFile2)fFile2->cd();
271 for(evnt=0;evnt<fEnt;evnt++){
272 nparticles = fArp->GetEvent(evnt);
273 fArp->SetEvent(evnt);
276 fArp->MakeTree("R",fFile2);
282 fITS->MakeBranch("R");
284 fITS->DigitsToRecPoints(evnt,0,lopt);
288 //______________________________________________________________________
289 void AliITSreconstruction::SetOutputFile(TString filename){
290 // Set a file name for recpoints. Used only if this file is not the file
291 // containing digits. This obj is deleted by AliRun.
292 fFile2 = fArp->InitTreeFile("R",filename);