FairRoot/PandaRoot
PndFsmSimpleTracker.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // Description:
3 // Class PndFsmSimpleTracker
4 //
5 // Example Tracker for the PANDA Fast Sim Detectors
6 //
7 // This software was developed for the PANDA collaboration. If you
8 // use all or part of it, please give an appropriate acknowledgement.
9 //
10 // Author List:
11 // Klaus Goetzen Original Author
12 //
13 // Copyright Information:
14 // Copyright (C) 2008 GSI
15 //
16 //------------------------------------------------------------------------
17 
18 //-----------------------
19 // This Class's Header --
20 //-----------------------
21 #include "PndFsmSimpleTracker.h"
22 
23 //-------------
24 // C Headers --
25 //-------------
26 
27 //---------------
28 // C++ Headers --
29 //---------------
30 #include <math.h>
31 #include <iostream>
32 
33 using std::cout;
34 using std::endl;
35 using std::ostream;
36 using std::string;
37 
38 //-------------------------------
39 // Collaborating Class Headers --
40 //-------------------------------
41 
42 #include "ArgList.h"
43 #include "PndFsmResponse.h"
44 #include "PndFsmTrack.h"
45 
46 //-----------------------------------------------------------------------
47 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
48 //-----------------------------------------------------------------------
49 
50 //----------------
51 // Constructors --
52 //----------------
53 
55 {
57 
58  _thtMin=_thtMin*M_PI/180.0;
59  _thtMax=_thtMax*M_PI/180.0;
60 
61  //print(std::cout);
62 }
63 
65 {
67  //set default parameter values and parses a parameter list
68  //i.e. std::list<std::string> of the form
69  //"a=1" "b=2" "c=3"
70  parseParameterList(par);
71 
72  _thtMin=_thtMin*M_PI/180.0;
73  _thtMax=_thtMax*M_PI/180.0;
74 
75  //print(std::cout);
76 }
77 
78 //--------------
79 // Destructor --
80 //--------------
81 
83 {
84 }
85 
86 //--------------
87 // Operations --
88 //--------------
89 
92 {
93  PndFsmResponse *result=new PndFsmResponse();
94 
95  result->setDetector(this);
96  bool wasDetected=detected(t);
97  result->setDetected(wasDetected);
98 
99  if (wasDetected && fabs(t->charge())>1e-8)
100  {
101  result->setdp(dp(t));
102  result->setdphi(dphi(t));
103  result->setdtheta(dtheta(t));
104  }
105 
106  return result;
107 }
108 
109 bool
111 {
112  double theta = t->p4().Theta();
113  double p_t=t->p4().Vect().Perp(TVector3(0.,0.,1.));
114  double p=t->p4().Vect().Mag();
115  double charge=t->charge();
116 
117  double eff = _efficiency;
118  // use parametrization for eff(p) for p<0.6 as multiplier for _efficiency from
119  // https://panda-wiki.gsi.de/foswiki/pub/Computing/Minutes07April2014/Costanza_EVO_April07.pdf
120  if (eff<0)
121  {
122  eff = -eff;
123  if (p<0.6) eff = eff * (0.32602 + 1.91679*p -1.58341*p*p + 0.305179*p*p*p);
124  }
125 
126  return ( charge!=0.0 && theta>=_thtMin && theta<=_thtMax && p_t>_ptmin && p>_pmin && _rand->Rndm()<=eff);
127 }
128 
129 
130 double
132 {
133  double p=t->p4().Vect().Mag();
134 
135  double res;
136 
137  // use parametrization dp/p(p) from
138  // https://panda-wiki.gsi.de/foswiki/pub/Computing/Minutes07April2014/Costanza_EVO_April07.pdf
139  if (_pRes<0)
140  res = 0.012 + p*0.0034;
141  else // use fixed resolution
142  res = _pRes * p;
143 
144  return res;
145 }
146 
147 double
149 {
150  double res = _phiRes;
151 
152  // use parametrization dphi(p) from
153  // https://panda-wiki.gsi.de/foswiki/pub/Computing/Minutes07April2014/Costanza_EVO_April07.pdf
154  if (_phiRes<0)
155  {
156  double p=t->p4().Vect().Mag();
157  res = 2.497e-3/pow(p,1.307) + 8.77e-4;
158  }
159 
160  return res;
161 }
162 
163 double
165 {
166  double res = _thtRes;
167 
168  // use parametrization dtheta(p) from
169  // https://panda-wiki.gsi.de/foswiki/pub/Computing/Minutes07April2014/Costanza_EVO_April07.pdf
170  if (_thtRes<0)
171  {
172  double p=t->p4().Vect().Mag();
173  res = 1.81e-3/pow(p,1.131) + 3.85e-4;
174  }
175  return res;
176 }
177 
178 void
180 {
181  o <<"Parameters for detector <"<<detName()<<">"<<endl;
182  o <<" _thtMin = " << _thtMin << endl;
183  o <<" _thtMax = " << _thtMax << endl;
184  o <<" _ptmin = " << _ptmin << endl;
185  o <<" _pmin = " << _pmin << endl;
186  o <<" _pRes = " << _pRes << " (rel)"<< endl;
187  if (_pRes<0) o<<" ... using parametrisation function for dp/p."<<endl;
188  o <<" _thtRes = " << _thtRes << endl;
189  if (_thtRes<0) o<<" ... using parametrisation function for dtht."<<endl;
190  o <<" _phiRes = " << _phiRes << endl;
191  if (_phiRes<0) o<<" ... using parametrisation function for dphi."<<endl;
192  o <<" _efficiency = " << _efficiency<<endl;
193  if (_efficiency<0) o<<" ... using parametrisation function for p<0.6."<<endl;
194 }
195 
196 void
198 {
199  _detName = "PndFsmSimpleTracker";
200  _thtMin = 7.765;
201  _thtMax = 159.44;
202  _ptmin = 0.1;
203  _pmin = 0.0;
204  // if the resolutions are <0, than the parametrisations according to
205  // https://panda-wiki.gsi.de/foswiki/pub/Computing/Minutes07April2014/Costanza_EVO_April07.pdf
206  // p.6, p.9, p.10 are used
207  _pRes = -1.;//0.02; // 2%
208  _thtRes = -1.;//0.005;
209  _phiRes = -1.;//0.005;
210  // if the efficiency<0 and p<0.6GeV/c, parametrisation as multiplier to _efficiency according to p.8; else flat _efficiency
211  _efficiency = -1.0;//
212 
213 }
214 
215 bool
216 PndFsmSimpleTracker::setParameter(std::string &name, double value)
217 {
218  // *****************
219  // include here all parameters which should be settable via script
220  // *****************
221 
222  bool knownName=true;
223 
224  if (name == "thtMin")
225  _thtMin=value;
226  else
227  if (name == "thtMax")
228  _thtMax=value;
229  else
230  if (name == "ptmin")
231  _ptmin=value;
232  else
233  if (name == "pmin")
234  _pmin=value;
235  else
236  if (name == "pRes")
237  _pRes=value;
238  else
239  if (name == "thtRes")
240  _thtRes=value;
241  else
242  if (name == "phiRes")
243  _phiRes=value;
244  else
245  if (name == "efficiency")
246  _efficiency=value;
247  else
248  knownName=false;
249 
250  return knownName;
251 }
252 
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdphi(double val)
Int_t res
Definition: anadigi.C:166
std::list< std::string > ArgList
Definition: ArgList.h:7
double dp(PndFsmTrack *t) const
Double_t par[3]
void print(std::ostream &o)
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
Double_t p
Definition: anasim.C:58
TLorentzVector p4()
Definition: PndFsmTrack.h:72
basic_ostream< char, char_traits< char > > ostream
void setDetector(PndFsmAbsDet *detector)
virtual PndFsmResponse * respond(PndFsmTrack *t)
const std::string & detName()
Definition: PndFsmAbsDet.h:74
void setdp(double val)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
double dtheta(PndFsmTrack *t) const
std::string _detName
Definition: PndFsmAbsDet.h:92
double dphi(PndFsmTrack *t) const
bool detected(PndFsmTrack *t) const
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
void setdtheta(double val)
bool setParameter(std::string &name, double value)