4 #include "AliTPCParamSR.h"
5 #include "AliTPCDigitsArray.h"
6 #include "AliSimDigits.h"
7 #include "AliTPCBuffer.h"
11 void AliTPCDDL(Int_t eventNumber=0, Int_t eth=0){
13 /// eth is a threshold.
14 /// Digits stored into a file have an amplitude value greater than "eth"
16 const char * inFile_new = "galice.root";
17 AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","read");
19 Int_t nevents=rl->GetNumberOfEvents();
20 cout<<"Number of Events:"<<nevents<<endl;
21 while (eventNumber<=0 || eventNumber>nevents){
22 cout<<"Insert the event number:";
26 rl->GetEvent(eventNumber-1);
27 AliLoader *tpcloader=rl->GetLoader("TPCLoader");
28 tpcloader->LoadDigits();
29 TTree *digitsTree=tpcloader->TreeD();
31 AliSimDigits digrows, *dummy=&digrows;
32 digitsTree->GetBranch("Segment")->SetAddress(&dummy);
33 Stat_t nrows = digitsTree->GetEntries();
34 cout<<"Number of entries (rows):"<<nrows<<endl;
35 // get the TPC parameters
37 AliTPCParamSR* param = AliTPC::LoadTPCParam(gFile);
39 cout<<"No TPC parameter"<<endl;
40 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
42 digarr->ConnectTree(digitsTree);
44 AliTPCBuffer *b=new AliTPCBuffer("AliTPCDDL.dat");
49 // 2: txt files with digits
50 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
51 //it is highly suggested to use this mode only for debugging digits files
52 //reasonably small, because otherwise the size of the txt files can reach
53 //quickly several MB wasting time and disk space.
57 nrows=Int_t(digarr->GetTree()->GetEntries());
58 cout<<"Number of entries "<<nrows<<endl;
61 for (Int_t n=0; n<nrows; n++) {
62 AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
64 Int_t sec,row; // sector and row number (in the TPC)
65 param->AdjustSectorRow(digrow->GetID(),sec,row);
66 // cout<<sec<<" row "<<row<<endl;
75 //the whole row is written into the output file
76 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
78 //only the pads in the range [37;48] are written into the output file
79 b->WriteRowBinary(eth,digrow,37,48,1,sec,SubSec,row);
81 //only the pads outside the range [37;48] are written into the output file
82 b->WriteRowBinary(eth,digrow,37,48,2,sec,SubSec,row);
86 //outer sector [36;71]
88 if((row!=27)&&(row!=76))
89 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
92 //only the pads outside the range [43;46] are written into the output file
93 b->WriteRowBinary(eth,digrow,43,46,2,sec,SubSec,row);
95 //only the pads in the range [43;46] are written into the output file
96 b->WriteRowBinary(eth,digrow,43,46,1,sec,SubSec,row);
99 //only the pads outside the range [33;88] are written into the output file
100 b->WriteRowBinary(eth,digrow,33,88,2,sec,SubSec,row);
102 //only the pads in the range [33;88] are written into the output file
103 b->WriteRowBinary(eth,digrow,33,88,1,sec,SubSec,row);
108 cout<<"File created !"<<endl;
109 cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
112 }//end AliTPCDataChallenge