FairRoot/PandaRoot
PndFsmEmcBwCap.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: FsmEmcBwCap.cc,v 1.9 2007/05/24 08:07:40 klausg Exp $
4 //
5 // Description:
6 // Class FsmEmcBwCap
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 "PndFsmEmcBwCap.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 #include "ArgList.h"
45 #include "PndFsmResponse.h"
46 #include "PndFsmTrack.h"
47 
48 //-----------------------------------------------------------------------
49 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
50 //-----------------------------------------------------------------------
51 
52 //----------------
53 // Constructors --
54 //----------------
55 
57 {
59 
60  _thtMin=_thtMin*M_PI/180.0;
61  _thtMax=_thtMax*M_PI/180.0;
62  //print(std::cout);
63 }
64 
66 {
68  //set default parameter values and parses a parameter list
69  //i.e. std::list<std::string> of the form
70  //"a=1" "b=2" "c=3"
71  parseParameterList(par);
72 
73  _thtMin=_thtMin*M_PI/180.0;
74  _thtMax=_thtMax*M_PI/180.0;
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->setdE(dE(t));
102  result->setdphi(dphi(t));
103  result->setdtheta(dtheta(t));
104  double zscale = t->p4().Pz()/_dist;
105  double x = t->p4().Px()/zscale;
106  double y = t->p4().Py()/zscale;
107  TVector3 hitpos(x,y,_dist);
108  t->setStopVtx(hitpos);
109  }
110  else
111  {
112  result->setdE(0.);
113  result->setdphi(0.);
114  result->setdtheta(0.);
115  }
116 
117  return result;
118 }
119 
120 bool
122 {
123  if (t->hitMapValid()) {
125  } else {
126  double theta = t->p4().Theta();
127  double E=t->p4().E();
128  double lund = t->pdt();
129  return ( lund==22 && theta>=_thtMin && theta<=_thtMax && E>_Emin && _rand->Rndm()<=_efficiency);
130  }
131 }
132 
133 double
135 {
136  double E = t->p4().E();
137 
138  return (_aPar+_bPar/E+_cPar/sqrt(E) ) * E;
139 }
140 
141 double
143 {
144  double theta = t->p4().Vect().Theta();
145 
146  return (_resFactor*M_PI/int(2*M_PI*_dist*tan(M_PI-theta)/_xtalDim) );
147 }
148 
149 double
151 {
152  double theta = t->p4().Vect().Theta();
153  return ( _resFactor*atan(_xtalDim*cos(M_PI-theta)/(2*_dist)) );
154 }
155 
156 void
158 {
159  o <<"Detector <"<<_detName<<">"<<endl;
160  o <<" _aPar = "<<_aPar<<endl;
161  o <<" _bPar = "<<_bPar<<endl;
162  o <<" _cPar = "<<_cPar<<endl;
163  o <<" _xtalDim = "<<_xtalDim<<endl;
164  o <<" _Emin = "<<_Emin<<endl;
165  o <<" _dist = "<<_dist<<endl;
166  o <<" _resFactor = "<<_resFactor<<endl;
167  o <<" _thtMin = "<<_thtMin<<endl;
168  o <<" _thtMax = "<<_thtMax<<endl;
169  o <<" _radiationLength = "<<_radiationLength<<endl;
170  o <<" _efficiency = "<<_efficiency<<endl;
171 }
172 
173 void
175 {
177  _aPar=4.52495e-3;
178  _bPar=2.9539e-3;
179  _cPar=7.7596e-3;
180  //_aPar = 0.01;
181  //_bPar = 0.01;
182  _xtalDim = 0.02;
183  _Emin = 0.01;
184  _dist = 0.7;
185  _resFactor = 0.25;
186  _thtMin = 140.0;
187  _thtMax = 170.0;
188  _radiationLength = 0.0;
189  _efficiency =1.0;
190 }
191 
192 bool
193 PndFsmEmcBwCap::setParameter(std::string &name, double value)
194 {
195  // *****************
196  // include here all parameters which should be settable via tcl
197  // *****************
198 
199  bool knownName=true;
200 
201  if (name == "aPar")
202  _aPar=value;
203  else
204  if (name == "bPar")
205  _bPar=value;
206  else
207  if (name == "cPar")
208  _cPar=value;
209  else
210  if (name == "xtalDim")
211  _xtalDim=value;
212  else
213  if (name == "Emin")
214  _Emin=value;
215  else
216  if (name == "dist")
217  _dist=value;
218  else
219  if (name == "resFactor")
220  _resFactor=value;
221  else
222  if (name == "thtMin")
223  _thtMin=value;
224  else
225  if (name == "thtMax")
226  _thtMax=value;
227  else
228  if (name == "radiationLength")
229  _radiationLength=value;
230  else
231  if (name == "efficiency")
232  _efficiency=value;
233  else
234  knownName=false;
235 
236  return knownName;
237 }
238 
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdphi(double val)
bool detected(PndFsmTrack *t) const
double _radiationLength
void setStopVtx(TVector3 v)
std::list< std::string > ArgList
Definition: ArgList.h:7
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
bool hitMapResponse(unsigned int)
Definition: PndFsmTrack.h:86
Double_t par[3]
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
double dphi(PndFsmTrack *t) const
double dtheta(PndFsmTrack *t) const
double dE(PndFsmTrack *t) const
bool setParameter(std::string &name, double value)
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)
virtual ~PndFsmEmcBwCap()
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
bool hitMapValid()
Definition: PndFsmTrack.h:85
void setdE(double val)
Double_t x
std::string _detName
Definition: PndFsmAbsDet.h:92
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
void print(std::ostream &o)
void setdtheta(double val)
Double_t y
virtual PndFsmResponse * respond(PndFsmTrack *t)