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

#include <PndPidMvaAssociatorTask.h>

Inheritance diagram for PndPidMvaAssociatorTask:
PndPidEmcAssociatorTask

Public Member Functions

 PndPidMvaAssociatorTask ()
 
 PndPidMvaAssociatorTask (char const *name)
 
virtual ~PndPidMvaAssociatorTask ()
 
virtual void Exec (Option_t *option)
 
virtual InitStatus Init ()
 
void Register ()
 
void Reset ()
 
void SetVerbose (Bool_t verb)
 
virtual void SetParContainers ()
 
virtual void Finish ()
 
virtual void SetVarNames (std::vector< std::string > const &vNames)
 
void SetClassNames (std::vector< std::string > const &clNames)
 
void SetWeightFileName (std::string const &wFileName)
 
void SetClassifier (Mva_MethodType const &methodT)
 
void SetClassifier (std::string const &methodName)
 
void SetNumNeigh (size_t val)
 
void SetKnnEventParams (float scFact, double weight)
 

Private Member Functions

 PndPidMvaAssociatorTask (PndPidMvaAssociatorTask const &other)
 
PndPidMvaAssociatorTaskoperator= (PndPidMvaAssociatorTask const &other)
 
void DoPidMatch (PndPidCandidate &pidcand, PndPidProbability &prob)
 
std::vector< float > const * PrepareEvtVect (PndPidCandidate const &pidcand) const
 
void SetDefaultWeightsPath ()
 
 ClassDef (PndPidMvaAssociatorTask, 0)
 

Private Attributes

FairRootManager * fManager
 
std::vector< std::string > fVarNames
 Variable names container. More...
 
std::vector< std::string > fClassNames
 Class names container. More...
 
std::string fWeightsFileName
 Path to the file holding weights (proto-types, examples, ...) More...
 
size_t fNumNeigh
 Number of neighbors. More...
 
float fScFact
 
double fWeight
 
PndMvaClassifierfClassifier
 MVA classifier object. More...
 
Mva_MethodType fMethodType
 MVA Method name. More...
 
TClonesArray * fPidChargedCand
 
TClonesArray * fPidChargedProb
 PndPidCandidate TCA for charged particles. More...
 
TClonesArray * fMCTrack
 PndPidProbability TCA for charged particles. More...
 
std::string fMethodName
 Monte-Carlo Truth track TCA. More...
 

Detailed Description

Definition at line 42 of file PndPidMvaAssociatorTask.h.

Constructor & Destructor Documentation

PndPidMvaAssociatorTask::PndPidMvaAssociatorTask ( )

Default Constructor.

PndPidMvaAssociatorTask::PndPidMvaAssociatorTask ( char const *  name)

Constructor.

Definition at line 86 of file PndPidMvaAssociatorTask.cxx.

87  : FairTask(name),
88  fManager(0),
89  fVarNames (std::vector<std::string>()),
90  fClassNames(std::vector<std::string>()),
91  fWeightsFileName(std::string(getenv("VMCWORKDIR")) + std::string("/tools/MVA/PndMVAWeights/")),
92  fNumNeigh(200),
93  fScFact(0.8),
94  fWeight(1.00),
95  fClassifier(0),
97  fPidChargedCand(0),
98  fPidChargedProb(new TClonesArray("PndPidProbability")),
99  fMCTrack(0),
100  fMethodName("UNKNOWN_METHOD")
101 {
102  // Init neutral probab. containers.
103  // fPidNeutralProb = new TClonesArray("PndPidProbability");
104 
105  // Set Default path to the weight file
106  //SetDefaultWeightsPath();
107 }
TClonesArray * fMCTrack
PndPidProbability TCA for charged particles.
PndMvaClassifier * fClassifier
MVA classifier object.
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
std::string fMethodName
Monte-Carlo Truth track TCA.
TString name
std::vector< std::string > fVarNames
Variable names container.
size_t fNumNeigh
Number of neighbors.
std::vector< std::string > fClassNames
Class names container.
std::string fWeightsFileName
Path to the file holding weights (proto-types, examples, ...)
Mva_MethodType fMethodType
MVA Method name.
PndPidMvaAssociatorTask::~PndPidMvaAssociatorTask ( )
virtual

