]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGGA/GammaConv/macros/MakeCutLog.C
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / macros / MakeCutLog.C
CommitLineData
5fdef45d 1// provided by Gamma Conversion Group, PWGGA, Kathrin Koch, kkoch@physi.uni-heidelberg.de
baf06eb6 2
3#include <Riostream>
4#include <fstream>
5using namespace std;
6
7void MakeCutLog(const char *inputRootFile = "AnalysisResults",const char *path = "./", const char* outputDir="./Output/"){
8
9 fstream outputFile(Form("%sCutSelection.log",outputDir),ios::out);
10 if(!outputFile.is_open()){
11 cout<<"Problem opening file"<<endl;
12 return;
13 }
14
15 // Char_t filename_input1[200] = (Form("%s%s",path,input1));
16 TString filename = Form("%s%s.root",path,inputRootFile);
17 TFile f(filename.Data());
18
19 TList *directories = f.GetListOfKeys(); // get the list of directories in the file
20
21 for(Int_t entFile=0;entFile<directories->GetEntries();entFile++){
22
23 TObject * o = f.Get(directories->At(entFile)->GetName()); // get the object in the base directory
24
5fdef45d 25 if(TString(o->IsA()->GetName())=="TDirectoryFile"){ // means that this is a directory (PWGGA......)
baf06eb6 26
27 TDirectory *pwg4dir =(TDirectory*)o;
28
29 TString baseDirName = pwg4dir->GetName();
30
5fdef45d 31 TString reconstructionFlagString = ""; // this is for new scheme where also the flags are coded in numbers in the PWGGA.... name
baf06eb6 32
33 if(baseDirName.Length()>31){
34 reconstructionFlagString = baseDirName(baseDirName.Index("GammaConversion_")+16,8);
35 }
36
37 TList *pwg4list = pwg4dir->GetListOfKeys(); // list of the yeys inside the base directory
38
39 for(Int_t entHist=0;entHist<pwg4list->GetEntries();entHist++){
40 TString name = pwg4list->At(entHist)->GetName();
41
42 if(name.Contains("container")==0){ // does not try to read the container (get errors if tried)
43 TObject * oHist = pwg4dir->Get(pwg4list->At(entHist)->GetName()); // get the object
44
45 if(TString(oHist->IsA()->GetName())=="TList"){ // check if the object is a TList
46
47 TString listname = oHist->GetName();
48 cout<<"Reading: "<<listname.Data()<<endl;
49
50 TString cutString = listname(listname.Index("_")+1,listname.Length()) + "\n";// get the Cut string from the name
51
52
53 outputFile << cutString.Data();
54 }
55 }
56 }
57 }
58 }
59 outputFile.close();
60}