Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef TPCPedestalCalibration_H
0004 #define TPCPedestalCalibration_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 #include <cdbobjects/CDBTTree.h>
0008 #include <sphenixnpc/CDBUtils.h>
0009 
0010 #include <string>
0011 #include <vector>
0012 
0013 class PHCompositeNode;
0014 class TFile;
0015 class TTree;
0016 
0017 class TPCPedestalCalibration : public SubsysReco
0018 {
0019  public:
0020   explicit TPCPedestalCalibration(const std::string &name = "TPCPedestalCalibration.root");
0021 
0022   ~TPCPedestalCalibration() override {}
0023 
0024   int InitRun(PHCompositeNode *topNode) override;
0025 
0026   int process_event(PHCompositeNode *topNode) override;
0027 
0028   int EndRun(const int runnumber) override;
0029 
0030   void CDBInsert();
0031 
0032   int End(PHCompositeNode *topNode) override; 
0033 
0034   void AddPacket(int packet)
0035   {
0036     m_packets.push_back(packet);
0037   }
0038 
0039   void SetSector(int sectorNum)
0040   {
0041     m_sector = sectorNum;
0042   }
0043 
0044   void InsertCDBTTree(const std::string &username) // username for CDB record of who uploaded the file
0045   {
0046     m_writeToCDB = true;
0047     m_username = username; 
0048   }
0049 
0050   void NewCDBGlobalTag(std::string username)
0051   {
0052     CDBUtils *uti = new CDBUtils();
0053     uti->createGlobalTag(username); 
0054   }
0055  
0056  protected:
0057   //! which packet to decode
0058   std::vector<int> m_packets{1001};
0059 
0060  private:
0061   std::string m_fname;
0062   bool m_writeToCDB;
0063   CDBTTree * m_cdbttree = nullptr;
0064 
0065   int m_BCO = 0;
0066   int m_packet = 0;
0067   int m_nWaveormInFrame = 0;
0068   int m_nSamples = 0;
0069   int m_fee = 0;
0070   int m_Channel = 0;
0071   std::vector<unsigned short> m_adcSamples; 
0072 
0073   float m_aveADCFeeChannel[26][256]{};
0074   float m_stdADCFeeChannel[26][256]{};
0075   float m_countsADCFeeChannel[26][256]{};
0076   int m_aliveArrayFeeChannel[26][256]{};
0077 
0078   std::string m_username = "test";
0079   bool m_firstBCO = true;
0080   int m_isAlive = 1;
0081   float m_pedMean = 0;
0082   float m_pedStd = 0;
0083   int m_sector = 0;
0084   int m_outFEE = 99;
0085   int m_chan = 999;
0086   int m_module = 9;
0087   int m_slot = 99;
0088  
0089   int mod_arr[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};
0090   int slot_arr[26] = {5,6,1,3,2,12,10,11,9,8,7,1,2,4,8,7,6,5,4,3,1,3,2,4,6,5};
0091 };
0092 
0093 #endif // TPCPedestalCalibration_H