EmcPID Class Reference

#include <EmcPID.h>

Inheritance diagram for EmcPID:

ParticleIDBase List of all members.

Public Member Functions

 ~EmcPID ()
void init ()
void calculate ()
bool IsPidInfoValid () const
double chi (int n) const
double prob (int n) const
int ndof () const
double energy () const
double eseed () const
double e3x3 () const
double e5x5 () const
double delta_theta () const
double delta_phi () const
double secondmoment () const
double val_emc1 () const
int neuronPID () const
double pars (int n) const
EvtRecTrackPidTrk () const
void setRecTrack (EvtRecTrack *trk)
double chiMinCut () const
void setChiMinCut (const double chi=4)
double chiMaxCut () const
void setChiMaxCut (const double chi=6)
double pdfMinSigmaCut () const
void setPdfMinSigmaCut (const double pdf=4)
double getRunNo () const
void setRunNo (const double runh=8093)
double p ()
double pt ()
double charge ()
double xmass (int n)
double velc ()
double probCalculate (double chi2, int n)
double pdfCalculate (double offset, double sigma)
double interpolation (double *x, double *y, double x1)
double pol2 (double x, double *par)
double pol3 (double x, double *par)
double pol4 (double x, double *par)
int useDedx () const
int useTof () const
int useTof1 () const
int useTof2 () const
int useTofE () const
int useTofQ () const
int useTofC () const
int useTofCorr () const
int useEmc () const
int useMuc () const
int onlyPionKaon () const
int onlyPionKaonProton () const
int onlyPionKaonElectron () const
int all () const
int onlyElectron () const
int onlyMuon () const
int onlyPion () const
int onlyKaon () const
int onlyProton () const
int methodLikelihood () const
int methodProbability () const
int methodNeuronNetwork () const
int dedxValid () const
int tofValid () const
int tofeValid () const
int tofqValid () const
int tofcValid () const
int tofcorrValid () const
int emcValid () const
int mucValid () const
void set_path (const char *s_path=0)
void set_path (std::string s_path)

Static Public Member Functions

static EmcPIDinstance ()

Protected Member Functions

int particleIDCalculation ()
int neuronPIDCalculation ()
int LikelihoodCalculation ()

Static Protected Attributes

static std::string path = ""

Private Member Functions

 EmcPID ()

Private Attributes

double m_chi [5]
double m_prob [5]
double m_chimin
int m_ndof
double m_ptrk
double m_pt
int m_type
double m_energy
double m_eseed
double m_e3x3
double m_e5x5
double m_delta_theta
double m_delta_phi
double m_secondmoment
double m_latmoment
double m_a20moment
double m_a42moment
double m_val_emc
double params_emc1 [9]
double m_e_h [18][300]
double m_m_h [18][300]
double m_p_h [18][300]

Static Private Attributes

static TMultiLayerPerceptron * m_mlp_emc = 0
static TTree * m_trainTree_emconly = 0
static EmcPIDm_pointer = 0

Detailed Description

Definition at line 16 of file EmcPID.h.


Constructor & Destructor Documentation

EmcPID::~EmcPID (  )  [inline]

Definition at line 21 of file EmcPID.h.

00021 {;} 

EmcPID::EmcPID (  )  [private]

Definition at line 28 of file EmcPID.cxx.

References genRecEmupikp::i, showlog::input, ganga-rec::j, m_a20moment, m_a42moment, m_delta_phi, m_delta_theta, m_e3x3, m_e5x5, m_e_h, m_energy, m_eseed, m_latmoment, m_m_h, m_mlp_emc, m_p_h, m_pt, m_ptrk, m_secondmoment, m_trainTree_emconly, m_type, ParticleIDBase::path, and deljobs::string.

Referenced by instance().

