]>
Commit | Line | Data |
---|---|---|
29998a6e | 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 | ||
451f5018 | 16 | /* $Id: AliITSULoader.cxx $ */ |
29998a6e | 17 | |
18 | #include <TClonesArray.h> | |
19 | #include <TClass.h> | |
20 | #include <TGeoManager.h> | |
21 | #include <TTree.h> | |
22 | ||
23 | #include "AliITSdigit.h" | |
451f5018 | 24 | #include "AliITSULoader.h" |
29998a6e | 25 | #include "AliRunLoader.h" |
26 | #include "AliObjectLoader.h" | |
29998a6e | 27 | #include "AliLog.h" |
28 | ||
29 | /////////////////////////////////////////////////////////////////////////// | |
30 | // Loader for ITS Upgrade | |
31 | // it manages the I/O for: | |
32 | // raw clusters, primary vertices | |
33 | // V0 and cascade | |
34 | // and tracks propagated to the origin | |
35 | ////////////////////////////////////////////////////////////////////////// | |
451f5018 | 36 | ClassImp(AliITSULoader) |
29998a6e | 37 | |
38 | /**********************************************************************/ | |
451f5018 | 39 | AliITSULoader::AliITSULoader() |
40 | :AliLoader() | |
41 | { | |
29998a6e | 42 | // Default constructor |
43 | } | |
451f5018 | 44 | |
29998a6e | 45 | /*********************************************************************/ |
451f5018 | 46 | AliITSULoader::AliITSULoader(const Char_t *name,const Char_t *topfoldername) |
47 | : AliLoader(name,topfoldername) | |
48 | { | |
29998a6e | 49 | //Constructor |
28798685 | 50 | TString rawContainerName = "TreeC"; |
29998a6e | 51 | AliDataLoader* rawClustersDataLoader = new AliDataLoader( |
28798685 | 52 | fDetectorName + ".RawCl.root",rawContainerName, |
29998a6e | 53 | "Raw Clusters"); |
54 | fDataLoaders->Add(rawClustersDataLoader); | |
55 | rawClustersDataLoader->SetEventFolder(fEventFolder); | |
56 | rawClustersDataLoader->SetFolder(GetDetectorDataFolder()); | |
57 | ||
28798685 | 58 | TString backTracksContainerName= "TreeB"; |
29998a6e | 59 | AliDataLoader* backTracksDataLoader = new AliDataLoader( |
28798685 | 60 | fDetectorName + ".BackTracks.root",backTracksContainerName, |
29998a6e | 61 | "Back Propagated Tracks"); |
62 | fDataLoaders->Add(backTracksDataLoader); | |
63 | backTracksDataLoader->SetEventFolder(fEventFolder); | |
64 | backTracksDataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 65 | TString verticesContainerName="Vertex"; |
29998a6e | 66 | AliDataLoader* vertexDataLoader = new AliDataLoader( |
28798685 | 67 | fDetectorName + ".Vertex.root",verticesContainerName, |
29998a6e | 68 | "Primary Vertices","O"); |
69 | fDataLoaders->Add(vertexDataLoader); | |
70 | vertexDataLoader->SetEventFolder(fEventFolder); | |
71 | vertexDataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 72 | TString v0ContainerName="V0"; |
29998a6e | 73 | AliDataLoader* v0DataLoader = new AliDataLoader( |
28798685 | 74 | fDetectorName + ".V0s.root",v0ContainerName,"V0 Vertices"); |
29998a6e | 75 | fDataLoaders->Add(v0DataLoader); |
76 | v0DataLoader->SetEventFolder(fEventFolder); | |
77 | v0DataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 78 | TString cascadeContainerName="Cascade"; |
29998a6e | 79 | AliDataLoader* cascadeDataLoader = new AliDataLoader( |
28798685 | 80 | fDetectorName + ".Cascades.root",cascadeContainerName, |
29998a6e | 81 | "Cascades"); |
82 | fDataLoaders->Add(cascadeDataLoader); | |
83 | cascadeDataLoader->SetEventFolder(fEventFolder); | |
84 | cascadeDataLoader->SetFolder(GetDetectorDataFolder()); | |
85 | } | |
86 | /**********************************************************************/ | |
451f5018 | 87 | AliITSULoader::AliITSULoader(const Char_t *name,TFolder *topfolder) |
88 | : AliLoader(name,topfolder) | |
89 | { | |
29998a6e | 90 | //ctor |
28798685 | 91 | TString rawContainerName="TreeC"; |
29998a6e | 92 | AliDataLoader* rawClustersDataLoader = new AliDataLoader( |
28798685 | 93 | fDetectorName + ".RawCl.root",rawContainerName, |
29998a6e | 94 | "Raw Clusters"); |
95 | fDataLoaders->Add(rawClustersDataLoader); | |
96 | rawClustersDataLoader->SetEventFolder(fEventFolder); | |
97 | rawClustersDataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 98 | TString backTracksContainerName="TreeB"; |
29998a6e | 99 | AliDataLoader* backTracksDataLoader = new AliDataLoader( |
28798685 | 100 | fDetectorName + ".BackTracks.root",backTracksContainerName, |
29998a6e | 101 | "Back Propagated Tracks"); |
102 | fDataLoaders->Add(backTracksDataLoader); | |
103 | backTracksDataLoader->SetEventFolder(fEventFolder); | |
104 | backTracksDataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 105 | TString verticesContainerName="Vertex"; |
29998a6e | 106 | AliDataLoader* vertexDataLoader = new AliDataLoader( |
28798685 | 107 | fDetectorName + ".Vertex.root",verticesContainerName, |
29998a6e | 108 | "Primary Vertices","O"); |
109 | fDataLoaders->Add(vertexDataLoader); | |
110 | vertexDataLoader->SetEventFolder(fEventFolder); | |
111 | vertexDataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 112 | TString v0ContainerName="V0"; |
29998a6e | 113 | AliDataLoader* v0DataLoader = new AliDataLoader( |
28798685 | 114 | fDetectorName + ".V0.root",v0ContainerName,"V0 Vertices"); |
29998a6e | 115 | fDataLoaders->Add(v0DataLoader); |
116 | v0DataLoader->SetEventFolder(fEventFolder); | |
117 | v0DataLoader->SetFolder(GetDetectorDataFolder()); | |
28798685 | 118 | TString cascadeContainerName="Cascade"; |
29998a6e | 119 | AliDataLoader* cascadeDataLoader = new AliDataLoader( |
28798685 | 120 | fDetectorName + ".Cascade.root",cascadeContainerName, |
29998a6e | 121 | "Cascades"); |
122 | fDataLoaders->Add(cascadeDataLoader); | |
123 | cascadeDataLoader->SetEventFolder(fEventFolder); | |
124 | cascadeDataLoader->SetFolder(GetDetectorDataFolder()); | |
125 | } | |
126 | ||
127 | ||
128 | /**********************************************************************/ | |
451f5018 | 129 | AliITSULoader::~AliITSULoader(){ |
29998a6e | 130 | //destructor |
29998a6e | 131 | UnloadRawClusters(); |
28798685 | 132 | AliDataLoader *dl = GetRawClLoader(); |
29998a6e | 133 | fDataLoaders->Remove(dl); |
134 | ||
135 | UnloadBackTracks(); | |
136 | dl = GetBackTracksDataLoader(); | |
137 | fDataLoaders->Remove(dl); | |
138 | ||
139 | UnloadVertices(); | |
140 | dl = GetVertexDataLoader(); | |
141 | fDataLoaders->Remove(dl); | |
142 | ||
143 | UnloadV0s(); | |
144 | dl = GetV0DataLoader(); | |
145 | fDataLoaders->Remove(dl); | |
146 | ||
147 | UnloadCascades(); | |
148 | dl = GetCascadeDataLoader(); | |
149 | fDataLoaders->Remove(dl); | |
150 | ||
29998a6e | 151 | } |
152 | /* | |
153 | //---------------------------------------------------------------------- | |
451f5018 | 154 | AliITS* AliITSULoader::GetITS(){ |
29998a6e | 155 | // Returns the pointer to the ITS, kept on the file. A short cut metthod |
156 | // Inputs: | |
157 | // none. | |
158 | // Outputs: | |
159 | // none. | |
160 | // Returns: | |
161 | // Returns a pointer to the ITS, if not found returns 0. | |
162 | AliITS *its; | |
163 | ||
164 | if(gAlice){ | |
165 | its = dynamic_cast<AliITS*> (gAlice->GetDetector( | |
166 | GetDetectorName().Data())); | |
167 | if(its) return its; | |
168 | } // end if gAlice | |
169 | AliRunLoader *rl=0; | |
170 | rl = GetRunLoader(); | |
171 | if(!rl) return 0; | |
172 | AliRun *ar=0; | |
173 | ar = rl->GetAliRun(); | |
174 | if(!ar) return 0; | |
175 | its = dynamic_cast<AliITS*> (ar->GetDetector(GetDetectorName().Data())); | |
176 | return its; | |
177 | } | |
178 | //---------------------------------------------------------------------- | |
451f5018 | 179 | void AliITSULoader::SetupDigits(AliITS *its){ |
29998a6e | 180 | // Sets up to store ITS Digits in side AliITS::fDtype TObjArray |
181 | // Inputs: | |
182 | // AliITS *its Pointer to the ITS | |
183 | // Outputs: | |
184 | // none. | |
185 | // Return: | |
186 | // none. | |
187 | ||
188 | its->SetTreeAddressD(TreeD()); | |
189 | } | |
190 | */ | |
191 | //---------------------------------------------------------------------- | |
451f5018 | 192 | void AliITSULoader::SetupDigits(TObjArray *digPerDet,Int_t n, |
29998a6e | 193 | const Char_t **digclass){ |
194 | // Sets up digPerDet to store ITS Digits. | |
195 | // Inputs: | |
196 | // TObjArray *digPerDet A pointer to a TObject Array size>=3. | |
197 | // Int_t n The size of the TObjArray and digclass array | |
198 | // Char_t **digclass Array of digit class names | |
199 | // Outputs: | |
200 | // TObjArray *digPerDet Setup and linked to the tree of digits | |
201 | // Return: | |
202 | // none. | |
203 | Int_t i,m; | |
204 | TClonesArray *cl = 0; | |
205 | TTree *td = 0; | |
206 | TBranch *br = 0; | |
207 | Char_t branch[14]; | |
208 | const Char_t *det[3] = {"SPD","SDD","SSD"}; | |
209 | ||
210 | if(!digPerDet){ | |
211 | Error("SetUpDigits","TObject Array digPerDet does not exist"); | |
212 | return; | |
213 | } // end if | |
214 | m = digPerDet->GetSize(); | |
215 | if(m<n){ | |
216 | Error("SetUpDigits","TObject Array digPerDet=%p must have a size" | |
217 | " at least that of n=%d",digPerDet,n); | |
218 | } // end if | |
219 | if(m<3){ | |
220 | Error("SetUpDigits","TObject Array digPerDet=%p must have a size >2", | |
221 | digPerDet); | |
222 | return; | |
223 | } // end if | |
224 | td = TreeD(); | |
225 | for(i=0;i<n;i++){ | |
226 | if(digPerDet->At(i)==0){ // set up TClones Array | |
227 | digPerDet->AddAt(new TClonesArray(digclass[i],1000),i); | |
228 | if(n==3) snprintf(branch,13,"ITSDigits%s",det[i]); | |
229 | else snprintf(branch,13,"ITSDigits%d",i+1); | |
230 | br = td->GetBranch(branch); | |
231 | br->SetAddress(&((*digPerDet)[i])); | |
232 | continue; // do next one. | |
233 | } // end if | |
234 | cl = dynamic_cast<TClonesArray*> (digPerDet->At(i)); | |
235 | if(!cl && digPerDet->At(i)!=0){ // not a TClonesArray | |
236 | Error("SetUpDigits","TObject Array digPerDet-At(%d)=%p must be " | |
237 | "zeroed or filled with TClonesArrays",i,digPerDet); | |
238 | return; | |
239 | } // end if | |
240 | if(!(cl->GetClass()->GetBaseClass(AliITSdigit::Class()))){ | |
241 | Error("SetUPDigits","TClones array at digPerDet[%d}=%p must be" | |
242 | "derived from AliITSdigit",i,digPerDet->At(i)); | |
243 | } // end if | |
244 | cl->Clear(); | |
245 | if(n==3) snprintf(branch,13,"ITSDigits%s",det[i]); | |
246 | else snprintf(branch,13,"ITSDigits%d",i+1); | |
247 | br = td->GetBranch(branch); | |
248 | br->SetAddress(&((*digPerDet)[i])); | |
249 | continue; | |
250 | } // end for i | |
251 | } | |
252 | //--------------------------------------------------------------------- | |
451f5018 | 253 | AliITSdigit * AliITSULoader::GetDigit(TObjArray *digPerDet,Int_t module, |
29998a6e | 254 | Int_t digit){ |
255 | // Gets the digit for for a specific detector type and module. | |
256 | // To be used in conjustion with Setupdigits(AliITS *its). | |
257 | // Inputs: | |
258 | // TObjArray *digPereDet Pointer to the Array of digits | |
259 | // Int_t module Module number | |
260 | // Int_t digit Digit number | |
261 | // Outputs: | |
262 | // none. | |
263 | // Return: | |
264 | // returns the pointer to the digit. if zero then last digit for that | |
265 | // module. | |
266 | ||
267 | if(digPerDet==0){ | |
268 | Error("GetDigit","digPerDet=%p, module=%d, digit=%d", | |
269 | digPerDet,module,digit); | |
270 | return 0; | |
271 | } // end if | |
272 | return 0; | |
273 | } | |
29998a6e | 274 | //---------------------------------------------------------------------- |
451f5018 | 275 | void AliITSULoader::MakeTree(Option_t *opt){ |
29998a6e | 276 | // invokes AliLoader::MakeTree + specific ITS tree(s) |
277 | // Valid options: H,S,D,R,T and C (C=raw clusters) | |
278 | AliLoader::MakeTree(opt); | |
279 | const char *oC = strstr(opt,"C"); | |
280 | if (oC) MakeRawClustersContainer(); | |
281 | ||
282 | const char *oB = strstr(opt,"B"); | |
283 | if (oB) MakeBackTracksContainer(); | |
284 | ||
285 | const char *oV0 = strstr(opt,"V0"); | |
286 | if (oV0) MakeV0Container(); | |
287 | ||
288 | const char *oX = strstr(opt,"X"); | |
289 | if (oX) MakeCascadeContainer(); | |
290 | } |