AliRoot Core  d69033e (d69033e)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliTPCDDL.C
Go to the documentation of this file.
1 
3 #if !defined(__CINT__)
4 #include <TFile.h>
5 #include <TTree.h>
6 #include "AliTPCParamSR.h"
7 #include "AliTPCDigitsArray.h"
8 #include "AliSimDigits.h"
9 #include "AliTPCBuffer.h"
10 #endif
11 
12 
13 void AliTPCDDL(Int_t eventNumber=0, Int_t eth=0){
16 
17  const char * inFile_new = "galice.root";
18  AliRunLoader *rl = AliRunLoader::Open(inFile_new,"Event","read");
19 
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:";
24  cin>>eventNumber;
25  cout<<endl;
26  }
27  rl->GetEvent(eventNumber-1);
28  AliLoader *tpcloader=rl->GetLoader("TPCLoader");
29  tpcloader->LoadDigits();
30  TTree *digitsTree=tpcloader->TreeD();
31 
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
37  rl->CdGAFile();
38  AliTPCParamSR* param = AliTPC::LoadTPCParam(gFile);
39  if (!param)
40  cout<<"No TPC parameter"<<endl;
42  digarr->Setup(param);
43  digarr->ConnectTree(digitsTree);
44 
45  AliTPCBuffer *b=new AliTPCBuffer("AliTPCDDL.dat");
46 
47  //Verbose level
48  // 0: Silent
49  // 1: cout messages
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.
55  b->SetVerbose(0);
56 
57 
58  nrows=Int_t(digarr->GetTree()->GetEntries());
59  cout<<"Number of entries "<<nrows<<endl;
60  Int_t PSector=-1;
61  Int_t SubSec=0;
62  for (Int_t n=0; n<nrows; n++) {
63  AliSimDigits *digrow=(AliSimDigits*)digarr->LoadEntry(n);
64 
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;
68  if(PSector!=sec){
69  SubSec=0;
70  PSector=sec;
71  }//end if
72 
73  if(sec<36){
74  //inner sector [0;35]
75  if(row!=30)
76  //the whole row is written into the output file
77  b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
78  else{
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);
81  SubSec=1;
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);
84  }//end else
85  }//end if
86  else{
87  //outer sector [36;71]
88  if(row==54)SubSec=2;
89  if((row!=27)&&(row!=76))
90  b->WriteRowBinary(eth,digrow,0,0,0,sec,SubSec,row);
91  else{
92  if(row==27){
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);
95  SubSec=1;
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);
98  }
99  if(row==76){
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);
102  SubSec=3;
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);
105  }
106  }
107  }//end else
108  }//end for
109  cout<<"File created !"<<endl;
110  cout<<"Total number of digits: "<<b->GetDigNumber()<<endl;
111  delete b;
112  return;
113 }//end AliTPCDataChallenge
void AliTPCDDL(Int_t eventNumber=0, Int_t eth=0)
Definition: AliTPCDDL.C:13
TFile * Open(const char *filename, Long64_t &nevents)
Manager and of geomety classes for set: TPC.
Definition: AliTPCParamSR.h:15
Time Projection Chamber clusters objects.
virtual Bool_t ConnectTree(const char *treeName)
Int_t GetID()
Definition: AliSegmentID.h:19
virtual AliSegmentID * LoadEntry(Int_t index)
Bool_t AdjustSectorRow(Int_t index, Int_t &sector, Int_t &row) const
Bool_t Setup(AliDetectorParam *param)