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

#include <PndRichRecoTask.h>

Inheritance diagram for PndRichRecoTask:

Public Member Functions

 PndRichRecoTask ()
 
 ~PndRichRecoTask ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 
void SetPersistence (Bool_t persistence)
 
void SetGeoVersion (UInt_t version)
 
void SetParticleID (UInt_t pid)
 
void SetTrackPosition (TVector3 pos)
 
void SetTrackDirection (TVector3 dir)
 
void SetTrackPositionSecond (TVector3 pos)
 
void SetTrackDirectionSecond (TVector3 dir)
 
void SetNumberOfEvents (UInt_t events)
 
TF1 * GetPeakParameters (std::vector< Double_t > v, UInt_t nbins, Double_t xmin, Double_t xmax, Double_t sig)
 
void FinishEvent ()
 
void FinishTask ()
 

Private Member Functions

 ClassDef (PndRichRecoTask, 1)
 PndRichBarPoint TCA. More...
 

Private Attributes

Bool_t fPersistence
 
UInt_t fNumberOfEvents
 
UInt_t fGeoVersion
 
UInt_t fParticleID
 
UInt_t fEvent
 
PndRichRecofRichReco
 
TVector3 fTrackPosition
 
TVector3 fTrackDirection
 
TVector3 fTrackPositionSecond
 
TVector3 fTrackDirectionSecond
 
std::vector< UInt_t > vnhits
 
std::vector< Double_tvth
 
std::vector< Double_tvph
 
std::vector< Double_tvdth
 
std::vector< Double_tvmean
 
std::vector< Double_tvsigma
 
PndRichResolutionfRichResolution
 
TClonesArray * fRichBarPoint
 

Detailed Description

Definition at line 15 of file PndRichRecoTask.h.

Constructor & Destructor Documentation

PndRichRecoTask::PndRichRecoTask ( )

Default constructor

Definition at line 22 of file PndRichRecoTask.cxx.

References fVerbose.

22  :
23  FairTask("Rich Reco task") ,
24  fPersistence(kTRUE),
25  fNumberOfEvents(0),
26  fEvent(0),
27  fTrackPositionSecond(0,0,0),
29 {
30  fVerbose=1;
31 }
TVector3 fTrackDirectionSecond
int fVerbose
Definition: poormantracks.C:24
TVector3 fTrackPositionSecond
PndRichRecoTask::~PndRichRecoTask ( )

Destructor

Definition at line 35 of file PndRichRecoTask.cxx.

35  {
36 }

Member Function Documentation

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

Virtual method Exec

Definition at line 66 of file PndRichRecoTask.cxx.

References dbpoint::beta, Double_t, fEvent, fRichBarPoint, fRichReco, fRichResolution, fTrackDirection, fTrackDirectionSecond, fTrackPosition, fTrackPositionSecond, fVerbose, PndRichReco::GetDThetas(), PndRichBarPoint::GetPdgCode(), PndRichReco::GetPhis(), PndRichReco::GetThetas(), i, dbpoint::mass, mom, p, chigen::pythia::pdf, dbpoint::phi, pnt, pos, PndRichReco::RichFullReconstruction(), PndRichResolution::Shift(), PndRichResolution::Sigma(), CAMath::Sqrt(), dbpoint::theta, vdth, vmean, vnhits, vph, vsigma, vth, dbpoint::x, and dbpoint::y.