00028               :ParticleIDBase() {
00029    m_mlp_emc = 0;
00030    std::string e_emc_file = path + "/share/elec_emc_hist.txt";
00031    //std::string e_emc_file = "$PARTICLEIDROOT/share/elechist.txt";
00032    ifstream input(e_emc_file.c_str(),std::ios_base::in);
00033    if ( !input ) {
00034       cout << " can not open: " << e_emc_file << endl;
00035       exit(1);
00036    }
00037    for(int i=0; i<18; i++) {
00038       for(int j=0; j<300; j++) {
00039          input>>m_e_h[i][j];
00040       }
00041    }
00042    //   std::string pi_emc_file = "/ihepbatch/bes/huangb/boss610/Analysis/ParticleID/ParticleID-00-02-03/share/pionhist.txt";
00043    std::string pi_emc_file =  path + "/share/pion_emc_hist.txt";
00044    //std::string pi_emc_file = "$PARTICLEIDROOT/share/pionhist.txt";
00045    ifstream input1(pi_emc_file.c_str(),std::ios_base::in);
00046    if ( !input1 ) {
00047       cout << " can not open: " << pi_emc_file << endl;
00048       exit(1);
00049    }
00050    for(int i=0; i<18; i++) {
00051       for(int j=0; j<300; j++) {
00052          input1>>m_p_h[i][j];
00053       }
00054    }
00055    std::string mu_emc_file =  path + "/share/muon_emc_hist.txt";
00056    //  std::string mu_emc_file = "/ihepbatch/bes/huangb/boss610/Analysis/ParticleID/ParticleID-00-02-03/share/muonhist.txt";
00057    //std::string mu_emc_file = "$PARTICLEIDROOT/share/muonhist.txt";
00058    ifstream input2(mu_emc_file.c_str(),std::ios_base::in);
00059    if ( !input2 ) {
00060       cout << " can not open: " << mu_emc_file << endl;
00061       exit(1);
00062    }
00063    for(int i=0; i<18; i++) {
00064       for(int j=0; j<300; j++) {
00065          input2>>m_m_h[i][j];
00066 
00067       }
00068    }
00069 
00070    if(!m_trainTree_emconly) {
00071       m_trainTree_emconly = new TTree("m_trainTree_emconly","m_trainTree_emconly");
00072       m_trainTree_emconly->Branch("ptrk",&m_ptrk,"ptrk/D");
00073       m_trainTree_emconly->Branch("pt",&m_pt,"pt/D");
00074       m_trainTree_emconly->Branch("type",&m_type,"type/D");
00075       m_trainTree_emconly->Branch("energy",&m_energy,"energy/D");
00076       m_trainTree_emconly->Branch("eseed",&m_eseed,"eseed/D");
00077       m_trainTree_emconly->Branch("e3x3",&m_e3x3,"e3x3/D");
00078       m_trainTree_emconly->Branch("e5x5",&m_e5x5,"e5x5/D");
00079       m_trainTree_emconly->Branch("latmoment",&m_latmoment,"latmoment/D");
00080       m_trainTree_emconly->Branch("a20moment",&m_a20moment,"a20moment/D");
00081       m_trainTree_emconly->Branch("a42moment",&m_a42moment,"a42moment/D");
00082       m_trainTree_emconly->Branch("secondmoment",&m_secondmoment,"secondmoment/D");
00083       m_trainTree_emconly->Branch("delta_phi",&m_delta_phi,"delta_phi/D");
00084       m_trainTree_emconly->Branch("delta_theta",&m_delta_theta,"delta_theta/D");
00085    }
00086    std::string emc =  path + "/share/emc.txt";
00087    if(!m_mlp_emc) {
00088       //  m_mlp_emc = new TMultiLayerPerceptron("ptrk,pt,energy,eseed,e3x3,e5x5,secondmoment,delta_theta,delta_phi:18:type",m_trainTree_emconly);
00089       m_mlp_emc = new TMultiLayerPerceptron("ptrk,pt,energy,eseed,e3x3,e5x5,secondmoment,latmoment,a20moment,a42moment,delta_theta,delta_phi:24:type",m_trainTree_emconly);
00090 
00091       m_mlp_emc->LoadWeights(emc.c_str());
00092 
00093    }
00094 }


Member Function Documentation

int ParticleIDBase::all (  )  const [inline, inherited]

Definition at line 79 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_ELECTRON, ParticleIDBase::IDENTIFY_KAON, ParticleIDBase::IDENTIFY_PION, and ParticleIDBase::IDENTIFY_PROTON.

void EmcPID::calculate (  )  [virtual]

Implements ParticleIDBase.

Definition at line 153 of file EmcPID.cxx.

References m_ndof, and particleIDCalculation().

00153                        {
00154    if(particleIDCalculation() == 0) m_ndof = 1;
00155 }

double ParticleIDBase::charge (  )  [inherited]

Definition at line 116 of file ParticleIDBase.cxx.

References DstMdcTrack::charge(), EvtRecTrack::isMdcTrackValid(), ParticleIDBase::m_trk, and EvtRecTrack::mdcTrack().

Referenced by TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), and DedxPID::particleIDCalculation().

00116                               {
00117    double val = 999;
00118    if(!m_trk) return val;
00119    if(!m_trk->isMdcTrackValid()) return val;
00120    RecMdcTrack *mdcTrk = m_trk->mdcTrack();
00121    val = mdcTrk->charge() + 0.0;
00122    return val;
00123 }

double EmcPID::chi ( int  n  )  const [inline, virtual]

Implements ParticleIDBase.

Definition at line 26 of file EmcPID.h.

References m_chi.

00026 {return m_chi[n];}

double ParticleIDBase::chiMaxCut (  )  const [inline, inherited]

Definition at line 40 of file ParticleIDBase.h.

References ParticleIDBase::m_chimax_cut.

Referenced by TofCorrPID::correlationCheck(), TofCorrPID::particleIDCalculation(), and ParticleID::particleIDCalculation().

00040 {return m_chimax_cut;}

double ParticleIDBase::chiMinCut (  )  const [inline, inherited]

Definition at line 38 of file ParticleIDBase.h.

References ParticleIDBase::m_chimin_cut.

Referenced by TofCorrPID::correlationCheck(), TofPID::particleIDCalculation(), TofCPID::particleIDCalculation(), TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), ParticleID::particleIDCalculation(), and DedxPID::particleIDCalculation().

00038 {return m_chimin_cut;}

int ParticleIDBase::dedxValid (  )  const [inline, inherited]

Definition at line 91 of file ParticleIDBase.h.

References ParticleIDBase::DEDX_VALID.

00091 {return DEDX_VALID;}

double EmcPID::delta_phi (  )  const [inline]

Definition at line 34 of file EmcPID.h.

References m_delta_phi.

00034 {return m_delta_phi;}

double EmcPID::delta_theta (  )  const [inline]

Definition at line 33 of file EmcPID.h.

References m_delta_theta.

00033 {return m_delta_theta;}

double EmcPID::e3x3 (  )  const [inline]

Definition at line 31 of file EmcPID.h.

References m_e3x3.

00031 {return m_e3x3;}

double EmcPID::e5x5 (  )  const [inline]

Definition at line 32 of file EmcPID.h.

References m_e5x5.

00032 {return m_e5x5;}

