FairRoot/PandaRoot
PndFsmEmcFS.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: FsmEmcFS.cc,v 1.9 2007/05/24 08:07:40 klausg Exp $
4 //
5 // Description:
6 // Class FsmEmcFS
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 "PndFsmEmcFS.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 //-----------------------------------------------------------------------
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())<1e-8)
101  {
102  result->setdE(dE(t));
103  result->setdphi(dphi(t));
104  result->setdtheta(dtheta(t));
105  double zscale = t->p4().Pz()/_dist;
106  double x = t->p4().Px()/zscale;
107  double y = t->p4().Py()/zscale;
108  TVector3 hitpos(x,y,_dist);
109  t->setStopVtx(hitpos);
110  }
111  else
112  {
113  result->setdE(0.);
114  result->setdphi(0.);
115  result->setdtheta(0.);
116  }
117 
118  return result;
119 }
120 
121 bool
123 {
124  if (t->hitMapValid()) {
126  } else {
127  double theta = t->p4().Theta();
128  double E=t->p4().E();
129  double lund = t->pdt();
130  return ( lund==22 && theta>=_thtMin && theta<=_thtMax && E>_Emin && _rand->Rndm()<=_efficiency);
131  }
132 }
133 
134 double
136 {
137  double E = t->p4().E();
138 
139  return (sqrt(_aPar*_aPar+_bPar*_bPar/E ) * E); //Jerzy's version
140 }
141 
142 double
144 {
145  double theta = t->p4().Vect().Theta();
146  int denom=int(2*M_PI*_dist*tan(theta)/_xtalDim);
147  if (denom==0) return 0;
148  else
149  return (_resFactor*M_PI/(double)denom );
150 }
151 
152 double
154 {
155  //double theta = t->p4().vect().theta();// Alex's version
156  //return ( _resFactor*atan(_xtalDim*cos(theta)/(2*_dist)) );
157 
158  double E = t->p4().E(); //Jerzy's version
159  return (0.002/sqrt(E));
160 }
161 
162 void
164 {
165  o <<"Detector <"<<_detName<<">"<<endl;
166  o <<" _aPar = "<<_aPar<<endl;
167  o <<" _bPar = "<<_bPar<<endl;
168  o <<" _xtalDim = "<<_xtalDim<<endl;
169  o <<" _Emin = "<<_Emin<<endl;
170  o <<" _dist = "<<_dist<<endl;
171  o <<" _resFactor = "<<_resFactor<<endl;
172  o <<" _thtMin = "<<_thtMin<<endl;
173  o <<" _thtMax = "<<_thtMax<<endl;
174  o <<" _radiationLength = "<<_radiationLength<<endl;
175  o <<" _efficiency = "<<_efficiency<<endl;
176 }
177 
178 void
180 {
182  _aPar = 0.013;
183  _bPar = 0.0283;
184  _xtalDim = 0.0555;
185  _Emin = 0.01;
186  _dist = 8.2;
187  _resFactor = 0.25;
188  _thtMin = 0.05;
189  _thtMax = 5.0;
190  _radiationLength = 0.0;
191  _efficiency =1.0;
192 }
193 
194 bool
195 PndFsmEmcFS::setParameter(std::string &name, double value)
196 {
197  // *****************
198  // include here all parameters which should be settable via tcl
199  // *****************
200 
201  bool knownName=true;
202 
203  if (name == "aPar")
204  _aPar=value;
205  else
206  if (name == "bPar")
207  _bPar=value;
208  else
209  if (name == "xtalDim")
210  _xtalDim=value;
211  else
212  if (name == "Emin")
213  _Emin=value;
214  else
215  if (name == "dist")
216  _dist=value;
217  else
218  if (name == "resFactor")
219  _resFactor=value;
220  else
221  if (name == "thtMin")
222  _thtMin=value;
223  else
224  if (name == "thtMax")
225  _thtMax=value;
226  else
227  if (name == "radiationLength")
228  _radiationLength=value;
229  else
230  if (name == "efficiency")
231  _efficiency=value;
232  else
233  knownName=false;
234 
235  return knownName;
236 }
237 
double dtheta(PndFsmTrack *t) const
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdphi(double val)
void setStopVtx(TVector3 v)
double _bPar
Definition: PndFsmEmcFS.h:82
std::list< std::string > ArgList
Definition: ArgList.h:7
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
double _dist
Definition: PndFsmEmcFS.h:85
bool hitMapResponse(unsigned int)
Definition: PndFsmTrack.h:86
void print(std::ostream &o)
Double_t par[3]
double _resFactor
Definition: PndFsmEmcFS.h:86
double _Emin
Definition: PndFsmEmcFS.h:84
double dE(PndFsmTrack *t) const
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
virtual PndFsmResponse * respond(PndFsmTrack *t)
Definition: PndFsmEmcFS.cxx:92
double dphi(PndFsmTrack *t) const
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
bool detected(PndFsmTrack *t) const
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)
double _xtalDim
Definition: PndFsmEmcFS.h:83
bool setParameter(std::string &name, double value)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
double _thtMax
Definition: PndFsmEmcFS.h:88
bool hitMapValid()
Definition: PndFsmTrack.h:85
void setdE(double val)
Double_t x
double _aPar
Definition: PndFsmEmcFS.h:81
std::string _detName
Definition: PndFsmAbsDet.h:92
double _radiationLength
Definition: PndFsmEmcFS.h:89
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
void setdtheta(double val)
void initParameters()
Double_t y
virtual ~PndFsmEmcFS()
Definition: PndFsmEmcFS.cxx:83
double _thtMin
Definition: PndFsmEmcFS.h:87