File indexing completed on 2024-04-06 12:31:33
0001 #ifndef _CR_MATERIALEFFECTSUPDATOR_H_
0002 #define _CR_MATERIALEFFECTSUPDATOR_H_
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #include "DataFormats/GeometrySurface/interface/Surface.h"
0015 #include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h"
0016 #include "DataFormats/TrajectorySeed/interface/PropagationDirection.h"
0017
0018 namespace materialEffect {
0019 enum CovIndex { elos = 0, msxx = 1, msxy = 2, msyy = 3 };
0020 class Covariance {
0021 public:
0022 float operator[](CovIndex i) const { return data[i]; }
0023 float& operator[](CovIndex i) { return data[i]; }
0024 void add(AlgebraicSymMatrix55& cov) const {
0025 cov(0, 0) += data[elos];
0026 cov(1, 1) += data[msxx];
0027 cov(1, 2) += data[msxy];
0028 cov(2, 2) += data[msyy];
0029 }
0030 Covariance& operator+=(Covariance const& cov) {
0031 for (int i = 0; i != 4; ++i)
0032 data[i] += cov.data[i];
0033 return *this;
0034 }
0035
0036 private:
0037 float data[4] = {0};
0038 };
0039
0040 struct Effect {
0041 float weight = 1.f;
0042
0043 float deltaP = 0;
0044
0045 Covariance deltaCov;
0046 void combine(Effect const& e1, Effect const& e2) {
0047 weight *= e1.weight * e2.weight;
0048 deltaP += e1.deltaP + e2.deltaP;
0049 deltaCov += e1.deltaCov;
0050 deltaCov += e2.deltaCov;
0051 }
0052 };
0053
0054 }
0055
0056 class MaterialEffectsUpdator {
0057 public:
0058 typedef materialEffect::Covariance Covariance;
0059 typedef materialEffect::Effect Effect;
0060 typedef materialEffect::CovIndex CovIndex;
0061
0062
0063
0064 MaterialEffectsUpdator(float mass);
0065 virtual ~MaterialEffectsUpdator();
0066
0067
0068
0069
0070 virtual TrajectoryStateOnSurface updateState(const TrajectoryStateOnSurface& TSoS,
0071 const PropagationDirection propDir) const;
0072
0073
0074
0075
0076
0077
0078
0079 virtual bool updateStateInPlace(TrajectoryStateOnSurface& TSoS, const PropagationDirection propDir) const;
0080
0081
0082
0083 inline float mass() const { return theMass; }
0084
0085 virtual MaterialEffectsUpdator* clone() const = 0;
0086
0087
0088 virtual void compute(const TrajectoryStateOnSurface&, const PropagationDirection, Effect& effect) const = 0;
0089
0090 private:
0091 float theMass;
0092 };
0093
0094 #endif