ATLAS Offline Software
Macros | Functions | Variables
testWrite.cxx File Reference
#include <iostream>
#include <limits>
#include <type_traits>
#include <TFile.h>
#include "GaudiKernel/SystemOfUnits.h"
#include "RingerSelectorTools/AsgElectronRingerSelector.h"
#include "RingerSelectorTools/procedures/RingerProcedureWrapper.h"
#include "RingerSelectorTools/procedures/Normalizations.h"
#include "RingerSelectorTools/procedures/NeuralNetwork.h"
#include "RingerSelectorTools/procedures/Thresholds.h"
#include "RingerSelectorTools/tools/IOHelperFcns.h"
#include "RingerSelectorTools/tools/TrackPatternsHolder.h"

Go to the source code of this file.

Macros

#define protected   public
 
#define private   public
 
#define BREAKER   "================================================================================"
 

Functions

Ringer::AsgElectronRingerSelector __AsgRingerSel__ ("testWrite")
 
template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency, SegmentationType segType>
IPreProcWrappercreatePPWrapper (const char *fileName, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()})
 Method dedicated for testing pre-processing wrapper creation. More...
 
template<typename procedure_t >
procedure_t * ppFactoryEtaEtDep (SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax, float etMin, float etMax, MSG::Level lvl)
 PP factory with segType, eta and et dependency. More...
 
template<typename procedure_t >
procedure_t * ppFactoryEtaDep (SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax, MSG::Level lvl)
 PP factory with segType and eta dependency. More...
 
template<typename procedure_t >
procedure_t * ppFactoryEtDep (SegmentationType cSegType, unsigned segIdx, float etMin, float etMax, MSG::Level lvl)
 PP factory with segType and et dependency. More...
 
template<typename procedure_t >
procedure_t * ppFactoryDep (SegmentationType cSegType, unsigned segIdx=0, MSG::Level lvl=MSG::INFO)
 PP factory with segType dependency. More...
 
PreProcessing::IPreProcessorVarDepcreateRandomPP (SegmentationType cSegType, unsigned segIdx=0, MSG::Level lvl=MSG::INFO)
 PP random factory. More...
 
template<typename procedure_t >
procedure_t * createPP (SegmentationType cSegType, unsigned segIdx=0, MSG::Level lvl=MSG::INFO)
 Create PP of t. More...
 
template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency, SegmentationType segType>
void createDiscrWrapper (const char *fileName, const IPreProcWrapperCollection *ppWrapper=nullptr, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()})
 Method dedicated for testing discriminator wrapper creation. More...
 
void writeWrapperOnFile (const IProcWrapperBase &wrapper, const char *fileName, MSG::Level)
 Write wrapper to file. More...
 
template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createNN (SegmentationType cSegType, unsigned segIdx)
 Creates eta/et independent neural network. More...
 
template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtaDepNN (SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax)
 Creates eta dependent, et independent neural network. More...
 
template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtDepNN (SegmentationType cSegType, unsigned segIdx, float etMin, float etMax)
 Creates eta independent, et dependent neural network. More...
 
template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtaEtDepNN (SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax, float etMin, float etMax)
 Creates eta dependent, et dependent neural network. More...
 
template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency>
void createThresWrapper (const char *fileName, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()}, float thresValue=0)
 Method dedicated for testing threshold wrapper creation. More...
 
Discrimination::UniqueThresholdVarDep * createThres (float thresValue)
 
Discrimination::UniqueThresholdVarDep * createEtaDepThres (float etaMin, float etaMax, float thresValue)
 
Discrimination::UniqueThresholdVarDep * createEtDepThres (float etMin, float etMax, float thresValue)
 
Discrimination::UniqueThresholdVarDep * createEtaEtDepThres (float etaMin, float etaMax, float etMin, float etMax, float thresValue)
 
int main ()
 

Variables

MsgStream & msg = __AsgRingerSel__.msg()
 
std::vector< std::vector< unsigned > > segmentationEntries
 

Macro Definition Documentation

◆ BREAKER

#define BREAKER   "================================================================================"

Definition at line 43 of file testWrite.cxx.

◆ private

#define private   public

Definition at line 31 of file testWrite.cxx.

◆ protected

#define protected   public

Definition at line 30 of file testWrite.cxx.

Function Documentation

◆ __AsgRingerSel__()

Ringer::AsgElectronRingerSelector __AsgRingerSel__ ( "testWrite"  )

◆ createDiscrWrapper()

template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency, SegmentationType segType>
void createDiscrWrapper ( const char *  fileName,
const IPreProcWrapperCollection ppWrapper = nullptr,
const std::vector< float > &  etaDepBounderies = {0, 2.5},
const std::vector< float > &  etDepBounderies = {0, std::numeric_limits<float>::infinity()} 
)

Method dedicated for testing discriminator wrapper creation.

Definition at line 1064 of file testWrite.cxx.

1068 {
1069  // Typedef to make things easier
1070  typedef RingerProcedureWrapper<procedure_t,
1071  etaDependency,
1072  etDependency,
1073  segType> wrapper_t;
1074 
1075  typedef typename RingerProcedureType<procedure_t>::procEnum_t procEnum_t;
1076 
1077  msg << MSG::INFO << "Attempting to create a RingerProcedureWrapper<"
1078  << toStr(procedure_t::template procType<procEnum_t>() )
1080  << toStr(etaDependency) << ","
1081  << toStr(etDependency) << ","
1082  << toStr(segType) << "> with file name: " << fileName << "." << endmsg;
1083 
1084  unsigned etaDepProc = etaDepBounderies.size() - 1;
1085  unsigned etDepProc = etDepBounderies.size() - 1;
1086 
1087  // Loop over variable dependencies
1088  for ( unsigned uEtaDep = EtaIndependent; uEtaDep <= EtaDependent; ++uEtaDep ){
1089  for ( unsigned uEtDep = EtIndependent; uEtDep <= EtDependent; ++uEtDep ){
1090  // The enumerations
1091  EtaDependency etaDep = static_cast<EtaDependency>(uEtaDep);
1092  EtDependency etDep = static_cast<EtDependency>(uEtDep);
1093 
1094  // Change message level accondingly if we are creating correct wrapper
1095  // type
1096  MSG::Level lvl(MSG::VERBOSE);
1097  if ( etaDep == etaDependency &&
1098  etDep == etDependency )
1099  {
1100  lvl = MSG::INFO;
1101  }
1102 
1103  // The collection holder
1104  typename wrapper_t::DiscrDepProcCollection discrCol(numberOfSegments(segType),
1105  std::vector< std::vector<procedure_t*> >(
1106  etDepProc, std::vector<procedure_t*>(etaDepProc,
1107  nullptr)));
1108 
1109  // Fill collection
1110  for ( unsigned segDepIdx = 0; segDepIdx < numberOfSegments(segType); ++segDepIdx ){
1111  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
1112  // Get et bounderies:
1113  float etMin(etDepBounderies[etDepIdx]),
1114  etMax(etDepBounderies[etDepIdx+1]);
1115  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
1116  // Get eta bounderies:
1117  float etaMin(etaDepBounderies[etaDepIdx]),
1118  etaMax(etaDepBounderies[etaDepIdx+1]);
1119 
1120  // Fill collection:
1121  if (etaDep) {
1122  if (etDep) {
1123  discrCol[segDepIdx][etDepIdx][etaDepIdx] = createEtaEtDepNN(
1124  segType, segDepIdx,
1125  etaMin,
1126  etaMax,
1127  etMin,
1128  etMax);
1129  } else {
1130  discrCol[segDepIdx][etDepIdx][etaDepIdx] = createEtaDepNN(
1131  segType, segDepIdx,
1132  etaMin,
1133  etaMax);
1134  }
1135  } else {
1136  if (etDep) {
1137  discrCol[segDepIdx][etDepIdx][etaDepIdx] = createEtDepNN(
1138  segType, segDepIdx,
1139  etMin,
1140  etMax);
1141  } else {
1142  discrCol[segDepIdx][etDepIdx][etaDepIdx] = createNN(segType, segDepIdx);
1143  }
1144  }
1145  }
1146  }
1147  } // Finished looping and filling collection
1148 
1149  // Attempt to create a wrapper with filled collection:
1150  try {
1151 
1152  msg << lvl << "Attempting to create wrapper with ("
1153  << toStr(etaDep) << "," << toStr(etDep) << ") discriminator"
1154  << endmsg;
1155 
1156  wrapper_t* wrapper(nullptr);
1157  // Create wrapper:
1158  if ( !ppWrapperCol || ppWrapperCol->empty() ){
1159  wrapper = new wrapper_t(discrCol);
1160  } else {
1161  wrapper = new wrapper_t(*ppWrapperCol, discrCol);
1162  }
1163  // Use dummy message stream:
1164  wrapper->setMsgStream(&msg);
1165  // Print wrapper:
1166  wrapper->print(MSG::DEBUG);
1167 
1168  // Delete file if it already exists:
1169  IOHelperFcns::deleteFile( fileName );
1170 
1171  // Create IDiscrWrapperCollection and write it:
1172  //writeWrapperOnFile(*wrapper, fileName, MSG::VERBOSE);
1173  IDiscrWrapperCollection discrWrapperCol = {wrapper};
1174  IDiscrWrapper::writeCol(discrWrapperCol, fileName);
1175 
1176  // Add file io information:
1177  AsgElectronRingerSelector::IOConfStruct ioConf;
1178  ioConf.useBLOutliers = true;
1179  AsgElectronRingerSelector::writeConf( fileName, ioConf );
1180  AsgElectronRingerSelector::printConf(ioConf, &msg );
1181 
1182  // Release wrapper memory:
1183  //wrapper->releaseMemory();
1184  //delete wrapper;
1185 
1186  msg << lvl << "Succeed!" << endmsg;
1187 
1188  } catch (const std::runtime_error &e) {
1189 
1190  msg << MSG::VERBOSE << "Couldn't create wrapper. Reason: "
1191  << e.what() << endmsg;
1192 
1193  // Release collection memory
1194  for ( unsigned segDepIdx = 0; segDepIdx < numberOfSegments(segType); ++segDepIdx ){
1195  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
1196  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
1197  delete discrCol[segDepIdx][etDepIdx][etaDepIdx];
1198  discrCol[segDepIdx][etDepIdx][etaDepIdx] = nullptr;
1199  }
1200  }
1201  }
1202  } // Finished creating wrapper and handling possible errors
1203 
1204  }
1205  } // Finished looping over eta/et.
1206 }

◆ createEtaDepNN()

template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtaDepNN ( SegmentationType  cSegType,
unsigned  segIdx,
float  etaMin,
float  etaMax 
)

Creates eta dependent, et independent neural network.

Definition at line 1241 of file testWrite.cxx.

