Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:20:37

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef MVTX_P2_ALIGN_H
0004 #define MVTX_P2_ALIGN_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <phool/PHTimeServer.h>
0008 #include <map>
0009 #include <limits.h>
0010 
0011 #include <trackbase/TrkrClusterContainer.h>
0012 #include <trackbase/TrkrDefs.h>
0013 
0014 class TrkrHitSetContainer;
0015 
0016 class MvtxPrototype2Align : public SubsysReco {
0017 
0018 public:
0019 
0020   struct AlignmentPar {
0021     double dx;
0022     double dy;
0023     double dz;
0024   };
0025 
0026 
0027   MvtxPrototype2Align(const std::string &name = "MvtxAlign");
0028   virtual ~MvtxPrototype2Align() {}
0029 
0030   //! module initialization
0031   int Init(PHCompositeNode *topNode) {return 0;}
0032 
0033   //! run initialization
0034   int InitRun(PHCompositeNode *topNode);
0035 
0036   //! event processing
0037   int process_event(PHCompositeNode *topNode);
0038 
0039   //! end of process
0040   int End(PHCompositeNode *topNode) {return 0;}
0041 
0042   //! put in misalignment by hand
0043   void AddAlignmentPar(TrkrDefs::hitsetkey key, double dx, double dy, double dz);
0044 
0045   //! print stored misalignments
0046   void PrintAlignmentPars(std::ostream &os = std::cout) const;
0047 
0048   //! set the directory for alignment parameter files
0049   void SetAlignmentParFileDir(const std::string fdir) { fdir_ = fdir; }
0050 
0051   //! set boolean to read from file rather than setting by hand
0052   void SetAlignmentParFromFile(const bool yn) { apff_ = yn; }
0053 
0054   //! set par file name. same for all runs
0055   void SetAlignmentParFileName(const char* name) { m_afname = name; }
0056 
0057   //! set global coord flag;
0058   void SetIsGlobal(const bool yn) { m_is_global = yn; }
0059   bool GetIsGlobal() { return m_is_global; }
0060 
0061 private:
0062 
0063   // read the alignment parameters from file based on run number
0064   int ReadAlignmentParFile();
0065 
0066   // node tree storage pointers
0067   TrkrClusterContainer* clusters_;
0068 
0069   // storage object for misalignments
0070   std::map<TrkrDefs::hitsetkey, AlignmentPar> alignmap_;
0071 
0072   // directory for alignment parameter files
0073   std::string fdir_;
0074   int runnumber_;
0075   bool apff_; // alignment par from file
0076   std::string m_afname; // alignment par file name. If null generated by run by run
0077 
0078   bool m_is_global;
0079 
0080   PHTimeServer::timer _timer;
0081 };
0082 
0083 #endif