ATLAS Offline Software
Macros | Functions | Variables
testRead.cxx File Reference
#include <iostream>
#include <limits>
#include <TFile.h>
#include <THashList.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/cxx/remove_pointer.h"

Go to the source code of this file.

Macros

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

Functions

Ringer::AsgElectronRingerSelector __AsgRingerSel__ ("testRead")
 
template<class wrapper_t >
void readWrapperFromFile (wrapper_t *&wrapper, const char *fileName)
 Read first wrapper on file with type wrapper_t. More...
 
template<typename wrapperBase_t >
void readCollectionFromFile (const char *fileName)
 Read wrapper collection at file named fileName with base wrapper type wrapperBase_t. More...
 
template<>
void readCollectionFromFile< IThresWrapper > (const char *fileName)
 
int main ()
 

Variables

MsgStream & msg = __AsgRingerSel__.msg()
 

Macro Definition Documentation

◆ BREAKER

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

Definition at line 40 of file testRead.cxx.

◆ private

#define private   public

Definition at line 28 of file testRead.cxx.

◆ protected

#define protected   public

Definition at line 27 of file testRead.cxx.

Function Documentation

◆ __AsgRingerSel__()

Ringer::AsgElectronRingerSelector __AsgRingerSel__ ( "testRead"  )

◆ 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 68 of file testRead.cxx.

