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 //Digits stored into a file have an amplitude value greater than "eth"
15 const char * inFile_new = "galice.root";
16 AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","read");
18 Int_t nevents=rl->GetNumberOfEvents();
19 cout<<"Number of Events:"<<nevents<<endl;
20 while (eventNumber<=0 || eventNumber>nevents){
21 cout<<"Insert the event number:";
25 rl->GetEvent(eventNumber-1);
26 AliLoader *tpcloader=rl->GetLoader("TPCLoader");
27 tpcloader->LoadDigits();
28 TTree *digitsTree=tpcloader->TreeD();
30 AliSimDigits digrows, *dummy=&digrows;
31 digitsTree->GetBranch("Segment")->SetAddress(&dummy);
32 Stat_t nrows = digitsTree->GetEntries();
33 cout<<"Number of entries (rows):"<<nrows<<endl;
34 // get the TPC parameters
36 AliTPCParamSR* param = AliTPC::LoadTPCParam(gFile);
38 cout<<"No TPC parameter"<<endl;
39 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
41 digarr->ConnectTree(digitsTree);
43 AliTPCBuffer *b=new AliTPCBuffer("AliTPCDDL.dat");
48 // 2: txt files with digits
49 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
50 //it is highly suggested to use this mode only for debugging digits files
51 //reasonably small, because otherwise the size of the txt files can reach
52 //quickly several MB wasting time and disk space.
56 nrows=Int_t(digarr->GetTree()->GetEntries());
57 cout<<"Number of entries "<<nrows<<endl;
60 for (Int_t n=0; n<nrows; n++) {
61 AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
63 Int_t sec,row; // sector and row number (in the TPC)
64 param->AdjustSectorRow(digrow->GetID(),sec,row);
65 // cout<<sec<<" row "<<row<<endl;
74 //the whole row is written into the output file
75 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
77 //only the pads in the range [37;48] are written into the output file
78 b->WriteRowBinary(eth,digrow,37,48,1,sec,SubSec,row);
80 //only the pads outside the range [37;48] are written into the output file
81 b->WriteRowBinary(eth,digrow,37,48,2,sec,SubSec,row);
85 //outer sector [36;71]
87 if((row!=27)&&(row!=76))
88 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
91 //only the pads outside the range [43;46] are written into the output file
92 b->WriteRowBinary(eth,digrow,43,46,2,sec,SubSec,row);
94 //only the pads in the range [43;46] are written into the output file
95 b->WriteRowBinary(eth,digrow,43,46,1,sec,SubSec,row);
98 //only the pads outside the range [33;88] are written into the output file
99 b->WriteRowBinary(eth,digrow,33,88,2,sec,SubSec,row);
101 //only the pads in the range [33;88] are written into the output file
102 b->WriteRowBinary(eth,digrow,33,88,1,sec,SubSec,row);
107 cout<<"File created !"<<endl;
108 cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
111 }//end AliTPCDataChallenge