/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Utilities/SimplePIDSvc/SimplePIDSvc-00-00-11/SimplePIDSvc/SimplePIDSvc.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: PID for psi(3770) data                                           *
00003  * Package: SimplePIDSvc                                                     *
00004  *    File: SimplePIDSvc.h    $v8   2013/11/12$                              *
00005  * Authors:                                                                  *
00006  *   Chunlei LIU, chl56@andrew.cmu.edu                                       *
00007  *   Tian MA,     mat@ihep.ac.cn                                             *
00008  *                                                                           *
00009  *****************************************************************************/
00010 
00011 #ifndef SIMPLE_PID_SVC_H
00012 #define SIMPLE_PID_SVC_H
00013 
00014 #include "GaudiKernel/Service.h"
00015 #include "SimplePIDSvc/ISimplePIDSvc.h"
00016 #include "EvtRecEvent/EvtRecTrack.h"
00017 #include "TH1D.h"
00018 #include "TH2D.h"
00019 #include "TFile.h"
00020 
00021 class IDataProviderSvc;
00022 template <class TYPE> class CnvFactory;
00023 
00024 class SimplePIDSvc : public Service, virtual public ISimplePIDSvc
00025 {
00026         friend class CnvFactory<SimplePIDSvc>;
00027 
00028 public:
00029         SimplePIDSvc(const std::string& name, ISvcLocator* svcLoc);
00030         virtual ~SimplePIDSvc();
00031 
00032         virtual StatusCode initialize();
00033         virtual StatusCode finalize();
00034         virtual StatusCode queryInterface(const InterfaceID& riid, void** ppvIF);
00035 
00036         void    setdedxminchi(double x) { m_dedx_chi_cut = x; }
00037         void    settofminchi(double x)  { m_tof_chi_cut = x; }
00038         void    seteidratio(double x)   { m_eid_ratio = x; }
00039         void    preparePID(EvtRecTrack* track);
00040         bool    iselectron(bool emc = true);
00041         bool    ispion();
00042         bool    iskaon();
00043         // probabilities (dE/dx + TOF)
00044         double  probElectron() { return m_prob[0]; }
00045         double  probMuon()     { return m_prob[1]; }
00046         double  probPion()     { return m_prob[2]; }
00047         double  probKaon()     { return m_prob[3]; }
00048         double  probProton()   { return m_prob[4]; }
00049 
00050         double  getdEdxChi(int i) { return m_dedx_chi[i]; }
00051         double  getTOFChi(int i)  { return m_tof_chi[i]; }
00052         double  getEmcLikelihood(int i) { return m_emc_likelihood[i]; }
00053         double  getChi2(int i);
00054 
00055         // get TOF&EMC info for internal test & check
00056         double  getTofDt(int m, int n)  { return m_tof_dt[m][n]; }
00057         double  getTofPh(int n)         { return m_tof_ph[n]; }
00058         double  getTofZR(int n)         { return m_tof_zr[n]; }
00059         int     getTofCounter(int n)    { return m_tof_counter[n]; }
00060         int     getTofBarrel()          { return m_tof_barrel; }
00061         double  getEmcE()               { return m_emc_e; }
00062         double  getEmcE13()             { return m_emc_e13; }
00063         double  getEmcE35()             { return m_emc_e35; }
00064         double  getEmcLatMoment()       { return m_emc_lat; }
00065         double  getEmcSecMoment()       { return m_emc_sec; }
00066         double  getElectronLikelihood() { return m_lh_electron; }
00067 
00068 private:
00069         int     getRunIdx(int run_no);
00070         int     findBin(double *a, int length, double value);
00071         void    loadDedxInfo(EvtRecTrack *track);
00072         void    loadTOFInfo(EvtRecTrack *track);
00073         void    loadEMCInfo(EvtRecTrack *track);
00074         void    loadHistogram();
00075         void    dedxCorrection();
00076         void    tofBarrelCorrection();
00077         void    tofEndcapCorrection();
00078         void    calprob();
00079         bool    calEMCLikelihood();
00080 
00081         // variables in job_options
00082         bool   m_dedx_corr;
00083         bool   m_tof_corr;
00084         double m_dedx_chi_cut;
00085         double m_tof_chi_cut;
00086         double m_eid_ratio;
00087 
00088         IDataProviderSvc*  eventSvc_;
00089         int    m_run;  // run number
00090 
00091         bool   m_dedx_only[5];
00092         double m_p[5]; 
00093         double m_cost[5];
00094         int    m_charge[5];
00095         double m_betagamma[5];
00096 
00097         // TOF info
00098         double m_tof_dt[8][5];
00099         double m_tof_ph[8];
00100         double m_tof_zr[2];
00101         int    m_tof_counter[2];
00102         volatile int m_tof_barrel;
00103         // EMC info
00104         double m_emc_e;
00105         double m_emc_eop[5];
00106         double m_emc_e13;
00107         double m_emc_e35;
00108         double m_emc_sec;
00109         double m_emc_lat;
00110 
00111         // chisquares & probilites for each hypothesis
00112         double m_dedx_chi[5];
00113         double m_tof_chi[5];
00114         double m_emc_likelihood[5];
00115         double m_prob[5];
00116         double m_lh_electron;
00117         
00118         // dedx correction histogram 
00119         // (p, m)
00120         // p: 0-electron 1-k,pi
00121         // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
00122         TH2D *h_dedx_p_offset[2][4];
00123         TH2D *h_dedx_p_sigma[2][4];
00124         TH2D *h_dedx_m_offset[2][4];
00125         TH2D *h_dedx_m_sigma[2][4];
00126 
00127         // tof barrel correction histogram
00128         // (p, m, n)
00129         // p: 0-electron 1-k,pi
00130         // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
00131         // n: 0-inner east, 1-inner west, 2-outer east, 3-outer west
00132         TH1D *h_tof_p_q_offset[2][4][4];
00133         TH1D *h_tof_p_q_sigma[2][4][4];
00134         TH1D *h_tof_m_q_offset[2][4][4];
00135         TH1D *h_tof_m_q_sigma[2][4][4];
00136         TH2D *h_tof_p_bgcost_offset[2][4][4];
00137         TH2D *h_tof_p_bgcost_sigma[2][4][4];
00138         TH2D *h_tof_m_bgcost_offset[2][4][4];
00139         TH2D *h_tof_m_bgcost_sigma[2][4][4];
00140         
00141         TH2D *h_tof_p_wgt[2][4][15][5];
00142         TH2D *h_tof_m_wgt[2][4][15][5];
00143         TH2D *h_tof_p_final_offset[2][4][15];
00144         TH2D *h_tof_p_final_sigma[2][4][15];
00145         TH2D *h_tof_m_final_offset[2][4][15];
00146         TH2D *h_tof_m_final_sigma[2][4][15];
00147 
00148         // tof endcap correction histogram
00149         // (p, m, n)
00150         // p: 0-electron 1-k,pi
00151         // m: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
00152         // n: 0-east, 1-west
00153         TH1D *h_tofec_p_q_offset[2][4][2];
00154         TH1D *h_tofec_p_q_sigma[2][4][2];
00155         TH1D *h_tofec_m_q_offset[2][4][2];
00156         TH1D *h_tofec_m_q_sigma[2][4][2];
00157         TH1D *h_tofec_p_bg_offset[2][4][2];
00158         TH1D *h_tofec_p_bg_sigma[2][4][2];
00159         TH1D *h_tofec_m_bg_offset[2][4][2];
00160         TH1D *h_tofec_m_bg_sigma[2][4][2];
00161         TH1D *h_tofec_p_cost_offset[2][4][2];
00162         TH1D *h_tofec_p_cost_sigma[2][4][2];
00163         TH1D *h_tofec_m_cost_offset[2][4][2];
00164         TH1D *h_tofec_m_cost_sigma[2][4][2];
00165 
00166         // emc histogram
00167         // (p, q, m, n)
00168         // p: 0-electron, 1-pion, 2-kaon
00169         // q: 0-10 data, 1-11 data, 2-10 mc, 3-11 mc
00170         // m: 15 momentum-bin
00171         // n: 25 cost-bin
00172         TH1D *h_emc_ep[3][4][15][25];
00173         TH1D *h_emc_e35[3][4][15][25];
00174 
00175         // TFiles
00176         TFile *f_dedx[2][4];
00177         TFile *f_tof_q[2][4];
00178         TFile *f_tof_bgcost[2][4];
00179         TFile *f_tof_wgt[2][4];
00180         TFile *f_tof_final[2][4];
00181         TFile *f_tofec_q[2][4];
00182         TFile *f_tofec_bg[2][4];
00183         TFile *f_tofec_cost[2][4];
00184         TFile *f_emc[3][4];
00185 };
00186 
00187 #endif //SIMPLE_PID_SVC_H

Generated on Tue Nov 29 23:14:44 2016 for BOSS_7.0.2 by  doxygen 1.4.7