68  {
69 
70  // Change message level and greet user
71  msg.setLevel(MSG::DEBUG);
72 
73  msg << MSG::INFO << BREAKER << endmsg;
74  msg << MSG::INFO << "Reading discriminator using interface "
75  "without using normalization." << endmsg;
76  msg << MSG::INFO << BREAKER << endmsg;
77 
78  // ----------------------------------------------------------------------------
79  // Read simple discriminator using interface (without using normalization)
80  // ----------------------------------------------------------------------------
81  // Read "basicWrapperWrong" using correct template
85  NoSegmentation > *basicWrapper(nullptr);
87  typename Ringer::remove_pointer<decltype(basicWrapper)>::type
88  >( basicWrapper, "basicWrapper.root" );
89  msg << MSG::INFO << BREAKER << endmsg;
90 
91  // Read as "basicEtaDepWrapper" using correct template
95  NoSegmentation > *basicEtaDepWrapper(nullptr);
97  typename Ringer::remove_pointer<decltype(basicEtaDepWrapper)>::type
98  >( basicEtaDepWrapper, "basicEtaDepWrapper.root");
99  msg << MSG::INFO << BREAKER << endmsg;
100 
101  // Read "basicEtDepWrapper" using correct template
104  EtDependent,
105  NoSegmentation > *basicEtDepWrapper(nullptr);
107  typename Ringer::remove_pointer<decltype(basicEtDepWrapper)>::type
108  >( basicEtDepWrapper, "basicEtDepWrapper.root");
109  msg << MSG::INFO << BREAKER << endmsg;
110 
111  // Read "basicEtaEtDepWrapper.root" using correct template
113  EtaDependent,
114  EtDependent,
115  NoSegmentation > *basicEtaEtDepWrapper(nullptr);
117  typename Ringer::remove_pointer<decltype(basicEtaEtDepWrapper)>::type
118  >( basicEtaEtDepWrapper, "basicEtaEtDepWrapper.root");
119  // -------------------------- END --- END --- END -----------------------------
120 
121  msg.setLevel(MSG::ERROR);
122 
123  msg << MSG::INFO << BREAKER << endmsg;
124  msg << MSG::INFO << "Reading discriminator with wrong types!" << endmsg;
125  msg << MSG::INFO << BREAKER << endmsg;
126  // ----------------------------------------------------------------------------
127  // Read simple discriminator using interface with WRONG types
128  // ----------------------------------------------------------------------------
130  EtaDependent,
131  EtDependent,
132  NoSegmentation > *basicWrapperWrong(nullptr);
134  typename Ringer::remove_pointer<decltype(basicWrapperWrong)>::type
135  >( basicWrapperWrong, "basicWrapper.root" );
136  msg << MSG::INFO << BREAKER << endmsg;
137 
138  // Read as "basicEtaDepWrapperWrong" using wrong template
142  NoSegmentation > *basicEtaDepWrapperWrong(nullptr);
144  typename Ringer::remove_pointer<decltype(basicEtaDepWrapperWrong)>::type
145  >( basicEtaDepWrapperWrong, "basicEtaDepWrapper.root");
146  msg << MSG::INFO << BREAKER << endmsg;
147 
148  // Read "basicEtDepWrapperWrong" using wrong template
152  NoSegmentation > *basicEtDepWrapperWrong(nullptr);
154  typename Ringer::remove_pointer<decltype(basicEtDepWrapperWrong)>::type
155  >( basicEtDepWrapperWrong, "basicEtDepWrapper.root");
156  msg << MSG::INFO << BREAKER << endmsg;
157 
158  // Read "basicEtaEtDepWrapperWrong.root" using wrong template
160  EtaDependent,
161  EtDependent,
162  TrackCalJointLayers > *basicEtaEtDepWrapperWrong(nullptr);
164  typename Ringer::remove_pointer<decltype(basicEtaEtDepWrapperWrong)>::type
165  >( basicEtaEtDepWrapperWrong, "basicEtaEtDepWrapper.root");
166  // -------------------------- END --- END --- END -----------------------------
167  msg.setLevel(MSG::DEBUG);
168 
169  msg << MSG::INFO << BREAKER << endmsg;
170  msg << MSG::INFO << "Reading pre-processings!" << endmsg;
171  msg << MSG::INFO << BREAKER << endmsg;
172  // ----------------------------------------------------------------------------
173  // Start testing pre-processings
174  // ----------------------------------------------------------------------------
175  // Read "basicPPWrapper.root"
179  NoSegmentation > *basicPPWrapper(nullptr);
181  typename Ringer::remove_pointer<decltype(basicPPWrapper)>::type
182  >( basicPPWrapper, "basicPPWrapper.root");
183  msg << MSG::INFO << BREAKER << endmsg;
184 
185  // Read "basicEtaDepPPWrapper.root"
187  EtaDependent,
189  NoSegmentation > *basicEtaDepPPWrapper(nullptr);
191  typename Ringer::remove_pointer<decltype(basicEtaDepPPWrapper)>::type
192  >( basicEtaDepPPWrapper, "basicEtaDepPPWrapper.root");
193  msg << MSG::INFO << BREAKER << endmsg;
194 
195  // Read "basicEtDepPPWrapper.root"
198  EtDependent,
199  NoSegmentation > *basicEtDepPPWrapper(nullptr);
201  typename Ringer::remove_pointer<decltype(basicEtDepPPWrapper)>::type
202  >( basicEtDepPPWrapper, "basicEtDepPPWrapper.root");
203  msg << MSG::INFO << BREAKER << endmsg;
204 
205  // Read "basicEtEtaDepPPWrapper.root"
207  EtaDependent,
208  EtDependent,
209  NoSegmentation > *basicEtEtaDepPPWrapper(nullptr);
211  typename Ringer::remove_pointer<decltype(basicEtEtaDepPPWrapper)>::type
212  >( basicEtEtaDepPPWrapper, "basicEtEtaDepPPWrapper.root");
213  msg << MSG::INFO << BREAKER << endmsg;
214 
215  // Read "basicEtEtaTrackCalDepPPWrapper.root"
217  EtaDependent,
218  EtDependent,
219  TrackCalSegmentation > *basicEtEtaTrackCalDepPPWrapper(nullptr);
221  typename Ringer::remove_pointer<decltype(basicEtEtaTrackCalDepPPWrapper)>::type
222  >( basicEtEtaTrackCalDepPPWrapper, "basicEtEtaTrackCalDepPPWrapper.root");
223  msg << MSG::INFO << BREAKER << endmsg;
224 
225  // Read "basicEtEtaTrackCalPatTypeDepPPWrapper.root"
227  EtaDependent,
228  EtDependent,
229  TrackCalPatTypeSegmentation > *basicEtEtaTrackCalPatTypeDepPPWrapper(nullptr);
231  typename Ringer::remove_pointer<decltype(basicEtEtaTrackCalPatTypeDepPPWrapper)>::type
232  >( basicEtEtaTrackCalPatTypeDepPPWrapper, "basicEtEtaTrackCalPatTypeDepPPWrapper.root");
233  msg << MSG::INFO << BREAKER << endmsg;
234 
235  // Read "basicEtaEtSectionDepPPWrapper.root"
237  EtaDependent,
238  EtDependent,
239  TrackCalJointSections > *basicEtaEtSectionDepPPWrapper(nullptr);
241  typename Ringer::remove_pointer<decltype(basicEtaEtSectionDepPPWrapper)>::type
242  >( basicEtaEtSectionDepPPWrapper, "basicEtaEtSectionDepPPWrapper.root");
243  msg << MSG::INFO << BREAKER << endmsg;
244 
245  // Read "basicEtaEtLayerDepPPWrapper.root"
247  EtaDependent,
248  EtDependent,
249  TrackCalJointLayers > *basicEtaEtLayerDepPPWrapper(nullptr);
251  typename Ringer::remove_pointer<decltype(basicEtaEtLayerDepPPWrapper)>::type
252  >( basicEtaEtLayerDepPPWrapper, "basicEtaEtLayerDepPPWrapper.root");
253  msg << MSG::INFO << BREAKER << endmsg;
254 
255  // Read "basicNorm1Wrapper.root"
259  NoSegmentation > *basicNorm1Wrapper(nullptr);
261  typename Ringer::remove_pointer<decltype(basicNorm1Wrapper)>::type
262  >( basicNorm1Wrapper, "basicNorm1Wrapper.root");
263  msg << MSG::INFO << BREAKER << endmsg;
264 
265  // Read "basicNorm1Wrapper.root"
267  EtaDependent,
268  EtDependent,
269  TrackCalJointLayers > *basicLayerDepNorm1Wrapper(nullptr);
271  typename Ringer::remove_pointer<decltype(basicLayerDepNorm1Wrapper)>::type
272  >( basicLayerDepNorm1Wrapper, "basicLayerDepNorm1Wrapper.root");
273  msg << MSG::INFO << BREAKER << endmsg;
274 
275  // Read "basicNorm2Wrapper.root"
279  TrackCalJointLayers > *basicNorm2Wrapper(nullptr);
281  typename Ringer::remove_pointer<decltype(basicNorm2Wrapper)>::type
282  >( basicNorm2Wrapper, "basicNorm2Wrapper.root");
283  msg << MSG::INFO << BREAKER << endmsg;
284 
285  // Read "basicSqrtWrapper.root"
289  NoSegmentation > *basicSqrtWrapper(nullptr);
291  typename Ringer::remove_pointer<decltype(basicSqrtWrapper)>::type
292  >( basicSqrtWrapper, "basicSqrtWrapper.root");
293  msg << MSG::INFO << BREAKER << endmsg;
294 
295  // Read "basicConstantValueWrapper.root"
299  NoSegmentation > *basicConstantValueWrapper(nullptr);
301  typename Ringer::remove_pointer<decltype(basicConstantValueWrapper)>::type
302  >( basicConstantValueWrapper, "basicConstantValueWrapper.root");
303  msg << MSG::INFO << BREAKER << endmsg;
304 
305  // Read "basicMevToGevWrapper.root"
309  NoSegmentation > *basicMevToGevWrapper(nullptr);
311  typename Ringer::remove_pointer<decltype(basicMevToGevWrapper)>::type
312  >( basicMevToGevWrapper, "basicMevToGevWrapper.root");
313  msg << MSG::INFO << BREAKER << endmsg;
314 
315  // Read "basicSequentialWrapper.root"
319  NoSegmentation > *basicSequentialWrapper(nullptr);
321  typename Ringer::remove_pointer<decltype(basicSequentialWrapper)>::type
322  >( basicSequentialWrapper, "basicSequentialWrapper.root");
323  msg << MSG::INFO << BREAKER << endmsg;
324 
325  // Read "basicSpherizationWrapper.root"
329  NoSegmentation > *basicSpherizationWrapper(nullptr);
331  typename Ringer::remove_pointer<decltype(basicSpherizationWrapper)>::type
332  >( basicSpherizationWrapper, "basicSpherizationWrapper.root");
333  msg << MSG::INFO << BREAKER << endmsg;
334 
335  // Read "basicMinMaxWrapper.root"
339  NoSegmentation > *basicMinMaxWrapper(nullptr);
341  typename Ringer::remove_pointer<decltype(basicMinMaxWrapper)>::type
342  >( basicMinMaxWrapper, "basicMinMaxWrapper.root");
343  msg << MSG::INFO << BREAKER << endmsg;
344  // -------------------------- END --- END --- END -----------------------------
345 
346  msg << MSG::INFO << BREAKER << endmsg;
347  msg << MSG::INFO << "Reading discriminators with pre-processings!" << endmsg;
348  msg << MSG::INFO << BREAKER << endmsg;
349 
350  // ----------------------------------------------------------------------------
351  // Read discriminators with pre-processings
352  // ----------------------------------------------------------------------------
353  // Read "randomNorm1PPDiscrWrapper.root"
355  EtaDependent,
356  EtDependent,
357  NoSegmentation > *randomNorm1PPDiscrWrapper(nullptr);
359  typename Ringer::remove_pointer<decltype(randomNorm1PPDiscrWrapper)>::type
360  >( randomNorm1PPDiscrWrapper, "randomNorm1PPDiscrWrapper.root");
361  msg << MSG::INFO << BREAKER << endmsg;
362 
363  // Read "randomNorm1PPDiscrWrapper.root"
365  EtaDependent,
366  EtDependent,
367  NoSegmentation > *randomDepPPrandomDepPPDiscrWrapper(nullptr);
369  typename Ringer::remove_pointer<decltype(randomDepPPrandomDepPPDiscrWrapper)>::type
370  >( randomDepPPrandomDepPPDiscrWrapper, "randomDepPPrandomDepPPDiscrWrapper.root");
371  msg << MSG::INFO << BREAKER << endmsg;
372  // ----------------------------------------------------------------------------
373 
374  msg << MSG::INFO << BREAKER << endmsg;
375  msg << MSG::INFO << "Reading segmented discriminator PP wrappers:" << endmsg;
376  msg << MSG::INFO << BREAKER << endmsg;
377 
378  // ----------------------------------------------------------------------------
379  // Read segmented discriminators with pre-processings
380  // ----------------------------------------------------------------------------
381  // Read "randomDepPPrandomDepPPDiscrSegmentedWrapper.root"
383  EtaDependent,
384  EtDependent,
385  TrackCalJointLayers > *randomDepPPrandomDepPPDiscrSegmentedWrapper(nullptr);
387  typename Ringer::remove_pointer<decltype(randomDepPPrandomDepPPDiscrSegmentedWrapper)>::type
388  >( randomDepPPrandomDepPPDiscrSegmentedWrapper, "randomDepPPrandomDepPPDiscrSegmentedWrapper.root");
389  // -------------------------- END --- END --- END -----------------------------
390 
391  msg << MSG::INFO << BREAKER << endmsg;
392  msg << MSG::INFO << "Reading specialized discriminator:" << endmsg;
393  msg << MSG::INFO << BREAKER << endmsg;
394 
395  // ----------------------------------------------------------------------------
396  // Read specialized discriminator wrapper with no pre-processings
397  // ----------------------------------------------------------------------------
398  // Read "NNWrapper.root"
399  RingerProcedureWrapper<Discrimination::NNFeedForwardVarDep,
402  NoSegmentation > *NNWrapper(nullptr);
404  typename Ringer::remove_pointer<decltype(NNWrapper)>::type
405  >( NNWrapper, "NNWrapper.root");
406  msg << MSG::INFO << BREAKER << endmsg;
407 
408  // Read "NNWrapper.root"
409  RingerProcedureWrapper<Discrimination::NNFeedForwardVarDep,
410  EtaDependent,
411  EtDependent,
412  TrackCalJointLayers > *FullDepNNWrapper(nullptr);
414  typename Ringer::remove_pointer<decltype(FullDepNNWrapper)>::type
415  >( FullDepNNWrapper, "FullDepNNWrapper.root");
416  // -------------------------- END --- END --- END -----------------------------
417 
418  msg << MSG::INFO << BREAKER << endmsg;
419  msg << MSG::INFO << "Reading specialized discriminator with PP wrappers:" << endmsg;
420  msg << MSG::INFO << BREAKER << endmsg;
421 
422  // ----------------------------------------------------------------------------
423  // Read specialized discriminator wrapper with specialized pre-processings
424  // ----------------------------------------------------------------------------
425  // Read "Norm1NNWrapper.root"
426  RingerProcedureWrapper<Discrimination::NNFeedForwardVarDep,
429  NoSegmentation > *Norm1NNWrapper(nullptr);
431  typename Ringer::remove_pointer<decltype(Norm1NNWrapper)>::type
432  >( Norm1NNWrapper, "Norm1NNWrapper.root");
433  msg << MSG::INFO << BREAKER << endmsg;
434 
435  // Read "Norm1Norm1FullDepNNWrapper.root"
436  RingerProcedureWrapper<Discrimination::NNFeedForwardVarDep,
437  EtaDependent,
438  EtDependent,
439  TrackCalJointLayers > *Norm1Norm1FullDepNNWrapper(nullptr);
441  typename Ringer::remove_pointer<decltype(Norm1Norm1FullDepNNWrapper)>::type
442  >( Norm1Norm1FullDepNNWrapper, "Norm1Norm1FullDepNNWrapper.root");
443  // -------------------------- END --- END --- END -----------------------------
444 
445  msg << MSG::INFO << BREAKER << endmsg;
446  msg << MSG::INFO << "Reading threshold wrappers:" << endmsg;
447  msg << MSG::INFO << BREAKER << endmsg;
448 
449  // ----------------------------------------------------------------------------
450  // Read thresholds
451  // ----------------------------------------------------------------------------
452  // Read "basicThres.root"
455  EtIndependent > *basicThres(nullptr);
457  typename Ringer::remove_pointer<decltype(basicThres)>::type
458  >( basicThres, "basicThres.root");
459  msg << MSG::INFO << BREAKER << endmsg;
460 
461  // Read "basicEtaDepThres.root"
463  EtaDependent,
464  EtIndependent > *basicEtaDepThres(nullptr);
466  typename Ringer::remove_pointer<decltype(basicEtaDepThres)>::type
467  >( basicEtaDepThres, "basicEtaDepThres.root");
468  msg << MSG::INFO << BREAKER << endmsg;
469 
470  // Read "basicEtDepThres.root"
473  EtDependent > *basicEtDepThres(nullptr);
475  typename Ringer::remove_pointer<decltype(basicEtDepThres)>::type
476  >( basicEtDepThres, "basicEtDepThres.root");
477  msg << MSG::INFO << BREAKER << endmsg;
478 
479  // Read "basicEtaEtDepThres.root"
481  EtaDependent,
482  EtDependent > *basicEtaEtDepThres(nullptr);
484  typename Ringer::remove_pointer<decltype(basicEtaEtDepThres)>::type
485  >( basicEtaEtDepThres, "basicEtaEtDepThres.root");
486  // -------------------------- END --- END --- END -----------------------------
487 
488  msg << MSG::INFO << BREAKER << endmsg;
489  msg << MSG::INFO << "Reading specialized threshold wrappers:" << endmsg;
490  msg << MSG::INFO << BREAKER << endmsg;
491 
492  // ----------------------------------------------------------------------------
493  // Read speaclized thresholds
494  // ----------------------------------------------------------------------------
495  // Read "uniqueThres.root"
496  RingerProcedureWrapper<Discrimination::UniqueThresholdVarDep,
498  EtIndependent > *uniqueThres(nullptr);
500  typename Ringer::remove_pointer<decltype(uniqueThres)>::type
501  >( uniqueThres, "uniqueThres.root");
502  msg << MSG::INFO << BREAKER << endmsg;
503 
504  // Read "uniqueEtaDepThres.root"
505  RingerProcedureWrapper<Discrimination::UniqueThresholdVarDep,
506  EtaDependent,
507  EtIndependent > *uniqueEtaDepThres(nullptr);
509  typename Ringer::remove_pointer<decltype(uniqueEtaDepThres)>::type
510  >( uniqueEtaDepThres, "uniqueEtaDepThres.root");
511  msg << MSG::INFO << BREAKER << endmsg;
512 
513  // Read "uniqueEtDepThres.root"
514  RingerProcedureWrapper<Discrimination::UniqueThresholdVarDep,
516  EtDependent > *uniqueEtDepThres(nullptr);
518  typename Ringer::remove_pointer<decltype(uniqueEtDepThres)>::type
519  >( uniqueEtDepThres, "uniqueEtDepThres.root");
520  msg << MSG::INFO << BREAKER << endmsg;
521 
522  // Read "uniqueEtaEtDepThres.root"
523  RingerProcedureWrapper<Discrimination::UniqueThresholdVarDep,
524  EtaDependent,
525  EtDependent > *uniqueEtaEtDepThres(nullptr);
527  typename Ringer::remove_pointer<decltype(uniqueEtaEtDepThres)>::type
528  >( uniqueEtaEtDepThres, "uniqueEtaEtDepThres.root");
529  // -------------------------- END --- END --- END -----------------------------
530 
531 
532  msg << MSG::INFO << BREAKER << endmsg;
533  msg << MSG::INFO << "Special reading" << endmsg;
534  msg << MSG::INFO << BREAKER << endmsg;
535 
536  // ----------------------------------------------------------------------------
537  // Test reading multiple wrappers
538  // ----------------------------------------------------------------------------
539  readCollectionFromFile<IDiscrWrapper>("Norm1NNWrapper.root");
540  msg << MSG::INFO << BREAKER << endmsg;
541  readCollectionFromFile<IDiscrWrapper>("Norm1Norm1FullDepNNWrapper.root");
542  msg << MSG::INFO << BREAKER << endmsg;
543  readCollectionFromFile<IThresWrapper>("uniqueEtaEtDepThres.root");
544  // -------------------------- END --- END --- END -----------------------------
545 
546  msg << MSG::INFO << BREAKER << endmsg;
547  msg << MSG::INFO << "Finished!" << endmsg;
548  msg << MSG::INFO << BREAKER << endmsg;
549 
550  return 0;
551 }

