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 **************************************************************************/
17 /////////////////////////////////////////////////////////////////////////
19 // Class for ITS RecPoint reconstruction //
21 ////////////////////////////////////////////////////////////////////////
25 #include "AliRunLoader.h"
26 #include "AliITSDetTypeRec.h"
27 #include "AliITSLoader.h"
28 #include "AliITSreconstruction.h"
29 #include "AliITSgeom.h"
32 ClassImp(AliITSreconstruction)
34 //______________________________________________________________________
35 AliITSreconstruction::AliITSreconstruction():
45 // Default constructor.
51 // A zero-ed constructed AliITSreconstruction class.
52 fDet[0] = fDet[1] = fDet[2] = kTRUE;
54 //______________________________________________________________________
56 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
66 fDet[0] = fDet[1] = fDet[2] = kTRUE;
68 //______________________________________________________________________
69 AliITSreconstruction::AliITSreconstruction(const char* filename):
79 // Standard constructor.
81 // const char* filename filename containing the digits to be
82 // reconstructed. If filename = 0 (nil)
83 // then no file is opened but a file is
84 // assumed to already be opened. This
85 // already opened file will be used.
89 // A standardly constructed AliITSreconstruction class.
91 fDet[0] = fDet[1] = fDet[2] = kTRUE;
93 fRunLoader = AliRunLoader::Open(filename);
94 if (fRunLoader == 0x0)
96 Error("AliITSreconstruction","Can not load the session %s \n",filename);
103 //______________________________________________________________________
104 AliITSreconstruction::~AliITSreconstruction(){
105 // A destroyed AliITSreconstruction class.
111 //______________________________________________________________________
112 Bool_t AliITSreconstruction::Init(){
119 // kTRUE if no errors initilizing this class occurse else kFALSE
120 Info("Init"," Init ITS reconstruction");
121 if (fRunLoader == 0x0)
123 Error("Init","Run Loader is NULL");
126 // fRunLoader->LoadgAlice();
127 // fRunLoader->LoadHeader();
129 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
131 Error("Init","ITS loader not found");
135 // Now ready to init.
137 //fRunLoader->CdGAFile();
138 fITSgeom = fLoader->GetITSgeom();
140 fDetTypeRec = new AliITSDetTypeRec();
141 fDetTypeRec->SetITSgeom(fITSgeom);
142 fDetTypeRec->SetDefaults();
143 fDet[0] = fDet[1] = fDet[2] = kTRUE;
146 fEnt = Int_t(fRunLoader->GetNumberOfEvents());
148 fLoader->LoadDigits("read");
149 fLoader->LoadRecPoints("recreate");
150 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
152 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
153 fDetTypeRec->MakeBranchR(fLoader->TreeR());
154 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
158 Info("Init"," Done\n\n\n");
162 //______________________________________________________________________
163 Bool_t AliITSreconstruction::InitRec(){
164 // Sets up Reconstruction part of AliITSDetType..
173 fDetTypeRec->SetDefaultClusterFindersV2();
174 Info("InitRec"," Done\n");
177 //______________________________________________________________________
178 void AliITSreconstruction::Exec(const Option_t *opt){
179 // Main reconstruction function.
181 // Option_t * opt list of subdetector to digitize. =0 all.
188 Bool_t condition =kFALSE;
190 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
196 fDet[0] = fDet[1] = fDet[2] = kTRUE;
199 fDet[0] = fDet[1] = fDet[2] = kFALSE;
200 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
201 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
202 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
203 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
205 } // end if strstr(opt,...)
208 cout << "Initilization Failed, Can't run Exec." << endl;
211 for(evnt=0;evnt<fEnt;evnt++)
214 Info("Exec","Processing Event %d",evnt);
217 fRunLoader->GetEvent(evnt);
218 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
219 fDetTypeRec->MakeBranchR(0);
220 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
221 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
222 fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt);
225 //______________________________________________________________________
226 void AliITSreconstruction::SetOutputFile(TString filename){
227 // Set a new file name for recpoints.
228 // It must be called before Init()
229 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
231 Info("SetOutputFile","name for rec points is %s",filename.Data());
232 fLoader->SetRecPointsFileName(filename);
235 Error("SetOutputFile",
236 "ITS loader not available. Not possible to set name: %s",filename.Data());