FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndProdAnaTask Class Reference

#include <PndProdAnaTask.h>

Inheritance diagram for PndProdAnaTask:

Public Member Functions

 PndProdAnaTask (int mode=0, TString pidAlgo="")
 
 ~PndProdAnaTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
virtual void Finish ()
 

Private Member Functions

int SelectTruePid (PndAnalysis *ana, RhoCandList &l)
 
 ClassDef (PndProdAnaTask, 1)
 

Private Attributes

int fEvtCount
 
int fMode
 
TString fPidAlgo
 
RhoTuplentp
 
TLorentzVector fIni
 
PndAnalysisfAnalysis
 

Detailed Description

Definition at line 21 of file PndProdAnaTask.h.

Constructor & Destructor Documentation

PndProdAnaTask::PndProdAnaTask ( int  mode = 0,
TString  pidAlgo = "" 
)

Definition at line 54 of file PndProdAnaTask.cxx.

References fMode, fPidAlgo, and mode.

54  :
55  FairTask("Panda Tutorial Analysis Task")
56 {
57  fMode = mode;
58  fPidAlgo = pidAlgo;
59  if (fPidAlgo=="") fPidAlgo = "PidAlgoEmcBayes;PidAlgoDrc;PidAlgoDisc;PidAlgoStt;PidAlgoMdtHardCuts;PidAlgoSciT;PidAlgoRich";
60 }
Int_t mode
Definition: autocutx.C:47
PndProdAnaTask::~PndProdAnaTask ( )

Definition at line 65 of file PndProdAnaTask.cxx.

65 { }

Member Function Documentation

PndProdAnaTask::ClassDef ( PndProdAnaTask  ,
 
)
private
void PndProdAnaTask::Exec ( Option_t *  opt)
virtual

Definition at line 117 of file PndProdAnaTask.cxx.

References RhoTuple::Column(), RhoTuple::DumpData(), fAnalysis, fEvtCount, PndAnalysis::FillList(), fIni, RhoFitterBase::Fit(), fMode, fPidAlgo, RhoFitterBase::GetChi2(), PndAnalysis::GetEventInTask(), RhoCandidate::GetFit(), RhoCandidate::GetMcTruth(), i, ntp, and RhoCandidate::P4().

118 {
119  // *** some variables
120  int i=0,j=0, k=0, l=0;
121 
122  // necessary to read the next event
124 
125  if (!(++fEvtCount%100)) cout << "[PndProdAnaTask] evt "<<fEvtCount<<endl;
126 
127  // *** QA tool for simple dumping of analysis results in RhoRuple
128  // *** WIKI: https://panda-wiki.gsi.de/foswiki/bin/view/Computing/PandaRootAnalysisJuly13#PndRhoTupleQA
129  PndRhoTupleQA qa(fAnalysis,fIni.P());
130 
131  // *** RhoCandLists for the analysis
132  RhoCandList kp, km, pip, pim, D0, D0bar;
133 
134  // *** Select with no PID info ('All'); type and mass are set
135  fAnalysis->FillList(kp, "KaonAllPlus", fPidAlgo);
136  fAnalysis->FillList(km, "MuonAllMinus", fPidAlgo);
137  fAnalysis->FillList(pip, "PionAllPlus", fPidAlgo);
138  fAnalysis->FillList(pim, "PionAllMinus", fPidAlgo);
139 
140  D0.Combine(km, pip, 421);
141  D0bar.Combine(kp, pim, -421);
142 
143  D0.Append(D0bar);
144 
145  for (j=0; j<D0.GetLength(); ++j)
146  {
147  Float_t mmiss = (fIni-(D0[j]->P4())).M();
148  Float_t msum = D0[j]->M() + mmiss;
149 
150  // dump out information
151  ntp->Column("ev", (Int_t) fEvtCount);
152  ntp->Column("cand", (Int_t) j);
153  ntp->Column("ncand", (Int_t) D0.GetLength());
154  ntp->Column("mode", (Int_t) fMode);
155  ntp->Column("mmiss", (Float_t) mmiss);
156  ntp->Column("msum", (Float_t) msum);
157 
158  // store beam info
159  qa.qaP4("beam", fIni, ntp);
160 
161  // store information about composite candidate tree recursively (see analysis/AnalysisTools/PndRhoTupleQA)
162  qa.qaComp("x", D0[j], ntp);
163 
164  // store the 4-vector of the truth matched candidate (or a dummy, if not matched to keep ntuple consistent)
165  RhoCandidate *truth = D0[j]->GetMcTruth();
166  TLorentzVector lv(0,0,0,0);
167  if (truth) lv = truth->P4();
168  qa.qaP4("trx", lv, ntp);
169 
170  // do a vertex fit
171  RhoKinVtxFitter vtxfitter(D0[j]); // *** instantiate the vertex fitter; input is the object to be fitted
172  vtxfitter.Fit(); // *** perform fit
173 
174  RhoCandidate *cfit = D0[j]->GetFit(); // *** get the fitted candidate
175  qa.qaVtx("fvxx",cfit,ntp);
176  qa.qaP4("fvxx", cfit->P4(), ntp);
177  double chi2_vtx = vtxfitter.GetChi2(); // *** and the chi^2 of the fit
178  ntp->Column("chi2vx", (Float_t) chi2_vtx);
179 
180  // really write information to tree
181  ntp->DumpData();
182  }
183 }
TLorentzVector fIni
Int_t i
Definition: run_full.C:25
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
void GetEventInTask()
TLorentzVector P4() const
Definition: RhoCandidate.h:195
void Column(const char *label, Bool_t value, Bool_t defval=0, const char *block=0)
Definition: RhoTuple.cxx:56
RhoCandidate * GetMcTruth() const
Definition: RhoCandidate.h:437
PndAnalysis * fAnalysis
void DumpData()
Definition: RhoTuple.cxx:391
RhoCandidate * GetFit() const
Definition: RhoCandidate.h:293
RhoTuple * ntp
void PndProdAnaTask::Finish ( )
virtual

