]>
Commit | Line | Data |
---|---|---|
20dae051 | 1 | // $Id$ |
fa3634bd | 2 | // Main author: Davide Caffarri 2009 |
bd38690a | 3 | |
4 | /************************************************************************** | |
5 | * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. * | |
6 | * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for * | |
7 | * full copyright notice. * | |
8 | **************************************************************************/ | |
ba978640 | 9 | #if !defined(__CINT__) || defined(__MAKECINT__) |
10 | #include <TClonesArray.h> | |
11 | #include <TROOT.h> | |
12 | #include <TSystem.h> | |
13 | #include <TEveVSDStructs.h> | |
14 | #include <TEveTrackPropagator.h> | |
15 | #include <TEvePointSet.h> | |
16 | #include <TEveManager.h> | |
6c49a8e1 | 17 | #include <TEveUtil.h> |
18 | ||
19 | #include <AliExternalTrackParam.h> | |
20 | #include <AliVVertex.h> | |
21 | #include <AliAODVertex.h> | |
22 | #include <AliAODEvent.h> | |
23 | #include <AliAODTrack.h> | |
24 | #include <AliAODMCParticle.h> | |
25 | #include <AliESDtrack.h> | |
26 | #include <AliESDEvent.h> | |
290113e6 | 27 | #include <PWGHF/vertexingHF/AliAODRecoDecayHF.h> |
28 | #include <PWGHF/vertexingHF/AliAODRecoDecayHF2Prong.h> | |
29 | #include <PWGHF/vertexingHF/macros/LoadLibraries.C> | |
6c49a8e1 | 30 | #include <AliEveHF.h> |
31 | #include <AliEveEventManager.h> | |
ba978640 | 32 | #else |
f8d5a389 | 33 | class AliAODRecoDecayHF; |
ba978640 | 34 | #endif |
fa3634bd | 35 | |
36 | void aod_hf_init_rectrack(TEveRecTrack& rt, AliExternalTrackParam* tp) | |
bd38690a | 37 | { |
38 | Double_t pbuf[3], vbuf[3]; | |
bd38690a | 39 | rt.fSign = tp->GetSign(); |
40 | tp->GetXYZ(vbuf); rt.fV.Set(vbuf); | |
41 | tp->GetPxPyPz(pbuf); rt.fP.Set(pbuf); | |
42 | // Double_t ep = at->GetP(), mc = at->GetMass(); | |
43 | rt.fBeta = 1; // ep/TMath::Sqrt(ep*ep + mc*mc); | |
44 | } | |
45 | ||
fa3634bd | 46 | |
47 | AliEveHF* aod_make_HF(TEveTrackPropagator* rnrStyle, AliAODVertex* primAODVtx, | |
bd38690a | 48 | AliESDtrack* neg, AliESDtrack* pos, AliAODRecoDecayHF* rd, Int_t i) |
f8d5a389 | 49 | { |
bd38690a | 50 | TEveRecTrack rcPos; |
51 | TEveRecTrack rcNeg; | |
fa3634bd | 52 | //TEveRecV0 rcV0; |
bd38690a | 53 | |
f8d5a389 | 54 | /* |
55 | Double_t p[3]; | |
56 | p[0]=rd->PxProng(0); p[1]=rd->PyProng(0); p[2]=rd->PzProng(0); | |
57 | rcV0.fPPos.Set(p); | |
58 | p[0]=rd->PxProng(1); p[1]=rd->PyProng(1); p[2]=rd->PzProng(1); | |
59 | rcV0.fPNeg.Set(p); | |
bd38690a | 60 | |
f8d5a389 | 61 | p[0]=rd->Px(); p[1]=rd->Py(); p[2]=rd->Pz(); |
fa3634bd | 62 | */ |
f8d5a389 | 63 | |
64 | Double_t primVtx[3]={primAODVtx->GetX(), primAODVtx->GetY(), primAODVtx->GetZ()}; | |
65 | ||
bd38690a | 66 | |
fa3634bd | 67 | Double_t v[3] = {rd->Xv(),rd->Yv(),rd->Zv()}; |
bd38690a | 68 | printf("vertex %f %f %f\n",v[0],v[1],v[2]); |
f8d5a389 | 69 | |
fa3634bd | 70 | aod_hf_init_rectrack(rcNeg, neg); |
bd38690a | 71 | //rcNeg.fIndex = v0->GetNindex(); |
fa3634bd | 72 | aod_hf_init_rectrack(rcPos, pos); |
bd38690a | 73 | //rcPos.fIndex = v0->GetPindex(); |
74 | ||
12cc265f | 75 | AliEveHF* myHF = new AliEveHF(&rcNeg, &rcPos, primVtx ,rd, rnrStyle); |
fa3634bd | 76 | myHF->SetElementName(Form("D0->Kpi %d", i)); |
f8d5a389 | 77 | myHF->SetElementTitle(Form("CosPointingAngle %f", rd->CosPointingAngle())); |
fa3634bd | 78 | myHF->SetAODIndex(i); |
79 | return myHF; | |
bd38690a | 80 | } |
81 | ||
fa3634bd | 82 | AliEveHFList* aod_HF() |
f8d5a389 | 83 | { |
84 | Bool_t useParFiles=kFALSE; | |
6c49a8e1 | 85 | |
290113e6 | 86 | TEveUtil::LoadMacro("$ALICE_ROOT/PWGHF/vertexingHF/macros/LoadLibraries.C+"); |
fa3634bd | 87 | LoadLibraries(useParFiles); |
6c49a8e1 | 88 | |
bd38690a | 89 | AliAODEvent* aod = AliEveEventManager::AssertAOD(); |
90 | AliESDEvent* esd = AliEveEventManager::AssertESD(); | |
91 | ||
f8d5a389 | 92 | /* |
93 | gSystem->Load("libANALYSIS"); | |
94 | gSystem->Load("libANALYSISalice"); | |
95 | gSystem->Load("libCORRFW"); | |
ba978640 | 96 | gSystem->Load("libPWG3base"); |
97 | gSystem->Load("libPWG3vertexingHF"); | |
fa3634bd | 98 | */ |
99 | ||
100 | // load MC particles | |
f8d5a389 | 101 | TClonesArray *mcArray = |
102 | (TClonesArray*) aod->FindListObject(AliAODMCParticle::StdBranchName()); | |
103 | if (!mcArray) { | |
fa3634bd | 104 | printf("MC particles branch not found!\n"); |
ba978640 | 105 | return 0; |
fa3634bd | 106 | } |
107 | ||
fa3634bd | 108 | AliAODVertex* primVtx_aod = (AliAODVertex*) aod->GetPrimaryVertex(); |
109 | // AliESDVertex *primVtx_esd = (AliESDVertex*) esd->GetPrimaryVertex(); | |
bd38690a | 110 | |
fa3634bd | 111 | AliEveHFList* cont = new AliEveHFList("AOD HF vertices"); |
bd38690a | 112 | cont->SetMainColor(2); |
113 | TEveTrackPropagator* rnrStyle = cont->GetPropagator(); | |
114 | rnrStyle->SetMagField( 0.1*aod->GetMagneticField() ); | |
115 | ||
116 | gEve->AddElement(cont); | |
117 | ||
bd38690a | 118 | TEvePointSet* pointsD0toKpi = new TEvePointSet("D0->Kpi vertex locations"); |
119 | ||
120 | // load D0->Kpi candidates | |
f8d5a389 | 121 | TClonesArray *arrayD0toKpi = (TClonesArray*) aod->FindListObject("D0toKpi"); |
122 | ||
bd38690a | 123 | // load 3prong candidates |
f8d5a389 | 124 | // TClonesArray *array3Prong = |
125 | // (TClonesArray*)aod->GetList()->FindObject("Charm3Prong"); | |
bd38690a | 126 | |
127 | Int_t countD0 = 0; | |
f8d5a389 | 128 | for (Int_t iD0toKpi=0; iD0toKpi<arrayD0toKpi->GetEntriesFast(); iD0toKpi++) |
129 | { | |
bd38690a | 130 | AliAODRecoDecayHF2Prong *rd = (AliAODRecoDecayHF2Prong*)arrayD0toKpi->UncheckedAt(iD0toKpi); |
131 | Bool_t unsetvtx=kFALSE; | |
f8d5a389 | 132 | if (!rd->GetOwnPrimaryVtx()) { |
fa3634bd | 133 | rd->SetOwnPrimaryVtx(primVtx_aod); |
bd38690a | 134 | unsetvtx=kTRUE; |
f8d5a389 | 135 | } |
fa3634bd | 136 | // REAL D0 particle. If you want to draw only real D0 un-comment these lines |
137 | //Int_t labD0 = rd->MatchToMC(421,mcArray); | |
138 | //if(labD0<0) continue; | |
139 | ||
ba978640 | 140 | AliAODTrack *negAODTr = dynamic_cast<AliAODTrack *>(rd->GetDaughter(0)); |
141 | AliAODTrack *posAODTr = dynamic_cast<AliAODTrack *>(rd->GetDaughter(1)); | |
f8d5a389 | 142 | |
143 | AliVVertex *secv = rd->GetSecondaryVtx(); | |
bd38690a | 144 | |
fa3634bd | 145 | AliESDtrack *negTr = new AliESDtrack(negAODTr); |
146 | AliESDtrack *posTr = new AliESDtrack(posAODTr); | |
bd38690a | 147 | |
fa3634bd | 148 | negTr->PropagateToDCA((AliAODVertex*)secv,aod->GetMagneticField(),100.); |
149 | posTr->PropagateToDCA((AliAODVertex*)secv,aod->GetMagneticField(),100.); | |
bd38690a | 150 | |
fa3634bd | 151 | AliEveHF* myD0 = aod_make_HF(rnrStyle,primVtx_aod,negTr,posTr,rd,iD0toKpi); |
bd38690a | 152 | if (myD0) { |
153 | gEve->AddElement(myD0,cont); | |
154 | countD0++; | |
155 | } | |
156 | ||
157 | pointsD0toKpi->SetNextPoint(rd->Xv(),rd->Yv(),rd->Zv()); | |
158 | pointsD0toKpi->SetPointId(rd); | |
159 | ||
fa3634bd | 160 | if(unsetvtx) { |
161 | rd->UnsetOwnPrimaryVtx(); | |
f8d5a389 | 162 | } |
bd38690a | 163 | } |
164 | ||
fa3634bd | 165 | //cont->SetTitle("test"); |
bd38690a | 166 | |
fa3634bd | 167 | cont->MakeHFs(); |
bd38690a | 168 | gEve->Redraw3D(); |
169 | ||
f8d5a389 | 170 | pointsD0toKpi->SetTitle(Form("N=%d", pointsD0toKpi->Size())); |
bd38690a | 171 | pointsD0toKpi->SetMarkerStyle(4); |
172 | pointsD0toKpi->SetMarkerSize(1.5); | |
173 | pointsD0toKpi->SetMarkerColor(kViolet); | |
174 | ||
175 | gEve->AddElement(pointsD0toKpi); | |
176 | gEve->Redraw3D(); | |
177 | ||
178 | return cont; | |
179 | } |