Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:17:30

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef QA_INTT_INTTRAWHITQA_H
0004 #define QA_INTT_INTTRAWHITQA_H
0005 
0006 // Fun4All libraries
0007 #include <fun4all/SubsysReco.h>
0008 
0009 // std libraries
0010 #include <string>
0011 #include <vector>
0012 
0013 class InttRawHit;
0014 class InttRawHitContainer;
0015 class PHCompositeNode;
0016 class TH1;
0017 class TH2;
0018 class TH3;
0019 
0020 class InttRawHitQA : public SubsysReco
0021 {
0022  public:
0023   InttRawHitQA(const std::string& name = "InttRawHitQA");
0024 
0025   ~InttRawHitQA() override = default;
0026 
0027   /** Called during initialization.
0028       Typically this is where you can book histograms, and e.g.
0029       register them to Fun4AllServer (so they can be output to file
0030       using Fun4AllServer::dumpHistos() method).
0031    */
0032   int Init(PHCompositeNode* topNode) override;
0033 
0034   /** Called for first event when run number is known.
0035       Typically this is where you may want to fetch data from
0036       database, because you know the run number. A place
0037       to book histograms which have to know the run number.
0038    */
0039   int InitRun(PHCompositeNode* topNode) override;
0040 
0041   /** Called for each event.
0042       This is where you do the real work.
0043    */
0044   int process_event(PHCompositeNode* topNode) override;
0045 
0046   /// Clean up internals after each event.
0047   int ResetEvent(PHCompositeNode* topNode) override;
0048 
0049   /// Called at the end of each run.
0050   int EndRun(const int runnumber) override;
0051 
0052   /// Called at the end of all processing.
0053   int End(PHCompositeNode* topNode) override;
0054 
0055   /// Reset
0056   int Reset(PHCompositeNode* /*topNode*/) override;
0057 
0058  private:
0059   void createHistos();
0060   std::string getHistoPrefix() const;
0061   ///////////////////////////////////////////
0062   // general variables
0063   ///////////////////////////////////////////
0064   static const int kFelix_num_ = 8;     // the number of our FELIX server
0065   static const int kFee_num_ = 14;      // the number of half-ladders in a single FELIX server
0066   static const int kChip_num_ = 26;     // the number of chip in a half-ladder
0067   static const int kChan_num_ = 128;    // the number of channel in a single chip
0068   static const int kFirst_pid_ = 3001;  // the first pid (packet ID), which means intt0
0069 
0070     std::vector<InttRawHitContainer*> m_rawhit_containers;
0071   int previous_event_counter_ = -1;
0072   int last_event_counter_ = 0;
0073   int event_counter_by_myself_ = 0;  // because the event counter is not reliable, I count it by myself for histogram normalization
0074 
0075   bool is_first_event_ = true;
0076 
0077   ///////////////////////////////////////////
0078   // objects to be output
0079   ///////////////////////////////////////////
0080 
0081   // mother 3D hist
0082   TH3* hist_fee_chip_chan_[kFelix_num_]{nullptr};  // ch vs chip vs ladder vs felix
0083   // TH3* hist_fee_chip_chan_woclonehit_[ kFelix_num_ ]; // ch vs chip vs ladder vs felix ; without clonehit
0084   TH3* hist_fee_bco_full_event_counter_[kFelix_num_]{nullptr};       // event counter vs bco full vs ladder vs felix
0085   TH3* hist_fee_bco_full_event_counter_diff_[kFelix_num_]{nullptr};  // difference of event counter vs difference of bco full vs ladder vs felix, difference means ( val - Min( val(felix=Min(felix) ) ) )
0086 
0087   // 2D hists
0088   TH2* hist_hitmap_[kFelix_num_][kFee_num_]{{nullptr}};
0089 
0090   // a simple 1D hists
0091   TH1* hist_nhit_{nullptr};        // the number of INTTRAWHIT
0092   TH1* hist_pid_{nullptr};         // the number of hits for each FELIX server
0093   TH1* hist_nhit_south_{nullptr};  // the number of INTTRAWHIT
0094   TH1* hist_nhit_north_{nullptr};  // the number of INTTRAWHIT
0095 
0096   // TH1* hist_fee_;
0097   // TH1* hist_chip_;
0098   // TH1* hist_chan_;
0099   TH1* hist_adc_{nullptr};
0100   TH1* hist_bco_{nullptr};       // FPHX BCO
0101   TH1* hist_bco_full_{nullptr};  // BCO full
0102 
0103   // felix vs event counter
0104   TH1* hist_event_counter_[kFelix_num_]{nullptr};
0105   TH1* hist_event_counter_diff_[kFelix_num_]{nullptr};
0106 
0107   ///////////////////////////////////////////
0108   // functions
0109   ///////////////////////////////////////////
0110   virtual std::vector<InttRawHit*> GetHits(InttRawHitContainer* container);
0111 };
0112 
0113 #endif  // INTTRAWHITQA_H