FairRoot/PandaRoot
Functions
tutorials/analysis/quickana.C File Reference

Go to the source code of this file.

Functions

void quickana (TString Fname="", double Mom=0, TString anadecay="", int nevts=0, TString anaparms="", bool fastsim=false, bool runST=false, int run=0, int runmode=0)
 

Function Documentation

void quickana ( TString  Fname = "",
double  Mom = 0,
TString  anadecay = "",
int  nevts = 0,
TString  anaparms = "",
bool  fastsim = false,
bool  runST = false,
int  run = 0,
int  runmode = 0 
)

Definition at line 20 of file tutorials/analysis/quickana.C.

References RhoCalculationTools::ForceConstantBz(), fRun, mp, run, PndSimpleCombinerTask::SetPidAlgo(), sqrt(), TString, and X.

21 {
22  if (Fname=="" || Mom==0)
23  {
24  cout << "USAGE:\n";
25  cout << "quickana.C( <input>, <mom>, <decay>, [nevt], [parms], [fastsim], [runST], [runnum], [mode] )\n\n";
26  cout << " <input> : input file name with PndPidCandidates\n";
27  cout << " <mom> : pbar momentum; negative values are interpreted as -E_cm\n";
28  cout << " <decay> : the decay pattern to be reconstructed, e.g. 'phi -> K+ K-; D_s+ -> phi pi-'\n";
29  cout << " [nevt] : number of events; default: 0 = all\n";
30  cout << " [parms] : parameters for the analysis, e.g. 'mwin=0.4:mwin(phi)=0.1:emin=0.1:pmin=0.1:qamc'; 'qapart' runs particle QA task\n";
31  cout << " [fastsim] : set true, if running fast sim (sets the PID algos properly); default: false'\n";
32  cout << " [runST] : if 'true' runs Software Trigger (default: false)\n";
33  cout << " [runnum] : integer run number (default: 0)\n";
34  cout << " [mode] : arbitrary mode number (default: 0)\n\n";
35  return;
36  }
37 
38  // do some reconstruction ?
39  bool doreco = (anadecay != "" || anaparms.Contains("nevt"));
40 
41  // do particle QA?
42  bool partQA = (anaparms.Contains("qapart"));
43  bool mc = !(anaparms.Contains("!mc")) && !(anaparms.Contains("qamc"));
44  bool neut = !(anaparms.Contains("!neut"));
45  bool chrg = !(anaparms.Contains("!chrg"));
46 
47  // if Mom<0, interprete as -E_cm
48  double mp = 0.938272;
49 
50  // if mom<0, it's -E_cm -> compute mom
51  if (Mom<0)
52  {
53  double X = (Mom*Mom-2*mp*mp)/(2*mp);
54  Mom = sqrt(X*X-mp*mp);
55  }
56 
57  // PID algorithm for the PndSimpleCombinerTask (for Eventshape variables)
58  TString pidalgo = "PidAlgoEmcBayes;PidAlgoDrc;PidAlgoDisc;PidAlgoStt;PidAlgoMdtHardCuts;PidAlgoRich;PidAlgoSciT";
59  if (fastsim) pidalgo = "PidChargedProbability";
60 
61  // allow shortcuts
62  anadecay.ReplaceAll("pbp","pbarpSystem");
63  anadecay.ReplaceAll("pbp0","pbarpSystem0");
64 
65  // Prevent generator from throwing a lot of warnings
66  //TLorentzVector fIni(0,0,Mom,0.938272+sqrt(Mom*Mom+0.938272*0.938272));
67  TDatabasePDG::Instance()->AddParticle("pbarpSystem","pbarpSystem",3,kFALSE,0.1,0, "",88888);
68  TDatabasePDG::Instance()->AddParticle("pbarpSystem0","pbarpSystem0",3,kFALSE,0.1,0, "",88880);
69 
70  // *** set this to your output path
71  TString OutFile = Fname;//(Fname.Last('/')+1,Fname.Length()); // cut away input path
72  OutFile.ReplaceAll(".root","_ana.root");
73 
74  // *** the output file for FairRunAna
75  TString InFile = Fname;
76  if (!InFile.EndsWith(".root")) InFile+="_fast.root";
77 
78  // *** initialization
79  FairLogger::GetLogger()->SetLogToFile(kFALSE);
80 
81  FairRunAna* fRun = new FairRunAna();
82  fRun->SetGenerateRunInfo(kFALSE);
83  fRun->SetSource(new FairFileSource(InFile));
84  fRun->SetOutputFile(OutFile);
85 
86  // *** take constant field; needed for PocaVtx
88 
89  // ***********************
90  // *** SoftTriggerTask ***
91  // ***********************
92 
93  if (runST)
94  {
95  // this file contains the trigger line definitions
96  TString triggercfg = TString(gSystem->Getenv("VMCWORKDIR"))+"/softrig/triggerlines.cfg"; // fullsim trigger definitions
97  if (fastsim) triggercfg = TString(gSystem->Getenv("VMCWORKDIR"))+"/softrig/triggerlines_fsim.cfg"; // fastsim trigger definitions
98 
99  PndSoftTriggerTask *stTask = new PndSoftTriggerTask(Mom, 0, run, triggercfg);
100 
101  if (fastsim) stTask->SetFastSimDefaults();
102  else stTask->SetFullSimDefaults();
103 
104  fRun->AddTask(stTask);
105  }
106 
107  // --------------------------------
108  // *** Analysis Task ***
109  // --------------------------------
110 
111  // *****************************
112  // *** PndSimpleCombinerTask ***
113  // *****************************
114 
115  if (doreco)
116  {
117  if (fastsim) anaparms+=":algo="+pidalgo;
118  PndSimpleCombinerTask *scTask = new PndSimpleCombinerTask(anadecay, anaparms, Mom, run, runmode);
119  scTask->SetPidAlgo(pidalgo);
120  fRun->AddTask(scTask);
121  }
122 
123  // *****************************
124  // *** PndParticleQATask ***
125  // *****************************
126 
127  if (partQA)
128  {
129  PndParticleQATask *partQaTask = new PndParticleQATask(fastsim,chrg,neut,mc); // particle QA task
130  fRun->AddTask(partQaTask);
131  }
132 
133 
134  // *** and run analysis
135  fRun->Init();
136  fRun->Run(0,nevts);
137 }
Int_t run
Definition: autocutx.C:47
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
void SetPidAlgo(TString algo)
static const double mp
Definition: mzparameters.h:11
static void ForceConstantBz(Double_t bz=0.)
Force a constant B field value for all positions.
FairRunAna * fRun
Definition: hit_dirc.C:58
double X
Definition: anaLmdDigi.C:68