bool checkfile(TString fn) { bool fileok=true; TFile fff(fn); if (fff.IsZombie()) fileok=false; TTree *t=(TTree*)fff.Get("cbmsim"); if (t==0x0) fileok=false; if (!fileok) cout <<"Skipping broken file '"<, , , [nevt] )\n\n"; cout << " : output file names prefix\n"; cout << " : first run number\n"; cout << " : last run number\n"; cout << " [mode] : arbitrary mode number; default: 0\n"; cout << " [nevt] : number of events; default: 0 = all\n\n"; return 0; } bool fastsim = true; // -------------------------------- // Set Pid Algos for full or fast sim // -------------------------------- TString pidalgo = "PidAlgoEmcBayes;PidAlgoDrc;PidAlgoDisc;PidAlgoStt;PidAlgoMdtHardCuts;PidAlgoRich;PidAlgoSciT"; if (fastsim) pidalgo = "PidChargedProbability"; // -------------------------------- // Prepare input file naming // -------------------------------- TString suffix = fastsim ? "fsim" : "pid"; TString outFile = TString::Format("%s_ana_%d_%d.root",prefix.Data(), from, to); TString firstFile = TString::Format("%s_%d_%s.root",prefix.Data(),from,suffix.Data()); // if prefix is a full file name, we skip the run number in the name if (prefix.EndsWith(".root")) { firstFile = prefix; outFile = prefix; outFile.ReplaceAll(".root","_ana.root"); //inParFile = prefix; inParFile.ReplaceAll("_pid.root","_par.root"); to = from; } // if only one file, we name outfile to 'prefix__ana.root' else if (from==to) outFile = TString::Format("%s_%d_ana.root", prefix.Data(), from); // -------------------------------- // Start a stop watch // -------------------------------- TStopwatch fTimer; fTimer.Start(); // -------------------------------- // Create the Analysis run manager // -------------------------------- FairRunAna *fRun = new FairRunAna(); FairFileSource *fSrc = new FairFileSource(firstFile); // Add pid files for (int i=from+1;i<=to;++i) { TString fname = TString::Format("%s_%d_%s.root",prefix.Data(),i,suffix.Data()); if ( checkfile(fname) ) fSrc->AddFile(fname); } fRun->SetSource(fSrc); // *** PID table with selection thresholds; can be modified by the user TString pidParFile = TString(gSystem->Getenv("VMCWORKDIR"))+"/macro/params/all.par"; // *** initialization FairLogger::GetLogger()->SetLogToFile(kFALSE); fRun->SetOutputFile(outFile); //---------------------Create and Set the Field(s)---------- RhoCalculationTools::ForceConstantBz(20.0); // *** // *** HERE YOUR TASK/CODE CODE GOES! // *** PndProdAnaTask *prodTask = new PndProdAnaTask(mode, pidalgo); fRun->AddTask(prodTask); // -------------------------------- // ... and run analysis // -------------------------------- fRun->Init(); fRun->Run(0,nevts); //------------------------Print some info and exit---------------- fTimer.Stop(); FairSystemInfo sysInfo; Float_t maxMemory=sysInfo.GetMaxMemory(); Double_t rtime = fTimer.RealTime(); Double_t ctime = fTimer.CpuTime(); Float_t cpuUsage=ctime/rtime; cout << endl; cout << "[INFO ] Macro call : prod_fsim.C(\""<