Destructor.

Definition at line 125 of file PndPidMvaAssociatorTask.cxx.

References fClassifier, fManager, fMCTrack, fPidChargedCand, and fPidChargedProb.

126 {
127  // Clean-up allocated stuff.
128  if(fManager) {
129  fManager->Write();
130  delete fManager;
131  }
132 
133  if(fPidChargedCand) {
134  delete fPidChargedCand;
135  }
136 
137  if(fPidChargedProb) {
138  delete fPidChargedProb;
139  }
140  //if(fPidNeutralCand)
141  //delete fPidNeutralCand;
142 
143  //if(fPidNeutralProb)
144  //delete fPidNeutralProb;
145 
146  if(fMCTrack) {
147  delete fMCTrack;
148  }
149 
150  if(fClassifier) {
151  delete fClassifier;
152  }
153 }
TClonesArray * fMCTrack
PndPidProbability TCA for charged particles.
PndMvaClassifier * fClassifier
MVA classifier object.
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
PndPidMvaAssociatorTask::PndPidMvaAssociatorTask ( PndPidMvaAssociatorTask const &  other)
private

Member Function Documentation

PndPidMvaAssociatorTask::ClassDef ( PndPidMvaAssociatorTask  ,
 
)
private
void PndPidMvaAssociatorTask::DoPidMatch ( PndPidCandidate pidcand,
PndPidProbability prob 
)
private

Performs the actual classification.

Parameters
pidcandCurrent pid candidate to be classified.
probOutput probabilities.

Definition at line 387 of file PndPidMvaAssociatorTask.cxx.

References fClassifier, fClassNames, PndPidCandidate::GetDrcThetaC(), PndPidCandidate::GetEmcCalEnergy(), PndPidCandidate::GetEmcClusterE1(), PndPidCandidate::GetEmcClusterE25(), PndPidCandidate::GetEmcClusterE9(), PndPidCandidate::GetEmcClusterLat(), PndPidCandidate::GetEmcClusterZ20(), PndPidCandidate::GetEmcClusterZ53(), PndPidCandidate::GetEnergy(), PndPidCandidate::GetMomentum(), PndMvaClassifier::GetMvaValues(), PndPidCandidate::GetMvdDEDX(), PndPidCandidate::GetSttMeanDEDX(), i, name, out, PrepareEvtVect(), PndPidProbability::SetElectronPdf(), PndPidProbability::SetKaonPdf(), PndPidProbability::SetMuonPdf(), PndPidProbability::SetPionPdf(), and PndPidProbability::SetProtonPdf().

Referenced by Exec().

