12 #include "TProfile2D.h"
18 ISvcLocator * pSvcLocator) :
32 for (
unsigned int iFile=0;iFile<theLCJetEnergyScaleFileNames.size();iFile++) {
36 TFile* theLCJetEnergyScaleFile =
new TFile(
file.c_str());
37 if ( !theLCJetEnergyScaleFile ) {
38 return StatusCode::FAILURE;
43 TList * theKeyList = theLCJetEnergyScaleFile->GetListOfKeys();
44 while ( theKeyList->GetEntries() ) {
45 TProfile2D * prof = (TProfile2D *)theLCJetEnergyScaleFile->Get(theKeyList->First()->GetTitle());
47 std::string sTitle(prof->GetTitle());
50 std::vector<std::string>
keys;
51 keys.emplace_back(
"ieta_inv_");
53 std::vector<std::string>
names;
54 names.emplace_back(
"|eta|");
55 names.emplace_back(
"side");
56 names.emplace_back(
"phi");
58 names.emplace_back(
"log10(E_jet (MeV))");
59 names.emplace_back(
"frac_low_E_clus");
63 std::vector<int> types;
70 std::vector<int> ibin(
names.size(),-1);
71 std::vector<double> rmin(
names.size(),-1);
72 std::vector<double> rmax(
names.size(),-1);
73 std::vector<int> nbin(
names.size(),-1);
76 for (idim=0;idim<
keys.size();idim++) {
78 if (
found == std::string::npos ) {
83 std::istringstream tstr(sTitle.substr(
found+
keys[idim].length()));
91 if ( ibin[idim] < 0 || ibin[idim] >= nbin[idim] ) {
92 ATH_MSG_ERROR(
"Found invalid bin number " << ibin[idim] <<
" not in valid range [0," << nbin[idim] <<
" in current histogram." );
110 nbin[
names.size()-2] = prof->GetNbinsX();
111 rmin[
names.size()-2] = prof->GetXaxis()->GetXmin();
112 rmax[
names.size()-2] = prof->GetXaxis()->GetXmax();
113 nbin[
names.size()-1] = prof->GetNbinsY();
114 rmin[
names.size()-1] = prof->GetYaxis()->GetXmin();
115 rmax[
names.size()-1] = prof->GetYaxis()->GetXmax();
117 if ( theArea.
getNdim() == 0 ) {
118 for (idim = 0;idim<
names.size();idim++) {
123 data.addArea(theArea);
126 TAxis * xax = prof->GetXaxis();
127 TAxis * yax = prof->GetYaxis();
128 for (ibin[
names.size()-2]=0;ibin[
names.size()-2]<prof->GetNbinsX();ibin[
names.size()-2]++) {
129 for (ibin[
names.size()-1]=0;ibin[
names.size()-1]<prof->GetNbinsY();ibin[
names.size()-1]++) {
130 float logE = xax->GetBinCenter(ibin[
names.size()-2]+1);
131 float frac = yax->GetBinCenter(ibin[
names.size()-1]+1);
132 int iBin = prof->FindBin(logE,
frac);
139 msg() << MSG::INFO <<
"Now set data for bins: ";
140 for(
unsigned int ii=0;ii<ibin.size();ii++)
141 msg() << ibin[ii] <<
" ";
143 int dbin =
data.getBin(iFile,ibin);
145 data.setCoeff(dbin,theData);
149 theKeyList->RemoveFirst();
152 return StatusCode::SUCCESS;
157 auto data = std::make_unique<CaloLocalHadCoeff>();
160 return StatusCode::SUCCESS;
165 return StatusCode::SUCCESS;
170 return StatusCode::SUCCESS;