1245 {
1246  Discrimination::NNFeedForwardVarDep* nn = createNN(cSegType, segIdx);
1247  nn->setEtaDep(etaMin, etaMax);
1248  return nn;
1249 }

◆ createEtaDepThres()

Discrimination::UniqueThresholdVarDep * createEtaDepThres ( float  etaMin,
float  etaMax,
float  thresValue 
)

Definition at line 1414 of file testWrite.cxx.

1417 {
1418  Discrimination::UniqueThresholdVarDep* thres = createThres(thresValue);
1419  thres->setEtaDep(etaMin, etaMax);
1420  return thres;
1421 }

◆ createEtaEtDepNN()

template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtaEtDepNN ( SegmentationType  cSegType,
unsigned  segIdx,
float  etaMin,
float  etaMax,
float  etMin,
float  etMax 
)

Creates eta dependent, et dependent neural network.

Definition at line 1265 of file testWrite.cxx.

1269 {
1270  Discrimination::NNFeedForwardVarDep* nn = createNN(cSegType, segIdx);
1271  nn->setEtaEtDep(etaMin, etaMax, etMin, etMax);
1272  return nn;
1273 }

◆ createEtaEtDepThres()

Discrimination::UniqueThresholdVarDep * createEtaEtDepThres ( float  etaMin,
float  etaMax,
float  etMin,
float  etMax,
float  thresValue 
)

Definition at line 1434 of file testWrite.cxx.

1438 {
1439  Discrimination::UniqueThresholdVarDep* thres = createThres(thresValue);
1440  thres->setEtaEtDep(etaMin, etaMax, etMin, etMax);
1441  return thres;
1442 }

◆ createEtDepNN()

template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createEtDepNN ( SegmentationType  cSegType,
unsigned  segIdx,
float  etMin,
float  etMax 
)

Creates eta independent, et dependent neural network.

Definition at line 1253 of file testWrite.cxx.

1257 {
1258  Discrimination::NNFeedForwardVarDep* nn = createNN(cSegType, segIdx);
1259  nn->setEtDep(etMin, etMax);
1260  return nn;
1261 }

◆ createEtDepThres()

Discrimination::UniqueThresholdVarDep * createEtDepThres ( float  etMin,
float  etMax,
float  thresValue 
)

Definition at line 1424 of file testWrite.cxx.

1427 {
1428  Discrimination::UniqueThresholdVarDep* thres = createThres(thresValue);
1429  thres->setEtDep(etMin, etMax);
1430  return thres;
1431 }

◆ createNN()

template<bool goodStatus = true>
Discrimination::NNFeedForwardVarDep * createNN ( SegmentationType  cSegType,
unsigned  segIdx 
)

Creates eta/et independent neural network.

If goodStatus = false, returns a dummy neural network which always returns 0 as output for an pattern space of dimension size of 100.

An old MC12 Zee x JF14 neural network is created otherwise.

Definition at line 1210 of file testWrite.cxx.

