53 {
54
55 ATH_MSG_DEBUG(
"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
89
92
93 if (
m_jetAlgo.EqualTo(
"") ) {
ATH_MSG_FATAL(
"No jet algorithm specified. Aborting.");
return StatusCode::FAILURE; }
94
95
96 TString GSCFile =
m_config->GetValue(
"GSCFactorsFile",
"empty");
97 if ( GSCFile.EqualTo("empty") ) {
99 return StatusCode::FAILURE;
100 }
102 GSCFile.Remove(0,33);
103 GSCFile.Insert(0,"JetCalibTools/");
104 }
107 std::unique_ptr<TFile>
inputFile(TFile::Open(fileName));
108 if (!inputFile){
110 return StatusCode::FAILURE;
111 }
112
113 TString depthString = "";
115 else depthString =
m_config->GetValue(
"GSCDepth",
"Full");
116 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") ) {
117 ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
118 return StatusCode::FAILURE;
119 }
120
121
123 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");
124 return StatusCode::FAILURE;
125 }
126
127
128 if (
m_caloBased && (depthString.Contains(
"nTrk")||depthString.Contains(
"trackWIDTH")||depthString.Contains(
"ChargedFraction")||depthString.Contains(
"PunchThrough"))){
129 ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file. nTrk, trackWIDTH, PunchThrough and ChargedFraction corrections not available for trigger jets");
130 return StatusCode::FAILURE;
131 }
132
133
134
135
136 if ( depthString.Contains("PunchThrough") || depthString.Contains("Full") ) {
139 }
140
141
148 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
149 }
156 else {
ATH_MSG_FATAL(
"depthString flag for calo based GSC not properly set, please check your config file.");
return StatusCode::FAILURE; }
157 }
158 else {
164 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
165 } else {
172 else {
ATH_MSG_FATAL(
"depthString flag not properly set, please check your config file.");
return StatusCode::FAILURE; }
173 }
174 }
175
176
179 std::vector<TString> histoNames;
180
181 TIter ikeys(keys);
182 while ( TKey *iterobj = (TKey*)ikeys() ) { histoNames.emplace_back(iterobj->GetName() ); }
183
184
185 for (
uint ihisto=0; ihisto<histoNames.size(); ++ihisto) {
186 if ( !histoNames[ihisto].Contains(
m_jetAlgo.Data() ) )
continue;
187 else if ( ihisto>0 && histoNames[ihisto].Contains( histoNames[ihisto-1].
Data() ) )
continue;
198 else if ( histoNames[ihisto].Contains("PunchThrough") )
206 }
207
208
211 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
212 return StatusCode::FAILURE;
213 }
215 ATH_MSG_FATAL(
"Vector of nTrk histograms may be empty. Please check your GSCFactors file: " << GSCFile);
216 return StatusCode::FAILURE;
217 }
219 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
220 return StatusCode::FAILURE;
221 }
223 ATH_MSG_FATAL(
"Vector of trackWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
224 return StatusCode::FAILURE;
225 }
227 ATH_MSG_FATAL(
"Vector of PunchThrough histograms may be empty. Please check your GSCFactors file: " << GSCFile);
228 return StatusCode::FAILURE;
229 }
230 else ATH_MSG_DEBUG(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName);
231 }
234 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
235 return StatusCode::FAILURE;
236 }
238 ATH_MSG_FATAL(
"Vector of N90Constituents histograms may be empty. Please check your GSCFactors file: " << GSCFile);
239 return StatusCode::FAILURE;
240 }
242 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
243 return StatusCode::FAILURE;
244 }
246 ATH_MSG_FATAL(
"Vector of caloWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
247 return StatusCode::FAILURE;
248 }
250 ATH_MSG_FATAL(
"Vector of TileGap3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
251 return StatusCode::FAILURE;
252 }
253
254 else ATH_MSG_DEBUG(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName <<
"\n");
255 }
256 else{
258 ATH_MSG_FATAL(
"Vector of ChargedFraction histograms may be empty. Please check your GSCFactors file: " << GSCFile);
259 return StatusCode::FAILURE;
260 }
262 ATH_MSG_FATAL(
"Vector of EM3 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
263 return StatusCode::FAILURE;
264 }
266 ATH_MSG_FATAL(
"Vector of Tile0 histograms may be empty. Please check your GSCFactors file: " << GSCFile);
267 return StatusCode::FAILURE;
268 }
270 ATH_MSG_FATAL(
"Vector of nTrk histograms may be empty. Please check your GSCFactors file: " << GSCFile);
271 return StatusCode::FAILURE;
272 }
274 ATH_MSG_FATAL(
"Vector of trackWIDTH histograms may be empty. Please check your GSCFactors file: " << GSCFile);
275 return StatusCode::FAILURE;
276 }
278 ATH_MSG_FATAL(
"Vector of PunchThrough histograms may be empty. Please check your GSCFactors file: " << GSCFile);
279 return StatusCode::FAILURE;
280 }
281 else ATH_MSG_DEBUG(
"GSC Tool has been initialized with binning and eta fit factors from: " << fileName);
282 }
283 return StatusCode::SUCCESS;
284
285}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_FATAL(x,...)
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=" ")