Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:06

0001 #ifndef TPCCALIB_TPCSPACECHARGEMATRIXINVERSION_H
0002 #define TPCCALIB_TPCSPACECHARGEMATRIXINVERSION_H
0003 /**
0004  * \file TpcSpaceChargeMatrixInversion.h
0005  * \brief aggregate space charge reconstruction matrices from several jobs and perform the inversion
0006  * \author Hugo Pereira Da Costa <hugo.pereira-da-costa@cea.fr>
0007  */
0008 
0009 #include "TpcSpaceChargeMatrixContainer.h"
0010 
0011 #include <fun4all/Fun4AllBase.h>
0012 #include <tpc/TpcDistortionCorrectionContainer.h>
0013 
0014 #include <memory>
0015 
0016 /**
0017  * \class TpcSpaceChargeMatrixInversion
0018  * \brief performs space charge distortion reconstruction using tracks
0019  */
0020 
0021 class TpcSpaceChargeMatrixInversion : public Fun4AllBase
0022 {
0023  public:
0024   /// constructor
0025   TpcSpaceChargeMatrixInversion(const std::string& = "TPCSPACECHARGEMATRIXINVERSION");
0026 
0027   ///@name modifiers
0028   //@{
0029 
0030   /// load central membrane distortion correction
0031   void load_cm_distortion_corrections(const std::string& /*filename*/);
0032 
0033   /// load average distortion correction
0034   void load_average_distortion_corrections(const std::string& /*filename*/);
0035 
0036   /// add space charge correction matrix to current. Returns true on success
0037   bool add(const TpcSpaceChargeMatrixContainer&);
0038 
0039   /// add space charge correction matrix, loaded from file, to current. Returns true on success
0040   bool add_from_file(const std::string& /*filename*/, const std::string& /*objectname*/ = "TpcSpaceChargeMatrixContainer");
0041 
0042   enum class InversionMode
0043   {
0044     FullInversion,        // use 3D matrices (phi,z,r)
0045     ReducedInversion_phi, // use 3D reduced matrices, use phi residuals to get delta_r
0046     ReducedInversion_z    // use 3D reduced matrices, use z residuals to get delta_r
0047   };
0048 
0049   /// calculate distortions by inverting stored matrices, and save relevant histograms
0050   void calculate_distortion_corrections(const InversionMode = InversionMode::FullInversion);
0051 
0052   /// extrapolate distortions
0053   void extrapolate_distortion_corrections();
0054 
0055   /// save distortions
0056   void save_distortion_corrections(const std::string& /*filename*/ = "DistortionCorrections.root");
0057 
0058   //@}
0059 
0060  private:
0061   /// matrix container
0062   std::unique_ptr<TpcSpaceChargeMatrixContainer> m_matrix_container;
0063 
0064   /// output distortion container
0065   std::unique_ptr<TpcDistortionCorrectionContainer> m_dcc_average;
0066 
0067   /// central membrane distortion container
0068   std::unique_ptr<TpcDistortionCorrectionContainer> m_dcc_cm;
0069 };
0070 
0071 #endif