Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:35

0001 /*!
0002  * \file MvtxHitMapWriter.h
0003  * \brief Module to write the Mvtx hit map to a ROOT file
0004  * \author Tanner Mengel <tmengel@bnl.gov>
0005  * \version $Version: 1.0.1 $
0006  * \date $Date: 05/23/2025.
0007  */
0008 
0009 #ifndef MVTXCALIB_MVTXHITMAPWRITER_H
0010 #define MVTXCALIB_MVTXHITMAPWRITER_H
0011 
0012 #include <fun4all/SubsysReco.h>
0013 
0014 #include <cstdint>
0015 #include <iostream>
0016 #include <string>
0017 #include <vector>
0018 
0019 class PHCompositeNode;
0020 class MvtxHitMap;
0021 class MvtxPixelMask;
0022 class MvtxRawEvtHeader;
0023 class MvtxRawHitContainer;
0024 class TTree;
0025 
0026 class MvtxHitMapWriter : public SubsysReco
0027 {
0028  public:
0029   MvtxHitMapWriter(const std::string& name = "MvtxHitMapWriter")
0030     : SubsysReco(name)
0031   {}
0032 
0033   ~MvtxHitMapWriter() override = default;
0034 
0035   // standard Fun4All functions
0036   int InitRun(PHCompositeNode*) override;
0037   int process_event(PHCompositeNode*) override;
0038   int End(PHCompositeNode*) override;
0039 
0040   void SetOutputfile(const std::string& name) { m_outputfile = name; }
0041 
0042  private:
0043   // optional output
0044   std::string m_outputfile{"mvtx_hit_map.root"};
0045 
0046   uint64_t m_last_strobe{0};
0047 
0048   // hit map
0049   MvtxHitMap* m_hit_map{nullptr};
0050 
0051   MvtxRawEvtHeader* m_mvtx_raw_event_header{nullptr};
0052   MvtxRawHitContainer* m_mvtx_raw_hit_container{nullptr};
0053 
0054   TTree* m_tree_info{nullptr};
0055   unsigned int m_num_strobes{0};
0056   unsigned int m_nhits_total{0};
0057   unsigned int m_num_fired_pixels{0};
0058 
0059   TTree* m_tree{nullptr};
0060   std::vector<uint64_t> m_pixels{};
0061   std::vector<unsigned int> m_nhits{};
0062 
0063   int get_nodes(PHCompositeNode* topNode);
0064   int FillTree();
0065 };
0066 
0067 #endif