int ParticleIDBase::emcValid (  )  const [inline, inherited]

Definition at line 97 of file ParticleIDBase.h.

References ParticleIDBase::EMC_VALID.

00097 {return EMC_VALID;}

double EmcPID::energy (  )  const [inline]

Definition at line 29 of file EmcPID.h.

References m_energy.

00029 {return m_energy;}

double EmcPID::eseed (  )  const [inline]

Definition at line 30 of file EmcPID.h.

References m_eseed.

00030 {return m_eseed;}

double ParticleIDBase::getRunNo (  )  const [inline, inherited]

Definition at line 44 of file ParticleIDBase.h.

References ParticleIDBase::m_runno.

Referenced by TofCPID::calculate(), DedxPID::CorrDedx(), TofCorrPID::init(), TofCPID::offsetTofC(), TofCorrPID::sigmaTof(), and TofCPID::sigmaTofC().

00044 {return m_runno;}

void EmcPID::init (  )  [virtual]

Implements ParticleIDBase.

Definition at line 95 of file EmcPID.cxx.

References genRecEmupikp::i, m_chi, m_chimin, m_delta_phi, m_delta_theta, m_e3x3, m_e5x5, m_energy, m_eseed, m_ndof, m_prob, m_secondmoment, and m_val_emc.

Referenced by ParticleID::init().

00095                   {
00096    for(int i = 0; i < 5; i++) {
00097       m_chi[i] = 99.0;
00098       m_prob[i] = -1.0;
00099    }
00100    m_chimin = 99.;
00101    m_ndof = 0;
00102    m_energy = -99;
00103    m_eseed = -99;
00104    m_e3x3 = -99;
00105    m_e5x5 = -99;
00106    m_delta_theta = -99;
00107    m_delta_phi = -99;
00108    m_secondmoment = -99;
00109    m_val_emc = -99;
00110    //   std::string emc =  path + "/share/emc_epimu.txt";
00111    /*   if(!m_trainTree_emconly){
00112      m_trainTree_emconly = new TTree("m_trainTree_emconly","m_trainTree_emconly");
00113      m_trainTree_emconly->Branch("ptrk",&m_ptrk,"ptrk/D");
00114      m_trainTree_emconly->Branch("pt",&m_pt,"pt/D");
00115      m_trainTree_emconly->Branch("type",&m_type,"type/D");
00116      m_trainTree_emconly->Branch("energy",&m_energy,"energy/D");
00117      m_trainTree_emconly->Branch("eseed",&m_eseed,"eseed/D");
00118      m_trainTree_emconly->Branch("e3x3",&m_e3x3,"e3x3/D");
00119      m_trainTree_emconly->Branch("e5x5",&m_e5x5,"e5x5/D");
00120      m_trainTree_emconly->Branch("secondmoment",&m_secondmoment,"secondmoment/D");
00121      m_trainTree_emconly->Branch("delta_phi",&m_delta_phi,"delta_phi/D");
00122      m_trainTree_emconly->Branch("delta_theta",&m_delta_theta,"delta_theta/D");
00123       }
00124      if(!m_mlp_emc){
00125     m_mlp_emc = new TMultiLayerPerceptron("ptrk,pt,energy,eseed,e3x3,e5x5,secondmoment,delta_theta,delta_phi:18:type",m_trainTree_emconly);
00126      m_mlp_emc->LoadWeights(emc.c_str());
00127    }
00128    */
00129 
00130    /*if(!m_trainTree_emconly){
00131    m_trainTree_emconly = new TTree("m_trainTree_emconly","m_trainTree_emconly");
00132    m_trainTree_emconly->Branch("ptrk",&m_ptrk,"ptrk/D");
00133    m_trainTree_emconly->Branch("pt",&m_pt,"pt/D");
00134    m_trainTree_emconly->Branch("type",&m_type,"type/D");
00135    m_trainTree_emconly->Branch("energy",&m_energy,"energy/D");
00136    m_trainTree_emconly->Branch("eseed",&m_eseed,"eseed/D");
00137    m_trainTree_emconly->Branch("e3x3",&m_e3x3,"e3x3/D");
00138    m_trainTree_emconly->Branch("e5x5",&m_e5x5,"e5x5/D");
00139    m_trainTree_emconly->Branch("secondmoment",&m_secondmoment,"secondmoment/D");
00140    m_trainTree_emconly->Branch("delta_phi",&m_delta_phi,"delta_phi/D");
00141    m_trainTree_emconly->Branch("delta_theta",&m_delta_theta,"delta_theta/D");
00142    }
00143    if(!m_mlp_emc){
00144    m_mlp_emc = new TMultiLayerPerceptron("ptrk,pt,energy,eseed,e3x3,e5x5,secondmoment,delta_theta,delta_phi:18:type",m_trainTree_emconly);
00145    m_mlp_emc->LoadWeights(emc.c_str());
00146    }
00147    */
00148 
00149 
00150 
00151 }

EmcPID * EmcPID::instance (  )  [static]

Definition at line 23 of file EmcPID.cxx.

References EmcPID(), and m_pointer.

Referenced by ParticleID::init().

00023                           {
00024    if(!m_pointer) m_pointer = new EmcPID();
00025    return m_pointer;
00026 }

double ParticleIDBase::interpolation ( double *  x,
double *  y,
double  x1 
) [inherited]

Definition at line 125 of file ParticleIDBase.cxx.

