Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TPCRawDataTree_H
0004 #define TPCRawDataTree_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <tpc/TpcMap.h>
0009 
0010 #include <stdint.h>
0011 #include <string>
0012 #include <vector>
0013 
0014 class PHCompositeNode;
0015 class TFile;
0016 class TTree;
0017 class TH1F;
0018 class TH2F;
0019 
0020 class TPCRawDataTree : public SubsysReco
0021 {
0022  public:
0023   explicit TPCRawDataTree(const std::string &fname = "TPCRawDataTree.root");
0024 
0025   ~TPCRawDataTree() override {}
0026 
0027   /** Called for first event when run number is known.
0028       Typically this is where you may want to fetch data from
0029       database, because you know the run number. A place
0030       to book histograms which have to know the run number.
0031   */
0032   int InitRun(PHCompositeNode *topNode) override;
0033 
0034   /** Called for each event.
0035       This is where you do the real work.
0036   */
0037   int process_event(PHCompositeNode *topNode) override;
0038 
0039   /// Called at the end of all processing.
0040   int End(PHCompositeNode *topNode) override;
0041 
0042   void AddPacket(int packet)
0043   {
0044     m_packets.push_back(packet);
0045   }
0046 
0047   void includeXYPos(bool doInclude)
0048   {
0049     m_includeXYPos = doInclude;
0050   }
0051  
0052  protected:
0053   //! which packet to decode
0054   std::vector<int> m_packets;
0055   TpcMap M;
0056 
0057  private:
0058   bool m_includeXYPos = true;
0059   std::string m_fname;
0060   TFile *m_file = nullptr;
0061   TTree *m_SampleTree = nullptr;
0062   TTree *m_PacketTree = nullptr;
0063   TTree *m_TaggerTree = nullptr;
0064   //TTree *R1_map = nullptr;
0065   //TTree *R2_map = nullptr;
0066   //TTree *R3_map = nullptr;
0067   TH1F *R1_hist = nullptr;
0068   TH1F *R2_hist = nullptr;
0069   TH1F *R3_hist = nullptr;
0070   TH1F *TotalFEE = nullptr;
0071   TH1F *TotalFEEsampa = nullptr;
0072   TH1F *TotalFRAME = nullptr;
0073   TH1F *checksumError_fee = nullptr;
0074   TH1F *checksumError_feesampa = nullptr;
0075   TH1F *checksumError_frame = nullptr;
0076   TH2F *R1_time = nullptr;
0077   TH2F *R2_time = nullptr;
0078   TH2F *R3_time = nullptr;
0079 
0080   std::string sectorNum;
0081 
0082   int m_packet = 0;
0083   int m_frame = 0;
0084   int m_nWaveormInFrame = 0;
0085   int m_maxFEECount = 0;
0086   int m_nSamples = 0;
0087   int m_fee = 0;
0088   int m_sampaAddress = 0;
0089   int m_sampaChannel = 0;
0090   int m_Channel = 0;
0091   int m_BCO = 0;
0092   int m_checksum = 0;
0093   int m_checksumError = 0;
0094   int side = 0;
0095   double m_xPos = 0.;
0096   double m_yPos = 0.;
0097   uint64_t m_Lv1TaggerBCO = 0;
0098   uint64_t m_Lv1TaggerCount = 0;
0099 
0100   int m_nTaggerInFrame = 0;
0101   uint16_t m_tagger_type = 0;
0102   uint8_t m_is_endat = 0;
0103   uint8_t m_is_lvl1 = 0;
0104   uint64_t m_bco = 0;
0105   uint32_t m_lvl1_count = 0;
0106   uint32_t m_endat_count = 0;
0107   uint64_t m_last_bco = 0;
0108   uint8_t m_modebits = 0;
0109 
0110 
0111   uint64_t m_last_lvl1_bco = 0;
0112 
0113   std::vector<unsigned short> m_adcSamples;
0114 
0115   int FEE_R[26]={2, 2, 1, 1, 1, 3, 3, 3, 3, 3, 3, 2, 2, 1, 2, 2, 1, 1, 2, 2, 3, 3, 3, 3, 3, 3};
0116   int FEE_map[26]={4, 5, 0, 2, 1, 11, 9, 10, 8, 7, 6, 0, 1, 3, 7, 6, 5, 4, 3, 2, 0, 2, 1, 3, 5, 4};
0117 };
0118 
0119 #endif  // TPCRawDataTree_H