42{
43
44 if (argc < 4 || argc > 6)
45 {
46 std::cout <<
"USAGE: " <<
argv[0] <<
" <JetCollection> <ConfigFile> <OutputFile> (dev mode switch) (JES_vs_E switch)" << std::endl;
47 return 1;
48 }
49
50
51 const TString jetAlgo =
argv[1];
54 const bool isDevMode =
argc > 4 && (TString(argv[4]) ==
"true" || TString(argv[4]) ==
"dev");
55 const bool vsE =
argc > 5 && (TString(argv[5]) ==
"true");
56
57
58 const bool outFileIsExtensible =
outFile.EndsWith(
".pdf") ||
outFile.EndsWith(
".ps") ||
outFile.EndsWith(
".root");
59
60
61 const TString calibSeq = "EtaJES";
62 const bool isData = false;
63 float massForScan = 80.385e3;
64 if ( !jetAlgo.Contains("AntiKt10") ) massForScan = 0;
65
66
67 TString startingScaleString = "JetConstitScaleMomentum";
68 if ( !jetAlgo.Contains("AntiKt10") ) startingScaleString = "JetPileupScaleMomentum";
69 const TString endingScaleString = "JetEtaJESScaleMomentum";
70 const TString detectorEtaString = "DetectorEta";
71
72
76
77
78
81 {
83 {
84 std::cout << "Failed to make ana tool" << std::endl;
85 return 2;
86 }
87 if (calibTool.
setProperty(
"JetCollection",jetAlgo.Data()).isFailure())
88 {
89 std::cout << "Failed to set JetCollection: " << jetAlgo.Data() << std::endl;
90 return 3;
91 }
93 {
94 std::cout <<
"Failed to set ConfigFile: " <<
config.Data() << std::endl;
95 return 3;
96 }
97 if (calibTool.
setProperty(
"CalibSequence",calibSeq.Data()).isFailure())
98 {
99 std::cout << "Failed to set CalibSequence: " << calibSeq.Data() << std::endl;
100 return 3;
101 }
102 if (calibTool.
setProperty(
"IsData",isData).isFailure())
103 {
104 std::cout <<
"Failed to set IsData: " << (isData ? std::string(
"true") :
std::
string(
"false")) <<
std::endl;
105 return 3;
106 }
107 if (isDevMode && calibTool.
setProperty(
"DEVmode",isDevMode).isFailure())
108 {
109 std::cout << "Failed to set DEVmode" << std::endl;
110 return 4;
111 }
112 if (calibTool.
retrieve().isFailure())
113 {
114 std::cout << "Failed to initialize the JetCalibTool" << std::endl;
115 return 5;
116 }
117 }
118
119
120
127
128
129
130 TH2D* hist_pt_eta;
131 if ( jetAlgo.Contains("AntiKt10") ) hist_pt_eta = new TH2D("JES_pt_eta",Form("JES for jets with mass=%.1f GeV",massForScan/1.e3),1200,100,2500,60,-3,3);
132 else { hist_pt_eta = new TH2D("JES_pt_eta",Form("JES for jets with mass=%.1f GeV",massForScan/1.e3),2500,20,5000,90,-4.5,4.5); }
133
134
135 for (int xBin = 1; xBin <= hist_pt_eta->GetNbinsX(); ++xBin)
136 {
137 const double pt = hist_pt_eta->GetXaxis()->GetBinCenter(xBin)*1.e3;
138 for (int yBin = 1; yBin <= hist_pt_eta->GetNbinsY(); ++yBin)
139 {
140 const double eta = hist_pt_eta->GetYaxis()->GetBinCenter(yBin);
141
142
143 if ( !vsE ){
147 } else {
149 const double pT = sqrt((E*E)-(massForScan*massForScan))/cosh(
eta);
153 }
154 const double startingE = startingScale(*jet).e();
155
156
157 if(calibTool->modify(*jets).isFailure()){
158 std::cout << "Failed to apply jet calibration" << std::endl;
159 return 6;
160 }
161
162 const double JES =
jet->e()/startingE;
163
164
165 hist_pt_eta->SetBinContent(xBin,yBin,JES);
166 }
167 }
168
169
170
171
172
173
174 TCanvas*
canvas =
new TCanvas(
"canvas");
175 canvas->SetMargin(0.07,0.13,0.1,0.10);
176 canvas->SetFillStyle(4000);
178 canvas->SetFrameBorderMode(0);
181
182
183 hist_pt_eta->SetStats(false);
184 if ( !vsE ) hist_pt_eta->GetXaxis()->SetTitle("Jet #it{p}_{T} [GeV]");
185 else { hist_pt_eta->GetXaxis()->SetTitle("Jet E [GeV]"); }
186 hist_pt_eta->GetXaxis()->SetTitleOffset(1.35);
187 hist_pt_eta->GetXaxis()->SetMoreLogLabels();
188 hist_pt_eta->GetYaxis()->SetTitle("#eta");
189 hist_pt_eta->GetYaxis()->SetTitleOffset(0.9);
190 hist_pt_eta->GetZaxis()->SetTitle("JES_{Factor}");
191
192
193 if (outFileIsExtensible)
194 {
195
197 canvas->Print(outFile+
"[");
198 hist_pt_eta->Draw("colz");
200 canvas->Print(outFile+
"]");
201 }
else if (
outFile.EndsWith(
".root") ){
202 TFile *
fout =
new TFile(
outFile.Data(),
"RECREATE");
203 hist_pt_eta->Write();
206 }
207
208 }
209 else
210 {
212 hist_pt_eta->Draw("colz");
213 canvas->Print(Form(
"%u-fixMass-%s",counter++,
outFile.Data()));
214 }
215
216 delete hist_pt_eta;
217
218 return 0;
219}
Scalar eta() const
pseudorapidity method
SG::Accessor< T, ALLOC > Accessor
JetFourMomAccessor is an extension of JetAttributeAccessor::AccessorWrapper<xAOD::JetFourMom_t> Acces...
Tool for accessing xAOD files outside of Athena.
A relatively simple transient store for objects created in analysis.
outFile
Comment Out Those You do not wish to run.
Jet_v1 Jet
Definition of the current "jet version".
JetAuxContainer_v1 JetAuxContainer
Definition of the current jet auxiliary container.
JetContainer_v1 JetContainer
Definition of the current "jet container version".
ROOT::Math::LorentzVector< ROOT::Math::PtEtaPhiM4D< double > > JetFourMom_t
Base 4 Momentum type for Jet.