Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mergeCDBTTrees.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file mergeCDBTTrees.C
1 #include <GlobalVariables.C>
2 #include <cdbobjects/CDBTTree.h> // for CDBTTree
4 #include <phool/recoConsts.h>
5 #include "TowerInfo.h"
6 #include "TowerInfoDefs.h"
7 
8 R__LOAD_LIBRARY(libLiteCaloEvalTowSlope.so)
9 
10 R__LOAD_LIBRARY(libcdbobjects)
11 R__LOAD_LIBRARY(libphool.so)
12 R__LOAD_LIBRARY(libcalo_reco.so)
13 R__LOAD_LIBRARY(libcalo_io.so)
14 
15 void mergeCDBTTrees(const char * infile1, const char * infile2, const char * outputfile)
16 {
17 
18  CDBTTree *cdbttree1 = new CDBTTree(infile1);
19  CDBTTree *cdbttree2 = new CDBTTree(infile2);
20  CDBTTree *cdbttreeOut = new CDBTTree(outputfile);
21 
22  string m_fieldname = "Femc_datadriven_qm1_correction";
23 
24  for(int i = 0; i < 96 ; i++)
25  {
26  for(int j = 0; j < 256; j++)
27  {
28  unsigned int key = TowerInfoDefs::encode_emcal(i,j);
29  float val1 = cdbttree1->GetFloatValue(key, m_fieldname);
30  float val2 = cdbttree2->GetFloatValue(key, m_fieldname);
31  cdbttreeOut->SetFloatValue(key,m_fieldname,val1*val2);
32  }
33  }
34 
35  cdbttreeOut->Commit();
36  cdbttreeOut->WriteCDBTTree();
37  delete cdbttreeOut;
38  delete cdbttree1;
39  delete cdbttree2;
40 
41 }//end macro