10#include <ecl/dataobjects/ECLElementNumbers.h>
11#include <ecl/dbobjects/ECLCrystalCalib.h>
14#include <framework/database/Configuration.h>
15#include <framework/database/DBObjPtr.h>
16#include <framework/database/DBStore.h>
17#include <framework/dataobjects/EventMetaData.h>
18#include <framework/datastore/DataStore.h>
19#include <framework/datastore/StoreObjPtr.h>
33 void setupDatabase(
int exp,
int run,
int eventNr = 1)
40 std::cout <<
"about to construct EventMetaData, exp = " << exp <<
" run = " << run <<
" eventNr = " << eventNr << std::endl;
49int main(
int argc,
char** argv)
51 if (argc < 4 || argc > 5) {
52 std::cout <<
"incorrect number of arguments for eclDumpECLCrystalCalib" << std::endl;
55 std::string payloadName = argv[1];
56 std::string gtName = argv[2];
57 int experiment = std::stoi(argv[3]);
58 int run = std::stoi(argv[4]);
59 std::cout <<
"eclDumpECLCrystalCalib called with arguments " << payloadName <<
" " << gtName <<
" " << experiment <<
" " << run <<
66 conf.prependGlobalTag(gtName);
67 conf.prependTestingPayloadLocation(
"localdb/database.txt");
70 std::cout <<
"calling setupDatabase " << std::endl;
71 setupDatabase(experiment, run);
76 std::cout <<
"Dumping " << payloadName << std::endl;
77 existingObject->Dump();
80 std::vector<float> currentValues = existingObject->getCalibVector();
81 std::vector<float> currentUnc = existingObject->getCalibUncVector();
84 std::cout << std::endl <<
"Values read from database " << std::endl;
85 for (
int ic = 0; ic < 9000; ic += 1000) {
86 std::cout <<
"cellID " << ic + 1 <<
" " << currentValues[ic] <<
" +/- " << currentUnc[ic] << std::endl;
88 std::cout << std::endl;
90 TString payloadTitle = payloadName;
92 payloadTitle += experiment;
95 TString fname = payloadTitle;
97 TFile hfile(fname,
"recreate");
98 TString htitle = payloadTitle;
99 htitle +=
" values;cellID";
103 existingPayload->SetBinContent(cellID, currentValues[cellID - 1]);
104 existingPayload->SetBinError(cellID, currentUnc[cellID - 1]);
110 std::cout << std::endl <<
"Values written to " << fname << std::endl;
static Configuration & getInstance()
Get a reference to the instance which will be used when the Database is initialized.
Class for accessing objects in the database.
Singleton class to cache database objects.
static DataStore & Instance()
Instance of singleton Store.
void setInitializeActive(bool active)
Setter for m_initializeActive.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
Type-safe access to single objects in the data store.
bool construct(Args &&... params)
Construct an object of type T in this StoreObjPtr, using the provided constructor arguments.
static DBStore & Instance()
Instance of a singleton DBStore.
void updateEvent()
Updates all intra-run dependent objects.
void update()
Updates all objects that are outside their interval of validity.
const int c_NCrystals
Number of crystals.
Abstract base class for different kinds of events.