Definition at line 186 of file PndProdAnaTask.cxx.

References RhoTuple::GetInternalTree(), and ntp.

187 {
188  ntp->GetInternalTree()->Write();
189 }
TTree * GetInternalTree()
Definition: RhoTuple.h:207
RhoTuple * ntp
InitStatus PndProdAnaTask::Init ( )
virtual

Definition at line 89 of file PndProdAnaTask.cxx.

References fAnalysis, fEvtCount, fIni, RhoTuple::GetInternalTree(), and ntp.

90 {
91  // initialize analysis object
92  fAnalysis = new PndAnalysis();
93 
94  // reset the event counter
95  fEvtCount = 0;
96 
97  // *** Save current gDirectory
98  TDirectory *dir = gDirectory;
99  FairRootManager::Instance()->GetOutFile()->cd();
100 
101  ntp = new RhoTuple("ntp", "Prod Example Analysis: D0->K pi");
102  ntp->GetInternalTree()->SetDirectory(gDirectory);
103 
104  // *** restore original gDirectory
105  dir->cd();
106 
107  // *** the lorentz vector of the initial psi(2S)
108  fIni.SetXYZT(0, 0, 6.231552, 7.240065);
109 
110  return kSUCCESS;
111 }
TLorentzVector fIni
PndAnalysis * fAnalysis
TTree * GetInternalTree()
Definition: RhoTuple.h:207
RhoTuple * ntp
int PndProdAnaTask::SelectTruePid ( PndAnalysis ana,
RhoCandList l 
)
private

Definition at line 70 of file PndProdAnaTask.cxx.

References RhoCandList::GetLength(), PndAnalysis::McTruthMatch(), and RhoCandList::Remove().

71 {
72  int removed = 0;
73 
74  for (int ii=l.GetLength()-1;ii>=0;--ii)
75  {
76  if ( !(ana->McTruthMatch(l[ii])) )
77  {
78  l.Remove(l[ii]);
79  removed++;
80  }
81  }
82 
83  return removed;
84 }
Int_t GetLength() const
Definition: RhoCandList.h:46
Int_t Remove(RhoCandidate *)
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)

Member Data Documentation

PndAnalysis* PndProdAnaTask::fAnalysis
private

Definition at line 64 of file PndProdAnaTask.h.

Referenced by Exec(), and Init().

int PndProdAnaTask::fEvtCount
private

Definition at line 46 of file PndProdAnaTask.h.

Referenced by Exec(), and Init().

TLorentzVector PndProdAnaTask::fIni
private

Definition at line 61 of file PndProdAnaTask.h.

Referenced by Exec(), and Init().

int PndProdAnaTask::fMode
private

Definition at line 49 of file PndProdAnaTask.h.

Referenced by Exec(), and PndProdAnaTask().

TString PndProdAnaTask::fPidAlgo
private

Definition at line 52 of file PndProdAnaTask.h.

Referenced by Exec(), and PndProdAnaTask().

RhoTuple* PndProdAnaTask::ntp
private

Definition at line 55 of file PndProdAnaTask.h.

Referenced by Exec(), Finish(), and Init().


The documentation for this class was generated from the following files: