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",filename);
99 fRunLoader->LoadgAlice();
100 gAlice = fRunLoader->GetAliRun();
103 Error("AliITSreconstruction","gAlice not found on file. Aborting.");
110 //______________________________________________________________________
111 AliITSreconstruction::AliITSreconstruction(const AliITSreconstruction &rec):TTask(rec),
115 fDetTypeRec(rec.fDetTypeRec),
117 fITSgeom(rec.fITSgeom),
118 fLoader(rec.fLoader),
119 fRunLoader(rec.fRunLoader)
126 //______________________________________________________________________
127 AliITSreconstruction& AliITSreconstruction::operator=(const AliITSreconstruction& source){
128 // Assignment operator.
129 this->~AliITSreconstruction();
130 new(this) AliITSreconstruction(source);
135 //______________________________________________________________________
136 AliITSreconstruction::~AliITSreconstruction(){
137 // A destroyed AliITSreconstruction class.
143 //______________________________________________________________________
144 Bool_t AliITSreconstruction::Init(){
151 // kTRUE if no errors initilizing this class occurse else kFALSE
153 if (fRunLoader == 0x0)
155 Error("Init","Run Loader is NULL");
158 fRunLoader->LoadgAlice();
159 fRunLoader->LoadHeader();
161 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
163 Error("Init","ITS loader not found");
167 // Now ready to init.
169 fRunLoader->CdGAFile();
170 fITSgeom = fLoader->GetITSgeom();
172 fDetTypeRec = new AliITSDetTypeRec(fLoader);
173 fDetTypeRec->SetDefaults();
174 fDet[0] = fDet[1] = fDet[2] = kTRUE;
177 //fEnt = gAlice->GetEventsPerRun();
178 fEnt = Int_t(fRunLoader->TreeE()->GetEntries());
180 fLoader->LoadDigits("read");
181 fLoader->LoadRecPoints("recreate");
182 fLoader->LoadRawClusters("recreate");
183 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
184 if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C");
186 fDetTypeRec->MakeBranchR(0);
187 fDetTypeRec->MakeBranchC();
188 fDetTypeRec->SetTreeAddress();
189 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
193 Info("Init"," Done\n\n\n");
197 //______________________________________________________________________
198 Bool_t AliITSreconstruction::InitRec(){
199 // Sets up Reconstruction part of AliITSDetType..
207 //AliITSDetType *idt;
208 fDetTypeRec->SetLoader(fLoader);
211 Info("InitRec","SPD");
212 //idt = fITS->DetType(kSPD);
213 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0);
214 TClonesArray *digSPD = fDetTypeRec->DigitsAddress(kSPD);
215 TClonesArray *recpSPD = fDetTypeRec->ClustersAddress(kSPD);
216 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",fDetTypeRec,digSPD,recpSPD);
217 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
218 fDetTypeRec->SetReconstructionModel(kSPD,recSPD);
219 } // end if fDet[kSPD].
222 Info("InitRec","SDD");
223 // idt = fITS->DetType(kSDD);
224 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
225 fDetTypeRec->GetSegmentationModel(1);
226 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
227 fDetTypeRec->GetCalibrationModel(fDetTypeRec->GetITSgeom()->GetStartSDD());
228 TClonesArray *digSDD = fDetTypeRec->DigitsAddress(kSDD);
229 TClonesArray *recpSDD = fDetTypeRec->ClustersAddress(kSDD);
230 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
233 fDetTypeRec->SetReconstructionModel(kSDD,recSDD);
234 } // end if fDet[kSDD]
237 Info("InitRec","SSD");
238 //idt = fITS->DetType(kSSD);
239 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
240 fDetTypeRec->GetSegmentationModel(2);
241 TClonesArray *digSSD = fDetTypeRec->DigitsAddress(kSSD);
242 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
244 recSSD->SetITSgeom(fDetTypeRec->GetITSgeom());
245 fDetTypeRec->SetReconstructionModel(kSSD,recSSD);
246 } // end if fDet[kSSD]
248 fDetTypeRec->SetDefaultClusterFinders();
249 Info("InitRec"," Done\n");
252 //______________________________________________________________________
253 void AliITSreconstruction::Exec(const Option_t *opt){
254 // Main reconstruction function.
256 // Option_t * opt list of subdetector to digitize. =0 all.
264 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
265 fDet[0] = fDet[1] = fDet[2] = kTRUE;
268 fDet[0] = fDet[1] = fDet[2] = kFALSE;
269 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
270 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
271 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
272 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
274 } // end if strstr(opt,...)
277 cout << "Initilization Failed, Can't run Exec." << endl;
280 for(evnt=0;evnt<fEnt;evnt++)
283 Info("Exec","Processing Event %d",evnt);
286 fRunLoader->GetEvent(evnt);
287 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
288 fDetTypeRec->MakeBranchR(0);
289 if (fLoader->TreeC() == 0x0){
290 fDetTypeRec->MakeTreeC();
291 fDetTypeRec->MakeBranchC();
293 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
294 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
295 fDetTypeRec->DigitsToRecPoints(evnt,0,lopt);
298 //______________________________________________________________________
299 void AliITSreconstruction::SetOutputFile(TString filename){
300 // Set a new file name for recpoints.
301 // It must be called before Init()
302 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
304 Info("SetOutputFile","name for rec points is %s",filename.Data());
305 fLoader->SetRecPointsFileName(filename);
308 Error("SetOutputFile",
309 "ITS loader not available. Not possible to set name: %s",filename.Data());