1 /**************************************************************************
2 * Copyright(c) 1998-2000, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
19 Class for creating of the sumable digits and digits from MC data
21 The input : ideal signals (Hits->Diffusion->Attachment -Ideal signal)
22 The output: "raw digits"
25 1. Pad by pad gain map
27 3. The dead channels identified - zerro noise for corresponding pads
28 In this case the outpu equal zerro
37 #include <TObjArray.h>
39 #include <TDirectory.h>
40 #include <Riostream.h>
41 #include <TParameter.h>
43 #include "AliTPCDigitizer.h"
46 #include "AliTPCParam.h"
47 #include "AliTPCParamSR.h"
49 #include "AliLoader.h"
51 #include "AliDigitizationInput.h"
52 #include "AliSimDigits.h"
55 #include "AliTPCcalibDB.h"
56 #include "AliTPCCalPad.h"
57 #include "AliTPCCalROC.h"
58 #include "TTreeStream.h"
63 ClassImp(AliTPCDigitizer)
65 //___________________________________________
66 AliTPCDigitizer::AliTPCDigitizer() :AliDigitizer(),fDebug(0)
69 // Default ctor - don't use it
74 //___________________________________________
75 AliTPCDigitizer::AliTPCDigitizer(AliDigitizationInput* digInput)
76 :AliDigitizer(digInput),fDebug(0)
79 // ctor which should be used
81 AliDebug(2,"(AliDigitizationInput* digInput) was processed");
84 //------------------------------------------------------------------------
85 AliTPCDigitizer::~AliTPCDigitizer()
92 //------------------------------------------------------------------------
93 Bool_t AliTPCDigitizer::Init()
101 //------------------------------------------------------------------------
102 void AliTPCDigitizer::Digitize(Option_t* option)
104 DigitizeFast(option);
106 //------------------------------------------------------------------------
107 void AliTPCDigitizer::DigitizeFast(Option_t* option)
110 // merge input tree's with summable digits
111 //output stored in TreeTPCD
114 TString optionString = option;
115 if (!strcmp(optionString.Data(),"deb")) {
116 cout<<"AliTPCDigitizer:::DigitizeFast called with option deb "<<endl;
119 //get detector and geometry
122 AliRunLoader *rl, *orl;
123 AliLoader *gime, *ogime;
127 Warning("DigitizeFast","gAlice is NULL. Loading from input 0");
128 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(0));
131 Error("DigitizeFast","Can not find Run Loader for input 0. Can not proceed.");
137 AliTPC *pTPC = (AliTPC *) gAlice->GetModule("TPC");
138 AliTPCParam * param = pTPC->GetParam();
140 //sprintf(s,param->GetTitle());
141 snprintf(s,100,"%s",param->GetTitle());
142 //sprintf(ss,"75x40_100x60");
143 snprintf(ss,100,"75x40_100x60");
145 printf("2 pad-length geom hits with 3 pad-lenght geom digits...\n");
147 param=new AliTPCParamSR();
150 //sprintf(ss,"75x40_100x60_150x60");
151 snprintf(ss,100,"75x40_100x60_150x60");
152 if(strcmp(s,ss)!=0) {
153 printf("No TPC parameters found...\n");
158 pTPC->GenerNoise(500000); //create table with noise
160 Int_t nInputs = fDigInput->GetNinputs();
161 Int_t * masks = new Int_t[nInputs];
162 for (Int_t i=0; i<nInputs;i++)
163 masks[i]= fDigInput->GetMask(i);
164 Short_t **pdig= new Short_t*[nInputs]; //pointers to the expanded digits array
165 Int_t **ptr= new Int_t*[nInputs]; //pointers to the expanded tracks array
166 Bool_t *active= new Bool_t[nInputs]; //flag for active input segments
169 //create digits array for given sectors
172 //create branch's in TPC treeD
173 orl = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
174 ogime = orl->GetLoader("TPCLoader");
175 TTree * tree = ogime->TreeD();
176 AliSimDigits * digrow = new AliSimDigits;
180 ogime->MakeTree("D");
181 tree = ogime->TreeD();
183 tree->Branch("Segment","AliSimDigits",&digrow);
185 AliSimDigits ** digarr = new AliSimDigits*[nInputs];
186 for (Int_t i1=0;i1<nInputs; i1++)
190 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i1));
191 gime = rl->GetLoader("TPCLoader");
192 gime->LoadSDigits("read");
193 TTree * treear = gime->TreeS();
197 cerr<<"AliTPCDigitizer: Input tree with SDigits not found in"
198 <<" input "<< i1<<endl;
199 for (Int_t i2=0;i2<i1+1; i2++){
201 if(digarr[i2]) delete digarr[i2];
211 //sprintf(phname,"lhcphase%d",i1);
212 snprintf(phname,100,"lhcphase%d",i1);
213 TParameter<float> *ph = (TParameter<float>*)treear->GetUserInfo()
214 ->FindObject("lhcphase0");
216 cerr<<"AliTPCDigitizer: LHC phase not found in"
217 <<" input "<< i1<<endl;
218 for (Int_t i2=0;i2<i1+1; i2++){
219 if(digarr[i2]) delete digarr[i2];
228 tree->GetUserInfo()->Add(new TParameter<float>(phname,ph->GetVal()));
230 if (treear->GetIndex()==0)
231 treear->BuildIndex("fSegmentID","fSegmentID");
232 treear->GetBranch("Segment")->SetAddress(&digarr[i1]);
240 param->SetZeroSup(2);
242 Int_t zerosup = param->GetZeroSup();
243 AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetDedxGainFactor();
244 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
246 //Loop over segments of the TPC
248 for (Int_t segmentID=0; segmentID<param->GetNRowsTotal(); segmentID++)
250 Int_t sector, padRow;
251 if (!param->AdjustSectorRow(segmentID,sector,padRow))
253 cerr<<"AliTPC warning: invalid segment ID ! "<<segmentID<<endl;
256 AliTPCCalROC * gainROC = gainTPC->GetCalROC(sector); // pad gains per given sector
257 AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(sector); // noise per given sector
258 digrow->SetID(segmentID);
263 Bool_t digitize = kFALSE;
264 for (Int_t i=0;i<nInputs; i++)
267 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i));
268 gime = rl->GetLoader("TPCLoader");
270 if (gime->TreeS()->GetEntryWithIndex(segmentID,segmentID) >= 0) {
271 digarr[i]->ExpandBuffer();
272 digarr[i]->ExpandTrackBuffer();
273 nTimeBins = digarr[i]->GetNRows();
274 nPads = digarr[i]->GetNCols();
276 if (!GetRegionOfInterest() || (i == 0)) digitize = kTRUE;
280 if (GetRegionOfInterest() && !digitize) break;
282 if (!digitize) continue;
284 digrow->Allocate(nTimeBins,nPads);
285 digrow->AllocateTrack(3);
288 Int_t label[1000]; //stack for 300 events
291 Int_t nElems = nTimeBins*nPads;
293 for (Int_t i=0;i<nInputs; i++)
295 pdig[i] = digarr[i]->GetDigits();
296 ptr[i] = digarr[i]->GetTracks();
299 Short_t *pdig1= digrow->GetDigits();
300 Int_t *ptr1= digrow->GetTracks() ;
304 for (Int_t elem=0;elem<nElems; elem++)
310 for (Int_t i=0;i<nInputs; i++) if (active[i])
312 // q += digarr[i]->GetDigitFast(rows,col);
315 for (Int_t tr=0;tr<3;tr++)
317 // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr);
318 Int_t lab = ptr[i][tr*nElems];
319 if ( (lab > 1) && *(pdig[i])>zerosup)
321 label[labptr]=lab+masks[i];
328 q/=16.; //conversion factor
329 Float_t gain = gainROC->GetValue(padRow,elem/nTimeBins); // get gain for given - pad-row pad
331 //printf("problem\n");
334 Float_t noisePad = noiseROC->GetValue(padRow,elem/nTimeBins);
335 // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac());
336 Float_t noise = pTPC->GetNoise();
341 if(q >= param->GetADCSat()) q = (Short_t)(param->GetADCSat() - 1);
342 //digrow->SetDigitFast((Short_t)q,rows,col);
344 for (Int_t tr=0;tr<3;tr++)
347 ptr1[tr*nElems] = label[tr];
356 digrow->GlitchFilter();
358 digrow->CompresBuffer(1,zerosup);
359 digrow->CompresTrackBuffer(1);
361 if (fDebug>0) cerr<<sector<<"\t"<<padRow<<"\n";
362 } //for (Int_t n=0; n<param->GetNRowsTotal(); n++)
365 orl = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
366 ogime = orl->GetLoader("TPCLoader");
367 ogime->WriteDigits("OVERWRITE");
369 //fDigInput->GetTreeDTPC()->Write(0,TObject::kOverwrite);
372 for (Int_t i1=0;i1<nInputs; i1++) delete digarr[i1];
382 //------------------------------------------------------------------------
383 void AliTPCDigitizer::DigitizeSave(Option_t* option)
386 // Merge input tree's with summable digits
387 // Output digits stored in TreeTPCD
389 // Not active for long time.
390 // Before adding modification (for ion tail calucation and for the crorsstalk) it should be
391 // checked one by one with currenlty used AliTPCDigitizer::DigitizeFast
393 TString optionString = option;
394 if (!strcmp(optionString.Data(),"deb")) {
395 cout<<"AliTPCDigitizer::Digitize: called with option deb "<<endl;
398 //get detector and geometry
399 AliRunLoader *rl, *orl;
400 AliLoader *gime, *ogime;
403 orl = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
404 ogime = orl->GetLoader("TPCLoader");
406 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(0));
407 //gime = rl->GetLoader("TPCLoader");
408 rl->GetLoader("TPCLoader");
410 AliRun* alirun = rl->GetAliRun();
412 AliTPC *pTPC = (AliTPC *) alirun->GetModule("TPC");
413 AliTPCParam * param = pTPC->GetParam();
414 pTPC->GenerNoise(500000); //create teble with noise
415 printf("noise %f \n", param->GetNoise()*param->GetNoiseNormFac());
417 Int_t nInputs = fDigInput->GetNinputs();
418 // stupid protection...
419 if (nInputs <= 0) return;
421 Int_t * masks = new Int_t[nInputs];
422 for (Int_t i=0; i<nInputs;i++)
423 masks[i]= fDigInput->GetMask(i);
425 AliSimDigits ** digarr = new AliSimDigits*[nInputs];
426 for(Int_t ii=0;ii<nInputs;ii++) digarr[ii]=0;
428 for (Int_t i1=0;i1<nInputs; i1++)
432 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i1));
433 gime = rl->GetLoader("TPCLoader");
435 TTree * treear = gime->TreeS();
438 cerr<<" TPC - not existing input = \n"<<i1<<" ";
440 for(Int_t i=0; i<nInputs; i++) delete digarr[i];
445 TBranch * br = treear->GetBranch("fSegmentID");
446 if (br) br->GetFile()->cd();
447 treear->GetBranch("Segment")->SetAddress(&digarr[i1]);
450 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(0));
451 gime = rl->GetLoader("TPCLoader");
452 Stat_t nentries = gime->TreeS()->GetEntries();
455 //create branch's in TPC treeD
456 AliSimDigits * digrow = new AliSimDigits;
457 TTree * tree = ogime->TreeD();
459 tree->Branch("Segment","AliSimDigits",&digrow);
460 param->SetZeroSup(2);
462 Int_t zerosup = param->GetZeroSup();
463 //Loop over segments of the TPC
465 AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetDedxGainFactor();
466 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
467 for (Int_t n=0; n<nentries; n++) {
468 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(0));
469 gime = rl->GetLoader("TPCLoader");
470 gime->TreeS()->GetEvent(n);
472 digarr[0]->ExpandBuffer();
473 digarr[0]->ExpandTrackBuffer();
476 for (Int_t i=1;i<nInputs; i++){
477 // fDigInput->GetInputTreeTPCS(i)->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID());
478 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i));
479 gime = rl->GetLoader("TPCLoader");
480 gime->TreeS()->GetEntryWithIndex(digarr[0]->GetID(),digarr[0]->GetID());
481 digarr[i]->ExpandBuffer();
482 digarr[i]->ExpandTrackBuffer();
483 if ((digarr[0]->GetID()-digarr[i]->GetID())>0)
488 Int_t sector, padRow;
489 if (!param->AdjustSectorRow(digarr[0]->GetID(),sector,padRow)) {
490 cerr<<"AliTPC warning: invalid segment ID ! "<<digarr[0]->GetID()<<endl;
494 AliTPCCalROC * gainROC = gainTPC->GetCalROC(sector); // pad gains per given sector
495 AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(sector); // noise per given sector
496 digrow->SetID(digarr[0]->GetID());
498 Int_t nTimeBins = digarr[0]->GetNRows();
499 Int_t nPads = digarr[0]->GetNCols();
500 digrow->Allocate(nTimeBins,nPads);
501 digrow->AllocateTrack(3);
504 Int_t label[1000]; //stack for 300 events
509 for (Int_t iTimeBin=0;iTimeBin<nTimeBins; iTimeBin++){ // iTimeBin
510 for (Int_t iPad=0;iPad<nPads; iPad++){ // pad
515 for (Int_t i=0;i<nInputs; i++){
516 q += digarr[i]->GetDigitFast(iTimeBin,iPad);
519 for (Int_t tr=0;tr<3;tr++) {
520 Int_t lab = digarr[i]->GetTrackIDFast(iTimeBin,iPad,tr);
521 //Int_t lab = ptr[i][tr*nElems];
523 label[labptr]=lab+masks[i];
531 q/=16.; //conversion factor
532 // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac());
533 Float_t gain = gainROC->GetValue(padRow,iPad);
535 Float_t noisePad = noiseROC->GetValue(padRow, iPad);
537 Float_t noise = pTPC->GetNoise();
540 // here we can get digits from past and add signal
543 //for (Int_t jTimeBin=0; jTimeBin<iTimeBin; jTimeBin++)
550 if(q >= param->GetADCSat()) q = (Short_t)(param->GetADCSat() - 1);
551 digrow->SetDigitFast((Short_t)q,iTimeBin,iPad);
552 // *pdig1 =Short_t(q);
553 for (Int_t tr=0;tr<3;tr++){
555 ((AliSimDigits*)digrow)->SetTrackIDFast(label[tr],iTimeBin,iPad,tr);
556 //ptr1[tr*nElems] = label[tr];
558 // ((AliSimDigits*)digrow)->SetTrackIDFast(-1,iTimeBin,iPad,tr);
559 // ptr1[tr*nElems] = 1;
567 digrow->CompresBuffer(1,zerosup);
568 digrow->CompresTrackBuffer(1);
570 if (fDebug>0) cerr<<sector<<"\t"<<padRow<<"\n";
572 // printf("end TPC merging - end -Tree %s\t%p\n",fDigInput->GetInputTreeH(0)->GetName(),fDigInput->GetInputTreeH(0)->GetListOfBranches()->At(3));
573 //fDigInput->GetTreeDTPC()->Write(0,TObject::kOverwrite);
574 ogime->WriteDigits("OVERWRITE");
576 for (Int_t i=1;i<nInputs; i++)
578 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i));
579 gime = rl->GetLoader("TPCLoader");
580 gime->UnloadSDigits();
582 ogime->UnloadDigits();
585 for (Int_t i1=0;i1<nInputs; i1++) delete digarr[i1];
592 //------------------------------------------------------------------------
593 void AliTPCDigitizer::DigitizeWithTailAndCrossTalk(Option_t* option, TTreeSredirector *pcstream)
595 // Modified version of the digitization function
596 // Modification: adding the ion tail and crosstalk:
598 // pcstream used in order to visually inspect data
601 // Crosstalk simulation:
602 // 1.) Calculate per time bin mean charge (per pad) within anode wire segment
603 // 2.) Subsract for the clusters at given time bin fraction of (mean charge) normalized by add hoc constant
604 // AliTPCRecoParam::GetCrosstalkCorrection() (0 if not crosstalk, 1 if ideal crosstalk)
605 // for simplicity we are assuming that wire segents are related to pad-rows
606 // Wire segmentationn is obtatined from the
607 // AliTPCParam::GetWireSegment(Int_t sector, Int_t row); // to be implemented
608 // AliTPCParam::GetNPadsPerSegment(Int_t segmentID); // to be implemented
610 // Ion tail simulation:
611 // 1.) Needs signal from pad+-1, taking signal from history
612 // merge input tree's with summable digits
613 // output stored in TreeTPCD
617 TString optionString = option;
618 if (!strcmp(optionString.Data(),"deb")) {
619 cout<<"AliTPCDigitizer:::DigitizeFast called with option deb "<<endl;
622 //get detector and geometry
625 AliRunLoader *rl, *orl;
626 AliLoader *gime, *ogime;
630 Warning("DigitizeFast","gAlice is NULL. Loading from input 0");
631 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(0));
634 Error("DigitizeFast","Can not find Run Loader for input 0. Can not proceed.");
640 AliTPC *pTPC = (AliTPC *) gAlice->GetModule("TPC");
641 AliTPCParam * param = pTPC->GetParam();
643 //sprintf(s,param->GetTitle());
644 snprintf(s,100,"%s",param->GetTitle());
645 //sprintf(ss,"75x40_100x60");
646 snprintf(ss,100,"75x40_100x60");
648 printf("2 pad-length geom hits with 3 pad-lenght geom digits...\n");
650 param=new AliTPCParamSR();
653 //sprintf(ss,"75x40_100x60_150x60");
654 snprintf(ss,100,"75x40_100x60_150x60");
655 if(strcmp(s,ss)!=0) {
656 printf("No TPC parameters found...\n");
661 pTPC->GenerNoise(500000); //create table with noise
663 Int_t nInputs = fDigInput->GetNinputs();
664 Int_t * masks = new Int_t[nInputs];
665 for (Int_t i=0; i<nInputs;i++)
666 masks[i]= fDigInput->GetMask(i);
667 Short_t **pdig= new Short_t*[nInputs]; //pointers to the expanded digits array
668 Int_t **ptr= new Int_t*[nInputs]; //pointers to the expanded tracks array
669 Bool_t *active= new Bool_t[nInputs]; //flag for active input segments
672 //create digits array for given sectors
675 //create branch's in TPC treeD
676 orl = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
677 ogime = orl->GetLoader("TPCLoader");
678 TTree * tree = ogime->TreeD();
679 AliSimDigits * digrow = new AliSimDigits;
683 ogime->MakeTree("D");
684 tree = ogime->TreeD();
686 tree->Branch("Segment","AliSimDigits",&digrow);
688 AliSimDigits ** digarr = new AliSimDigits*[nInputs];
689 for (Int_t i1=0;i1<nInputs; i1++)
693 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i1));
694 gime = rl->GetLoader("TPCLoader");
695 gime->LoadSDigits("read");
696 TTree * treear = gime->TreeS();
700 cerr<<"AliTPCDigitizer: Input tree with SDigits not found in"
701 <<" input "<< i1<<endl;
702 for (Int_t i2=0;i2<i1+1; i2++){
704 if(digarr[i2]) delete digarr[i2];
714 //sprintf(phname,"lhcphase%d",i1);
715 snprintf(phname,100,"lhcphase%d",i1);
716 TParameter<float> *ph = (TParameter<float>*)treear->GetUserInfo()
717 ->FindObject("lhcphase0");
719 cerr<<"AliTPCDigitizer: LHC phase not found in"
720 <<" input "<< i1<<endl;
721 for (Int_t i2=0;i2<i1+1; i2++){
722 if(digarr[i2]) delete digarr[i2];
731 tree->GetUserInfo()->Add(new TParameter<float>(phname,ph->GetVal()));
733 if (treear->GetIndex()==0)
734 treear->BuildIndex("fSegmentID","fSegmentID");
735 treear->GetBranch("Segment")->SetAddress(&digarr[i1]);
743 param->SetZeroSup(2);
744 Int_t zerosup = param->GetZeroSup();
745 AliTPCCalPad * gainTPC = AliTPCcalibDB::Instance()->GetDedxGainFactor();
746 AliTPCCalPad * noiseTPC = AliTPCcalibDB::Instance()->GetPadNoise();
748 // 1.) Make first loop to calculate mean amplitude per pad per segment
750 // TObjArray * crossTalkSignalArray(nsectors);
751 // TMatrixD crossTalkSignal(nWireSegments, timeBin); // structure with mean signal per pad to be filled in first loop
754 //2.) Loop over segments (padrows) of the TPC
756 for (Int_t segmentID=0; segmentID<param->GetNRowsTotal(); segmentID++)
758 Int_t sector, padRow;
759 if (!param->AdjustSectorRow(segmentID,sector,padRow))
761 cerr<<"AliTPC warning: invalid segment ID ! "<<segmentID<<endl;
764 AliTPCCalROC * gainROC = gainTPC->GetCalROC(sector); // pad gains per given sector
765 AliTPCCalROC * noiseROC = noiseTPC->GetCalROC(sector); // noise per given sector
766 digrow->SetID(segmentID);
771 Bool_t digitize = kFALSE;
772 for (Int_t i=0;i<nInputs; i++)
775 rl = AliRunLoader::GetRunLoader(fDigInput->GetInputFolderName(i));
776 gime = rl->GetLoader("TPCLoader");
778 if (gime->TreeS()->GetEntryWithIndex(segmentID,segmentID) >= 0) {
779 digarr[i]->ExpandBuffer();
780 digarr[i]->ExpandTrackBuffer();
781 nTimeBins = digarr[i]->GetNRows();
782 nPads = digarr[i]->GetNCols();
784 if (!GetRegionOfInterest() || (i == 0)) digitize = kTRUE;
788 if (GetRegionOfInterest() && !digitize) break;
790 if (!digitize) continue;
792 digrow->Allocate(nTimeBins,nPads);
793 digrow->AllocateTrack(3);
796 Int_t label[1000]; //stack for 300 events
799 Int_t nElems = nTimeBins*nPads;
801 for (Int_t i=0;i<nInputs; i++)
803 pdig[i] = digarr[i]->GetDigits();
804 ptr[i] = digarr[i]->GetTracks();
807 Short_t *pdig1= digrow->GetDigits();
808 Int_t *ptr1= digrow->GetTracks() ;
812 for (Int_t elem=0;elem<nElems; elem++)
814 // padNumber=elem/nTimeBins
815 // timeBin=elem%nTimeBins
819 for (Int_t i=0;i<nInputs; i++) if (active[i])
821 // q += digarr[i]->GetDigitFast(rows,col);
824 for (Int_t tr=0;tr<3;tr++)
826 // Int_t lab = digarr[i]->GetTrackIDFast(rows,col,tr);
827 Int_t lab = ptr[i][tr*nElems];
828 if ( (lab > 1) && *(pdig[i])>zerosup)
830 label[labptr]=lab+masks[i];
837 Int_t padNumber=elem/nTimeBins;
839 q/=16.; //conversion factor
840 Float_t gain = gainROC->GetValue(padRow,padNumber); // get gain for given - pad-row pad
842 //printf("problem\n");
845 // Crosstalk correction:
846 // Double_t qCrossTalk=crossTalkSignal(wireSegment,timeBin); // signal matrix from per sector array
849 // Ion tail correction:
850 // padNumber=elem/nTimeBins
851 // timeBin=elem%nTimeBins
852 // elem=padNumber*nTimeBins+timeBin;
853 // lowerElem=elem-nIonTailBins;
854 // if (lowerElem<0) lowerElem=0;
855 // if (lowerElem in previospad) lowerElem = padNumber*nTimeBins;
857 // for (Int_t celem=elem-1; celem>lowerElem; celem--){
858 // Int_t deltaT=elem-celem
862 Float_t noisePad = noiseROC->GetValue(padRow,padNumber);
863 // Float_t noise = gRandom->Gaus(0,param->GetNoise()*param->GetNoiseNormFac());
864 Float_t noise = pTPC->GetNoise();
866 q=TMath::Nint(q); // round to the nearest integer
868 fill infor to check consistency of the data
872 if(q >= param->GetADCSat()) q = (Short_t)(param->GetADCSat() - 1);
873 //digrow->SetDigitFast((Short_t)q,rows,col);
875 for (Int_t tr=0;tr<3;tr++)
878 ptr1[tr*nElems] = label[tr];
887 digrow->GlitchFilter();
889 digrow->CompresBuffer(1,zerosup);
890 digrow->CompresTrackBuffer(1);
892 if (fDebug>0) cerr<<sector<<"\t"<<padRow<<"\n";
893 } //for (Int_t n=0; n<param->GetNRowsTotal(); n++)
896 orl = AliRunLoader::GetRunLoader(fDigInput->GetOutputFolderName());
897 ogime = orl->GetLoader("TPCLoader");
898 ogime->WriteDigits("OVERWRITE");
900 //fDigInput->GetTreeDTPC()->Write(0,TObject::kOverwrite);
903 for (Int_t i1=0;i1<nInputs; i1++) delete digarr[i1];