Browse Source

training of nn

main
cetin 9 months ago
parent
commit
c0c20a8af0
  1. 2
      .gitignore
  2. BIN
      data_results/PrCheckerBDefault.root
  3. 5
      main.py
  4. 2
      moore_options/get_ghost_data.py
  5. 28
      neural_net_training/result/matching.hpp
  6. 48
      neural_net_training/result_default_loose_preselection/matching.hpp
  7. 62
      neural_net_training/result_default_tight_phi_eta/matching.hpp
  8. 46
      neural_net_training/result_default_tight_preselection/matching.hpp
  9. 48
      neural_net_training/result_electrons_D/matching.hpp
  10. 61
      neural_net_training/result_electrons_D_eta_phi/matching.hpp
  11. 47
      neural_net_training/result_electrons_loose_preselection/matching.hpp
  12. 74
      neural_net_training/result_electrons_phi_eta_teta/matching.hpp
  13. 63
      neural_net_training/result_electrons_tight_absphi/matching.hpp
  14. 63
      neural_net_training/result_electrons_tight_absphi_eta/matching.hpp
  15. 64
      neural_net_training/result_electrons_tight_phi_eta/matching.hpp
  16. 48
      neural_net_training/result_electrons_tight_preselection/matching.hpp
  17. 22
      parameterisations/train_matching_ghost_mlps.py

2
.gitignore

@ -27,7 +27,7 @@ miniconda.sh
arc1_data arc1_data
arc2_data arc2_data
electron_training electron_training
neural_net_training
nn_neural_net_training
nn_electron_training nn_electron_training
nn_trackinglosses_training nn_trackinglosses_training
outputs_nn outputs_nn

BIN
data_results/PrCheckerBDefault.root

Binary file not shown.

5
main.py