00125                                                                    {
00126    double c1 = (y[0]-y[1])*(x[1]-x[2])-(x[0]-x[1])*(y[1]-y[2]);
00127    double c2 = (x[0]*x[0]-x[1]*x[1])*(x[1]-x[2])-(x[1]*x[1]-x[2]*x[2])*(x[0]-x[1]);
00128    double c = c1/c2;
00129    double b1 = (y[0]-y[1])*(x[1]*x[1]-x[2]*x[2])-(x[0]*x[0]-x[1]*x[1])*(y[1]-y[2]);
00130    double b2 = (x[0]-x[1])*(x[1]*x[1]-x[2]*x[2])-(x[1]-x[2])*(x[0]*x[0]-x[1]*x[1]);
00131    double b = b1/b2;
00132    double a = y[0] - b*x[0]-c*x[0]*x[0];
00133    double y1 = a + b*x1 +c*x1*x1;
00134    return y1;
00135 }

bool EmcPID::IsPidInfoValid (  )  const [inline, virtual]

Implements ParticleIDBase.

Definition at line 25 of file EmcPID.h.

References m_ndof.

00025 {return (m_ndof> 0);}

int EmcPID::LikelihoodCalculation (  )  [inline, protected, virtual]

Implements ParticleIDBase.

Definition at line 44 of file EmcPID.h.

00044 {return -1;}

int ParticleIDBase::methodLikelihood (  )  const [inline, inherited]

Definition at line 87 of file ParticleIDBase.h.

References ParticleIDBase::LIKELIHOOD_PID.

00087 {return LIKELIHOOD_PID;}

int ParticleIDBase::methodNeuronNetwork (  )  const [inline, inherited]

Definition at line 89 of file ParticleIDBase.h.

References ParticleIDBase::NEURONNETWORK_PID.

00089 {return NEURONNETWORK_PID;}

int ParticleIDBase::methodProbability (  )  const [inline, inherited]

Definition at line 88 of file ParticleIDBase.h.

References ParticleIDBase::PROBABILITY_PID.

00088 {return PROBABILITY_PID;}

int ParticleIDBase::mucValid (  )  const [inline, inherited]

Definition at line 98 of file ParticleIDBase.h.

References ParticleIDBase::MUC_VALID.

00098 {return MUC_VALID;}

int EmcPID::ndof (  )  const [inline, virtual]

Implements ParticleIDBase.

Definition at line 28 of file EmcPID.h.

References m_ndof.

00028 {return m_ndof;}

int EmcPID::neuronPID (  )  const [inline]

Definition at line 37 of file EmcPID.h.

00037 {return -1;}

int EmcPID::neuronPIDCalculation (  )  [inline, protected]

Definition at line 43 of file EmcPID.h.

00043 {return -1;}

int ParticleIDBase::onlyElectron (  )  const [inline, inherited]

Definition at line 80 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_ELECTRON.

Referenced by ParticleID::LikelihoodCalculation(), and ParticleID::particleIDCalculation().

00080 {return IDENTIFY_ELECTRON;}

int ParticleIDBase::onlyKaon (  )  const [inline, inherited]

Definition at line 83 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_KAON.

Referenced by ParticleID::LikelihoodCalculation(), and ParticleID::particleIDCalculation().

00083 {return IDENTIFY_KAON;}

int ParticleIDBase::onlyMuon (  )  const [inline, inherited]

Definition at line 81 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_MUON.

Referenced by ParticleID::LikelihoodCalculation(), and ParticleID::particleIDCalculation().

00081 {return IDENTIFY_MUON;}

int ParticleIDBase::onlyPion (  )  const [inline, inherited]

Definition at line 82 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_PION.

Referenced by ParticleID::LikelihoodCalculation(), and ParticleID::particleIDCalculation().

00082 {return IDENTIFY_PION;}

int ParticleIDBase::onlyPionKaon (  )  const [inline, inherited]

Definition at line 76 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_KAON, and ParticleIDBase::IDENTIFY_PION.

00076 {return (IDENTIFY_PION | IDENTIFY_KAON);}

int ParticleIDBase::onlyPionKaonElectron (  )  const [inline, inherited]

Definition at line 78 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_ELECTRON, ParticleIDBase::IDENTIFY_KAON, and ParticleIDBase::IDENTIFY_PION.

int ParticleIDBase::onlyPionKaonProton (  )  const [inline, inherited]

Definition at line 77 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_KAON, ParticleIDBase::IDENTIFY_PION, and ParticleIDBase::IDENTIFY_PROTON.

int ParticleIDBase::onlyProton (  )  const [inline, inherited]

Definition at line 84 of file ParticleIDBase.h.

References ParticleIDBase::IDENTIFY_PROTON.

Referenced by ParticleID::LikelihoodCalculation(), and ParticleID::particleIDCalculation().

00084 {return IDENTIFY_PROTON;}

double ParticleIDBase::p (  )  [inherited]

Definition at line 100 of file ParticleIDBase.cxx.

References EvtRecTrack::isMdcTrackValid(), ParticleIDBase::m_trk, EvtRecTrack::mdcTrack(), and DstMdcTrack::p().

Referenced by DedxPID::cal_par(), TofCorrPID::particleIDCalculation(), and ParticleIDBase::probCalculate().

00100                          {
00101    double val = 999;
00102    if(!m_trk) return val;
00103    if(!m_trk->isMdcTrackValid()) return val;
00104    RecMdcTrack *mdcTrk = m_trk->mdcTrack();
00105    val = mdcTrk->p();
00106    return val;
00107 }

double EmcPID::pars ( int  n  )  const [inline]

Definition at line 38 of file EmcPID.h.

References params_emc1.

00038 {return params_emc1[n];}