389 {
390 
391  std::map<std::string, float> out;
392  std::vector<float> const* evtPidData = PrepareEvtVect(pidcand);
393 
394  // Perform Recognition.
395  if( evtPidData ) {
396  fClassifier->GetMvaValues( *evtPidData, out);
397  delete evtPidData;
398  }
399  else {
400  // Feature vector is empty or damaged.
401  delete evtPidData;
402  evtPidData = 0;
403  return;
404  }
405 
406 #if ( PIDMVA_ASSOCIATORT_DEBUG != 0 )
407  std::cout << "****************************************************\n"
408  << "Momentum = " << (pidcand.GetMomentum()).Mag()
409  << "\nGetEnergy = " << pidcand.GetEnergy()
410  << "\nEMC = " << pidcand.GetEmcCalEnergy()
411  << "\nEMC/P = "
412  << (pidcand.GetEmcCalEnergy())/((pidcand.GetMomentum()).Mag())
413  << "\nEMCZ20 = " << pidcand.GetEmcClusterZ20()
414  << "\nEMCZ53 = " << pidcand.GetEmcClusterZ53()
415  << "\nEMCLAT = " << pidcand.GetEmcClusterLat()
416  << "\nEmcE1 = " << pidcand.GetEmcClusterE1()
417  << "\nEmcE9 = " << pidcand.GetEmcClusterE9()
418  << "\nEmcE25 = " << pidcand.GetEmcClusterE25()
419  << "\nSTT = " << pidcand.GetSttMeanDEDX()
420  << "\nMVD = " << pidcand.GetMvdDEDX()
421  << "\nDRC_TC = " << pidcand.GetDrcThetaC()
422  << '\n';
423  printResult(out);
424  std::cout << "====================================================\n";
425 #endif
426 
427  // Set probs.
428  for(size_t i = 0; i < fClassNames.size(); i++)
429  {
430  std::string name = fClassNames[i];
431 
432  if(name == "electron")
433  {
434  prob.SetElectronPdf(out[name]);
435  }
436  else if(name == "muon")
437  {
438  prob.SetMuonPdf(out[name]);
439  }
440  else if(name == "pion")
441  {
442  prob.SetPionPdf(out[name]);
443  }
444  else if(name == "kaon")
445  {
446  prob.SetKaonPdf(out[name]);
447  }
448  else if(name == "proton")
449  {
450  prob.SetProtonPdf(out[name]);
451  }
452  else
453  {
454  std::cerr << "<ERROR> Unknown label (class Name).\n"
455  << std::flush;
456  }
457  }
458 }
Double_t GetEmcClusterE25() const
Int_t i
Definition: run_full.C:25
void SetPionPdf(Double_t val)
PndMvaClassifier * fClassifier
MVA classifier object.
Float_t GetSttMeanDEDX() const
Float_t GetEmcCalEnergy() const
virtual void GetMvaValues(std::vector< float > EvtData, std::map< std::string, float > &result)=0
std::vector< float > const * PrepareEvtVect(PndPidCandidate const &pidcand) const
Double_t GetEnergy() const
void SetKaonPdf(Double_t val)
Double_t GetEmcClusterE9() const
Float_t GetDrcThetaC() const
void SetElectronPdf(Double_t val)
void SetMuonPdf(Double_t val)
Double_t GetEmcClusterE1() const
Double_t GetEmcClusterZ53() const
Double_t GetEmcClusterLat() const
Float_t GetMvdDEDX() const
Double_t GetEmcClusterZ20() const
TFile * out
Definition: reco_muo.C:20
TString name
void SetProtonPdf(Double_t val)
std::vector< std::string > fClassNames
Class names container.
TVector3 GetMomentum() const
void PndPidMvaAssociatorTask::Exec ( Option_t *  option)
virtual

Execute the method.

Definition at line 323 of file PndPidMvaAssociatorTask.cxx.

References DoPidMatch(), fPidChargedCand, fPidChargedProb, fVerbose, PndPidCandidate::GetLorentzVector(), and i.

324 {
325  std::cout << option << '\n';
326 
327  if (fPidChargedProb->GetEntriesFast() != 0)
328  {
329  fPidChargedProb->Delete();
330  }
331 
332 #if ( PIDMVA_ASSOCIATORT_DEBUG != 0 )
333  std::cout << "<INFO> Call to Exec with options = " << option
334  << "___\n";
335 #endif
336 
337  if(fVerbose > 1)
338  {
339  std::cout << "-I- Start PndPidMvaAssociatorTask.\n";
340  }
341 
342  // Charged Candidates Loop
343  for(int i = 0; i < fPidChargedCand->GetEntriesFast(); i++)
344  {
346  TClonesArray& pidRef = *fPidChargedProb;
347 
348  // initializes with zeros
349  PndPidProbability* prob = new(pidRef[i]) PndPidProbability();
350 
351  if(fVerbose > 1)
352  {
353  std::cout << "-I- PndPidMVAAssociatorTask Ch BEFORE "
354  << pidcand->GetLorentzVector().M()
355  << '\n';
356  }
357  // Classify
358  DoPidMatch(*pidcand, *prob);
359 
360  if(fVerbose > 1)
361  {
362  std::cout << "-I- PndPidMVAAssociatorTask Ch AFTER "
363  << pidcand->GetLorentzVector().M()
364  << '\n';
365  }
366  }
367 
368  // Get the Neutral Candidates
369  /*
370  for(int i = 0; i < fPidNeutralCand->GetEntriesFast(); i++)
371  {
372  PndPidCandidate* pidcand = (PndPidCandidate*)fPidNeutralCand->At(i);
373  TClonesArray& pidRef = *fPidNeutralProb;
374  // initializes with zeros
375  PndPidProbability* prob = new(pidRef[i]) PndPidProbability();
376  // Classify
377  DoPidMatch(*pidcand, *prob);
378  }
379  */
380 }
int fVerbose
Definition: poormantracks.C:24
Int_t i
Definition: run_full.C:25
TLorentzVector GetLorentzVector() const
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
void DoPidMatch(PndPidCandidate &pidcand, PndPidProbability &prob)
void PndPidMvaAssociatorTask::Finish ( )
virtual

