FairRoot/PandaRoot
PndFsmDetTemplate.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // Description:
3 // Class PndFsmDetTemplate
4 //
5 // Template class for a 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 "PndFsmDetTemplate.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 charge=t->charge();
115 
116  return ( charge!=0.0 && theta>=_thtMin && theta<=_thtMax && p_t>_ptmin && _rand->Rndm()<=_efficiency);
117 }
118 
119 
120 double
122 {
123  double p=t->p4().Vect().Mag();
124 
125  return (_pRes * p );
126 }
127 
128 double
130 {
131  return _phiRes;
132 }
133 
134 double
136 {
137  return _thtRes;
138 }
139 
140 void
142 {
143  o <<"Parameters for detector <"<<detName()<<">"<<endl;
144  o <<" _thtMin = " << _thtMin << endl;
145  o <<" _thtMax = " << _thtMax << endl;
146  o <<" _ptmin = " << _ptmin << endl;
147  o <<" _pRes = " << _pRes << " (rel)"<< endl;
148  o <<" _thtRes = " << _thtRes << endl;
149  o <<" _phiRes = " << _phiRes << endl;
150  o <<" _efficiency = " << _efficiency<<endl;
151 }
152 
153 void
155 {
156  _detName = "PndFsmDetTemplate";
157  _thtMin = 7.765;
158  _thtMax = 159.44;
159  _ptmin = 0.1;
160  _pRes = 0.02; // 2%
161  _thtRes = 0.005;
162  _phiRes = 0.005;
163  _efficiency = 1.0;
164 
165 }
166 
167 bool
168 PndFsmDetTemplate::setParameter(std::string &name, double value)
169 {
170  // *****************
171  // include here all parameters which should be settable via script
172  // *****************
173 
174  bool knownName=true;
175 
176  if (name == "thtMin")
177  _thtMin=value;
178  else
179  if (name == "thtMax")
180  _thtMax=value;
181  else
182  if (name == "ptmin")
183  _ptmin=value;
184  else
185  if (name == "pRes")
186  _pRes=value;
187  else
188  if (name == "thtRes")
189  _thtRes=value;
190  else
191  if (name == "phiRes")
192  _phiRes=value;
193  else
194  if (name == "efficiency")
195  _efficiency=value;
196  else
197  knownName=false;
198 
199  return knownName;
200 }
201 
Double_t p
Definition: anasim.C:58
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdphi(double val)
std::list< std::string > ArgList
Definition: ArgList.h:7
Double_t par[3]
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
bool setParameter(std::string &name, double value)
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
bool detected(PndFsmTrack *t) const
TLorentzVector p4()
Definition: PndFsmTrack.h:72
double dphi(PndFsmTrack *t) const
basic_ostream< char, char_traits< char > > ostream
void setDetector(PndFsmAbsDet *detector)
double dp(PndFsmTrack *t) const
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
std::string _detName
Definition: PndFsmAbsDet.h:92
double dtheta(PndFsmTrack *t) const
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
virtual PndFsmResponse * respond(PndFsmTrack *t)
void setdtheta(double val)
void print(std::ostream &o)