FairRoot/PandaRoot
softrig/qa_softtrig.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 void qa_softtrig(TString outpre="M9999", int mode, double pmom, int from=1, int to=1, int nEvents=0)
14 {
15  gROOT->Macro("$VMCWORKDIR/gconfig/rootlogon.C");
16  gSystem->Load("libSofTrig");
17 
18  TString OutFile = outpre+"_st_qa.root";
19  TString inParFile = TString::Format("%s_%d_par.root",outpre.Data(),from);
20 
21  bool finefile[1000];
22  for (int i=0;i<1000;++i) finefile[i]=false;
23 
24  FairRunAna *fRun= new FairRunAna();
25 
26  bool firstfile=true;
27 
28  // add pid files
29  for (int i=from;i<=to;++i)
30  {
31  TString fname = outpre+"_"; fname+=i; fname+="_pid.root";
32  //TString fname2 = outpre+"_"; fname2+=i; fname2+="_sim.root";
33 
34  if (checkfile(fname) )//&& checkfile(fname2))
35  {
36  finefile[i]=true;
37  if (firstfile) fRun->SetInputFile(fname);
38  else fRun->AddFile(fname);
39  firstfile=false;
40  }
41 
42  }
43  FairLogger::GetLogger()->SetLogToFile(kFALSE);
44 
45  // *** initialization
46 /* FairRuntimeDb* rtdb = fRun->GetRuntimeDb();
47 
48  FairParRootFileIo* parIO = new FairParRootFileIo();
49  parIO->open(inParFile);
50  rtdb->setFirstInput(parIO);
51  rtdb->setOutput(parIO); */
52 
53  fRun->SetOutputFile(OutFile);
54 
55  //---------------------Create and Set the Field(s)----------
56  //PndMultiField *fField= new PndMultiField("FULL");
57  //fRun->SetField(fField);
58 
60 
61 
62  // *** HERE OUR TASK GOES!
63  PndSoftTriggerTask *stTask = new PndSoftTriggerTask(pmom, mode);
64 
65  stTask->SetPi0SignalParams(0.135, 0.01);
66  stTask->SetEtaSignalParams(0.547, 0.03);
67  stTask->SetKs0SignalParams(0.493, 0.05);
68 
69  stTask->SetGammaMinE(0.15);
70  stTask->SetTrackMinP(0.15);
71 
72  TString algo = "PidAlgoEmcBayes;PidAlgoDrc;PidAlgoDisc;PidAlgoStt;PidAlgoMdtHardCuts";
73 
74  stTask->SetAlgoElectron(algo);
75  stTask->SetAlgoMuon(algo);
76  stTask->SetAlgoPion(algo);
77  stTask->SetAlgoKaon(algo);
78  stTask->SetAlgoProton(algo);
79 
80  fRun->AddTask(stTask);
81 
82  // *** and run analysis
83  fRun->Init();
84  fRun->Run(0,nEvents);
85 
86  //gObjectTable->Print();
87 }
Double_t x0
Definition: checkhelixhit.C:70
Int_t i
Definition: run_full.C:25
void SetKs0SignalParams(double mean, double sigma)
void SetPi0SignalParams(double mean, double sigma)
static void ForceConstantBz(Double_t bz=0.)
Force a constant B field value for all positions.
FairRunAna * fRun
Definition: hit_dirc.C:58
Int_t mode
Definition: autocutx.C:47
void SetEtaSignalParams(double mean, double sigma)
int qa_softtrig(TString pref="M9999", int mode, double pmom, int from=1, int to=1, int nEvents=0, int run=0)
Int_t nEvents
Definition: hit_dirc.C:11
bool checkfile(TString fn)
TTree * t
Definition: bump_analys.C:13