1212 {
1213  if ( goodStatus ){
1214  switch (cSegType)
1215  {
1217  {
1218  std::vector<unsigned int> nodes = {100,16,1};
1219  std::vector<float> weights = {0.028688,-0.062593,-0.110670,-0.109672,-0.224397,-0.113062,0.039054,-0.529236,-2.888686,-0.605837,-0.994450,0.006954,-0.056765,-0.031750,-0.503685,-0.494298,-0.221056,0.400392,-0.531358,-0.629313,0.089911,-1.007010,-0.629093,-0.716350,-0.273729,-0.826810,-0.214472,-0.975512,-0.396733,-0.003727,-0.276535,-0.056521,0.186771,-0.077535,-0.058493,-0.245285,-0.982163,-0.797398,-0.073127,-0.115995,-0.007802,-1.154354,-0.132477,-0.594071,0.124951,-0.115163,-0.164945,-0.095116,-0.324021,-0.066871,-0.051343,-0.719736,-0.064108,0.144933,-0.404720,-0.052662,-0.203778,-0.495595,0.025789,-0.115119,-0.153406,-1.088269,-1.284559,0.007588,-0.376025,-0.218487,-0.014306,0.037344,-0.159262,0.033259,-0.300734,-0.328634,-1.224337,0.318360,-0.545602,0.263710,-0.034113,-0.121256,-0.271094,-0.406514,0.282135,0.078523,0.364275,-0.856901,-0.442518,-0.008571,-0.030869,0.089742,-1.372179,0.552057,-0.457882,-0.200123,-1.674263,-0.621302,-0.498098,-0.299907,-1.576183,0.046803,-0.091531,-0.096722,1.568295,0.231312,-0.640472,-3.136615,-2.410643,-13.031759,33.412286,-8.683243,1.475885,0.969468,0.017705,0.295497,0.938570,-0.365949,-1.487067,-1.581031,-7.219507,-5.611233,-2.667463,-3.709057,-0.538870,-0.711813,0.433348,-0.594230,-0.844310,-1.288160,-0.741892,-1.830146,-0.325822,-1.631410,-1.751475,-1.720901,-0.898951,-13.288799,-1.933127,-3.081192,-6.221801,-1.104714,-3.841797,-3.328604,-5.193892,-0.808612,-0.796501,-0.288802,7.600919,-0.329103,-2.054659,-0.080070,-7.080676,-0.922352,-4.327209,-3.596929,-1.918411,-3.564654,3.974327,-2.244009,-4.969694,-8.027518,-6.920259,-8.452600,-2.703256,-6.863256,-3.882042,-6.151130,-26.816965,-94.151225,-14.878026,-9.943644,-37.491924,-46.556123,-1.433659,-2.125969,0.698555,1.188699,-1.000490,-0.471744,-0.684885,-4.686223,11.678164,-9.628196,12.210666,-2.342332,-1.902629,-1.247211,-1.661623,-1.388010,-1.868174,-1.932632,-1.209638,2.603166,0.492622,1.332110,-1.645321,1.261750,-4.505736,0.740274,-0.668193,-0.267155,0.334967,3.742837,0.740339,-0.073527,-0.324355,-0.064818,-0.051392,0.094401,0.154956,-0.067873,0.440951,0.138248,-0.572323,-0.010880,-0.047062,-0.180201,-0.479383,-0.188006,-0.424571,-0.457951,-0.638549,-0.298774,-0.708894,-0.359068,-0.192183,-1.064735,-0.140763,-0.518375,0.131144,-0.282072,-0.277306,-0.393560,0.307943,-0.087220,-0.106205,-0.135257,-0.082795,-0.240611,-0.450951,-0.439167,-0.101002,-0.123107,-0.063369,-0.086694,-0.493826,0.086611,0.178572,-0.215764,-0.120014,0.351601,-0.273922,0.485342,-0.132585,0.111573,-0.076256,0.067623,-0.109474,0.206897,-0.093580,-0.016174,0.008848,-0.061735,0.014456,-0.013979,-0.631338,0.191005,-0.191373,-0.267904,0.389943,0.057172,-0.028360,-0.138402,-0.162590,-0.098487,-0.271238,-0.218225,0.084942,-0.490171,-0.076231,-0.104584,-0.075355,-0.206857,1.956858,1.263630,-1.606997,0.258611,-0.221201,-0.126122,0.055639,-0.052784,0.267501,-0.976859,0.077316,-0.236870,-1.100098,-0.340871,0.266472,-0.033575,-1.106904,-0.048352,-0.034147,-0.027628,-0.907428,-0.114443,0.639170,-5.046371,2.117636,12.534221,4.109699,1.002582,-6.121682,-1.300009,0.000709,0.001165,-0.206458,0.354377,-3.450948,3.458475,17.388021,19.380078,5.190390,4.633401,9.791459,1.829216,29.071445,2.496838,3.528770,5.186754,1.097003,1.898567,1.687048,1.712853,18.696546,2.422834,2.972473,1.986865,1.978833,2.538006,8.025286,10.573317,16.791273,3.481498,3.077972,1.144574,0.829633,5.784941,3.109096,7.093387,53.518546,45.052680,9.139784,13.222146,2.750695,3.407295,6.188783,3.406966,-23.018505,2.266498,5.030206,8.614132,5.835313,5.992136,7.205853,6.317150,0.141573,7.108026,-93.605318,-111.675271,2.469222,2.625255,1.189963,0.092941,1.280597,0.471347,-0.712683,-0.367087,0.920240,-0.766278,0.996182,10.240765,8.472205,8.538664,0.794154,3.866253,2.359055,2.030608,1.149638,2.585729,2.002529,1.638214,1.052308,-1.465720,-1.196036,-3.249994,1.560568,-20.990768,0.155179,-1.015941,0.794045,-0.179825,-19.952022,1.910052,1.051576,0.060563,0.031857,0.070955,0.007167,0.378318,0.023833,0.649955,4.275588,0.027542,0.627095,-0.024055,0.048692,0.653087,-0.136869,0.853252,0.711888,0.746423,0.917728,1.66293,0.943031,0.591943,-0.978663,1.058206,0.267564,-0.642447,0.024186,0.398969,-0.004766,0.372238,0.077377,-0.042264,0.054782,0.081330,0.037063,0.236487,0.187889,-0.077143,-0.182055,-0.012978,-0.179301,-0.157928,0.005376,-0.020677,5.841787,0.412119,0.708508,0.070569,-0.645499,-0.112014,0.125128,0.024352,0.703745,0.062582,0.280714,0.045282,0.155499,0.189150,0.299881,0.054184,-0.049919,0.111692,0.026760,0.135167,0.270543,0.148473,-0.015246,-0.100352,0.165556,0.170405,0.228728,0.319828,0.835729,-0.198271,0.439356,-0.002287,0.066184,0.327133,0.233683,0.278432,-3.083528,-1.286595,1.464285,0.698704,0.024064,0.079657,0.007752,0.066683,0.711628,-0.769123,0.203221,0.116553,0.573138,0.035675,-0.406918,0.183639,-1.605187,-0.058066,0.070112,0.147746,-2.392498,-2.745882,1.263215,0.181240,0.343909,-3.675908,4.112136,0.180781,-4.340636,-2.242731,-2.255890,-2.695255,-1.605709,0.047641,-0.994458,5.288881,3.168465,4.077442,1.480216,1.922621,-1.683723,1.113707,0.608307,1.749436,1.209098,3.086876,0.551001,-1.049812,0.239036,-1.736003,-1.371147,29.087469,0.396884,1.155119,4.757856,-0.492357,-2.349446,0.096400,-3.124810,0.448417,0.128918,0.592998,0.331566,0.300982,0.001730,0.269922,-3.360424,-15.594998,-0.537339,9.110059,-2.362906,-1.938478,-1.143943,-0.152321,-2.628727,-0.891215,-1.643069,-4.414059,-10.897783,-6.394373,0.097377,-11.008657,-2.151860,-11.556536,-16.268739,-31.602494,-11.505709,-1.876816,-6.329613,1.669843,0.571898,-2.337885,-1.365757,-0.944771,0.970493,-0.442543,0.995064,-3.749592,-5.691184,-4.139481,-0.788088,4.890539,2.398736,2.532407,1.881680,1.500637,0.623273,-30.264643,9.645718,10.514421,8.475971,0.121070,2.874658,4.640818,1.437012,1.848824,-2.715429,-0.324435,0.844252,6.818916,2.389538,0.107453,0.263178,4.235293,0.609985,1.110795,0.093694,-1.311855,2.269984,5.058177,1.137608,1.277659,-0.033944,-0.164212,-2.001901,-7.228751,-1.036251,1.976840,-2.504326,4.353166,-1.511555,-1.452743,-0.663433,-0.976442,-0.693744,0.198484,-0.407872,-0.506523,-0.590362,4.043677,6.314065,0.126364,-0.194009,-16.236056,4.068819,1.224119,1.543314,-0.128289,1.302668,1.465868,1.603645,-0.031988,0.175951,0.158367,0.120493,-0.004462,7.682568,0.469458,-0.000680,-7.551085,0.606771,0.200480,1.057136,0.555353,4.748190,0.039710,0.263192,0.593023,3.582425,1.947296,0.517452,-0.076818,0.682754,0.357066,0.075757,-0.007521,0.317154,1.510008,0.580695,5.009438,0.728683,-0.267382,2.371758,0.446246,-0.167985,-7.106345,-0.097237,3.584461,4.274035,4.095569,-1.738810,-6.914329,-3.810478,1.208624,1.140845,2.095668,0.575353,0.626909,-2.226223,-2.056425,-1.312785,-1.551202,-2.271757,-0.504885,-0.277969,-0.431348,2.347458,-0.027946,-0.392081,-0.388553,8.689883,4.189324,-0.862448,-5.671942,-1.845137,9.754921,-10.775090,72.349025,6.208780,6.869102,0.123899,0.383385,0.675272,-0.332477,-0.960122,-31.058836,-7.949740,-3.758648,7.108799,11.528299,8.149853,-0.615473,-0.439979,-0.677038,-0.723783,29.196677,-0.859601,-1.499570,-0.576167,-1.667575,-1.829887,-1.398700,-0.515988,41.517160,0.713953,30.545081,-6.188533,-7.091922,-9.414879,-1.904592,-7.658521,-2.284183,-7.772925,21.863106,20.947830,-1.751241,13.477022,-7.682248,-8.168043,-20.637880,10.466483,0.089507,-5.340472,-3.344616,-8.410060,-2.282409,-6.121732,-6.918085,-6.073172,-11.025504,-8.407571,-6.208835,-4.529416,-5.678833,-5.714158,-1.018523,19.611186,-2.653425,-1.897749,-3.690523,0.166875,-0.394813,0.722076,-0.189588,-0.930066,0.943887,-0.845358,-5.028208,-4.240671,-15.165471,-0.622049,-3.294203,1.575702,3.755827,-1.110502,-1.434140,-1.507328,-12.166484,2.660743,2.035036,0.891480,2.444064,-2.451179,-1.473334,0.802695,-0.310561,0.390210,0.371984,-15.530832,1.328315,-6.511445,-1.310474,1.158307,20.504969,0.870710,1.396723,0.227466,-1.831463,-2.830913,-5.143690,-0.271427,-0.426230,-0.240882,-0.115466,0.874429,1.650408,4.967956,1.912887,2.400235,1.008770,2.862430,1.166314,0.933473,2.330710,2.444949,1.830853,1.049244,2.607336,2.804982,3.107458,3.294002,3.170131,13.693583,76.926670,3.845448,23.346861,9.812383,2.391273,10.606641,1.963476,2.967598,1.526888,0.866287,4.209006,18.102486,0.533338,1.445390,0.872831,0.853834,0.273607,.321337,0.123892,0.412314,0.355130,-4.645920,0.283349,-6.881706,0.901227,-4.195997,0.916571,-0.388821,0.565599,1.117080,0.812389,5.323900,1.317251,0.320280,0.308174,-26.829184,1.149731,1.275011,2.000144,-1.470072,-0.767747,0.202361,-1.587088,1.155752,1.098314,1.257929,-3.200987,0.668693,4.033012,0.999027,-1.208894,1.632769,1.014471,0.723843,2.399647,-2.593154,-9.382237,1.349194,-0.021662,-3.713423,-1.746662,-6.558139,-1.554877,-2.434262,1.989675,0.249551,-2.443816,-3.779906,-2.636414,-1.277373,-4.628381,-0.505515,-3.990376,-11.436412,-2.227947,-2.823871,-6.863975,-1.281835,-3.663759,-0.310102,0.149827,2.020108,2.642968,1.497769,3.041259,2.015148,1.067337,-0.013860,0.981229,0.631989,1.125228,0.752725,-1.872923,0.565742,0.566382,0.054049,0.409526,-0.925388,-0.245978,-0.132565,-0.171097,-3.199698,2.047109,-2.335864,-0.230441,-3.463833,-2.292295,-0.984754,-0.119444,-0.079340,-1.964507,-0.163262,-0.044391,-3.299204,-1.317512,-1.653288,-360.611655,-0.792871,-1.526987,-5.112393,-0.545486,-8.757870,-0.044763,0.033397,-1.166951,-3.586482,-3.397790,-0.226581,-0.680198,-0.470130,-0.421405,-3.563391,-0.720706,0.001545,-2.030093,-3.074116,-0.915965,-2.567866,0.300819,-2.735884,-2.183676,4.409152,0.644427,-0.628248,-3.267413,-3.548809,-4.949955,3.555070,8.891552,3.580243,1.056337,-1.324928,-1.612563,-0.576405,-0.681977,2.571778,1.858078,1.474100,0.776536,3.534101,0.802548,-0.213475,0.434609,-4.311330,-1.056947,0.292802,-0.536683,-9.690235,-3.111939,-0.113073,5.260060,0.512237,1.040290,34.479682,2.148753,-3.126262,-2.802152,-0.047654,-0.012042,1.508002,5.959009,1.083541,1.424925,-1.638421,-3.557558,-1.322984,4.979366,2.018343,1.150012,1.216431,-0.280425,2.333079,1.243301,0.841088,1.886149,1.498563,1.629537,3.290616,1.685732,2.013451,0.862097,1.742377,-25.609594,1.644792,4.482274,-18.463892,1.851310,0.167115,-0.404057,0.565838,4.045443,1.878586,0.753386,-16.788055,0.126791,-10.594349,3.300475,-0.634618,0.747863,7.905016,3.666997,31.245129,3.526583,9.021474,8.262771,10.631880,-3.141672,4.410128,6.165324,12.481022,5.635590,8.770696,8.735834,10.870203,3.874316,21.608977,4.526612,1.156461,1.276455,-0.976077,-0.288614,1.000854,0.298251,0.383862,0.127455,-10.489012,-1.725379,-7.637858,9.150683,2.160111,1.407201,1.326115,1.018763,2.385681,1.744191,1.730315,7.003605,-10.912519,4.530976,3.405832,13.760234,-1.191210,-1.174960,0.549645,0.459820,3.840778,12.674068,-2.126857,-3.227273,0.883224,5.710771,2.435913,-63.068527,3.723472,10.381427,-6.550155,-5.879445,-0.212391,-0.055838,-0.030079,0.349785,0.068710,3.085991,5.712933,5.268697,4.278224,2.301436,0.565240,0.997076,0.590336,0.721163,0.832828,1.161940,0.703974,1.480778,0.505237,1.669236,1.958621,1.691473,0.893302,19.534316,1.782585,1.056738,-3.575074,16.543404,26.596598,24.057324,6.166616,11.768488,2.438942,0.139397,2.026144,3.923045,8.086570,7.847441,5.052775,3.426013,3.642981,2.268567,-0.649373,3.161143,7.047121,2.205177,5.594592,-61.189816,8.415619,8.300800,-2.673700,-2.996654,5.218760,-23.693685,-2.322776,8.623765,4.627958,3.368395,46.500027,5.639402,-8.165272,0.796185,-0.706099,0.135805,0.868030,0.306016,0.789311,7.124334,4.242289,9.727023,0.681696,3.756994,3.622855,1.035487,1.025518,1.451887,1.854145,53.213359,-1.431522,-0.091550,-1.656084,-29.300245,1.570393,-0.978860,-1.027790,0.540321,-0.337222,-0.445398,5.875282,-1.581966,-2.580338,-0.264537,1.197146,-1.569363,-1.206515,-4.797875,-4.215951,8.528007,-6.191259,-2.189876,-2.501495,-0.966387,-1.200414,-1.520622,1.784751,3.031218,2.192351,1.142476,3.948292,1.763238,1.458057,1.396658,0.608675,1.724458,1.444704,-0.337446,0.570233,-0.657234,0.994609,-1.613324,-1.018631,9.949645,0.400291,0.977540,2.793460,9.773625,-2.396520,-2.783999,-2.708673,0.222687,-0.809978,0.368899,0.299932,-0.449218,0.185562,-0.459102,19.015891,-5.459218,-5.169562,-2.773216,-2.557959,-1.678736,-1.842239,-2.521119,-2.590653,-1.349186,-6.084066,13.539631,-2.590764,-6.882887,-4.029900,-1.488305,-4.217717,-0.591442,-4.848400,-2.261591,-1.905966,0.042691,-46.258913,-34.478861,-0.503401,-0.420428,-2.167570,-0.846137,0.870438,-2.407570,0.566669,-4.854715,12.200811,-2.699115,2.80773,7.892013,12.472750,0.180263,1.710783,0.879254,-2.253537,-2.573041,23.346808,6.059341,2.580303,14.766641,5.840801,4.124855,2.460706,1.147568,-1.740196,-0.196835,0.446965,-4.702591,1.964575,-0.052577,0.050285,-0.335195,0.303068,-0.149456,0.085326,-0.495100,1.934900,1.936413,1.653900,0.018581,-0.061852,-0.204984,-1.333097,-1.018476,-0.999683,-1.024398,-2.082589,-1.729892,-1.682701,-1.436921,-0.425914,0.474230,-0.613048,2.100885,-0.575348,-0.652350,0.685484,0.915968,0.304119,33.087667,22.601027,-0.104921,-0.177293,0.234389,0.198040,-0.238190,0.024597,-0.234056,2.822241,0.004142,-0.021054,-1.552198,0.397562,0.077244,-0.810139,0.196844,0.939802,-0.136742,0.592149,-0.255330,0.163302,0.318883,-0.064531,0.062070,0.694546,0.209702,-0.010243,-0.073304,0.410424,0.204043,0.361079,-0.055767,-0.101269,-0.050839,0.051487,0.718138,0.694693,0.435695,-0.256583,1.158518,1.995850,0.439841,-6.203604,-0.985698,-0.155184,0.593911,2.482176,0.946247,-8.436521,2.401151,1.810159,-1.035090,1.092773,0.036518,0.601562,0.147424,-1.833577,-0.126662,-0.374717,0.021811,-1.851743,2.796177,7.877599,0.255243,1.929069,0.112273,1.512485,-0.092995,2.856183,2.717226,-2.437687,29.901422,-2.085927,-19.040682,7.366650,-6.152353,2.929612,2.416426,0.020353,0.695380,-1.096458,-0.048956,-4.537238,-1.349666,-1.191487,-4.125253,-1.868902,-0.829698,0.339131,-0.988083,-0.657337,-1.539595,-0.878505,0.020183,-0.606991,-6.575499,-1.118187,-5.901197,-1.902425,-1.830654,-0.680334,-5.982117,-0.672636,-0.566174,0.880422,-0.227259,16.390507,16.269985,0.259872,-0.607438,-0.343732,-0.055939,-0.167441,-0.216072,-0.726638,-1.074767,-0.762545,0.036361,-1.061878,-0.472379,0.016452,-0.140865,10.090679,-0.235577,-0.524869,0.212008,-0.585822,7.323222,-0.135613,0.180593,-0.011106,-0.042434,-12.922468,-1.085171,-0.292372,-0.325988,-1.179218,-1.970896,-16.414723,0.919156,1.402566,2.696173,-0.709757,1.263208,-4.311061,-1.912170,0.871238,3.954405,-0.151088,-1.171526,-4.635838,-1.823951,-1.739963,-1.850814,-0.681339,-4.348577,6.466663,-1.359048,-2.297508,0.873118,-2.400759,-1.233752,-11.830300,-4.348966,0.058590,-0.093309,-0.269750,-0.034210,2.940893,0.216562,-0.620224,-5.364289,2.643353,-14.314586,0.580299,-7.502483,3.299922,3.749239,0.036450,2.614238,2.437889,-0.351271,-1.562823,-1.413144,-5.498119,-3.459754,0.428530,-0.058354,-0.386101,-0.304795,-0.544952,-1.530170,-0.663988,-0.703933,-0.727071,-1.581068,-0.311638,-1.667302,-1.823642,-1.680038,1.580470,177.705612,-1.861632,6.898606,1.315608,-1.085525,-5.474480,-1.913068,-1.113184,-0.820879,-0.721986,-0.105046,0.573232,-0.567043,-0.447164,-1.654838,-6.803239,-0.794338,-4.504619,-2.908429,-4.093875,-3.466304,-3.426859,-2.315266,-5.298508,-10.366847,-17.253376,-8.906028,-8.385869,-6.196990,-2.296948,-5.304315,-18.097126,-25.213401,1.869964,-2.902289,-1.899073,-1.705180,-1.426860,-2.510971,0.838146,0.526502,-0.782129,0.808493,-0.845322,-12.005751,-18.375311,-9.925110,-1.189432,-1.891818,-5.313697,-1.043915,-1.121079,-1.301175,-2.109128,-2.104007,2.245467,0.933534,-3.669234,0.044000,-3.064914,-3.341542,-2.857548,-0.249489,-0.592423,-0.582685,0.247260,7.506503,1.967544,0.566159,0.832930,-0.418475,-0.390811,-0.564865,0.433205,0.504496,-0.647795,-0.236603,-0.652715,-0.487510,-0.544541,0.332621,0.466587,0.523348};
1220  std::vector<float> bias = {-350.736300,1.530207,-9.805541,-1.676745,6.448848,-0.185940,-0.834116,1.642355,-0.557261,0.211599,-1.207916,-1.731354,-0.243328,-0.166474,0.338915,1.356859,-0.370182};
1221  return new Discrimination::NNFeedForwardVarDep(nodes,weights,bias);
1222  }
1223  default:
1224  {
1225  std::vector<unsigned int> nodes = {segmentationEntries[cSegType][segIdx],1};
1226  std::vector<float> weights(segmentationEntries[cSegType][segIdx],.01);
1227  std::vector<float> bias={0};
1228  return new Discrimination::NNFeedForwardVarDep(nodes, weights, bias);
1229  }
1230  }
1231  } else {
1232  std::vector<unsigned int> nodes = {100,1};
1233  std::vector<float> weights(100,1);
1234  std::vector<float> bias={0};
1235  return new Discrimination::NNFeedForwardVarDep(nodes, weights, bias);
1236  }
1237 }

