Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:16:33

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef ZDCSMDCOUNT_H
0004 #define ZDCSMDCOUNT_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 #include <map>
0010 class TFile;
0011 class TTree;
0012 class TH1;
0013 class TH2;
0014 class PHCompositeNode;
0015 class TGraphErrors;
0016 
0017 class ZdcSmdCount : public SubsysReco
0018 {
0019 public:
0020     ZdcSmdCount(const std::string &name = "ZdcSmdCount", const int runnumber = 0,float cutvalue=0.,int roller=0);
0021 
0022     ~ZdcSmdCount() override;
0023 
0024     /** Called during initialization.
0025         Typically this is where you can book histograms, and e.g.
0026         register them to Fun4AllServer (so they can be output to file
0027         using Fun4AllServer::dumpHistos() method).
0028      */
0029     int Init(PHCompositeNode *topNode) override;
0030 
0031     /** Called for first event when run number is known.
0032         Typically this is where you may want to fetch data from
0033         database, because you know the run number. A place
0034         to book histograms which have to know the run number.
0035      */
0036     int InitRun(PHCompositeNode *topNode) override;
0037 
0038     /** Called for each event.
0039         This is where you do the real work.
0040      */
0041     int process_event(PHCompositeNode *topNode) override;
0042     int process_event_2(PHCompositeNode *topNode);
0043 
0044     /// Clean up internals after each event.
0045     int ResetEvent(PHCompositeNode *topNode) override;
0046 
0047     /// Called at the end of each run.
0048     int EndRun(const int runnumber) override;
0049 
0050     /// Called at the end of all processing.
0051     int End(PHCompositeNode *topNode) override;
0052 
0053     /// Reset
0054     int Reset(PHCompositeNode * /*topNode*/) override;
0055 
0056     void Print(const std::string &what = "ALL") const override;
0057 
0058     ////////////// Functions ///////////////////////////////
0059     void SetZDCAdcCut(unsigned int side, unsigned int module, float value); // side 0 = north side = 1 south
0060     void GetSpinPatterns();
0061     
0062     void InitGraph();
0063     void WriteGraph();
0064     void InitHist();
0065 
0066 private:
0067     std::map<int, int> Chmapping;
0068     const unsigned int kZdc_num_ = 3;
0069     const unsigned int kSmd_num_ = 16;
0070     const unsigned int kSide_num_ = 2; // side 0 = north side 1 = south
0071     static const int NBUNCHES = 120;
0072     float zdc_adc_cut_[2][3] = {0.}; // ADC cut for each ZDC module ::array[side][module]
0073     float smd_adc_cut_[2][2] = {0.}; // ADC cut for each smd  ::array[side][direction]
0074     int spinPatternBlue[NBUNCHES] = {0};
0075     int spinPatternYellow[NBUNCHES] = {0};
0076     int crossingShift = 0;
0077     int runNum = 0;
0078     int event_counter_;
0079     int runnumber_;
0080     int bunchNum_;
0081     int bunchNum_previous_;
0082     bool b_s_smd_v12_ = false;
0083     bool b_n_smd_h12_ = false;
0084     bool b_s_smd_v67_ = false;
0085     bool b_n_smd_v67_ = false;
0086     bool b_s_smd_h12_ = false;
0087     bool b_n_smd_v12_ = false;
0088     bool b_s_smd_h78_ = false;
0089     bool b_n_smd_h78_ = false;
0090 
0091     float cut_value_ = 5;
0092     ///////////// variables ///////////////////
0093 
0094     /////////// TFile / TTree / NTuple / Histograms//////////
0095     TFile *outfile_;
0096     std::string outfile_name_;
0097     TH1 *h1_NorthZDC_adc_;
0098     TH1 *h1_SouthZDC_adc_;
0099     TH1 *h1_SouthZDC_adc_origin_;
0100     TH1 *h1_NorthZDC_adc_origin_;
0101     TH1 *h1_SouthSMD_adc_origin_;
0102     TH1 *h1_NorthSMD_adc_origin_;
0103     TH1 *h1_SouthVeto_adc_origin_;
0104     TH1 *h1_NorthVeto_adc_origin_;
0105     TH1 *h1_SouthZDC_adc_ped_;
0106     TH1 *h1_NorthZDC_adc_ped_;
0107     TH1 *h1_SouthSMD_adc_ped_;
0108     TH1 *h1_NorthSMD_adc_ped_;
0109     TH1 *h1_SouthVeto_adc_;
0110     TH1 *h1_NorthVeto_adc_;
0111     TH1 *h1_SouthVeto_adc_ped_;
0112     TH1 *h1_NorthVeto_adc_ped_;
0113     TH1 *h1_NorthSMD_adc_;
0114     TH1 *h1_SouthSMD_adc_;
0115     TH1 *h1_NorthZDC1_adc_;
0116     TH1 *h1_SouthZDC1_adc_;
0117     TH1 *h1_NorthZDC2_adc_;
0118     TH1 *h1_SouthZDC2_adc_;
0119     TH1 *h1_NorthZDC3_adc_;
0120     TH1 *h1_SouthZDC3_adc_;
0121 
0122     TH1 *h1_NorthSMD_Vertical_12_;
0123     TH1 *h1_NorthSMD_Vertical_67_;
0124     TH1 *h1_NorthSMD_Horizontal_12_;
0125     TH1 *h1_NorthSMD_Horizontal_78_;
0126     TH1 *h1_SouthSMD_Vertical_12_;
0127     TH1 *h1_SouthSMD_Vertical_67_;
0128     TH1 *h1_SouthSMD_Horizontal_12_;
0129     TH1 *h1_SouthSMD_Horizontal_78_;
0130 
0131 
0132 
0133 
0134 
0135 //////////////// not used ////////////////////
0136     TH1 *h1_smd_hor_north_;
0137     TH1 *h1_smd_ver_north_;
0138     TH1 *h1_smd_hor_south_;
0139     TH1 *h1_smd_ver_south_;
0140 
0141     TH1 *h1_smd_hor_south_up_;
0142     TH1 *h1_smd_ver_south_up_;
0143     TH1 *h1_smd_hor_south_down_;
0144     TH1 *h1_smd_ver_south_down_;
0145     TH1 *h1_smd_hor_north_up_;
0146     TH1 *h1_smd_ver_north_up_;
0147     TH1 *h1_smd_hor_north_down_;
0148     TH1 *h1_smd_ver_north_down_;
0149 
0150     TH2 *h2_SouthZDC_;
0151     TH2 *h2_NorthZDC_;
0152     TH2 *h2_SouthSMD_;
0153     TH2 *h2_NorthSMD_;
0154     TH2 *h2_SouthVeto_;
0155     TH2 *h2_NorthVeto_;
0156     TH2 *h2_SouthZDC_cut_;
0157     TH2 *h2_NorthZDC_cut_;
0158     TH2 *h2_SouthSMD_cut_;
0159     TH2 *h2_NorthSMD_cut_;
0160     TH2 *h2_SouthVeto_cut_;
0161     TH2 *h2_NorthVeto_cut_;
0162 
0163     // simple asymmetries
0164     TGraphErrors *b_asymLR_north = nullptr;
0165     TGraphErrors *b_asymUD_north = nullptr;
0166     TGraphErrors *b_asym_north = nullptr;
0167     TGraphErrors *b_asymLR_south = nullptr;
0168     TGraphErrors *b_asymUD_south = nullptr;
0169     TGraphErrors *b_asym_south = nullptr;
0170 
0171     TGraphErrors *y_asymLR_north = nullptr;
0172     TGraphErrors *y_asymUD_north = nullptr;
0173     TGraphErrors *y_asym_north = nullptr;
0174     TGraphErrors *y_asymLR_south = nullptr;
0175     TGraphErrors *y_asymUD_south = nullptr;
0176     TGraphErrors *y_asym_south = nullptr;
0177 
0178     // square root asymmetries
0179     TGraphErrors *b_sqasymLR_north = nullptr;
0180     TGraphErrors *b_sqasymUD_north = nullptr;
0181     TGraphErrors *b_sqasym_north = nullptr;
0182     TGraphErrors *b_sqasymLR_south = nullptr;
0183     TGraphErrors *b_sqasymUD_south = nullptr;
0184     TGraphErrors *b_sqasym_south = nullptr;
0185 
0186     TGraphErrors *y_sqasymLR_north = nullptr;
0187     TGraphErrors *y_sqasymUD_north = nullptr;
0188     TGraphErrors *y_sqasym_north = nullptr;
0189     TGraphErrors *y_sqasymLR_south = nullptr;
0190     TGraphErrors *y_sqasymUD_south = nullptr;
0191     TGraphErrors *y_sqasym_south = nullptr;
0192 };
0193 
0194 #endif // ZDCSMDCOUT_H