]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HBTAN/AliHBTWriteInternFormat.C
Bug correction: uninitialized fPartX
[u/mrichter/AliRoot.git] / HBTAN / AliHBTWriteInternFormat.C
1 #if 0
2   #include "/afs/cern.ch/user/s/skowron/aliroot/my/TPC/alles.h"
3   #include "AliHBTReader.h"
4   #include "AliHBTReaderKineTree.h"
5   #include "AliHBTReaderITSv2.h"
6   #include "AliHBTReaderITSv1.h"
7   #include "AliHBTReaderTPC.h"
8   #include "AliHBTParticleCut.h"
9   #include "AliHBTEvent.h"
10   #include "AliHBTPairCut.h"
11   #include "AliHBTQResolutionFctns.h"
12   #include "AliHBTTwoTrackEffFctn.h"
13   #include "AliHBTCorrelFctn.h"
14   #include "TSystem.h"
15   #include "TObjString.h"
16   #include "TString.h"
17   #include "AliPDG.h"
18 #endif
19
20
21 void AliHBTWriteInternFormat(Option_t* datatype, Option_t* processopt="TracksAndParticles",
22                 Int_t first = -1,Int_t last = -1,
23                 char *outfile = "data.root")
24  {
25 //HBT Anlysis Macro
26 //Anlyzes TPC recontructed tracks and simulated particles that corresponds to them
27
28 //datatype defines type of data to be read
29 //  Kine  - analyzes Kine Tree: simulated particles
30 //  TPC   - analyzes TPC   tracking + particles corresponding to these tracks
31 //  ITSv1 - analyzes ITSv1 ----------------------//--------------------------
32 //  ITSv2 - analyzes ITSv2 ----------------------//--------------------------
33
34 //processopt defines option passed to AliHBTAnlysis::Process method
35 // default: TracksAndParticles - process both recontructed tracks and sim. particles corresponding to them 
36 //          Tracks - process only recontructed tracks
37 //          Particles - process only simulated particles
38
39 //Reads data from diroctories from first to last(including)
40 // For examples if first=3 and last=5 it reads from
41 //  ./3/
42 //  ./4/
43 //  ./5/
44 //if first or last is negative (or both), it reads from current directory
45 //
46 //these names I use when analysis is done directly from CASTOR files via RFIO
47
48   const char* basedir=".";
49   const char* serie="";
50   const char* field = "";
51   cout<<"AliHBTWriteInternFormat.C: datatype is "<<datatype<<" dir is basedir"<<endl;
52   // Dynamically link some shared libs                    
53   
54   cout<<"AliHBTWriteInternFormat.C: Loading  HBTAN .....\n";
55   gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libHBTAN");
56   cout<<"AliHBTWriteInternFormat.C: ..... Loaded\n";
57   
58
59   /***********************************************************/
60    
61   AliHBTReader* reader;
62   Int_t kine = strcmp(datatype,"Kine");
63   Int_t TPC = strcmp(datatype,"TPC");
64   Int_t ITSv1 = strcmp(datatype,"ITSv1");
65   Int_t ITSv2 = strcmp(datatype,"ITSv2");
66   Int_t intern = strcmp(datatype,"Intern");
67
68   if(!kine)
69    {
70     reader = new AliHBTReaderKineTree();
71     processopt="Particles"; //this reader by definition reads only simulated particles
72    }
73   else if(!TPC)
74    {
75     cout<<"AliHBTWriteInternFormat.C: Creating Reader TPC .....\n";
76     reader = new AliHBTReaderTPC("tpc.tracks.root","tpc.clusters.root");
77     cout<<"AliHBTWriteInternFormat.C: ..... Created\n";
78    }
79   else if(!ITSv1)
80    {
81     reader = new AliHBTReaderITSv1();
82    }
83   else if(!ITSv2)
84    {
85     cout<<"AliHBTWriteInternFormat.C: Creating Reader ITSv2 .....\n";
86     reader = new AliHBTReaderITSv2("its.tracksv2.root","its.clustersv2.root");
87     cout<<"AliHBTWriteInternFormat.C: ..... Created\n";
88    }
89   else if(!intern)
90    {
91     reader = new AliHBTReaderInternal("TPC.root");
92    }
93   else
94    {
95     cerr<<"Option "<<datatype<<"  not recognized. Exiting"<<endl;
96     return;
97    }
98
99   TObjArray* dirs=0;
100   if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
101    {//read from many dirs dirs
102      cout<<"AliHBTWriteInternFormat.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
103      char buff[50];
104      dirs = new TObjArray(last-first+1);
105      dirs->SetOwner();
106      for (Int_t i = first; i<=last; i++)
107       { 
108         sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
109         TObjString *odir= new TObjString(buff);
110         dirs->Add(odir);
111       }
112     }
113     
114    reader->SetDirs(dirs);
115
116    cout<<"AliHBTWriteInternFormat.C:   P R O C S E S S I N G .....\n\n";
117    AliHBTReaderInternal::Write(reader,outfile);
118    cout<<"\n\nAliHBTWriteInternFormat.C:   F I N I S H E D";
119    
120    if (dirs) delete dirs;
121    delete reader;
122  }
123