#include <iostream>
#include <iomanip>
#include <cassert>
#include <map>
#include <cstring>
#include <fstream>
#include <stdlib.h>
#include <float.h>
#include "TFile.h"
#include "TTree.h"
#include "TRandom3.h"
#include "TH1D.h"
#include "TString.h"
#include "tree/dk2nu.h"
#include "tree/dkmeta.h"
#include "tree/readWeightLocations.h"
#include "tree/calcLocationWeights.h"
Go to the source code of this file.
Functions | |
bool | histCompare (double a, double b, string s) |
void | ConvertInit (std::string locfilename="$(DK2NU)/etc/locations.txt") |
void | ConvertBookNtuple (std::string ofname="test_dk2nu.root") |
void | ConvertFinish () |
int | ConvertGeantToPdg (int geant_code, std::string tag="?") |
int | Convert5xToPdg (int old_ntype) |
TString | ConvertFlukaInteractionCodeToString (int interactionCode) |
TString | ConvertVolumeCodeToString (int volumeCode, string volumeFilePath) |
size_t | find_loc_index (string match) |
string | construct_outfilename (string infilename) |
double | estimate_pots (int highest_potnum) |
bool | isCloseEnough (double a, double b, double &difference, double &fdiff, int &nmsg, int mxmsg, string s) |
Definition at line 491 of file common_convert.C.
References stan::math::dot().
Referenced by convert_flugg(), convert_g4lbne(), and convert_g4minerva().
Definition at line 363 of file common_convert.C.
References ana::assert(), om::cerr, and allTimeWatchdog::endl.
Referenced by copy_flugg_to_dk2nu(), copy_g4lbne_to_dk2nu(), and copy_g4minerva_to_dk2nu().
void ConvertBookNtuple | ( | std::string | ofname = "test_dk2nu.root" | ) |
equivalent to NumiAnalysis::book() in g4numi
Definition at line 74 of file common_convert.C.
References dk2nuTree, dkmetaTree, and treeFile.
Referenced by convert_flugg(), convert_g4lbne(), and convert_g4minerva().
void ConvertFinish | ( | ) |
equivalent to NumiAnalysis::finish() in g4numi
fill the rest of the metadata (locations filled above)
Definition at line 92 of file common_convert.C.
References dk2nuTree, dkmetaTree, histCompare(), bsim::DkMeta::job, myjob, pots, bsim::DkMeta::pots, and treeFile.
Referenced by convert_flugg(), convert_g4lbne(), and convert_g4minerva().
TString ConvertFlukaInteractionCodeToString | ( | int | interactionCode | ) |
int ConvertGeantToPdg | ( | int | geant_code, |
std::string | tag = "?" |
||
) |
Definition at line 295 of file common_convert.C.
References om::cerr, allTimeWatchdog::endl, kPdgAntiD0, kPdgAntiLambda, kPdgAntiMuon, kPdgAntiNeutron, kPdgAntiOmegaP, kPdgAntiProton, kPdgAntiSigma0, kPdgAntiSigmaM, kPdgAntiSigmaP, kPdgAntiTau, kPdgAntiXi0, kPdgAntiXiP, kPdgD0, kPdgDM, kPdgDMs, kPdgDP, kPdgDPs, kPdgElectron, kPdgEta, kPdgGamma, kPdgK0L, kPdgK0S, kPdgKM, kPdgKP, kPdgLambda, kPdgMuon, kPdgNeutron, kPdgOmegaM, kPdgPi0, kPdgPiM, kPdgPiP, kPdgPositron, kPdgProton, kPdgSigma0, kPdgSigmaM, kPdgSigmaP, kPdgTau, kPdgWM, kPdgWP, kPdgXi0, kPdgXiM, kPdgZ0, and getGoodRuns4SAM::tag.
Referenced by copy_flugg_to_dk2nu(), copy_g4lbne_to_dk2nu(), and copy_g4minerva_to_dk2nu().
void ConvertInit | ( | std::string | locfilename = "$(DK2NU)/etc/locations.txt" | ) |
equivalent to NumiAnalysis::NumiAnalysis() in g4numi
Definition at line 52 of file common_convert.C.
References bsim::printWeightLocations(), bsim::readWeightLocations(), and rndm.
Referenced by convert_flugg(), convert_g4lbne(), and convert_g4minerva().
Definition at line 410 of file common_convert.C.
References om::cout, allTimeWatchdog::endl, and string.
Referenced by copy_flugg_to_dk2nu().
double estimate_pots | ( | int | highest_potnum | ) |
Definition at line 505 of file common_convert.C.
References nquant.
Referenced by convert_flugg(), convert_g4lbne(), and convert_g4minerva().
size_t find_loc_index | ( | string | match | ) |
Definition at line 478 of file common_convert.C.
References MECModelEnuComparisons::i, and bsim::DkMeta::location.
Referenced by fluggCrossChecks(), g4lbneCrossChecks(), and g4minervaCrossChecks().
bool histCompare | ( | double | a, |
double | b, | ||
string | s | ||
) |
static bool first = true;
Definition at line 561 of file common_convert.C.
References close(), release_diff::diff, util::frac(), isCloseEnough(), and nbins.
Referenced by ConvertFinish(), fluggCrossChecks(), g4lbneCrossChecks(), and g4minervaCrossChecks().
bool isCloseEnough | ( | double | a, |
double | b, | ||
double & | difference, | ||
double & | fdiff, | ||
int & | nmsg, | ||
int | mxmsg, | ||
string | s | ||
) |
Definition at line 523 of file common_convert.C.
References a, b, om::cout, delta, e, allTimeWatchdog::endl, epsilon, stan::math::fabs(), frac_diff_tolerance, stan::math::ldexp(), obs_frac_diff_max, and sum.
Referenced by histCompare().
bsim::Dk2Nu* dk2nu = 0 |
Definition at line 37 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), copy_flugg_to_dk2nu(), copy_g4lbne_to_dk2nu(), copy_g4minerva_to_dk2nu(), fluggCrossChecks(), g4lbneCrossChecks(), g4minervaCrossChecks(), MergeGenCollections::MergeGenCollections::produce(), test_fill_dk2nu(), and test_read_dk2nu().
TTree* dk2nuTree = 0 |
Definition at line 40 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), ConvertBookNtuple(), ConvertFinish(), and test_fill_dk2nu().
bsim::DkMeta* dkmeta = 0 |
Definition at line 38 of file common_convert.C.
Referenced by genie::flux::GDk2NuFlux::AddFile(), convert_flugg(), convert_g4lbne(), convert_g4minerva(), evgen::GENIEGen::produce(), test_fill_dk2nu(), test_read_dk2nu(), and genie::flux::GDk2NuFluxXMLHelper::~GDk2NuFluxXMLHelper().
TTree* dkmetaTree = 0 |
Definition at line 41 of file common_convert.C.
Referenced by ConvertBookNtuple(), ConvertFinish(), and test_fill_dk2nu().
double frac_diff_tolerance = 5.0e-4 |
Definition at line 45 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), and isCloseEnough().
const int kPdgAntiBQuark = -5 |
Definition at line 153 of file common_convert.C.
const int kPdgAntiCQuark = -4 |
Definition at line 151 of file common_convert.C.
const int kPdgAntiD0 = -421 |
Definition at line 260 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiDQuark = -1 |
Definition at line 147 of file common_convert.C.
const int kPdgAntiK0 = -311 |
Definition at line 254 of file common_convert.C.
const int kPdgAntiLambda = -3122 |
Definition at line 172 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiMuon = -13 |
Definition at line 140 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiNeutron = -2112 |
Definition at line 170 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiNuE = -12 |
Definition at line 131 of file common_convert.C.
const int kPdgAntiNuMu = -14 |
Definition at line 133 of file common_convert.C.
const int kPdgAntiNuTau = -16 |
Definition at line 135 of file common_convert.C.
const int kPdgAntiOmegaP = -3334 |
Definition at line 184 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiProton = -2212 |
Definition at line 168 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiSigma0 = -3212 |
Definition at line 177 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiSigmaM = -3112 |
Definition at line 178 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiSigmaP = -3222 |
Definition at line 176 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiSQuark = -3 |
Definition at line 149 of file common_convert.C.
const int kPdgAntiTau = -15 |
Definition at line 142 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiTQuark = -6 |
Definition at line 155 of file common_convert.C.
const int kPdgAntiUQuark = -2 |
Definition at line 145 of file common_convert.C.
const int kPdgAntiXi0 = -3322 |
Definition at line 181 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgAntiXiP = -3312 |
Definition at line 182 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgBindino = 2000000101 |
Definition at line 283 of file common_convert.C.
const int kPdgBQuark = 5 |
Definition at line 152 of file common_convert.C.
const int kPdgCluster = 91 |
Definition at line 290 of file common_convert.C.
const int kPdgClusterNN = 2000000200 |
Definition at line 285 of file common_convert.C.
const int kPdgClusterNP = 2000000201 |
Definition at line 286 of file common_convert.C.
const int kPdgClusterPP = 2000000202 |
Definition at line 287 of file common_convert.C.
const int kPdgCoulobtron = 2000000102 |
Definition at line 284 of file common_convert.C.
const int kPdgCQuark = 4 |
Definition at line 150 of file common_convert.C.
const int kPdgD0 = 421 |
Definition at line 259 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgD13m1520_N0 = 1214 |
Definition at line 196 of file common_convert.C.
const int kPdgD13m1520_NP = 2124 |
Definition at line 197 of file common_convert.C.
const int kPdgD13m1700_N0 = 21214 |
Definition at line 200 of file common_convert.C.
const int kPdgD13m1700_NP = 22124 |
Definition at line 201 of file common_convert.C.
const int kPdgD15m1675_N0 = 2116 |
Definition at line 202 of file common_convert.C.
const int kPdgD15m1675_NP = 2216 |
Definition at line 203 of file common_convert.C.
const int kPdgD33m1700_Delta0 = 12114 |
Definition at line 209 of file common_convert.C.
const int kPdgD33m1700_DeltaM = 11114 |
Definition at line 208 of file common_convert.C.
const int kPdgD33m1700_DeltaP = 12214 |
Definition at line 210 of file common_convert.C.
const int kPdgD33m1700_DeltaPP = 12224 |
Definition at line 211 of file common_convert.C.
const int kPdgDDDiquarkS1 = 1103 |
Definition at line 157 of file common_convert.C.
const int kPdgDM = -411 |
Definition at line 258 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgDMs = -431 |
Definition at line 262 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgDP = 411 |
Definition at line 257 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgDPs = 431 |
Definition at line 261 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgDQuark = 1 |
Definition at line 146 of file common_convert.C.
const int kPdgElectron = 11 |
Definition at line 137 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgEta = 221 |
Definition at line 240 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgEtab = 551 |
Definition at line 243 of file common_convert.C.
const int kPdgEtac = 441 |
Definition at line 242 of file common_convert.C.
const int kPdgEtaPrm = 331 |
Definition at line 241 of file common_convert.C.
const int kPdgF15m1680_N0 = 12116 |
Definition at line 216 of file common_convert.C.
const int kPdgF15m1680_NP = 12216 |
Definition at line 217 of file common_convert.C.
const int kPdgF35m1905_Delta0 = 1216 |
Definition at line 227 of file common_convert.C.
const int kPdgF35m1905_DeltaM = 1116 |
Definition at line 226 of file common_convert.C.
const int kPdgF35m1905_DeltaP = 2126 |
Definition at line 228 of file common_convert.C.
const int kPdgF35m1905_DeltaPP = 2226 |
Definition at line 229 of file common_convert.C.
const int kPdgF37m1950_Delta0 = 2118 |
Definition at line 231 of file common_convert.C.
const int kPdgF37m1950_DeltaM = 1118 |
Definition at line 230 of file common_convert.C.
const int kPdgF37m1950_DeltaP = 2218 |
Definition at line 232 of file common_convert.C.
const int kPdgF37m1950_DeltaPP = 2228 |
Definition at line 233 of file common_convert.C.
const int kPdgGamma = 22 |
Definition at line 265 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgGluon = 21 |
Definition at line 264 of file common_convert.C.
const int kPdgHadronicBlob = 2000000002 |
Definition at line 282 of file common_convert.C.
const int kPdgHadronicSyst = 2000000001 |
Definition at line 281 of file common_convert.C.
const int kPdgIndep = 93 |
Definition at line 292 of file common_convert.C.
const int kPdgJpsi = 443 |
Definition at line 249 of file common_convert.C.
const int kPdgK0 = 311 |
Definition at line 253 of file common_convert.C.
const int kPdgK0L = 130 |
Definition at line 255 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgK0S = 310 |
Definition at line 256 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgKM = -321 |
Definition at line 252 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgKP = 321 |
Definition at line 251 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgLambda = 3122 |
Definition at line 171 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgLambdaPc = 4122 |
Definition at line 185 of file common_convert.C.
const int kPdgMuon = 13 |
Definition at line 139 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgNeutron = 2112 |
Definition at line 169 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgNuE = 12 |
Definition at line 130 of file common_convert.C.
const int kPdgNuMu = 14 |
Definition at line 132 of file common_convert.C.
const int kPdgNuTau = 16 |
Definition at line 134 of file common_convert.C.
const int kPdgomega = 223 |
Definition at line 247 of file common_convert.C.
const int kPdgOmegaM = 3334 |
Definition at line 183 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgP11m1440_N0 = 12112 |
Definition at line 212 of file common_convert.C.
const int kPdgP11m1440_NP = 12212 |
Definition at line 213 of file common_convert.C.
const int kPdgP11m1710_N0 = 42112 |
Definition at line 234 of file common_convert.C.
const int kPdgP11m1710_NP = 42212 |
Definition at line 235 of file common_convert.C.
const int kPdgP13m1720_N0 = 31214 |
Definition at line 214 of file common_convert.C.
const int kPdgP13m1720_NP = 32124 |
Definition at line 215 of file common_convert.C.
const int kPdgP31m1910_Delta0 = 21212 |
Definition at line 219 of file common_convert.C.
const int kPdgP31m1910_DeltaM = 21112 |
Definition at line 218 of file common_convert.C.
const int kPdgP31m1910_DeltaP = 22122 |
Definition at line 220 of file common_convert.C.
const int kPdgP31m1910_DeltaPP = 22222 |
Definition at line 221 of file common_convert.C.
const int kPdgP33m1232_Delta0 = 2114 |
Definition at line 191 of file common_convert.C.
const int kPdgP33m1232_DeltaM = 1114 |
Definition at line 190 of file common_convert.C.
const int kPdgP33m1232_DeltaP = 2214 |
Definition at line 192 of file common_convert.C.
const int kPdgP33m1232_DeltaPP = 2224 |
Definition at line 193 of file common_convert.C.
const int kPdgP33m1920_Delta0 = 22114 |
Definition at line 223 of file common_convert.C.
const int kPdgP33m1920_DeltaM = 21114 |
Definition at line 222 of file common_convert.C.
const int kPdgP33m1920_DeltaP = 22214 |
Definition at line 224 of file common_convert.C.
const int kPdgP33m1920_DeltaPP = 22224 |
Definition at line 225 of file common_convert.C.
const int kPdgPhi = 333 |
Definition at line 248 of file common_convert.C.
const int kPdgPi0 = 111 |
Definition at line 239 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgPiM = -211 |
Definition at line 238 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgPiP = 211 |
Definition at line 237 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgPositron = -11 |
Definition at line 138 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgProton = 2212 |
Definition at line 167 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgRho0 = 113 |
Definition at line 246 of file common_convert.C.
const int kPdgRhoM = -213 |
Definition at line 245 of file common_convert.C.
const int kPdgRhoP = 213 |
Definition at line 244 of file common_convert.C.
const int kPdgS11m1535_N0 = 22112 |
Definition at line 194 of file common_convert.C.
const int kPdgS11m1535_NP = 22212 |
Definition at line 195 of file common_convert.C.
const int kPdgS11m1650_N0 = 32112 |
Definition at line 198 of file common_convert.C.
const int kPdgS11m1650_NP = 32212 |
Definition at line 199 of file common_convert.C.
const int kPdgS31m1620_Delta0 = 1212 |
Definition at line 205 of file common_convert.C.
const int kPdgS31m1620_DeltaM = 1112 |
Definition at line 204 of file common_convert.C.
const int kPdgS31m1620_DeltaP = 2122 |
Definition at line 206 of file common_convert.C.
const int kPdgS31m1620_DeltaPP = 2222 |
Definition at line 207 of file common_convert.C.
const int kPdgSDDiquarkS0 = 3101 |
Definition at line 161 of file common_convert.C.
const int kPdgSDDiquarkS1 = 3103 |
Definition at line 162 of file common_convert.C.
const int kPdgSigma0 = 3212 |
Definition at line 174 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgSigma0c = 4112 |
Definition at line 186 of file common_convert.C.
const int kPdgSigmaM = 3112 |
Definition at line 175 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgSigmaP = 3222 |
Definition at line 173 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgSigmaPc = 4212 |
Definition at line 187 of file common_convert.C.
const int kPdgSigmaPPc = 4222 |
Definition at line 188 of file common_convert.C.
const int kPdgSQuark = 3 |
Definition at line 148 of file common_convert.C.
const int kPdgSSDiquarkS1 = 3303 |
Definition at line 165 of file common_convert.C.
const int kPdgString = 92 |
Definition at line 291 of file common_convert.C.
const int kPdgSUDiquarkS0 = 3201 |
Definition at line 163 of file common_convert.C.
const int kPdgSUDiquarkS1 = 3203 |
Definition at line 164 of file common_convert.C.
const int kPdgTau = 15 |
Definition at line 141 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgTgtC12 = 1000060120 |
Definition at line 276 of file common_convert.C.
const int kPdgTgtDeuterium = 1000010020 |
Definition at line 275 of file common_convert.C.
const int kPdgTgtFe56 = 1000260560 |
Definition at line 278 of file common_convert.C.
const int kPdgTgtFreeN = 1000000010 |
Definition at line 274 of file common_convert.C.
const int kPdgTgtFreeP = 1000010010 |
Definition at line 273 of file common_convert.C.
const int kPdgTgtO16 = 1000080160 |
Definition at line 277 of file common_convert.C.
const int kPdgTQuark = 6 |
Definition at line 154 of file common_convert.C.
const int kPdgUDDiquarkS0 = 2101 |
Definition at line 158 of file common_convert.C.
const int kPdgUDDiquarkS1 = 2103 |
Definition at line 159 of file common_convert.C.
const int kPdgUQuark = 2 |
Definition at line 144 of file common_convert.C.
const int kPdgUUDiquarkS1 = 2203 |
Definition at line 160 of file common_convert.C.
const int kPdgWM = -24 |
Definition at line 268 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgWP = 24 |
Definition at line 267 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgXi0 = 3322 |
Definition at line 179 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgXiM = 3312 |
Definition at line 180 of file common_convert.C.
Referenced by ConvertGeantToPdg().
const int kPdgY = 553 |
Definition at line 250 of file common_convert.C.
const int kPdgZ0 = 23 |
Definition at line 266 of file common_convert.C.
Referenced by ConvertGeantToPdg().
int myjob = 0 |
Definition at line 42 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), ConvertFinish(), copy_flugg_to_dk2nu(), copy_g4lbne_to_dk2nu(), copy_g4minerva_to_dk2nu(), and test_fill_dk2nu().
double obs_frac_diff_max = 0 |
Definition at line 46 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), and isCloseEnough().
int pots = 0 |
Definition at line 43 of file common_convert.C.
Referenced by convert_flugg(), convert_g4lbne(), convert_g4minerva(), ConvertFinish(), MergeGenCollections::MergeGenCollections::endSubRun(), getHists_FNEX(), gnumi2simple(), ana::PredictionCombinePeriods::LoadFrom(), make_simple_grid(), ana::ExposureSource::ReportExposures(), ana::PredictionCombinePeriods::SaveTo(), and wrong_sign_uncertainty().
TRandom3* rndm = 0 |
common code for use in the ntuple converter code
2012-11-07
functions for reading location text file and calculating energy and weight vectors for locations
Definition at line 36 of file common_convert.C.
Referenced by ConvertInit(), and test_fill_dk2nu().
TFile* treeFile = 0 |
Definition at line 39 of file common_convert.C.
Referenced by ConvertBookNtuple(), ConvertFinish(), and test_fill_dk2nu().