FairRoot/PandaRoot
ana_task_mult.C
Go to the documentation of this file.
1 bool checkfile(TString fn)
2 {
3  bool fileok=true;
4  TFile fff(fn);
5  if (fff.IsZombie()) fileok=false;
6  TTree *t=(TTree*)fff.Get("pndsim");
7  if (t==0x0) fileok=false;
8 
9  if (!fileok) cout <<"Skipping broken file '"<<fn<<"'"<<endl;
10  return fileok;
11 }
12 
13 int ana_task_mult(TString outpre="test", int from=1, int to=1, double pbarmom = 6.232069, int nevts=0)
14 {
15  // *** set this to your output path
16  TString OutPath = TString(gSystem->Getenv("VMCWORKDIR"))+"/macro/scrut/data";
17  TString Filename = OutPath + "/" + outpre(outpre.Last('/')+1,outpre.Length()); // cut away input path
18 
19  TString OutFile = TString::Format("%s_fana_%d_%d.root", Filename.Data(), from, to);
20  TString OutDummy = TString::Format("%s_dummy_%d_%d.root", Filename.Data(), from, to);
21 
22  FairRunAna *fRun= new FairRunAna();
23 
24  bool firstfile=true;
25 
26  // *** Add input files
27  for (int i=from;i<=to;++i)
28  {
29  TString fname = TString::Format("%s_%d_fast.root",outpre.Data(),i);
30 
31  if ( checkfile(fname) )
32  {
33  if (firstfile)
34  fRun->SetInputFile(fname);
35  else
36  fRun->AddFile(fname);
37 
38  firstfile=false;
39  }
40  }
41 
42  // *** initialization
43  FairLogger::GetLogger()->SetLogToFile(kFALSE);
44 
45  fRun->SetGenerateRunInfo(kFALSE);
46  fRun->SetOutputFile(OutDummy);
47 
48  // *** take constant field; needed for PocaVtx
50 
51  // *** HERE OUR ANALYSIS TASK GOES!
52  PndScrutAnaTask *scrutTask = new PndScrutAnaTask(pbarmom, OutFile);
53  fRun->AddTask(scrutTask);
54 
55  // *** and run analysis
56  fRun->Init();
57  fRun->Run(0,nevts);
58  return 0;
59 }
Double_t x0
Definition: checkhelixhit.C:70
Int_t i
Definition: run_full.C:25
bool checkfile(TString fn)
Definition: ana_task_mult.C:1
static void ForceConstantBz(Double_t bz=0.)
Force a constant B field value for all positions.
int ana_task_mult(TString outpre="test", int from=1, int to=1, double pbarmom=6.232069, int nevts=0)
Definition: ana_task_mult.C:13
FairRunAna * fRun
Definition: hit_dirc.C:58
TTree * t
Definition: bump_analys.C:13