Definition at line 564 of file PndPidMvaAssociatorTask.cxx.

565 {}
InitStatus PndPidMvaAssociatorTask::Init ( )
virtual

Initialize the method. Called by runner.

Definition at line 156 of file PndPidMvaAssociatorTask.cxx.

References fClassifier, fClassNames, fManager, fMethodName, fMethodType, fNumNeigh, fPidChargedCand, fScFact, fVarNames, fWeight, fWeightsFileName, PndMvaClassifier::Initialize(), PndMultiClassMlpClassify::Initialize(), PndMultiClassBdtClassify::Initialize(), PndKnnClassify::Initialize(), KNN, LVQ, Register(), PndKnnClassify::SetEvtParam(), PndKnnClassify::SetKnn(), TMVA_BDT, and TMVA_MLP.

157 {
158  std::cout << "<-I-> InitStatus PndPidMvaAssociatorTask::Init()\n";
159 
160  fManager = FairRootManager::Instance();
161  if( !fManager ) {
162  std::cerr << "<ERROR> PndPidMvaAssociatorTask::Init:\n"
163  << "\t Could not init FairRootManager."
164  << std::endl;
165 
166  return kERROR;
167  }
168 
169  // Get charged candidates.
170  fPidChargedCand = (TClonesArray *)fManager->GetObject("PidChargedCand");
171  if ( !fPidChargedCand) {
172  std::cerr << "<ERROR> PndPidMvaAssociatorTask::Init: No PidChargedCand there!"
173  << std::endl;
174  return kERROR;
175  }
176 
177  // Get Neutral candidates.
178  /*
179  fPidNeutralCand = (TClonesArray *)fManager->GetObject("PidNeutralCand");
180  if ( ! fPidNeutralCand)
181  {
182  std::cerr << "<ERROR> PndPidMvaAssociatorTask::Init: No PidNeutralCand there!"
183  << std::endl;
184  return kERROR;
185  }
186  */
187 
188  std::cout << "<INFO> Using weight file " << fWeightsFileName
189  << '\n';
190 
191  // Init Classifier object
192  switch(fMethodType)
193  {
194  case TMVA_MLP:// Multi label MLP classifier from TMVA.
195  {
196  PndMultiClassMlpClassify* TmvaMlpCls = new PndMultiClassMlpClassify(fWeightsFileName, fClassNames,
197  fVarNames);
198  if(!TmvaMlpCls)
199  {
200  std::cerr << "<Error> Failed to initialize TMVA_MLP classifier."
201  << std::endl;
202  return kERROR;
203  }
204  // Init
205  TmvaMlpCls->Initialize();
206 
207  //fClassifier = dynamic_cast<PndMultiClassMlpClassify*>(TmvaMlpCls);
208  fClassifier = TmvaMlpCls;
209  std::cout << "<INFO> TMVA_MLP initialized using " << fWeightsFileName << '\n';
210 
211  fMethodName = "TMVAMLP";
212  }
213  break;
214 
215  case TMVA_BDT:// Multi label BDT classifier from TMVA.
216  {
217  PndMultiClassBdtClassify* TmvaBdtCls = new PndMultiClassBdtClassify(fWeightsFileName, fClassNames,
218  fVarNames);
219  if(!TmvaBdtCls)
220  {
221  std::cerr << "<Error> Failed to initialize TMVA_BDT classifier."
222  << std::endl;
223  return kERROR;
224  }
225  // INIT
226  TmvaBdtCls->Initialize();
227 
228  //fClassifier = dynamic_cast<PndMultiClassBdtClassify*>(TmvaBdtCls);
229  fClassifier = TmvaBdtCls;
230  std::cout << "<INFO> TMVA_BDT initialized using " << fWeightsFileName << '\n';
231 
232  fMethodName = "TMVABDT";
233  }
234  break;
235 
236  case LVQ:
237  {
238  PndLVQClassify* LvqCls = new PndLVQClassify(fWeightsFileName, fClassNames, fVarNames);
239 
240  if(!LvqCls)
241  {
242  std::cerr << "<Error> Failed to initialize LVQ classifier."
243  << std::endl;
244  return kERROR;
245  }
246  // Init
247  LvqCls->Initialize();
248 
249  //fClassifier = dynamic_cast<PndMvaClassifier*>(LvqCls);
250  fClassifier = LvqCls;
251  std::cout << "<INFO> LVQ initialized using " << fWeightsFileName << '\n';
252 
253  fMethodName = "LVQ";
254  }
255  break;
256 
257  case KNN:
258  default:
259  {
260  PndKnnClassify* KnnCls = new PndKnnClassify(fWeightsFileName, fClassNames, fVarNames);
261 
262  if(!KnnCls)
263  {
264  std::cerr << "<Error> Failed to initialize KNN classifier."
265  << std::endl;
266  return kERROR;
267  }
268 
269  // Set parameters.
270  KnnCls->SetEvtParam(fScFact, fWeight);
271  KnnCls->SetKnn(fNumNeigh);
272  KnnCls->Initialize();
273 
274  //fClassifier = dynamic_cast<PndMvaClassifier*>(KnnCls);
275  fClassifier = KnnCls;
276  std::cout << "<INFO> KNN initialized using " << fWeightsFileName << '\n';
277 
278  fMethodName = "KNN";
279  }
280  break;
281  }// End of switch(fMethodType)
282 
283  // Register objects in the output chain
284  Register();
285 
286  std::cout << "<INFO> PndPidMvaAssociatorTask::Init: Success!\n";
287  return kSUCCESS;
288 }
PndMvaClassifier * fClassifier
MVA classifier object.
!< Type definition of the neighbour list.
std::string fMethodName
Monte-Carlo Truth track TCA.
void SetEvtParam(float const scFact, double const weight)
std::vector< std::string > fVarNames
Variable names container.
void SetKnn(size_t const N)
Set the number of neighbours.
size_t fNumNeigh
Number of neighbors.
virtual void Initialize()
std::vector< std::string > fClassNames
Class names container.
Interface definition of the LVQ classifier.
std::string fWeightsFileName
Path to the file holding weights (proto-types, examples, ...)
virtual void Initialize()
Mva_MethodType fMethodType
MVA Method name.
PndPidMvaAssociatorTask& PndPidMvaAssociatorTask::operator= ( PndPidMvaAssociatorTask const &  other)
private
std::vector< float > const * PndPidMvaAssociatorTask::PrepareEvtVect ( PndPidCandidate const &  pidcand) const
private

