File indexing completed on 2024-09-07 04:34:34
0001 #ifndef Alignment_MuonAlignmentAlgorithms_CSCPairResidualsConstraint_H
0002 #define Alignment_MuonAlignmentAlgorithms_CSCPairResidualsConstraint_H
0003
0004
0005
0006
0007
0008
0009
0010 #include <fstream>
0011
0012 #include "TH1F.h"
0013
0014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0015 #include "DataFormats/DetId/interface/DetId.h"
0016 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
0017 #include "Alignment/MuonAlignmentAlgorithms/interface/CSCPairConstraint.h"
0018 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
0019 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
0020 #include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
0021 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
0022 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
0023 #include "DataFormats/GeometrySurface/interface/Plane.h"
0024
0025 class CSCOverlapsAlignmentAlgorithm;
0026
0027 class CSCPairResidualsConstraint : public CSCPairConstraint {
0028 public:
0029 CSCPairResidualsConstraint(unsigned int identifier, int i, int j, CSCDetId id_i, CSCDetId id_j)
0030 : CSCPairConstraint(i, j, 0., 0.),
0031 m_identifier(identifier),
0032 m_id_i(id_i),
0033 m_id_j(id_j),
0034 m_sum1(0.),
0035 m_sumx(0.),
0036 m_sumy(0.),
0037 m_sumxx(0.),
0038 m_sumyy(0.),
0039 m_sumxy(0.),
0040 m_sumN(0),
0041 m_Zplane(1000.),
0042 m_iZ1(1000.),
0043 m_iZ6(1000.),
0044 m_jZ1(1000.),
0045 m_jZ6(1000.),
0046 m_cscGeometry(nullptr),
0047 m_propagator(nullptr) {}
0048 ~CSCPairResidualsConstraint() override {}
0049
0050 enum { kModePhiy, kModePhiPos, kModePhiz, kModeRadius };
0051
0052 double value() const override;
0053 double error() const override;
0054 CSCDetId id_i() const { return m_id_i; };
0055 CSCDetId id_j() const { return m_id_j; };
0056 bool valid() const override;
0057 double radius(bool is_i) const {
0058 return m_cscGeometry->idToDet((is_i ? m_id_i : m_id_j))->surface().position().perp();
0059 };
0060
0061 void configure(CSCOverlapsAlignmentAlgorithm *parent);
0062 void setZplane(const CSCGeometry *cscGeometry);
0063 void setPropagator(const Propagator *propagator);
0064 bool addTrack(const std::vector<TrajectoryMeasurement> &measurements,
0065 const reco::TransientTrack &track,
0066 const TrackTransformer *trackTransformer);
0067
0068 void write(std::ofstream &output);
0069 void read(std::vector<std::ifstream *> &input, std::vector<std::string> &filenames);
0070
0071 protected:
0072 void calculatePhi(
0073 const TransientTrackingRecHit *hit, double &phi, double &phierr2, bool doRphi = false, bool globalPhi = false);
0074 bool isFiducial(std::vector<const TransientTrackingRecHit *> &hits, bool is_i);
0075 bool dphidzFromTrack(const std::vector<TrajectoryMeasurement> &measurements,
0076 const reco::TransientTrack &track,
0077 const TrackTransformer *trackTransformer,
0078 double &drphidz);
0079
0080 unsigned int m_identifier;
0081 CSCDetId m_id_i, m_id_j;
0082 double m_sum1, m_sumx, m_sumy, m_sumxx, m_sumyy, m_sumxy;
0083 int m_sumN;
0084
0085 CSCOverlapsAlignmentAlgorithm *m_parent;
0086
0087 double m_Zplane, m_iZ, m_jZ, m_iZ1, m_iZ6, m_jZ1, m_jZ6, m_averageRadius;
0088 const CSCGeometry *m_cscGeometry;
0089 const Propagator *m_propagator;
0090 Plane::PlanePointer m_Zsurface;
0091
0092 TH1F *m_slopeResiduals;
0093 TH1F *m_offsetResiduals;
0094 TH1F *m_radial;
0095 };
0096
0097 #endif