◆ createPP()

template<typename procedure_t >
procedure_t * createPP ( SegmentationType  cSegType,
unsigned  segIdx = 0,
MSG::Level  lvl = MSG::INFO 
)

Create PP of t.

Definition at line 1024 of file testWrite.cxx.

1026 {
1028  return reinterpret_cast<procedure_t*>(new PreProcessing::Norm::Norm1VarDep);
1030  return reinterpret_cast<procedure_t*>(new PreProcessing::Norm::Norm2VarDep);
1032  return reinterpret_cast<procedure_t*>(new PreProcessing::Norm::SqrtVarDep);
1034  return reinterpret_cast<procedure_t*>(new PreProcessing::Norm::ConstantValueVarDep(123));
1036  return reinterpret_cast<procedure_t*>(new PreProcessing::Norm::MevToGevVarDep);
1038  auto seq = new PreProcessing::Norm::SequentialVarDep(100,.001);
1039  return reinterpret_cast<procedure_t*>(seq);
1042  std::vector<float>( segmentationEntries[cSegType][segIdx], 21 ),
1043  std::vector<float>( segmentationEntries[cSegType][segIdx], 61 )
1044  );
1045  return reinterpret_cast<procedure_t*>(std);
1047  auto minMax = new PreProcessing::Norm::MinMaxVarDep(
1048  std::vector<float>( segmentationEntries[cSegType][segIdx], 11 ),
1049  std::vector<float>( segmentationEntries[cSegType][segIdx], 92 )
1050  );
1051  return reinterpret_cast<procedure_t*>(minMax);
1052  } else {
1053  throw std::runtime_error(std::string("Unknown pre-processing type."));
1054  }
1055 }

◆ createPPWrapper()

template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency, SegmentationType segType>
IPreProcWrapper * createPPWrapper ( const char *  fileName,
const std::vector< float > &  etaDepBounderies = {0, 2.5},
const std::vector< float > &  etDepBounderies = {0, std::numeric_limits<float>::infinity()} 
)

Method dedicated for testing pre-processing wrapper creation.

Definition at line 746 of file testWrite.cxx.

749 {
750  // Typedef to make things easier
751  typedef RingerProcedureWrapper<procedure_t,
752  etaDependency,
753  etDependency,
754  segType> wrapper_t;
755 
756  typedef typename RingerProcedureType<procedure_t>::procEnum_t procEnum_t;
757 
758  msg << MSG::INFO << "Attempting to create a RingerProcedureWrapper<"
759  << toStr(procedure_t::template procType<procEnum_t>() )
761  << toStr(etaDependency) << ","
762  << toStr(etDependency) << ","
763  << toStr(segType) << "> with file name: " << fileName << "." << endmsg;
764 
765  unsigned etaDepProc = etaDepBounderies.size() - 1;
766  unsigned etDepProc = etDepBounderies.size() - 1;
767 
768  IPreProcWrapper *ret(nullptr);
769 
770  // Loop over variable dependencies
771  for ( unsigned uSegType = NoSegmentation;
772  uSegType < NSegmentations;
773  ++uSegType )
774  {
775  SegmentationType cSegType = static_cast<SegmentationType>(uSegType);
776  //if ( segType == SegmentationType::TrackCalPatTypeSegmentation ) {
777  // continue;
778  //}
779  for ( unsigned uEtaDep = EtaIndependent; uEtaDep <= EtaDependent; ++uEtaDep ){
780  EtaDependency etaDep = static_cast<EtaDependency>(uEtaDep);
781  for ( unsigned uEtDep = EtIndependent; uEtDep <= EtDependent; ++uEtDep ){
782  EtDependency etDep = static_cast<EtDependency>(uEtDep);
783 
784  // Change message level accondingly if we are creating correct wrapper
785  // type
787  if ( cSegType == segType &&
788  etaDep == etaDependency &&
789  etDep == etDependency )
790  {
791  lvl = MSG::INFO;
792  }
793 
794 
795  // The collection holder
796  typename wrapper_t::PPDepProcCollection ppCol(
797  numberOfSegments(cSegType),
798  std::vector< std::vector<procedure_t*> >(
799  etDepProc, std::vector<procedure_t*>(etaDepProc,
800  nullptr)));
801 
802  // Fill collection
803  for ( unsigned segDepIdx = 0; segDepIdx < numberOfSegments(cSegType); ++segDepIdx ){
804  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
805  // Get et bounderies:
806  float etMin(etDepBounderies[etDepIdx]),
807  etMax(etDepBounderies[etDepIdx+1]);
808  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
809  // Get eta bounderies:
810  float etaMin(etaDepBounderies[etaDepIdx]),
811  etaMax(etaDepBounderies[etaDepIdx+1]);
812 
813 
814  // Fill collection:
815  if (etaDep) {
816  if (etDep) {
817  ppCol[segDepIdx][etDepIdx][etaDepIdx] =
818  ppFactoryEtaEtDep<procedure_t>(cSegType,
819  segDepIdx,
820  etaMin,
821  etaMax,
822  etMin,
823  etMax,
824  MSG::VERBOSE);
825  } else {
826  ppCol[segDepIdx][etDepIdx][etaDepIdx] =
827  ppFactoryEtaDep<procedure_t>(cSegType,
828  segDepIdx,
829  etaMin,
830  etaMax,
831  MSG::VERBOSE);
832  }
833  } else {
834  if (etDep) {
835  ppCol[segDepIdx][etDepIdx][etaDepIdx] =
836  ppFactoryEtDep<procedure_t>(cSegType,
837  segDepIdx,
838  etMin,
839  etMax,
840  MSG::VERBOSE);
841  } else {
842  ppCol[segDepIdx][etDepIdx][etaDepIdx] =
843  ppFactoryDep<procedure_t>(cSegType,
844  segDepIdx,
845  MSG::VERBOSE);
846  }
847  }
848  }
849  }
850  } // Finished looping and filling collection
851 
852  // Attempt to create a wrapper with filled collection:
853  try {
854 
855  msg << lvl << "Attempting to create wrapper with ("
856  << toStr(segType) << "," << toStr(etaDep) << "," << toStr(etDep)
857  << ") pre-processing" << endmsg;
858 
859  //msg << lvl << ppCol << endmsg;
860 
861  // Create wrapper:
862  auto wrapper = new wrapper_t(ppCol);
863  // Use dummy message stream:
864  wrapper->setMsgStream(&msg);
865  // Print wrapper:
866  wrapper->print(MSG::DEBUG);
867 
868  // If it succeed, write it into file:
870  //IPreProcWrapperCollection ppWrapperCol = {wrapper};
871  //IPreProcWrapper::writeCol( ppWrapperCol, fileName );
872 
873  // We do not release memory for the wrapper, it will be given as a
874  // return parameter.
875  ret = wrapper;
876 
877  msg << lvl << "Succeed!" << endmsg;
878 
879  } catch (const std::runtime_error &e) {
880 
881  msg << MSG::VERBOSE << "Couldn't create wrapper. Reason: "
882  << e.what() << endmsg;
883 
884  // Release collection memory
885  for ( unsigned segDepIdx = 0; segDepIdx < numberOfSegments(cSegType); ++segDepIdx ){
886  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
887  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
888  delete ppCol[segDepIdx][etDepIdx][etaDepIdx];
889  ppCol[segDepIdx][etDepIdx][etaDepIdx] = nullptr;
890  }
891  }
892  }
893  } // Finished creating wrapper and handling possible errors
894 
895  }
896  }
897  } // Finished looping over segType/eta/et.
898  return ret;
899 }

