Belle II Software  release-08-01-10
SVDDatabaseImporter.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 // Own header.
10 #include <svd/calibration/SVDDatabaseImporter.h>
11 
12 // framework - Database
13 #include <framework/database/IntervalOfValidity.h>
14 #include <framework/database/DBImportObjPtr.h>
15 
16 // framework aux
17 #include <framework/logging/Logger.h>
18 
19 // wrapper objects
20 #include <mva/dataobjects/DatabaseRepresentationOfWeightfile.h>
21 
22 #include <boost/property_tree/ptree.hpp>
23 
24 #include <iostream>
25 #include <fstream>
26 #include <sstream>
27 
28 using namespace std;
29 using namespace Belle2;
30 using boost::property_tree::ptree;
31 
32 
33 void SVDDatabaseImporter::importSVDHitTimeNeuralNetwork(string fileName, bool threeSamples)
34 {
35  ifstream xml(fileName);
36  if (!xml.good()) {
37  B2RESULT("ERROR: File not found.\nNeural network from " << fileName << " could not be imported.");
38  return;
39  }
40  string label("SVDTimeNet_6samples");
41  if (threeSamples)
42  label = "SVDTimeNet_3samples";
43  stringstream buffer;
44  buffer << xml.rdbuf();
46  importObj.construct();
47  importObj->m_data = buffer.str();
48 
49  IntervalOfValidity iov(m_firstExperiment, m_firstRun,
50  m_lastExperiment, m_lastRun);
51  importObj.import(iov);
52  B2RESULT("Neural network from " << fileName << " successfully imported.");
53 }
bool import(const IntervalOfValidity &iov)
Import the object to database.
Definition: DBImportBase.cc:36
Class for importing a single object to the database.
void construct(Args &&... params)
Construct an object of type T in this DBImportObjPtr using the provided constructor arguments.
A class that describes the interval of experiments/runs for which an object in the database is valid.
Abstract base class for different kinds of events.