Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:13:56

0001 #pragma once
0002 
0003 class Analysis
0004 {
0005 private:
0006   int run_no_;
0007   bool mag_on_;
0008   bool debug_;
0009   bool is_preliminary_ = false;
0010   
0011   int fphx_bco_ = -1;
0012   
0013   int sigma_ = 3;
0014   int nloop_ = 50;
0015   int page_num_limit_ = 500;
0016   int event_counter_ = 0;
0017   int page_counter_ = 0;
0018   int good_counter_ = 0;
0019 
0020   double vertex_range_z_ = 10; // range of z_vertex to select events to be drawn
0021   bool is_geant_ = false;
0022   //bool does_reverse_ = false;  
0023   bool take_too_good_event_ = true;
0024   
0025   /////////////////////////////////////////////////////////////////////////
0026   // Variables/Objects for I/O                                           //
0027   /////////////////////////////////////////////////////////////////////////
0028   //  string data_dir_ = "/sphenix/u/nukazuka/work_now/analysis/tracking/hinakos/work/F4AInttRead/macro/results/";
0029   string data_dir_ = "./results/";
0030   string fname_input_; 
0031   
0032   string dir_output_ = "results/tracking/";
0033   TString fname_output_;
0034   TFile *f_input_;
0035   TFile *f_output_; 
0036   string output_pdf_ = "";
0037   string output_good_pdf_ = "";
0038   
0039   /////////////////////////////////////////////////////////////////////////
0040   // Histograms                                                          //
0041   /////////////////////////////////////////////////////////////////////////
0042   TH1F *h_dcaz_one_ ;
0043   TH1F *h_nclus_ ;
0044   TH2F* h_dphi_nocut_ ;
0045   TH1F *h_dcaz_sigma_one_ ;
0046   TH1D *h_xvtx_ ;
0047   TH1D *h_yvtx_ ;
0048   TH1D *h_zvtx_ ;
0049   //  TH2D *h_zr_[2];
0050 
0051   TH1F *h_dcax_ ;
0052   TH1F *h_dcay_ ;
0053   TH1F *h_dcaz_ ;
0054   TH1F *h_dtheta_ ;
0055   TH1F *h_dphi_ ;
0056   TH1F *h_dca2d_ ;
0057 
0058   /////////////////////////////////////////////////////////////////////////
0059   // Trees                                                               //
0060   /////////////////////////////////////////////////////////////////////////
0061   TTree *temp_tree_ ;
0062   TTree *clus_tree_ ;
0063   TTree *truth_tree_ ;
0064   TTree *track_tree_ ;
0065   TTree *hepmctree_;
0066   TTree* bco_tree_;
0067   TNtuple *ntp_clus_;
0068   TNtuple *ntp_evt_; 
0069 
0070   /////////////////////////////////////////////////////////////////////////
0071   // Tree variables                                                      //
0072   /////////////////////////////////////////////////////////////////////////
0073   TVector3 vertex_;
0074   double x_vertex_;
0075   double y_vertex_;
0076   double z_vertex_;
0077 
0078   // variables for temp_tree_
0079   int evt_temp_;
0080   vector<double> d_phi_;
0081   vector<double> d_theta_;
0082   vector<double> dca_x_;
0083   vector<double> dca_y_;
0084   vector<double> dca_z_;
0085   vector<double> dca_2d_;
0086   double zvtx_one_;
0087   double zvtx_sigma_one_;
0088 
0089   // variables for ?
0090   int evt_clus_;
0091   vector<double> x_in_;
0092   vector<double> y_in_;
0093   vector<double> z_in_;
0094   vector<double> r_in_;
0095   vector<int> size_in_;
0096   vector<double> phi_in_;
0097   vector<double> theta_in_;
0098   vector<double> adc_in_;
0099   vector<bool>   is_associated_in_;
0100   vector<double> track_incoming_theta_in_;
0101   vector<double> x_out_;
0102   vector<double> y_out_;
0103   vector<double> z_out_;
0104   vector<double> r_out_;
0105   vector<int> size_out_;
0106   vector<double> phi_out_;
0107   vector<double> theta_out_;
0108   vector<double> adc_out_;
0109   vector<bool>   is_associated_out_;
0110   vector<double> track_incoming_theta_out_;  
0111 
0112   // variables for ntp_evt_
0113   float vertex_z_ = -9999;
0114 
0115   // variables for bco_tree_
0116   ULong64_t bco_intt_ = 0;
0117 
0118   //
0119   int evt_track_;
0120   int ntrack_ = 0;
0121   vector<double> slope_rz_;
0122   vector<double> phi_tracklets_;
0123   vector<double> theta_tracklets_;
0124   vector<double> phi_track_;
0125   vector<double> theta_track_;
0126   vector<double> z_tracklets_out_;
0127   vector<int> is_deleted_;
0128   vector<int> dca_range_out_;
0129   vector<int> dca2d_range_out_;
0130   vector<int> dcaz_range_out_;
0131   vector<double> pT_;
0132   vector<double> px_truth_;
0133   vector<double> py_truth_;
0134   vector<double> pz_truth_;
0135   vector<double> px_;
0136   vector<double> py_;
0137   vector<double> pz_;
0138   vector<double> rad_;
0139   vector<double> pT_truth_;
0140   vector<double> charge_;
0141 
0142   int evt_truth_;
0143   int ntruth_ = 0;
0144   int ntruth_cut_ = 0;
0145   vector<double> truthpx_;
0146   vector<double> truthpy_;
0147   vector<double> truthpz_;
0148   vector<double> truthpt_;
0149   vector<double> trutheta_;
0150   vector<double> truththeta_;
0151   vector<double> truthphi_;
0152   vector<double> truthxvtx_;
0153   vector<double> truthyvtx_;
0154   vector<double> truthzvtx_;
0155   vector<double> truthzout_;
0156   vector<int> truthpid_;
0157   vector<int> status_;
0158 
0159   // from input file
0160   
0161   bool no_mc_;
0162 
0163   Float_t nclus_;
0164   Float_t nclus2_;
0165   Float_t bco_full_;
0166   Float_t evt_;
0167   Float_t size_;
0168   Float_t adc_;
0169   Float_t x_;
0170   Float_t y_;
0171   Float_t z_;
0172   Float_t lay_;
0173   Float_t lad_;
0174   Float_t sen_;
0175   Float_t x_vtx_;
0176   Float_t y_vtx_;
0177   Float_t z_vtx_;
0178 
0179   double m_truthpx_;
0180   double m_truthpy_;
0181   double m_truthpz_;
0182   double m_truthpt_;
0183   double m_trutheta_;
0184   double m_truththeta_;
0185   double m_truthphi_;
0186   double m_xvtx_;
0187   double m_yvtx_;
0188   double m_zvtx_;
0189   
0190   int m_evt_;
0191   int m_status_;
0192   int m_truthpid_;
0193   
0194   /////////////////////////////////////////////////////////////////////////
0195   // Misc variables/objects                                              //
0196   /////////////////////////////////////////////////////////////////////////
0197   TCanvas* c_;
0198 
0199   void Init();
0200   void InitIO();
0201   void InitInput();
0202   void InitOutput();
0203   void InitHist();
0204   void InitTree();
0205   void InitCanvas();
0206   
0207   void ResetVariables();
0208   //void Reset();
0209   void ResetTempTreeVariables();
0210   void ResetClustTreeVariables();
0211   void ResetTruthTreeVariables();
0212   void ResetTrackTreeVariables();
0213   void ResetHepMcTreeVariables();
0214 
0215   void ProcessEvent();
0216   void ProcessEvent_Draw( clustEvent event );
0217   void EndProcess();
0218 public:
0219   Analysis(int run_no = 50889, int fphx_bco=-1, bool mag_on = true, bool debug = false, bool is_preliminary=false );
0220 
0221   void Begin();
0222 
0223   void SetDebugMode( bool flag ){ debug_ = flag;};
0224   void SetPageNumLimit( int val ){ page_num_limit_ = val; };
0225   void SetVertexRangeZ( double val ){ vertex_range_z_ = val;};
0226   
0227   void UseTooGoodEventOnly( bool flag ){ take_too_good_event_ = flag;};
0228 };
0229 
0230 #ifndef Analysis_cc
0231 #include "Analysis.cc"
0232 #endif