1 // provided by Gamma Conversion Group, PWG4, Kathrin Koch, kkoch@physi.uni-heidelberg.de
7 void MakeCutLog(const char *inputRootFile = "AnalysisResults",const char *path = "./", const char* outputDir="./Output/"){
9 fstream outputFile(Form("%sCutSelection.log",outputDir),ios::out);
10 if(!outputFile.is_open()){
11 cout<<"Problem opening file"<<endl;
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());
19 TList *directories = f.GetListOfKeys(); // get the list of directories in the file
21 for(Int_t entFile=0;entFile<directories->GetEntries();entFile++){
23 TObject * o = f.Get(directories->At(entFile)->GetName()); // get the object in the base directory
25 if(TString(o->IsA()->GetName())=="TDirectoryFile"){ // means that this is a directory (PWG4......)
27 TDirectory *pwg4dir =(TDirectory*)o;
29 TString baseDirName = pwg4dir->GetName();
31 TString reconstructionFlagString = ""; // this is for new scheme where also the flags are coded in numbers in the PWG4.... name
33 if(baseDirName.Length()>31){
34 reconstructionFlagString = baseDirName(baseDirName.Index("GammaConversion_")+16,8);
37 TList *pwg4list = pwg4dir->GetListOfKeys(); // list of the yeys inside the base directory
39 for(Int_t entHist=0;entHist<pwg4list->GetEntries();entHist++){
40 TString name = pwg4list->At(entHist)->GetName();
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
45 if(TString(oHist->IsA()->GetName())=="TList"){ // check if the object is a TList
47 TString listname = oHist->GetName();
48 cout<<"Reading: "<<listname.Data()<<endl;
50 TString cutString = listname(listname.Index("_")+1,listname.Length()) + "\n";// get the Cut string from the name
53 outputFile << cutString.Data();