66  {
67  if(fVerbose > 0) {
68  //cout << "==================== EVENT " << evt << endl;
69  }
70  fEvent++;
71  //fRichReco->RichFullReconstruction();
72 
73  TVector3 pos = fTrackPosition;
74  TVector3 dir = fTrackDirection.Unit();
75  Double_t mom = 0;
76  Double_t tm = 0;
77  Int_t pdg = 0;
78 
79  PndRichBarPoint *richHit = NULL;
80  Int_t richEntries = fRichBarPoint->GetEntriesFast();
81  if (richEntries) {
82  richHit = (PndRichBarPoint*)fRichBarPoint->At(0);
83  //pos = richHit->GetPosition0();
84  //dir = richHit->GetMomentum0().Unit();
85  //mom = richHit->GetMomentum0().Mag();
86  pos = TVector3(richHit->GetX(),richHit->GetY(),richHit->GetZ());
87  TVector3 p = TVector3(richHit->GetPx(),richHit->GetPy(),richHit->GetPz());
88  dir = p.Unit();
89  mom = p.Mag();
90  tm = richHit->GetTime();
91  pdg = richHit->GetPdgCode();
92  }
93 
94  Int_t richPhot = 0;
95  Float_t richThetaC = -1000, richThetaCErr = 0;
96  Float_t richQuality = 1000000;
97  // first particle
99  richQuality,richThetaC,richThetaCErr,richPhot);
100  std::vector<Double_t> dth = fRichReco->GetDThetas();
101 
102  std::cout << std::setprecision(10) << std::endl;
103  std::cout << "PndRichRecoTask: " << fEvent << " " << richQuality << " " << richThetaC
104  << " " << richThetaCErr << " " << richPhot << " " << 1
105  << " " << mom << " " << dir.Phi() << " " << dir.Theta()
106  << " " << pos.X() << " " << pos.Y() << " " << pdg << std::endl;
107  Double_t mass[5] = {0.000510998961,0.1056583745,0.13957018,0.493667,0.9382720813};
108  Double_t pdf[5];
109  Double_t pdfsum = 0;
110  dbpoint pnt;
111  for(Int_t i=0;i<5;i++)
112  {
113  Float_t richThetaCx = richThetaC;
114  pnt.mass = mass[i];
115  pnt.beta = richThetaCx;
116  pnt.x = pos.X();
117  pnt.y = pos.Y();
118  pnt.theta = dir.Theta();
119  pnt.phi = dir.Phi();
120  pnt.beta += fRichResolution->Shift(pnt);
121  richThetaCx += fRichResolution->Shift(pnt);
122 
123  std::cout << i << " " << fRichResolution->Shift(pnt) << " " << fRichResolution->Sigma(pnt) << " " << mass[i] << " " <<
124  pnt.beta << " " << pnt.x << " " << pnt.y << " " << pnt.theta << " " << pnt.phi << std::endl;
125 
126  Double_t beta = mom / TMath::Sqrt(mom*mom + mass[i]*mass[i]);
127  TF1 *gausPdf = new TF1("gausPdf","gausn",0,1);
128  gausPdf->SetParameter(0,1);
129  gausPdf->SetParameter(1,richThetaCx);
130  gausPdf->SetParameter(2,richThetaCErr);
131  //gausPdf->SetParameter(2,fRichResolution->Sigma(pnt));
132  pdf[i] = gausPdf->Eval(beta);
133  pdfsum += pdf[i];
134  delete gausPdf;
135  }
136  std::cout << "particles PID: ";
137  for(Int_t i=0;i<5;i++)
138  std::cout << pdf[i] << " " << (pdfsum?pdf[i]/pdfsum:0.2) << " " ;
139  std::cout << std::endl;
140 
141  vdth.insert(vdth.end(),dth.begin(),dth.end());
142  vnhits.push_back(dth.size());
143  vmean.push_back(richThetaC);
144  vsigma.push_back(richThetaCErr);
145 
146  std::vector<Double_t> th = fRichReco->GetThetas();
147  std::vector<Double_t> ph = fRichReco->GetPhis();
148  vth.insert(vth.end(),th.begin(),th.end());
149  vph.insert(vph.end(),ph.begin(),ph.end());
150 
151  for(size_t i=0; i<ph.size(); i++)
152  std::cout << "::HitPars() " << fEvent << " " << ph.at(i) << " " <<
153  th.at(i) << " " << dth.at(i) << std::endl;
154 
155  if (fTrackDirectionSecond.Mag()!=0) {
156  // secon particle
158  richQuality,richThetaC,richThetaCErr,richPhot);
159  std::cout << "PndRichRecoTask: " << fEvent << " " << richQuality << " " << richThetaC
160  << " " << richThetaCErr << " " << richPhot << " " << 2 << std::endl;
161  }
162 }
TVector3 pos
TVector3 fTrackDirectionSecond
Double_t p
Definition: anasim.C:58
int fVerbose
Definition: poormantracks.C:24
std::vector< double > GetDThetas()
Double_t x
Definition: PndRichCalDb.h:25
std::vector< Double_t > vsigma
PndRichResolution * fRichResolution
Int_t i
Definition: run_full.C:25
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
std::vector< double > GetThetas()
TVector3 fTrackPosition
TClonesArray * pnt
Double_t mom
Definition: plot_dirc.C:14
void RichFullReconstruction(TVector3 pos, TVector3 dir, Float_t ts, Float_t &chi2, Float_t &chTh, Float_t &dChTh, Int_t &nph)
std::vector< Double_t > vmean
std::vector< Double_t > vth
TVector3 fTrackDirection
Double_t
Double_t mass
Definition: PndRichCalDb.h:23
Double_t Shift(dbpoint pnt)
TClonesArray * fRichBarPoint
std::vector< Double_t > vdth
std::vector< UInt_t > vnhits
Int_t GetPdgCode() const
TVector3 fTrackPositionSecond
PndRichReco * fRichReco
std::vector< double > GetPhis()
Double_t theta
Definition: PndRichCalDb.h:27
Pythia8::PDF * pdf
Double_t phi
Definition: PndRichCalDb.h:28
Double_t Sigma(dbpoint pnt)
Double_t beta
Definition: PndRichCalDb.h:24
Double_t y
Definition: PndRichCalDb.h:26
std::vector< Double_t > vph
void PndRichRecoTask::FinishEvent ( )

