Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:17

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 // stl includes
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 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  private:
0043   void createHistos();
0044   std::string getHistoPrefix() const;
0045   ///////////////////////////////////////////
0046   // general variables
0047   ///////////////////////////////////////////
0048   static const int kFelix_num_{8};     // the number of our FELIX server
0049   static const int kFee_num_{14};      // the number of half-ladders in a single FELIX server
0050   static const int kChip_num_{26};     // the number of chip in a half-ladder
0051   static const int kChan_num_{128};    // the number of channel in a single chip
0052   static const int kFirst_pid_{3001};  // the first pid (packet ID), which means intt0
0053 
0054   std::vector<InttRawHitContainer*> m_rawhit_containers;
0055   int previous_event_counter_{-1};
0056   int last_event_counter_{0};
0057   int event_counter_by_myself_{0};  // because the event counter is not reliable, I count it by myself for histogram normalization
0058 
0059   bool is_first_event_{true};
0060 
0061   ///////////////////////////////////////////
0062   // objects to be output
0063   ///////////////////////////////////////////
0064 
0065   // mother 3D hist
0066   TH3* hist_fee_chip_chan_[kFelix_num_]{nullptr};  // ch vs chip vs ladder vs felix
0067   // TH3* hist_fee_chip_chan_woclonehit_[ kFelix_num_ ]; // ch vs chip vs ladder vs felix ; without clonehit
0068   TH3* hist_fee_bco_full_event_counter_[kFelix_num_]{nullptr};       // event counter vs bco full vs ladder vs felix
0069   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) ) ) )
0070 
0071   // 2D hists
0072   TH2* hist_hitmap_[kFelix_num_][kFee_num_]{{nullptr}};
0073 
0074   // a simple 1D hists
0075   TH1* hist_nhit_{nullptr};        // the number of INTTRAWHIT
0076   TH1* hist_pid_{nullptr};         // the number of hits for each FELIX server
0077   TH1* hist_nhit_south_{nullptr};  // the number of INTTRAWHIT
0078   TH1* hist_nhit_north_{nullptr};  // the number of INTTRAWHIT
0079 
0080   // TH1* hist_fee_;
0081   // TH1* hist_chip_;
0082   // TH1* hist_chan_;
0083   TH1* hist_adc_{nullptr};
0084   TH1* hist_bco_{nullptr};       // FPHX BCO
0085   TH1* hist_bco_full_{nullptr};  // BCO full
0086 
0087   // felix vs event counter
0088   TH1* hist_event_counter_[kFelix_num_]{nullptr};
0089   TH1* hist_event_counter_diff_[kFelix_num_]{nullptr};
0090 
0091   ///////////////////////////////////////////
0092   // functions
0093   ///////////////////////////////////////////
0094   virtual std::vector<InttRawHit*> GetHits(InttRawHitContainer* container);
0095 };
0096 
0097 #endif  // INTTRAWHITQA_H