Fork me on GitHub

Changeset 205ff13 in git for classes


Ignore:
Timestamp:
Feb 14, 2019, 4:20:05 PM (6 years ago)
Author:
Pavel Demin <pavel-demin@…>
Branches:
ImprovedOutputFile, Timing, llp, master
Children:
19ed91a
Parents:
1f2a49a
Message:

remove TVarNameMap and TVarValMap from DelphesLongFormula

Location:
classes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • classes/DelphesLongFormula.cc

    r1f2a49a r205ff13  
    5757  }
    5858
    59   buffer.ReplaceAll("pt", "[pt]");
    60   buffer.ReplaceAll("eta", "[eta]");
    61   buffer.ReplaceAll("phi", "[phi]");
    62   buffer.ReplaceAll("energy", "[energy]");
    63   buffer.ReplaceAll("d0", "[d0]");
    64   buffer.ReplaceAll("dz", "[dz]");
    65   buffer.ReplaceAll("ctgTheta", "[ctgTheta]");
    66 
    6759#if ROOT_VERSION_CODE < ROOT_VERSION(6, 0, 0)
    6860  TFormula::SetMaxima(100000, 1000, 1000000);
     61#else
     62  TFormula::AddVariable("pt");
     63  TFormula::AddVariable("eta");
     64  TFormula::AddVariable("phi");
     65  TFormula::AddVariable("energy");
     66  TFormula::AddVariable("d0");
     67  TFormula::AddVariable("dz");
     68  TFormula::AddVariable("ctgTheta");
    6969#endif
    7070
     
    8282  Double_t energy, Double_t d0, Double_t dz, Double_t ctgTheta)
    8383{
     84  Double_t x[7];
    8485
    85   TVarNameMap fVarNameMap;
    86   TVarValMap fVarValMap;
     86  x[0] = pt;
     87  x[1] = eta;
     88  x[2] = phi;
     89  x[3] = energy;
     90  x[4] = d0;
     91  x[5] = dz;
     92  x[6] = ctgTheta;
    8793
    88   fVarNameMap[this->GetParNumber("pt")] = "pt";
    89   fVarNameMap[this->GetParNumber("eta")] = "eta";
    90   fVarNameMap[this->GetParNumber("phi")] = "phi";
    91   fVarNameMap[this->GetParNumber("energy")] = "energy";
    92   fVarNameMap[this->GetParNumber("d0")] = "d0";
    93   fVarNameMap[this->GetParNumber("dz")] = "dz";
    94   fVarNameMap[this->GetParNumber("ctgTheta")] = "ctgTheta";
    95 
    96   fVarValMap["pt"] = pt;
    97   fVarValMap["eta"] = eta;
    98   fVarValMap["phi"] = phi;
    99   fVarValMap["energy"] = energy;
    100   fVarValMap["d0"] = d0;
    101   fVarValMap["dz"] = dz;
    102   fVarValMap["ctgTheta"] = ctgTheta;
    103 
    104   Double_t vals[7];
    105 
    106   Int_t j = 0;
    107   for(Int_t i = 0; i != 7; i++)
    108   {
    109     if(fVarNameMap.find(i) != fVarNameMap.end())
    110     {
    111       TString var_name = fVarNameMap[i];
    112       vals[i] = fVarValMap[var_name];
    113     }
    114     else
    115       vals[i] = 0.;
    116   }
    117   return EvalPar(nullptr, vals);
     94  return EvalPar(x);
    11895}
    11996
  • classes/DelphesLongFormula.h

    r1f2a49a r205ff13  
    2121
    2222#include "TFormula.h"
    23 #include <map>
    2423
    2524class DelphesLongFormula: public TFormula
     
    3534  Double_t Eval(Double_t pt, Double_t eta = 0, Double_t phi = 0,
    3635    Double_t energy = 0, Double_t d0 = 0, Double_t dz = 0, Double_t ctgTheta = 0);
    37 
    38   typedef std::map<Int_t, TString> TVarNameMap; //!
    39   typedef std::map<TString, Double_t> TVarValMap; //!
    4036};
    4137
Note: See TracChangeset for help on using the changeset viewer.