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