◆ readCollectionFromFile()

template<typename wrapperBase_t >
void readCollectionFromFile ( const char *  fileName)

Read wrapper collection at file named fileName with base wrapper type wrapperBase_t.

Definition at line 623 of file testRead.cxx.

624 {
625 
626  msg << MSG::INFO << "Reading file: " << fileName << endmsg;
627 
628  // Get wrapper collection and read it:
629  typename wrapperBase_t::WrapperCollection col;
631 
632  unsigned counter(0);
633  for ( auto *wrapper : col ) {
634  if (wrapper){
635  msg << MSG::INFO << "Printing wrapper " << wrapper->fullName()
636  << " at position " << IOHelperFcns::makeIdxStr(counter++) << endmsg;
637  wrapper->setMsgStream(&msg);wrapper->print();
638  } else {
639  msg << MSG::ERROR << "Couldn't print wrapper on file " << fileName << endmsg;
640  }
641  }
642 
643  msg << MSG::INFO << "File configuration: " << endmsg;
644  AsgElectronRingerSelector::IOConfStruct ioConf;
645  AsgElectronRingerSelector::retrieveFileConf( fileName, ioConf );
646  AsgElectronRingerSelector::printConf(ioConf, &msg);
647 }

◆ readCollectionFromFile< IThresWrapper >()

