FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PndFsmDetTemplate Class Reference

#include <PndFsmDetTemplate.h>

Inheritance diagram for PndFsmDetTemplate:
PndFsmAbsDet

Public Member Functions

 PndFsmDetTemplate ()
 
 PndFsmDetTemplate (ArgList &par)
 
virtual ~PndFsmDetTemplate ()
 
virtual PndFsmResponserespond (PndFsmTrack *t)
 
const std::string & detName ()
 
void setName (std::string &name)
 
Bool_t doesPid () const
 
void setStorePid (Bool_t doespid=kTRUE)
 

Protected Member Functions

virtual bool setParameter (std::string &name, std::string &value)
 
void parseParameterList (ArgList &par)
 

Protected Attributes

std::string _detName
 
double _efficiency
 
TRandom3 * _rand
 
TDatabasePDG * _fdbPDG
 
Bool_t _doesPid
 

Private Member Functions

bool detected (PndFsmTrack *t) const
 
double dp (PndFsmTrack *t) const
 
double dphi (PndFsmTrack *t) const
 
double dtheta (PndFsmTrack *t) const
 
void initParameters ()
 
void print (std::ostream &o)
 
bool setParameter (std::string &name, double value)
 

Private Attributes

double _thtMin
 
double _thtMax
 
double _ptmin
 
double _pRes
 
double _thtRes
 
double _phiRes
 

Detailed Description

Definition at line 38 of file PndFsmDetTemplate.h.

Constructor & Destructor Documentation

PndFsmDetTemplate::PndFsmDetTemplate ( )

Default ctor.

Definition at line 54 of file PndFsmDetTemplate.cxx.

References _thtMax, _thtMin, initParameters(), and print().

55 {
57 
58  _thtMin=_thtMin*M_PI/180.0;
59  _thtMax=_thtMax*M_PI/180.0;
60 
61  print(std::cout);
62 }
void print(std::ostream &o)
PndFsmDetTemplate::PndFsmDetTemplate ( ArgList par)

Definition at line 64 of file PndFsmDetTemplate.cxx.

References _thtMax, _thtMin, initParameters(), PndFsmAbsDet::parseParameterList(), and print().

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"
71 
72  _thtMin=_thtMin*M_PI/180.0;
73  _thtMax=_thtMax*M_PI/180.0;
74 
75  print(std::cout);
76 }
Double_t par[3]
void parseParameterList(ArgList &par)
void print(std::ostream &o)
PndFsmDetTemplate::~PndFsmDetTemplate ( )
virtual

Destructor

Definition at line 82 of file PndFsmDetTemplate.cxx.

83 {
84 }

Member Function Documentation

bool PndFsmDetTemplate::detected ( PndFsmTrack t) const
private

Definition at line 110 of file PndFsmDetTemplate.cxx.

References PndFsmAbsDet::_efficiency, _ptmin, PndFsmAbsDet::_rand, _thtMin, PndFsmTrack::charge(), PndFsmTrack::p4(), and theta.

Referenced by respond().

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 }
double _efficiency
Definition: PndFsmAbsDet.h:93
double charge()
Definition: PndFsmTrack.h:75
TRandom3 * _rand
Definition: PndFsmAbsDet.h:94
TLorentzVector p4()
Definition: PndFsmTrack.h:72
const std::string& PndFsmAbsDet::detName ( )
inlineinherited
Bool_t PndFsmAbsDet::doesPid ( ) const
inlineinherited

Definition at line 76 of file PndFsmAbsDet.h.

References PndFsmAbsDet::_doesPid.

Referenced by PndFastSim::Register(), and PndFastSim::smearTrack().

76 {return _doesPid;};
Bool_t _doesPid
Definition: PndFsmAbsDet.h:96
double PndFsmDetTemplate::dp ( PndFsmTrack t) const
private

Definition at line 121 of file PndFsmDetTemplate.cxx.

References _pRes, p, and PndFsmTrack::p4().

Referenced by respond().

122 {
123  double p=t->p4().Vect().Mag();
124 
125  return (_pRes * p );
126 }
Double_t p
Definition: anasim.C:58
TLorentzVector p4()
Definition: PndFsmTrack.h:72
double PndFsmDetTemplate::dphi ( PndFsmTrack t) const
private

Definition at line 129 of file PndFsmDetTemplate.cxx.

References _phiRes.

