9 #include <framework/database/DBObjPtr.h>
10 #include <framework/database/DBStore.h>
11 #include <framework/datastore/StoreObjPtr.h>
12 #include <framework/datastore/DataStore.h>
13 #include <framework/dataobjects/EventMetaData.h>
14 #include <framework/database/Configuration.h>
15 #include <ecl/dbobjects/ECLCrystalCalib.h>
25 void setupDatabase(
int exp,
int run,
int eventNr = 1)
32 std::cout <<
"about to construct EventMetaData, exp = " << exp <<
" run = " << run <<
" eventNr = " << eventNr << std::endl;
41 int main(
int argc,
char** argv)
43 if (argc < 4 || argc > 5) {
44 std::cout <<
"incorrect number of arguments for eclDumpECLCrystalCalib" << std::endl;
47 std::string payloadName = argv[1];
48 std::string gtName = argv[2];
49 int experiment = std::stoi(argv[3]);
50 int run = std::stoi(argv[4]);
51 std::cout <<
"eclDumpECLCrystalCalib called with arguments " << payloadName <<
" " << gtName <<
" " << experiment <<
" " << run <<
58 conf.prependGlobalTag(gtName);
59 conf.prependTestingPayloadLocation(
"localdb/database.txt");
62 std::cout <<
"calling setupDatabase " << std::endl;
63 setupDatabase(experiment, run);
68 std::cout <<
"Dumping " << payloadName << std::endl;
69 existingObject->Dump();
72 std::vector<float> currentValues = existingObject->getCalibVector();
73 std::vector<float> currentUnc = existingObject->getCalibUncVector();
76 std::cout << std::endl <<
"Values read from database " << std::endl;
77 for (
int ic = 0; ic < 9000; ic += 1000) {
78 std::cout <<
"cellID " << ic + 1 <<
" " << currentValues[ic] <<
" +/- " << currentUnc[ic] << std::endl;
80 std::cout << std::endl;
82 TString payloadTitle = payloadName;
84 payloadTitle += experiment;
87 TString fname = payloadTitle;
89 TFile hfile(fname,
"recreate");
90 TString htitle = payloadTitle;
91 htitle +=
" values;cellID";
92 TH1F* existingPayload =
new TH1F(
"existingPayload", htitle, 8736, 1, 8737);
94 for (
int cellID = 1; cellID <= 8736; cellID++) {
95 existingPayload->SetBinContent(cellID, currentValues[cellID - 1]);
96 existingPayload->SetBinError(cellID, currentUnc[cellID - 1]);
102 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.
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.
Abstract base class for different kinds of events.
int main(int argc, char **argv)
Run all tests.