template<>
void readCollectionFromFile< IThresWrapper > ( const char *  fileName)

Definition at line 651 of file testRead.cxx.

652 {
653 
654  msg << MSG::INFO << "Reading file: " << fileName << endmsg;
655 
656  // Get wrapper collection and read it:
657  IThresWrapper *wrapper;
658  IThresWrapper::read( wrapper, fileName );
659  if (wrapper) {wrapper->setMsgStream(&msg); wrapper->print();}
660  else msg << MSG::ERROR << "Couldn't print wrapper on file " << fileName << endmsg;
661 }

◆ readWrapperFromFile()

template<class wrapper_t >
void readWrapperFromFile ( wrapper_t *&  wrapper,
const char *  fileName 
)

Read first wrapper on file with type wrapper_t.

Definition at line 555 of file testRead.cxx.

556 {
557 
558  msg << MSG::INFO << "Reading wrapper: " << wrapper_t::staticFullName()
559  << ", at file named: " << fileName << endmsg;
560 
561  // Read file and bring everything to memory:
562  TFile wrapperFile(fileName, "READ");
563  wrapperFile.ReadAll();
564  TDirectory *baseDir = wrapperFile.GetDirectory("");
565 
566  std::shared_ptr<THashList> wrapperDirList(nullptr);
567  if ( !( wrapperDirList = IOHelperFcns::getDirList(baseDir) ) ) {
568  throw std::runtime_error(std::string("There are no directories available"));
569  }
570 
571  msg << MSG::INFO << "Number(s) of folder(s) within this TFile is "
572  << wrapperDirList->GetSize()
573  << endmsg;
574 
575  try {
576 
577  TIter iter( wrapperDirList.get() );
578  TDirectory* wrapperDir(nullptr);
579 
580  bool foundDir = false;
581 
582  while ( (wrapperDir = static_cast<TDirectoryFile*>(iter())) ){
583  if ( wrapperDir->GetName() ==
584  ( std::string(wrapper_t::wrapName) +
585  IOHelperFcns::makeIdxStr(0) ) )
586  {
587  msg << MSG::INFO << "Found directory named "
588  << wrapperDir->GetName() << endmsg;
589  foundDir = true;
590  break;
591  }
592  }
593 
594  if ( !foundDir ){
595  throw std::runtime_error(std::string("Couldn't find the wrapper directory"));
596  }
597 
598  wrapper = wrapper_t::read(wrapperDir,IOHelperFcns::version());
599 
600  if (wrapper == nullptr){
601  throw std::runtime_error(std::string("Returned void pointer."));
602  }
603 
604  // Use dummy message stream:
605  wrapper->setMsgStream(&msg);
606 
607  msg << MSG::INFO << "Printing wrapper " << endmsg;
608 
609  // to print wrapper information:
610  wrapper->print();
611 
612  } catch ( const std::runtime_error &e){
613  msg << MSG::ERROR << "Couldn't read due to error: "
614  << e.what() << endmsg;
615  }
616 
617  // Close file
618  wrapperFile.Close();
619 }

