]>
Commit | Line | Data |
---|---|---|
3c038d07 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2000, 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 | ||
88cb7938 | 16 | /* $Id$ */ |
d37f8c34 | 17 | |
f94f8f87 | 18 | /* |
19 | Class for creating of the sumable digits and digits from MC data | |
20 | // | |
21 | The input : ideal signals (Hits->Diffusion->Attachment -Ideal signal) | |
22 | The output: raw digits | |
23 | ||
24 | Effect implemented: | |
25 | 1. Pad by pad gain map | |
26 | 2. Noise map | |
27 | 3. The dead channels identified - zerro noise for corresponding pads | |
28 | In this case the outpu equal zerro | |
29 | ||
30 | */ | |
31 | ||
32 | ||
33 | ||
34 | ||
d37f8c34 | 35 | #include <stdlib.h> |
3c038d07 | 36 | #include <TTree.h> |
37 | #include <TObjArray.h> | |
38 | #include <TFile.h> | |
39 | #include <TDirectory.h> | |
19364939 | 40 | #include <Riostream.h> |
f546a4b4 | 41 | #include <TParameter.h> |
3c038d07 | 42 | |
43 | #include "AliTPCDigitizer.h" | |
44 | ||
45 | #include "AliTPC.h" | |
46 | #include "AliTPCParam.h" | |
7a09f434 | 47 | #include "AliTPCParamSR.h" |
3c038d07 | 48 | #include "AliRun.h" |
49 | #include "AliPDG.h" | |
50 | #include "AliRunDigitizer.h" | |
51 | #include "AliSimDigits.h" | |
f77f13c8 | 52 | #include "AliLog.h" |
3c038d07 | 53 | |
13116aec | 54 | #include "AliTPCcalibDB.h" |
55 | #include "AliTPCCalPad.h" | |
56 | #include "AliTPCCalROC.h" | |
57 | ||
3c038d07 | 58 | ClassImp(AliTPCDigitizer) |
59 | ||
60 | //___________________________________________ | |
179c6296 | 61 | AliTPCDigitizer::AliTPCDigitizer() :AliDigitizer(),fDebug(0) |
3c038d07 | 62 | { |
179c6296 | 63 | // |
3c038d07 | 64 | // Default ctor - don't use it |
179c6296 | 65 | // |
66 | ||
3c038d07 | 67 | } |
68 | ||
69 | //___________________________________________ | |
70 | AliTPCDigitizer::AliTPCDigitizer(AliRunDigitizer* manager) | |
179c6296 | 71 | :AliDigitizer(manager),fDebug(0) |
3c038d07 | 72 | { |
179c6296 | 73 | // |
3c038d07 | 74 | // ctor which should be used |
179c6296 | 75 | // |
f77f13c8 | 76 | AliDebug(2,"(AliRunDigitizer* manager) was processed"); |
3c038d07 | 77 | } |
78 | ||
79 | //------------------------------------------------------------------------ | |
80 | AliTPCDigitizer::~AliTPCDigitizer() | |
81 | { | |
82 | // Destructor | |
83 | } | |
84 | ||
85 | ||
86 | ||
87 | //------------------------------------------------------------------------ | |
88 | Bool_t AliTPCDigitizer::Init() | |
89 | { | |
90 | // Initialization | |
91 | ||
92 | return kTRUE; | |
93 | } | |
94 | ||
95 | ||
96 | //------------------------------------------------------------------------ | |
97 | void AliTPCDigitizer::Exec(Option_t* option) | |
f648982e | 98 | { |
99 | ExecFast(option); | |
100 | } | |
101 | //------------------------------------------------------------------------ | |
102 | void AliTPCDigitizer::ExecFast(Option_t* option) | |
3c038d07 | 103 | { |
104 | ||
105 | // merge input tree's with summable digits | |
106 | //output stored in TreeTPCD | |
7a09f434 | 107 | char s[100]; |
108 | char ss[100]; | |
3c038d07 | 109 | TString optionString = option; |
94bf739c | 110 | if (!strcmp(optionString.Data(),"deb")) { |
3c038d07 | 111 | cout<<"AliTPCDigitizer::Exec: called with option deb "<<endl; |
112 | fDebug = 3; | |
113 | } | |
114 | //get detector and geometry | |
88cb7938 | 115 | |
116 | ||
117 | AliRunLoader *rl, *orl; | |
118 | AliLoader *gime, *ogime; | |
119 | ||
120 | if (gAlice == 0x0) | |
121 | { | |
122 | Warning("ExecFast","gAlice is NULL. Loading from input 0"); | |
123 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); | |
124 | if (rl == 0x0) | |
125 | { | |
126 | Error("ExecFast","Can not find Run Loader for input 0. Can not proceed."); | |
127 | return; | |
128 | } | |
129 | rl->LoadgAlice(); | |
130 | rl->GetAliRun(); | |
131 | } | |
3c038d07 | 132 | AliTPC *pTPC = (AliTPC *) gAlice->GetModule("TPC"); |
133 | AliTPCParam * param = pTPC->GetParam(); | |
7a09f434 | 134 | |
135 | sprintf(s,param->GetTitle()); | |
136 | sprintf(ss,"75x40_100x60"); | |
137 | if(strcmp(s,ss)==0){ | |
138 | printf("2 pad-length geom hits with 3 pad-lenght geom digits...\n"); | |
139 | delete param; | |
140 | param=new AliTPCParamSR(); | |
141 | } | |
142 | else{ | |
143 | sprintf(ss,"75x40_100x60_150x60"); | |
144 | if(strcmp(s,ss)!=0) { | |
145 | printf("No TPC parameters found...\n"); | |
146 | exit(2); | |
147 | } | |
148 | } | |
149 | ||
f546a4b4 | 150 | pTPC->GenerNoise(500000); //create table with noise |
407ff276 | 151 | // |
152 | Int_t nInputs = fManager->GetNinputs(); | |
153 | Int_t * masks = new Int_t[nInputs]; | |
154 | for (Int_t i=0; i<nInputs;i++) | |
155 | masks[i]= fManager->GetMask(i); | |
156 | Short_t **pdig= new Short_t*[nInputs]; //pointers to the expanded digits array | |
f546a4b4 | 157 | Int_t **ptr= new Int_t*[nInputs]; //pointers to the expanded tracks array |
4df28b43 | 158 | Bool_t *active= new Bool_t[nInputs]; //flag for active input segments |
f546a4b4 | 159 | Char_t phname[100]; |
88cb7938 | 160 | |
3c038d07 | 161 | //create digits array for given sectors |
f648982e | 162 | // make indexes |
f546a4b4 | 163 | // |
164 | //create branch's in TPC treeD | |
165 | orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); | |
166 | ogime = orl->GetLoader("TPCLoader"); | |
167 | TTree * tree = ogime->TreeD(); | |
168 | AliSimDigits * digrow = new AliSimDigits; | |
169 | ||
170 | if (tree == 0x0) | |
171 | { | |
172 | ogime->MakeTree("D"); | |
173 | tree = ogime->TreeD(); | |
174 | } | |
175 | tree->Branch("Segment","AliSimDigits",&digrow); | |
176 | // | |
407ff276 | 177 | AliSimDigits ** digarr = new AliSimDigits*[nInputs]; |
88cb7938 | 178 | for (Int_t i1=0;i1<nInputs; i1++) |
179 | { | |
180 | digarr[i1]=0; | |
181 | // intree[i1] | |
182 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i1)); | |
183 | gime = rl->GetLoader("TPCLoader"); | |
184 | gime->LoadSDigits("read"); | |
185 | TTree * treear = gime->TreeS(); | |
186 | ||
187 | if (!treear) | |
188 | { | |
189 | cerr<<"AliTPCDigitizer: Input tree with SDigits not found in" | |
190 | <<" input "<< i1<<endl; | |
712976a6 | 191 | for (Int_t i2=0;i2<i1+1; i2++){ |
192 | ||
193 | if(digarr[i2]) delete digarr[i2]; | |
194 | } | |
195 | delete [] digarr; | |
196 | delete [] active; | |
197 | delete []masks; | |
198 | delete []pdig; | |
199 | delete []ptr; | |
88cb7938 | 200 | return; |
201 | } | |
f546a4b4 | 202 | |
203 | sprintf(phname,"lhcphase%d",i1); | |
204 | TParameter<float> *ph = (TParameter<float>*)treear->GetUserInfo() | |
205 | ->FindObject("lhcphase0"); | |
206 | if(!ph){ | |
207 | cerr<<"AliTPCDigitizer: LHC phase not found in" | |
208 | <<" input "<< i1<<endl; | |
712976a6 | 209 | for (Int_t i2=0;i2<i1+1; i2++){ |
210 | if(digarr[i2]) delete digarr[i2]; | |
211 | } | |
212 | delete [] digarr; | |
213 | delete [] active; | |
214 | delete []masks; | |
215 | delete []pdig; | |
216 | delete []ptr; | |
f546a4b4 | 217 | return; |
218 | } | |
219 | tree->GetUserInfo()->Add(new TParameter<float>(phname,ph->GetVal())); | |
220 | // | |
88cb7938 | 221 | if (treear->GetIndex()==0) |
222 | treear->BuildIndex("fSegmentID","fSegmentID"); | |
223 | treear->GetBranch("Segment")->SetAddress(&digarr[i1]); | |
12d8d654 | 224 | } |
88cb7938 | 225 | |
3c038d07 | 226 | |
88cb7938 | 227 | |
f546a4b4 | 228 | |
3c038d07 | 229 | // |
230 | ||
407ff276 | 231 | param->SetZeroSup(2); |
232 | ||
f648982e | 233 | Int_t zerosup = param->GetZeroSup(); |
5033a39a | 234 | AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetDedxGainFactor(); |
1ac191a6 | 235 | AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise(); |
f648982e | 236 | // |
3c038d07 | 237 | //Loop over segments of the TPC |
238 | ||
4df28b43 | 239 | for (Int_t segmentID=0; segmentID<param->GetNRowsTotal(); segmentID++) |
88cb7938 | 240 | { |
4df28b43 | 241 | Int_t sec, row; |
242 | if (!param->AdjustSectorRow(segmentID,sec,row)) | |
243 | { | |
244 | cerr<<"AliTPC warning: invalid segment ID ! "<<segmentID<<endl; | |
245 | continue; | |
246 | } | |
13116aec | 247 | AliTPCCalROC * gainROC = gainTPC->GetCalROC(sec); // pad gains per given sector |
1ac191a6 | 248 | AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(sec); // noise per given sector |
4df28b43 | 249 | digrow->SetID(segmentID); |
250 | ||
251 | Int_t nrows = 0; | |
252 | Int_t ncols = 0; | |
253 | ||
254 | Bool_t digitize = kFALSE; | |
255 | for (Int_t i=0;i<nInputs; i++) | |
88cb7938 | 256 | { |
257 | ||
258 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i)); | |
259 | gime = rl->GetLoader("TPCLoader"); | |
260 | ||
4df28b43 | 261 | if (gime->TreeS()->GetEntryWithIndex(segmentID,segmentID) >= 0) { |
262 | digarr[i]->ExpandBuffer(); | |
263 | digarr[i]->ExpandTrackBuffer(); | |
264 | nrows = digarr[i]->GetNRows(); | |
265 | ncols = digarr[i]->GetNCols(); | |
266 | active[i] = kTRUE; | |
267 | if (!fRegionOfInterest || (i == 0)) digitize = kTRUE; | |
268 | } else { | |
269 | active[i] = kFALSE; | |
270 | } | |
271 | if (fRegionOfInterest && !digitize) break; | |
88cb7938 | 272 | } |
4df28b43 | 273 | if (!digitize) continue; |
3c038d07 | 274 | |
3c038d07 | 275 | digrow->Allocate(nrows,ncols); |
276 | digrow->AllocateTrack(3); | |
277 | ||
407ff276 | 278 | Float_t q=0; |
279 | Int_t label[1000]; //stack for 300 events | |
280 | Int_t labptr = 0; | |
281 | ||
f648982e | 282 | Int_t nElems = nrows*ncols; |
283 | ||
88cb7938 | 284 | for (Int_t i=0;i<nInputs; i++) |
4df28b43 | 285 | if (active[i]) { |
88cb7938 | 286 | pdig[i] = digarr[i]->GetDigits(); |
287 | ptr[i] = digarr[i]->GetTracks(); | |
4df28b43 | 288 | } |
88cb7938 | 289 | |
407ff276 | 290 | Short_t *pdig1= digrow->GetDigits(); |
291 | Int_t *ptr1= digrow->GetTracks() ; | |
292 | ||
f648982e | 293 | |
407ff276 | 294 | |
88cb7938 | 295 | for (Int_t elem=0;elem<nElems; elem++) |
296 | { | |
297 | ||
298 | q=0; | |
299 | labptr=0; | |
300 | // looop over digits | |
4df28b43 | 301 | for (Int_t i=0;i<nInputs; i++) if (active[i]) |
88cb7938 | 302 | { |
303 | // q += digarr[i]->GetDigitFast(rows,col); | |
304 | q += *(pdig[i]); | |
305 | ||
306 | for (Int_t tr=0;tr<3;tr++) | |
307 | { | |
308 | // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); | |
309 | Int_t lab = ptr[i][tr*nElems]; | |
310 | if ( (lab > 1) && *(pdig[i])>zerosup) | |
311 | { | |
312 | label[labptr]=lab+masks[i]; | |
313 | labptr++; | |
314 | } | |
315 | } | |
316 | pdig[i]++; | |
317 | ptr[i]++; | |
318 | } | |
319 | q/=16.; //conversion factor | |
13116aec | 320 | Float_t gain = gainROC->GetValue(row,elem/nrows); // get gain for given - pad-row pad |
ebf9a79e | 321 | //if (gain<0.5){ |
322 | //printf("problem\n"); | |
323 | //} | |
13116aec | 324 | q*= gain; |
1ac191a6 | 325 | Float_t noisePad = noiseROC->GetValue(row,elem/nrows); |
88cb7938 | 326 | // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); |
327 | Float_t noise = pTPC->GetNoise(); | |
1ac191a6 | 328 | q+=noise*noisePad; |
3c038d07 | 329 | q=TMath::Nint(q); |
88cb7938 | 330 | if (q > zerosup) |
331 | { | |
e93a083a | 332 | if(q >= param->GetADCSat()) q = (Short_t)(param->GetADCSat() - 1); |
88cb7938 | 333 | //digrow->SetDigitFast((Short_t)q,rows,col); |
334 | *pdig1 =Short_t(q); | |
335 | for (Int_t tr=0;tr<3;tr++) | |
336 | { | |
337 | if (tr<labptr) | |
338 | ptr1[tr*nElems] = label[tr]; | |
339 | } | |
340 | } | |
341 | pdig1++; | |
342 | ptr1++; | |
343 | } | |
58c45a5e | 344 | // |
345 | // glitch filter | |
346 | // | |
347 | digrow->GlitchFilter(); | |
348 | // | |
3c038d07 | 349 | digrow->CompresBuffer(1,zerosup); |
350 | digrow->CompresTrackBuffer(1); | |
351 | tree->Fill(); | |
352 | if (fDebug>0) cerr<<sec<<"\t"<<row<<"\n"; | |
4df28b43 | 353 | } //for (Int_t n=0; n<param->GetNRowsTotal(); n++) |
88cb7938 | 354 | |
355 | ||
356 | orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); | |
357 | ogime = orl->GetLoader("TPCLoader"); | |
358 | ogime->WriteDigits("OVERWRITE"); | |
359 | ||
360 | //fManager->GetTreeDTPC()->Write(0,TObject::kOverwrite); | |
361 | ||
3c038d07 | 362 | delete digrow; |
407ff276 | 363 | for (Int_t i1=0;i1<nInputs; i1++) delete digarr[i1]; |
364 | delete []masks; | |
4df28b43 | 365 | delete []pdig; |
366 | delete []ptr; | |
367 | delete []active; | |
368 | delete []digarr; | |
3c038d07 | 369 | } |
370 | ||
f648982e | 371 | |
372 | ||
373 | //------------------------------------------------------------------------ | |
374 | void AliTPCDigitizer::ExecSave(Option_t* option) | |
375 | { | |
376 | ||
377 | // merge input tree's with summable digits | |
378 | //output stored in TreeTPCD | |
379 | ||
380 | TString optionString = option; | |
94bf739c | 381 | if (!strcmp(optionString.Data(),"deb")) { |
f648982e | 382 | cout<<"AliTPCDigitizer::Exec: called with option deb "<<endl; |
383 | fDebug = 3; | |
384 | } | |
385 | //get detector and geometry | |
88cb7938 | 386 | AliRunLoader *rl, *orl; |
387 | AliLoader *gime, *ogime; | |
388 | ||
389 | ||
390 | orl = AliRunLoader::GetRunLoader(fManager->GetOutputFolderName()); | |
391 | ogime = orl->GetLoader("TPCLoader"); | |
392 | ||
393 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); | |
394 | gime = rl->GetLoader("TPCLoader"); | |
395 | ||
396 | rl->LoadgAlice(); | |
397 | AliRun* alirun = rl->GetAliRun(); | |
398 | ||
399 | AliTPC *pTPC = (AliTPC *) alirun->GetModule("TPC"); | |
f648982e | 400 | AliTPCParam * param = pTPC->GetParam(); |
401 | pTPC->GenerNoise(500000); //create teble with noise | |
402 | printf("noise %f \n", param->GetNoise()*param->GetNoiseNormFac()); | |
403 | // | |
404 | Int_t nInputs = fManager->GetNinputs(); | |
405 | Int_t * masks = new Int_t[nInputs]; | |
406 | for (Int_t i=0; i<nInputs;i++) | |
407 | masks[i]= fManager->GetMask(i); | |
f648982e | 408 | |
606d6545 | 409 | AliSimDigits ** digarr = new AliSimDigits*[nInputs]; |
410 | for(Int_t ii=0;ii<nInputs;ii++) digarr[ii]=0; | |
411 | ||
88cb7938 | 412 | for (Int_t i1=0;i1<nInputs; i1++) |
413 | { | |
606d6545 | 414 | //digarr[i1]=0; |
f648982e | 415 | // intree[i1] |
88cb7938 | 416 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i1)); |
417 | gime = rl->GetLoader("TPCLoader"); | |
418 | ||
419 | TTree * treear = gime->TreeS(); | |
de0e19ab | 420 | // |
f648982e | 421 | if (!treear) { |
de0e19ab | 422 | cerr<<" TPC - not existing input = \n"<<i1<<" "; |
423 | delete [] masks; | |
424 | for(Int_t i=0; i<nInputs; i++) delete digarr[i]; | |
425 | delete [] digarr; | |
426 | return; | |
f648982e | 427 | } |
de0e19ab | 428 | // |
429 | TBranch * br = treear->GetBranch("fSegmentID"); | |
430 | if (br) br->GetFile()->cd(); | |
f648982e | 431 | treear->GetBranch("Segment")->SetAddress(&digarr[i1]); |
de0e19ab | 432 | } |
88cb7938 | 433 | |
434 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); | |
435 | gime = rl->GetLoader("TPCLoader"); | |
436 | Stat_t nentries = gime->TreeS()->GetEntries(); | |
f648982e | 437 | |
438 | ||
439 | //create branch's in TPC treeD | |
440 | AliSimDigits * digrow = new AliSimDigits; | |
88cb7938 | 441 | TTree * tree = ogime->TreeD(); |
442 | ||
f648982e | 443 | tree->Branch("Segment","AliSimDigits",&digrow); |
f648982e | 444 | param->SetZeroSup(2); |
445 | ||
446 | Int_t zerosup = param->GetZeroSup(); | |
447 | //Loop over segments of the TPC | |
448 | ||
5033a39a | 449 | AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetDedxGainFactor(); |
1ac191a6 | 450 | AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise(); |
f648982e | 451 | for (Int_t n=0; n<nentries; n++) { |
88cb7938 | 452 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(0)); |
453 | gime = rl->GetLoader("TPCLoader"); | |
454 | gime->TreeS()->GetEvent(n); | |
455 | ||
f648982e | 456 | digarr[0]->ExpandBuffer(); |
457 | digarr[0]->ExpandTrackBuffer(); | |
13116aec | 458 | |
459 | ||
f648982e | 460 | for (Int_t i=1;i<nInputs; i++){ |
88cb7938 | 461 | // fManager->GetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); |
462 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i)); | |
463 | gime = rl->GetLoader("TPCLoader"); | |
464 | gime->TreeS()->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID()); | |
f648982e | 465 | digarr[i]->ExpandBuffer(); |
466 | digarr[i]->ExpandTrackBuffer(); | |
467 | if ((digarr[0]->GetID()-digarr[i]->GetID())>0) | |
88cb7938 | 468 | printf("problem\n"); |
f648982e | 469 | |
470 | } | |
471 | ||
472 | Int_t sec, row; | |
473 | if (!param->AdjustSectorRow(digarr[0]->GetID(),sec,row)) { | |
474 | cerr<<"AliTPC warning: invalid segment ID ! "<<digarr[0]->GetID()<<endl; | |
475 | continue; | |
476 | } | |
477 | ||
13116aec | 478 | AliTPCCalROC * gainROC = gainTPC->GetCalROC(sec); // pad gains per given sector |
1ac191a6 | 479 | AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(sec); // noise per given sector |
f648982e | 480 | digrow->SetID(digarr[0]->GetID()); |
481 | ||
482 | Int_t nrows = digarr[0]->GetNRows(); | |
483 | Int_t ncols = digarr[0]->GetNCols(); | |
484 | digrow->Allocate(nrows,ncols); | |
485 | digrow->AllocateTrack(3); | |
486 | ||
487 | Float_t q=0; | |
488 | Int_t label[1000]; //stack for 300 events | |
489 | Int_t labptr = 0; | |
490 | ||
491 | ||
492 | ||
493 | for (Int_t rows=0;rows<nrows; rows++){ | |
494 | for (Int_t col=0;col<ncols; col++){ | |
495 | ||
88cb7938 | 496 | q=0; |
497 | labptr=0; | |
498 | // looop over digits | |
f648982e | 499 | for (Int_t i=0;i<nInputs; i++){ |
88cb7938 | 500 | q += digarr[i]->GetDigitFast(rows,col); |
f648982e | 501 | //q += *(pdig[i]); |
88cb7938 | 502 | |
f648982e | 503 | for (Int_t tr=0;tr<3;tr++) { |
88cb7938 | 504 | Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr); |
505 | //Int_t lab = ptr[i][tr*nElems]; | |
f648982e | 506 | if ( (lab > 1) ) { |
507 | label[labptr]=lab+masks[i]; | |
508 | labptr++; | |
88cb7938 | 509 | } |
f648982e | 510 | } |
88cb7938 | 511 | // pdig[i]++; |
512 | //ptr[i]++; | |
513 | ||
f648982e | 514 | } |
88cb7938 | 515 | q/=16.; //conversion factor |
516 | // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac()); | |
13116aec | 517 | Float_t gain = gainROC->GetValue(row,col); |
518 | q*= gain; | |
1ac191a6 | 519 | Float_t noisePad = noiseROC->GetValue(row, col); |
520 | ||
88cb7938 | 521 | Float_t noise = pTPC->GetNoise(); |
1ac191a6 | 522 | q+=noise*noisePad; |
633fa37f | 523 | |
f648982e | 524 | q=TMath::Nint(q); |
525 | if (q > zerosup){ | |
88cb7938 | 526 | |
e93a083a | 527 | if(q >= param->GetADCSat()) q = (Short_t)(param->GetADCSat() - 1); |
88cb7938 | 528 | digrow->SetDigitFast((Short_t)q,rows,col); |
529 | // *pdig1 =Short_t(q); | |
530 | for (Int_t tr=0;tr<3;tr++){ | |
531 | if (tr<labptr) | |
532 | ((AliSimDigits*)digrow)->SetTrackIDFast(label[tr],rows,col,tr); | |
533 | //ptr1[tr*nElems] = label[tr]; | |
534 | //else | |
535 | // ((AliSimDigits*)digrow)->SetTrackIDFast(-1,rows,col,tr); | |
536 | // ptr1[tr*nElems] = 1; | |
537 | } | |
538 | } | |
539 | //pdig1++; | |
540 | //ptr1++; | |
f648982e | 541 | } |
542 | } | |
543 | ||
544 | digrow->CompresBuffer(1,zerosup); | |
545 | digrow->CompresTrackBuffer(1); | |
546 | tree->Fill(); | |
547 | if (fDebug>0) cerr<<sec<<"\t"<<row<<"\n"; | |
548 | } | |
88cb7938 | 549 | // printf("end TPC merging - end -Tree %s\t%p\n",fManager->GetInputTreeH(0)->GetName(),fManager->GetInputTreeH(0)->GetListOfBranches()->At(3)); |
550 | //fManager->GetTreeDTPC()->Write(0,TObject::kOverwrite); | |
551 | ogime->WriteDigits("OVERWRITE"); | |
552 | ||
553 | for (Int_t i=1;i<nInputs; i++) | |
554 | { | |
555 | rl = AliRunLoader::GetRunLoader(fManager->GetInputFolderName(i)); | |
556 | gime = rl->GetLoader("TPCLoader"); | |
557 | gime->UnloadSDigits(); | |
558 | } | |
559 | ogime->UnloadDigits(); | |
560 | ||
f648982e | 561 | delete digrow; |
562 | for (Int_t i1=0;i1<nInputs; i1++) delete digarr[i1]; | |
4ce766eb | 563 | delete [] masks; |
564 | delete [] digarr; | |
f648982e | 565 | } |