Definition at line 164 of file PndRichRecoTask.cxx.

165 {
166 }
void PndRichRecoTask::FinishTask ( )

Definition at line 168 of file PndRichRecoTask.cxx.

References Double_t, f, f1, fabs(), GetPeakParameters(), i, mean, nhits, vdth, vmean, and vsigma.

169 {
170  std::cout << "::FinishTask() " << vmean.size() << " " << vsigma.size() << std::endl;
171  TF1 * f = GetPeakParameters(vmean,1100,0.95,1.005,0.0003);
172 
173  double chisq=f->GetChisquare();
174  double ndf=f->GetNDF();
175  double chisqdf=chisq/ndf;
176  std::cout << "Chisquare: " << chisq << "/" << ndf << " : " << chisqdf << std::endl;
177 
178  //Double_t amp = f->GetParameter(0); //value of 0th parameter //[R.K. 03/2017] unused variable?
179  //Double_t eamp = f->GetParError(0); //error on 0th parameter //[R.K. 03/2017] unused variable?
180  Double_t mean = f->GetParameter(1); //value of 1st parameter
181  Double_t emean = f->GetParError(1); //error on 1st parameter
182  Double_t sig = f->GetParameter(2); //value of 1st parameter
183  Double_t esig = f->GetParError(2); //error on 1st parameter
184 
185  size_t nhits = 0;
186  for(size_t i=0; i<vmean.size(); i++) {
187  if ( std::fabs(vmean.at(i)-mean) < 3*sig ) nhits++;
188  }
189 
190  std::cout << "::FinishTask() " << mean << " " << sig << std::endl;
191  std::cout << "CalData: " << chisq << std::endl;
192  std::cout << "CalData: " << ndf << std::endl;
193  std::cout << "CalData: " << nhits << std::endl;
194  std::cout << "CalData: " << mean << std::endl;
195  std::cout << "CalData: " << emean << std::endl;
196  std::cout << "CalData: " << sig << std::endl;
197  std::cout << "CalData: " << esig << std::endl;
198 
199  TF1 * f1 = GetPeakParameters(vdth,500,-0.05,0.05,0.003);
200 
201  chisq=f1->GetChisquare();
202  ndf=f1->GetNDF();
203  chisqdf=chisq/ndf;
204  std::cout << "Chisquare: " << chisq << "/" << ndf << " : " << chisqdf << std::endl;
205 
206  //amp = f1->GetParameter(0); //value of 0th parameter //[R.K. 03/2017] unused variable?
207  //eamp = f1->GetParError(0); //error on 0th parameter //[R.K. 03/2017] unused variable?
208  mean = f1->GetParameter(1); //value of 1st parameter
209  emean = f1->GetParError(1); //error on 1st parameter
210  sig = f1->GetParameter(2); //value of 1st parameter
211  esig = f1->GetParError(2); //error on 1st parameter
212 
213  std::cout << "::FinishTask() " << mean << " " << sig << std::endl;
214  std::cout << "CalData: " << chisq << std::endl;
215  std::cout << "CalData: " << ndf << std::endl;
216  std::cout << "CalData: " << mean << std::endl;
217  std::cout << "CalData: " << emean << std::endl;
218  std::cout << "CalData: " << sig << std::endl;
219  std::cout << "CalData: " << esig << std::endl;
220 
221 }
std::vector< Double_t > vsigma
Int_t i
Definition: run_full.C:25
TF1 * f1
Definition: reco_analys2.C:50
std::vector< Double_t > vmean
Double_t
TFile * f
Definition: bump_analys.C:12
TF1 * GetPeakParameters(std::vector< Double_t > v, UInt_t nbins, Double_t xmin, Double_t xmax, Double_t sig)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
std::vector< Double_t > vdth
Double_t mean[nsteps]
Definition: dedx_bands.C:65
TF1 * PndRichRecoTask::GetPeakParameters ( std::vector< Double_t v,
UInt_t  nbins,
Double_t  xmin,
Double_t  xmax,
Double_t  sig 
)

