FairRoot/PandaRoot
PndFsmSimpleVtx.cxx
Go to the documentation of this file.
1 //--------------------------------------------------------------------------
2 // File and Version Information:
3 // $Id: PndFsmSimpleVtx.cc,v 1.10 2007/05/24 08:07:40 klausg Exp $
4 //
5 // Description:
6 // Class PndFsmSimpleVtx
7 //
8 // Implementation of the MVD 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 "PndFsmSimpleVtx.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 //-----------------------------------------------------------------------
51 // Local Macros, Typedefs, Structures, Unions and Forward Declarations --
52 //-----------------------------------------------------------------------
53 
54 //----------------
55 // Constructors --
56 //----------------
57 
59 {
61 
62  _thtMin=_thtMin*M_PI/180.0;
63  _thtMax=_thtMax*M_PI/180.0;
64  //print(std::cout);
65 }
66 
68 {
70  //set default parameter values and parses a parameter list
71  //i.e. std::list<std::string> of the form
72  //"a=1" "b=2" "c=3"
73  parseParameterList(par);
74 
75  _thtMin=_thtMin*M_PI/180.0;
76  _thtMax=_thtMax*M_PI/180.0;
77  //print(std::cout);
78 }
79 
80 //--------------
81 // Destructor --
82 //--------------
83 
85 {
86 }
87 
88 //--------------
89 // Operations --
90 //--------------
91 
94 {
95  PndFsmResponse *result=new PndFsmResponse();
96 
97  result->setDetector(this);
98  bool wasDetected=detected(t);
99  result->setDetected(wasDetected);
100 
101  if (wasDetected && fabs(t->charge())>1e-8)
102  {
103  result->setdV(_vtxRes, _vtxRes, _vtxRes);
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 void
122 {
123  o <<"Parameters for detector <"<<detName()<<">"<<endl;
124  o <<" _thtMin = "<<_thtMin<<endl;
125  o <<" _thtMax = "<<_thtMax<<endl;
126  o <<" _ptmin = "<<_ptmin<<endl;
127  o <<" _vtxRes = "<<_vtxRes*1e5<<"um"<<endl;
128  o <<" _efficiency = "<<_efficiency<<endl;
129 }
130 
131 void
133 {
135  _thtMin = 5.0;
136  _thtMax = 160.0;
137  _ptmin = 0.0;
138  _vtxRes = 100e-4; //vtx res = 100 um
139  _efficiency =1.0;
140 }
141 
142 bool
143 PndFsmSimpleVtx::setParameter(std::string &name, double value)
144 {
145  // *****************
146  // include here all parameters which should be settable via tcl
147  // *****************
148 
149  bool knownName=true;
150 
151  if (name == "thtMin")
152  _thtMin=value;
153  else
154  if (name == "thtMax")
155  _thtMax=value;
156  else
157  if (name == "ptmin")
158  _ptmin=value;
159  else
160  if (name == "vtxRes")
161  _vtxRes=value;
162  else
163  if (name == "efficiency")
164  _efficiency=value;
165  else
166  knownName=false;
167 
168  return knownName;
169 }
170 
void print(std::ostream &o)
double _efficiency
Definition: PndFsmAbsDet.h:93
void setdV(TVector3 v)
std::list< std::string > ArgList
Definition: ArgList.h:7
Double_t par[3]
double charge()
Definition: PndFsmTrack.h:75
void parseParameterList(ArgList &par)
virtual PndFsmResponse * respond(PndFsmTrack *t)
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)
const std::string & detName()
Definition: PndFsmAbsDet.h:74
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TString name
virtual ~PndFsmSimpleVtx()
std::string _detName
Definition: PndFsmAbsDet.h:92
void setDetected(bool isdet)
TTree * t
Definition: bump_analys.C:13
bool setParameter(std::string &name, double value)