◆ createRandomPP()

PreProcessing::IPreProcessorVarDep * createRandomPP ( SegmentationType  cSegType,
unsigned  segIdx = 0,
MSG::Level  lvl = MSG::INFO 
)

PP random factory.

Definition at line 971 of file testWrite.cxx.

974 {
975  static unsigned sequenceLoop = 0;
976  switch ( static_cast<PreProcessing::Type::PreProcessorTypes>(2+((sequenceLoop++)%7)) ) {
977  case PreProcessing::Type::Norm1:
978  msg << lvl << "Creating Norm1" << endmsg;
980  break;
981  case PreProcessing::Type::Norm2:
982  msg << lvl << "Creating Norm2" << endmsg;
984  break;
985  case PreProcessing::Type::Sqrt:
986  msg << lvl << "Creating Sqrt" << endmsg;
988  break;
989  case PreProcessing::Type::ConstantValue:
990  msg << lvl << "Creating ConstantValue" << endmsg;
992  break;
994  msg << lvl << "Creating Sequential" << endmsg;
995  return new PreProcessing::Norm::SequentialVarDep(100,.001);
996  break;
997  case PreProcessing::Type::Spherization:
998  {
999  msg << lvl << "Creating Spherization" << endmsg;
1001  std::vector<float>( segmentationEntries[cSegType][segIdx], 21 ),
1002  std::vector<float>( segmentationEntries[cSegType][segIdx], 61 )
1003  );
1004  return std;
1005  break;
1006  }
1007  case PreProcessing::Type::MinMax:
1008  {
1009  msg << lvl << "Creating MinMax" << endmsg;
1010  auto minMax = new PreProcessing::Norm::MinMaxVarDep(
1011  std::vector<float>( segmentationEntries[cSegType][segIdx], 11 ),
1012  std::vector<float>( segmentationEntries[cSegType][segIdx], 92 )
1013  );
1014  return minMax;
1015  break;
1016  }
1017  default:
1018  throw std::runtime_error(std::string( "Couldn't create pre-processing." ));
1019  }
1020 }

◆ createThres()

Discrimination::UniqueThresholdVarDep * createThres ( float  thresValue)

Definition at line 1408 of file testWrite.cxx.

1409 {
1410  return new Discrimination::UniqueThresholdVarDep(thresValue);
1411 }

◆ createThresWrapper()

template<typename procedure_t , EtaDependency etaDependency, EtDependency etDependency>
void createThresWrapper ( const char *  fileName,
const std::vector< float > &  etaDepBounderies = {0, 2.5},
const std::vector< float > &  etDepBounderies = {0, std::numeric_limits<float>::infinity()},
float  thresValue = 0 
)

Method dedicated for testing threshold wrapper creation.

Definition at line 1281 of file testWrite.cxx.

1285 {
1286  // Typedef to make things easier
1287  typedef RingerProcedureWrapper<procedure_t,
1288  etaDependency,
1289  etDependency> wrapper_t;
1290 
1291  typedef typename RingerProcedureType<procedure_t>::procEnum_t procEnum_t;
1292 
1293  msg << MSG::INFO << "Attempting to create a RingerProcedureWrapper<"
1294  << toStr(procedure_t::template procType<procEnum_t>() )
1296  << toStr(etaDependency) << ","
1297  << toStr(etDependency) << "> with file name: " << fileName << "." << endmsg;
1298 
1299  unsigned etaDepProc = etaDepBounderies.size() - 1;
1300  unsigned etDepProc = etDepBounderies.size() - 1;
1301 
1302  // Loop over variable dependencies
1303  for ( unsigned uEtaDep = EtaIndependent; uEtaDep <= EtaDependent; ++uEtaDep ){
1304  for ( unsigned uEtDep = EtIndependent; uEtDep <= EtDependent; ++uEtDep ){
1305  // The enumerations
1306  EtaDependency etaDep = static_cast<EtaDependency>(uEtaDep);
1307  EtDependency etDep = static_cast<EtDependency>(uEtDep);
1308 
1309  // Change message level accondingly if we are creating correct wrapper
1310  // type
1311  MSG::Level lvl(MSG::VERBOSE);
1312  if ( etaDep == etaDependency &&
1313  etDep == etDependency )
1314  {
1315  lvl = MSG::INFO;
1316  }
1317 
1318  // The collection holder
1319  typename wrapper_t::ThresDepProcCollection thresCol( etDepProc,
1320  std::vector<procedure_t*>(etaDepProc, nullptr));
1321 
1322  // Fill collection
1323  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
1324  // Get et bounderies:
1325  float etMin(etDepBounderies[etDepIdx]),
1326  etMax(etDepBounderies[etDepIdx+1]);
1327  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
1328  // Get eta bounderies:
1329  float etaMin(etaDepBounderies[etaDepIdx]),
1330  etaMax(etaDepBounderies[etaDepIdx+1]);
1331 
1332  // Fill collection:
1333  if (etaDep) {
1334  if (etDep) {
1335  thresCol[etDepIdx][etaDepIdx] = createEtaEtDepThres(
1336  etaMin,
1337  etaMax,
1338  etMin,
1339  etMax,
1340  thresValue);
1341  } else {
1342  thresCol[etDepIdx][etaDepIdx] = createEtaDepThres(
1343  etaMin,
1344  etaMax,
1345  thresValue);
1346  }
1347  } else {
1348  if (etDep) {
1349  thresCol[etDepIdx][etaDepIdx] = createEtDepThres(
1350  etMin,
1351  etMax,
1352  thresValue);
1353  } else {
1354  thresCol[etDepIdx][etaDepIdx] = createThres(thresValue);
1355  }
1356  }
1357  }
1358  } // Finished looping and filling collection
1359 
1360  // Attempt to create a wrapper with filled collection:
1361  try {
1362 
1363  msg << lvl << "Attempting to create wrapper with ("
1364  << toStr(etaDep) << "," << toStr(etDep) << ") discriminator"
1365  << endmsg;
1366 
1367  // Create wrapper:
1368  auto wrapper = new wrapper_t(thresCol);
1369 
1370  // Use dummy message stream:
1371  wrapper->setMsgStream(&msg);
1372  // Print wrapper:
1373  wrapper->print(MSG::DEBUG);
1374 
1375  // Delete file if it already exists:
1376  IOHelperFcns::deleteFile( fileName );
1377 
1378  // If it succeed, write it into file:
1379  //writeWrapperOnFile(*wrapper, fileName, MSG::VERBOSE);
1380  IThresWrapper::writeWrapper(wrapper, fileName);
1381 
1382  // Release wrapper memory:
1383  //wrapper->releaseMemory();
1384  //delete wrapper;
1385 
1386  msg << lvl << "Succeed!" << endmsg;
1387 
1388  } catch (const std::runtime_error &e) {
1389 
1390  msg << MSG::VERBOSE << "Couldn't create wrapper. Reason: "
1391  << e.what() << endmsg;
1392 
1393  // Release collection memory
1394  for ( unsigned etDepIdx = 0; etDepIdx < etDepProc; ++etDepIdx){
1395  for ( unsigned etaDepIdx = 0; etaDepIdx < etaDepProc; ++etaDepIdx){
1396  delete thresCol[etDepIdx][etaDepIdx];
1397  thresCol[etDepIdx][etaDepIdx] = nullptr;
1398  }
1399  }
1400  } // Finished creating wrapper and handling possible errors
1401 
1402  }
1403  } // Finished looping over eta/et.
1404 }

◆ main()

int main ( )

getCoefficientMap(label, EigenIdxList)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light
  2. EigenIdxList is user defined vector containing all eigenvector index that user interested in. output: Map of format map<string, map<string, float>> containing decomposition coefficient of the list of eigenvectors defined by EigenIdxList.

getCoefficients(label, evIdx)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light
  2. evIdx: The index of eigenvector user interested in. output value: vector of coefficient values. The order is the same as output given by getListOfOriginalNuisanceParameters()

getListOfOriginalNuisanceParameters(label)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light output value: List of original nuisance parameter names.

getNumEigenVectors(label)

input value:

  1. label: falvor label in std::string format, could be one of B, C, T, Light return value: number of eigen vectors used for chosen label. Return 0 if error occured.

Definition at line 220 of file testWrite.cxx.

