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"
33 ClassImp(AliITSreconstruction)
35 //______________________________________________________________________
36 AliITSreconstruction::AliITSreconstruction():
46 // Default constructor.
52 // A zero-ed constructed AliITSreconstruction class.
53 fDet[0] = fDet[1] = fDet[2] = kTRUE;
55 //______________________________________________________________________
57 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
67 fDet[0] = fDet[1] = fDet[2] = kTRUE;
69 //______________________________________________________________________
70 AliITSreconstruction::AliITSreconstruction(const char* filename):
80 // Standard constructor.
82 // const char* filename filename containing the digits to be
83 // reconstructed. If filename = 0 (nil)
84 // then no file is opened but a file is
85 // assumed to already be opened. This
86 // already opened file will be used.
90 // A standardly constructed AliITSreconstruction class.
92 fDet[0] = fDet[1] = fDet[2] = kTRUE;
94 fRunLoader = AliRunLoader::Open(filename);
95 if (fRunLoader == 0x0)
97 Error("AliITSreconstruction","Can not load the session %s \n",filename);
104 //______________________________________________________________________
105 AliITSreconstruction::~AliITSreconstruction(){
106 // A destroyed AliITSreconstruction class.
112 //______________________________________________________________________
113 Bool_t AliITSreconstruction::Init(){
120 // kTRUE if no errors initilizing this class occurse else kFALSE
121 Info("Init"," Init ITS reconstruction");
122 if (fRunLoader == 0x0)
124 Error("Init","Run Loader is NULL");
127 // fRunLoader->LoadgAlice();
128 // fRunLoader->LoadHeader();
130 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
132 Error("Init","ITS loader not found");
136 // Now ready to init.
138 //fRunLoader->CdGAFile();
139 fITSgeom = fLoader->GetITSgeom();
141 fDetTypeRec = new AliITSDetTypeRec();
142 fDetTypeRec->SetITSgeom(fITSgeom);
143 fDetTypeRec->SetDefaults();
144 fDet[0] = fDet[1] = fDet[2] = kTRUE;
147 fEnt = Int_t(fRunLoader->GetNumberOfEvents());
149 fLoader->LoadDigits("read");
150 fLoader->LoadRecPoints("recreate");
151 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
153 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
154 fDetTypeRec->MakeBranchR(fLoader->TreeR());
155 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
159 Info("Init"," Done\n\n\n");
163 //______________________________________________________________________
164 Bool_t AliITSreconstruction::InitRec(){
165 // Sets up Reconstruction part of AliITSDetType..
174 fDetTypeRec->SetDefaultClusterFindersV2();
175 Info("InitRec"," Done\n");
178 //______________________________________________________________________
179 void AliITSreconstruction::Exec(const Option_t *opt){
180 // Main reconstruction function.
182 // Option_t * opt list of subdetector to digitize. =0 all.
189 Bool_t condition =kFALSE;
191 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS"))condition =kTRUE;
197 fDet[0] = fDet[1] = fDet[2] = kTRUE;
200 fDet[0] = fDet[1] = fDet[2] = kFALSE;
201 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
202 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
203 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
204 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
206 } // end if strstr(opt,...)
209 cout << "Initilization Failed, Can't run Exec." << endl;
212 for(evnt=0;evnt<fEnt;evnt++)
215 Info("Exec","Processing Event %d",evnt);
218 fRunLoader->GetEvent(evnt);
219 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
220 fDetTypeRec->MakeBranchR(0);
221 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
222 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
223 fDetTypeRec->DigitsToRecPoints(fLoader->TreeD(),fLoader->TreeR(),0,lopt);
226 //______________________________________________________________________
227 void AliITSreconstruction::SetOutputFile(TString filename){
228 // Set a new file name for recpoints.
229 // It must be called before Init()
230 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
232 Info("SetOutputFile","name for rec points is %s",filename.Data());
233 fLoader->SetRecPointsFileName(filename);
236 Error("SetOutputFile",
237 "ITS loader not available. Not possible to set name: %s",filename.Data());