25 gPARMS->SetDefaultParameter(
"DIRC_LUT", lut_file,
"DIRC LUT root file (will eventually be moved to resource)");
28 map<string,string> lut_map_name;
29 jcalib = japp->GetJCalibration(run_number);
30 if(jcalib->GetCalib(
"/DIRC/LUT/lut_map", lut_map_name))
31 jout <<
"Can't find requested /DIRC/LUT/lut_map in CCDB for this run!" << endl;
32 else if(lut_map_name.find(
"map_name") != lut_map_name.end() && lut_map_name[
"map_name"] !=
"None") {
33 jresman = japp->GetJResourceManager(run_number);
34 lut_file = jresman->GetResource(lut_map_name[
"map_name"]);
38 if(!lut_file.empty()) {
39 jout<<
"Reading DIRC LUT TTree from "<<lut_file<<
" ..."<<endl;
41 auto saveDir = gDirectory;
42 TFile *fLut =
new TFile(lut_file.c_str());
43 if( !fLut->IsOpen() ){
44 jerr <<
"Unable to open " << lut_file <<
"!!" << endl;
47 TTree *tLut=(TTree*) fLut->Get(
"lut_dirc_flat");
49 jerr <<
"Unable find TTree lut_dirc_flat in " << lut_file <<
"!!" << endl;
53 vector<Float_t> *LutPixelAngleX[luts];
54 vector<Float_t> *LutPixelAngleY[luts];
55 vector<Float_t> *LutPixelAngleZ[luts];
56 vector<Float_t> *LutPixelTime[luts];
57 vector<Long64_t> *LutPixelPath[luts];
60 for(
int l=0; l<luts; l++){
61 LutPixelAngleX[l] = 0;
62 LutPixelAngleY[l] = 0;
63 LutPixelAngleZ[l] = 0;
68 for(
int l=0; l<luts; l++){
69 tLut->SetBranchAddress(Form(
"LUT_AngleX_%d",l),&LutPixelAngleX[l]);
70 tLut->SetBranchAddress(Form(
"LUT_AngleY_%d",l),&LutPixelAngleY[l]);
71 tLut->SetBranchAddress(Form(
"LUT_AngleZ_%d",l),&LutPixelAngleZ[l]);
72 tLut->SetBranchAddress(Form(
"LUT_Time_%d",l),&LutPixelTime[l]);
73 tLut->SetBranchAddress(Form(
"LUT_Path_%d",l),&LutPixelPath[l]);
77 for(
int i=0; i<tLut->GetEntries(); i++) {
80 for(
int l=0; l<luts; l++){
81 for(uint j=0; j<LutPixelAngleX[l]->size(); j++) {
82 TVector3 angle(LutPixelAngleX[l]->at(j), LutPixelAngleY[l]->at(j), LutPixelAngleZ[l]->at(j));
83 lutNodeAngle[l][i].push_back(angle);
84 lutNodeTime[l][i].push_back(LutPixelTime[l]->at(j));
85 lutNodePath[l][i].push_back(LutPixelPath[l]->at(j));
103 return lutNodeAngle[bar][pixel].size();
108 return lutNodeTime[bar][pixel].size();
113 return lutNodePath[bar][pixel].size();
118 return lutNodeAngle[bar][pixel].at(entry);
123 return lutNodeTime[bar][pixel].at(entry);
128 return lutNodePath[bar][pixel].at(entry);
TVector3 GetLutPixelAngle(int bar, int pixel, int entry) const
uint GetLutPixelAngleSize(int bar, int pixel) const
Long64_t GetLutPixelPath(int bar, int pixel, int entry) const
Float_t GetLutPixelTime(int bar, int pixel, int entry) const
uint GetLutPixelPathSize(int bar, int pixel) const
virtual ~DDIRCLutReader()
DDIRCLutReader(JApplication *japp, unsigned int run_number)
uint GetLutPixelTimeSize(int bar, int pixel) const