Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:23:58

0001 #include <cdbobjects/CDBTTree.h>
0002 #include <tpc/TpcMap.h>
0003 
0004 
0005 #include <Rtypes.h>  // resolves R__LOAD_LIBRARY for clang-tidy
0006 #include <TSystem.h>
0007 
0008 #include <iostream>
0009 
0010 R__LOAD_LIBRARY(libcdbobjects.so)
0011 R__LOAD_LIBRARY(libtpc.so)
0012 
0013 
0014 void TestCDBTTreeTPC(const std::string &fname = "./PadPlane/TPCPadPlaneCDBTTree.root")
0015 {
0016   TpcMap M;
0017   // To use the latest CSV files the path should be directly 
0018   // from the default CDBTTree directory used in TpcMap to files, 
0019   // otherwise the default CSV Files are used 
0020   M.setMapNames("/sphenix/user/shulga/Work/TPCPadPlaneMapping/macros/calibrations/tpc/PadPlane/AutoPad-R1-RevA.sch.ChannelMapping.csv", 
0021                 "/sphenix/user/shulga/Work/TPCPadPlaneMapping/macros/calibrations/tpc/PadPlane/AutoPad-R2-RevA-Pads.sch.ChannelMapping.csv", 
0022                 "/sphenix/user/shulga/Work/TPCPadPlaneMapping/macros/calibrations/tpc/PadPlane/AutoPad-R3-RevA.sch.ChannelMapping.csv");
0023 
0024 
0025   CDBTTree *cdbttree = new CDBTTree(fname);
0026 
0027   int Nfee = 26;
0028   int Nch = 256;
0029   for(int f=0;f<Nfee;f++){
0030     for(int ch=0;ch<Nch;ch++){
0031       int layer = M.getLayer(f, ch);
0032       int padN = M.getPad(f, ch);
0033       double padR = M.getR(f, ch);
0034       if (f==5 && ch==30){std::cout<<"layer="<<layer<<" padR="<<padR<<std::endl;}
0035       double padPhi = M.getPhi(f, ch);
0036       // int mod = 0;
0037       // if(f>5) mod = 1;
0038       // if(f>15) mod =2;
0039       unsigned int key = 256 * (f) + ch;
0040       std::string varname = "layer";// + std::to_string(key);
0041       cdbttree->SetIntValue(key,varname,layer);
0042       varname = "fee";// + std::to_string(key);
0043       cdbttree->SetIntValue(key,varname,f);
0044       varname = "ch";// + std::to_string(key);
0045       cdbttree->SetIntValue(key,varname,ch);
0046       varname = "R";// + std::to_string(key);
0047       cdbttree->SetDoubleValue(key,varname,padR);
0048       varname = "phi";// + std::to_string(key);
0049       cdbttree->SetDoubleValue(key,varname,padPhi);
0050       varname = "pad";// + std::to_string(key);
0051       cdbttree->SetIntValue(key,varname,padN);
0052 
0053     }
0054   }
0055 
0056   std::cout<<"cdbttree->Commit();"<<std::endl;
0057   cdbttree->Commit();
0058   std::cout<<"cdbttree->Print();"<<std::endl;
0059   //cdbttree->Print();
0060   std::cout<<"cdbttree->WriteCDBTTree()"<<std::endl;
0061   cdbttree->WriteCDBTTree();
0062 
0063   std::cout<<"delete cdbttree;"<<std::endl;
0064   delete cdbttree;
0065   //delete M;
0066   std::cout<<"gSystem->Exit(0);"<<std::endl;
0067 
0068   gSystem->Exit(0);
0069 }