]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCDDL.C
39838bcd016bef561b0e111840e26cd264eaa4c6
[u/mrichter/AliRoot.git] / TPC / AliTPCDDL.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "TFile.h"
3 #include "AliTPCBuffer.h"
4 #endif
5
6
7 void AliTPCDDL(char* FileName,Int_t eth=0){
8   //eth is a threshold.
9   //Digits stored into a file have an amplitude value greater than "eth"
10   TFile *cf=TFile::Open(FileName);
11   // old geometry (3.07)
12   //AliTPCParamSR *param =(AliTPCParamSR *)cf->Get("75x40_100x60");
13   // if new geometry comment out the line above and uncomment the one below
14   AliTPCParamSR *param =(AliTPCParamSR *)cf->Get("75x40_100x60_150x60");
15   AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
16   digarr->Setup(param);
17   char  cname[100];
18   //old geometry
19   //sprintf(cname,"TreeD_75x40_100x60_%d",eventn);
20   // if new geometry comment out the line above and uncomment the one below
21   Int_t eventn=0;
22   sprintf(cname,"TreeD_75x40_100x60_150x60_%d",eventn);
23   digarr->ConnectTree(cname);
24   AliTPCBuffer *b=new AliTPCBuffer("AliTPCDDL.dat");
25
26   //Verbose level
27   // 0: Silent
28   // 1: cout messages
29   // 2: txt files with digits 
30   //BE CAREFUL, verbose level 2 MUST be used only for debugging and
31   //it is highly suggested to use this mode only for debugging digits files
32   //reasonably small, because otherwise the size of the txt files can reach
33   //quickly several MB wasting time and disk space.
34   b->SetVerbose(0);
35
36
37   Int_t nrows=Int_t(digarr->GetTree()->GetEntries());
38   cout<<"Number of entries "<<nrows<<endl;
39   Int_t PSector=-1;
40   Int_t SubSec=0;
41   for (Int_t n=0; n<nrows; n++) {
42     AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
43
44     Int_t sec,row; // sector and row number (in the TPC)
45     param->AdjustSectorRow(digrow->GetID(),sec,row);   
46     // cout<<sec<<" row "<<row<<endl;
47     if(PSector!=sec){
48       SubSec=0;
49       PSector=sec;
50     }//end if
51
52     if(sec<36){
53       //inner sector [0;35]
54       if(row!=30)
55         //the whole row is written into the output file
56         b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
57       else{
58         //only the pads in the range [37;48] are written into the output file
59         b->WriteRowBinary(eth,digrow,37,48,1,sec,SubSec,row);
60         SubSec=1;
61         //only the pads outside the range [37;48] are written into the output file
62         b->WriteRowBinary(eth,digrow,37,48,2,sec,SubSec,row);
63       }//end else
64     }//end if
65     else{
66       //outer sector [36;71]
67       if(row==54)SubSec=2;
68       if((row!=27)&&(row!=76))
69         b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
70       else{
71         if(row==27){
72           //only the pads outside the range [43;46] are written into the output file
73           b->WriteRowBinary(eth,digrow,43,46,2,sec,SubSec,row);
74           SubSec=1;
75           //only the pads in the range [43;46] are written into the output file
76           b->WriteRowBinary(eth,digrow,43,46,1,sec,SubSec,row);
77         }
78         if(row==76){
79           //only the pads outside the range [33;88] are written into the output file
80           b->WriteRowBinary(eth,digrow,33,88,2,sec,SubSec,row);
81           SubSec=3;
82           //only the pads in the range [33;88] are written into the output file
83           b->WriteRowBinary(eth,digrow,33,88,1,sec,SubSec,row);
84         }
85       }
86     }//end else
87   }//end for
88   cf->Close();
89   cout<<"File created !"<<endl;
90   cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
91   delete b;
92   return;
93 }//end AliTPCDataChallenge