Referenced by respond().

130 {
131  return _phiRes;
132 }
double PndFsmDetTemplate::dtheta ( PndFsmTrack t) const
private

Definition at line 135 of file PndFsmDetTemplate.cxx.

References _thtRes.

Referenced by respond().

136 {
137  return _thtRes;
138 }
void PndFsmDetTemplate::initParameters ( )
privatevirtual

Reimplemented from PndFsmAbsDet.

Definition at line 154 of file PndFsmDetTemplate.cxx.

References PndFsmAbsDet::_detName, PndFsmAbsDet::_efficiency, _phiRes, _pRes, _ptmin, _thtMax, _thtMin, and _thtRes.

Referenced by PndFsmDetTemplate().

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 }
double _efficiency
Definition: PndFsmAbsDet.h:93
std::string _detName
Definition: PndFsmAbsDet.h:92
void PndFsmAbsDet::parseParameterList ( ArgList par)
protectedinherited

Definition at line 119 of file PndFsmAbsDet.cxx.

References CStrTok::GetFirst(), CStrTok::GetNext(), name, and PndFsmAbsDet::setParameter().

Referenced by PndFsmAbsDet::PndFsmAbsDet(), PndFsmCmpDet::PndFsmCmpDet(), PndFsmCombiDet::PndFsmCombiDet(), PndFsmDetTemplate(), PndFsmDrcBarrel::PndFsmDrcBarrel(), PndFsmDrcDisc::PndFsmDrcDisc(), PndFsmEffTracker::PndFsmEffTracker(), PndFsmEmcBarrel::PndFsmEmcBarrel(), PndFsmEmcBwCap::PndFsmEmcBwCap(), PndFsmEmcFS::PndFsmEmcFS(), PndFsmEmcFwCap::PndFsmEmcFwCap(), PndFsmEmcPid::PndFsmEmcPid(), PndFsmIdealPid::PndFsmIdealPid(), PndFsmMdcFS::PndFsmMdcFS(), PndFsmMdcTS::PndFsmMdcTS(), PndFsmMdtPid::PndFsmMdtPid(), PndFsmMvd::PndFsmMvd(), PndFsmMvd2::PndFsmMvd2(), PndFsmMvdPid::PndFsmMvdPid(), PndFsmRich::PndFsmRich(), PndFsmSimpleTracker::PndFsmSimpleTracker(), PndFsmSimpleVtx::PndFsmSimpleVtx(), PndFsmStt::PndFsmStt(), PndFsmSttPid::PndFsmSttPid(), and PndFsmTof::PndFsmTof().

120 {
121  // ArgList is a std::list<std::string> of the form ("a=1","b=2","c=3","d=4")
122 
123  // Default values for the parameters
124 
125  CStrTok tokenizer;
126  char csrc[200];
127 
128  if (par.size() != 0) {
129 
130  //cout <<"Parameters for detector <"<<_detName<<">"<<endl;
131  for(ArgList::const_iterator argIt=par.begin(); argIt!=par.end();argIt++) {
132 
133  const char *src=argIt->data();
134  strcpy(csrc,src);
135 
136  char* token = tokenizer.GetFirst(csrc,"=");
137  string name(token);
138  //cout <<"variable: -" << name << "- ";
139  token = tokenizer.GetNext("=");
140 
141  double value = atof(token);
142  string strvalue(token);
143 
144  //cout <<"value: -"<<value<<"- "<<endl;
145 
146  if (value!=0 || strvalue=="0" || strvalue=="0.0" || strvalue=="0.")
147  {
148  if (!setParameter(name,value))
149  cout <<" -W- (PndFsmAbsDet::parseParameterList) Unknown Parameter: <"<<name<< endl;
150  }
151  else
152  {
153  if (!setParameter(name,strvalue))
154  cout <<" -W- (PndFsmAbsDet::parseParameterList) Unknown Parameter: <"<<name<< endl;
155  }
156 
157  }
158  }
159 
160  /*
161  if (par.size() != 0) {
162 
163  //cout <<"Parameters for detector <"<<_detName<<">"<<endl;
164  for(ArgList::const_iterator argIt=par.begin(); argIt!=par.end();argIt++) {
165  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
166  boost::char_separator<char> sep("=");
167  tokenizer tokens(*argIt, sep);
168  tokenizer::iterator tok_iter = tokens.begin();
169  string name(*tok_iter);
170  ++tok_iter;
171  double value=atof((*tok_iter).c_str());
172 
173  //cout <<"<"<<name<<"> = "<<value<<endl;
174 
175  string name("efficiency");
176  double value=0.99;
177  if (!setParameter(name,value))
178  cout <<" -W- Unknown Parameter: <"<<name<<"> in PndFsmAbsDet::parseParameterList" << endl;
179  }
180  }
181  */
182  //print(std::cout);
183 
184 }
Double_t par[3]
char * GetFirst(char *lpsz, const char *lpcszDelimiters)
Definition: StrTok.cxx:29
TString name
Definition: StrTok.h:11
virtual bool setParameter(std::string &name, double value)
char * GetNext(const char *lpcszDelimiters)
Definition: StrTok.cxx:37
void PndFsmDetTemplate::print ( std::ostream o)
privatevirtual