int EmcPID::particleIDCalculation (  )  [protected, virtual]

Implements ParticleIDBase.

Definition at line 157 of file EmcPID.cxx.

References DstEmcShower::a20Moment(), DstEmcShower::a42Moment(), CALG(), DstMdcTrack::charge(), DstEmcShower::e3x3(), DstEmcShower::e5x5(), DstMdcKalTrack::electron, DstExtTrack::emcPosition(), EvtRecTrack::emcShower(), DstExtTrack::emcVolumeNumber(), DstEmcShower::energy(), DstEmcShower::eSeed(), EvtRecTrack::extTrack(), genRecEmupikp::i, EvtRecTrack::isEmcShowerValid(), EvtRecTrack::isExtTrackValid(), EvtRecTrack::isMdcTrackValid(), ganga-rec::j, DstEmcShower::latMoment(), m_a20moment, m_a42moment, m_chi, m_delta_phi, m_delta_theta, m_e3x3, m_e5x5, m_e_h, m_energy, m_eseed, m_latmoment, m_m_h, m_mlp_emc, m_ndof, m_p_h, m_prob, m_pt, m_ptrk, m_secondmoment, m_val_emc, EvtRecTrack::mdcTrack(), DstMdcKalTrack::p(), params_emc1, DstEmcShower::phi(), ParticleIDBase::PidTrk(), DstMdcKalTrack::pxy(), DstEmcShower::secondMoment(), DstMdcKalTrack::setPidType(), and DstEmcShower::theta().

Referenced by calculate().

00157                                   {
00158    int irc = -1;
00159    EvtRecTrack* recTrk = PidTrk();
00160    if(!(recTrk->isMdcTrackValid())) return irc;
00161    RecMdcTrack* mdcTrk = recTrk->mdcTrack();
00162    if (!(recTrk)->isMdcKalTrackValid()) return irc;
00163    RecMdcKalTrack* mdcKalTrk = (recTrk)->mdcKalTrack();
00164    mdcKalTrk->setPidType(RecMdcKalTrack::electron);
00165    double ptrk=mdcKalTrk->p();
00166    // double ptrk = mdcTrk->p();
00167    m_ptrk = ptrk;
00168 
00169    m_pt=mdcKalTrk->pxy();
00170    m_pt = m_pt*mdcTrk->charge();
00171    //   double cost = cos(mdcTrk->theta());
00172 
00173    if(!(recTrk->isExtTrackValid())) return irc;
00174    RecExtTrack* extTrk = recTrk->extTrack();
00175    if(extTrk->emcVolumeNumber() == -1) return irc;
00176    if (!(recTrk->isEmcShowerValid())) return irc;
00177    RecEmcShower* emcTrk = recTrk->emcShower();
00178 
00179    m_energy = emcTrk->energy();
00180    m_eseed = emcTrk->eSeed();
00181    m_e3x3 = emcTrk->e3x3();
00182    m_e5x5 = emcTrk->e5x5();
00183 
00184    double m_emc_theta = emcTrk->theta();
00185    double m_emc_phi = emcTrk->phi();
00186 
00187    Hep3Vector mc = extTrk->emcPosition();
00188    double m_ext_theta = mc.theta();
00189    double m_ext_phi = mc.phi();
00190 
00191 
00192    m_delta_theta = m_emc_theta - m_ext_theta;
00193    m_delta_phi = m_emc_phi - m_ext_phi;
00194    if(m_delta_phi>1)   m_delta_phi=m_delta_phi-6.283;
00195    if(m_delta_phi<-1)  m_delta_phi=m_delta_phi+6.283;
00196 
00197 
00198    m_secondmoment = emcTrk->secondMoment()/1000.;
00199    m_a20moment=emcTrk->a20Moment();
00200    m_latmoment=emcTrk->latMoment();
00201    m_a42moment=emcTrk->a42Moment();
00202 
00203    if(emcTrk->energy() <= 0) return irc;
00204    //if(emcTrk->energy() > ptrk) return irc;
00205 
00206    /*  params_emc1[0] = m_ptrk;
00207      params_emc1[1] = m_pt;
00208      params_emc1[2] = m_energy;
00209      params_emc1[3] = m_eseed;
00210      params_emc1[4] = m_e3x3;
00211      params_emc1[5] = m_e5x5;
00212      params_emc1[6] = m_secondmoment;
00213      params_emc1[7] = m_delta_theta;
00214      params_emc1[8] = m_delta_phi;*/
00215    params_emc1[0] =m_ptrk;
00216    params_emc1[1] =m_pt;
00217    params_emc1[2] =m_energy;
00218    params_emc1[3] =m_eseed;
00219    params_emc1[4] =m_e3x3;
00220    params_emc1[5] =m_e5x5;
00221    params_emc1[6] =m_secondmoment;
00222    params_emc1[7] =m_latmoment;
00223    params_emc1[8] =m_a20moment;
00224    params_emc1[9] =m_a42moment;
00225    params_emc1[10] =m_delta_theta;
00226    params_emc1[11] =m_delta_phi;
00227 
00228    m_val_emc = m_mlp_emc->Evaluate(0,params_emc1);
00229    int pindex = int((m_ptrk-0.2)/0.1);
00230    int bindex = int((m_val_emc-0.5)/0.01);
00231    if(bindex>300||bindex<0) return irc;
00232    if(pindex>17) pindex=17;
00233    if(pindex<0) pindex=0;
00234    //   double bin_pos[3];
00235    m_prob[0] = m_e_h[pindex][bindex];
00236    m_prob[1] = m_m_h[pindex][bindex];
00237    m_prob[2] = m_p_h[pindex][bindex];
00238    m_prob[3] = m_p_h[pindex][bindex];
00239    m_prob[4] = m_p_h[pindex][bindex];
00240    for(int i =0; i<5; i++) {
00241       if(m_prob[i]==0) m_prob[i] = 0.001;
00242    }
00243    //calculate the chisq value using GAUSIN
00244    float ppp[5];
00245    for(int i=0; i<5; i++) {
00246       ppp[i]=0;
00247    }
00248    for(int j=0; j<=bindex; j++) {
00249       ppp[0]+= m_e_h[pindex][j];
00250       ppp[1]+= m_m_h[pindex][j];
00251       ppp[2]+= m_p_h[pindex][j];
00252    }
00253    for(int i=0; i<3; i++) {
00254       ppp[i]=ppp[i]*0.01;
00255       if(ppp[i]>0&&ppp[i]<1) {
00256          CALG(ppp[i],m_chi[i]);
00257       }
00258       if(ppp[i]<=0||ppp[i]>=1) m_chi[i]=-99;
00259    }
00260    // if(fabs(m_chi[2])==-99)
00261    m_chi[3]=m_chi[2];
00262    m_chi[4]=m_chi[2];
00263 
00264    m_ndof = 1;
00265    irc = 0;
00266    return irc;
00267 }

