12 #include "TProfile2D.h"
18 ISvcLocator * pSvcLocator) :
35 TFile* theLCClassificationFile =
new TFile(
file.c_str());
36 if ( !theLCClassificationFile ) {
37 return StatusCode::FAILURE;
42 TList * theKeyList = theLCClassificationFile->GetListOfKeys();
43 while ( theKeyList->GetEntries() ) {
44 TProfile2D * prof = (TProfile2D *)theLCClassificationFile->Get(theKeyList->First()->GetTitle());
46 std::string sTitle(prof->GetTitle());
49 std::vector<std::string>
keys;
50 keys.emplace_back(
"_iside_");
51 keys.emplace_back(
"_ieta_");
52 keys.emplace_back(
"_iphi_");
53 keys.emplace_back(
"_ilogE_");
55 std::vector<std::string>
names;
56 names.emplace_back(
"side");
57 names.emplace_back(
"|eta|");
58 names.emplace_back(
"phi");
59 names.emplace_back(
"log10(E_clus (MeV))");
60 names.emplace_back(prof->GetXaxis()->GetTitle());
61 names.emplace_back(prof->GetYaxis()->GetTitle());
63 std::vector<int> types;
71 std::vector<int> ibin(
names.size(),-1);
72 std::vector<double> rmin(
names.size(),-1);
73 std::vector<double> rmax(
names.size(),-1);
74 std::vector<int> nbin(
names.size(),-1);
77 for (idim=0;idim<
keys.size();idim++) {
79 if (
found == std::string::npos ) {
85 std::istringstream tstr(sTitle.substr(
found+
keys[idim].length()));
86 tstr >> ibin[idim] >>
c >>
c >> rmin[idim] >>
c >> rmax[idim] >>
c >> nbin[idim];
87 if ( ibin[idim] < 0 || ibin[idim] >= nbin[idim] ) {
88 ATH_MSG_ERROR (
"Found invalid bin number " << ibin[idim] <<
" not in valid range [0," << nbin[idim] <<
" in current histogram.");
95 nbin[
names.size()-2] = prof->GetNbinsX();
96 rmin[
names.size()-2] = prof->GetXaxis()->GetXmin();
97 rmax[
names.size()-2] = prof->GetXaxis()->GetXmax();
98 nbin[
names.size()-1] = prof->GetNbinsY();
99 rmin[
names.size()-1] = prof->GetYaxis()->GetXmin();
100 rmax[
names.size()-1] = prof->GetYaxis()->GetXmax();
102 if ( theArea.
getNdim() == 0 ) {
103 for (idim = 0;idim<
names.size();idim++) {
108 data.addArea(theArea);
111 TAxis * xax = prof->GetXaxis();
112 TAxis * yax = prof->GetYaxis();
113 for (ibin[
names.size()-2]=0;ibin[
names.size()-2]<prof->GetNbinsX();ibin[
names.size()-2]++) {
114 for (ibin[
names.size()-1]=0;ibin[
names.size()-1]<prof->GetNbinsY();ibin[
names.size()-1]++) {
115 float logEDens = xax->GetBinCenter(ibin[
names.size()-2]+1);
116 float loglambda = yax->GetBinCenter(ibin[
names.size()-1]+1);
117 int iBin = prof->FindBin(logEDens,loglambda);
124 msg() << MSG::INFO <<
"Now set data for bins: ";
125 for(
unsigned int ii=0;ii<ibin.size();ii++)
126 msg() << ibin[ii] <<
" ";
128 int dbin =
data.getBin(0,ibin);
130 data.setCoeff(dbin,theData);
134 theKeyList->RemoveFirst();
137 return StatusCode::SUCCESS;
142 auto data = std::make_unique<CaloLocalHadCoeff>();
145 return StatusCode::SUCCESS;
150 return StatusCode::SUCCESS;
155 return StatusCode::SUCCESS;