FairRoot/PandaRoot
Functions
macro/softrig/quickana.C File Reference

Go to the source code of this file.

Functions

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

Function Documentation

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

Definition at line 19 of file macro/softrig/quickana.C.

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

20 {
21  if (Fname=="" || anadecay=="")
22  {
23  cout << "USAGE:\n";
24  cout << "quickana.C( <input>, <mom>, <decay>, [nevt], [parms], [fastsim], [runST], [runnum] )\n\n";
25  cout << " <input> : input file name with PndPidCandidates\n";
26  cout << " <mom> : pbar momentum; negative values are interpreted as -E_cm\n";
27  cout << " <decay> : the decay pattern to be reconstructed, e.g. 'phi -> K+ K-; D_s+ -> phi pi-'\n";
28  cout << " [nevt] : number of events; default: 0 = all\n";
29  cout << " [parms] : parameters for the analysis, e.g. 'mwin=0.4:mwin(phi)=0.1:emin=0.1:pmin=0.1:qamc'\n";
30  cout << " [fastsim] : set true, if running fast sim (sets the PID algos properly); default: false'\n";
31  cout << " [runST] : if 'true' runs Software Trigger (default: false)\n";
32  cout << " [runnum] : integer run number (default: 0)\n\n";
33  return;
34  }
35 
36  // if Mom<0, interprete as -E_cm
37  double mp = 0.938272;
38 
39  // if mom<0, it's -E_cm -> compute mom
40  if (Mom<0)
41  {
42  double X = (Mom*Mom-2*mp*mp)/(2*mp);
43  Mom = sqrt(X*X-mp*mp);
44  }
45 
46  // PID algorithm for the PndSimpleCombinerTask (for Eventshape variables)
47  TString pidalgo = "PidAlgoEmcBayes;PidAlgoDrc;PidAlgoDisc;PidAlgoStt;PidAlgoMdtHardCuts";
48  if (fastsim) pidalgo = "PidChargedProbability";
49 
50  // allow shortcuts
51  anadecay.ReplaceAll("pbp","pbarpSystem");
52  anadecay.ReplaceAll("pbp0","pbarpSystem0");
53 
54  // Prevent generator from throwing a lot of warnings
55  //TLorentzVector fIni(0,0,Mom,0.938272+sqrt(Mom*Mom+0.938272*0.938272));
56  TDatabasePDG::Instance()->AddParticle("pbarpSystem","pbarpSystem",3,kFALSE,0.1,0, "",88888);
57  TDatabasePDG::Instance()->AddParticle("pbarpSystem0","pbarpSystem0",3,kFALSE,0.1,0, "",88880);
58  TDatabasePDG::Instance()->AddParticle("Z(3900)+","Z+",3.900,kFALSE,0.1,0, "",90000);
59  TDatabasePDG::Instance()->AddParticle("Z(3900)-","Z-",3.900,kFALSE,0.1,0, "",-90000);
60 
61  // *** set this to your output path
62  TString OutFile = Fname(Fname.Last('/')+1,Fname.Length()); // cut away input path
63  OutFile.ReplaceAll(".root","_ana.root");
64 
65  // *** the output file for FairRunAna
66  TString InFile = Fname;
67  if (!InFile.EndsWith(".root")) InFile+="_fast.root";
68 
69  // *** initialization
70  FairLogger::GetLogger()->SetLogToFile(kFALSE);
71 
72  FairRunAna* fRun = new FairRunAna();
73  fRun->SetGenerateRunInfo(kFALSE);
74  fRun->SetInputFile(InFile);
75  fRun->SetOutputFile(OutFile);
76 
77  // *** take constant field; needed for PocaVtx
79 
80  // ***********************
81  // *** SoftTriggerTask ***
82  // ***********************
83 
84  if (runST)
85  {
86  // this file contains the trigger line definitions
87  TString triggercfg = TString(gSystem->Getenv("VMCWORKDIR"))+"/softrig/triggerlines.cfg"; // fullsim trigger definitions
88  if (fastsim) triggercfg = TString(gSystem->Getenv("VMCWORKDIR"))+"/softrig/triggerlines_fsim.cfg"; // fastsim trigger definitions
89 
90  PndSoftTriggerTask *stTask = new PndSoftTriggerTask(Mom, 0, run, triggercfg);
91 
92  if (fastsim) stTask->SetFastSimDefaults();
93  else stTask->SetFullSimDefaults();
94 
95  fRun->AddTask(stTask);
96  }
97 
98  // --------------------------------
99  // *** Analysis Task ***
100  // --------------------------------
101 
102  // *****************************
103  // *** PndSimpleCombinerTask ***
104  // *****************************
105  if (fastsim) anaparms+=":algo="+pidalgo;
106  PndSimpleCombinerTask *scTask = new PndSimpleCombinerTask(anadecay, anaparms, Mom, run);
107  scTask->SetPidAlgo(pidalgo);
108  fRun->AddTask(scTask);
109 
110  // *** and run analysis
111  fRun->Init();
112  fRun->Run(0,nevts);
113  return 0;
114 }
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