Reimplemented from PndFsmAbsDet.

Definition at line 141 of file PndFsmDetTemplate.cxx.

References PndFsmAbsDet::_efficiency, _phiRes, _pRes, _ptmin, _thtMax, _thtMin, _thtRes, and PndFsmAbsDet::detName().

Referenced by PndFsmDetTemplate().

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 }
double _efficiency
Definition: PndFsmAbsDet.h:93
const std::string & detName()
Definition: PndFsmAbsDet.h:74
PndFsmResponse * PndFsmDetTemplate::respond ( PndFsmTrack t)
virtual

Accessors to contained information

Implements PndFsmAbsDet.

Definition at line 91 of file PndFsmDetTemplate.cxx.

References PndFsmTrack::charge(), detected(), dp(), dphi(), dtheta(), fabs(), PndFsmResponse::setDetected(), PndFsmResponse::setDetector(), PndFsmResponse::setdp(), PndFsmResponse::setdphi(), and PndFsmResponse::setdtheta().

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 }
void setdphi(double val)
double charge()
Definition: PndFsmTrack.h:75
bool detected(PndFsmTrack *t) const
double dphi(PndFsmTrack *t) const
void setDetector(PndFsmAbsDet *detector)
double dp(PndFsmTrack *t) const
void setdp(double val)
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
double dtheta(PndFsmTrack *t) const
void setDetected(bool isdet)
void setdtheta(double val)
void PndFsmAbsDet::setName ( std::string &  name)
inlineinherited

Definition at line 75 of file PndFsmAbsDet.h.

References PndFsmAbsDet::_detName, and name.

Referenced by PndFsmDetFactory::create().

75 {_detName = name;};
TString name
std::string _detName
Definition: PndFsmAbsDet.h:92
bool PndFsmDetTemplate::setParameter ( std::string &  name,
double  value 
)
privatevirtual

Reimplemented from PndFsmAbsDet.

Definition at line 168 of file PndFsmDetTemplate.cxx.

References PndFsmAbsDet::_efficiency, _phiRes, _pRes, _ptmin, _thtMax, _thtMin, and _thtRes.

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 }
double _efficiency
Definition: PndFsmAbsDet.h:93
TString name
bool PndFsmAbsDet::setParameter ( std::string &  name,
std::string &  value 
)
protectedvirtualinherited

Reimplemented in PndFsmDrcBarrel, PndFsmDrcDisc, PndFsmCombiDet, and PndFsmCmpDet.

Definition at line 99 of file PndFsmAbsDet.cxx.

100 {
101  return false;
102 }
void PndFsmAbsDet::setStorePid ( Bool_t  doespid = kTRUE)
inlineinherited

Definition at line 77 of file PndFsmAbsDet.h.

References PndFsmAbsDet::_doesPid.

Referenced by PndFsmDetFactory::create().

77 {_doesPid=doespid;};
Bool_t _doesPid
Definition: PndFsmAbsDet.h:96

Member Data Documentation

std::string PndFsmAbsDet::_detName
protectedinherited
Bool_t PndFsmAbsDet::_doesPid
protectedinherited
double PndFsmAbsDet::_efficiency
protectedinherited

Definition at line 93 of file PndFsmAbsDet.h.

