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():
44 // Default constructor.
50 // A zero-ed constructed AliITSreconstruction class.
51 fDet[0] = fDet[1] = fDet[2] = kTRUE;
53 //______________________________________________________________________
55 AliITSreconstruction::AliITSreconstruction(AliRunLoader *rl):
64 fDet[0] = fDet[1] = fDet[2] = kTRUE;
66 //______________________________________________________________________
67 AliITSreconstruction::AliITSreconstruction(const char* filename):
76 // Standard constructor.
78 // const char* filename filename containing the digits to be
79 // reconstructed. If filename = 0 (nil)
80 // then no file is opened but a file is
81 // assumed to already be opened. This
82 // already opened file will be used.
86 // A standardly constructed AliITSreconstruction class.
88 fDet[0] = fDet[1] = fDet[2] = kTRUE;
90 fRunLoader = AliRunLoader::Open(filename);
91 if (fRunLoader == 0x0)
93 Error("AliITSreconstruction","Can not load the session",filename);
96 fRunLoader->LoadgAlice();
97 gAlice = fRunLoader->GetAliRun();
100 Error("AliITSreconstruction","gAlice not found on file. Aborting.");
106 //______________________________________________________________________
107 AliITSreconstruction::AliITSreconstruction(const AliITSreconstruction &/*rec*/):TTask(/*rec*/){
110 Error("Copy constructor","Copy constructor not allowed");
113 //______________________________________________________________________
114 AliITSreconstruction& AliITSreconstruction::operator=(const AliITSreconstruction& /*source*/){
115 // Assignment operator. This is a function which is not allowed to be
117 Error("operator=","Assignment operator not allowed\n");
121 //______________________________________________________________________
122 AliITSreconstruction::~AliITSreconstruction(){
123 // A destroyed AliITSreconstruction class.
129 //______________________________________________________________________
130 Bool_t AliITSreconstruction::Init(){
137 // kTRUE if no errors initilizing this class occurse else kFALSE
139 if (fRunLoader == 0x0)
141 Error("Init","Run Loader is NULL");
144 fRunLoader->LoadgAlice();
145 fRunLoader->LoadHeader();
147 fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
149 Error("Init","ITS loader not found");
153 // Now ready to init.
155 fRunLoader->CdGAFile();
156 fITSgeom = (AliITSgeom*)gDirectory->Get("AliITSgeom");
158 fDetTypeRec = new AliITSDetTypeRec(fLoader);
159 fDetTypeRec->SetDefaults();
160 fDet[0] = fDet[1] = fDet[2] = kTRUE;
163 //fEnt = gAlice->GetEventsPerRun();
164 fEnt = Int_t(fRunLoader->TreeE()->GetEntries());
166 fLoader->LoadDigits("read");
167 fLoader->LoadRecPoints("recreate");
168 fLoader->LoadRawClusters("recreate");
169 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
170 if (fLoader->TreeC() == 0x0) fLoader->MakeTree("C");
172 fDetTypeRec->MakeBranchR(0);
173 fDetTypeRec->MakeBranchC();
174 fDetTypeRec->SetTreeAddress();
175 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
179 Info("Init"," Done\n\n\n");
183 //______________________________________________________________________
184 Bool_t AliITSreconstruction::InitRec(){
185 // Sets up Reconstruction part of AliITSDetType..
193 //AliITSDetType *idt;
194 fDetTypeRec->SetLoader(fLoader);
197 Info("InitRec","SPD");
198 //idt = fITS->DetType(kSPD);
199 AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*)fDetTypeRec->GetSegmentationModel(0);
200 TClonesArray *digSPD = fDetTypeRec->DigitsAddress(kSPD);
201 TClonesArray *recpSPD = fDetTypeRec->ClustersAddress(kSPD);
202 Info("InitRec","idt = %#x; digSPD = %#x; recpSPD = %#x",fDetTypeRec,digSPD,recpSPD);
203 AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD,digSPD,recpSPD);
204 fDetTypeRec->SetReconstructionModel(kSPD,recSPD);
205 } // end if fDet[kSPD].
208 Info("InitRec","SDD");
209 // idt = fITS->DetType(kSDD);
210 AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*)
211 fDetTypeRec->GetSegmentationModel(1);
212 AliITSresponseSDD *resSDD = (AliITSresponseSDD*)
213 fDetTypeRec->GetCalibrationModel(fDetTypeRec->GetITSgeom()->GetStartSDD());
214 TClonesArray *digSDD = fDetTypeRec->DigitsAddress(kSDD);
215 TClonesArray *recpSDD = fDetTypeRec->ClustersAddress(kSDD);
216 AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD,
219 fDetTypeRec->SetReconstructionModel(kSDD,recSDD);
220 } // end if fDet[kSDD]
223 Info("InitRec","SSD");
224 //idt = fITS->DetType(kSSD);
225 AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*)
226 fDetTypeRec->GetSegmentationModel(2);
227 TClonesArray *digSSD = fDetTypeRec->DigitsAddress(kSSD);
228 AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD,
230 recSSD->SetITSgeom(fDetTypeRec->GetITSgeom());
231 fDetTypeRec->SetReconstructionModel(kSSD,recSSD);
232 } // end if fDet[kSSD]
234 fDetTypeRec->SetDefaultClusterFinders();
235 Info("InitRec"," Done\n");
238 //______________________________________________________________________
239 void AliITSreconstruction::Exec(const Option_t *opt){
240 // Main reconstruction function.
242 // Option_t * opt list of subdetector to digitize. =0 all.
250 if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){
251 fDet[0] = fDet[1] = fDet[2] = kTRUE;
254 fDet[0] = fDet[1] = fDet[2] = kFALSE;
255 if(strstr(opt,"SPD")) fDet[kSPD] = kTRUE;
256 if(strstr(opt,"SDD")) fDet[kSDD] = kTRUE;
257 if(strstr(opt,"SSD")) fDet[kSSD] = kTRUE;
258 if(fDet[kSPD] && fDet[kSDD] && fDet[kSSD]) lopt = "All";
260 } // end if strstr(opt,...)
263 cout << "Initilization Failed, Can't run Exec." << endl;
266 for(evnt=0;evnt<fEnt;evnt++)
269 Info("Exec","Processing Event %d",evnt);
272 fRunLoader->GetEvent(evnt);
273 if (fLoader->TreeR() == 0x0) fLoader->MakeTree("R");
274 fDetTypeRec->MakeBranchR(0);
275 if (fLoader->TreeC() == 0x0){
276 fDetTypeRec->MakeTreeC();
277 fDetTypeRec->MakeBranchC();
279 fDetTypeRec->SetTreeAddressR(fLoader->TreeR());
280 fDetTypeRec->SetTreeAddressD(fLoader->TreeD());
281 fDetTypeRec->DigitsToRecPoints(evnt,0,lopt);
284 //______________________________________________________________________
285 void AliITSreconstruction::SetOutputFile(TString filename){
286 // Set a new file name for recpoints.
287 // It must be called before Init()
288 if(!fLoader)fLoader = (AliITSLoader*) fRunLoader->GetLoader("ITSLoader");
290 Info("SetOutputFile","name for rec points is %s",filename.Data());
291 fLoader->SetRecPointsFileName(filename);
294 Error("SetOutputFile",
295 "ITS loader not available. Not possible to set name: %s",filename.Data());