]>
Commit | Line | Data |
---|---|---|
3e87ef69 | 1 | // @(#) $Id$ |
31d9405a | 2 | |
02f030e3 | 3 | // Author: Uli Frankenfeld <mailto:franken@fi.uib.no>, Anders Vestbo <mailto:vestbo$fi.uib.no>, C. Loizides <mailto:loizides@ikf.uni-frankfurt.de> |
3e87ef69 | 4 | //*-- Copyright © ALICE HLT Group |
108615fc | 5 | |
4aa41877 | 6 | #include "AliHLTStandardIncludes.h" |
5e0f9911 | 7 | #include <TClonesArray.h> |
f6670bec | 8 | #include <TSystem.h> |
386b1330 | 9 | #include <TMath.h> |
5e0f9911 | 10 | |
b2a02bce | 11 | #ifdef use_newio |
12 | #include <AliRunLoader.h> | |
b2a02bce | 13 | #endif |
02f030e3 | 14 | #include <AliTPCParamSR.h> |
118c26c3 | 15 | #include <AliTPCDigitsArray.h> |
16 | #include <AliTPCClustersArray.h> | |
17 | #include <AliTPCcluster.h> | |
18 | #include <AliTPCClustersRow.h> | |
5e0f9911 | 19 | #include <AliSimDigits.h> |
108615fc | 20 | |
4aa41877 | 21 | #include "AliHLTLogging.h" |
22 | #include "AliHLTTransform.h" | |
23 | #include "AliHLTMemHandler.h" | |
24 | #include "AliHLTDigitData.h" | |
25 | #include "AliHLTTrackSegmentData.h" | |
26 | #include "AliHLTSpacePointData.h" | |
27 | #include "AliHLTTrackArray.h" | |
28 | #include "AliHLTFileHandler.h" | |
b661165c | 29 | |
5929c18d | 30 | #if __GNUC__ >= 3 |
3e87ef69 | 31 | using namespace std; |
32 | #endif | |
748e01f4 | 33 | |
4aa41877 | 34 | /** \class AliHLTFileHandler |
3e87ef69 | 35 | <pre> |
108615fc | 36 | //_____________________________________________________________ |
4aa41877 | 37 | // AliHLTFileHandler |
108615fc | 38 | // |
9183aa27 | 39 | // The HLT ROOT <-> binary files handling class |
108615fc | 40 | // |
9183aa27 | 41 | // This class provides the interface between AliROOT files, |
42 | // and HLT binary files. It should be used for converting | |
43 | // TPC data stored in AliROOT format (outputfile from a simulation), | |
44 | // into the data format currently used by in the HLT framework. | |
45 | // This enables the possibility to always use the same data format, | |
46 | // whether you are using a binary file as an input, or a AliROOT file. | |
47 | // | |
48 | // For example on how to create binary files from a AliROOT simulation, | |
49 | // see example macro exa/Binary.C. | |
50 | // | |
51 | // For reading a AliROOT file into HLT format in memory, do the following: | |
52 | // | |
4aa41877 | 53 | // AliHLTFileHandler file; |
2330399d | 54 | // file.Init(slice,patch); |
9183aa27 | 55 | // file.SetAliInput("galice.root"); |
4aa41877 | 56 | // AliHLTDigitRowData *dataPt = (AliHLTDigitRowData*)file.AliDigits2Memory(nrows,eventnr); |
9183aa27 | 57 | // |
58 | // All the data are then stored in memory and accessible via the pointer dataPt. | |
4aa41877 | 59 | // Accesing the data is then identical to the example 1) showed in AliHLTMemHandler class. |
9183aa27 | 60 | // |
61 | // For converting the data back, and writing it to a new AliROOT file do: | |
62 | // | |
4aa41877 | 63 | // AliHLTFileHandler file; |
2330399d | 64 | // file.Init(slice,patch); |
9183aa27 | 65 | // file.SetAliInput("galice.root"); |
66 | // file.Init(slice,patch,NumberOfRowsInPatch); | |
67 | // file.AliDigits2RootFile(dataPt,"new_galice.root"); | |
68 | // file.CloseAliInput(); | |
3e87ef69 | 69 | </pre> |
70 | */ | |
108615fc | 71 | |
4aa41877 | 72 | ClassImp(AliHLTFileHandler) |
108615fc | 73 | |
1f1942b8 | 74 | // of course on start up the index is not created |
4aa41877 | 75 | Bool_t AliHLTFileHandler::fgStaticIndexCreated=kFALSE; |
76 | Int_t AliHLTFileHandler::fgStaticIndex[36][159]; | |
1f1942b8 | 77 | |
4aa41877 | 78 | void AliHLTFileHandler::CleanStaticIndex() |
b1ed0288 | 79 | { |
80 | // use this static call to clean static index after | |
1f1942b8 | 81 | // running over one event |
4aa41877 | 82 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
83 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
b1ed0288 | 84 | fgStaticIndex[i][j]=-1; |
1f1942b8 | 85 | } |
b1ed0288 | 86 | fgStaticIndexCreated=kFALSE; |
1f1942b8 | 87 | } |
88 | ||
4aa41877 | 89 | Int_t AliHLTFileHandler::SaveStaticIndex(Char_t *prefix,Int_t event) |
b1ed0288 | 90 | { |
91 | // use this static call to store static index after | |
92 | if(!fgStaticIndexCreated) return -1; | |
1f1942b8 | 93 | |
94 | Char_t fname[1024]; | |
95 | if(prefix) | |
96 | sprintf(fname,"%s-%d.txt",prefix,event); | |
97 | else | |
98 | sprintf(fname,"TPC.Digits.staticindex-%d.txt",event); | |
99 | ||
100 | ofstream file(fname,ios::trunc); | |
101 | if(!file.good()) return -1; | |
102 | ||
4aa41877 | 103 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
104 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
b1ed0288 | 105 | file << fgStaticIndex[i][j] << " "; |
1f1942b8 | 106 | file << endl; |
107 | } | |
108 | file.close(); | |
109 | return 0; | |
110 | } | |
111 | ||
4aa41877 | 112 | Int_t AliHLTFileHandler::LoadStaticIndex(Char_t *prefix,Int_t event) |
b1ed0288 | 113 | { |
114 | // use this static call to store static index after | |
115 | if(fgStaticIndexCreated){ | |
4aa41877 | 116 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::LoadStaticIndex","Inxed") |
1f1942b8 | 117 | <<"Static index already created, will overwrite"<<ENDLOG; |
118 | CleanStaticIndex(); | |
119 | } | |
120 | ||
121 | Char_t fname[1024]; | |
122 | if(prefix) | |
123 | sprintf(fname,"%s-%d.txt",prefix,event); | |
124 | else | |
125 | sprintf(fname,"TPC.Digits.staticindex-%d.txt",event); | |
126 | ||
127 | ifstream file(fname); | |
128 | if(!file.good()) return -1; | |
129 | ||
4aa41877 | 130 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
131 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
b1ed0288 | 132 | file >> fgStaticIndex[i][j]; |
1f1942b8 | 133 | } |
134 | file.close(); | |
135 | ||
b1ed0288 | 136 | fgStaticIndexCreated=kTRUE; |
1f1942b8 | 137 | return 0; |
138 | } | |
139 | ||
4aa41877 | 140 | AliHLTFileHandler::AliHLTFileHandler(Bool_t b) |
9183aa27 | 141 | { |
108615fc | 142 | //Default constructor |
143 | fInAli = 0; | |
de3c3890 | 144 | #ifdef use_newio |
145 | fUseRunLoader = kFALSE; | |
146 | #endif | |
108615fc | 147 | fParam = 0; |
108615fc | 148 | fMC =0; |
a6e4f9d6 | 149 | fDigits=0; |
150 | fDigitsTree=0; | |
02f030e3 | 151 | fIndexCreated=kFALSE; |
1f1942b8 | 152 | fUseStaticIndex=b; |
153 | ||
4aa41877 | 154 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++) |
155 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
1f1942b8 | 156 | fIndex[i][j]=-1; |
157 | ||
b1ed0288 | 158 | if(fUseStaticIndex&&!fgStaticIndexCreated) CleanStaticIndex(); |
108615fc | 159 | } |
160 | ||
4aa41877 | 161 | AliHLTFileHandler::~AliHLTFileHandler() |
9183aa27 | 162 | { |
108615fc | 163 | //Destructor |
108615fc | 164 | if(fMC) CloseMCOutput(); |
a815f9dd | 165 | FreeDigitsTree(); |
8f1a9904 | 166 | if(fInAli) CloseAliInput(); |
108615fc | 167 | } |
168 | ||
4aa41877 | 169 | void AliHLTFileHandler::FreeDigitsTree() |
b1ed0288 | 170 | { |
171 | //free digits tree | |
a815f9dd | 172 | if(!fDigitsTree) |
173 | { | |
4aa41877 | 174 | LOG(AliHLTLog::kInformational,"AliHLTFileHandler::FreeDigitsTree()","Pointer") |
a815f9dd | 175 | <<"Cannot free digitstree, it is not present"<<ENDLOG; |
176 | return; | |
177 | } | |
a6c89175 | 178 | delete fDigits; |
a815f9dd | 179 | fDigits=0; |
b2a02bce | 180 | #ifndef use_newio |
a815f9dd | 181 | fDigitsTree->Delete(); |
b2a02bce | 182 | #endif |
a815f9dd | 183 | fDigitsTree=0; |
b2a02bce | 184 | |
4aa41877 | 185 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
186 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
02f030e3 | 187 | fIndex[i][j]=-1; |
188 | } | |
189 | fIndexCreated=kFALSE; | |
a815f9dd | 190 | } |
191 | ||
4aa41877 | 192 | Bool_t AliHLTFileHandler::SetMCOutput(Char_t *name) |
b1ed0288 | 193 | { |
194 | //set mc input | |
108615fc | 195 | fMC = fopen(name,"w"); |
196 | if(!fMC){ | |
4aa41877 | 197 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetMCOutput","File Open") |
9183aa27 | 198 | <<"Pointer to File = 0x0 "<<ENDLOG; |
108615fc | 199 | return kFALSE; |
200 | } | |
201 | return kTRUE; | |
202 | } | |
203 | ||
4aa41877 | 204 | Bool_t AliHLTFileHandler::SetMCOutput(FILE *file) |
b1ed0288 | 205 | { |
206 | //set mc output | |
108615fc | 207 | fMC = file; |
208 | if(!fMC){ | |
4aa41877 | 209 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetMCOutput","File Open") |
9183aa27 | 210 | <<"Pointer to File = 0x0 "<<ENDLOG; |
108615fc | 211 | return kFALSE; |
212 | } | |
213 | return kTRUE; | |
214 | } | |
215 | ||
4aa41877 | 216 | void AliHLTFileHandler::CloseMCOutput() |
b1ed0288 | 217 | { |
218 | //close mc output | |
108615fc | 219 | if(!fMC){ |
4aa41877 | 220 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::CloseMCOutPut","File Close") |
9183aa27 | 221 | <<"Nothing to Close"<<ENDLOG; |
108615fc | 222 | return; |
223 | } | |
224 | fclose(fMC); | |
225 | fMC =0; | |
226 | } | |
227 | ||
4aa41877 | 228 | Bool_t AliHLTFileHandler::SetAliInput() |
b1ed0288 | 229 | { |
230 | //set ali input | |
b2a02bce | 231 | #ifdef use_newio |
a27af97b | 232 | fInAli->CdGAFile(); |
9d0f29d2 | 233 | fParam = (AliTPCParam*)gFile->Get("75x40_100x60_150x60"); |
02f030e3 | 234 | if(!fParam){ |
4aa41877 | 235 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetAliInput","File") |
a27af97b | 236 | <<"No TPC parameters found in \""<<gFile->GetName() |
02f030e3 | 237 | <<"\", creating standard parameters " |
238 | <<"which might not be what you want!"<<ENDLOG; | |
239 | fParam = new AliTPCParamSR; | |
240 | } | |
108615fc | 241 | if(!fParam){ |
4aa41877 | 242 | LOG(AliHLTLog::kError,"AliHLTFileHandler::SetAliInput","File Open") |
243 | <<"No AliTPCParam "<<AliHLTTransform::GetParamName()<<" in File "<<gFile->GetName()<<ENDLOG; | |
9183aa27 | 244 | return kFALSE; |
108615fc | 245 | } |
b2a02bce | 246 | #else |
247 | if(!fInAli->IsOpen()){ | |
4aa41877 | 248 | LOG(AliHLTLog::kError,"AliHLTFileHandler::SetAliInput","File Open") |
b2a02bce | 249 | <<"Ali File "<<fInAli->GetName()<<" does not exist"<<ENDLOG; |
250 | return kFALSE; | |
251 | } | |
4aa41877 | 252 | fParam = (AliTPCParam*)fInAli->Get(AliHLTTransform::GetParamName()); |
b2a02bce | 253 | if(!fParam){ |
4aa41877 | 254 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetAliInput","File") |
b2a02bce | 255 | <<"No TPC parameters found in \""<<fInAli->GetName() |
256 | <<"\", creating standard parameters " | |
257 | <<"which might not be what you want!"<<ENDLOG; | |
258 | fParam = new AliTPCParamSR; | |
259 | } | |
260 | if(!fParam){ | |
4aa41877 | 261 | LOG(AliHLTLog::kError,"AliHLTFileHandler::SetAliInput","File Open") |
262 | <<"No AliTPCParam "<<AliHLTTransform::GetParamName()<<" in File "<<fInAli->GetName()<<ENDLOG; | |
b2a02bce | 263 | return kFALSE; |
264 | } | |
265 | #endif | |
266 | ||
108615fc | 267 | return kTRUE; |
268 | } | |
269 | ||
4aa41877 | 270 | Bool_t AliHLTFileHandler::SetAliInput(Char_t *name) |
b1ed0288 | 271 | { |
9183aa27 | 272 | //Open the AliROOT file with name. |
b2a02bce | 273 | #ifdef use_newio |
a27af97b | 274 | fInAli= AliRunLoader::Open(name); |
b2a02bce | 275 | #else |
276 | fInAli= new TFile(name,"READ"); | |
277 | #endif | |
108615fc | 278 | if(!fInAli){ |
4aa41877 | 279 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetAliInput","File Open") |
b2a02bce | 280 | <<"Pointer to fInAli = 0x0 "<<ENDLOG; |
108615fc | 281 | return kFALSE; |
282 | } | |
283 | return SetAliInput(); | |
284 | } | |
285 | ||
b2a02bce | 286 | #ifdef use_newio |
4aa41877 | 287 | Bool_t AliHLTFileHandler::SetAliInput(AliRunLoader *runLoader) |
b1ed0288 | 288 | { |
289 | //set ali input as runloader | |
a27af97b | 290 | fInAli=runLoader; |
de3c3890 | 291 | fUseRunLoader = kTRUE; |
108615fc | 292 | if(!fInAli){ |
4aa41877 | 293 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetAliInput","File Open") |
a27af97b | 294 | <<"Pointer to AliRunLoader = 0x0 "<<ENDLOG; |
108615fc | 295 | return kFALSE; |
296 | } | |
297 | return SetAliInput(); | |
298 | } | |
b2a02bce | 299 | #endif |
300 | ||
301 | #ifdef use_newio | |
4aa41877 | 302 | Bool_t AliHLTFileHandler::SetAliInput(TFile */*file*/) |
b2a02bce | 303 | { |
b1ed0288 | 304 | //Specify already opened AliROOT file to use as an input. |
4aa41877 | 305 | LOG(AliHLTLog::kFatal,"AliHLTFileHandler::SetAliInput","File Open") |
b2a02bce | 306 | <<"This function is not supported for NEWIO, check ALIHLT_USENEWIO settings in Makefile.conf"<<ENDLOG; |
307 | return kFALSE; | |
308 | } | |
309 | #else | |
4aa41877 | 310 | Bool_t AliHLTFileHandler::SetAliInput(TFile *file) |
b1ed0288 | 311 | { |
b2a02bce | 312 | //Specify already opened AliROOT file to use as an input. |
313 | fInAli=file; | |
314 | if(!fInAli){ | |
4aa41877 | 315 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::SetAliInput","File Open") |
b2a02bce | 316 | <<"Pointer to fInAli = 0x0 "<<ENDLOG; |
317 | return kFALSE; | |
318 | } | |
319 | return SetAliInput(); | |
320 | } | |
321 | #endif | |
108615fc | 322 | |
4aa41877 | 323 | void AliHLTFileHandler::CloseAliInput() |
b1ed0288 | 324 | { |
325 | //close ali input | |
de3c3890 | 326 | #ifdef use_newio |
327 | if(fUseRunLoader) return; | |
328 | #endif | |
108615fc | 329 | if(!fInAli){ |
4aa41877 | 330 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::CloseAliInput","RunLoader") |
9183aa27 | 331 | <<"Nothing to Close"<<ENDLOG; |
332 | return; | |
108615fc | 333 | } |
b2a02bce | 334 | #ifndef use_newio |
335 | if(fInAli->IsOpen()) fInAli->Close(); | |
336 | #endif | |
de3c3890 | 337 | |
108615fc | 338 | delete fInAli; |
339 | fInAli = 0; | |
340 | } | |
341 | ||
4aa41877 | 342 | Bool_t AliHLTFileHandler::IsDigit(Int_t event) |
9183aa27 | 343 | { |
344 | //Check if there is a TPC digit tree in the current file. | |
345 | //Return kTRUE if tree was found, and kFALSE if not found. | |
346 | ||
108615fc | 347 | if(!fInAli){ |
4aa41877 | 348 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::IsDigit","File") |
b2a02bce | 349 | <<"Pointer to fInAli = 0x0 "<<ENDLOG; |
92616b9b | 350 | return kTRUE; //maybe you are using binary input which is Digits! |
a27af97b | 351 | } |
b2a02bce | 352 | #ifdef use_newio |
a27af97b | 353 | AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader"); |
354 | if(!tpcLoader){ | |
4aa41877 | 355 | LOG(AliHLTLog::kWarning,"AliHLTFileHandlerNewIO::IsDigit","File") |
a27af97b | 356 | <<"Pointer to AliLoader for TPC = 0x0 "<<ENDLOG; |
357 | return kFALSE; | |
108615fc | 358 | } |
a27af97b | 359 | fInAli->GetEvent(event); |
360 | tpcLoader->LoadDigits(); | |
361 | TTree *t=tpcLoader->TreeD(); | |
b2a02bce | 362 | #else |
363 | Char_t name[1024]; | |
4aa41877 | 364 | sprintf(name,"TreeD_%s_%d",AliHLTTransform::GetParamName(),event); |
b2a02bce | 365 | TTree *t=(TTree*)fInAli->Get(name); |
366 | #endif | |
108615fc | 367 | if(t){ |
4aa41877 | 368 | LOG(AliHLTLog::kInformational,"AliHLTFileHandlerNewIO::IsDigit","File Type") |
108615fc | 369 | <<"Found Digit Tree -> Use Fast Cluster Finder"<<ENDLOG; |
370 | return kTRUE; | |
371 | } | |
372 | else{ | |
4aa41877 | 373 | LOG(AliHLTLog::kInformational,"AliHLTFileHandlerNewIO::IsDigit","File Type") |
108615fc | 374 | <<"No Digit Tree -> Use Cluster Tree"<<ENDLOG; |
375 | return kFALSE; | |
376 | } | |
377 | } | |
378 | ||
379 | ///////////////////////////////////////// Digit IO | |
4aa41877 | 380 | Bool_t AliHLTFileHandler::AliDigits2Binary(Int_t event,Bool_t altro) |
9183aa27 | 381 | { |
b1ed0288 | 382 | //save alidigits as binary |
108615fc | 383 | Bool_t out = kTRUE; |
384 | UInt_t nrow; | |
4aa41877 | 385 | AliHLTDigitRowData* data = 0; |
3e87ef69 | 386 | if(altro) |
387 | data = AliAltroDigits2Memory(nrow,event); | |
388 | else | |
389 | data = AliDigits2Memory(nrow,event); | |
108615fc | 390 | out = Memory2Binary(nrow,data); |
391 | Free(); | |
392 | return out; | |
393 | } | |
394 | ||
4aa41877 | 395 | Bool_t AliHLTFileHandler::AliDigits2CompBinary(Int_t event,Bool_t altro) |
9183aa27 | 396 | { |
397 | //Convert AliROOT TPC data, into HLT data format. | |
398 | //event specifies the event you want in the aliroot file. | |
399 | ||
108615fc | 400 | Bool_t out = kTRUE; |
401 | UInt_t ndigits=0; | |
4aa41877 | 402 | AliHLTDigitRowData *digits=0; |
02f030e3 | 403 | if(altro) |
954beff0 | 404 | digits = AliAltroDigits2Memory(ndigits,event); |
02f030e3 | 405 | else |
406 | digits = AliDigits2Memory(ndigits,event); | |
108615fc | 407 | out = Memory2CompBinary(ndigits,digits); |
408 | Free(); | |
409 | return out; | |
410 | } | |
411 | ||
4aa41877 | 412 | Bool_t AliHLTFileHandler::CreateIndex() |
02f030e3 | 413 | { |
1f1942b8 | 414 | //create the access index or copy from static index |
02f030e3 | 415 | fIndexCreated=kFALSE; |
02f030e3 | 416 | |
b1ed0288 | 417 | if(!fgStaticIndexCreated || !fUseStaticIndex) { //we have to create index |
4aa41877 | 418 | LOG(AliHLTLog::kInformational,"AliHLTFileHandler::CreateIndex","Index") |
1f1942b8 | 419 | <<"Starting to create index, this can take a while."<<ENDLOG; |
420 | ||
421 | for(Int_t n=0; n<fDigitsTree->GetEntries(); n++) { | |
422 | Int_t sector, row; | |
423 | Int_t lslice,lrow; | |
424 | fDigitsTree->GetEvent(n); | |
425 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
4aa41877 | 426 | if(!AliHLTTransform::Sector2Slice(lslice,lrow,sector,row)){ |
427 | LOG(AliHLTLog::kError,"AliHLTFileHandler::CreateIndex","Slice/Row") | |
428 | <<AliHLTLog::kDec<<"Index could not be created. Wrong values " | |
1f1942b8 | 429 | <<sector<<" "<<row<<ENDLOG; |
430 | return kFALSE; | |
431 | } | |
432 | if(fIndex[lslice][lrow]==-1) { | |
433 | fIndex[lslice][lrow]=n; | |
434 | } | |
435 | } | |
436 | if(fUseStaticIndex) { // create static index | |
4aa41877 | 437 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
438 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
b1ed0288 | 439 | fgStaticIndex[i][j]=fIndex[i][j]; |
1f1942b8 | 440 | } |
b1ed0288 | 441 | fgStaticIndexCreated=kTRUE; //remember that index has been created |
02f030e3 | 442 | } |
02f030e3 | 443 | |
4aa41877 | 444 | LOG(AliHLTLog::kInformational,"AliHLTFileHandler::CreateIndex","Index") |
02f030e3 | 445 | <<"Index successfully created."<<ENDLOG; |
446 | ||
1f1942b8 | 447 | } else if(fUseStaticIndex) { //simply copy static index |
4aa41877 | 448 | for(Int_t i=0;i<AliHLTTransform::GetNSlice();i++){ |
449 | for(Int_t j=0;j<AliHLTTransform::GetNRows();j++) | |
b1ed0288 | 450 | fIndex[i][j]=fgStaticIndex[i][j]; |
1f1942b8 | 451 | } |
452 | ||
4aa41877 | 453 | LOG(AliHLTLog::kInformational,"AliHLTFileHandler::CreateIndex","Index") |
1f1942b8 | 454 | <<"Index successfully taken from static copy."<<ENDLOG; |
1f1942b8 | 455 | } |
02f030e3 | 456 | fIndexCreated=kTRUE; |
b2a02bce | 457 | return kTRUE; |
02f030e3 | 458 | } |
459 | ||
4aa41877 | 460 | AliHLTDigitRowData * AliHLTFileHandler::AliDigits2Memory(UInt_t & nrow,Int_t event) |
9183aa27 | 461 | { |
462 | //Read data from AliROOT file into memory, and store it in the HLT data format. | |
463 | //Returns a pointer to the data. | |
464 | ||
4aa41877 | 465 | AliHLTDigitRowData *data = 0; |
108615fc | 466 | nrow=0; |
4499ed26 | 467 | |
108615fc | 468 | if(!fInAli){ |
4aa41877 | 469 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2Memory","File") |
b2a02bce | 470 | <<"No Input avalible: Pointer to fInAli == NULL"<<ENDLOG; |
108615fc | 471 | return 0; |
472 | } | |
b2a02bce | 473 | |
474 | #ifndef use_newio | |
475 | if(!fInAli->IsOpen()){ | |
4aa41877 | 476 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2Memory","File") |
b2a02bce | 477 | <<"No Input avalible: TFile not opened"<<ENDLOG; |
478 | return 0; | |
479 | } | |
480 | #endif | |
481 | ||
a6e4f9d6 | 482 | if(!fDigitsTree) |
3e87ef69 | 483 | if(!GetDigitsTree(event)) return 0; |
b2a02bce | 484 | |
108615fc | 485 | UShort_t dig; |
486 | Int_t time,pad,sector,row; | |
02f030e3 | 487 | Int_t lslice,lrow; |
108615fc | 488 | Int_t nrows=0; |
489 | Int_t ndigitcount=0; | |
a6e4f9d6 | 490 | Int_t entries = (Int_t)fDigitsTree->GetEntries(); |
92616b9b | 491 | if(entries==0) { |
4aa41877 | 492 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2Memory","ndigits") |
92616b9b | 493 | <<"No TPC digits (entries==0)!"<<ENDLOG; |
494 | nrow = (UInt_t)(fRowMax-fRowMin+1); | |
4aa41877 | 495 | Int_t size = nrow*sizeof(AliHLTDigitRowData); |
496 | data=(AliHLTDigitRowData*) Allocate(size); | |
497 | AliHLTDigitRowData *tempPt = data; | |
92616b9b | 498 | for(Int_t r=fRowMin;r<=fRowMax;r++){ |
499 | tempPt->fRow = r; | |
500 | tempPt->fNDigit = 0; | |
501 | tempPt++; | |
502 | } | |
503 | return data; | |
504 | } | |
505 | ||
386b1330 | 506 | Int_t * ndigits = new Int_t[fRowMax+1]; |
4499ed26 | 507 | Float_t xyz[3]; |
02f030e3 | 508 | |
509 | for(Int_t r=fRowMin;r<=fRowMax;r++){ | |
510 | Int_t n=fIndex[fSlice][r]; | |
045549b7 | 511 | if(n!=-1){ //data on that row |
512 | fDigitsTree->GetEvent(n); | |
513 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
4aa41877 | 514 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
045549b7 | 515 | |
516 | if(lrow!=r){ | |
4aa41877 | 517 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2Memory","Row") |
518 | <<AliHLTLog::kDec<<"Rows in slice " << fSlice << " dont match "<<lrow<<" "<<r<<ENDLOG; | |
045549b7 | 519 | continue; |
520 | } | |
02f030e3 | 521 | |
045549b7 | 522 | ndigits[lrow] = 0; |
523 | fDigits->First(); | |
524 | do { | |
525 | time=fDigits->CurrentRow(); | |
526 | pad=fDigits->CurrentColumn(); | |
527 | dig = fDigits->GetDigit(time,pad); | |
528 | if(dig <= fParam->GetZeroSup()) continue; | |
4aa41877 | 529 | if(dig >= AliHLTTransform::GetADCSat()) |
530 | dig = AliHLTTransform::GetADCSat(); | |
3e87ef69 | 531 | |
4aa41877 | 532 | AliHLTTransform::Raw2Local(xyz,sector,row,pad,time); |
a8ffd46b | 533 | // if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) |
534 | // continue; // why 230??? | |
108615fc | 535 | |
045549b7 | 536 | ndigits[lrow]++; //for this row only |
537 | ndigitcount++; //total number of digits to be published | |
108615fc | 538 | |
045549b7 | 539 | } while (fDigits->Next()); |
540 | //cout << lrow << " " << ndigits[lrow] << " - " << ndigitcount << endl; | |
541 | } | |
02f030e3 | 542 | nrows++; |
543 | } | |
4499ed26 | 544 | |
4aa41877 | 545 | Int_t size = sizeof(AliHLTDigitData)*ndigitcount |
546 | + nrows*sizeof(AliHLTDigitRowData); | |
108615fc | 547 | |
4aa41877 | 548 | LOG(AliHLTLog::kDebug,"AliHLTFileHandler::AliDigits2Memory","Digits") |
549 | <<AliHLTLog::kDec<<"Found "<<ndigitcount<<" Digits"<<ENDLOG; | |
a6e4f9d6 | 550 | |
4aa41877 | 551 | data=(AliHLTDigitRowData*) Allocate(size); |
108615fc | 552 | nrow = (UInt_t)nrows; |
4aa41877 | 553 | AliHLTDigitRowData *tempPt = data; |
108615fc | 554 | |
02f030e3 | 555 | for(Int_t r=fRowMin;r<=fRowMax;r++){ |
556 | Int_t n=fIndex[fSlice][r]; | |
045549b7 | 557 | tempPt->fRow = r; |
558 | tempPt->fNDigit = 0; | |
559 | ||
560 | if(n!=-1){//data on that row | |
561 | fDigitsTree->GetEvent(n); | |
562 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
4aa41877 | 563 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
045549b7 | 564 | if(lrow!=r){ |
4aa41877 | 565 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2Memory","Row") |
566 | <<AliHLTLog::kDec<<"Rows on slice " << fSlice << " dont match "<<lrow<<" "<<r<<ENDLOG; | |
045549b7 | 567 | continue; |
568 | } | |
02f030e3 | 569 | |
045549b7 | 570 | tempPt->fNDigit = ndigits[lrow]; |
571 | ||
572 | Int_t localcount=0; | |
573 | fDigits->First(); | |
574 | do { | |
575 | time=fDigits->CurrentRow(); | |
576 | pad=fDigits->CurrentColumn(); | |
577 | dig = fDigits->GetDigit(time,pad); | |
578 | if (dig <= fParam->GetZeroSup()) continue; | |
4aa41877 | 579 | if(dig >= AliHLTTransform::GetADCSat()) |
580 | dig = AliHLTTransform::GetADCSat(); | |
045549b7 | 581 | |
582 | //Exclude data outside cone: | |
4aa41877 | 583 | AliHLTTransform::Raw2Local(xyz,sector,row,pad,time); |
a8ffd46b | 584 | // if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) |
585 | // continue; // why 230??? | |
045549b7 | 586 | |
587 | if(localcount >= ndigits[lrow]) | |
4aa41877 | 588 | LOG(AliHLTLog::kFatal,"AliHLTFileHandler::AliDigits2Binary","Memory") |
589 | <<AliHLTLog::kDec<<"Mismatch: localcount "<<localcount<<" ndigits " | |
045549b7 | 590 | <<ndigits[lrow]<<ENDLOG; |
03b6adf7 | 591 | |
045549b7 | 592 | tempPt->fDigitData[localcount].fCharge=dig; |
593 | tempPt->fDigitData[localcount].fPad=pad; | |
594 | tempPt->fDigitData[localcount].fTime=time; | |
10f815d9 | 595 | #ifdef do_mc |
045549b7 | 596 | tempPt->fDigitData[localcount].fTrackID[0] = fDigits->GetTrackID(time,pad,0); |
597 | tempPt->fDigitData[localcount].fTrackID[1] = fDigits->GetTrackID(time,pad,1); | |
598 | tempPt->fDigitData[localcount].fTrackID[2] = fDigits->GetTrackID(time,pad,2); | |
10f815d9 | 599 | #endif |
045549b7 | 600 | localcount++; |
601 | } while (fDigits->Next()); | |
602 | } | |
02f030e3 | 603 | Byte_t *tmp = (Byte_t*)tempPt; |
4aa41877 | 604 | Int_t size = sizeof(AliHLTDigitRowData) |
605 | + ndigits[lrow]*sizeof(AliHLTDigitData); | |
02f030e3 | 606 | tmp += size; |
4aa41877 | 607 | tempPt = (AliHLTDigitRowData*)tmp; |
02f030e3 | 608 | } |
62bb4b3d | 609 | delete [] ndigits; |
108615fc | 610 | return data; |
611 | } | |
612 | ||
4aa41877 | 613 | AliHLTDigitRowData * AliHLTFileHandler::AliAltroDigits2Memory(UInt_t & nrow,Int_t event,Bool_t eventmerge) |
954beff0 | 614 | { |
615 | //Read data from AliROOT file into memory, and store it in the HLT data format. | |
616 | //Returns a pointer to the data. | |
617 | //This functions filter out single timebins, which is noise. The timebins which | |
618 | //are removed are timebins which have the 4 zero neighbours; | |
619 | //(pad-1,time),(pad+1,time),(pad,time-1),(pad,time+1). | |
620 | ||
4aa41877 | 621 | AliHLTDigitRowData *data = 0; |
954beff0 | 622 | nrow=0; |
623 | ||
624 | if(!fInAli){ | |
4aa41877 | 625 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliAltroDigits2Memory","File") |
b2a02bce | 626 | <<"No Input avalible: Pointer to TFile == NULL"<<ENDLOG; |
954beff0 | 627 | return 0; |
628 | } | |
b2a02bce | 629 | #ifndef use_newio |
630 | if(!fInAli->IsOpen()){ | |
4aa41877 | 631 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliAltroDigits2Memory","File") |
b2a02bce | 632 | <<"No Input avalible: TFile not opened"<<ENDLOG; |
633 | return 0; | |
634 | } | |
635 | #endif | |
3e87ef69 | 636 | if(eventmerge == kTRUE && event >= 1024) |
637 | { | |
4aa41877 | 638 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliAltroDigits2Memory","TrackIDs") |
92616b9b | 639 | <<"Too many events if you want to merge!"<<ENDLOG; |
3e87ef69 | 640 | return 0; |
641 | } | |
a6c89175 | 642 | delete fDigits; |
643 | fDigits=0; | |
b2a02bce | 644 | #ifdef use_newio |
645 | /* Dont understand why we have to do | |
045549b7 | 646 | reload the tree, but otherwise the code crashes */ |
b2a02bce | 647 | fDigitsTree=0; |
648 | if(!GetDigitsTree(event)) return 0; | |
649 | #else | |
650 | if(!fDigitsTree){ | |
3e87ef69 | 651 | if(!GetDigitsTree(event)) return 0; |
b2a02bce | 652 | } |
653 | #endif | |
654 | ||
954beff0 | 655 | UShort_t dig; |
656 | Int_t time,pad,sector,row; | |
657 | Int_t nrows=0; | |
658 | Int_t ndigitcount=0; | |
659 | Int_t entries = (Int_t)fDigitsTree->GetEntries(); | |
92616b9b | 660 | if(entries==0) { |
4aa41877 | 661 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliAltroDigits2Memory","ndigits") |
92616b9b | 662 | <<"No TPC digits (entries==0)!"<<ENDLOG; |
663 | nrow = (UInt_t)(fRowMax-fRowMin+1); | |
4aa41877 | 664 | Int_t size = nrow*sizeof(AliHLTDigitRowData); |
665 | data=(AliHLTDigitRowData*) Allocate(size); | |
666 | AliHLTDigitRowData *tempPt = data; | |
92616b9b | 667 | for(Int_t r=fRowMin;r<=fRowMax;r++){ |
668 | tempPt->fRow = r; | |
669 | tempPt->fNDigit = 0; | |
670 | tempPt++; | |
671 | } | |
672 | return data; | |
673 | } | |
386b1330 | 674 | Int_t * ndigits = new Int_t[fRowMax+1]; |
954beff0 | 675 | Int_t lslice,lrow; |
4aa41877 | 676 | Int_t zerosupval=AliHLTTransform::GetZeroSup(); |
954beff0 | 677 | Float_t xyz[3]; |
b2a02bce | 678 | |
02f030e3 | 679 | for(Int_t r=fRowMin;r<=fRowMax;r++){ |
680 | Int_t n=fIndex[fSlice][r]; | |
b2a02bce | 681 | |
de3c3890 | 682 | ndigits[r] = 0; |
683 | ||
045549b7 | 684 | if(n!=-1){//data on that row |
685 | fDigitsTree->GetEvent(n); | |
686 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
4aa41877 | 687 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
045549b7 | 688 | //cout << lslice << " " << fSlice << " " << lrow << " " << r << " " << sector << " " << row << endl; |
689 | if((lslice!=fSlice)||(lrow!=r)){ | |
4aa41877 | 690 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliAltroDigits2Memory","Row") |
691 | <<AliHLTLog::kDec<<"Rows on slice " << fSlice << " dont match "<<lrow<<" "<<r<<ENDLOG; | |
045549b7 | 692 | continue; |
693 | } | |
02f030e3 | 694 | |
045549b7 | 695 | fDigits->ExpandBuffer(); |
696 | fDigits->ExpandTrackBuffer(); | |
697 | for(Int_t i=0; i<fDigits->GetNCols(); i++){ | |
698 | for(Int_t j=0; j<fDigits->GetNRows(); j++){ | |
699 | pad=i; | |
700 | time=j; | |
701 | dig = fDigits->GetDigitFast(time,pad); | |
702 | if(dig <= zerosupval) continue; | |
4aa41877 | 703 | if(dig >= AliHLTTransform::GetADCSat()) |
704 | dig = AliHLTTransform::GetADCSat(); | |
045549b7 | 705 | |
706 | //Check for single timebins, and remove them because they are noise for sure. | |
707 | if(i>0 && i<fDigits->GetNCols()-1 && j>0 && j<fDigits->GetNRows()-1) | |
708 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
709 | fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
710 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
711 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
712 | continue; | |
954beff0 | 713 | |
045549b7 | 714 | //Boundaries: |
715 | if(i==0) //pad==0 | |
716 | { | |
717 | if(j < fDigits->GetNRows()-1 && j > 0) | |
718 | { | |
719 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
720 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
721 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
722 | continue; | |
723 | } | |
724 | else if(j > 0) | |
725 | { | |
726 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
727 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
728 | continue; | |
729 | } | |
730 | } | |
731 | if(j==0) | |
732 | { | |
733 | if(i < fDigits->GetNCols()-1 && i > 0) | |
734 | { | |
735 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
736 | fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
737 | fDigits->GetDigitFast(time+1,pad)<=zerosupval) | |
738 | continue; | |
739 | } | |
740 | else if(i > 0) | |
741 | { | |
742 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
743 | fDigits->GetDigitFast(time+1,pad)<=zerosupval) | |
744 | continue; | |
745 | } | |
746 | } | |
747 | ||
748 | if(i==fDigits->GetNCols()-1) | |
749 | { | |
750 | if(j>0 && j<fDigits->GetNRows()-1) | |
751 | { | |
752 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
753 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
754 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
755 | continue; | |
756 | } | |
757 | else if(j==0 && j<fDigits->GetNRows()-1) | |
758 | { | |
759 | if(fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
760 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
761 | continue; | |
762 | } | |
763 | else | |
764 | { | |
765 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
766 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
767 | continue; | |
768 | } | |
769 | } | |
02f030e3 | 770 | |
045549b7 | 771 | if(j==fDigits->GetNRows()-1) |
772 | { | |
773 | if(i>0 && i<fDigits->GetNCols()-1) | |
774 | { | |
775 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
776 | fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
777 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
778 | continue; | |
779 | } | |
780 | else if(i==0 && fDigits->GetNCols()-1) | |
781 | { | |
782 | if(fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
783 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
784 | continue; | |
785 | } | |
786 | else | |
787 | { | |
788 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
789 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
790 | continue; | |
791 | } | |
792 | } | |
793 | ||
4aa41877 | 794 | AliHLTTransform::Raw2Local(xyz,sector,row,pad,time); |
a8ffd46b | 795 | // if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) |
796 | // continue; | |
954beff0 | 797 | |
045549b7 | 798 | ndigits[lrow]++; //for this row only |
799 | ndigitcount++; //total number of digits to be published | |
800 | } | |
02f030e3 | 801 | } |
954beff0 | 802 | } |
02f030e3 | 803 | nrows++; |
804 | } | |
805 | ||
4aa41877 | 806 | Int_t size = sizeof(AliHLTDigitData)*ndigitcount |
807 | + nrows*sizeof(AliHLTDigitRowData); | |
954beff0 | 808 | |
4aa41877 | 809 | LOG(AliHLTLog::kDebug,"AliHLTFileHandler::AliAltroDigits2Memory","Digits") |
810 | <<AliHLTLog::kDec<<"Found "<<ndigitcount<<" Digits"<<ENDLOG; | |
954beff0 | 811 | |
4aa41877 | 812 | data=(AliHLTDigitRowData*) Allocate(size); |
954beff0 | 813 | nrow = (UInt_t)nrows; |
4aa41877 | 814 | AliHLTDigitRowData *tempPt = data; |
02f030e3 | 815 | |
816 | for(Int_t r=fRowMin;r<=fRowMax;r++){ | |
817 | Int_t n=fIndex[fSlice][r]; | |
045549b7 | 818 | tempPt->fRow = r; |
819 | tempPt->fNDigit = 0; | |
820 | if(n!=-1){ //no data on that row | |
821 | fDigitsTree->GetEvent(n); | |
822 | fParam->AdjustSectorRow(fDigits->GetID(),sector,row); | |
4aa41877 | 823 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
045549b7 | 824 | |
825 | if(lrow!=r){ | |
4aa41877 | 826 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliAltroDigits2Memory","Row") |
827 | <<AliHLTLog::kDec<<"Rows on slice " << fSlice << " dont match "<<lrow<<" "<<r<<ENDLOG; | |
045549b7 | 828 | continue; |
829 | } | |
954beff0 | 830 | |
045549b7 | 831 | tempPt->fNDigit = ndigits[lrow]; |
832 | ||
833 | Int_t localcount=0; | |
834 | fDigits->ExpandBuffer(); | |
835 | fDigits->ExpandTrackBuffer(); | |
836 | for(Int_t i=0; i<fDigits->GetNCols(); i++){ | |
837 | for(Int_t j=0; j<fDigits->GetNRows(); j++){ | |
838 | pad=i; | |
839 | time=j; | |
840 | dig = fDigits->GetDigitFast(time,pad); | |
841 | if(dig <= zerosupval) continue; | |
4aa41877 | 842 | if(dig >= AliHLTTransform::GetADCSat()) |
843 | dig = AliHLTTransform::GetADCSat(); | |
954beff0 | 844 | |
045549b7 | 845 | //Check for single timebins, and remove them because they are noise for sure. |
846 | if(i>0 && i<fDigits->GetNCols()-1 && j>0 && j<fDigits->GetNRows()-1) | |
847 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
848 | fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
849 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
850 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
851 | continue; | |
852 | ||
853 | //Boundaries: | |
854 | if(i==0) //pad ==0 | |
855 | { | |
856 | if(j < fDigits->GetNRows()-1 && j > 0) | |
857 | { | |
858 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
859 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
860 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
861 | continue; | |
862 | } | |
863 | else if(j > 0) | |
864 | { | |
865 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
866 | fDigits->GetDigitFast(time,pad+1)<=zerosupval) | |
867 | continue; | |
868 | } | |
869 | } | |
870 | if(j==0) | |
871 | { | |
872 | if(i < fDigits->GetNCols()-1 && i > 0) | |
873 | { | |
874 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
875 | fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
876 | fDigits->GetDigitFast(time+1,pad)<=zerosupval) | |
877 | continue; | |
878 | } | |
879 | else if(i > 0) | |
880 | { | |
881 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
882 | fDigits->GetDigitFast(time+1,pad)<=zerosupval) | |
883 | continue; | |
884 | } | |
885 | } | |
02f030e3 | 886 | |
045549b7 | 887 | if(i == fDigits->GetNCols()-1) |
888 | { | |
889 | if(j>0 && j<fDigits->GetNRows()-1) | |
890 | { | |
891 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
892 | fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
893 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
894 | continue; | |
895 | } | |
896 | else if(j==0 && j<fDigits->GetNRows()-1) | |
897 | { | |
898 | if(fDigits->GetDigitFast(time+1,pad)<=zerosupval && | |
899 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
900 | continue; | |
901 | } | |
902 | else | |
903 | { | |
904 | if(fDigits->GetDigitFast(time-1,pad)<=zerosupval && | |
905 | fDigits->GetDigitFast(time,pad-1)<=zerosupval) | |
906 | continue; | |
907 | } | |
908 | } | |
909 | if(j==fDigits->GetNRows()-1) | |
910 | { | |
911 | if(i>0 && i<fDigits->GetNCols()-1) | |
912 | { | |
913 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
914 | fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
915 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
916 | continue; | |
917 | } | |
918 | else if(i==0 && fDigits->GetNCols()-1) | |
919 | { | |
920 | if(fDigits->GetDigitFast(time,pad+1)<=zerosupval && | |
921 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
922 | continue; | |
923 | } | |
924 | else | |
925 | { | |
926 | if(fDigits->GetDigitFast(time,pad-1)<=zerosupval && | |
927 | fDigits->GetDigitFast(time-1,pad)<=zerosupval) | |
928 | continue; | |
929 | } | |
930 | } | |
02f030e3 | 931 | |
4aa41877 | 932 | AliHLTTransform::Raw2Local(xyz,sector,row,pad,time); |
a8ffd46b | 933 | // if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) |
934 | // continue; | |
045549b7 | 935 | |
936 | if(localcount >= ndigits[lrow]) | |
4aa41877 | 937 | LOG(AliHLTLog::kFatal,"AliHLTFileHandler::AliAltroDigits2Binary","Memory") |
938 | <<AliHLTLog::kDec<<"Mismatch: localcount "<<localcount<<" ndigits " | |
045549b7 | 939 | <<ndigits[lrow]<<ENDLOG; |
02f030e3 | 940 | |
045549b7 | 941 | tempPt->fDigitData[localcount].fCharge=dig; |
942 | tempPt->fDigitData[localcount].fPad=pad; | |
943 | tempPt->fDigitData[localcount].fTime=time; | |
954beff0 | 944 | #ifdef do_mc |
045549b7 | 945 | tempPt->fDigitData[localcount].fTrackID[0] = (fDigits->GetTrackIDFast(time,pad,0)-2); |
946 | tempPt->fDigitData[localcount].fTrackID[1] = (fDigits->GetTrackIDFast(time,pad,1)-2); | |
947 | tempPt->fDigitData[localcount].fTrackID[2] = (fDigits->GetTrackIDFast(time,pad,2)-2); | |
948 | if(eventmerge == kTRUE) //careful track mc info will be touched | |
949 | {//Event are going to be merged, so event number is stored in the upper 10 bits. | |
950 | tempPt->fDigitData[localcount].fTrackID[0] += 128; //leave some room | |
951 | tempPt->fDigitData[localcount].fTrackID[1] += 128; //for neg. numbers | |
952 | tempPt->fDigitData[localcount].fTrackID[2] += 128; | |
953 | tempPt->fDigitData[localcount].fTrackID[0] += ((event&0x3ff)<<22); | |
954 | tempPt->fDigitData[localcount].fTrackID[1] += ((event&0x3ff)<<22); | |
955 | tempPt->fDigitData[localcount].fTrackID[2] += ((event&0x3ff)<<22); | |
956 | } | |
954beff0 | 957 | #endif |
045549b7 | 958 | localcount++; |
959 | } | |
02f030e3 | 960 | } |
954beff0 | 961 | } |
02f030e3 | 962 | Byte_t *tmp = (Byte_t*)tempPt; |
4aa41877 | 963 | Int_t size = sizeof(AliHLTDigitRowData) |
964 | + ndigits[r]*sizeof(AliHLTDigitData); | |
02f030e3 | 965 | tmp += size; |
4aa41877 | 966 | tempPt = (AliHLTDigitRowData*)tmp; |
02f030e3 | 967 | } |
62bb4b3d | 968 | delete [] ndigits; |
954beff0 | 969 | return data; |
970 | } | |
02f030e3 | 971 | |
4aa41877 | 972 | Bool_t AliHLTFileHandler::GetDigitsTree(Int_t event) |
a6e4f9d6 | 973 | { |
9183aa27 | 974 | //Connects to the TPC digit tree in the AliROOT file. |
b2a02bce | 975 | #ifdef use_newio |
a27af97b | 976 | AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader"); |
977 | if(!tpcLoader){ | |
4aa41877 | 978 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::GetDigitsTree","File") |
a27af97b | 979 | <<"Pointer to AliLoader for TPC = 0x0 "<<ENDLOG; |
980 | return kFALSE; | |
981 | } | |
982 | fInAli->GetEvent(event); | |
983 | tpcLoader->LoadDigits(); | |
984 | fDigitsTree = tpcLoader->TreeD(); | |
b2a02bce | 985 | #else |
986 | fInAli->cd(); | |
987 | Char_t dname[100]; | |
4aa41877 | 988 | sprintf(dname,"TreeD_%s_%d",AliHLTTransform::GetParamName(),event); |
b2a02bce | 989 | fDigitsTree = (TTree*)fInAli->Get(dname); |
990 | #endif | |
a6e4f9d6 | 991 | if(!fDigitsTree) |
992 | { | |
4aa41877 | 993 | LOG(AliHLTLog::kError,"AliHLTFileHandler::GetDigitsTree","Digits Tree") |
994 | <<AliHLTLog::kHex<<"Error getting digitstree "<<(void*)fDigitsTree<<ENDLOG; | |
a6e4f9d6 | 995 | return kFALSE; |
996 | } | |
997 | fDigitsTree->GetBranch("Segment")->SetAddress(&fDigits); | |
02f030e3 | 998 | |
b2a02bce | 999 | if(!fIndexCreated) return CreateIndex(); |
1000 | else return kTRUE; | |
a6e4f9d6 | 1001 | } |
1002 | ||
4aa41877 | 1003 | void AliHLTFileHandler::AliDigits2RootFile(AliHLTDigitRowData *rowPt,Char_t *new_digitsfile) |
0d319e67 | 1004 | { |
9183aa27 | 1005 | //Write the data stored in rowPt, into a new AliROOT file. |
1006 | //The data is stored in the AliROOT format | |
1007 | //This is specially a nice thing if you have modified data, and wants to run it | |
1008 | //through the offline reconstruction chain. | |
1009 | //The arguments is a pointer to the data, and the name of the new AliROOT file. | |
1010 | //Remember to pass the original AliROOT file (the one that contains the original | |
1011 | //simulated data) to this object, in order to retrieve the MC id's of the digits. | |
f6670bec | 1012 | |
0d319e67 | 1013 | if(!fInAli) |
1014 | { | |
4aa41877 | 1015 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","File") |
b2a02bce | 1016 | <<"No rootfile "<<ENDLOG; |
0d319e67 | 1017 | return; |
1018 | } | |
1019 | if(!fParam) | |
1020 | { | |
4aa41877 | 1021 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","File") |
b2a02bce | 1022 | <<"No parameter object. Run on rootfile "<<ENDLOG; |
0d319e67 | 1023 | return; |
1024 | } | |
b2a02bce | 1025 | |
1026 | #ifdef use_newio | |
0d319e67 | 1027 | //Get the original digitstree: |
a27af97b | 1028 | AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader"); |
1029 | if(!tpcLoader){ | |
4aa41877 | 1030 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2RootFile","File") |
a27af97b | 1031 | <<"Pointer to AliLoader for TPC = 0x0 "<<ENDLOG; |
1032 | return; | |
1033 | } | |
1034 | tpcLoader->LoadDigits(); | |
1035 | TTree *t=tpcLoader->TreeD(); | |
6df3cddf | 1036 | |
0d319e67 | 1037 | AliTPCDigitsArray *old_array = new AliTPCDigitsArray(); |
1038 | old_array->Setup(fParam); | |
1039 | old_array->SetClass("AliSimDigits"); | |
5e0f9911 | 1040 | |
a27af97b | 1041 | Bool_t ok = old_array->ConnectTree(t); |
0d319e67 | 1042 | if(!ok) |
1043 | { | |
4aa41877 | 1044 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","File") |
b2a02bce | 1045 | << "No digits tree object" << ENDLOG; |
0d319e67 | 1046 | return; |
1047 | } | |
6df3cddf | 1048 | |
a27af97b | 1049 | tpcLoader->SetDigitsFileName(new_digitsfile); |
1050 | tpcLoader->MakeDigitsContainer(); | |
03b6adf7 | 1051 | |
1052 | //setup a new one, or connect it to the existing one: | |
6df3cddf | 1053 | AliTPCDigitsArray *arr = new AliTPCDigitsArray(); |
0d319e67 | 1054 | arr->SetClass("AliSimDigits"); |
1055 | arr->Setup(fParam); | |
a27af97b | 1056 | arr->MakeTree(tpcLoader->TreeD()); |
b2a02bce | 1057 | #else |
1058 | ||
1059 | //Get the original digitstree: | |
1060 | Char_t dname[100]; | |
4aa41877 | 1061 | sprintf(dname,"TreeD_%s_0",AliHLTTransform::GetParamName()); |
b2a02bce | 1062 | |
1063 | fInAli->cd(); | |
1064 | AliTPCDigitsArray *old_array = new AliTPCDigitsArray(); | |
1065 | old_array->Setup(fParam); | |
1066 | old_array->SetClass("AliSimDigits"); | |
1067 | ||
1068 | Bool_t ok = old_array->ConnectTree(dname); | |
1069 | if(!ok) | |
1070 | { | |
4aa41877 | 1071 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","File") |
b2a02bce | 1072 | <<"No digits tree object." <<ENDLOG; |
1073 | return; | |
1074 | } | |
1075 | ||
1076 | Bool_t create=kFALSE; | |
1077 | TFile *digFile; | |
1078 | ||
1079 | if(gSystem->AccessPathName(new_digitsfile)) | |
1080 | { | |
4aa41877 | 1081 | LOG(AliHLTLog::kInformational,"AliHLTFileHandler::AliDigits2RootFile","File") |
b2a02bce | 1082 | <<"Creating new file "<<new_digitsfile<<ENDLOG; |
1083 | create = kTRUE; | |
1084 | digFile = TFile::Open(new_digitsfile,"RECREATE"); | |
1085 | fParam->Write(fParam->GetTitle()); | |
1086 | } | |
1087 | else | |
1088 | { | |
1089 | create = kFALSE; | |
1090 | digFile = TFile::Open(new_digitsfile,"UPDATE"); | |
1091 | ||
1092 | } | |
1093 | if(!digFile->IsOpen()) | |
1094 | { | |
4aa41877 | 1095 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","Rootfile") |
b2a02bce | 1096 | <<"Error opening rootfile "<<new_digitsfile<<ENDLOG; |
1097 | return; | |
1098 | } | |
1099 | ||
1100 | digFile->cd(); | |
1101 | ||
1102 | //setup a new one, or connect it to the existing one: | |
1103 | AliTPCDigitsArray *arr = new AliTPCDigitsArray(); | |
1104 | arr->SetClass("AliSimDigits"); | |
1105 | arr->Setup(fParam); | |
1106 | if(create) | |
1107 | arr->MakeTree(); | |
1108 | else | |
1109 | { | |
1110 | Bool_t ok = arr->ConnectTree(dname); | |
1111 | if(!ok) | |
1112 | { | |
4aa41877 | 1113 | LOG(AliHLTLog::kError,"AliHLTFileHandler::AliDigits2RootFile","Rootfile") |
b2a02bce | 1114 | <<"No digits tree object in existing file"<<ENDLOG; |
1115 | return; | |
1116 | } | |
1117 | } | |
1118 | #endif | |
a27af97b | 1119 | |
6df3cddf | 1120 | Int_t digcounter=0,trackID[3]; |
49898c33 | 1121 | |
0d319e67 | 1122 | for(Int_t i=fRowMin; i<=fRowMax; i++) |
1123 | { | |
03b6adf7 | 1124 | |
6df3cddf | 1125 | if((Int_t)rowPt->fRow != i) |
4aa41877 | 1126 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2RootFile","Data") |
b2a02bce | 1127 | <<"Mismatching row numbering "<<(Int_t)rowPt->fRow<<" "<<i<<ENDLOG; |
03b6adf7 | 1128 | |
0d319e67 | 1129 | Int_t sector,row; |
4aa41877 | 1130 | AliHLTTransform::Slice2Sector(fSlice,i,sector,row); |
6df3cddf | 1131 | |
49898c33 | 1132 | AliSimDigits *old_dig = (AliSimDigits*)old_array->LoadRow(sector,row); |
6df3cddf | 1133 | AliSimDigits * dig = (AliSimDigits*)arr->CreateRow(sector,row); |
1134 | old_dig->ExpandBuffer(); | |
1135 | old_dig->ExpandTrackBuffer(); | |
1136 | dig->ExpandBuffer(); | |
1137 | dig->ExpandTrackBuffer(); | |
1138 | ||
0d319e67 | 1139 | if(!old_dig) |
4aa41877 | 1140 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2RootFile","Data") |
b2a02bce | 1141 | <<"No padrow " << sector << " " << row <<ENDLOG; |
1142 | ||
4aa41877 | 1143 | AliHLTDigitData *digPt = rowPt->fDigitData; |
54efe57a | 1144 | digcounter=0; |
0d319e67 | 1145 | for(UInt_t j=0; j<rowPt->fNDigit; j++) |
1146 | { | |
6df3cddf | 1147 | Short_t charge = (Short_t)digPt[j].fCharge; |
49898c33 | 1148 | Int_t pad = (Int_t)digPt[j].fPad; |
1149 | Int_t time = (Int_t)digPt[j].fTime; | |
03b6adf7 | 1150 | |
1151 | if(charge == 0) //Only write the digits that has not been removed | |
6df3cddf | 1152 | { |
4aa41877 | 1153 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliDigits2RootFile","Data") |
b2a02bce | 1154 | <<"Zero charge" <<ENDLOG; |
6df3cddf | 1155 | continue; |
1156 | } | |
1157 | ||
54efe57a | 1158 | digcounter++; |
49898c33 | 1159 | |
6df3cddf | 1160 | //Tricks to get and set the correct track id's. |
1161 | for(Int_t t=0; t<3; t++) | |
97543115 | 1162 | { |
6df3cddf | 1163 | Int_t label = old_dig->GetTrackIDFast(time,pad,t); |
1164 | if(label > 1) | |
1165 | trackID[t] = label - 2; | |
1166 | else if(label==0) | |
1167 | trackID[t] = -2; | |
1168 | else | |
1169 | trackID[t] = -1; | |
49898c33 | 1170 | } |
6df3cddf | 1171 | |
1172 | dig->SetDigitFast(charge,time,pad); | |
1173 | ||
1174 | for(Int_t t=0; t<3; t++) | |
1175 | ((AliSimDigits*)dig)->SetTrackIDFast(trackID[t],time,pad,t); | |
0d319e67 | 1176 | |
1177 | } | |
54efe57a | 1178 | //cout<<"Wrote "<<digcounter<<" on row "<<i<<endl; |
0d319e67 | 1179 | UpdateRowPointer(rowPt); |
1180 | arr->StoreRow(sector,row); | |
1181 | arr->ClearRow(sector,row); | |
1182 | old_array->ClearRow(sector,row); | |
1183 | } | |
b2a02bce | 1184 | |
0d319e67 | 1185 | char treeName[100]; |
03b6adf7 | 1186 | sprintf(treeName,"TreeD_%s_0",fParam->GetTitle()); |
b2a02bce | 1187 | |
1188 | #ifdef use_newio | |
6df3cddf | 1189 | arr->GetTree()->SetName(treeName); |
1190 | arr->GetTree()->AutoSave(); | |
a27af97b | 1191 | tpcLoader->WriteDigits("OVERWRITE"); |
b2a02bce | 1192 | #else |
1193 | digFile->cd(); | |
1194 | arr->GetTree()->SetName(treeName); | |
1195 | arr->GetTree()->AutoSave(); | |
1196 | digFile->Close(); | |
1197 | #endif | |
6df3cddf | 1198 | delete arr; |
1199 | delete old_array; | |
0d319e67 | 1200 | } |
1201 | ||
108615fc | 1202 | ///////////////////////////////////////// Point IO |
4aa41877 | 1203 | Bool_t AliHLTFileHandler::AliPoints2Binary(Int_t eventn) |
b1ed0288 | 1204 | { |
1205 | //points to binary | |
108615fc | 1206 | Bool_t out = kTRUE; |
1207 | UInt_t npoint; | |
4aa41877 | 1208 | AliHLTSpacePointData *data = AliPoints2Memory(npoint,eventn); |
108615fc | 1209 | out = Memory2Binary(npoint,data); |
1210 | Free(); | |
1211 | return out; | |
1212 | } | |
1213 | ||
4aa41877 | 1214 | AliHLTSpacePointData * AliHLTFileHandler::AliPoints2Memory(UInt_t & npoint,Int_t eventn) |
b1ed0288 | 1215 | { |
1216 | //points to memory | |
4aa41877 | 1217 | AliHLTSpacePointData *data = 0; |
108615fc | 1218 | npoint=0; |
1219 | if(!fInAli){ | |
4aa41877 | 1220 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliPoints2Memory","File") |
b2a02bce | 1221 | <<"No Input avalible: no object fInAli"<<ENDLOG; |
1222 | return 0; | |
1223 | } | |
1224 | #ifndef use_newio | |
1225 | if(!fInAli->IsOpen()){ | |
4aa41877 | 1226 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliPoints2Memory","File") |
b2a02bce | 1227 | <<"No Input avalible: TFile not opend"<<ENDLOG; |
108615fc | 1228 | return 0; |
1229 | } | |
b2a02bce | 1230 | #endif |
a27af97b | 1231 | |
1232 | TDirectory *savedir = gDirectory; | |
b2a02bce | 1233 | #ifdef use_newio |
a27af97b | 1234 | AliLoader* tpcLoader = fInAli->GetLoader("TPCLoader"); |
1235 | if(!tpcLoader){ | |
4aa41877 | 1236 | LOG(AliHLTLog::kWarning,"AliHLTFileHandler::AliPoints2Memory","File") |
a27af97b | 1237 | <<"Pointer to AliLoader for TPC = 0x0 "<<ENDLOG; |
1f1942b8 | 1238 | return 0; |
108615fc | 1239 | } |
a27af97b | 1240 | fInAli->GetEvent(eventn); |
1241 | tpcLoader->LoadRecPoints(); | |
494fad94 | 1242 | |
108615fc | 1243 | AliTPCClustersArray carray; |
1244 | carray.Setup(fParam); | |
1245 | carray.SetClusterType("AliTPCcluster"); | |
a27af97b | 1246 | Bool_t clusterok = carray.ConnectTree(tpcLoader->TreeR()); |
b2a02bce | 1247 | #else |
1248 | fInAli->cd(); | |
1249 | ||
1250 | Char_t cname[100]; | |
1251 | sprintf(cname,"TreeC_TPC_%d",eventn); | |
1252 | AliTPCClustersArray carray; | |
1253 | carray.Setup(fParam); | |
1254 | carray.SetClusterType("AliTPCcluster"); | |
1255 | Bool_t clusterok = carray.ConnectTree(cname); | |
1256 | #endif | |
1257 | ||
108615fc | 1258 | if(!clusterok) return 0; |
1259 | ||
1260 | AliTPCClustersRow ** clusterrow = | |
1261 | new AliTPCClustersRow*[ (int)carray.GetTree()->GetEntries()]; | |
1262 | Int_t *rows = new int[ (int)carray.GetTree()->GetEntries()]; | |
1263 | Int_t *sects = new int[ (int)carray.GetTree()->GetEntries()]; | |
1264 | Int_t sum=0; | |
1265 | ||
1266 | Int_t lslice,lrow; | |
1267 | for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++){ | |
1268 | AliSegmentID *s = carray.LoadEntry(i); | |
1269 | Int_t sector,row; | |
1270 | fParam->AdjustSectorRow(s->GetID(),sector,row); | |
1271 | rows[i] = row; | |
1272 | sects[i] = sector; | |
1273 | clusterrow[i] = 0; | |
4aa41877 | 1274 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
108615fc | 1275 | if(fSlice != lslice || lrow<fRowMin || lrow>fRowMax) continue; |
1276 | clusterrow[i] = carray.GetRow(sector,row); | |
1277 | if(clusterrow[i]) | |
1278 | sum+=clusterrow[i]->GetArray()->GetEntriesFast(); | |
1279 | } | |
4aa41877 | 1280 | UInt_t size = sum*sizeof(AliHLTSpacePointData); |
108615fc | 1281 | |
4aa41877 | 1282 | LOG(AliHLTLog::kDebug,"AliHLTFileHandler::AliPoints2Memory","File") |
1283 | <<AliHLTLog::kDec<<"Found "<<sum<<" SpacePoints"<<ENDLOG; | |
108615fc | 1284 | |
4aa41877 | 1285 | data = (AliHLTSpacePointData *) Allocate(size); |
108615fc | 1286 | npoint = sum; |
1287 | UInt_t n=0; | |
3e87ef69 | 1288 | Int_t pat=fPatch; |
1289 | if(fPatch==-1) | |
1290 | pat=0; | |
108615fc | 1291 | for(Int_t i=0; i<carray.GetTree()->GetEntries(); i++){ |
1292 | if(!clusterrow[i]) continue; | |
1293 | Int_t row = rows[i]; | |
1294 | Int_t sector = sects[i]; | |
4aa41877 | 1295 | AliHLTTransform::Sector2Slice(lslice,lrow,sector,row); |
108615fc | 1296 | Int_t entries_in_row = clusterrow[i]->GetArray()->GetEntriesFast(); |
1297 | for(Int_t j = 0;j<entries_in_row;j++){ | |
1298 | AliTPCcluster *c = (AliTPCcluster*)(*clusterrow[i])[j]; | |
1299 | data[n].fZ = c->GetZ(); | |
1300 | data[n].fY = c->GetY(); | |
1301 | data[n].fX = fParam->GetPadRowRadii(sector,row); | |
8e348d6a | 1302 | data[n].fCharge = (UInt_t)c->GetQ(); |
3e87ef69 | 1303 | data[n].fID = n+((fSlice&0x7f)<<25)+((pat&0x7)<<22);//uli |
108615fc | 1304 | data[n].fPadRow = lrow; |
3e87ef69 | 1305 | data[n].fSigmaY2 = c->GetSigmaY2(); |
1306 | data[n].fSigmaZ2 = c->GetSigmaZ2(); | |
1307 | #ifdef do_mc | |
1308 | data[n].fTrackID[0] = c->GetLabel(0); | |
1309 | data[n].fTrackID[1] = c->GetLabel(1); | |
1310 | data[n].fTrackID[2] = c->GetLabel(2); | |
1311 | #endif | |
108615fc | 1312 | if(fMC) fprintf(fMC,"%d %d\n",data[n].fID,c->GetLabel(0)); |
1313 | n++; | |
1314 | } | |
1315 | } | |
1316 | for(Int_t i=0;i<carray.GetTree()->GetEntries();i++){ | |
1317 | Int_t row = rows[i]; | |
1318 | Int_t sector = sects[i]; | |
1319 | if(carray.GetRow(sector,row)) | |
1320 | carray.ClearRow(sector,row); | |
1321 | } | |
1322 | ||
1323 | delete [] clusterrow; | |
1324 | delete [] rows; | |
1325 | delete [] sects; | |
1326 | savedir->cd(); | |
1327 | ||
1328 | return data; | |
1329 | } | |
1330 |