FairRoot/PandaRoot
Public Member Functions | List of all members
PndFsmDetFactory Class Reference

#include <PndFsmDetFactory.h>

Public Member Functions

 PndFsmDetFactory ()
 
 ~PndFsmDetFactory ()
 
PndFsmAbsDetcreate (std::string &name, ArgList &par)
 
PndFsmAbsDetcreate (std::string &name, std::string par)
 

Detailed Description

Definition at line 43 of file PndFsmDetFactory.h.

Constructor & Destructor Documentation

PndFsmDetFactory::PndFsmDetFactory ( )

Definition at line 76 of file PndFsmDetFactory.cxx.

77 {
78 }
PndFsmDetFactory::~PndFsmDetFactory ( )

Definition at line 84 of file PndFsmDetFactory.cxx.

85 {
86 }

Member Function Documentation

PndFsmAbsDet * PndFsmDetFactory::create ( std::string &  name,
ArgList par 
)

Definition at line 93 of file PndFsmDetFactory.cxx.

References PndFsmAbsDet::setName(), PndFsmAbsDet::setStorePid(), and TString.

Referenced by PndFastSim::AddDetector(), PndFsmCmpDet::AddDetector(), PndFsmCombiDet::AddDetector(), create(), PndFsmCmpDet::SubtractDetector(), and PndFsmCombiDet::SubtractDetector().

94 {
95  TString tname(name);
96 
97  if (tname.BeginsWith("EmcBarrel")){
99  aDet->setName(name);
100  return aDet;
101  } else
102  if (tname=="EmcFwCap"){
103  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmEmcFwCap(par));
104  aDet->setName(name);
105  return aDet;
106  } else
107  if (tname=="EmcBwCap"){
108  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmEmcBwCap(par));
109  aDet->setName(name);
110  return aDet;
111  } else
112  if (tname=="EmcFS"){
113  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmEmcFS(par));
114  aDet->setName(name);
115  return aDet;
116  } else
117  if (tname=="Stt"){
118  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmStt(par));
119  aDet->setName(name);
120  return aDet;
121  } else
122  if (tname=="MdcFS"){
123  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMdcFS(par));
124  aDet->setName(name);
125  return aDet;
126  } else
127  if (tname=="MdcTS"){
128  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMdcTS(par));
129  aDet->setName(name);
130  return aDet;
131  } else
132  if (tname.BeginsWith("EffTracker")){
134  aDet->setName(name);
135  return aDet;
136  } else
137  if (tname=="DrcBarrel"){
138  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmDrcBarrel(par));
139  aDet->setName(name);
140  aDet->setStorePid();
141  return aDet;
142  } else
143  if (tname=="DrcDisc"){
144  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmDrcDisc(par));
145  aDet->setName(name);
146  aDet->setStorePid();
147  return aDet;
148  } else
149  if (tname=="Mvd"){
150  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMvd(par));
151  aDet->setName(name);
152  aDet->setStorePid();
153  return aDet;
154  } else
155  if (tname=="Mvd2"){
156  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMvd2(par));
157  aDet->setName(name);
158  aDet->setStorePid();
159  return aDet;
160  } else
161  if (tname=="Tof"){
162  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmTof(par));
163  aDet->setName(name);
164  aDet->setStorePid();
165  return aDet;
166  } else
167  if (tname=="Rich"){
168  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmRich(par));
169  aDet->setName(name);
170  aDet->setStorePid();
171  return aDet;
172  } else
173  // --- scrutiny process options
174  if (tname.BeginsWith("ScSttAlone") || tname.BeginsWith("ScSttMvd") || tname.BeginsWith("ScSttMvdGem") ||
175  tname.BeginsWith("ScSttGem") || tname.BeginsWith("ScMvdGem") || tname.BeginsWith("ScMvdGemFts") ||
176  tname.BeginsWith("ScMvdFts") || tname.BeginsWith("ScGemFts") || tname=="ScFts" ) {
178  aDet->setName(name);
179  return aDet;
180  } else
181  if (tname=="MvdPid") {
182  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMvdPid(par) );
183  aDet->setStorePid();
184  return aDet;
185  } else
186  if (tname.BeginsWith("ScEmcPidBarrel") || tname=="ScEmcPidFwCap" || tname=="ScEmcPidBwCap" || tname=="ScEmcPidFS"){
187  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmEmcPid(par) );
188  aDet->setName(name);
189  aDet->setStorePid();
190  return aDet;
191  } else
192  if (tname=="SttPid"){
193  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmSttPid(par) );
194  aDet->setStorePid();
195  return aDet;
196  }
197  if (tname=="ScVtxMvd" || tname=="ScVtxNoMvd") {
198  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmSimpleVtx(par));
199  aDet->setName(name);
200  return aDet;
201  } else
202  if (tname=="ScMdtPidBarrel" || tname=="ScMdtPidForward") {
203  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmMdtPid(par));
204  aDet->setName(name);
205  aDet->setStorePid();
206  return aDet;
207  }
208  // general Options
209  else
210  if (tname.BeginsWith("SimpleTracker")) {
212  aDet->setName(name);
213  return aDet;
214  } else
215  if (tname.BeginsWith("SimpleVtx")) {
216  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmSimpleVtx(par));
217  aDet->setName(name);
218  return aDet;
219  } else
220  if (tname=="IdealPid") {
221  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmIdealPid(par));
222  aDet->setName(name);
223  aDet->setStorePid();
224  return aDet;
225  }
226  if (tname=="CmpDet") {
227  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmCmpDet(par));
228  aDet->setName(name);
229  return aDet;
230  } else
231  if (tname=="CombiDet") {
232  PndFsmAbsDet* aDet = (PndFsmAbsDet*)(new PndFsmCombiDet(par));
233  aDet->setName(name);
234  return aDet;
235  } else {
236  std::cout <<" -W- (PndFsmDetFactory::create) Unknown detector: <"<<name<<">"<< std::endl;
237  return 0;
238  }
239 }
void setStorePid(Bool_t doespid=kTRUE)
Definition: PndFsmAbsDet.h:77
Double_t par[3]
void setName(std::string &name)
Definition: PndFsmAbsDet.h:75
TString name
PndFsmAbsDet * PndFsmDetFactory::create ( std::string &  name,
std::string  par 
)