Definition at line 223 of file PndRichRecoTask.cxx.

References Double_t, i, and xmin.

Referenced by FinishTask().

226 {
227  TH1F * hbetafit = new TH1F("hist", "for gauss fit", nbins, xmin, xmax);
228  for(size_t i=0; i<v.size(); i++)
229  hbetafit->Fill(v.at(i));
230  int ipeak = hbetafit->GetMaximumBin();
231  double amp0 = hbetafit->GetMaximum();
232  double peak = xmin + (ipeak-0.5)*(xmax-xmin)/nbins;
233  TF1 * gfit = new TF1("Gaussian","gaus",xmin,xmax);
234  gfit->SetParameter(0,amp0);
235  gfit->SetParameter(1,peak);
236  gfit->SetParameter(2,sig);
237  for(size_t i=0; i<5; i++) {
238  Double_t meanf = gfit->GetParameter(1);
239  Double_t sigf = gfit->GetParameter(2);
240  double xminf = meanf - 3*sigf;
241  double xmaxf = meanf + 3*sigf;
242  hbetafit->Fit("Gaussian","Q","",xminf,xmaxf);
243  }
244  delete hbetafit;
245  return gfit;
246 }
Int_t i
Definition: run_full.C:25
Double_t xmax
__m128 v
Definition: P4_F32vec4.h:4
Double_t
int nbins
Definition: full_core_ntp.C:33
Double_t xmin
InitStatus PndRichRecoTask::Init ( )
virtual

Virtual method Init

Definition at line 40 of file PndRichRecoTask.cxx.

References fGeoVersion, fNumberOfEvents, fRichBarPoint, fRichReco, fRichResolution, vmean, vnhits, and vsigma.

40  {
41 
42  FairRootManager *ioman = FairRootManager::Instance();
43 
44  if (!ioman)
45  {
46  cout << "-E- PndRichRecoTask: "
47  << "RootManager not instantised!" << endl;
48  return kFATAL;
49  }
50 
51  fRichReco = new PndRichReco(fGeoVersion); // 13 - one of the flat mirror variant
52  vnhits.reserve(fNumberOfEvents);
53  vmean.reserve(fNumberOfEvents);
54  vsigma.reserve(fNumberOfEvents);
55  fRichBarPoint = dynamic_cast<TClonesArray *> (ioman->GetObject("RichBarPoint"));
56 
58 
59  cout << "-I- PndRichRecoTask: Intialisation successfull " << endl;
60  return kSUCCESS;
61 }
std::vector< Double_t > vsigma
PndRichResolution * fRichResolution
std::vector< Double_t > vmean
TClonesArray * fRichBarPoint
std::vector< UInt_t > vnhits
PndRichReco * fRichReco
void PndRichRecoTask::SetGeoVersion ( UInt_t  version)
inline

Definition at line 34 of file PndRichRecoTask.h.

References fGeoVersion.

34 { fGeoVersion = version; }
void PndRichRecoTask::SetNumberOfEvents ( UInt_t  events)
inline

Definition at line 40 of file PndRichRecoTask.h.

References fNumberOfEvents.

40 { fNumberOfEvents = events; }
void PndRichRecoTask::SetParticleID ( UInt_t  pid)
inline

Definition at line 35 of file PndRichRecoTask.h.