Variable Documentation

◆ msg

MsgStream& msg = __AsgRingerSel__.msg()

Definition at line 32 of file testRead.cxx.

read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
Ringer::PreProcessing::Norm::Norm1VarDep
@ Usable normalizations:
Definition: Normalizations.h:312
Ringer::EtDependent
@ EtDependent
Definition: RingerSelectorToolsEnums.h:97
Ringer::TrackCalSegmentation
@ TrackCalSegmentation
Definition: RingerSelectorToolsEnums.h:66
Ringer::EtIndependent
@ EtIndependent
Definition: RingerSelectorToolsEnums.h:96
readWrapperFromFile
void readWrapperFromFile(wrapper_t *&wrapper, const char *fileName)
Read first wrapper on file with type wrapper_t.
Definition: testRead.cxx:555
Ringer::TrackCalPatTypeSegmentation
@ TrackCalPatTypeSegmentation
Definition: RingerSelectorToolsEnums.h:67
Ringer::PreProcessing::Norm::ConstantValueVarDep
Use constant value as rings normalization factor.
Definition: Normalizations.h:365
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
Ringer::PreProcessing::IPreProcessorVarDep
PreProcessor interface to be used by Ringer Wrapper.
Definition: IRingerProcedure.h:269
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
Ringer::TrackCalJointLayers
@ TrackCalJointLayers
Definition: RingerSelectorToolsEnums.h:69
readCollectionFromFile< IThresWrapper >
void readCollectionFromFile< IThresWrapper >(const char *fileName)
Definition: testRead.cxx:651
Ringer::PreProcessing::Norm::SequentialVarDep
Use sequential normalization.
Definition: Normalizations.h:415
msg
MsgStream & msg
Definition: testRead.cxx:32
BREAKER
#define BREAKER
Definition: testRead.cxx:39
query_example.col
col
Definition: query_example.py:7
Ringer::EtaIndependent
@ EtaIndependent
Definition: RingerSelectorToolsEnums.h:82
get_generator_info.version
version
Definition: get_generator_info.py:33
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
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
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
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
test_pyathena.counter
counter
Definition: test_pyathena.py:15
Ringer::NoSegmentation
@ NoSegmentation
Definition: RingerSelectorToolsEnums.h:65