Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:39

0001 /****************************************************************************
0002 *
0003 * This is a part of TOTEM offline software.
0004 * Authors:
0005 *   Hubert Niewiadomski
0006 *   Jan Kašpar (jan.kaspar@gmail.com)
0007 *
0008 ****************************************************************************/
0009 
0010 #ifndef RecoPPS_Local_TotemRPLocalTrackFitterAlgorithm
0011 #define RecoPPS_Local_TotemRPLocalTrackFitterAlgorithm
0012 
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014 
0015 #include "DataFormats/Common/interface/DetSetVector.h"
0016 #include "DataFormats/CTPPSReco/interface/TotemRPRecHit.h"
0017 #include "DataFormats/CTPPSReco/interface/TotemRPLocalTrack.h"
0018 
0019 #include "Geometry/VeryForwardGeometryBuilder/interface/CTPPSGeometry.h"
0020 #include "Geometry/VeryForwardRPTopology/interface/RPTopology.h"
0021 
0022 #include "TVector3.h"
0023 #include "TVector2.h"
0024 
0025 #include <unordered_map>
0026 
0027 //----------------------------------------------------------------------------------------------------
0028 
0029 /**
0030  *\brief Algorithm for fitting tracks through a single RP.
0031  **/
0032 class TotemRPLocalTrackFitterAlgorithm {
0033 public:
0034   TotemRPLocalTrackFitterAlgorithm(const edm::ParameterSet &conf);
0035 
0036   /// performs the track fit, returns true if successful
0037   bool fitTrack(const edm::DetSetVector<TotemRPRecHit> &hits,
0038                 double z_0,
0039                 const CTPPSGeometry &tot_geom,
0040                 TotemRPLocalTrack &fitted_track);
0041 
0042   /// Resets the reconstruction-data cache.
0043   void reset();
0044 
0045 private:
0046   struct RPDetCoordinateAlgebraObjs {
0047     TVector3 centre_of_det_global_position_;
0048     double rec_u_0_;              ///< in mm, position of det. centre projected on readout direction
0049     TVector2 readout_direction_;  ///< non paralell projection and rot_cor included
0050     bool available_;              ///< if det should be included in the reconstruction
0051   };
0052 
0053   /// A cache of reconstruction data. Must be reset every time the geometry chagnges.
0054   std::unordered_map<unsigned int, RPDetCoordinateAlgebraObjs> det_data_map_;
0055 
0056   RPTopology rp_topology_;
0057 
0058   /// Returns the reconstruction data for the chosen detector from the cache DetReconstructionDataMap.
0059   /// If it is not yet in the cache, calls PrepareReconstAlgebraData to make it.
0060   RPDetCoordinateAlgebraObjs *getDetAlgebraData(unsigned int det_id, const CTPPSGeometry &tot_rp_geom);
0061 
0062   /// Build the reconstruction data.
0063   RPDetCoordinateAlgebraObjs prepareReconstAlgebraData(unsigned int det_id, const CTPPSGeometry &tot_rp_geom);
0064 
0065   /// A matrix multiplication shorthand.
0066   void multiplyByDiagonalInPlace(TMatrixD &mt, const TVectorD &diag);
0067 
0068   static TVector3 convert3vector(const CTPPSGeometry::Vector &v) { return TVector3(v.x(), v.y(), v.z()); }
0069 };
0070 
0071 #endif