Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-18 09:14:30

0001 #include <cdbobjects/CDBTTree.h>
0002 
0003 R__LOAD_LIBRARY(libcdbobjects.so)
0004 
0005 void readhcalcalib(){
0006   ofstream ohcal_precalib_file("script/ohcal_precalib.txt", std::ios::trunc);
0007   ofstream ihcal_precalib_file("script/ihcal_precalib.txt", std::ios::trunc);
0008 
0009   CDBTTree *cdbttree_ohcal = new CDBTTree("ohcal_precalib.root");
0010   CDBTTree *cdbttree_ihcal = new CDBTTree("ihcal_precalib.root");
0011   if (!cdbttree_ohcal){
0012     std::cout << "ohcal CDBTTree not found!" << std::endl;
0013     return;
0014   }
0015   if (!cdbttree_ihcal){
0016     std::cout << "ihcal CDBTTree not found!" << std::endl;
0017     return;
0018   }
0019 
0020   for(int ieta = 0; ieta<24;ieta++){
0021     for(int iphi = 0; iphi<64; iphi++){
0022       //int towerid = ieta*64+iphi;
0023       int towerid = iphi + (ieta << 16U);
0024       float ihcalcalib = cdbttree_ihcal->GetFloatValue(towerid,"HCALIN_calib_ADC_to_ETower");
0025       float ohcalcalib = cdbttree_ohcal->GetFloatValue(towerid,"HCALOUT_calib_ADC_to_ETower");
0026       //replace this
0027       ihcal_precalib_file << ieta << " " << iphi << " " << ihcalcalib << std::endl;
0028       ohcal_precalib_file << ieta << " " << iphi << " " << ohcalcalib << std::endl;
0029     }
0030   }
0031   
0032 }