]>
Commit | Line | Data |
---|---|---|
1 | /************************************************************************** | |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | /* | |
17 | $Log$ | |
18 | */ | |
19 | #include <TROOT.h> | |
20 | #include <TFile.h> | |
21 | #include <TSeqCollection.h> | |
22 | #include <TString.h> | |
23 | #include <TClonesArray.h> | |
24 | ||
25 | #include "AliRun.h" | |
26 | ||
27 | #include "AliITS.h" | |
28 | #include "AliITSDetType.h" | |
29 | #include "AliITSreconstruction.h" | |
30 | #include "AliITSsegmentationSPD.h" | |
31 | #include "AliITSsegmentationSDD.h" | |
32 | #include "AliITSsegmentationSSD.h" | |
33 | #include "AliITSClusterFinderSPD.h" | |
34 | #include "AliITSClusterFinderSDD.h" | |
35 | #include "AliITSClusterFinderSSD.h" | |
36 | #include "AliITSresponseSDD.h" | |
37 | #include "AliITSgeom.h" | |
38 | ||
39 | ClassImp(AliITSreconstruction) | |
40 | ||
41 | //______________________________________________________________________ | |
42 | AliITSreconstruction::AliITSreconstruction(){ | |
43 | // Default constructor. | |
44 | // Inputs: | |
45 | // none. | |
46 | // Outputs: | |
47 | // none. | |
48 | // Return: | |
49 | // A zero-ed constructed AliITSreconstruction class. | |
50 | ||
51 | fFilename = ""; | |
52 | fFile = 0; | |
53 | fITS = 0; | |
54 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
55 | fInit = kFALSE; | |
56 | } | |
57 | //______________________________________________________________________ | |
58 | AliITSreconstruction::AliITSreconstruction(const char* filename){ | |
59 | // Standard constructor. | |
60 | // Inputs: | |
61 | // const char* filename filename containing the digits to be | |
62 | // reconstructed | |
63 | // Outputs: | |
64 | // none. | |
65 | // Return: | |
66 | // A standardly constructed AliITSreconstruction class. | |
67 | ||
68 | fFilename = filename; | |
69 | ||
70 | fFile = (TFile*)gROOT->GetListOfFiles()->FindObject(fFilename.Data()); | |
71 | if(fFile) fFile->Close(); | |
72 | fFile = new TFile(fFilename.Data(),"UPDATE"); | |
73 | // | |
74 | if(gAlice) delete gAlice; | |
75 | gAlice = (AliRun*)fFile->Get("gAlice"); | |
76 | if(!gAlice) { | |
77 | cout << "gAlice not found on file. Aborting." << endl; | |
78 | fInit = kFALSE; | |
79 | return; | |
80 | } // end if !gAlice | |
81 | ||
82 | Init(); | |
83 | } | |
84 | //______________________________________________________________________ | |
85 | AliITSreconstruction::~AliITSreconstruction(){ | |
86 | // Default constructor. | |
87 | // Inputs: | |
88 | // none. | |
89 | // Outputs: | |
90 | // none. | |
91 | // Return: | |
92 | // A destroyed AliITSreconstruction class. | |
93 | ||
94 | if(fFile) fFile->Close(); | |
95 | fFile = 0; | |
96 | fITS = 0; | |
97 | ||
98 | } | |
99 | //______________________________________________________________________ | |
100 | Bool_t AliITSreconstruction::Init(){ | |
101 | // Class Initilizer. | |
102 | // Inputs: | |
103 | // none. | |
104 | // Outputs: | |
105 | // none. | |
106 | // Return: | |
107 | // kTRUE if no errors initilizing this class occurse else kFALSE | |
108 | Int_t nparticles; | |
109 | ||
110 | fITS = (AliITS*) gAlice->GetDetector("ITS"); | |
111 | if(!fITS){ | |
112 | cout << "ITS not found aborting. fITS=" << fITS << endl; | |
113 | fInit = kFALSE; | |
114 | return fInit; | |
115 | } // end if !fITS | |
116 | if(!(fITS->GetITSgeom())){ | |
117 | cout << "ITSgeom not found aborting."<< endl; | |
118 | fInit = kFALSE; | |
119 | return fInit; | |
120 | } // end if !GetITSgeom() | |
121 | // Now ready to init. | |
122 | ||
123 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
124 | fEnt0 = 0; | |
125 | fEnt = gAlice->GetEventsPerRun(); | |
126 | fITS->MakeTreeC(); | |
127 | nparticles = gAlice->GetEvent(fEnt0); | |
128 | ||
129 | // finished init. | |
130 | fInit = InitRec(); | |
131 | return fInit; | |
132 | } | |
133 | //______________________________________________________________________ | |
134 | Bool_t AliITSreconstruction::InitRec(){ | |
135 | // Sets up Reconstruction part of AliITSDetType.. | |
136 | // Inputs: | |
137 | // none. | |
138 | // Outputs: | |
139 | // none. | |
140 | // Return: | |
141 | // none. | |
142 | AliITSDetType *idt; | |
143 | ||
144 | // SPD | |
145 | if(fDet[kSPD]){ | |
146 | idt = fITS->DetType(kSPD); | |
147 | AliITSsegmentationSPD *segSPD = (AliITSsegmentationSPD*) | |
148 | idt->GetSegmentationModel(); | |
149 | TClonesArray *digSPD = fITS->DigitsAddress(kSPD); | |
150 | TClonesArray *recpSPD = fITS->ClustersAddress(kSPD); | |
151 | AliITSClusterFinderSPD *recSPD = new AliITSClusterFinderSPD(segSPD, | |
152 | digSPD, | |
153 | recpSPD); | |
154 | fITS->SetReconstructionModel(kSPD,recSPD); | |
155 | } // end if fDet[kSPD]. | |
156 | // SDD | |
157 | if(fDet[kSDD]){ | |
158 | idt = fITS->DetType(kSDD); | |
159 | AliITSsegmentationSDD *segSDD = (AliITSsegmentationSDD*) | |
160 | idt->GetSegmentationModel(); | |
161 | AliITSresponseSDD *resSDD = (AliITSresponseSDD*) | |
162 | idt->GetResponseModel(); | |
163 | TClonesArray *digSDD = fITS->DigitsAddress(kSDD); | |
164 | TClonesArray *recpSDD = fITS->ClustersAddress(kSDD); | |
165 | AliITSClusterFinderSDD *recSDD =new AliITSClusterFinderSDD(segSDD, | |
166 | resSDD, | |
167 | digSDD,recpSDD); | |
168 | fITS->SetReconstructionModel(kSDD,recSDD); | |
169 | } // end if fDet[kSDD] | |
170 | // SSD | |
171 | if(fDet[kSSD]){ | |
172 | idt = fITS->DetType(kSSD); | |
173 | AliITSsegmentationSSD *segSSD = (AliITSsegmentationSSD*) | |
174 | idt->GetSegmentationModel(); | |
175 | TClonesArray *digSSD = fITS->DigitsAddress(kSSD); | |
176 | AliITSClusterFinderSSD *recSSD =new AliITSClusterFinderSSD(segSSD, | |
177 | digSSD); | |
178 | fITS->SetReconstructionModel(kSSD,recSSD); | |
179 | } // end if fDet[kSSD] | |
180 | ||
181 | return kTRUE; | |
182 | } | |
183 | //______________________________________________________________________ | |
184 | void AliITSreconstruction::Exec(const Option_t *opt){ | |
185 | // Main reconstruction function. | |
186 | // Inputs: | |
187 | // Option_t * opt list of subdetector to digitize. =0 all. | |
188 | // Outputs: | |
189 | // none. | |
190 | // Return: | |
191 | // none. | |
192 | Option_t *lopt; | |
193 | Int_t nparticles,evnt; | |
194 | ||
195 | if(strstr(opt,"All")||strstr(opt,"ALL")||strstr(opt,"ITS")||opt==0){ | |
196 | fDet[0] = fDet[1] = fDet[2] = kTRUE; | |
197 | lopt = "All"; | |
198 | }else{ | |
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"; | |
204 | else lopt = opt; | |
205 | } // end if strstr(opt,...) | |
206 | ||
207 | if(!fInit){ | |
208 | cout << "Initilization Failed, Can't run Exec." << endl; | |
209 | return; | |
210 | } // end if !fInit | |
211 | for(evnt=0;evnt<fEnt;evnt++){ | |
212 | nparticles = gAlice->GetEvent(evnt); | |
213 | gAlice->SetEvent(evnt); | |
214 | if(!gAlice->TreeR()) gAlice->MakeTree("R"); | |
215 | fITS->MakeBranch("R"); | |
216 | fITS->DigitsToRecPoints(evnt,0,lopt); | |
217 | } // end for evnt | |
218 | } |