Definition at line 460 of file PndPidMvaAssociatorTask.cxx.

References fVarNames, PndPidCandidate::GetDrcThetaC(), PndPidCandidate::GetEmcCalEnergy(), PndPidCandidate::GetEmcClusterE1(), PndPidCandidate::GetEmcClusterE25(), PndPidCandidate::GetEmcClusterE9(), PndPidCandidate::GetEmcClusterLat(), PndPidCandidate::GetEmcClusterZ20(), PndPidCandidate::GetEmcClusterZ53(), PndPidCandidate::GetMomentum(), PndPidCandidate::GetMvdDEDX(), PndPidCandidate::GetSttMeanDEDX(), i, and mom.

Referenced by DoPidMatch().

461 {
462  std::vector<float>* vect = new std::vector<float>();
463  float mom = (pidcand.GetMomentum()).Mag();
464 
465  for(size_t i = 0; i < fVarNames.size(); i++)
466  {
467  if( fVarNames[i] == "p" )
468  {
469  vect->push_back((pidcand.GetMomentum()).Mag());
470  }
471  else if(fVarNames[i] == "emc")
472  {
473  if(mom > 0.00) { // E/p
474  vect->push_back( (pidcand.GetEmcCalEnergy())/mom);
475  }
476  else {
477  std::cerr << "<WARNING> (p > 0) failed. The event is skipped.\n"
478  << "<ER-I> p = " << mom << std::endl;
479  delete vect;
480  vect = 0;
481  return 0;// Can not proceed. Break the procedure
482  }
483  }
484  // Cluster Ex parameters.
485  else if( (fVarNames[i] == "e1") || (fVarNames[i] == "E1") )
486  {
487  vect->push_back(pidcand.GetEmcClusterE1());
488  }
489  else if( (fVarNames[i] == "e9") || (fVarNames[i] == "E9") )
490  {
491  vect->push_back(pidcand.GetEmcClusterE9());
492  }
493  else if( (fVarNames[i] == "e25") || (fVarNames[i] == "E25") )
494  {
495  vect->push_back(pidcand.GetEmcClusterE25());
496  }
497  else if( (fVarNames[i] == "e1e9") || (fVarNames[i] == "E1E9") )
498  {
499  if( pidcand.GetEmcClusterE9() > 0 ) {
500  vect->push_back(pidcand.GetEmcClusterE1()/pidcand.GetEmcClusterE9());
501  }
502  else {
503  std::cerr << "<WARNING> (EmcClusterE9 > 0) failed. The event is skipped.\n"
504  << std::flush;
505  delete vect;
506  vect = 0;
507  return 0;// Can not proceed. Break the procedure
508  }
509  }
510  else if( (fVarNames[i] == "e9e25") || (fVarNames[i] == "E9E25") )
511  {
512  if( pidcand.GetEmcClusterE25() > 0 ) {
513  vect->push_back(pidcand.GetEmcClusterE9()/pidcand.GetEmcClusterE25());
514  }
515  else {
516  std::cerr << "<WARNING> (EmcClusterE25 > 0) failed. The event is skipped.\n"
517  << std::flush;
518  delete vect;
519  vect = 0;
520  return 0;// Can not proceed. Break the procedure
521  }
522  }
523  //======== Zernike & moments
524  else if(fVarNames[i] == "z20")
525  {
526  vect->push_back(pidcand.GetEmcClusterZ20());
527  }
528  else if(fVarNames[i] == "z53")
529  {
530  vect->push_back(pidcand.GetEmcClusterZ53());
531  }
532  // Cluster Second lat. moment
533  else if(fVarNames[i] == "lat")
534  {
535  vect->push_back(pidcand.GetEmcClusterLat());
536  }
537  // ========== other detectors
538  else if(fVarNames[i] == "stt")
539  {
540  vect->push_back(pidcand.GetSttMeanDEDX());
541  }
542  else if(fVarNames[i] == "mvd")
543  {
544  vect->push_back(pidcand.GetMvdDEDX());
545  }
546  else if(fVarNames[i] == "thetaC")
547  {
548  vect->push_back(pidcand.GetDrcThetaC());
549  }
550  }
551  return vect;
552 }
Int_t i
Definition: run_full.C:25
Double_t mom
Definition: plot_dirc.C:14
std::vector< std::string > fVarNames
Variable names container.
void PndPidMvaAssociatorTask::Register ( )