Referenced by detected(), PndFsmSimpleTracker::detected(), PndFsmMvd::detected(), PndFsmMvd2::detected(), PndFsmMdcFS::detected(), PndFsmEmcBwCap::detected(), PndFsmSimpleVtx::detected(), PndFsmEmcFwCap::detected(), PndFsmMdcTS::detected(), PndFsmTof::detected(), PndFsmSttPid::detected(), PndFsmEmcFS::detected(), PndFsmStt::detected(), PndFsmMvdPid::detected(), PndFsmRich::detected(), PndFsmEmcBarrel::detected(), PndFsmDrcDisc::detected(), PndFsmMdtPid::detected(), PndFsmDrcBarrel::detected(), PndFsmEmcPid::detected(), PndFsmEffTracker::detected(), PndFsmSimpleTracker::initParameters(), PndFsmSimpleVtx::initParameters(), initParameters(), PndFsmMvdPid::initParameters(), PndFsmTof::initParameters(), PndFsmMdtPid::initParameters(), PndFsmEmcPid::initParameters(), PndFsmSttPid::initParameters(), PndFsmMdcTS::initParameters(), PndFsmEmcBwCap::initParameters(), PndFsmEmcFS::initParameters(), PndFsmMvd2::initParameters(), PndFsmEmcFwCap::initParameters(), PndFsmRich::initParameters(), PndFsmMdcFS::initParameters(), PndFsmEmcBarrel::initParameters(), PndFsmDrcDisc::initParameters(), PndFsmDrcBarrel::initParameters(), PndFsmStt::initParameters(), PndFsmMvd::initParameters(), PndFsmEffTracker::initParameters(), PndFsmSimpleTracker::print(), PndFsmSimpleVtx::print(), print(), PndFsmMvdPid::print(), PndFsmTof::print(), PndFsmMdtPid::print(), PndFsmEmcPid::print(), PndFsmSttPid::print(), PndFsmMdcFS::print(), PndFsmMdcTS::print(), PndFsmEmcBwCap::print(), PndFsmMvd2::print(), PndFsmEmcFS::print(), PndFsmEmcFwCap::print(), PndFsmRich::print(), PndFsmDrcDisc::print(), PndFsmEmcBarrel::print(), PndFsmDrcBarrel::print(), PndFsmStt::print(), PndFsmMvd::print(), PndFsmEffTracker::print(), PndFsmSimpleTracker::setParameter(), PndFsmMvdPid::setParameter(), setParameter(), PndFsmSimpleVtx::setParameter(), PndFsmMdtPid::setParameter(), PndFsmTof::setParameter(), PndFsmEmcPid::setParameter(), PndFsmEmcFwCap::setParameter(), PndFsmSttPid::setParameter(), PndFsmRich::setParameter(), PndFsmMdcFS::setParameter(), PndFsmEmcBwCap::setParameter(), PndFsmEmcFS::setParameter(), PndFsmMvd2::setParameter(), PndFsmMdcTS::setParameter(), PndFsmEmcBarrel::setParameter(), PndFsmDrcDisc::setParameter(), PndFsmDrcBarrel::setParameter(), PndFsmStt::setParameter(), PndFsmMvd::setParameter(), and PndFsmEffTracker::setParameter().

TDatabasePDG* PndFsmAbsDet::_fdbPDG
protectedinherited
double PndFsmDetTemplate::_phiRes
private

Definition at line 83 of file PndFsmDetTemplate.h.

Referenced by dphi(), initParameters(), print(), and setParameter().

double PndFsmDetTemplate::_pRes
private

Definition at line 81 of file PndFsmDetTemplate.h.

Referenced by dp(), initParameters(), print(), and setParameter().

double PndFsmDetTemplate::_ptmin
private

Definition at line 79 of file PndFsmDetTemplate.h.

Referenced by detected(), initParameters(), print(), and setParameter().

TRandom3* PndFsmAbsDet::_rand
protectedinherited
double PndFsmDetTemplate::_thtMax
private

Definition at line 78 of file PndFsmDetTemplate.h.

Referenced by initParameters(), PndFsmDetTemplate(), print(), and setParameter().

double PndFsmDetTemplate::_thtMin
private

Definition at line 77 of file PndFsmDetTemplate.h.

Referenced by detected(), initParameters(), PndFsmDetTemplate(), print(), and setParameter().

double PndFsmDetTemplate::_thtRes
private

Definition at line 82 of file PndFsmDetTemplate.h.

Referenced by dtheta(), initParameters(), print(), and setParameter().


The documentation for this class was generated from the following files: