]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/AliTPCDDL.C
CMake: Install missing headers for AliPythia6
[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
04fa961a 11void AliTPCDDL(Int_t eventNumber=0, Int_t eth=0){
a7a1dd76 12/// \file AliTPCDDL.C
13/// eth is a threshold.
14/// Digits stored into a file have an amplitude value greater than "eth"
04fa961a 15
16 const char * inFile_new = "galice.root";
17 AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","read");
18
19 Int_t nevents=rl->GetNumberOfEvents();
20 cout<<"Number of Events:"<<nevents<<endl;
21 while (eventNumber<=0 || eventNumber>nevents){
22 cout<<"Insert the event number:";
23 cin>>eventNumber;
24 cout<<endl;
25 }
26 rl->GetEvent(eventNumber-1);
27 AliLoader *tpcloader=rl->GetLoader("TPCLoader");
28 tpcloader->LoadDigits();
29 TTree *digitsTree=tpcloader->TreeD();
30
31 AliSimDigits digrows, *dummy=&digrows;
32 digitsTree->GetBranch("Segment")->SetAddress(&dummy);
33 Stat_t nrows = digitsTree->GetEntries();
34 cout<<"Number of entries (rows):"<<nrows<<endl;
35 // get the TPC parameters
36 rl->CdGAFile();
37 AliTPCParamSR* param = AliTPC::LoadTPCParam(gFile);
38 if (!param)
39 cout<<"No TPC parameter"<<endl;
2e9f335b 40 AliTPCDigitsArray *digarr=new AliTPCDigitsArray;
41 digarr->Setup(param);
04fa961a 42 digarr->ConnectTree(digitsTree);
43
2e9f335b 44 AliTPCBuffer *b=new AliTPCBuffer("AliTPCDDL.dat");
9f992f70 45
46 //Verbose level
47 // 0: Silent
48 // 1: cout messages
49 // 2: txt files with digits
50 //BE CAREFUL, verbose level 2 MUST be used only for debugging and
51 //it is highly suggested to use this mode only for debugging digits files
52 //reasonably small, because otherwise the size of the txt files can reach
53 //quickly several MB wasting time and disk space.
54 b->SetVerbose(0);
55
56
04fa961a 57 nrows=Int_t(digarr->GetTree()->GetEntries());
2e9f335b 58 cout<<"Number of entries "<<nrows<<endl;
59 Int_t PSector=-1;
60 Int_t SubSec=0;
61 for (Int_t n=0; n<nrows; n++) {
62 AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
63
64 Int_t sec,row; // sector and row number (in the TPC)
65 param->AdjustSectorRow(digrow->GetID(),sec,row);
66 // cout<<sec<<" row "<<row<<endl;
67 if(PSector!=sec){
68 SubSec=0;
69 PSector=sec;
70 }//end if
71
72 if(sec<36){
73 //inner sector [0;35]
74 if(row!=30)
75 //the whole row is written into the output file
76 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
77 else{
78 //only the pads in the range [37;48] are written into the output file
79 b->WriteRowBinary(eth,digrow,37,48,1,sec,SubSec,row);
80 SubSec=1;
81 //only the pads outside the range [37;48] are written into the output file
82 b->WriteRowBinary(eth,digrow,37,48,2,sec,SubSec,row);
83 }//end else
84 }//end if
85 else{
86 //outer sector [36;71]
87 if(row==54)SubSec=2;
88 if((row!=27)&&(row!=76))
89 b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
90 else{
91 if(row==27){
92 //only the pads outside the range [43;46] are written into the output file
93 b->WriteRowBinary(eth,digrow,43,46,2,sec,SubSec,row);
94 SubSec=1;
95 //only the pads in the range [43;46] are written into the output file
96 b->WriteRowBinary(eth,digrow,43,46,1,sec,SubSec,row);
97 }
98 if(row==76){
99 //only the pads outside the range [33;88] are written into the output file
100 b->WriteRowBinary(eth,digrow,33,88,2,sec,SubSec,row);
101 SubSec=3;
102 //only the pads in the range [33;88] are written into the output file
103 b->WriteRowBinary(eth,digrow,33,88,1,sec,SubSec,row);
104 }
105 }
106 }//end else
107 }//end for
2e9f335b 108 cout<<"File created !"<<endl;
109 cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
110 delete b;
111 return;
112}//end AliTPCDataChallenge