CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/Alignment/MuonAlignmentAlgorithms/plugins/CSCPairResidualsConstraint.h

Go to the documentation of this file.
00001 #ifndef Alignment_MuonAlignmentAlgorithms_CSCPairResidualsConstraint_H
00002 #define Alignment_MuonAlignmentAlgorithms_CSCPairResidualsConstraint_H
00003 
00010 #include <fstream>
00011 
00012 #include "TH1F.h"
00013 
00014 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00015 #include "DataFormats/DetId/interface/DetId.h"
00016 #include "DataFormats/MuonDetId/interface/CSCDetId.h"
00017 #include "Alignment/MuonAlignmentAlgorithms/interface/CSCPairConstraint.h"
00018 #include "TrackingTools/PatternTools/interface/TrajectoryMeasurement.h"
00019 #include "Geometry/CSCGeometry/interface/CSCGeometry.h"
00020 #include "TrackingTools/TrackRefitter/interface/TrackTransformer.h"
00021 #include "TrackingTools/TransientTrack/interface/TransientTrack.h"
00022 #include "TrackingTools/GeomPropagators/interface/Propagator.h"
00023 #include "DataFormats/GeometrySurface/interface/Plane.h"
00024 
00025 class CSCOverlapsAlignmentAlgorithm;
00026 
00027 class CSCPairResidualsConstraint : public CSCPairConstraint {
00028 public:
00029   CSCPairResidualsConstraint(unsigned int identifier, int i, int j, CSCDetId id_i, CSCDetId id_j)
00030     : CSCPairConstraint(i, j, 0., 0.)
00031     , m_identifier(identifier), m_id_i(id_i), m_id_j(id_j)
00032     , m_sum1(0.), m_sumx(0.), m_sumy(0.), m_sumxx(0.), m_sumyy(0.), m_sumxy(0.), m_sumN(0)
00033     , m_Zplane(1000.), m_iZ1(1000.), m_iZ6(1000.), m_jZ1(1000.), m_jZ6(1000.), m_cscGeometry(NULL), m_propagator(NULL)
00034   {};
00035   virtual ~CSCPairResidualsConstraint() {};
00036 
00037   enum {
00038     kModePhiy,
00039     kModePhiPos,
00040     kModePhiz,
00041     kModeRadius
00042   };
00043 
00044   double value() const;
00045   double error() const;
00046   CSCDetId id_i() const { return m_id_i; };
00047   CSCDetId id_j() const { return m_id_j; };
00048   bool valid() const;
00049   double radius(bool is_i) const { return m_cscGeometry->idToDet((is_i ? m_id_i : m_id_j))->surface().position().perp(); };
00050 
00051   void configure(CSCOverlapsAlignmentAlgorithm *parent);
00052   void setZplane(const CSCGeometry *cscGeometry);
00053   void setPropagator(const Propagator *propagator);
00054   bool addTrack(const std::vector<TrajectoryMeasurement> &measurements, const reco::TransientTrack &track, const TrackTransformer *trackTransformer);
00055 
00056   void write(std::ofstream &output);
00057   void read(std::vector<std::ifstream*> &input, std::vector<std::string> &filenames);
00058 
00059 protected:
00060   void calculatePhi(const TransientTrackingRecHit *hit, double &phi, double &phierr2, bool doRphi=false, bool globalPhi=false);
00061   bool isFiducial(std::vector<const TransientTrackingRecHit*> &hits, bool is_i);
00062   bool dphidzFromTrack(const std::vector<TrajectoryMeasurement> &measurements, const reco::TransientTrack &track, const TrackTransformer *trackTransformer, double &drphidz);
00063 
00064   unsigned int m_identifier;
00065   CSCDetId m_id_i, m_id_j;
00066   double m_sum1, m_sumx, m_sumy, m_sumxx, m_sumyy, m_sumxy;
00067   int m_sumN;
00068 
00069   CSCOverlapsAlignmentAlgorithm *m_parent;
00070 
00071   double m_Zplane, m_iZ, m_jZ, m_iZ1, m_iZ6, m_jZ1, m_jZ6, m_averageRadius;
00072   const CSCGeometry *m_cscGeometry;
00073   const Propagator *m_propagator;
00074   Plane::PlanePointer m_Zsurface;
00075 
00076   TH1F *m_slopeResiduals;
00077   TH1F *m_offsetResiduals;
00078   TH1F *m_radial;
00079 };
00080 
00081 #endif // Alignment_MuonAlignmentAlgorithms_CSCPairResidualsConstraint_H