]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCDDL.C
No ios::binary on Alpha with cxx
[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   Int_t nrows=Int_t(digarr->GetTree()->GetEntries());
26   cout<<"Number of entries "<<nrows<<endl;
27   Int_t PSector=-1;
28   Int_t SubSec=0;
29   for (Int_t n=0; n<nrows; n++) {
30     AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
31
32     Int_t sec,row; // sector and row number (in the TPC)
33     param->AdjustSectorRow(digrow->GetID(),sec,row);   
34     // cout<<sec<<" row "<<row<<endl;
35     if(PSector!=sec){
36       SubSec=0;
37       PSector=sec;
38     }//end if
39
40     if(sec<36){
41       //inner sector [0;35]
42       if(row!=30)
43         //the whole row is written into the output file
44         b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
45       else{
46         //only the pads in the range [37;48] are written into the output file
47         b->WriteRowBinary(eth,digrow,37,48,1,sec,SubSec,row);
48         SubSec=1;
49         //only the pads outside the range [37;48] are written into the output file
50         b->WriteRowBinary(eth,digrow,37,48,2,sec,SubSec,row);
51       }//end else
52     }//end if
53     else{
54       //outer sector [36;71]
55       if(row==54)SubSec=2;
56       if((row!=27)&&(row!=76))
57         b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
58       else{
59         if(row==27){
60           //only the pads outside the range [43;46] are written into the output file
61           b->WriteRowBinary(eth,digrow,43,46,2,sec,SubSec,row);
62           SubSec=1;
63           //only the pads in the range [43;46] are written into the output file
64           b->WriteRowBinary(eth,digrow,43,46,1,sec,SubSec,row);
65         }
66         if(row==76){
67           //only the pads outside the range [33;88] are written into the output file
68           b->WriteRowBinary(eth,digrow,33,88,2,sec,SubSec,row);
69           SubSec=3;
70           //only the pads in the range [33;88] are written into the output file
71           b->WriteRowBinary(eth,digrow,33,88,1,sec,SubSec,row);
72         }
73       }
74     }//end else
75   }//end for
76   cf->Close();
77   cout<<"File created !"<<endl;
78   cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
79   delete b;
80   return;
81 }//end AliTPCDataChallenge