53 {
54
55 ATH_MSG_INFO(
"Initializing the Global Sequential Calibration tool");
56
59 return StatusCode::FAILURE;
60 }
61
62
64
65
69 } else{
70
72 }
73
79
80
81
83
84
86
87 if (
m_jetAlgo.EqualTo(
"") ) {
ATH_MSG_FATAL(
"No jet algorithm specified. Aborting.");
return StatusCode::FAILURE; }
88
89
90 TString GSCFile =
m_config->GetValue(
"GSCFactorsFile",
"empty");
91 if ( GSCFile.EqualTo("empty") ) {
93 return StatusCode::FAILURE;
94 }
96 GSCFile.Remove(0,33);
97 GSCFile.Insert(0,"JetCalibTools/");
98 }
101 std::unique_ptr<TFile>
inputFile(TFile::Open(fileName));
102 if (!inputFile){
104 return StatusCode::FAILURE;
105 }
106
107 TString depthString = "";
109 else depthString =
m_config->GetValue(
"GSCDepth",
"Full");
110 if ( !depthString.Contains("ChargedFraction") && !depthString.Contains("Tile0") && !depthString.Contains("EM3") && !depthString.Contains("nTrk") && !depthString.Contains("trackWIDTH") && !depthString.Contains("PunchThrough") && !depthString.Contains("N90Constituents") && !depthString.Contains("TileGap3") && !depthString.Contains("caloWIDTH") && !depthString.Contains("Full") ) {
111 ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
112 return StatusCode::FAILURE;
113 }
114
115
117 ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file. nTrkwTrk4PFlow should be set to true to apply nTrk or trackWIDTH corrections to PFlow jets");
118 return StatusCode::FAILURE;
119 }
120
121
122 if (
m_caloBased && (depthString.Contains(
"nTrk")||depthString.Contains(
"trackWIDTH")||depthString.Contains(
"ChargedFraction")||depthString.Contains(
"PunchThrough"))){
123 ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file. nTrk, trackWIDTH, PunchThrough and ChargedFraction corrections not available for trigger jets");
124 return StatusCode::FAILURE;
125 }
126
127
128
129
130 if ( depthString.Contains("PunchThrough") || depthString.Contains("Full") ) {
133 }
134
135
142 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
143 }
150 else {
ATH_MSG_FATAL(
"depthString flag for calo based GSC not properly set, please check your config file.");
return StatusCode::FAILURE; }
151 }
152 else {
158 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
159 } else {
166 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
167 }
168 }
169
170
173 std::vector<TString> histoNames;
174
175 TIter ikeys(keys);
176 while ( TKey *iterobj = (TKey*)ikeys() ) { histoNames.emplace_back(iterobj->GetName() ); }
177
178
179 for (
uint ihisto=0; ihisto<histoNames.size(); ++ihisto) {
180 if ( !histoNames[ihisto].Contains(
m_jetAlgo.Data() ) )
continue;
181 else if ( ihisto>0 && histoNames[ihisto].Contains( histoNames[ihisto-1].
Data() ) )
continue;
192 else if ( histoNames[ihisto].Contains("PunchThrough") )
200 }
201
202
205 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
206 return StatusCode::FAILURE;
207 }
209 ATH_MSG_FATAL(
"Vector of nTrk histograms may be empty. Please check your GSCFactors file: " << GSCFile);
210 return StatusCode::FAILURE;
211 }
213 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
214 return StatusCode::FAILURE;
215 }
217 ATH_MSG_FATAL(
"Vector of trackWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
218 return StatusCode::FAILURE;
219 }
221 ATH_MSG_FATAL(
"Vector of PunchThrough histograms may be empty. Please check your GSCFactors file: " << GSCFile);
222 return StatusCode::FAILURE;
223 }
224 else ATH_MSG_INFO(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName);
225 }
228 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
229 return StatusCode::FAILURE;
230 }
232 ATH_MSG_FATAL(
"Vector of N90Constituents histograms may be empty. Please check your GSCFactors file: " << GSCFile);
233 return StatusCode::FAILURE;
234 }
236 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
237 return StatusCode::FAILURE;
238 }
240 ATH_MSG_FATAL(
"Vector of caloWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
241 return StatusCode::FAILURE;
242 }
244 ATH_MSG_FATAL(
"Vector of TileGap3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
245 return StatusCode::FAILURE;
246 }
247
248 else ATH_MSG_INFO(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName <<
"\n");
249 }
250 else{
252 ATH_MSG_FATAL(
"Vector of ChargedFraction histograms may be empty. Please check your GSCFactors file: " << GSCFile);
253 return StatusCode::FAILURE;
254 }
256 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
257 return StatusCode::FAILURE;
258 }
260 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
261 return StatusCode::FAILURE;
262 }
264 ATH_MSG_FATAL(
"Vector of nTrk histograms may be empty. Please check your GSCFactors file: " << GSCFile);
265 return StatusCode::FAILURE;
266 }
268 ATH_MSG_FATAL(
"Vector of trackWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
269 return StatusCode::FAILURE;
270 }
272 ATH_MSG_FATAL(
"Vector of PunchThrough histograms may be empty. Please check your GSCFactors file: " << GSCFile);
273 return StatusCode::FAILURE;
274 }
275 else ATH_MSG_INFO(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName);
276 }
277 return StatusCode::SUCCESS;
278
279}
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
void setPunchThroughEtaBins(const VecD &etabins)
void setPunchThroughMinPt(double minPt)
std::string m_jetStartScale
std::unique_ptr< const TH2 > GetHisto2(TFile &file, const TString &hname)
VecD VectorizeD(const TString &str, const TString &sep=" ")