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