MinervaExpt / MAT-MINERvA

MINERvA-specific plugins to the MAT like FluxReweighter, MuonFunctions, and our CCInclusiveCuts.
MIT License
1 stars 1 forks source link

Should fix hard-coded MasterAnaDev tuple variable call #3

Open smgilligan opened 2 years ago

smgilligan commented 2 years ago

As of writing, lines 29-31 of MAT-MINERvA/calculators/LowRecoilFunctions.h read as:

double GetCalorimetryQ0() const {
  return GetDouble("MasterAnaDev_recoil_E");
}

Suggested rewrite, something like:

double GetCalorimetryQ0() const {
  return GetDouble(std::string(GetAnaToolName()+"_recoil_E").c_str());
}

This is similar to the format as implemented in lines 57-74 of MAT-MINERvA/calculators/MuonFunctions.h for functions GetPmu_nominal() and GetPmuMinos_nominal(), but without creating new variables. Those lines at the time of writing are:

virtual double GetPmu_nominal() const {                       /* MeV */
  std::string lepton_branch = GetAnaToolName() + "_leptonE";  // AnaTool
  // std::string lepton_branch = "Muon_leptonE";
  double px = GetVecElem(lepton_branch.c_str(), 0);
  double py = GetVecElem(lepton_branch.c_str(), 1);
  double pz = GetVecElem(lepton_branch.c_str(), 2);
  double total_p_nominal = sqrt(px * px + py * py + pz * pz);

  return total_p_nominal;
}

virtual double GetPmuMinos_nominal() const { /* MeV */
  // std::string minos_momentum_branch = "Muon_minos_trk_p";
  std::string minos_momentum_branch = GetAnaToolName() + "_minos_trk_p";
  double minos_p_nominal = GetDouble(minos_momentum_branch.c_str());

  return minos_p_nominal;
}
hschellman commented 2 years ago

Looks good to me. Will make it work for other packages