#include "ciro.h" void TestA(TString InputDir, TString TelescopeList="1", Int_t LogSizeBins=40, Int_t DistanceBins=40, Int_t EccentricityBins=50, Double_t MinLogSize=1.0, Double_t MaxLogSize=5.0, Double_t MinDistance=0.5, Double_t MaxDistance=4.5, Double_t MinEccentricity=0.0, Double_t MaxEccentricity=1.0 ) { // InputDir Directory where the MC gamma files are // TelescopeList List of telescopes to analyze. For example 1 13 44 55 gROOT->Time(); cout << " Input dir " << InputDir << endl; cout << " List of telescopes " << TelescopeList << endl; TObjArray* Telescopes = TelescopeList.Tokenize(" "); Int_t Ntel = Telescopes->GetEntries(); cout << " Telescopes to analyze " << Ntel << endl; if (Ntel < 1) {cout << " No telescope to analyze " << endl; return;} TString InputFiles = InputDir + "/*.root"; cout << " Input files " << InputFiles << endl; TSystemDirectory idir("InputDir", InputDir.Data()); TList* ifiles = idir.GetListOfFiles(); if (!ifiles) {cout << " No input file found " << endl; return;} TSystemFile *ifile; TString fname; TIter next(ifiles); while ((file=(TSystemFile*)next())) { fname = file->GetName(); if (!file->IsDirectory() && fname.EndsWith(".root")) { // cout << fname.Data() << endl; break; } } fname.Prepend(InputDir); TFile *FirstFile = new TFile(fname.Data()); if (! FirstFile) {cout << " Input file not opened " << endl; return;} TTree* TelescopeLayout; FirstFile->GetObject("telconfig",TelescopeLayout); if (! TelescopeLayout) {cout << " Telconfig tree not found " << endl; return;} // Open the output file TString OutputFile = TString::Format("LUTs_%2i_%3.1f_%3.1f_%2i_%3.1f_%3.1f_%2i_%3.1f_%3.1f.root", LogSizeBins, MinLogSize, MaxLogSize, DistanceBins, MinDistance, MaxDistance, EccentricityBins, MinEccentricity, MaxEccentricity); cout << " Output file " << OutputFile << endl; TFile* output = new TFile(OutputFile,"RECREATE"); // Instatiate the class for the LUT booking and filling ciro *CIRO = (ciro *)TSelector::GetSelector("ciro.C+"); TString Cut("TelID == "); for (Int_t i=0; i <= Telescopes->GetLast(); i++ ) // Loop over telescopes { TObjString* Telescope = (TObjString *)Telescopes->At(i); Int_t Tel = Telescope->GetString().Atoi(); cout << " Processing Telescope " << Tel << endl; // Retrieve the telescope position Cut += Tel-1; TelescopeLayout->Draw("TelX:TelY",Cut.Data(),"goff"); Double_t Xtel = TelescopeLayout->GetV1()[0]; Double_t Ytel = TelescopeLayout->GetV2()[0]; // CIRO->setTelescopePosition(Xtel,Ytel); TString TparsTree = TString::Format("Tel_%i/tpars",Tel); TChain chain(TparsTree.Data()); cout << " Telescope " << Tel << " Tree " << TparsTree << endl; chain.Add(InputFiles); cout << " Telescope " << Tel << " Triggered events " << chain.GetEntries() << endl; TString ProcOption; if ( Ntel == 1 ) { ProcOption = "BookFillNorm"; } else if (i == 0) { ProcOption = "BookFill"; } else if (i == Telescopes->GetLast()) { ProcOption = "FillNorm"; } else { ProcOption = "Fill"; } cout << " Telescope " << Tel << " Processing option " << ProcOption << endl; // Long64_t Status = chain.Process("ciro.C",ProcOption.Data()); Long64_t Status = chain.Process(CIRO,ProcOption.Data()); // Long64_t Status = chain.Process(CIRO); cout << " Status " << Status << endl; } output->Write(); // output->Close(); return; }