FairRoot/PandaRoot
PndFsmEmcBarrel.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: FsmEmcBarrel.cc,v 1.11 2007/05/24 08:07:40 klausg Exp $
4 //
5 // Description:
6 // Class FsmEmcBarrel
7 //
8 // Implementation of the EMC Barrel part 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 "PndFsmEmcBarrel.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  _phiMin=_phiMin*M_PI/180.0;
64  _phiMax=_phiMax*M_PI/180.0;
65  //print(std::cout);
66 }
67 
69 {
71  //set default parameter values and parses a parameter list
72  //i.e. std::list<std::string> of the form
73  //"a=1" "b=2" "c=3"
74  parseParameterList(par);
75 
76  _thtMin=_thtMin*M_PI/180.0;
77  _thtMax=_thtMax*M_PI/180.0;
78  _phiMin=_phiMin*M_PI/180.0;
79  _phiMax=_phiMax*M_PI/180.0;
80  //print(std::cout);
81 }
82 
83 
84 
85 
86 //--------------
87 // Destructor --
88 //--------------
89 
91 {
92 }
93 
94 //--------------
95 // Operations --
96 //--------------
97 
100 {
101  PndFsmResponse *result=new PndFsmResponse();
102 
103  result->setDetector(this);
104  bool wasDetected=detected(t);
105  result->setDetected(wasDetected);
106 
107  if (wasDetected && fabs(t->charge())<1e-8)
108  {
109  result->setdE(dE(t));
110  result->setdphi(dphi(t));
111  result->setdtheta(dtheta(t));
112 
113  if(fabs(t->p4().Perp()) > 1e-9)
114  {
115  double perpscale = _barrelRadius/t->p4().Perp();
116  double x = t->p4().Px()*perpscale;
117  double y = t->p4().Py()*perpscale;
118  //z = 0; // convention for Fsim to see if we have a barrel!
119  TVector3 hitpos(x,y,0.);
120  t->setStopVtx(hitpos);
121  }
122  }
123  else
124  {
125  result->setdE(0.);
126  result->setdphi(0.);
127  result->setdtheta(0.);
128  }
129 
130  return result;
131 }
132 
133 bool
135 {
136  if (t->hitMapValid()) {
138  } else {
139  double theta = t->p4().Theta();
140  double phi = t->p4().Phi();
141  double E = t->p4().E();
142  double lund = t->pdt();
143  return ( lund==22 && theta>=_thtMin && theta<=_thtMax && E>_Emin && phi>=_phiMin && phi<=_phiMax && _rand->Rndm()<=_efficiency);
144  }
145 }
146 
147 double
149 {
150  double E = t->p4().E();
151  return (_aPar+_bPar/E+_cPar/sqrt(E) ) * E;
152  //return (sqrt(_aPar*_aPar+_bPar*_bPar/sqrt(E) ) * E);
153 }
154 
155 double
156 PndFsmEmcBarrel::dphi(PndFsmTrack *) const // t //[R.K.03/2017] unused variable(s)
157 {
158  return (_resFactor*M_PI/int(2*M_PI*_barrelRadius/_xtalDim) );
159 }
160 
161 double
163 {
164  double theta = t->p4().Vect().Theta();
165  return ( _resFactor*atan(_xtalDim*sin(theta)/(2*_barrelRadius)) );
166 }
167 
168 void
170 {
171  o <<"Detector <"<<_detName<<">"<<endl;
172  o <<" _aPar = "<<_aPar<<endl;
173  o <<" _bPar = "<<_bPar<<endl;
174  o <<" _cPar = "<<_cPar<<endl;
175  o <<" _xtalDim = "<<_xtalDim<<endl;
176  o <<" _Emin = "<<_Emin<<endl;
177  o <<" _barrelRadius = "<<_barrelRadius<<endl;
178  o <<" _resFactor = "<<_resFactor<<endl;
179  o <<" _thtMin = "<<_thtMin<<endl;
180  o <<" _thtMax = "<<_thtMax<<endl;
181  o <<" _radiationLength = "<<_radiationLength<<endl;
182  o <<" _phiMin = "<<_phiMin<<endl;
183  o <<" _phiMax = "<<_phiMax<<endl;
184  o <<" _efficiency = "<<_efficiency<<endl;
185 }
186 
187 void
189 {
191  _aPar=4.52495e-3;
192  _bPar=2.9539e-3;
193  _cPar=7.7596e-3;
194  //_aPar = 0.01;
195  //_bPar = 0.01;
196  //_cPar = 0.01;
197  _xtalDim = 0.02;
198  _Emin = 0.01;
199  _barrelRadius = 0.5;
200  _resFactor = 0.25;
201  _thtMin = 22.0;
202  _thtMax = 140.0;
203  _radiationLength = 0.0;
204  _efficiency =1.0;
205  _phiMin=-360.;
206  _phiMax=360.;
207 }
208 
209 bool
210 PndFsmEmcBarrel::setParameter(std::string &name, double value)
211 {
212  // *****************
213  // include here all parameters which should be settable via tcl
214  // *****************
215 
216  bool knownName=true;
217 
218  if (name == "aPar")
219  _aPar=value;
220  else
221  if (name == "bPar")
222  _bPar=value;
223  else
224  if (name == "cPar")
225  _cPar=value;
226  else
227  if (name == "xtalDim")
228  _xtalDim=value;
229  else
230  if (name == "Emin")
231  _Emin=value;
232  else
233  if (name == "barrelRadius")
234  _barrelRadius=value;
235  else
236  if (name == "resFactor")
237  _resFactor=value;
238  else
239  if (name == "thtMin")
240  _thtMin=value;
241  else
242  if (name == "thtMax")
243  _thtMax=value;
244  else
245  if (name == "phiMin")
246  _phiMin=value;
247  else
248  if (name == "phiMax")
249  _phiMax=value;
250  else
251  if (name == "radiationLength")
252  _radiationLength=value;
253  else
254  if (name == "efficiency")
255  _efficiency=value;
256  else
257  knownName=false;
258 
259  return knownName;
260 }
261 
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdphi(double val)
bool setParameter(std::string &name, double value)
void setStopVtx(TVector3 v)
std::list< std::string > ArgList
Definition: ArgList.h:7
double dphi(PndFsmTrack *t) const
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
friend F32vec4 sin(const F32vec4 &a)
Definition: P4_F32vec4.h:111
bool hitMapResponse(unsigned int)
Definition: PndFsmTrack.h:86
Double_t par[3]
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
double dtheta(PndFsmTrack *t) const
virtual ~PndFsmEmcBarrel()
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)
bool detected(PndFsmTrack *t) const
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
bool hitMapValid()
Definition: PndFsmTrack.h:85
void setdE(double val)
void print(std::ostream &o)
Double_t x
std::string _detName
Definition: PndFsmAbsDet.h:92
double dE(PndFsmTrack *t) const
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
void setdtheta(double val)
Double_t y
virtual PndFsmResponse * respond(PndFsmTrack *t)