StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StMuMcTrack.cxx
1 // $Id: StMuMcTrack.cxx,v 1.4 2014/08/06 19:19:02 perev Exp $
2 #include "StMuMcTrack.h"
3 #include "Stiostream.h"
4 #include "TString.h"
5 #include "TMath.h"
6 ClassImp(StMuMcTrack);
7 //________________________________________________________________________________
8 StMuMcTrack::StMuMcTrack(const g2t_track_st &t) : TObject(), mGePid(t.ge_pid), mId(t.id), mIsShower(t.is_shower), mItrmdVertex(t.itrmd_vertex_p),
9  mIdVx(t.start_vertex_p), mIdVxEnd(t.stop_vertex_p), mCharge(t.charge), mE(t.e), mEta(t. eta), mPxyz(t.p), mpT(t.pt), mPtot(t.ptot),
10  mRapidity(t.rapidity) {
11  mHits[kctb] = 0xff & t.n_ctb_hit; /* Nhits in ctb */
12  mHits[keem] = 0xff & t.n_eem_hit; /* Nhits in eem (endcap em cal) */
13  mHits[kemc] = 0xff & t.n_emc_hit; /* Nhits in emc */
14  mHits[kesm] = 0xff & t.n_esm_hit; /* Nhits in esm (endcap shower max) */
15  mHits[kftp] = 0xff & t.n_ftp_hit; /* Nhits in forward tpc */
16  mHits[kgem] = 0xff & t.n_gem_hit; /* Nhits in gem barrel */
17  mHits[khpd] = 0xff & t.n_hpd_hit; /* Nhits in hpd */
18  mHits[kist] = 0xff & t.n_ist_hit; /* Nhits in ist */
19  mHits[kigt] = 0xff & t.n_igt_hit; /* Nhits in igt */
20  mHits[kfst] = 0xff & t.n_fst_hit; /* Nhits in fst */
21  mHits[kfgt] = 0xff & t.n_fgt_hit; /* Nhits in fgt */
22  mHits[kfpd] = 0xff & t.n_fpd_hit; /* Nhits in fpd */
23  mHits[kmwc] = 0xff & t.n_mwc_hit; /* Nhits in mwc */
24  mHits[kpgc] = 0xff & t.n_pgc_hit; /* Nhits in pgc ??? */
25  mHits[kpmd] = 0xff & t.n_pmd_hit; /* Nhits in pmd (PMD) */
26  mHits[ksmd] = 0xff & t.n_smd_hit; /* number of hits in shower max */
27  mHits[kssd] = 0xff & t.n_ssd_hit; /* Nhits in ssd */
28  mHits[ksvt] = 0xff & t.n_svt_hit; /* Nhits in svt */
29  mHits[kpix] = 0xff & t.n_pix_hit; /* Nhits in pix */
30  mHits[ktof] = 0xff & t.n_tof_hit; /* Nhits in tof */
31  mHits[ktpc] = 0xff & t.n_tpc_hit; /* Nhits in tpc */
32  mHits[kvpd] = 0xff & t.n_vpd_hit; /* Nhits in vpd */
33  mHits[ketr] = 0xff & t.n_etr_hit; /* Nhits in etr */
34  mHits[khca] = 0xff & t.n_hca_hit; /* Nhits in hca */
35  mHits[kfts] = 0xff & t.n_fts_hit; /* Nhits in fts */
36  mHits[keto] = 0xff & t.n_eto_hit; /* Nhits in eto */
37  mHits[kstg] = 0xff & t.n_stg_hit; /* Nhits in stg */
38  mHits[kwca] = 0xff & t.n_wca_hit; /* Nhits in wca */
39  mHits[kpre] = 0xff & t.n_pre_hit; /* Nhits in pre */
40  mHits[kepd] = 0xff & t.n_epd_hit; /* Nhits in epd */
41 
42 assert(t.pt<0 || mPxyz.perp()>1e-6);
43 
44 }
45 
46 
47 
48 
49 ostream& operator<<(ostream& os, const StMuMcTrack& v) {
50 //________________________________________________________________________________
51  os << Form("Tk:%4i Vx:%4i Ge:%4i NoHits:%3i",v.Id(),v.IdVx(),v.GePid(),v.NoHits());
52  os << Form(" q:%2i pT:%7.3f eta:%6.3f phi:%6.3f p:%8.3f px:%8.3f py:%8.3f pz:%8.3f",v.Charge(),v.pT(), v.Eta(),
53  TMath::ATan2(v.Pxyz().y(),v.Pxyz().x()), v.Ptot(), v.Pxyz().x(),v.Pxyz().y(),v.Pxyz().z());
54  return os;
55 }
56 //________________________________________________________________________________
57 Int_t StMuMcTrack::CorrectGePid(Int_t gePid) {
58  // By pass embedding particle redefinition
59  if (gePid == 99) gePid = 11151;
60  if (gePid == 207) gePid = 41;
61  if (gePid == 40001) gePid = 24;
62  if (gePid == 98) gePid = 18;
63  if (gePid == 40002) gePid = 32;
64  if (gePid == 97) gePid = 26;
65  if (gePid == 40003) gePid = 23;
66  if (gePid == 40004) gePid = 31;
67  if (gePid == 40005) gePid = 22;
68  if (gePid == 40006) gePid = 30;
69  if (gePid == 10150) gePid = 150;
70  if (gePid == 10151) gePid = 151;
71  if (gePid == 11151) gePid = 10151;
72  if (gePid == 10018) gePid = 98;
73  if (gePid == 10026) gePid = 97;
74  if (gePid == 10017) gePid = 17;
75  if (gePid == 10039) gePid = 39;
76  if (gePid == 10040) gePid = 40;
77  if (gePid == 98) gePid = 18;
78  if (gePid == 97) gePid = 26;
79  if (gePid < 0 || gePid > 50) {
80  // cout << "Illegal gePid " << gePid << endl;
81  gePid = 51;
82  }
83  return gePid;
84 }
85 //________________________________________________________________________________
86 const Char_t *StMuMcTrack::GeName() {
87  static const Char_t *GeNames[52] = {
88  // 1 2 3 4 5 6 7 8 9 10
89  "",
90  "gamma" ,"e+" ,"e-" ,"nu" ,"mu+" ,"mu-" ,"pi0" ,"pi+" ,"pi-" ,"K0L",
91  "K+" ,"K-" ,"N" ,"P" ,"Pbar" ,"K0S" ,"eta" ,"Lambda","Sigma+" ,"Sigma0",
92  "S-" ,"Xi0" ,"Xi-" ,"Omega","Nbar" ,"LamBar","SBar-","SBar0" ,"SBar+" ,"XiBar0",
93  "XiBar+" ,"OmBar","tau+","tau-" ,"D+" ,"D-" ,"D0" ,"Dbar0" ,"Ds+" ,"Ds-" ,
94  "LambC+" ,"W+" ,"W-" ,"Z0" ,"H2" ,"H3" ,"alpha","geanti","He3" ,"Cerenk",
95  "??????"};
96  static TString Name;
97  Int_t iGe = CorrectGePid(GePid());
98  Name = GeNames[iGe];
99  return Name.Data();
100 }
101 //________________________________________________________________________________
102 void StMuMcTrack::Print(Option_t *option) const {cout << *this << endl;}
103 //________________________________________________________________________________
104 // $Log: StMuMcTrack.cxx,v $
105 // Revision 1.4 2014/08/06 19:19:02 perev
106 // Move constructor .h ==> .cxx
107 //
108 // Revision 1.3 2012/11/26 23:08:23 fisyak
109 // Fix print out, thanks to Jonathan (bug #2442)
110 //
111 // Revision 1.2 2012/05/07 14:47:06 fisyak
112 // Add handles for track to fast detector matching
113 //
114 // Revision 1.1 2011/10/17 00:19:13 fisyak
115 // Active handing of IdTruth
116 //
virtual void Print(Option_t *option="") const
Print track info.