1 /////////////////////////////////////////////////////////////
5 // Author: Emanuele Simili
7 /////////////////////////////////////////////////////////////
9 // Description: AliRoot macro to make AliFlowEvents from KineTree (new way)
11 /////////////////////////////////////////////////////////////
19 #include "TStopwatch.h"
21 using namespace std; //required for resolving the 'cout' symbol
23 const char* aDataDir = "./" ; Int_t aRuns = -1 ; Int_t offset = 0 ;
25 //////////////////////////////////////////////////////////////////////////////////////////////////////
27 int testKiner(int cen = -1)
29 cout << " . Here the new flow kinemaker (2007 noRL) ... " << endl ;
35 cout << " . limited to " << limit << "events . " << endl ;
39 // flowEvents file (output) //
41 TString output = "flowKevts" ;
42 if(cen >= 0) { output += cen ; }
45 // start, load libs //
50 //gSystem->Load("libPhysics.so");
51 gSystem->Load("libPWG2flow.so");
53 // open output file //
55 TFile * fFlowfile = new TFile(output.Data(),"RECREATE") ;
60 AliFlowKineMaker * flowKiner = new AliFlowKineMaker() ;
62 flowKiner->SetAbsEtaCut(10.) ;
63 flowKiner->SetECut(0.001,100.) ;
64 //flowKiner->SetLabelCut(..,..) ;
65 flowKiner->SetPrimaryCut(kTRUE) ;
66 flowKiner->PrintCutList() ;
68 AliFlowEvent * flowEvt = 0 ;
73 TString execDir(gSystem->pwd());
74 TSystemDirectory* baseDir = new TSystemDirectory(".", aDataDir);
75 TList* dirList = baseDir->GetListOfFiles();
76 Int_t nDirs = dirList->GetEntries();
79 for(Int_t iDir=0; iDir<nDirs; ++iDir)
81 TSystemFile* presentDir = (TSystemFile*)dirList->At(iDir) ;
82 if(!presentDir || !presentDir->IsDirectory() || strcmp(presentDir->GetName(), ".") == 0 || strcmp(presentDir->GetName(), "..") == 0)
85 cout << "Directory (" << iDir << "): " << presentDir->GetName() << " - Skipping ... " << endl ;
88 if(offset > 0) { --offset ; continue ; }
89 if((aRuns > 0) && (count >= aRuns)) { break ; }
91 TString presentDirName(aDataDir);
92 presentDirName += presentDir->GetName();
93 presentDirName += "/";
95 TString fileName = presentDirName ;
96 fileName += "galice.root" ;
97 Long_t *id, *size, *flags, *modtime ;
98 if(gSystem->GetPathInfo(fileName.Data(),id,size,flags,modtime))
100 cout << " File : " << fileName << " does NOT exist ! - Skipping ... " << endl ;
103 cout << endl ; cout << "Directory (" << iDir << "): " << presentDirName << " ... " << endl ;
105 // loop (simulations in the present dir) //
107 TSystemDirectory* evtsDir = new TSystemDirectory(".", presentDirName.Data());
108 TList* fileList = evtsDir->GetListOfFiles();
109 Int_t nFiles = fileList->GetEntries();
110 gSystem->cd(execDir);
112 for(Int_t iFiles=0; iFiles<nFiles; ++iFiles)
114 TSystemFile* presentFile = (TSystemFile*) fileList->At(iFiles);
116 TString presentFileName(presentDirName);
117 presentFileName += presentFile->GetName();
119 if(!(presentFileName.Contains("Kinematics") && presentFileName.Contains("root"))) { continue ; }
121 cout << " found: " << presentFileName.Data() << endl ;
123 TFile* kineFile = new TFile(presentFileName.Data(), "READ") ;
125 Int_t nEvts = kineFile->GetNkeys() ;
126 cout << " . found: " << nEvts << " KineTree(s) in " << presentFileName.Data() << endl ;
127 TList* kineEventsList = (TList*)kineFile->GetListOfKeys() ;
129 TIter next(kineEventsList);
132 // Loop over the events
133 while( key=(TKey *)next() )
135 TDirectory* tDir = (TDirectory*)key->ReadObj() ;
138 TString evtDir(tDir->GetName()) ;
139 cout << " . . found: " << tDir->GetName() << endl ;
141 kTree = (TTree *)tDir->Get("TreeK");
144 Int_t nPart = kTree->GetEntries() ;
145 cout << " . . . kTree " << count << " has " << nPart << " particles " << endl ;
147 // fill and save the flow event
148 flowEvt = flowKiner->FillFlowEvent(kTree) ;
149 cout << " . . . flowEvent " << flowEvt << " filled from ttree " << kTree << " ... " << endl ;
150 // flowEvt->Dump() ; cout << endl ;
151 TString evtID = "" ; evtID += iDir ; evtID += "-" ; evtID += evtDir ;
152 fFlowfile->cd() ; flowEvt->Write(evtID.Data()) ;
153 cout << " . . . flowEvent " << flowEvt << " ( " << evtID.Data() << " ) - written on disk (" << output << ") ... " << endl;
154 delete flowEvt ; cout << endl ;
157 if(count == limit) { break ; }
170 cout << " Finished ... " << endl ;
171 cout << " nParticles: " << (flowKiner->GetNgoodTracks() + flowKiner->GetNgoodV0s()) << " (" << flowKiner->GetNposiTracks() << "+ , " << flowKiner->GetNnegaTracks() << "- , " << flowKiner->GetNgoodV0s() << " neutral) " << endl ;
172 cout << " <nCharged> (|eta|<0.5): " << (Int_t)(flowKiner->GetNgoodTracksEta()/count) << endl ;
173 cout << " Bayesian : " ;
174 for(int ii=0;ii<5;ii++) { cout << flowKiner->GetBayesianNorm(ii) << " " ; }
175 cout << " . " << endl ;
180 cout << " . here it was (kiner noRL) ... " << endl ; //juice!
183 // cout << endl ; cout << " Memory Check (from Paul)" << endl ;
184 // gObjectTable->Print();
185 // cout << endl ; cout << endl ;
190 //////////////////////////////////////////////////////////////////////////////////////////////////////