31{
32 for (unsigned int iFile=0;iFile<theLCJetEnergyScaleFileNames.size();iFile++) {
33
36 TFile* theLCJetEnergyScaleFile =
new TFile(
file.c_str());
37 if ( !theLCJetEnergyScaleFile ) {
38 return StatusCode::FAILURE;
39 }
40
41 CaloLocalHadCoeff::LocalHadArea theArea(theLCJetEnergyScaleJetCollectionNames[iFile].c_str(),0,3);
42
43 TList * theKeyList = theLCJetEnergyScaleFile->GetListOfKeys();
44 while ( theKeyList->GetEntries() ) {
45 TProfile2D * prof = (TProfile2D *)theLCJetEnergyScaleFile->Get(theKeyList->First()->GetTitle());
46
47 std::string sTitle(prof->GetTitle());
48 bool allValid(true);
49
50 std::vector<std::string>
keys;
51 keys.emplace_back(
"ieta_inv_");
52
53 std::vector<std::string>
names;
54 names.emplace_back(
"|eta|");
55 names.emplace_back(
"side");
56 names.emplace_back(
"phi");
57
58 names.emplace_back(
"log10(E_jet (MeV))");
59 names.emplace_back(
"frac_low_E_clus");
60
61
62
63 std::vector<int>
types;
69
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);
74 unsigned int idim;
75
76 for (idim=0;idim<
keys.size();idim++) {
77 size_t found = sTitle.find(keys[idim]);
78 if ( found == std::string::npos ) {
79 ATH_MSG_ERROR(
"Could not find key " << keys[idim] <<
" in current histogram." );
80 allValid = false;
81 }
82 else {
83 std::istringstream tstr(sTitle.substr(found+keys[idim].length()));
84 tstr >> ibin[idim];
85
86
87 nbin[idim] = 25;
88 rmin[idim] = 0.;
89 rmax[idim] = 5.;
90
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." );
93 allValid = false;
94 }
95 }
96 }
97 if ( allValid ) {
98
99 ibin[1] = 0;
100 nbin[1] = 1;
101 rmin[1] = -1.5;
102 rmax[1] = 1.5;
103
104 ibin[2] = 0;
105 nbin[2] = 1;
108
109
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();
116
117 if ( theArea.getNdim() == 0 ) {
118 for (idim = 0;idim<
names.size();idim++) {
119 CaloLocalHadCoeff::LocalHadDimension theDim(names[idim].c_str(),
types[idim],nbin[idim],rmin[idim],rmax[idim]);
120 theArea.addDimension(theDim);
121 }
122 ATH_MSG_INFO(
"adding Area with nDim = " << theArea.getNdim() );
123 data.addArea(theArea);
124 }
125
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);
133
138
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);
144 if (dbin >= 0)
145 data.setCoeff(dbin,theData);
146 }
147 }
148 }
149 theKeyList->RemoveFirst();
150 }
151 }
152 return StatusCode::SUCCESS;
153}
char data[hepevt_bytes_allocation_ATLAS]
static const std::vector< std::string > types
std::vector< float > LocalHadCoeff
Correction parameters for one general bin.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)