@ -39,7 +39,6 @@ parser.add_argument(
"-p", "-p",
"--prepare", "--prepare",
action="store_true", action="store_true",
default=True,
help="Enables preparation of data for matching.", help="Enables preparation of data for matching.",
) )
parser.add_argument( parser.add_argument(
@ -134,8 +133,8 @@ if args.forward_weights:
if args.matching_weights: if args.matching_weights:
os.chdir(os.path.dirname(os.path.realpath(__file__))) os.chdir(os.path.dirname(os.path.realpath(__file__)))
train_matching_ghost_mlp( train_matching_ghost_mlp(
prepare_data=False,
input_file="data/ghost_data_B_electron_weights.root",
prepare_data=args.prepare,
input_file="data/ghost_data_D_default_phi_eta.root",
tree_name="PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput", tree_name="PrMatchNN_3e224c41.PrMCDebugMatchToolNN/MVAInputAndOutput",
outdir="neural_net_training", outdir="neural_net_training",
exclude_electrons=False, exclude_electrons=False,

2
moore_options/get_ghost_data.py

@ -34,7 +34,7 @@ import glob
options.evt_max = -1 options.evt_max = -1
decay = "D" # D, B decay = "D" # D, B
options.ntuple_file = f"data/ghost_data_{decay}_electron_weights.root"
options.ntuple_file = f"data/ghost_data_{decay}_default_phi_eta.root"
options.input_type = "ROOT" options.input_type = "ROOT"
if decay == "B": if decay == "B":

28
neural_net_training/result/matching.hpp

@ -0,0 +1,28 @@
const auto fMin = std::array<simd::float_v, 8>{
{1.4334048501e-05, 1.63528045505e-06, 9.53674316406e-06, 3.0517578125e-05,
7.06594437361e-06, 1.16415321827e-09, -3.14159274101, 1.99012887478}};
const auto fMax = std::array<simd::float_v, 8>{
{14.9999303818, 0.150984346867, 249.944519043, 249.72227478, 1.2982006073,
0.14879232645, 3.14159274101, 5.00999403}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 9>, 10>{
{{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan},
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 11>, 8>{
{{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan},
{nan, nan, nan, nan, nan, nan, nan, nan, nan, nan, nan}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 9>{
{-nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan, -nan}};

48
neural_net_training/result_default_loose_preselection/matching.hpp

@ -0,0 +1,48 @@
const auto fMin = std::array<simd::float_v, 6>{
{1.2330087884e-05, 1.14277577268e-06, 0, 1.52587890625e-05,
9.76510345936e-05, 1.86264514923e-08}};
const auto fMax = std::array<simd::float_v, 6>{{29.999835968, 0.350415378809,
471.196533203, 499.813354492,
1.32896196842, 0.149163752794}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
{{-13.2136907232623, 7.16177343899553, -4.90659504186975, -1.40443876775166,
4.3555078488658, -3.43148224596641, -10.9264313855685},
{1.29488055242371, -8.97443331582755, 16.6842228291074, 6.71714620564152,
-3.74921481624604, 3.35817187582319, 15.4805735245565},
{0.420234624019091, -0.797000171120974, 10.1078755336062, 2.75680497160205,
-1.16657672848107, 2.14284752816565, 12.1456511379307},
{0.924095274474661, -26.511107478337, 9.17266710806768, -12.3137720216878,
1.57191747866999, 1.71426879790465, -25.4127067575223},
{-9.95998623094559, 3.38073809492709, -3.78323012348946, -1.54980570081529,
-1.85461791801922, -3.17214447925877, -15.4436853326759},
{-0.19322468230349, 5.30330590069981, 5.22833309437088, 0.627972909602714,
3.35747695330438, -4.47410334288559, 6.69575279978489},
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
0.681870030239224, -1.20759406685829, 0.769290467724204,
-1.8437808630988},
{-0.863597793900329, 4.25170672362734, 1.61114046377427,
-0.0494448939621707, -0.92588090335991, 0.0192735198561061,
2.75313753641611}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
{{-0.699155830564526, 0.27709320040335, -2.67228791707517, 1.79072057682953,
0.920945069028383, -0.34284929222179, 1.63438201788813, -1.32534600170999,
-0.548741839872972},
{-0.306068917617618, 1.3282980335412, -1.7928623424311, 0.631706031998356,
0.256924684384627, 0.0979204938626737, -1.61531096417457,
-1.3655060324371, 0.101336632353504},
{0.025726751432203, 0.182085291984978, -2.53948269914116,
-2.28881959534576, -0.571193899062842, -1.73118352619951,
-0.825543426908553, -2.02887334163012, -1.10945967580766},
{1.18488818791299, 0.313257572760128, -0.771272462255355,
-1.21375652398181, 0.637319263430119, -1.85833062849762, 1.61348068527877,
-1.61807729046488, -3.01576814681881},
{-0.890587888792212, -0.702067411700082, 1.00218119898999,
-0.786784547125751, -1.57074424198514, 1.24341502361426,
-0.848898627795279, -4.39534637009387, -0.318217431605746},
{0.681712218579357, -1.08096002297545, 1.60595857620362, -2.5415420090873,
1.93143971529045, -1.63027819222944, -1.52203810494393, 0.567879972252515,
1.34128986360153}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
{-0.424571481473764, -0.76142775459985, 0.344744981750389,
-0.678966885535158, -0.614932796051215, 1.06571002378454,
0.264280453247581}};

62
neural_net_training/result_default_tight_phi_eta/matching.hpp

@ -0,0 +1,62 @@
const auto fMin = std::array<simd::float_v, 7>{
{1.71099384261e-06, 1.14440917969e-05, 3.0517578125e-05, 6.79027289152e-05,
3.72529029846e-09, -3.14149880409, 1.90005290508}};
const auto fMax = std::array<simd::float_v, 7>{
{14.9999799728, 249.84552002, 249.773071289, 1.31235301495, 0.138549163938,
3.14159274101, 5.09986066818}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
{{-4.18424419845613, -12.4192061243283, -1.41322037470253, 1.73514230671811,
1.78456132400915, -0.0284964949823479, -1.53706713647359,
-11.3834431056086},
{1.94477607707594, -4.01227689722181, -0.371386722089328,
-3.71442118974182, 6.61690342263265, -0.0289978252864998,
-1.97078131456442, 1.77385518252442},
{1.03685146382329, 9.65470988588569, 1.00764792357888, -3.45997548499298,
0.228958230998389, -0.00726458265541188, 2.1042699679973,
8.93212709800203},
{-1.27938434306995, -13.3249411083299, 3.97726812070638, 3.48047554798379,
-0.914314485263975, -0.0163901142589541, 2.90689869117511,
-8.33314354229149},
{0.555598463936979, -3.1899149445921, -9.78504346418047, 3.55665144171685,
5.67032842387486, -0.000640696898465759, 0.240787688560384,
-3.47535808408129},
{-17.0265258957369, -0.800289753323074, -0.248296125186961,
-0.769466547319419, -4.33846595000546, 0.0249677773353691,
-1.1156270220429, -21.3239355986205},
{-0.0232147246588048, 3.15813466426365, -2.31740593048596,
2.57137997410373, -1.32651784207945, 0.0271664496692986,
-3.96711912665195, 0.424574728246325},
{0.393560288135839, -0.921199544113062, 1.7500786074714,
-0.838283179489772, 1.52039762635099, -6.73514977294235,
-0.640381337883352, -4.41268975219875},
{-0.938979488338217, 4.35777229714997, -0.699125591265619,
-0.105809997240887, -0.739100326026411, -0.0315797716816488,
-2.5122451839992, -0.235959593984004}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
{{-0.261040050177983, 0.486143780804901, 0.252051052175672,
-1.18995708465198, 0.89055809474221, -1.70927858575469, -1.89179125187008,
-0.653570466516257, -0.950450696005194, 3.55338280458285},
{0.45110406611478, 0.466717033594769, -0.835233711395806,
-0.19309884675555, 0.678341729953213, -0.779046758439749,
0.945844689355598, 0.418277818705828, -0.687823655656907,
-1.26855702545438},
{0.186038174270022, 0.775905183407563, -0.993545492755867,
1.13048626945173, 0.485543571878958, -0.0978447310890272,
-0.448335111680229, 0.485860161186557, 0.842036680385835,
-0.950253533003952},
{-1.38242635697565, 0.997854178475016, -0.471484459943151,
-0.698963719937461, 1.22969959184582, -1.8264143897544, -1.33941470325204,
-0.95772850434674, -2.34168282581711, -0.521814569505376},
{0.189506470603265, -1.21309515671232, -0.661087021636272,
-1.07045369461372, 0.325459663648017, -1.89599951544615,
-1.45693495849258, -1.25175575060095, 0.648032794660786, 2.9295711484467},
{-0.556281407795047, -1.35469567631903, 0.673395803244993,
-0.0926998210025074, 0.349209492478129, -0.794130473474385,
1.7813897211106, 2.35656455154566, -2.65908361493115, 0.363183601973262},
{1.03644831240189, -0.184800638276232, 0.0760700678944075,
0.592188273061358, -1.58108215301721, 1.56030619758474, -1.78217526562787,
-2.26736080526125, 0.28124705293164, -1.11240182653559}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
{-0.92273651128734, 0.703412371986641, -0.58682876325943, 0.393671161578984,
0.644114437819646, -0.720526680356417, 0.703229521399748,
1.92647380289835}};

46
neural_net_training/result_default_tight_preselection/matching.hpp

@ -0,0 +1,46 @@
const auto fMin = std::array<simd::float_v, 6>{
{5.13978602612e-06, 1.21001266962e-06, 4.57763671875e-05, 1.52587890625e-05,
2.35475599766e-05, 9.31322574615e-10}};
const auto fMax = std::array<simd::float_v, 6>{{14.9998340607, 0.341120511293,
249.85144043, 249.654418945,
1.28548693657, 0.148729145527}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
{{-3.59507134278867, 4.44126726754447, -5.39129122445807, -1.36145810331529,
3.45807944450432, -3.62963116336421, -4.76757165032208},
{0.00730809941484838, 12.1453993220489, 2.13238151012009,
-1.07193185705376, 1.01495516009388, 0.675773203755866, 14.5690446401099},
{0.74939730911321, -11.7987743358516, 17.2771453073228, 5.37607761448036,
-5.19543030874781, 0.745951779199187, 7.24675189876196},
{0.212425885693112, -30.1006750951061, 3.69908071847949, -7.58653388603974,
3.54229591266875, 4.5299185451693, -25.8190052197695},
{-12.7976367570783, 0.54423710671167, -1.05109638894657, 0.466387803049121,
-0.472928668238963, -3.40509315864411, -15.5434994540645},
{-0.598238271329329, 9.44679909613754, 4.52488059715358, -1.82253115221556,
4.48983855698619, -7.10328381782273, 5.57446461378229},
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
0.681870030239224, -1.20759406685829, 0.769290467724204,
-1.8437808630988},
{0.212882649189437, 4.84541802224511, -1.59141652350701, 0.137586963444654,
0.990271187848363, -0.244341013451349, 2.91171876264984}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
{{0.00389644240262298, -4.55698048859494, 0.219253812628637,
1.84871289342101, 0.431075248187761, -0.0591036222763046,
1.63438201788813, -3.75794030855487, -0.501979705923424},
{0.732763191833765, 1.07563903780358, -0.49481630429249, -0.23592165551296,
1.21429274982697, -0.847376289518716, -1.61531096417457,
-2.02639526813625, 1.75365741778183},
{0.55480953787371, -1.34763912029571, -1.18287931774105, -1.27366432648146,
1.22182097607433, -2.34417562895264, -0.825543426908553,
-0.356652889603628, 2.17198871290324},
{0.123941344788369, -0.373149230378266, -1.43068662525847,
-1.86275854214368, -0.838655280118823, -1.69085125560313,
1.61348068527877, -1.66550797875971, -0.967759843137966},
{-0.378493319151618, -0.952758303240969, 0.493592897083996,
0.915130842839079, -0.912852225845138, -0.504563583441966,
-0.848898627795279, 0.778732986751546, -0.808574895578719},
{-0.434490443617743, -1.68383028714987, -0.545709480825531,
-0.11424395667229, 0.00696279758727167, -0.608566694015555,
-1.52203810494393, 1.15233449144665, -0.792422297954841}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
{-1.14398227016536, 0.906917992751678, 0.840251146712371, 0.154975293170372,
-0.362358729103685, 1.22645848751857, -2.82791102236012}};

48
neural_net_training/result_electrons_D/matching.hpp

@ -0,0 +1,48 @@
const auto fMin = std::array<simd::float_v, 6>{
{1.4334048501e-05, 1.63528045505e-06, 9.53674316406e-06, 3.0517578125e-05,
7.06594437361e-06, 1.16415321827e-09}};
const auto fMax =
std::array<simd::float_v, 6>{{14.9999303818, 0.150984346867, 249.944519043,
249.72227478, 1.2982006073, 0.14879232645}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
{{-0.467009392443679, 3.13038478068159, 7.69074482195567, 19.4740399882829,
-12.4226124427254, -17.8377969080852, 0.324599910589164},
{0.409517663494154, -4.80717970008151, 7.39765986277672, 2.94291582266624,
-6.63674641556525, 14.5190335903859, 16.7183741770646},
{-1.1979267210966, 3.6445915667578, 0.146080609432624, 4.45219969251689,
-0.0841213041055908, 2.9617556137416, 7.8401740287792},
{1.17396583313892, -3.20374577742852, 3.53092294628749, -3.74950467361221,
-1.23345027639013, 8.36990985313349, 3.25979213328609},
{-4.00743769404869, -0.162350205755865, -13.6138131925815,
1.61570915988503, -2.07726361395964, -8.76589498728215,
-24.3243834851991},
{1.03931152369819, 2.06238587887749, 2.39383581231119, -1.28071940195598,
2.6359345348319, -8.53979185789067, -2.81437513237195},
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
0.681870030239224, -1.20759406685829, 0.769290467724204,
-1.8437808630988},
{1.23437152721431, 0.969867183299634, 0.489357752958563, 1.15557578730553,
0.375753930932818, 0.235772722180657, -1.93050331453235}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
{{-0.362984222655222, 0.0575415955867324, 1.81392234379813,
-1.43355707971832, -1.41410184245097, 1.24640985827233, 1.63438201788813,
-1.4104150048593, -1.38296879948788},
{-1.47307081661686, -0.433784117324807, 0.712469849514256,
0.141714938633336, 1.21002241594085, -1.51348568906894, -1.61531096417457,
0.0967363894593757, 1.95362088322887},
{1.40135993785718, 1.30774549452044, -2.539720675103, -0.983997921183448,
-0.445450459320042, 0.0266683318537168, -0.825543426908553,
-1.61051519922959, -1.57509382514065},
{1.30276531089237, -1.16242552734625, -3.12605763697036, -1.73297773012808,
-0.398400221663194, -0.132175182099031, 1.61348068527877,
-1.66550840168782, 1.46526675182052},
{-2.48572847167941, -1.09713494799696, 0.752331872799834, 1.15795999924382,
0.2461886540518, -0.878810683484985, -0.848898627795279,
0.925022060859081, 0.652563065038129},
{-0.0844554950529646, -1.48593949873299, 0.536229220758805,
0.345759115253286, -0.0709252677119196, -0.848029969991824,
-1.52203810494393, 1.52719221155096, -0.669504464600642}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
{-0.45016769768098, 0.751691649834118, -0.690008423258335,
0.519377093523785, -0.770441408980362, 1.21569665457313,
0.707344099705116}};

61
neural_net_training/result_electrons_D_eta_phi/matching.hpp

@ -0,0 +1,61 @@
const auto fMin = std::array<simd::float_v, 7>{
{1.4334048501e-05, 9.53674316406e-06, 3.0517578125e-05, 7.06594437361e-06,
1.16415321827e-09, -3.14159274101, 1.99012887478}};
const auto fMax = std::array<simd::float_v, 7>{
{14.9999303818, 249.944519043, 249.72227478, 1.2982006073, 0.14879232645,
3.14159274101, 5.00999403}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
{{-1.82465715913151, -10.2010171305812, -1.42093303951018,
0.919834015699839, -10.4150485838699, -0.0281549918318784,
-1.26200494008436, -19.9271720086567},
{-0.138742771637974, 10.5524338663868, 17.2690022883939, -12.3694105842677,
-11.9962987191379, -0.00577463403550591, 0.256605643306599,
5.16477485472814},
{-0.400125433080883, 5.53741314222854, 2.40312049388245, 1.52670836350648,
-3.74723079510049, 0.051276473645892, -3.04300589445482,
3.63413164466275},
{-0.189577231453644, -4.9415891327547, -1.74763132369993, 3.46892624478931,
-9.32991487575013, 0.0192546409442281, 1.0080622069658,
-10.9508760193221},
{0.539885601389771, 0.325994106119317, -1.67054779976588, 1.68623986436261,
-4.94974553031535, 0.0995106694167389, 2.37165604358826,
-5.40856440364541},
{-7.91544378116589, -8.57316082216659, 3.35136376350019, -3.0081998283886,
-6.65805966253578, -0.0243102509451739, 0.201701135662891,
-21.1737906056183},
{-1.05670319988875, -1.74446848072314, -0.977413017492524,
5.29794405132029, -2.44962419232973, -0.0482796438098403,
-4.11029493841502, -3.77501192892063},
{-0.114045919062656, -1.20130806684124, 3.16917343736805, 1.62066811060675,
-0.255275229731553, -7.26761443601754, -0.190908858021804,
-4.59712668344001},
{-1.41628728362779, 1.72199790327582, 1.5149999807157, -0.367955591451631,
-0.536948920276223, 1.07861510817241, -0.10780460025341,
-1.68515030182914}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
{{-0.17038395137592, 0.150181306405632, 1.6970957692913, 0.424950168755722,
0.418870023443624, -1.15505562321787, -0.500194277360204,
-0.433852585222747, -1.76125902413437, -1.30261758267868},
{-0.603613992089428, 0.214516633799749, -0.890409961786709,
-1.59704373515464, -0.0365449502710916, -0.31000388788415,
-1.66193022622544, -0.82541373627284, 1.06154510924169, 5.38145139969019},
{0.660787963616718, 2.4326549648495, -5.53011847407809, 2.19689305438139,
-0.767606842437728, -0.717942244184889, 1.32364564166278,
-1.27925450853779, 0.145022871464287, -8.75086124773929},
{0.388479405277008, 0.23655750997468, -0.246198621798783, -1.4080658778939,
1.70153464126939, -1.9870460811342, -1.82881874955337, 0.466125579974337,
-1.81862165592595, 0.0958972887717788},
{-2.3967381746343, 0.113270326428459, -0.14597746875961, -5.64422583639151,
-1.49058176034265, -0.217630446255199, 0.0646952664095084,
-0.588013585620472, 0.654603773596659, 1.29533222706315},
{-0.316760094706451, 0.083508326803881, -0.733843278556448,
-0.84394690256587, 1.16808849706493, 0.0930707017501082,
-0.577858485108157, 2.52941056827953, -1.43817544061762,
2.41948216005251},
{1.3436182203528, -0.661287974165493, -3.92748421553817, 0.500830701733313,
-0.0124097727863072, 1.44848571471865, 0.933335709275418,
-1.5293565439073, 0.0414860544356661, -2.81570886473419}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
{-0.561549883690818, -0.750809433710926, -0.663766324782396,
0.638060812812135, -0.517353021569073, -0.571930675833526,
0.560230593314939, 1.96110968951904}};

47
neural_net_training/result_electrons_loose_preselection/matching.hpp

@ -0,0 +1,47 @@
const auto fMin = std::array<simd::float_v, 6>{
{2.32376150961e-05, 1.25644373838e-06, 4.38690185547e-05, 1.90734863281e-06,
4.71249222755e-07, 3.16649675369e-08}};
const auto fMax = std::array<simd::float_v, 6>{{29.9998512268, 0.368200153112,
489.191040039, 498.304443359,
1.34504961967, 0.149330914021}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
{{-0.091951637525973, -6.93346987709903, 5.48848552856238, 19.5840311658558,
-7.36361108514447, -13.1757707275385, -1.86200889006216},
{0.655516759273221, -12.8630535300664, 16.0085502999955, 8.27229987939837,
-4.88507243398217, 11.9066297693309, 19.9634120764891},
{-0.91068716917935, 4.65690020223811, 3.49834183391567, 1.0611121921812,
2.5805168659915, 2.07853056390383, 10.2452574943481},
{3.05067318319739, -4.05548629577051, 1.84986442888556, -12.5475679512519,
0.44913034549931, -2.43260989687924, -13.4655207460294},
{-15.5043559456667, 5.69511263853998, -6.21955870103976, 0.352527471796584,
-1.78859423888245, -5.35993216119686, -20.8585464706034},
{-1.15591620816008, 8.32354137820574, 4.11620895717867, 2.12840590309323,
3.62768906209725, -3.81512479352066, 9.69863968988765},
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
0.681870030239224, -1.20759406685829, 0.769290467724204,
-1.8437808630988},
{1.7537624447672, 0.849924533877327, 0.445725632965271, 1.43754667616149,
0.828858464676059, 0.0104531969028869, -1.41061668641753}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
{{-1.67235097040123, 1.00513756776317, -2.92631487875512, -1.6038974765405,
-1.47288012266996, 2.70953672363598, 1.63438201788813, -1.42549390383994,
-0.543445952044864},
{-0.532691413776942, -0.580234674879184, 1.31478936946123,
-0.539672959325038, 0.138709555867666, -1.26578825688072,
-1.61531096417457, 0.0978404638976393, 2.77104692513204},
{4.28298138842154, 0.58608197013747, -1.77392582052533, -0.273645873484308,
-0.879428799028896, -0.137882560967726, -0.825543426908553,
-1.82572532002039, -0.529218019273749},
{1.8104405264028, 0.509636266869985, -2.67129956204263, -1.64014328771681,
-1.64641493283524, 1.19208652458466, 1.61348068527877, -1.68315031684302,
-1.74464421914292},
{-1.77348714639146, -0.626224486222319, 1.95830353256012, 0.40323457332636,
-0.837734704701505, -1.23466417916396, -0.848898627795279,
0.795980021309838, -2.10795903634289},
{0.785946766333194, -1.00518153582256, -1.24582824599048,
-1.34792657343402, 1.16296759700032, 0.207590308743009, -1.52203810494393,
1.60904858276205, 1.1231659288384}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
{-0.447860492158434, 0.901478241245483, -0.611589204105589,
0.941708659474118, -0.569567453555716, 1.04362285338971,
-1.04481061413156}};

74
neural_net_training/result_electrons_phi_eta_teta/matching.hpp

@ -0,0 +1,74 @@
const auto fMin = std::array<simd::float_v, 8>{
{2.32376150961e-05, 1.74778142537e-06, 3.0517578125e-05, 0.0001220703125,
2.65464186668e-05, 1.18743628263e-08, -3.14159274101, 2.00003242493}};
const auto fMax = std::array<simd::float_v, 8>{
{14.9997320175, 0.141672685742, 249.794219971, 249.185577393, 1.29696559906,
0.146845698357, 3.14159274101, 4.99999666214}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 9>, 10>{
{{0.295181543137343, 2.6420038040006, -9.67820414782616, -4.23623102238651,
5.00705830309854, -4.01124954289022, 0.00857341827046613,
-0.576151873921028, -8.11248281810843},
{-0.512180904585767, 3.51827933805129, 2.42238862812428, 0.838731881815807,
4.30731005461527, -0.295753081904998, 0.0370970838173889,
-1.65693600282558, 5.40841125085328},
{-0.476988913770149, -1.27890746500175, 8.56020244838285, 21.5628832153788,
-10.8495244013616, -7.89541462641814, -0.0193794505012618,
-0.303310325356957, 11.3256511704605},
{0.582728010127127, 7.18987808497679, -7.39737337785087, -0.75574101675804,
4.56110100978343, -2.94822657236073, 0.0261103340762415, 2.61116476935959,
-1.4568790286594},
{-1.43403953178773, -3.90365933757895, -13.8514934091584,
-1.77235775169013, -0.529871370313142, -7.68527706007013,
-0.00276626882890731, -0.465840016929989, -25.7660025952232},
{-11.655698767452, 7.17014049404882, -3.19271291719592, 3.37230468561323,
-10.4093254773443, 0.44771179470817, -0.131495652978628,
-0.800064635422711, -12.2730317377791},
{-0.594971658754502, -0.221774377822626, 4.75300419541858,
-0.530823749132235, 1.51600824694845, -4.52772170540803,
-0.00643426170876921, -2.18143307721965, 0.202391837041924},
{-0.440278616221611, -0.245963449620274, 3.15759861192785,
8.96301467786118, -2.09424873648802, -3.58776930329031,
0.0365164544479827, -0.0528690383662167, 4.89741586992701},
{0.238230009153502, -7.92097938919979, 0.845973956446886,
0.774744203952484, -2.19069617310293, 14.6392837080257,
-0.0147396839619376, -0.903620913896898, 7.23553346153025},
{-0.899364229180718, 1.40912613195513, 0.14166439353052, 1.29756800096878,
1.54622175952809, 0.718402231749967, -0.952829211416926,
0.366690588564447, -1.56987545944051}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 11>, 8>{
{{0.377218157070339, -1.36851829319414, -0.0255536122700866,
-0.796554268311274, 1.7295433280218, 1.23110088243058, 0.526878483259133,
0.261650200962869, -0.219637752187213, 0.494688824750483,
-3.3052438158225},
{-0.944288389161862, -0.298570220064341, -0.130445461381501,
1.4356024197125, -0.248662678840177, -3.81449203623528, 1.01981848400842,
0.556620612317623, 0.139049496296531, 0.654376816230576,
2.34372701174525},
{-4.86516480996763, -0.51618835923917, 0.490784586290075,
-1.09941480811542, -2.51167888321981, 0.557197816460786,
0.0538744752019429, 0.560387333325146, 0.123745996274959,
1.03063435474215, 0.393414075611267},
{-1.83019794210885, -1.68991182172873, -0.190849465863858,
-0.152867977417945, -1.08511688313258, -1.68901518636423,
-2.3636190783474, -0.340100440632336, -1.15831376948965,
-0.584243632853031, 2.81568736369002},
{-1.45969790184471, 0.0579413374982332, -2.00168919715931,
-0.366644144938965, -0.903130830337244, -0.722656831609052,
-1.57179109154109, -1.33858322445303, -0.141859158088594,
-0.604406645521522, -0.338093803777526},
{0.655178055137048, -0.440457640433061, -0.810070449177854,
0.073462804948251, 0.628624533718191, -1.5488729720956, 0.330453701040673,
2.36158028550233, -0.726451079227918, 1.06309875802739,
-3.86058192393894},
{0.00904540705320238, 0.116620450803267, 2.87248832926274,
0.575410883938485, 0.511090108141078, -0.17961887631223,
-2.13834265144765, -5.75354739491164, -4.06070648762533,
-0.920266687425846, -3.76309268372617},
{-0.657414373703338, -3.48182793369621, 0.305908846680114,
-0.39752577353779, -0.657548122346533, -0.306140274214076,
-1.13480377857786, -0.122214123750662, 1.00646226721791,
-0.573145033171245, 3.16728780813219}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 9>{
{0.559403044334073, -0.69559330578478, -0.205103250457036,
0.342095561101052, 1.07495093579365, -0.63306449797483, -0.778049830922131,
-0.69115258958376, 2.05404431493187}};

63
neural_net_training/result_electrons_tight_absphi/matching.hpp

@ -0,0 +1,63 @@
const auto fMin = std::array<simd::float_v, 7>{
{2.32376150961e-05, 3.0517578125e-05, 0.0001220703125, 3.88426706195e-05,
2.23517417908e-08, 0, 2.00006699562}};
const auto fMax = std::array<simd::float_v, 7>{
{14.9999017715, 249.897644043, 249.899658203, 1.29755973816, 0.148018673062,
3.14159274101, 4.99999856949}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
{{-0.671714627310239, -9.32336659508747, -4.41839581941394,
1.55855474838822, -9.7241032272164, 0.0306360664695698,
-0.595153565102944, -19.2589678582652},
{-0.531069582426663, 6.86739161324985, 16.4093951236624, -8.49165041056743,
-0.804852020960401, 0.153476926664198, 0.529385126789012,
13.6359644316319},
{-0.717546398136699, 4.4249809958607, 2.94803233025911, 2.1936990153831,
-4.31763499682017, 0.0371344352904277, -4.25091599134186,
0.488215868002033},
{-0.471250946616244, -6.17765452180064, -0.642875884912715,
4.95227988505658, -5.89364932889722, -0.00204723631263602,
-0.0939689061528296, -7.52292966982397},
{-0.0369055093663708, -0.289296557898614, 4.08312809980045,
1.84155453309604, -0.834048778147863, 2.50853254259567, 2.93773182323815,
1.67691895347038},
{-11.9694962544742, -6.22159033853731, 2.87048314026771, -3.76271766555389,
-2.69925559234914, 0.10952181471081, -0.306508574372787,
-19.9629504177843},
{-0.773770781267168, -2.82281961252368, 2.89108994595496,
-0.447278666207576, 2.13660099425865, 0.0598669555229345,
-5.97250771648216, -1.22086510231289},
{-0.363225136742187, -0.54136442442423, 4.97281654396114, 2.52226234164625,
-1.16112815781773, -3.24718852411858, 3.17801065231417,
0.936532276246438},
{-1.3967973177281, 1.7278401340848, 1.5357408216805, -0.35634716233731,
-0.518707888631828, 1.06126476769888, -0.0874915582310091,
-1.70828621688735}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
{{-0.391382428722935, -0.0663909530063533, 0.732758877631156,
-1.04447375582168, -0.569946210141964, -1.01881067975001,
-1.11513181799253, -0.507249889310829, -1.7712837447488,
3.83802329525711},
{0.627708096569698, 1.75522562653547, -4.4973586264804, -0.354877126164471,
-0.479241401543222, -0.583166046244812, 0.308356247253724,
-0.0618970113528529, 1.06333519221016, -1.29881110126361},
{1.69171969314137, -0.792058697154183, 0.45928641965229, 0.395923714584166,
0.0614659496596701, -1.39327924643817, 2.39198291047471,
-0.00869703428682855, 0.144862709722049, -5.74949221526789},
{-1.83136485540605, 1.72620781014183, -2.73787334352624, 1.39162887269774,
-1.02121610638074, -1.82791408989998, -0.612383938180649,
-0.916730733621054, -1.81865194656278, -3.25125146756466},
{-3.48580892738306, -0.175913043946308, -3.4949266815232,
-3.21987026214044, -2.37189187285153, -0.0968270140842057,
0.349363470018193, -2.01136130931921, 0.649339538892568,
1.38350010367642},
{-0.664261771114226, 0.726390189935223, -0.261956323136039,
-0.062718287896092, 1.00219730661601, 0.212287403242958,
-0.417337583766393, 1.0083998590149, -1.43898215976913,
0.827038099247328},
{2.00472230684538, -0.262141950771844, -0.316215568945394,
-0.457722762101942, -0.307671127614068, 0.61450968747354, 1.8381534446688,
-0.256667584500404, 0.0504320780803455, -2.85056831193397}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
{-0.768920724005148, -0.616975712001002, -0.592523657848261,
0.513099806807038, -0.768087686685332, -0.586054188824555,
0.683203979645521, 1.71489957369144}};

63
neural_net_training/result_electrons_tight_absphi_eta/matching.hpp

@ -0,0 +1,63 @@
const auto fMin = std::array<simd::float_v, 7>{
{2.32376150961e-05, 3.0517578125e-05, 0.00018310546875, 3.6396086216e-06,
1.76951289177e-08, 0, 1.90011811256}};
const auto fMax = std::array<simd::float_v, 7>{
{14.999830246, 249.825927734, 249.61138916, 1.29696559906, 0.149013325572,
3.14159274101, 5.09999227524}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
{{-0.846237746821496, -8.03843643532466, -3.00432818804268,
2.98362495153385, -8.30204037988624, -0.306326574654319, -2.5393244598679,
-12.9788166834249},
{-0.137032759920506, 7.41795757526836, 15.8691090940696, -12.0222660522419,
-1.26661989268768, -0.0471996453231026, 1.14044076185853,
10.0347389534087},
{-0.925404970993283, 3.91650473636148, 3.09872506164669, 3.07789907803461,
-5.89234371462099, 1.52697046878079, -2.41407448696455,
-0.52224103683963},
{0.525272669091143, -4.04036374422307, -3.63337846041632, 2.27518657840755,
-6.46815610170354, 0.105553386369743, 2.25675737076259,
-10.5864884774961},
{-0.712646078497308, -2.68155073885599, -0.63572676658644,
5.10857426235987, -4.58003514917929, -0.0139750813471162,
-1.50714566215816, -4.60717289916693},
{-8.51258300909997, -7.62444591413909, 1.20604253615868, -4.03703206441986,
-5.02901248764187, 0.0439553892392352, -0.134662730800406,
-21.4669837687862},
{-1.6997492195841, -0.54872602522421, 2.54594497136952, -0.270284425752145,
2.48803061545206, -0.240302974062072, -6.99199493959554,
-1.1600150379324},
{-0.35119903768516, -0.851010594055587, 2.49159394381305, 1.00592214377671,
-2.36013715652477, -3.96458625099317, -1.43246556719023,
-1.88906302802016},
{-1.41225035379307, 2.37091033887464, -0.53666708238452, 2.54623416884663,
0.500827252487499, 4.23305012223325, -0.176692711730615,
-2.78518952547645}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
{{-0.41855478347049, -0.208817828796731, 1.7716804600371,
-0.162153629253091, -0.704352403989385, -0.528957707377741,
-0.499141719348793, 0.859582735866302, -1.93294528330331,
3.06601088582947},
{-0.278272312566739, 1.06080049843089, -1.91424263771985, -1.4137661012997,
-1.25873165761699, -0.594370968945728, -1.51906009498781,
-0.374173621561471, 3.32641194302569, 4.29770565352321},
{-0.595978269228775, 1.00762386451696, -0.568276835286499, 1.3036795784,
0.853736498642311, -0.275539320806295, -2.13031494412905,
0.234026156134608, 1.03548830591165, -1.7253435996969},
{-1.07823546364454, -0.57414048842454, -2.36916670349986,
-0.789470519910404, 0.464625858097586, -1.80781082935096,
-0.348603275927619, -0.880953830416494, -1.75475001987691,
-0.663545013156836},
{-3.19650723751929, -0.158490246407849, 0.314067402555725,
-3.21582579345046, -0.181730644728971, -0.356221732374814,
0.399976792393633, 0.109338847378105, -0.602816917480111,
-0.13714412324491},
{-4.18367548264319, -1.02083234598983, -0.0703106364932762,
0.094072115695333, 0.0856152591584258, 0.1610107679122, -1.52627613168309,
-0.335584243838114, -0.303991294567878, 0.379939429115225},
{1.47455357123918, -0.866359170433226, -1.0615151059362, 0.114752686188043,
-1.73593206680509, 1.0000777059867, -0.325328900490266,
-0.0403527302222707, 0.0683224867974633, -2.80672566119746}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
{-0.612554243802521, -0.713038593311246, -0.481921446543178,
-0.184293838350977, -0.64531936417294, -0.501660149142157,
0.549782280888606, 1.83677089003801}};

64
neural_net_training/result_electrons_tight_phi_eta/matching.hpp

@ -0,0 +1,64 @@
const auto fMin = std::array<simd::float_v, 7>{
{2.32376150961e-05, 3.0517578125e-05, 0.00018310546875, 3.6396086216e-06,
1.76951289177e-08, -3.14159274101, 1.90011811256}};
const auto fMax = std::array<simd::float_v, 7>{
{14.999830246, 249.825927734, 249.61138916, 1.29696559906, 0.149013325572,
3.14159274101, 5.09999227524}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 8>, 9>{
{{0.442870516666807, -9.3047055696128, -3.01750420434556, 3.86628230578396,
-5.72432732897136, -0.0752609494950632, -1.67665079457158,
-10.7688849569757},
{-0.515799665733207, 5.7638934139085, 15.5881631094174, -9.90535333362731,
-5.02481655107484, 0.054497110352875, 0.928167098340353,
6.43629773634487},
{0.00603844252873313, 5.38885963615071, 7.34549979493078,
-3.12450040535732, -4.06592689435807, -0.145234575840507,
-1.47915016621128, 6.72714083561282},
{-0.322832878216595, 0.143214142212368, 0.362908157624904,
3.65860269285997, -10.0039735915951, 0.0199213344679254,
0.161471330948321, -5.67240816070424},
{0.0748124006664613, -0.654588048979364, 2.84194621986357,
-0.342792348843439, 0.378104312196163, 5.10709021736812, 0.71760193857599,
-2.14617028157952},
{-2.57265451779458, -10.7506862430442, -2.01268569560926,
-1.53415407815617, -7.97550844297617, -0.00385767117267526,
-0.390937943944926, -21.09168937771},
{-0.133143907167837, -3.03629080057939, 2.90888779017732, 1.74054202752173,
-0.757877737395336, -0.217890167597106, -7.79535053449244,
-2.4020691301751},
{0.133535929984892, -5.10405130756594, 4.1387927794926, 2.84850529649747,
2.00181830812858, -0.244574980347909, 3.37191107146915,
0.840717619473734},
{-1.35523448748177, 1.69668210818627, 1.54027945569274, -0.43424261231706,
-0.445502202335542, 0.963613138347562, -0.00256770883661197,
-1.80295124991042}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 10>, 7>{
{{-0.435483984067043, 0.8921147462395, 0.445166037069901, -1.2718835930042,
-0.424535287292852, -0.447675845965078, -1.49275340777608,
0.444387914103506, -1.75406593239073, 5.20436860527393},
{-0.215262398231123, -0.323748109655342, 0.243580373838591,
-1.57567240565874, -0.016151451389352, 3.02833651901909, 1.12403561936612,
-1.95152162032173, 1.05883058232419, -4.57724999652069},
{2.13771324207488, 0.719994856936999, -1.26239818511462, -1.71496819215905,
-0.0375283585241854, -0.288724808809512, -2.45581109694503,
0.575657666649783, 0.14732585999812, -3.18317421821689},
{-0.46718944597543, -0.496806076059947, -1.45208836758531,
-0.50495802543007, 2.19415489535187, -1.75513777424791,
-0.986265642891505, -0.0512818343546498, -1.81861709989607,
-0.170030928955202},
{0.00676307557503983, -3.03762646563539, -1.04222727489537,
-2.89793586812239, -0.0345367389372302, -0.396316156498655,
-4.17390683245654, -1.04259102949323, 0.646124407113894,
4.65879259115234},
{-0.918439271427834, -0.922619907488047, 0.341776900408886,
1.73376949112178, 1.67366897864704, -0.0774302916731713,
0.975805872588223, 0.644518767500112, -1.43271007801584,
-2.58137567157091},
{0.814839376914322, -0.767455861316133, -0.692891405428156,
-1.72740212450458, -1.13601031313238, 0.0826401983994109,
-1.63670634699018, -0.478887730480832, 0.0487182472675357,
2.73025561729349}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 8>{
{-0.831814666140585, 0.551212705784034, -0.288275793660515,
0.837134305995731, -0.931924240571019, -0.49504443280297,
0.710934557923224, 1.54820568081194}};

48
neural_net_training/result_electrons_tight_preselection/matching.hpp

@ -0,0 +1,48 @@
const auto fMin = std::array<simd::float_v, 6>{
{2.32376150961e-05, 1.20999777664e-06, 0.000137329101562, 0.0001220703125,
4.08235937357e-05, 1.58324837685e-08}};
const auto fMax =
std::array<simd::float_v, 6>{{14.9999294281, 0.397419095039, 249.888916016,
249.80456543, 1.27809739113, 0.145608559251}};
const auto fWeightMatrix0to1 = std::array<std::array<simd::float_v, 7>, 8>{
{{1.14686702105133, 7.32165886864229, -2.10667874646636, -7.81436645467837,
3.20456295583655, 5.71630082011742, 5.4267515236929},
{1.1223108812746, -18.4304654490729, 2.24283549655358, -7.91903630390993,
-1.7120179953541, 16.4428763984042, -7.7670575606826},
{-0.29671778729467, -13.0855752393889, 5.76397705095293, 15.1050031386427,
-9.46272395702593, -10.4098401251365, -11.1827876138273},
{1.22567671872288, -10.1806559784814, 9.4123889819786, 3.33020804707504,
-3.62892938790107, 1.97202890758237, 3.00691838410481},
{-13.287527754626, 8.65715009899808, -9.23874052442022, 0.342819975485346,
-2.66075937738172, -2.21180912649223, -15.8042500545369},
{0.40615324018488, 8.20528799556931, 0.120437714891502, 2.82045299528089,
3.3146607823261, -10.1500252961676, 2.98147186565103},
{-0.79066972900182, -0.617757099680603, 0.740878002718091,
0.681870030239224, -1.20759406685829, 0.769290467724204,
-1.8437808630988},
{2.03080670645102, 0.857008886862134, -0.000292226644302983,
0.178638222067627, -0.0451998322708684, 1.57747130561694,
-0.947885853615947}}};
const auto fWeightMatrix1to2 = std::array<std::array<simd::float_v, 9>, 6>{
{{1.34042894664901, -1.25881431072482, 0.854571496235596, 1.19180978658431,
-2.56084328311484, -1.16908642761855, 1.63438201788813,
-0.719776498381903, -0.517779751300816},
{-6.05551610325633, 3.51881316116878, -1.72489919395952, -1.34854599849755,
0.228556506507238, -1.24082608277022, -1.61531096417457,
-0.331048490560243, 0.0440270896123382},
{-0.910597065292042, 0.638583362065693, 2.46177710816441,
-0.383879693573997, 0.172027182621679, -4.97353833514206,
-0.825543426908553, -1.90529613859482, -1.62517251048573},
{0.749189388930382, -0.678429015139203, -0.113727217593658,
-0.745127265514822, -1.32287250351125, -1.52089060286024,
1.61348068527877, -1.98928137020268, 2.55881275295292},
{-1.90912384419543, -2.26367223577845, -0.778619268564688,
-0.385457172868458, 1.78069433521773, 2.26006150643181,
-0.848898627795279, 0.954332464334022, -4.46228362617693},
{-1.6361774999973, 0.351405034583161, -0.519208899403995,
-0.684887663689445, 2.06674522765702, 0.753161538395281,
-1.52203810494393, 1.28302454216952, 0.518256247348975}}};
const auto fWeightMatrix2to3 = std::array<simd::float_v, 7>{
{-0.579816512887146, -0.642641373642023, -0.601374474291051,
0.732569201596012, -0.643217840709555, 0.885243737133997,
-0.0355854155197324}};

22
parameterisations/train_matching_ghost_mlps.py

@ -11,10 +11,10 @@ def train_matching_ghost_mlp(
tree_name: str = "PrMatchNN.PrMCDebugMatchToolNN/MVAInputAndOutput", tree_name: str = "PrMatchNN.PrMCDebugMatchToolNN/MVAInputAndOutput",
exclude_electrons: bool = True, exclude_electrons: bool = True,
only_electrons: bool = False, only_electrons: bool = False,
n_train_signal: int = 100e3,
n_train_bkg: int = 100e3,
n_test_signal: int = 50e3,
n_test_bkg: int = 50e3,
n_train_signal: int = 165e3,
n_train_bkg: int = 165e3,
n_test_signal: int = 5e3,
n_test_bkg: int = 5e3,
prepare_data: bool = True, prepare_data: bool = True,
outdir: str = "neural_net_training", outdir: str = "neural_net_training",
): ):
@ -31,6 +31,7 @@ def train_matching_ghost_mlp(
prepare_data (bool, optional): Split data into signal and background file. Defaults to False. prepare_data (bool, optional): Split data into signal and background file. Defaults to False.
""" """
if prepare_data: if prepare_data:
print("Preparing Data for MVA Training: ")
rdf = ROOT.RDataFrame(tree_name, input_file) rdf = ROOT.RDataFrame(tree_name, input_file)
if exclude_electrons: if exclude_electrons:
rdf_signal = rdf.Filter( rdf_signal = rdf.Filter(
@ -50,13 +51,16 @@ def train_matching_ghost_mlp(
"Signal is defined as non-zero label", "Signal is defined as non-zero label",
) )
rdf_bkg = rdf.Filter("mc_quality == 0", "Ghosts are defined as zero label") rdf_bkg = rdf.Filter("mc_quality == 0", "Ghosts are defined as zero label")
print("Create Signal data file. ")
rdf_signal.Snapshot( rdf_signal.Snapshot(
"Signal", "Signal",
outdir + "/" + input_file.strip(".root") + "_matching_signal.root", outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
) )
print("Create Background data file. ")
rdf_bkg.Snapshot( rdf_bkg.Snapshot(
"Bkg", outdir + "/" + input_file.strip(".root") + "_matching_bkg.root" "Bkg", outdir + "/" + input_file.strip(".root") + "_matching_bkg.root"
) )
print("Data preparation terminated successfully.\n")
signal_file = ROOT.TFile.Open( signal_file = ROOT.TFile.Open(
outdir + "/" + input_file.strip(".root") + "_matching_signal.root", outdir + "/" + input_file.strip(".root") + "_matching_signal.root",
@ -88,17 +92,15 @@ def train_matching_ghost_mlp(
dataloader.AddVariable("mc_distY", "F") dataloader.AddVariable("mc_distY", "F")
dataloader.AddVariable("mc_dSlope", "F") dataloader.AddVariable("mc_dSlope", "F")
dataloader.AddVariable("mc_dSlopeY", "F") dataloader.AddVariable("mc_dSlopeY", "F")
# dataloader.AddVariable("tx", "F")
# dataloader.AddVariable("ty", "F")
# dataloader.AddVariable("tx_scifi", "F")
# dataloader.AddVariable("ty_scifi", "F")
dataloader.AddVariable("mc_end_velo_phi", "F")
dataloader.AddVariable("mc_end_velo_eta", "F")
dataloader.AddSignalTree(signal_tree, 1.0) dataloader.AddSignalTree(signal_tree, 1.0)
dataloader.AddBackgroundTree(bkg_tree, 1.0) dataloader.AddBackgroundTree(bkg_tree, 1.0)
# these cuts are also applied in the algorithm # these cuts are also applied in the algorithm
preselectionCuts = ROOT.TCut( preselectionCuts = ROOT.TCut(
"mc_chi2<30 && mc_distX<500 && mc_distY<500 && mc_dSlope<3.0 && mc_dSlopeY<0.3", #### ganz raus für elektronen
"mc_chi2<15 && mc_distX<250 && mc_distY<250 && mc_dSlope<1.5 && mc_dSlopeY<0.15 && std::abs(mc_end_velo_phi)<3.142 && mc_end_velo_eta>1.99 && mc_end_velo_eta<5.01", #### ganz raus für elektronen
) )
dataloader.PrepareTrainingAndTestTree( dataloader.PrepareTrainingAndTestTree(
preselectionCuts, preselectionCuts,
@ -108,7 +110,7 @@ def train_matching_ghost_mlp(
dataloader, dataloader,
TMVA.Types.kMLP, TMVA.Types.kMLP,
"matching_mlp", "matching_mlp",
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:!UseRegulator",
"!H:V:TrainingMethod=BP:NeuronType=ReLU:EstimatorType=CE:VarTransform=Norm:NCycles=700:HiddenLayers=N+2,N:TestRate=50:Sampling=1.0:SamplingImportance=1.0:LearningRate=0.02:DecayRate=0.01:UseRegulator",
) )
factory.TrainAllMethods() factory.TrainAllMethods()
factory.TestAllMethods() factory.TestAllMethods()

Loading…
Cancel
Save