double ParticleIDBase::pdfCalculate ( double  offset,
double  sigma 
) [inherited]

Definition at line 91 of file ParticleIDBase.cxx.

References exp(), M_PI, pi, and twoPi.

Referenced by TofCorrPID::correlationCheck(), ParticleID::LikelihoodCalculation(), TofPID::particleIDCalculation(), TofEPID::particleIDCalculation(), TofCPID::particleIDCalculation(), TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), and DedxPID::particleIDCalculation().

00091                                                               {
00092    //  const double pi =  3.141592653589793238;
00093    const double pi =  M_PI;
00094    const double twoPi = 2*pi;
00095    double chi2 = -0.5*offset*offset/(sigma*sigma);
00096    double pdf = exp(chi2)/(sigma*sqrt(twoPi));
00097    return pdf;
00098 }

double ParticleIDBase::pdfMinSigmaCut (  )  const [inline, inherited]

Definition at line 42 of file ParticleIDBase.h.

References ParticleIDBase::m_pdfsigmamin_cut.

Referenced by TofCorrPID::correlationCheck(), ParticleID::LikelihoodCalculation(), TofPID::particleIDCalculation(), TofCPID::particleIDCalculation(), TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), and DedxPID::particleIDCalculation().

00042 {return m_pdfsigmamin_cut;}

EvtRecTrack* ParticleIDBase::PidTrk (  )  const [inline, inherited]

Definition at line 36 of file ParticleIDBase.h.

References ParticleIDBase::m_trk.

Referenced by TofQPID::particleIDCalculation(), TofPID::particleIDCalculation(), TofEPID::particleIDCalculation(), TofCPID::particleIDCalculation(), TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), MucPID::particleIDCalculation(), particleIDCalculation(), and DedxPID::particleIDCalculation().

00036 {return m_trk;}

double ParticleIDBase::pol2 ( double  x,
double *  par 
) [inherited]

Definition at line 137 of file ParticleIDBase.cxx.

00137                                                  {
00138    double y=x;
00139    //    return par[0] + (par[1] * y) +(par[2] * y * y);
00140    return par[0] + y*(par[1] + y*(par[2]));
00141 }

double ParticleIDBase::pol3 ( double  x,
double *  par 
) [inherited]

Definition at line 143 of file ParticleIDBase.cxx.

00143                                                  {
00144    double y=x;
00145    //    return par[0] + (par[1] * y) +(par[2] * y * y)+(par[3] * y * y*y);
00146    return par[0] + y*(par[1] + y*(par[2] + y*(par[3])));
00147 }

double ParticleIDBase::pol4 ( double  x,
double *  par 
) [inherited]

Definition at line 149 of file ParticleIDBase.cxx.

00149                                                  {
00150    double y=x;
00151    //    return par[0] + (par[1] * y) +(par[2] * y * y)+(par[3] * y * y*y) + (par[4] * y * y*y*y);
00152    return par[0] + y*(par[1] + y*(par[2] + y*(par[3] + y*(par[4]))));
00153 }

double EmcPID::prob ( int  n  )  const [inline, virtual]

Implements ParticleIDBase.

Definition at line 27 of file EmcPID.h.

References m_prob.

00027 {return m_prob[n];}

double ParticleIDBase::probCalculate ( double  chi2,
int  n 
) [inherited]

Definition at line 83 of file ParticleIDBase.cxx.

References ParticleIDBase::p().

Referenced by TofPID::particleIDCalculation(), TofEPID::particleIDCalculation(), TofCPID::particleIDCalculation(), TofCorrPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), ParticleID::particleIDCalculation(), and DedxPID::particleIDCalculation().

00083                                                           {
00084    double p = -1.0;
00085    if(chi2 < 0) return p;
00086    p = TMath::Prob(chi2, ndof);
00087    return p;
00088 }

double ParticleIDBase::pt (  )  [inherited]

Definition at line 108 of file ParticleIDBase.cxx.

References EvtRecTrack::isMdcTrackValid(), ParticleIDBase::m_trk, EvtRecTrack::mdcTrack(), and DstMdcTrack::pxy().

