FairRoot/PandaRoot
PndFsmTof.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: FsmTof.cc,v 1.2 2007/05/24 08:07:40 klausg Exp $
4 //
5 // Description:
6 // Class FsmTof
7 //
8 // Implementation of the barrel tof for the FastSim
9 //
10 // This software was developed for the PANDA collaboration. If you
11 // use all or part of it, please give an appropriate acknowledgement.
12 //
13 // Author List:
14 // Klaus Goetzen Original Author
15 //
16 // Copyright Information:
17 // Copyright (C) 2006 GSI
18 //
19 //------------------------------------------------------------------------
20 
21 //-----------------------
22 // This Class's Header --
23 //-----------------------
24 #include "PndFsmTof.h"
25 
26 //-------------
27 // C Headers --
28 //-------------
29 
30 //---------------
31 // C++ Headers --
32 //---------------
33 #include <math.h>
34 #include <iostream>
35 
36 using std::cout;
37 using std::endl;
38 using std::ostream;
39 using std::string;
40 
41 //-------------------------------
42 // Collaborating Class Headers --
43 //-------------------------------
44 
45 #include "ArgList.h"
46 #include "PndFsmResponse.h"
47 #include "PndFsmTrack.h"
48 
49 //-----------------------------------------------------------------------
50 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
51 //-----------------------------------------------------------------------
52 
53 //----------------
54 // Constructors --
55 //----------------
56 
58 {
60 
61  _thtMin=_thtMin*M_PI/180.0;
62  _thtMax=_thtMax*M_PI/180.0;
63  //print(std::cout);
64 }
65 
67 {
69  //set default parameter values and parses a parameter list
70  //i.e. std::list<std::string> of the form
71  //"a=1" "b=2" "c=3"
72  parseParameterList(par);
73 
74  _thtMin=_thtMin*M_PI/180.0;
75  _thtMax=_thtMax*M_PI/180.0;
76  //print(std::cout);
77 }
78 
79 //--------------
80 // Destructor --
81 //--------------
82 
84 {
85 }
86 
87 //--------------
88 // Operations --
89 //--------------
90 
93 {
94  PndFsmResponse *result=new PndFsmResponse();
95 
96  result->setDetector(this);
97  bool wasDetected=detected(t);
98 // result->setDetected(wasDetected);
99 
100  if (wasDetected && fabs(t->charge())>0.999)
101  {
102  TParticlePDG* part = _fdbPDG->GetParticle(t->pdt());
103  double mass = (part) ? part->Mass() : t->p4().M();
104  double theta = t->p4().Theta();
105  double p=t->p4().Vect().Mag();
106  double stht=sin(theta);
107  double p_t=p*stht;
108  double En=t->p4().E();
109  double sigp=_dp*p;
110  double dt=_dt * 1e-12 * 2.998*(1e+8) * sqrt(2.0); // time resolution of tof
111 
112  if ( p==0 || p_t==0 || En==0 ) {result->setDetected(false);return result;} // floating point check ********************
113 
114  // curvature of track due to magnet field
115  double r = 3.3356 * p_t / _Bfield;
116 
117  // particle didn't pass through Tof
118  if( (2*r) < _rBarrel) {
119 
120  result->setDetected(false);
121  //std ::cout << "2r < rBarrel:: false from tof" << std::endl;
122  return result;
123  }
124 
125  else {
126 
127  double omega = _Bfield / 3.3356 / En; // angle velocity
128  double time = 2.0*asin(_rBarrel/2.0/r)/omega; // time
129  double measp = _rand->Gaus(p,sigp);
130 // std::cout<<"momen_smear_tof"<<p << "measp=" << measp;
131  double measpt=measp*stht;
132 
133  double meas_t = _rand->Gaus(0.0,dt);
134  double meastime = time + meas_t ;
135 
136 // std::cout<<"time_Tof"<<time << "meas_t=" << meas_t << std::endl;
137 
138  if (measpt==0) {result->setDetected(false);return result;} // floating point check ********************
139 
140  double arg = _rBarrel/2.0 *_Bfield/3.3356/measpt;
141 
142  if ( fabs(arg)>1.0 ) {result->setDetected(false);return result;} // floating point check ********************
143 
144  double measE=0;
145  measE = meastime*_Bfield /3.3356 *0.5/asin(arg);
146 
147  double measmas2 = measE* measE - measp* measp ;
148 
149  if (measmas2<0) {result->setDetected(false);return result;} // floating point check ********************
150 
151  double measmas = sqrt( measmas2);
152 
153 
154  //std::cout<<"mass2 from tof" << measmas2 << std::endl;
155 
156  double m_e = _fdbPDG->GetParticle(11)->Mass();
157  double m_mu = _fdbPDG->GetParticle(13)->Mass();
158  double m_pi = _fdbPDG->GetParticle(211)->Mass();
159  double m_K = _fdbPDG->GetParticle(321)->Mass();
160  double m_p = _fdbPDG->GetParticle(2212)->Mass();
161 
162  double sig_e=0.05; // to be refined
163  double sig_mu=0.05; // to be refined
164  double sig_pi=0.05; // to be refined
165  double sig_K=0.05; // to be refined
166  double sig_p=0.05; // to be refined
167 
168  double dm_p = measmas - mass;
169 
170  //error calc of m^2
171  double dE=measE*dt/meastime;
172  double dm2=2*sqrt(measE*measE*dE*dE+measp*measp*sigp*sigp);
173 
174  result->setdm(dm_p);
175  //double dm_test=result->dm(); //[R.K. 01/2017] unused variable //aida
176  // std::cout <<"Tof_result_setdm ="<< dm_test <<std::endl; //aida
177 
178 /*
179  if(fabs(measmas2)<3.5) { result ->setm2(measmas2);}
180  else {measmas2=3.5, result ->setm2(measmas2);}
181 */
182  result ->setm2(measmas2,dm2);
183 
184  result->setLHElectron( gauss_t(measmas,m_e,sig_e) );
185  result->setLHMuon( gauss_t(measmas,m_mu,sig_mu) );
186  result->setLHPion( gauss_t(measmas,m_pi,sig_pi) );;
187  result->setLHKaon ( gauss_t(measmas,m_K,sig_K) );
188  result->setLHProton( gauss_t(measmas,m_p,sig_p) );
189  }
190  }
191  return result;
192 }
193 
194 double
195 PndFsmTof::gauss_t(double x, double x0, double s)
196 {
197  return (1.0/(sqrt(2.0*M_PI)*s))*
198  exp(-(x-x0)*(x-x0)/(2.0*s*s));
199 }
200 
201 bool
203 {
204  if (t->hitMapValid()) {
205  return t->hitMapResponse(FsmDetEnum::Tof);
206  }
207  else
208  {
209 
210  int lundId = abs(t->pdt());
211  //TParticlePDG* part = _fdbPDG->GetParticle(lundId); //[R.K. 01/2017] unused variable?
212  //double mass = (part) ? part->Mass() : t->p4().M(); //[R.K. 01/2017] unused variable
213  double theta = t->p4().Theta();
214  //double p = t->p4().Vect().Mag(); //[R.K. 01/2017] unused variable
215  double p_t = t->p4().Vect().Pt();
216  double charge=t->charge();
217 
218  //only charged particles give signal
219  if (fabs(charge)<0.001) return false;
220 
221  // due to track curvature particle doesn't reach barrel
222  double rho = 3.3356 * p_t / _Bfield;
223  if (_rBarrel>(2*rho)) return false;
224 
225  //particle doesn't produce cherenkov light
226  if (!(lundId==11 || lundId==13 || lundId==211 || lundId==321 || lundId==2212)) return false;
227 
228  //due to helix trajectory particle doesn't hit detector (even with dip angle in tht range)
229  double z=2*rho*asin(_rBarrel/(2*rho))/tan(theta);
230  double polar=atan2(_rBarrel,z);
231  if (polar<_thtMin || polar>_thtMax) return false;
232 
233  //finally check for efficiency;
234  return ( _rand->Rndm()<=_efficiency);
235  }
236 }
237 
238 void
240 {
241  o <<"Parameters for detector <"<<detName()<<">"<<endl;
242  o <<" _thtMin = "<<_thtMin<<endl;
243  o <<" _thtMax = "<<_thtMax<<endl;
244  o <<" _radiationLength = "<<_radiationLength<<endl;
245  o <<" _pmin = "<<_pmin<<endl;
246  o <<" _Bfield = "<<_Bfield<<endl;
247  o <<" _rBarrel = "<<_rBarrel<<endl;
248  o <<" _dSlab = "<<_dSlab<<endl;
249  o <<" _dp = "<<_dp<<endl;
250  o <<" _dt = "<<_dt<<endl;
251  o <<" _efficiency = "<<_efficiency<<endl;
252 }
253 
254 void
256 {
258  _thtMin = 22.0;
259  _thtMax = 140.0;
260  _pmin = 0.0;
261  _radiationLength = 0.0;
262  _Bfield = 2.;
263  _rBarrel = 0.38;
264  _dSlab = 0.01;
265  _dp=0.01; //1 % is resolution of Tpc
266  _dt=100; //time res in ps
267  _efficiency =1.0;
268 }
269 
270 bool
271 PndFsmTof::setParameter(std::string &name, double value)
272 {
273  // *****************
274  // include here all parameters which should be settable via tcl
275  // *****************
276 
277  bool knownName=true;
278 
279  if (name == "thtMin")
280  _thtMin=value;
281  else
282  if (name == "thtMax")
283  _thtMax=value;
284  else
285  if (name == "radiationLength")
286  _radiationLength=value;
287  else
288  if (name == "pmin")
289  _pmin=value;
290  else
291  if (name == "Bfield")
292  _Bfield=value;
293  else
294  if (name == "rBarrel")
295  _rBarrel=value;
296  else
297  if (name == "dSlab")
298  _dSlab=value;
299  else
300  if (name == "dp")
301  _dp=value;
302  else
303  if (name == "dt")
304  _dt=value;
305  else
306  if (name == "efficiency")
307  _efficiency=value;
308  else
309  knownName=false;
310 
311  return knownName;
312 }
Double_t x0
Definition: checkhelixhit.C:70
double _rBarrel
Definition: PndFsmTof.h:82
Double_t p
Definition: anasim.C:58
double _efficiency
Definition: PndFsmAbsDet.h:93
void setLHElectron(double val)
double r
Definition: RiemannTest.C:14
bool detected(PndFsmTrack *t) const
Definition: PndFsmTof.cxx:202
friend F32vec4 exp(const F32vec4 &a)
Definition: P4_F32vec4.h:109
void initParameters()
Definition: PndFsmTof.cxx:255
TDatabasePDG * _fdbPDG
Definition: PndFsmAbsDet.h:95
void setLHProton(double val)
std::list< std::string > ArgList
Definition: ArgList.h:7
virtual PndFsmResponse * respond(PndFsmTrack *t)
Definition: PndFsmTof.cxx:92
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
void setLHMuon(double val)
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
bool hitMapResponse(unsigned int)
Definition: PndFsmTrack.h:86
TLorentzVector s
Definition: Pnd2DStar.C:50
double _dp
Definition: PndFsmTof.h:84
Double_t par[3]
double _pmin
Definition: PndFsmTof.h:80
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
void setm2(double val, double err=0)
Double_t dE
Definition: anasim.C:58
virtual ~PndFsmTof()
Definition: PndFsmTof.cxx:83
Double_t En
double _radiationLength
Definition: PndFsmTof.h:79
double gauss_t(double x, double x0, double s)
Definition: PndFsmTof.cxx:195
bool setParameter(std::string &name, double value)
Definition: PndFsmTof.cxx:271
static const std::string & name(unsigned int t)
Definition: FsmDetTypes.h:26
TLorentzVector p4()
Definition: PndFsmTrack.h:72
basic_ostream< char, char_traits< char > > ostream
void setDetector(PndFsmAbsDet *detector)
const std::string & detName()
Definition: PndFsmAbsDet.h:74
Double_t z
double _dSlab
Definition: PndFsmTof.h:83
void setLHKaon(double val)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
void print(std::ostream &o)
Definition: PndFsmTof.cxx:239
double _Bfield
Definition: PndFsmTof.h:81
TString name
bool hitMapValid()
Definition: PndFsmTrack.h:85
friend F32vec4 atan2(const F32vec4 &y, const F32vec4 &x)
Definition: P4_F32vec4.h:117
Double_t x
double _thtMin
Definition: PndFsmTof.h:77
std::string _detName
Definition: PndFsmAbsDet.h:92
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
double _thtMax
Definition: PndFsmTof.h:78
void setdm(double val)
void setLHPion(double val)
double _dt
Definition: PndFsmTof.h:85