Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2026-10-15 08:17:16

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef SINGLETRACKAN_H
0004 #define SINGLETRACKAN_H
0005 
0006 #include <fun4all/SubsysReco.h>
0007 
0008 #include <string>
0009 #include <array>
0010 
0011 class PHCompositeNode;
0012 class TTree;
0013 class TH1F;
0014 class TFile;
0015 
0016 class SingleTrackAN : public SubsysReco
0017 {
0018  public:
0019 
0020   SingleTrackAN(const std::string &name = "SingleTrackAN");
0021 
0022   ~SingleTrackAN() 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 
0043   /// Clean up internals after each event.
0044   int ResetEvent(PHCompositeNode *topNode) override;
0045 
0046   /// Called at the end of each run.
0047   int EndRun(const int runnumber) override;
0048 
0049   /// Called at the end of all processing.
0050   int End(PHCompositeNode *topNode) override;
0051 
0052   /// Reset
0053   int Reset(PHCompositeNode * /*topNode*/) override;
0054 
0055   void Print(const std::string &what = "ALL") const override;
0056 
0057   void set_output_filename(const std::string &filename) { m_output_filename = filename; }
0058 
0059  private:
0060 
0061   std::string m_output_filename = "SingleTrackAN.root";
0062 
0063 
0064 
0065 
0066 
0067   int bunchnum;
0068   int sphnxbunchnum;
0069   int multiplicity; 
0070   int crossing;
0071 
0072   // spin stuff
0073   static const int NBUNCHES = 120;
0074   int xingshift;
0075   int spinPatternBlue[NBUNCHES] = {0};
0076   int spinPatternYellow[NBUNCHES] = {0};
0077   int trackBunch = 0;
0078   int bspin = 0;
0079   int yspin = 0;
0080   float bpol;
0081   float bpolerr;
0082   float ypol;
0083   float ypolerr;
0084 
0085   // lumi
0086   std::array<double, 120> bunchnumber_lumi{0.};
0087 
0088   double lumi{0.};
0089 
0090 
0091   // track stuff
0092   float p;
0093   float pt;
0094   float pz;
0095   float xf;
0096   float eta;
0097   float phi;
0098   float quality;
0099   float charge;
0100 
0101 
0102   // bco stuff 
0103   int candidate_crossing;
0104   uint64_t bco;
0105   uint64_t bcowindowlow;
0106   uint64_t bcowindowhigh;
0107   bool usable_bco_tag;
0108   bool doublecount;
0109 
0110 
0111   TTree *singleTrackTree = nullptr;
0112   TTree *runTree = nullptr;
0113 
0114 
0115   TH1F *hbunchnum = nullptr;
0116   TH1F *hsphnxbunchnum = nullptr;
0117   TH1F *hmultiplicity = nullptr;
0118   TH1F *hcrossing = nullptr;
0119   TH1F *htrackBunch = nullptr;
0120   TH1F *hbspin = nullptr;
0121   TH1F *hyspin = nullptr;
0122 
0123   TFile *outfile; 
0124   
0125 
0126 
0127 
0128 
0129 };
0130 
0131 #endif // SINGLETRACKAN_H