00108                           {
00109    double val = 999;
00110    if(!m_trk) return val;
00111    if(!m_trk->isMdcTrackValid()) return val;
00112    RecMdcTrack *mdcTrk = m_trk->mdcTrack();
00113    val = mdcTrk->pxy();
00114    return val;
00115 }

double EmcPID::secondmoment (  )  const [inline]

Definition at line 35 of file EmcPID.h.

References m_secondmoment.

00035 {return m_secondmoment;}

void ParticleIDBase::set_path ( std::string  s_path  )  [inline, inherited]

Definition at line 105 of file ParticleIDBase.h.

References ParticleIDBase::path.

00105 {path = s_path;}

void ParticleIDBase::set_path ( const char *  s_path = 0  )  [inherited]

Definition at line 55 of file ParticleIDBase.cxx.

References ParticleIDBase::path, and deljobs::string.

Referenced by ParticleIDBase::ParticleIDBase().

00056 {
00057    if ( s_path ) {
00058       path = string(s_path);
00059    } else {
00060       char* env_path = getenv("PARTICLEIDROOT");
00061       if ( !env_path ) {
00062          cout << "  ParticleIDBase::set_path ERROR:"
00063               " the environment PARTICLEIDROOT not defined " << endl;
00064          exit(1);
00065       }
00066       path = string(env_path);
00067    }
00068 }

void ParticleIDBase::setChiMaxCut ( const double  chi = 6  )  [inline, inherited]

Definition at line 41 of file ParticleIDBase.h.

References ParticleIDBase::chi(), and ParticleIDBase::m_chimax_cut.

Referenced by ParticleID::init().

00041 {m_chimax_cut = chi;}

void ParticleIDBase::setChiMinCut ( const double  chi = 4  )  [inline, inherited]

Definition at line 39 of file ParticleIDBase.h.

References ParticleIDBase::chi(), and ParticleIDBase::m_chimin_cut.

Referenced by ParticleID::init(), and TofPID::particleIDCalculation().

00039 {m_chimin_cut = chi;}

void ParticleIDBase::setPdfMinSigmaCut ( const double  pdf = 4  )  [inline, inherited]

Definition at line 43 of file ParticleIDBase.h.

References ParticleIDBase::m_pdfsigmamin_cut.

Referenced by TofPID::particleIDCalculation().

00043 {m_pdfsigmamin_cut= pdf;}

void ParticleIDBase::setRecTrack ( EvtRecTrack trk  )  [inline, inherited]

Definition at line 37 of file ParticleIDBase.h.

References ParticleIDBase::m_trk.

Referenced by TofPID::particleIDCalculation().

00037 {m_trk = trk;}

void ParticleIDBase::setRunNo ( const double  runh = 8093  )  [inline, inherited]

Definition at line 45 of file ParticleIDBase.h.

References ParticleIDBase::m_runno.

00045 {m_runno = runh;}

int ParticleIDBase::tofcorrValid (  )  const [inline, inherited]

Definition at line 96 of file ParticleIDBase.h.

References ParticleIDBase::TOFCorr_VALID.

00096 {return TOFCorr_VALID;}

int ParticleIDBase::tofcValid (  )  const [inline, inherited]

Definition at line 95 of file ParticleIDBase.h.

References ParticleIDBase::TOFC_VALID.

00095 {return TOFC_VALID;}

int ParticleIDBase::tofeValid (  )  const [inline, inherited]

Definition at line 93 of file ParticleIDBase.h.

References ParticleIDBase::TOFE_VALID.

00093 {return TOFE_VALID;}

int ParticleIDBase::tofqValid (  )  const [inline, inherited]

Definition at line 94 of file ParticleIDBase.h.

References ParticleIDBase::TOFQ_VALID.

00094 {return TOFQ_VALID;}

int ParticleIDBase::tofValid (  )  const [inline, inherited]

Definition at line 92 of file ParticleIDBase.h.

References ParticleIDBase::TOF_VALID.

00092 {return TOF_VALID;}

int ParticleIDBase::useDedx (  )  const [inline, inherited]

Definition at line 64 of file ParticleIDBase.h.

References ParticleIDBase::USE_DEDX.

Referenced by ParticleID::IsDedxInfoUsed().

00064 {return USE_DEDX;}

int ParticleIDBase::useEmc (  )  const [inline, inherited]

Definition at line 72 of file ParticleIDBase.h.

References ParticleIDBase::USE_EMC.

Referenced by ParticleID::IsEmcInfoUsed().

00072 {return USE_EMC;}

int ParticleIDBase::useMuc (  )  const [inline, inherited]

Definition at line 73 of file ParticleIDBase.h.

References ParticleIDBase::USE_MUC.

Referenced by ParticleID::IsMucInfoUsed().

00073 {return USE_MUC;}

int ParticleIDBase::useTof (  )  const [inline, inherited]

Definition at line 65 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOF.

Referenced by ParticleID::IsTofInfoUsed().

00065 {return USE_TOF;}

int ParticleIDBase::useTof1 (  )  const [inline, inherited]

Definition at line 66 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOF1.

Referenced by ParticleID::IsTof1InfoUsed().

00066 {return USE_TOF1;}

int ParticleIDBase::useTof2 (  )  const [inline, inherited]

Definition at line 67 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOF2.

Referenced by ParticleID::IsTof2InfoUsed().

00067 {return USE_TOF2;}

int ParticleIDBase::useTofC (  )  const [inline, inherited]

Definition at line 70 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOFC.

Referenced by ParticleID::IsTofCInfoUsed().

00070 {return USE_TOFC;}

int ParticleIDBase::useTofCorr (  )  const [inline, inherited]

