]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTWriteInternFormat.C
New functions added
[u/mrichter/AliRoot.git] / HBTAN / AliHBTWriteInternFormat.C
CommitLineData
e35e9d49 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
f024b9d0 21void AliHBTWriteInternFormat(Option_t* datatype, Option_t* processopt="TracksAndParticles",
e35e9d49 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
f024b9d0 47
48 const char* basedir=".";
49 const char* serie="";
50 const char* field = "";
51 cout<<"AliHBTWriteInternFormat.C: datatype is "<<datatype<<" dir is basedir"<<endl;
e35e9d49 52 // Dynamically link some shared libs
53
f024b9d0 54 cout<<"AliHBTWriteInternFormat.C: Loading HBTAN .....\n";
e35e9d49 55 gSystem->Load("$(ALICE_ROOT)/lib/tgt_$(ALICE_TARGET)/libHBTAN");
f024b9d0 56 cout<<"AliHBTWriteInternFormat.C: ..... Loaded\n";
e35e9d49 57
4d91c73a 58 Bool_t multcheck = kTRUE;
e35e9d49 59 /***********************************************************/
f024b9d0 60
e35e9d49 61 AliHBTReader* reader;
62 Int_t kine = strcmp(datatype,"Kine");
bed069a4 63 Int_t ESD = strcmp(datatype,"ESD");
e35e9d49 64 Int_t TPC = strcmp(datatype,"TPC");
65 Int_t ITSv1 = strcmp(datatype,"ITSv1");
66 Int_t ITSv2 = strcmp(datatype,"ITSv2");
f024b9d0 67 Int_t intern = strcmp(datatype,"Intern");
e35e9d49 68
69 if(!kine)
70 {
71 reader = new AliHBTReaderKineTree();
72 processopt="Particles"; //this reader by definition reads only simulated particles
4d91c73a 73 multcheck = kFALSE;
e35e9d49 74 }
bed069a4 75 else if(!ESD)
76 {
77 AliHBTReaderESD* esdreader = new AliHBTReaderESD();
78 esdreader->ReadParticles(kTRUE);
79 reader = esdreader;
4d91c73a 80 multcheck = kTRUE;
bed069a4 81 }
e35e9d49 82 else if(!TPC)
83 {
f024b9d0 84 cout<<"AliHBTWriteInternFormat.C: Creating Reader TPC .....\n";
bed069a4 85 reader = new AliHBTReaderTPC();
4d91c73a 86 multcheck = kFALSE;
f024b9d0 87 cout<<"AliHBTWriteInternFormat.C: ..... Created\n";
e35e9d49 88 }
89 else if(!ITSv1)
90 {
91 reader = new AliHBTReaderITSv1();
4d91c73a 92 multcheck = kFALSE;
e35e9d49 93 }
94 else if(!ITSv2)
95 {
f024b9d0 96 cout<<"AliHBTWriteInternFormat.C: Creating Reader ITSv2 .....\n";
bed069a4 97 reader = new AliHBTReaderITSv2();
4d91c73a 98 multcheck = kFALSE;
f024b9d0 99 cout<<"AliHBTWriteInternFormat.C: ..... Created\n";
100 }
101 else if(!intern)
102 {
bed069a4 103 reader = new AliHBTReaderInternal("data.root");
4d91c73a 104 multcheck = kTRUE;
e35e9d49 105 }
106 else
107 {
108 cerr<<"Option "<<datatype<<" not recognized. Exiting"<<endl;
109 return;
110 }
111
112 TObjArray* dirs=0;
113 if ( (first >= 0) && (last>=0) && ( (last-first)>=0 ) )
114 {//read from many dirs dirs
f024b9d0 115 cout<<"AliHBTWriteInternFormat.C: ..... Setting dirs first="<<first<<" last="<<last<<"\n";
e35e9d49 116 char buff[50];
117 dirs = new TObjArray(last-first+1);
f024b9d0 118 dirs->SetOwner();
e35e9d49 119 for (Int_t i = first; i<=last; i++)
120 {
9f71d991 121 sprintf(buff,"%s/%s/%s/%d",basedir,field,serie,i);
e35e9d49 122 TObjString *odir= new TObjString(buff);
123 dirs->Add(odir);
124 }
125 }
f024b9d0 126
e35e9d49 127 reader->SetDirs(dirs);
f024b9d0 128
129 cout<<"AliHBTWriteInternFormat.C: P R O C S E S S I N G .....\n\n";
4d91c73a 130 AliHBTReaderInternal::Write(reader,outfile,multcheck);
bed069a4 131 cout<<"\n\nAliHBTWriteInternFormat.C: F I N I S H E D\n";
e35e9d49 132
f024b9d0 133 if (dirs) delete dirs;
134 delete reader;
e35e9d49 135 }
136