Definition at line 555 of file PndPidMvaAssociatorTask.cxx.

References fMethodName, and fPidChargedProb.

Referenced by Init().

556 {
557  std::string tcaName = fMethodName + "MvaProb";
558  //---
559  FairRootManager::Instance()->Register(tcaName.c_str(),"Pid", fPidChargedProb, kTRUE);
560  // FairRootManager::Instance()->Register("MvaNeutralProb","Pid", fPidNeutralProb, kTRUE);
561 }
TClonesArray * fPidChargedProb
PndPidCandidate TCA for charged particles.
std::string fMethodName
Monte-Carlo Truth track TCA.
void PndPidMvaAssociatorTask::Reset ( )

Definition at line 567 of file PndPidMvaAssociatorTask.cxx.

568 {}
void PndPidMvaAssociatorTask::SetClassifier ( Mva_MethodType const &  methodT)
inline

Set the classifier type.

Parameters
methodTThe method to be used.

Definition at line 201 of file PndPidMvaAssociatorTask.h.

References fMethodType.

202 {
203  fMethodType = methodT;
204 };
Mva_MethodType fMethodType
MVA Method name.
void PndPidMvaAssociatorTask::SetClassifier ( std::string const &  methodName)

Set the classifier type.

Parameters
methodNameThe method to be used.

