36 return "should never be here";
83 template <parameters my_param>
88 getStringFromParamEnum(my_param) +
" vs run number", getStringFromParamEnum(my_param)) {}
91 auto ret = std::make_pair<double, double>(-9999., -9999.);
95 return std::make_pair<double, double>(payload.
GetX(), payload.
GetXError());
97 return std::make_pair<double, double>(payload.
GetY(), payload.
GetYError());
99 return std::make_pair<double, double>(payload.
GetZ(), payload.
GetZError());
118 typedef BeamSpot_history<X> BeamSpot_HistoryX;
119 typedef BeamSpot_history<Y> BeamSpot_HistoryY;
120 typedef BeamSpot_history<Z> BeamSpot_HistoryZ;
121 typedef BeamSpot_history<sigmaX> BeamSpot_HistorySigmaX;
122 typedef BeamSpot_history<sigmaY> BeamSpot_HistorySigmaY;
123 typedef BeamSpot_history<sigmaZ> BeamSpot_HistorySigmaZ;
124 typedef BeamSpot_history<dxdz> BeamSpot_HistorydXdZ;
125 typedef BeamSpot_history<dydz> BeamSpot_HistorydYdZ;
131 template <parameters my_param>
132 class BeamSpot_runhistory
135 BeamSpot_runhistory()
137 getStringFromParamEnum(my_param) +
" vs run number", getStringFromParamEnum(my_param)) {}
140 auto ret = std::make_pair<double, double>(-9999., -9999.);
144 return std::make_pair<double, double>(payload.
GetX(), payload.
GetXError());
146 return std::make_pair<double, double>(payload.
GetY(), payload.
GetYError());
148 return std::make_pair<double, double>(payload.
GetZ(), payload.
GetZError());
167 typedef BeamSpot_runhistory<X> BeamSpot_RunHistoryX;
168 typedef BeamSpot_runhistory<Y> BeamSpot_RunHistoryY;
169 typedef BeamSpot_runhistory<Z> BeamSpot_RunHistoryZ;
170 typedef BeamSpot_runhistory<sigmaX> BeamSpot_RunHistorySigmaX;
171 typedef BeamSpot_runhistory<sigmaY> BeamSpot_RunHistorySigmaY;
172 typedef BeamSpot_runhistory<sigmaZ> BeamSpot_RunHistorySigmaZ;
173 typedef BeamSpot_runhistory<dxdz> BeamSpot_RunHistorydXdZ;
174 typedef BeamSpot_runhistory<dydz> BeamSpot_RunHistorydYdZ;
180 template <parameters my_param>
181 class BeamSpot_timehistory
184 BeamSpot_timehistory()
186 getStringFromParamEnum(my_param) +
" vs time", getStringFromParamEnum(my_param)) {}
189 auto ret = std::make_pair<double, double>(-9999., -9999.);
193 return std::make_pair<double, double>(payload.
GetX(), payload.
GetXError());
195 return std::make_pair<double, double>(payload.
GetY(), payload.
GetYError());
197 return std::make_pair<double, double>(payload.
GetZ(), payload.
GetZError());
216 typedef BeamSpot_timehistory<X> BeamSpot_TimeHistoryX;
217 typedef BeamSpot_timehistory<Y> BeamSpot_TimeHistoryY;
218 typedef BeamSpot_timehistory<Z> BeamSpot_TimeHistoryZ;
219 typedef BeamSpot_timehistory<sigmaX> BeamSpot_TimeHistorySigmaX;
220 typedef BeamSpot_timehistory<sigmaY> BeamSpot_TimeHistorySigmaY;
221 typedef BeamSpot_timehistory<sigmaZ> BeamSpot_TimeHistorySigmaZ;
222 typedef BeamSpot_timehistory<dxdz> BeamSpot_TimeHistorydXdZ;
223 typedef BeamSpot_timehistory<dydz> BeamSpot_TimeHistorydYdZ;
233 return std::make_tuple(payload.
GetX(), payload.
GetY());
246 bool fill(
const std::vector<std::tuple<cond::Time_t, cond::Hash> >& iovs)
override {
247 auto iov = iovs.front();
248 std::shared_ptr<BeamSpotObjects>
payload = fetchPayload(std::get<1>(iov));
250 TCanvas
canvas(
"Beam Spot Parameters Summary",
"BeamSpot Parameters summary", 1000, 1000);
253 canvas.SetTopMargin(0.07);
254 canvas.SetBottomMargin(0.06);
255 canvas.SetLeftMargin(0.15);
256 canvas.SetRightMargin(0.03);
260 auto h2_BSParameters =
261 std::unique_ptr<TH2F>(
new TH2F(
"Parameters",
"BeamSpot parameters summary", 2, 0.0, 2.0, 8, 0, 8.));
262 h2_BSParameters->SetStats(
false);
264 std::function<double(parameters, bool)> cutFunctor = [&
payload](
parameters my_param,
bool isError) {
269 return payload->GetX();
271 return payload->GetY();
273 return payload->GetZ();
275 return payload->GetBeamWidthX();
277 return payload->GetBeamWidthY();
279 return payload->GetSigmaZ();
281 return payload->Getdxdz();
283 return payload->Getdydz();
292 return payload->GetXError();
294 return payload->GetYError();
296 return payload->GetZError();
298 return payload->GetBeamWidthXError();
300 return payload->GetBeamWidthYError();
302 return payload->GetSigmaZError();
304 return payload->GetdxdzError();
306 return payload->GetdydzError();
315 h2_BSParameters->GetXaxis()->SetBinLabel(1,
"Value");
316 h2_BSParameters->GetXaxis()->SetBinLabel(2,
"Error");
318 unsigned int yBin = 8;
322 h2_BSParameters->GetYaxis()->SetBinLabel(yBin, theLabel.c_str());
323 h2_BSParameters->SetBinContent(1, yBin, cutFunctor(param,
false));
324 h2_BSParameters->SetBinContent(2, yBin, cutFunctor(param,
true));
328 h2_BSParameters->GetXaxis()->LabelsOption(
"h");
330 h2_BSParameters->GetYaxis()->SetLabelSize(0.05);
331 h2_BSParameters->GetXaxis()->SetLabelSize(0.05);
333 h2_BSParameters->SetMarkerSize(1.5);
334 h2_BSParameters->Draw(
"TEXT");
337 canvas.SaveAs(fileName.c_str());
352 return "#sigma_{X} [cm]";
354 return "#sigma_{Y} [cm]";
356 return "#sigma_{Z} [cm]";
358 return "#frac{dX}{dZ} [rad]";
360 return "#frac{dY}{dZ} [rad]";
362 return "should never be here";
double Getdydz() const
get dydz slope, crossing angle in YZ
double GetY() const
get Y beam position
#define PAYLOAD_INSPECTOR_CLASS(CLASS_NAME)
ret
prodAgent to be discontinued
double GetSigmaZ() const
get sigma Z, RMS bunch length
double GetBeamWidthX() const
get average transverse beam width
double GetYError() const
get Y beam position Error
double GetBeamWidthYError() const
get average transverse beam width error X = Y
double GetBeamWidthY() const
get average transverse beam width
double GetdydzError() const
get dydz slope, crossing angle in YZ Error
double GetZ() const
get Z beam position
std::string getStringFromTypeEnum(const parameters ¶meter)
#define PAYLOAD_INSPECTOR_MODULE(PAYLOAD_TYPENAME)
double Getdxdz() const
get dxdz slope, crossing angle in XZ
double GetdxdzError() const
get dxdz slope, crossing angle in XZ Error
double GetBeamWidthXError() const
get average transverse beam width error ASSUME the same for X and Y
virtual Y getFromPayload(PayloadType &payload)=0
double GetSigmaZError() const
get sigma Z, RMS bunch length Error
double GetX() const
get X beam position
double GetXError() const
get X beam position Error
double GetZError() const
get Z beam position Error