12 #include "TProfile2D.h"
18 ISvcLocator * pSvcLocator) :
34 TFile* theLCOutOfClusterFile =
new TFile(
file.c_str());
35 if ( !theLCOutOfClusterFile ) {
36 return StatusCode::FAILURE;
41 TList * theKeyList = theLCOutOfClusterFile->GetListOfKeys();
42 while ( theKeyList->GetEntries() ) {
43 TProfile2D * prof = (TProfile2D *)theLCOutOfClusterFile->Get(theKeyList->First()->GetTitle());
45 std::string sTitle(prof->GetTitle());
48 std::vector<std::string>
keys;
49 keys.emplace_back(
"_iside_");
50 keys.emplace_back(
"_iphi_");
51 keys.emplace_back(
"_ilogE_");
53 std::vector<std::string>
names;
54 names.emplace_back(
"side");
55 names.emplace_back(
"phi");
56 names.emplace_back(
"log10(E_clus (MeV))");
57 names.emplace_back(prof->GetXaxis()->GetTitle());
58 names.emplace_back(prof->GetYaxis()->GetTitle());
60 std::vector<int> types;
67 std::vector<int> ibin(
names.size(),-1);
68 std::vector<double> rmin(
names.size(),-1);
69 std::vector<double> rmax(
names.size(),-1);
70 std::vector<int> nbin(
names.size(),-1);
73 for (idim=0;idim<
keys.size();idim++) {
75 if (
found == std::string::npos ) {
81 std::istringstream tstr(sTitle.substr(
found+
keys[idim].length()));
82 tstr >> ibin[idim] >>
c >>
c >> rmin[idim] >>
c >> rmax[idim] >>
c >> nbin[idim];
83 if ( ibin[idim] < 0 || ibin[idim] >= nbin[idim] ) {
84 ATH_MSG_ERROR(
"Found invalid bin number " << ibin[idim] <<
" not in valid range [0," << nbin[idim] <<
" in current histogram." );
91 nbin[
names.size()-2] = prof->GetNbinsX();
92 rmin[
names.size()-2] = prof->GetXaxis()->GetXmin();
93 rmax[
names.size()-2] = prof->GetXaxis()->GetXmax();
94 nbin[
names.size()-1] = prof->GetNbinsY();
95 rmin[
names.size()-1] = prof->GetYaxis()->GetXmin();
96 rmax[
names.size()-1] = prof->GetYaxis()->GetXmax();
99 for (idim = 0;idim<
names.size();idim++) {
101 ATH_MSG_INFO(
"adding dimension " <<
names[idim].c_str() <<
" " << types[idim]<<
" " << nbin[idim]<<
" " << rmin[idim]<<
" " << rmax[idim] );
105 data.addArea(theArea);
108 TAxis * xax = prof->GetXaxis();
109 TAxis * yax = prof->GetYaxis();
110 for (ibin[
names.size()-2]=0;ibin[
names.size()-2]<prof->GetNbinsX();ibin[
names.size()-2]++) {
111 for (ibin[
names.size()-1]=0;ibin[
names.size()-1]<prof->GetNbinsY();ibin[
names.size()-1]++) {
112 float abseta = xax->GetBinCenter(ibin[
names.size()-2]+1);
113 float loglambda = yax->GetBinCenter(ibin[
names.size()-1]+1);
114 int iBin = prof->FindBin(abseta,loglambda);
121 msg() << MSG::INFO <<
"Now set data for bins: ";
122 for(
unsigned int ii=0;ii<ibin.size();ii++)
123 msg() << ibin[ii] <<
" ";
125 int dbin =
data.getBin(0,ibin);
127 data.setCoeff(dbin,theData);
131 theKeyList->RemoveFirst();
134 return StatusCode::SUCCESS;
139 auto data = std::make_unique<CaloLocalHadCoeff>();
142 return StatusCode::SUCCESS;
147 return StatusCode::SUCCESS;
152 return StatusCode::SUCCESS;