Definition at line 294 of file PndPidMvaAssociatorTask.cxx.

References fMethodName, fMethodType, KNN, LVQ, TMVA_BDT, and TMVA_MLP.

295 {
296  if(methodNameStr == "KNN")
297  {
298  fMethodType = KNN;
299  fMethodName = "KNN";
300  }
301  else if(methodNameStr == "LVQ")
302  {
303  fMethodType = LVQ;
304  fMethodName = "LVQ";
305  }
306  else if(methodNameStr == "TMVA_MLP")
307  {
309  fMethodName = "TMVAMLP";
310  }
311  else if(methodNameStr == "TMVA_BDT")
312  {
314  fMethodName = "TMVABDT";
315  }
316  else
317  {
318  std::cerr << "<ERROR> Unknown Method."
319  << std::endl;
320  }
321 };
std::string fMethodName
Monte-Carlo Truth track TCA.
Mva_MethodType fMethodType
MVA Method name.
void PndPidMvaAssociatorTask::SetClassNames ( std::vector< std::string > const &  clNames)
inline
Parameters
clNamesInput class names.

Definition at line 186 of file PndPidMvaAssociatorTask.h.

References fClassNames.

187 {
188  fClassNames = clNames;
189 };
std::vector< std::string > fClassNames
Class names container.
void PndPidMvaAssociatorTask::SetDefaultWeightsPath ( )
private

Definition at line 112 of file PndPidMvaAssociatorTask.cxx.

References fWeightsFileName.

113 {
114  fWeightsFileName = std::string(getenv("VMCWORKDIR"));
115  fWeightsFileName += std::string("/tools/MVA/PndMVAWeights/");
116  std::cout<<"<INFO> Default Weights path is set to "
118  << '\n';
119 }
std::string fWeightsFileName
Path to the file holding weights (proto-types, examples, ...)
void PndPidMvaAssociatorTask::SetKnnEventParams ( float  scFact,
double  weight 
)
inline

Set the scale factor and the event weight for KNN classifier.

Parameters
scFactScale factor.
weightEvents weight.

Definition at line 206 of file PndPidMvaAssociatorTask.h.

References fScFact, and fWeight.

207 {
208  fScFact = scFact;
209  fWeight = weight;
210 };
void PndPidMvaAssociatorTask::SetNumNeigh ( size_t  val)
inline
Parameters
valnNumber of neighbors to be uset for KNN classifier.

Definition at line 196 of file PndPidMvaAssociatorTask.h.

References fNumNeigh, and val.

197 {
198  fNumNeigh = val;
199 };
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
size_t fNumNeigh
Number of neighbors.
void PndPidMvaAssociatorTask::SetParContainers ( )
virtual