Definition at line 242 of file PndFsmDetFactory.cxx.

References create(), CStrTok::GetFirst(), and CStrTok::GetNext().

243 {
244  // par is a string of the form "a=1 b=2 c=3 d=4"
245  // this function splits the single assignments in the string to an ArgList
246  // i.e. a std::list<std::string> of the form ("a=1","b=2","c=3","d=4")
247 
248  ArgList parList;
249 
250  CStrTok tokenizer;
251  char csrc[200];
252 
253  const char *src=par.data();
254  strcpy(csrc,src);
255 
256  char* token = tokenizer.GetFirst(csrc, " \t");
257 
258  while(token)
259  {
260  parList.push_back(token);
261  token=tokenizer.GetNext(" \t");
262  }
263 
264  /*
265  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
266  boost::char_separator<char> sep_blank(" ");
267  tokenizer tokens_bl(par, sep_blank);
268 
269  for (tokenizer::iterator tok_iter_bl = tokens_bl.begin();tok_iter_bl!=tokens_bl.end();tok_iter_bl++)
270  parList.push_back(*tok_iter_bl);
271  */
272 
273  return (PndFsmAbsDet*)create(name, parList);
274 }
std::list< std::string > ArgList
Definition: ArgList.h:7
Double_t par[3]
char * GetFirst(char *lpsz, const char *lpcszDelimiters)
Definition: StrTok.cxx:29
PndFsmAbsDet * create(std::string &name, ArgList &par)
TString name
Definition: StrTok.h:11
char * GetNext(const char *lpcszDelimiters)
Definition: StrTok.cxx:37

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