220  {
221 
222 #if !defined(XAOD_STANDALONE) && !defined(RINGER_STANDALONE)
223  const float GeVf = GeV;
224 #endif
225 
226  msg.setLevel(MSG::DEBUG);
227 
228  // Eta and Et dependency bounderies:
229  const std::vector<float> etaIndepBounderies = {0, 2.5};
230  const std::vector<float> etaDepBounderies =
231  {0, .1, .6, 1.15, 1.37, 1.52, 1.81, 2.01, 2.37, 2.47, 2.5};
232 
233  const std::vector<float> etIndepBounderies = {0, std::numeric_limits<float>::infinity()};
234  const std::vector<float> etDepBounderies =
235 #if !defined(XAOD_STANDALONE) && !defined(RINGER_STANDALONE)
236  {0, 5*GeVf, 10*GeVf, 15*GeVf, 20*GeVf, 30*GeVf, 40*GeVf, 50*GeVf, 60*GeVf, 70*GeVf, 80*GeVf, //}
237 #else
238  {0, 5*1e3, 10*1e3, 15*1e3, 20*1e3, 30*1e3, 40*1e3, 50*1e3, 60*1e3, 70*1e3, 80*1e3,
239 #endif
240  std::numeric_limits<float>::infinity()};
241 
242  msg << MSG::INFO << BREAKER << endmsg;
243  msg << MSG::INFO << "Testing simple discriminator wrappers:" << endmsg;
244  msg << MSG::INFO << BREAKER << endmsg;
245 
246  // ----------------------------------------------------------------------------
247  // Write simple discriminator using interface (without using normalization)
248  // ----------------------------------------------------------------------------
249  // Create independent and non segmented wrapper.
250  // Test it allocating all possible permutations of eta/et dependency.
251  // No pre-processings available.
252  // Write it as "basicWrapper"
256  NoSegmentation >("basicWrapper.root");
257  msg << MSG::INFO << BREAKER << endmsg;
258 
259  // Create eta dependent and non segmented wrapper.
260  // Test it allocating all possible permutations of eta/et dependency.
261  // No pre-processings available.
262  // Write it as "basicEtaDepWrapper"
264  EtaDependent,
266  NoSegmentation >("basicEtaDepWrapper.root",
267  nullptr,
268  etaDepBounderies);
269  msg << MSG::INFO << BREAKER << endmsg;
270 
271  // Create Et dependent and non segmented wrapper.
272  // Test it allocating all possible permutations of eta/et dependency.
273  // No pre-processings available.
274  // Write it as "basicEtDepWrapper"
277  EtDependent,
278  NoSegmentation >("basicEtDepWrapper.root",
279  nullptr,
280  etaIndepBounderies,
281  etDepBounderies);
282  msg << MSG::INFO << BREAKER << endmsg;
283 
284  // Create eta, Et dependent and non segmented wrapper.
285  // Test it allocating all possible permutations of eta/et dependency.
286  // No pre-processings available.
287  // Write it as "basicEtDepWrapper"
289  EtaDependent,
290  EtDependent,
291  NoSegmentation >("basicEtaEtDepWrapper.root",
292  nullptr,
293  etaDepBounderies,
294  etDepBounderies);
295 
296  // Turn off the messages:
297  msg.setLevel(MSG::ERROR);
298  msg << MSG::INFO << BREAKER << endmsg;
299  msg << MSG::INFO << "Testing creation of badly configured wrappers:" << endmsg;
300  msg << MSG::INFO << BREAKER << endmsg;
301  // -------------------------- END --- END --- END -----------------------------
302 
303  // ----------------------------------------------------------------------------
304  // This block shoudln't work
305  // ----------------------------------------------------------------------------
306  // Create independent and non segmented wrapper.
307  // Test it allocating all possible permutations of eta/et dependency.
308  // No pre-processings available.
309  // It shouldn't be written because its eta size is different from unit.
313  NoSegmentation >("shouldntWrite.root",
314  nullptr,
315  etaDepBounderies);
316  msg << MSG::INFO << BREAKER << endmsg;
317 
318  // Create independent and non segmented wrapper.
319  // Test it allocating all possible permutations of eta/et dependency.
320  // No pre-processings available.
321  // It shouldn't be written because its eta size is different from unit.
325  NoSegmentation >("shouldntWrite.root",
326  nullptr,
327  etaIndepBounderies,
328  etDepBounderies);
329  msg.setLevel(MSG::DEBUG);
330  msg << MSG::INFO << BREAKER << endmsg;
331  msg << MSG::INFO << "Creating PP wrappers:" << endmsg;
332  msg << MSG::INFO << BREAKER << endmsg;
333  // ----------------------------------------------------------------------------
334 
335  // ----------------------------------------------------------------------------
336  // Start testing pre-processings
337  // ----------------------------------------------------------------------------
338  // Create eta, Et dependent and non segmented pp wrapper.
339  // Test it allocating all possible permutations of seg/eta/et dependency.
340  // No pre-processings available.
341  // Write it as "basicPPWrapper"
345  NoSegmentation >("basicPPWrapper.root");
346  msg << MSG::INFO << BREAKER << endmsg;
347 
348  auto *basicEtaDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
349  EtaDependent,
351  NoSegmentation >("basicEtaDepPPWrapper.root",
352  etaDepBounderies);
353  if (basicEtaDepPPWrapper) basicEtaDepPPWrapper->releaseMemory();
354  delete basicEtaDepPPWrapper;
355  msg << MSG::INFO << BREAKER << endmsg;
356 
357  auto *basicEtDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
359  EtDependent,
360  NoSegmentation >("basicEtDepPPWrapper.root",
361  etaIndepBounderies,
362  etDepBounderies);
363  if (basicEtDepPPWrapper) basicEtDepPPWrapper->releaseMemory();
364  delete basicEtDepPPWrapper;
365  msg << MSG::INFO << BREAKER << endmsg;
366 
367  auto *basicEtaEtDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
368  EtaDependent,
369  EtDependent,
370  NoSegmentation >("basicEtEtaDepPPWrapper.root",
371  etaDepBounderies,
372  etDepBounderies);
373  if (basicEtaEtDepPPWrapper) basicEtaEtDepPPWrapper->releaseMemory();
374  delete basicEtaEtDepPPWrapper;
375  msg << MSG::INFO << BREAKER << endmsg;
376 
377  auto *basicEtaEtTrackCalDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
378  EtaDependent,
379  EtDependent,
380  TrackCalSegmentation >("basicEtEtaTrackCalDepPPWrapper.root",
381  etaDepBounderies,
382  etDepBounderies);
383  if (basicEtaEtTrackCalDepPPWrapper) basicEtaEtTrackCalDepPPWrapper->releaseMemory();
384  delete basicEtaEtTrackCalDepPPWrapper;
385  msg << MSG::INFO << BREAKER << endmsg;
386 
387  auto *basicEtaEtTrackCalPatTypeDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
388  EtaDependent,
389  EtDependent,
390  TrackCalPatTypeSegmentation >("basicEtEtaTrackCalPatTypeDepPPWrapper.root",
391  etaDepBounderies,
392  etDepBounderies);
393  if (basicEtaEtTrackCalDepPPWrapper) basicEtaEtTrackCalPatTypeDepPPWrapper->releaseMemory();
394  delete basicEtaEtTrackCalPatTypeDepPPWrapper;
395  msg << MSG::INFO << BREAKER << endmsg;
396 
397  auto *basicEtaEtSectionDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
398  EtaDependent,
399  EtDependent,
400  TrackCalJointSections >("basicEtaEtSectionDepPPWrapper.root",
401  etaDepBounderies,
402  etDepBounderies);
403  if (basicEtaEtSectionDepPPWrapper) basicEtaEtSectionDepPPWrapper->releaseMemory();
404  delete basicEtaEtSectionDepPPWrapper;
405  msg << MSG::INFO << BREAKER << endmsg;
406 
407  auto *basicEtaEtLayerDepPPWrapper = createPPWrapper<PreProcessing::IPreProcessorVarDep,
408  EtaDependent,
409  EtDependent,
410  TrackCalJointLayers >("basicEtaEtLayerDepPPWrapper.root",
411  etaDepBounderies,
412  etDepBounderies);
413  msg << MSG::INFO << BREAKER << endmsg;
414 
415  auto *basicNorm1Wrapper = createPPWrapper<PreProcessing::Norm::Norm1VarDep,
418  NoSegmentation >("basicNorm1Wrapper.root");
419  msg << MSG::INFO << BREAKER << endmsg;
420 
421  auto *basicLayerDepNorm1Wrapper = createPPWrapper<PreProcessing::Norm::Norm1VarDep,
424  TrackCalJointLayers >("basicLayerDepNorm1Wrapper.root");
425  msg << MSG::INFO << BREAKER << endmsg;
426 
427  auto *basicNorm2Wrapper = createPPWrapper<PreProcessing::Norm::Norm2VarDep,
430  TrackCalJointLayers >("basicNorm2Wrapper.root");
431  if (basicNorm2Wrapper) basicNorm2Wrapper->releaseMemory();
432  delete basicNorm2Wrapper;
433  msg << MSG::INFO << BREAKER << endmsg;
434 
435  auto *basicSqrtWrapper = createPPWrapper<PreProcessing::Norm::SqrtVarDep,
438  NoSegmentation >("basicSqrtWrapper.root");
439  if (basicSqrtWrapper) basicSqrtWrapper->releaseMemory();
440  delete basicSqrtWrapper;
441  msg << MSG::INFO << BREAKER << endmsg;
442 
443  auto *basicConstantValueWrapper = createPPWrapper<PreProcessing::Norm::ConstantValueVarDep,
446  NoSegmentation >("basicConstantValueWrapper.root");
447  if (basicConstantValueWrapper) basicConstantValueWrapper->releaseMemory();
448  delete basicConstantValueWrapper;
449  msg << MSG::INFO << BREAKER << endmsg;
450 
451  auto *basicMevToGevWrapper = createPPWrapper<PreProcessing::Norm::MevToGevVarDep,
454  NoSegmentation >("basicMevToGevWrapper.root");
455  if (basicMevToGevWrapper) basicMevToGevWrapper->releaseMemory();
456  delete basicMevToGevWrapper;
457  msg << MSG::INFO << BREAKER << endmsg;
458 
459  auto *basicSequentialWrapper = createPPWrapper<PreProcessing::Norm::SequentialVarDep,
462  NoSegmentation >("basicSequentialWrapper.root");
463  if (basicSequentialWrapper) basicSequentialWrapper->releaseMemory();
464  delete basicSequentialWrapper;
465  msg << MSG::INFO << BREAKER << endmsg;
466 
467  auto *basicSpherizationWrapper = createPPWrapper<PreProcessing::Norm::SpherizationVarDep,
470  NoSegmentation >("basicSpherizationWrapper.root");
471  if (basicSpherizationWrapper) basicSpherizationWrapper->releaseMemory();
472  delete basicSpherizationWrapper;
473  msg << MSG::INFO << BREAKER << endmsg;
474 
475  auto *basicMinMaxWrapper = createPPWrapper<PreProcessing::Norm::MinMaxVarDep,
478  NoSegmentation >("basicMinMaxWrapper.root");
479  if (basicMinMaxWrapper) basicMinMaxWrapper->releaseMemory();
480  delete basicMinMaxWrapper;
481  // -------------------------- END --- END --- END -----------------------------
482 
483  msg << MSG::INFO << BREAKER << endmsg;
484  msg << MSG::INFO << "Creating discriminator with PP wrappers:" << endmsg;
485  msg << MSG::INFO << BREAKER << endmsg;
486 
487  // ----------------------------------------------------------------------------
488  // Write discriminators with pre-processings
489  // ----------------------------------------------------------------------------
490  // Create Eta, Et dependent and non segmented wrapper.
491  // Test it allocating all possible permutations of eta/et dependency.
492  // PP available {Unspecialized Norm1}.
493  // Write it as "randomNorm1DiscrWrapper.root"
494  IPreProcWrapperCollection randomNorm1PP = {basicPPWrapper};
496  EtaDependent,
497  EtDependent,
498  NoSegmentation >("randomNorm1PPDiscrWrapper.root",
499  &randomNorm1PP,
500  etaDepBounderies,
501  etDepBounderies);
502  msg << MSG::INFO << BREAKER << endmsg;
503 
504  // Create Eta, Et dependent and non segmented wrapper.
505  // Test it allocating all possible permutations of eta/et dependency.
506  // PP available {Unspecialized}.
507  // Write it as "randomDepPPrandomDepPP"
508  IPreProcWrapperCollection randomDepPPrandomDepPP = {
509  basicEtaEtLayerDepPPWrapper, basicEtaEtLayerDepPPWrapper
510  };
512  EtaDependent,
513  EtDependent,
514  NoSegmentation >("randomDepPPrandomDepPPDiscrWrapper.root",
515  &randomDepPPrandomDepPP,
516  etaDepBounderies,
517  etDepBounderies);
518  // ----------------------------------------------------------------------------
519 
520  msg << MSG::INFO << BREAKER << endmsg;
521  msg << MSG::INFO << "Creating segmented discriminator with PP wrappers:" << endmsg;
522  msg << MSG::INFO << BREAKER << endmsg;
523 
524  // ----------------------------------------------------------------------------
525  // Write segmented discriminators with pre-processings
526  // ----------------------------------------------------------------------------
527  // Create Eta, Et dependent and segmented wrapper.
528  // Test it allocating all possible permutations of eta/et dependency.
529  // PP available {Unspecialized Unspecialized}.
530  // Write it as "randomDepPPrandomDepPPDiscrSegmentedWrapper"
532  EtaDependent,
533  EtDependent,
534  TrackCalJointLayers >("randomDepPPrandomDepPPDiscrSegmentedWrapper.root",
535  &randomDepPPrandomDepPP,
536  etaDepBounderies,
537  etDepBounderies);
538  msg << MSG::INFO << BREAKER << endmsg;
539  // -------------------------- END --- END --- END -----------------------------
540 
541  msg << MSG::INFO << BREAKER << endmsg;
542  msg << MSG::INFO << "Creating specialized discriminator:" << endmsg;
543  msg << MSG::INFO << BREAKER << endmsg;
544 
545  // ----------------------------------------------------------------------------
546  // Write specialized discriminator wrapper with no pre-processings
547  // ----------------------------------------------------------------------------
548  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
551  NoSegmentation >("NNWrapper.root");
552  msg << MSG::INFO << BREAKER << endmsg;
553 
554  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
555  EtaDependent,
556  EtDependent,
557  TrackCalJointLayers >("FullDepNNWrapper.root",
558  {},
559  etaDepBounderies,
560  etDepBounderies);
561  // -------------------------- END --- END --- END -----------------------------
562 
563  msg << MSG::INFO << BREAKER << endmsg;
564  msg << MSG::INFO << "Creating specialized discriminator with PP wrappers:" << endmsg;
565  msg << MSG::INFO << BREAKER << endmsg;
566 
567  // ----------------------------------------------------------------------------
568  // Write specialized discriminator wrapper with specialized pre-processings
569  // ----------------------------------------------------------------------------
570  IPreProcWrapperCollection basicNorm1WrapperVec = {basicNorm1Wrapper};
571  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
574  NoSegmentation >("Norm1NNWrapper.root", &basicNorm1WrapperVec);
575  msg << MSG::INFO << BREAKER << endmsg;
576 
577  IPreProcWrapperCollection fullDepWrapperVec0 = {basicLayerDepNorm1Wrapper};
578  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
579  EtaDependent,
580  EtDependent,
581  TrackCalJointLayers >("Norm1FullDepNNWrapper.root",
582  &fullDepWrapperVec0,
583  etaDepBounderies,
584  etDepBounderies);
585  msg << MSG::INFO << BREAKER << endmsg;
586 
587  IPreProcWrapperCollection fullDepWrapperVec = {basicLayerDepNorm1Wrapper, basicLayerDepNorm1Wrapper};
588  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
589  EtaDependent,
590  EtDependent,
591  TrackCalJointLayers >("Norm1Norm1FullDepNNWrapper.root",
592  &fullDepWrapperVec,
593  etaDepBounderies,
594  etDepBounderies);
595  // -------------------------- END --- END --- END -----------------------------
596 
597  msg << MSG::INFO << BREAKER << endmsg;
598  msg << MSG::INFO << "Creating thresholds:" << endmsg;
599  msg << MSG::INFO << BREAKER << endmsg;
600 
601  // ----------------------------------------------------------------------------
602  // Write thresholds
603  // ----------------------------------------------------------------------------
606  EtIndependent >("basicThres.root");
607  msg << MSG::INFO << BREAKER << endmsg;
608 
610  EtaDependent,
611  EtIndependent >("basicEtaDepThres.root",
612  etaDepBounderies);
613  msg << MSG::INFO << BREAKER << endmsg;
614 
617  EtDependent >("basicEtDepThres.root",
618  etaIndepBounderies,
619  etDepBounderies);
620  msg << MSG::INFO << BREAKER << endmsg;
621 
623  EtaDependent,
624  EtDependent >("basicEtaEtDepThres.root",
625  etaDepBounderies,
626  etDepBounderies);
627  // -------------------------- END --- END --- END -----------------------------
628 
629  msg << MSG::INFO << BREAKER << endmsg;
630  msg << MSG::INFO << "Creating specialized thresholds:" << endmsg;
631  msg << MSG::INFO << BREAKER << endmsg;
632 
633  // ----------------------------------------------------------------------------
634  // Write specialized thresholds
635  // ----------------------------------------------------------------------------
636  createThresWrapper<Discrimination::UniqueThresholdVarDep,
638  EtIndependent >("uniqueThres.root");
639  msg << MSG::INFO << BREAKER << endmsg;
640 
641  createThresWrapper<Discrimination::UniqueThresholdVarDep,
642  EtaDependent,
643  EtIndependent >("uniqueEtaDepThres.root",
644  etaDepBounderies);
645  msg << MSG::INFO << BREAKER << endmsg;
646 
647  createThresWrapper<Discrimination::UniqueThresholdVarDep,
649  EtDependent >("uniqueEtDepThres.root",
650  etaIndepBounderies,
651  etDepBounderies);
652  msg << MSG::INFO << BREAKER << endmsg;
653 
654  createThresWrapper<Discrimination::UniqueThresholdVarDep,
655  EtaDependent,
656  EtDependent >("uniqueEtaEtDepThres.root",
657  etaDepBounderies,
658  etDepBounderies);
659  // -------------------------- END --- END --- END -----------------------------
660 
661 
662  // ----------------------------------------------------------------------------
663  // Creating test discrimination wrappers:
664  // ----------------------------------------------------------------------------
665  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
668  NoSegmentation >("ElectronRingerDiscrTestLoose.root", &basicNorm1WrapperVec);
669  msg << MSG::INFO << BREAKER << endmsg;
670 
671  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
674  NoSegmentation >("ElectronRingerDiscrTestMedium.root", &basicNorm1WrapperVec);
675  msg << MSG::INFO << BREAKER << endmsg;
676 
677  createDiscrWrapper<Discrimination::NNFeedForwardVarDep,
680  NoSegmentation >("ElectronRingerDiscrTestTight.root", &basicNorm1WrapperVec);
681  msg << MSG::INFO << BREAKER << endmsg;
682  // -------------------------- END --- END --- END -----------------------------
683 
684  // ----------------------------------------------------------------------------
685  // Creating test threshold wrappers:
686  // ----------------------------------------------------------------------------
687  createThresWrapper<Discrimination::UniqueThresholdVarDep,
689  EtIndependent >("ElectronRingerThresTestLoose.root",
690  etaIndepBounderies,
691  etIndepBounderies,
692  0.948 );
693  msg << MSG::INFO << BREAKER << endmsg;
694 
695  createThresWrapper<Discrimination::UniqueThresholdVarDep,
697  EtIndependent >("ElectronRingerThresTestMedium.root",
698  etaIndepBounderies,
699  etIndepBounderies,
700  0.2644 );
701  msg << MSG::INFO << BREAKER << endmsg;
702 
703  createThresWrapper<Discrimination::UniqueThresholdVarDep,
705  EtIndependent >("ElectronRingerThresTestTight.root",
706  etaIndepBounderies,
707  etIndepBounderies,
708  0.2826 );
709  // -------------------------- END --- END --- END -----------------------------
710 
711  msg << MSG::INFO << BREAKER << endmsg;
712  msg << MSG::INFO << "Finished!" << endmsg;
713  msg << MSG::INFO << BREAKER << endmsg;
714 
715  return 0;
716 }

◆ ppFactoryDep()

template<typename procedure_t >
procedure_t * ppFactoryDep ( SegmentationType  cSegType,
unsigned  segIdx = 0,
MSG::Level  lvl = MSG::INFO 
)

PP factory with segType dependency.

Definition at line 958 of file testWrite.cxx.

961 {
963  {
964  return reinterpret_cast<procedure_t*>(createRandomPP( cSegType, segIdx, lvl));
965  } else {
966  return createPP<procedure_t>( cSegType, segIdx, lvl );
967  }
968 }

◆ ppFactoryEtaDep()

template<typename procedure_t >
procedure_t * ppFactoryEtaDep ( SegmentationType  cSegType,
unsigned  segIdx,
float  etaMin,
float  etaMax,
MSG::Level  lvl 
)

PP factory with segType and eta dependency.

Definition at line 922 of file testWrite.cxx.

926 {
927  procedure_t* pp(nullptr);
929  {
930  pp = reinterpret_cast<procedure_t*>(createRandomPP(cSegType, segIdx, lvl));
931  } else {
932  pp = createPP<procedure_t>( cSegType, segIdx, lvl );
933  }
934  pp->setEtaDep(etaMin, etaMax);
935  return pp;
936 }

◆ ppFactoryEtaEtDep()

template<typename procedure_t >
procedure_t * ppFactoryEtaEtDep ( SegmentationType  cSegType,
unsigned  segIdx,
float  etaMin,
float  etaMax,
float  etMin,
float  etMax,
MSG::Level  lvl 
)

PP factory with segType, eta and et dependency.

Definition at line 903 of file testWrite.cxx.

908 {
909  procedure_t* pp(nullptr);
911  {
912  pp = reinterpret_cast<procedure_t*>(createRandomPP(cSegType, segIdx, lvl));
913  } else {
914  pp = createPP<procedure_t>( cSegType, segIdx, lvl );
915  }
916  pp->setEtaEtDep(etaMin, etaMax, etMin, etMax);
917  return pp;
918 }

◆ ppFactoryEtDep()

template<typename procedure_t >
procedure_t * ppFactoryEtDep ( SegmentationType  cSegType,
unsigned  segIdx,
float  etMin,
float  etMax,
MSG::Level  lvl 
)

PP factory with segType and et dependency.

Definition at line 940 of file testWrite.cxx.

944 {
945  procedure_t* pp(nullptr);
947  {
948  pp = reinterpret_cast<procedure_t*>(createRandomPP(cSegType, segIdx, lvl));
949  } else {
950  pp = createPP<procedure_t>( cSegType, segIdx, lvl );
951  }
952  pp->setEtDep(etMin, etMax);
953  return pp;
954 }

◆ writeWrapperOnFile()

void writeWrapperOnFile ( const IProcWrapperBase wrapper,
const char *  fileName,
MSG::Level  lvl 
)

Write wrapper to file.

Definition at line 719 of file testWrite.cxx.

721 {
722  msg << lvl << "Writing to file!" << endmsg;
723 
724  TFile wrapperFile(fileName, "RECREATE");
725  auto wrapperDir = wrapperFile.GetDirectory("");
726 
727  // Write wrapper on the file:
728  wrapper.write(wrapperDir, IOHelperFcns::makeIdxStr(0).c_str());
729 
730  if ( msg.level() <= lvl ){
731  wrapperDir->ls();
732  }
733 
734  // Write and close file
735  wrapperFile.Write();
736  wrapperFile.Close();
737 }

Variable Documentation

◆ msg

MsgStream& msg = __AsgRingerSel__.msg()

Definition at line 35 of file testWrite.cxx.

◆ segmentationEntries

std::vector< std::vector<unsigned> > segmentationEntries
Initial value:
=
{
{ 100 },
{ 100, (unsigned)(TrackPatternsHolder::numberOfPatterns()) },
{ 100, (unsigned)(TrackPatternsHolder::numberOfPatterns()), 10 },
{ 88, 12, (unsigned)(TrackPatternsHolder::numberOfPatterns()), 10 },
{ 8, 64, 8, 8, 4, 4, 4, (unsigned)(TrackPatternsHolder::numberOfPatterns()), 10 }
}

Definition at line 210 of file testWrite.cxx.

test_athena_ntuple_filter.seq
seq
filter configuration ## -> we use the special sequence 'AthMasterSeq' which is run before any other a...
Definition: test_athena_ntuple_filter.py:18
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Ringer::PreProcessing::Norm::Norm1VarDep
@ Usable normalizations:
Definition: Normalizations.h:312
GeV
#define GeV
Definition: PhysicsAnalysis/TauID/TauAnalysisTools/Root/HelperFunctions.cxx:17
createEtaDepThres
Discrimination::UniqueThresholdVarDep * createEtaDepThres(float etaMin, float etaMax, float thresValue)
Definition: testWrite.cxx:1414
createPPWrapper
IPreProcWrapper * createPPWrapper(const char *fileName, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()})
Method dedicated for testing pre-processing wrapper creation.
Definition: testWrite.cxx:746
Ringer::EtDependent
@ EtDependent
Definition: RingerSelectorToolsEnums.h:97
Ringer::TrackCalSegmentation
@ TrackCalSegmentation
Definition: RingerSelectorToolsEnums.h:66
Ringer::numberOfSegments
unsigned numberOfSegments(const SegmentationType e)
createEtDepNN
Discrimination::NNFeedForwardVarDep * createEtDepNN(SegmentationType cSegType, unsigned segIdx, float etMin, float etMax)
Creates eta independent, et dependent neural network.
Definition: testWrite.cxx:1253
createEtaEtDepThres
Discrimination::UniqueThresholdVarDep * createEtaEtDepThres(float etaMin, float etaMax, float etMin, float etMax, float thresValue)
Definition: testWrite.cxx:1434
Ringer::EtIndependent
@ EtIndependent
Definition: RingerSelectorToolsEnums.h:96
taskman.template
dictionary template
Definition: taskman.py:317
xAOD::etaMax
etaMax
Definition: HIEventShape_v2.cxx:46
Ringer::toStr
const char * toStr(SegmentationType e)
Transform enumeration types to string.
Ringer::TrackCalPatTypeSegmentation
@ TrackCalPatTypeSegmentation
Definition: RingerSelectorToolsEnums.h:67
createThres
Discrimination::UniqueThresholdVarDep * createThres(float thresValue)
Definition: testWrite.cxx:1408
athena.value
value
Definition: athena.py:124
Ringer::IRingerProcedureWrapperBase::write
virtual void write(TDirectory *baseDir, const char *idxStr="") const =0
Write collection to TDirectory.
Ringer::RingerProcedureType::procEnum_t
std::conditional< is_pre_processor, preProcEnum_t, typename std::conditional< is_discriminator, discrEnum_t, thresEnum_t >::type >::type procEnum_t
Definition: IRingerProcedure.h:204
Ringer::SegmentationType
SegmentationType
the possible procedure longitudinal segmentation types.
Definition: RingerSelectorToolsEnums.h:64
Ringer::IPreProcWrapperCollection
IPreProcWrapper::WrapperCollection IPreProcWrapperCollection
Facilitate access into Threshold Wrappers collection.
Definition: RingerPreProcessorWrapper.h:118
BREAKER
#define BREAKER
Definition: testWrite.cxx:42
xAOD::unsigned
unsigned
Definition: RingSetConf_v1.cxx:662
createEtaEtDepNN
Discrimination::NNFeedForwardVarDep * createEtaEtDepNN(SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax, float etMin, float etMax)
Creates eta dependent, et dependent neural network.
Definition: testWrite.cxx:1265
createThresWrapper
void createThresWrapper(const char *fileName, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()}, float thresValue=0)
Method dedicated for testing threshold wrapper creation.
Definition: testWrite.cxx:1281
Ringer::PreProcessing::Norm::ConstantValueVarDep
Use constant value as rings normalization factor.
Definition: Normalizations.h:365
createNN
Discrimination::NNFeedForwardVarDep * createNN(SegmentationType cSegType, unsigned segIdx)
Creates eta/et independent neural network.
Definition: testWrite.cxx:1210
Ringer::PreProcessing::Norm::MevToGevVarDep
Scale rings energy to GeV.
Definition: Normalizations.h:386
FortranAlgorithmOptions.fileName
fileName
Definition: FortranAlgorithmOptions.py:13
Ringer::EtaDependent
@ EtaDependent
Definition: RingerSelectorToolsEnums.h:83
TrigConf::MSGTC::Level
Level
Definition: Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:21
Ringer::PreProcessing::IPreProcessorVarDep
PreProcessor interface to be used by Ringer Wrapper.
Definition: IRingerProcedure.h:269
CheckAppliedSFs.e3
e3
Definition: CheckAppliedSFs.py:264
Ringer::NSegmentations
@ NSegmentations
Definition: RingerSelectorToolsEnums.h:70
Ringer::EtDependency
EtDependency
Specify et position dependency.
Definition: RingerSelectorToolsEnums.h:95
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Ringer::TrackCalJointLayers
@ TrackCalJointLayers
Definition: RingerSelectorToolsEnums.h:69
msg
MsgStream & msg
Definition: testWrite.cxx:35
Ringer::PreProcessing::Norm::SequentialVarDep
Use sequential normalization.
Definition: Normalizations.h:415
createEtDepThres
Discrimination::UniqueThresholdVarDep * createEtDepThres(float etMin, float etMax, float thresValue)
Definition: testWrite.cxx:1424
Ringer::IDiscrWrapperCollection
IDiscrWrapper::WrapperCollection IDiscrWrapperCollection
Facilitate access into Discrimination Wrappers.
Definition: RingerDiscriminatorWrapper.h:145
Ringer::IRingerProcedureWrapper< PreProcessing::IPreProcessor >
Definition: RingerPreProcessorWrapper.h:30
createRandomPP
PreProcessing::IPreProcessorVarDep * createRandomPP(SegmentationType cSegType, unsigned segIdx=0, MSG::Level lvl=MSG::INFO)
PP random factory.
Definition: testWrite.cxx:971
writeWrapperOnFile
void writeWrapperOnFile(const IProcWrapperBase &wrapper, const char *fileName, MSG::Level)
Write wrapper to file.
Definition: testWrite.cxx:719
Ringer::EtaDependency
EtaDependency
Specify eta position dependency.
Definition: RingerSelectorToolsEnums.h:81
createEtaDepNN
Discrimination::NNFeedForwardVarDep * createEtaDepNN(SegmentationType cSegType, unsigned segIdx, float etaMin, float etaMax)
Creates eta dependent, et independent neural network.
Definition: testWrite.cxx:1241
weights
Definition: herwig7_interface.h:44
Ringer::EtaIndependent
@ EtaIndependent
Definition: RingerSelectorToolsEnums.h:82
createDiscrWrapper
void createDiscrWrapper(const char *fileName, const IPreProcWrapperCollection *ppWrapper=nullptr, const std::vector< float > &etaDepBounderies={0, 2.5}, const std::vector< float > &etDepBounderies={0, std::numeric_limits< float >::infinity()})
Method dedicated for testing discriminator wrapper creation.
Definition: testWrite.cxx:1064
Ringer::PreProcessing::Norm::SpherizationVarDep
Normalize data to have zero mean and unitary standard deviation.
Definition: Normalizations.h:438
Ringer::TrackCalJointSections
@ TrackCalJointSections
Definition: RingerSelectorToolsEnums.h:68
LArCellBinning.etaMin
etaMin
Definition: LArCellBinning.py:84
segmentationEntries
std::vector< std::vector< unsigned > > segmentationEntries
Definition: testWrite.cxx:210
Ringer::PreProcessing::Norm::SqrtVarDep
Use SqrtVarDep of norm-1 as rings normalization factor.
Definition: Normalizations.h:347
Ringer::Discrimination::IThresholdVarDep
Threshold interface to be used by Ringer Wrapper.
Definition: IRingerProcedure.h:349
DEBUG
#define DEBUG
Definition: page_access.h:11
Ringer::Discrimination::IDiscriminatorVarDep
Discriminator interface to be used by Ringer Wrapper.
Definition: IRingerProcedure.h:311
Ringer::PreProcessing::Norm::Norm2VarDep
Use norm-2 as rings normalization factor.
Definition: Normalizations.h:329
Ringer::RingerProcedureWrapper
Specialization for Discriminator procedure.
Definition: RingerProcedureWrapper.h:171
Ringer::PreProcessing::Norm::MinMaxVarDep
Normalize data to be bounded within [-1,1] range.
Definition: Normalizations.h:461
DigiModel.Sequential
Sequential
Definition: DigiModel.py:32
python.Constants.VERBOSE
int VERBOSE
Definition: Control/AthenaCommon/python/Constants.py:14
Ringer::NoSegmentation
@ NoSegmentation
Definition: RingerSelectorToolsEnums.h:65