Definition at line 71 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOFCorr.

Referenced by ParticleID::IsTofCorrInfoUsed().

00071 {return USE_TOFCorr;}

int ParticleIDBase::useTofE (  )  const [inline, inherited]

Definition at line 68 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOFE.

Referenced by ParticleID::IsTofEInfoUsed().

00068 {return USE_TOFE;}

int ParticleIDBase::useTofQ (  )  const [inline, inherited]

Definition at line 69 of file ParticleIDBase.h.

References ParticleIDBase::USE_TOFQ.

Referenced by ParticleID::IsTofQInfoUsed().

00069 {return USE_TOFQ;}

double EmcPID::val_emc1 (  )  const [inline]

Definition at line 36 of file EmcPID.h.

References m_val_emc.

00036 {return m_val_emc;}

double ParticleIDBase::velc (  )  [inherited]

Definition at line 77 of file ParticleIDBase.cxx.

Referenced by TofEPID::particleIDCalculation(), TofCPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), and Tof1PID::particleIDCalculation().

00077                             {
00078    //  double vel = 29.9792458;  // tof_path unit in cm.
00079    double vel = 299.792458;   // tof path unit in mm
00080    return vel;
00081 }

double ParticleIDBase::xmass ( int  n  )  [inherited]

Definition at line 71 of file ParticleIDBase.cxx.

References mass.

Referenced by TofCorrPID::offsetTof(), TofCorrPID::particleIDCalculation(), and TofCorrPID::sigmaTof().

00071                                   {
00072    double mass[5] = {0.000511, 0.105658, 0.139570,0.493677, 0.938272};
00073    if(n < 0 || n >=5) return 0.0;
00074    return mass[n];
00075 }


Member Data Documentation

double EmcPID::m_a20moment [private]

Definition at line 62 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_a42moment [private]

Definition at line 63 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_chi[5] [private]

Definition at line 47 of file EmcPID.h.

Referenced by chi(), init(), and particleIDCalculation().

double EmcPID::m_chimin [private]

Definition at line 49 of file EmcPID.h.

Referenced by init().

double EmcPID::m_delta_phi [private]

Definition at line 59 of file EmcPID.h.

Referenced by delta_phi(), EmcPID(), init(), and particleIDCalculation().

double EmcPID::m_delta_theta [private]

Definition at line 58 of file EmcPID.h.

Referenced by delta_theta(), EmcPID(), init(), and particleIDCalculation().

double EmcPID::m_e3x3 [private]

Definition at line 56 of file EmcPID.h.

Referenced by e3x3(), EmcPID(), init(), and particleIDCalculation().

double EmcPID::m_e5x5 [private]

Definition at line 57 of file EmcPID.h.

Referenced by e5x5(), EmcPID(), init(), and particleIDCalculation().

double EmcPID::m_e_h[18][300] [private]

Definition at line 66 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_energy [private]

Definition at line 54 of file EmcPID.h.

Referenced by EmcPID(), energy(), init(), and particleIDCalculation().

double EmcPID::m_eseed [private]

Definition at line 55 of file EmcPID.h.

Referenced by EmcPID(), eseed(), init(), and particleIDCalculation().

double EmcPID::m_latmoment [private]

Definition at line 61 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_m_h[18][300] [private]

Definition at line 67 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

TMultiLayerPerceptron * EmcPID::m_mlp_emc = 0 [static, private]

Definition at line 70 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

int EmcPID::m_ndof [private]

Definition at line 50 of file EmcPID.h.

Referenced by calculate(), init(), IsPidInfoValid(), ndof(), and particleIDCalculation().

double EmcPID::m_p_h[18][300] [private]

Definition at line 68 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

EmcPID * EmcPID::m_pointer = 0 [static, private]

Definition at line 76 of file EmcPID.h.

Referenced by instance().

double EmcPID::m_prob[5] [private]

Definition at line 48 of file EmcPID.h.

Referenced by init(), particleIDCalculation(), and prob().

double EmcPID::m_pt [private]

Definition at line 52 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_ptrk [private]

Definition at line 51 of file EmcPID.h.

Referenced by EmcPID(), and particleIDCalculation().

double EmcPID::m_secondmoment [private]

Definition at line 60 of file EmcPID.h.

Referenced by EmcPID(), init(), particleIDCalculation(), and secondmoment().

TTree * EmcPID::m_trainTree_emconly = 0 [static, private]

Definition at line 71 of file EmcPID.h.

Referenced by EmcPID().

int EmcPID::m_type [private]

Definition at line 53 of file EmcPID.h.

Referenced by EmcPID().

double EmcPID::m_val_emc [private]

Definition at line 64 of file EmcPID.h.

Referenced by init(), particleIDCalculation(), and val_emc1().

double EmcPID::params_emc1[9] [private]

Definition at line 65 of file EmcPID.h.

Referenced by pars(), and particleIDCalculation().

std::string ParticleIDBase::path = "" [static, protected, inherited]

Definition at line 102 of file ParticleIDBase.h.

Referenced by TofCPID::calculate(), EmcPID(), MucPID::init(), DedxPID::inputpar(), TofCorrPID::inputParameter(), MucPID::MucPID(), ParticleIDBase::ParticleIDBase(), TofEPID::particleIDCalculation(), TofCPID::particleIDCalculation(), Tof2PID::particleIDCalculation(), Tof1PID::particleIDCalculation(), and ParticleIDBase::set_path().


Generated on Tue Nov 29 23:18:40 2016 for BOSS_7.0.2 by  doxygen 1.4.7