References fParticleID, and pid().

35 { fParticleID = pid; }
int pid()
void PndRichRecoTask::SetPersistence ( Bool_t  persistence)
inline

set persistence flag

Definition at line 32 of file PndRichRecoTask.h.

References fPersistence.

32 { fPersistence = persistence; }
void PndRichRecoTask::SetTrackDirection ( TVector3  dir)
inline

Definition at line 37 of file PndRichRecoTask.h.

References fTrackDirection.

37 { fTrackDirection = dir; }
TVector3 fTrackDirection
void PndRichRecoTask::SetTrackDirectionSecond ( TVector3  dir)
inline

Definition at line 39 of file PndRichRecoTask.h.

References fTrackDirectionSecond.

39 { fTrackDirectionSecond = dir; }
TVector3 fTrackDirectionSecond
void PndRichRecoTask::SetTrackPosition ( TVector3  pos)
inline

Definition at line 36 of file PndRichRecoTask.h.

References fTrackPosition, and pos.

36 { fTrackPosition = pos; }
TVector3 pos
TVector3 fTrackPosition
void PndRichRecoTask::SetTrackPositionSecond ( TVector3  pos)
inline

Definition at line 38 of file PndRichRecoTask.h.

References fTrackPositionSecond, and pos.

TVector3 pos
TVector3 fTrackPositionSecond

Member Data Documentation

UInt_t PndRichRecoTask::fEvent
private

Definition at line 54 of file PndRichRecoTask.h.

Referenced by Exec().

UInt_t PndRichRecoTask::fGeoVersion
private

Definition at line 52 of file PndRichRecoTask.h.

Referenced by Init(), and SetGeoVersion().

UInt_t PndRichRecoTask::fNumberOfEvents
private

Definition at line 51 of file PndRichRecoTask.h.

Referenced by Init(), and SetNumberOfEvents().

UInt_t PndRichRecoTask::fParticleID
private

Definition at line 53 of file PndRichRecoTask.h.

Referenced by SetParticleID().

Bool_t PndRichRecoTask::fPersistence
private

object persistence

Definition at line 49 of file PndRichRecoTask.h.

Referenced by SetPersistence().

TClonesArray* PndRichRecoTask::fRichBarPoint
private

Definition at line 69 of file PndRichRecoTask.h.

Referenced by Exec(), and Init().

PndRichReco* PndRichRecoTask::fRichReco
private

Definition at line 55 of file PndRichRecoTask.h.

Referenced by Exec(), and Init().

PndRichResolution* PndRichRecoTask::fRichResolution
private

Definition at line 67 of file PndRichRecoTask.h.

Referenced by Exec(), and Init().

TVector3 PndRichRecoTask::fTrackDirection
private

Definition at line 57 of file PndRichRecoTask.h.

Referenced by Exec(), and SetTrackDirection().

TVector3 PndRichRecoTask::fTrackDirectionSecond
private

Definition at line 59 of file PndRichRecoTask.h.

Referenced by Exec(), and SetTrackDirectionSecond().

TVector3 PndRichRecoTask::fTrackPosition
private

Definition at line 56 of file PndRichRecoTask.h.

Referenced by Exec(), and SetTrackPosition().

TVector3 PndRichRecoTask::fTrackPositionSecond
private

Definition at line 58 of file PndRichRecoTask.h.

Referenced by Exec(), and SetTrackPositionSecond().

std::vector<Double_t> PndRichRecoTask::vdth
private

Definition at line 63 of file PndRichRecoTask.h.

Referenced by Exec(), and FinishTask().

std::vector<Double_t> PndRichRecoTask::vmean
private

Definition at line 64 of file PndRichRecoTask.h.

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

std::vector<UInt_t> PndRichRecoTask::vnhits
private

Definition at line 60 of file PndRichRecoTask.h.

Referenced by Exec(), and Init().

std::vector<Double_t> PndRichRecoTask::vph
private

Definition at line 62 of file PndRichRecoTask.h.

Referenced by Exec().

std::vector<Double_t> PndRichRecoTask::vsigma
private

Definition at line 65 of file PndRichRecoTask.h.

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

std::vector<Double_t> PndRichRecoTask::vth
private

Definition at line 61 of file PndRichRecoTask.h.

Referenced by Exec().


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