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

#include <PndScrutAnaTask.h>

Inheritance diagram for PndScrutAnaTask:

Public Member Functions

 PndScrutAnaTask (double pbarmom, TString outname)
 
 ~PndScrutAnaTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
virtual void Finish ()
 

Private Member Functions

virtual void SetParContainers ()
 
 ClassDef (PndScrutAnaTask, 1)
 

Private Attributes

int fEvtCount
 
TLorentzVector fIni
 
PndAnalysisfAnalysis
 
TDatabasePDG * fPdg
 
TFile * fFile
 
TString fOutName
 
RhoTuplentp1
 
RhoTuplentp2
 
RhoTuplenmc
 
RhoMassParticleSelectorjpsiMassSel
 
RhoMassParticleSelectorjpsiPreMassSel
 

Detailed Description

Definition at line 24 of file PndScrutAnaTask.h.

Constructor & Destructor Documentation

PndScrutAnaTask::PndScrutAnaTask ( double  pbarmom,
TString  outname 
)

Definition at line 60 of file PndScrutAnaTask.cxx.

References fIni, fOutName, mp, and sqrt().

60  :
61  FairTask("Panda Scrutiny Analysis Task")
62 {
63  double mp=0.938272;
64  fIni.SetXYZT(0,0,pbarmom, sqrt(pbarmom*pbarmom+mp*mp)+mp);
65 
66  fOutName = outname;
67 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TLorentzVector fIni
static const double mp
Definition: mzparameters.h:11
PndScrutAnaTask::~PndScrutAnaTask ( )

Definition at line 72 of file PndScrutAnaTask.cxx.

References fFile.

73 {
74  delete fFile;
75 }

Member Function Documentation

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

Definition at line 134 of file PndScrutAnaTask.cxx.

References RhoKinFitter::Add4MomConstraint(), all, RhoTuple::Column(), RhoTuple::DumpData(), fAnalysis, fEvtCount, PndAnalysis::FillList(), fIni, RhoKinFitter::Fit(), RhoFitterBase::GetChi2(), PndAnalysis::GetEvent(), RhoCandidate::GetFit(), RhoCandidate::GetMcTruth(), i, jpsiMassSel, jpsiPreMassSel, mclist, PndAnalysis::McTruthMatch(), muminus, muplus, nmc, ntp1, ntp2, RhoCandidate::P4(), piminus, piplus, and TString.

135 {
136  // *** some variables
137  int i=0,j=0;
138 
139  // *** necessary to read the next event
140  fAnalysis->GetEvent();
141 
142  // *** print event counter
143  if (!(++fEvtCount%100)) cout << "evt "<<fEvtCount<<endl;
144 
145  // *******
146  // ******* PUT ANALYSIS CODE HERE
147  // *******
148 
149  TString pidalg = "PidChargedProbability";
150 
151  // *** QA tool for simple dumping of analysis results in RhoRuple
152  // *** WIKI: https://panda-wiki.gsi.de/foswiki/bin/view/Computing/PandaRootAnalysisJuly13#PndRhoTupleQA
153  PndRhoTupleQA qa(fAnalysis,fIni.P());
154 
155  // *** RhoCandLists for the analysis
156  RhoCandList muplus, muminus, piplus, piminus, jpsi, psi2s, all, mclist;
157 
158 
159  // *** Select with PID info pidalg and ('All'); type and mass are set
160  fAnalysis->FillList(muplus, "MuonAllPlus", pidalg);
161  fAnalysis->FillList(muminus, "MuonAllMinus", pidalg);
162  fAnalysis->FillList(piplus, "PionAllPlus", pidalg);
163  fAnalysis->FillList(piminus, "PionAllMinus", pidalg);
164 
165 
166  // *** Setup event shape object
167  fAnalysis->FillList(all, "All", pidalg);
168  PndEventShape evsh(all, fIni, 0.05, 0.1);
169 
170 
171  // *** store MC info in ntuple
172  fAnalysis->FillList(mclist, "McTruth");
173 
174  nmc->Column("ev", (Int_t) fEvtCount);
175  qa.qaMcList("", mclist, nmc);
176  nmc->DumpData();
177 
178 
179  // *** combinatorics for J/psi -> mu+ mu-
180  jpsi.Combine(muplus, muminus);
181  jpsi.Select(jpsiPreMassSel);
182  jpsi.SetType(443);
183  int njmct = fAnalysis->McTruthMatch(jpsi); // match the whole list to count #matches (should be only 1)
184 
185  // *** write ntuple for the jpsi reconstruction
186  for (j=0;j<jpsi.GetLength();++j)
187  {
188  // some general info about event (actually written for each candidate!)
189  ntp1->Column("ev", (Float_t) i);
190  ntp1->Column("cand", (Float_t) j);
191  ntp1->Column("ncand", (Float_t) jpsi.GetLength());
192  ntp1->Column("nmct", (Float_t) njmct);
193 
194  // store info about initial 4-vector
195  qa.qaP4("beam", fIni, ntp1);
196 
197  // dump information about composite candidate tree recursively (see analysis/AnalysisTools/PndRhoTupleQA)
198  qa.qaComp("j", jpsi[j], ntp1);
199 
200  // dump info about event shapes
201  qa.qaEventShapeShort("es",&evsh, ntp1);
202 
203  // *** store the 4-vector of the truth matched candidate (or a dummy, if not matched to keep ntuple consistent)
204  RhoCandidate *truth = jpsi[j]->GetMcTruth();
205  TLorentzVector lv;
206  if (truth) lv = truth->P4();
207  qa.qaP4("trj", lv, ntp1);
208 
209  ntp1->DumpData();
210  }
211 
212 
213  // *** some rough mass selection on J/psi
214  jpsi.Select(jpsiMassSel);
215 
216  // *** combinatorics for psi(2S) -> J/psi pi+ pi-
217  psi2s.Combine(jpsi, piplus, piminus);
218  psi2s.SetType(100443);
219  int npsimct = fAnalysis->McTruthMatch(psi2s); // match the whole list to count #matches (should be only 1)
220 
221  // *** write ntuple for the psi(2S) reconstruction
222  for (j=0;j<psi2s.GetLength();++j)
223  {
224  // some general info about event (actually written for each candidate!)
225  ntp2->Column("ev", (Float_t) i);
226  ntp2->Column("cand", (Float_t) j);
227  ntp2->Column("ncand", (Float_t) psi2s.GetLength());
228  ntp2->Column("nmct", (Float_t) npsimct);
229 
230  RhoKinFitter kinfit(psi2s[j]);
231  kinfit.Add4MomConstraint(fIni);
232  kinfit.Fit();
233 
234  RhoCandidate *psifit=psi2s[j]->GetFit();
235  // store info about initial 4-vector
236  qa.qaP4("beam", fIni, ntp2);
237 
238  // dump information about composite candidate tree recursively (see analysis/AnalysisTools/PndRhoTupleQA)
239  qa.qaComp("psi", psi2s[j], ntp2);
240  qa.qaComp("fpsi",psifit, ntp2);
241  ntp2->Column("fchi2", (Float_t) kinfit.GetChi2());
242 
243  // dump info about event shapes
244  qa.qaEventShapeShort("es",&evsh, ntp2);
245 
246  // *** store the 4-vector of the truth matched candidate (or a dummy, if not matched to keep ntuple consistent)
247  RhoCandidate *truth = psi2s[j]->GetMcTruth();
248  TLorentzVector lv;
249  if (truth) lv = truth->P4();
250  qa.qaP4("trpsi", lv, ntp2);
251 
252  ntp2->DumpData();
253  }
254 
255 }
CandList mclist
Int_t i
Definition: run_full.C:25
PndAnalysis * fAnalysis
TLorentzVector fIni
RhoMassParticleSelector * jpsiMassSel
Bool_t FillList(RhoCandList &l, TString listkey="All", TString pidTcaNames="", int trackHypothesis=-1)
CandList piplus
CandList muplus
RhoMassParticleSelector * jpsiPreMassSel
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
void DumpData()
Definition: RhoTuple.cxx:391
CandList piminus
RhoCandidate * GetFit() const
Definition: RhoCandidate.h:293
Bool_t McTruthMatch(RhoCandidate *cand, Int_t level=2, bool verbose=false)
Int_t GetEvent(Int_t n=-1)
CandList muminus
void PndScrutAnaTask::Finish ( )
virtual

Definition at line 258 of file PndScrutAnaTask.cxx.

References fFile.

259 {
260 
261  // *******
262  // ******* STORE YOUR HISTOS AND TUPLES
263  // *******
264 
265  fFile->Write();
266  fFile->Close();
267 
268 }
InitStatus PndScrutAnaTask::Init ( )
virtual

Definition at line 80 of file PndScrutAnaTask.cxx.

References fAnalysis, fEvtCount, fFile, fOutName, fPdg, RhoTuple::GetInternalTree(), jpsiMassSel, jpsiPreMassSel, nmc, ntp1, and ntp2.

81 {
82  // *** initialize PndAnalysis object
83  fAnalysis = new PndAnalysis();
84 
85  // *** reset the event counter
86  fEvtCount = 0;
87 
88  // *******
89  // ******* PREPARE/CREATE THE STUFF YOU NEED
90  // *******
91 
92  fPdg = TDatabasePDG::Instance();
93 
94  // *** Mass selector for the jpsi cands
95  double m0_jpsi = fPdg->GetParticle("J/psi")->Mass(); // Get nominal PDG mass of the J/psi
96  jpsiMassSel = new RhoMassParticleSelector("jpsi" ,m0_jpsi,0.5);
97  jpsiPreMassSel = new RhoMassParticleSelector("jpsipre",m0_jpsi,2.0);
98 
99  // ***
100  // *** Prepare RhoTuple output
101  // ***
102  TDirectory *dir = gDirectory;
103  fFile=new TFile(fOutName,"RECREATE");
104  fFile->cd();
105 
106  // *** create some ntuples
107  ntp1 = new RhoTuple("ntp1", "jpsi analysis");
108  ntp2 = new RhoTuple("ntp2", "psi(2S) analysis");
109  nmc = new RhoTuple("nmc", "mctruth info");
110 
111  // assign RhoTuples to outfile
112  if (ntp1) ntp1->GetInternalTree()->SetDirectory(gDirectory);
113  if (ntp2) ntp2->GetInternalTree()->SetDirectory(gDirectory);
114  if (nmc) nmc->GetInternalTree()->SetDirectory(gDirectory);
115 
116  // *** restore original gDirectory
117  dir->cd();
118 
119  return kSUCCESS;
120 }
PndAnalysis * fAnalysis
RhoMassParticleSelector * jpsiMassSel
RhoMassParticleSelector * jpsiPreMassSel
TDatabasePDG * fPdg
TTree * GetInternalTree()
Definition: RhoTuple.h:207
void PndScrutAnaTask::SetParContainers ( )
privatevirtual

Definition at line 124 of file PndScrutAnaTask.cxx.

References run.

125 {
126  // *** Get run and runtime database
127  FairRun* run = FairRun::Instance();
128  if ( ! run ) Fatal("SetParContainers", "No analysis run");
129 }
Int_t run
Definition: autocutx.C:47

Member Data Documentation

PndAnalysis* PndScrutAnaTask::fAnalysis
private

Definition at line 54 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

int PndScrutAnaTask::fEvtCount
private

Definition at line 48 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

TFile* PndScrutAnaTask::fFile
private

Definition at line 56 of file PndScrutAnaTask.h.

Referenced by Finish(), Init(), and ~PndScrutAnaTask().

TLorentzVector PndScrutAnaTask::fIni
private

Definition at line 51 of file PndScrutAnaTask.h.

Referenced by Exec(), and PndScrutAnaTask().

TString PndScrutAnaTask::fOutName
private

Definition at line 57 of file PndScrutAnaTask.h.

Referenced by Init(), and PndScrutAnaTask().

TDatabasePDG* PndScrutAnaTask::fPdg
private

Definition at line 55 of file PndScrutAnaTask.h.

Referenced by Init().

RhoMassParticleSelector* PndScrutAnaTask::jpsiMassSel
private

Definition at line 68 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

RhoMassParticleSelector* PndScrutAnaTask::jpsiPreMassSel
private

Definition at line 69 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

RhoTuple* PndScrutAnaTask::nmc
private

Definition at line 66 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

RhoTuple* PndScrutAnaTask::ntp1
private

Definition at line 64 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().

RhoTuple* PndScrutAnaTask::ntp2
private

Definition at line 65 of file PndScrutAnaTask.h.

Referenced by Exec(), and Init().


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