21#include "GaudiKernel/SystemOfUnits.h"
23using Gaudi::Units::GeV;
24using Gaudi::Units::mm;
33unsigned const NUM_BCID = 3564;
41struct MonitoredLSMatrices {
46 void publish(ToolHandle<GenericMonitoringTool>
const& monTool);
48 std::vector<double> beamLSMatrices;
49 std::vector<double> beamLSMatricesBCID;
56 unsigned const sizeBCID = 2*(2+1)/2 + 2 + 2 + 1;
58 if (beamLSMatrices.empty()) {
64 beamLSMatrices.resize(4*(4+1)/2 + 4 + 1 + 2 + 1);
68 beamLSMatricesBCID.resize(sizeBCID * NUM_BCID);
71 double const sin_phi0 = std::sin(
seed.phi0);
72 double const cos_phi0 = std::cos(
seed.phi0);
73 double const param[] = { -sin_phi0, cos_phi0, -
seed.z0*sin_phi0,
seed.z0*cos_phi0};
74 double d0_var =
seed.d0_var + beamSize*beamSize;
76 for (
int i = 0;
i < 4; ++
i) {
77 for (
int j = 0; j <=
i; ++ j) {
78 beamLSMatrices[
idx++] += param[
i]*param[j] / d0_var;
81 for (
int i = 0;
i < 4; ++
i) {
82 beamLSMatrices[
idx++] +=
seed.d0*param[
i] / d0_var;
85 beamLSMatrices[
idx++] +=
seed.z0;
87 beamLSMatrices[
idx++] += 1;
90 beamLSMatricesBCID[
idx++] += param[0]*param[0] / d0_var;
91 beamLSMatricesBCID[
idx++] += param[0]*param[1] / d0_var;
92 beamLSMatricesBCID[
idx++] += param[1]*param[1] / d0_var;
93 beamLSMatricesBCID[
idx++] +=
seed.d0*param[0] / d0_var;
94 beamLSMatricesBCID[
idx++] +=
seed.d0*param[1] / d0_var;
95 beamLSMatricesBCID[
idx++] +=
seed.z0;
97 beamLSMatricesBCID[
idx++] += 1;
100void MonitoredLSMatrices::publish(ToolHandle<GenericMonitoringTool>
const& monTool)
102 if (not beamLSMatrices.empty()) {
105 auto mon = Monitored::Group(monTool, matrices, matricesBCID);
129 return StatusCode::SUCCESS;
137 std::vector<TrackData> bsTracks;
139 eventID.bunch_crossing_id(), &bsTracks);
143 if (not bsTracks.empty()) {
155 ATH_MSG_DEBUG(
"Fill LS matrices with " << tracks.size() <<
" Trk::Track tracks");
156 MonitoredLSMatrices lsMatrices;
157 for (
auto& track: tracks) {
158 TrackData tdata(*track->perigeeParameters(), 0, bcid);
164 ATH_MSG_DEBUG(
"Fill LL coefficients with " << tracks.size() <<
" Trk::Track tracks");
165 std::vector<double> poly_coeff;
167 for (
auto& track: tracks) {
168 auto const& par = track->perigeeParameters()->parameters();
169 auto const& cov = track->perigeeParameters()->covariance();
172 if (not poly_coeff.empty()) {
184 ATH_MSG_DEBUG(
"Fill LS matrices with " << tracks.size() <<
" TrackData tracks");
185 MonitoredLSMatrices lsMatrices;
186 for (
auto& track: tracks) {
192 ATH_MSG_DEBUG(
"Fill LL coefficients with " << tracks.size() <<
" TrackData tracks");
193 std::vector<double> poly_coeff;
195 for (
auto& track: tracks) {
196 llpoly.
update(track.z0, track.d0, track.phi0, track.d0_var, poly_coeff);
#define ATH_CHECK
Evaluate an expression and check for errors.
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Group of local monitoring quantities and retain correlation when filling histograms
Class that knows details of LogLikelihood approximation with a polynomial.
void update(double z0, double d0, double phi0, double d0_var, std::vector< double > &coeff)
Update polynomial coefficients with track data.
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.