Set parameter containers

Definition at line 291 of file PndPidMvaAssociatorTask.cxx.

292 {}
void PndPidMvaAssociatorTask::SetVarNames ( std::vector< std::string > const &  vNames)
inlinevirtual
Parameters
vNamesInput variable names.

Reimplemented in PndPidEmcAssociatorTask.

Definition at line 181 of file PndPidMvaAssociatorTask.h.

References fVarNames.

Referenced by PndPidEmcAssociatorTask::SetVarNames().

182 {
183  fVarNames = vNames;
184 };
std::vector< std::string > fVarNames
Variable names container.
void PndPidMvaAssociatorTask::SetVerbose ( Bool_t  verb)
inline

Definition at line 176 of file PndPidMvaAssociatorTask.h.

References fVerbose.

177 {
178  fVerbose = verb;
179 };
int fVerbose
Definition: poormantracks.C:24
void PndPidMvaAssociatorTask::SetWeightFileName ( std::string const &  wFileName)
inline
Parameters
wFileNameInput weight file. If not specified the standard file from the standard location is loaded.

Definition at line 191 of file PndPidMvaAssociatorTask.h.

References fWeightsFileName.

192 {
193  fWeightsFileName = wFileName;
194 };
std::string fWeightsFileName
Path to the file holding weights (proto-types, examples, ...)

Member Data Documentation

PndMvaClassifier* PndPidMvaAssociatorTask::fClassifier
private

MVA classifier object.

Definition at line 161 of file PndPidMvaAssociatorTask.h.

Referenced by DoPidMatch(), Init(), and ~PndPidMvaAssociatorTask().

std::vector<std::string> PndPidMvaAssociatorTask::fClassNames
private

Class names container.

Definition at line 150 of file PndPidMvaAssociatorTask.h.

Referenced by DoPidMatch(), Init(), and SetClassNames().

FairRootManager* PndPidMvaAssociatorTask::fManager
private

Definition at line 140 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), and ~PndPidMvaAssociatorTask().

TClonesArray* PndPidMvaAssociatorTask::fMCTrack
private

PndPidProbability TCA for charged particles.

Definition at line 168 of file PndPidMvaAssociatorTask.h.

Referenced by ~PndPidMvaAssociatorTask().

std::string PndPidMvaAssociatorTask::fMethodName
private

Monte-Carlo Truth track TCA.

Definition at line 171 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), Register(), and SetClassifier().

Mva_MethodType PndPidMvaAssociatorTask::fMethodType
private

MVA Method name.

Definition at line 164 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), and SetClassifier().

size_t PndPidMvaAssociatorTask::fNumNeigh
private

Number of neighbors.

Definition at line 156 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), and SetNumNeigh().

TClonesArray* PndPidMvaAssociatorTask::fPidChargedCand
private

Definition at line 166 of file PndPidMvaAssociatorTask.h.

Referenced by Exec(), Init(), and ~PndPidMvaAssociatorTask().

TClonesArray* PndPidMvaAssociatorTask::fPidChargedProb
private

PndPidCandidate TCA for charged particles.

Definition at line 167 of file PndPidMvaAssociatorTask.h.

Referenced by Exec(), Register(), and ~PndPidMvaAssociatorTask().

float PndPidMvaAssociatorTask::fScFact
private

Definition at line 157 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), and SetKnnEventParams().

std::vector<std::string> PndPidMvaAssociatorTask::fVarNames
private

Variable names container.

Definition at line 147 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), PrepareEvtVect(), and SetVarNames().

double PndPidMvaAssociatorTask::fWeight
private

Definition at line 158 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), and SetKnnEventParams().

std::string PndPidMvaAssociatorTask::fWeightsFileName
private

Path to the file holding weights (proto-types, examples, ...)

Definition at line 153 of file PndPidMvaAssociatorTask.h.

Referenced by Init(), SetDefaultWeightsPath(), and SetWeightFileName().


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