3 #include <AliPWG0Helper.h>
6 #include <TParticlePDG.h>
12 #include <AliESDVertex.h>
14 //____________________________________________________________________
15 ClassImp(AliPWG0Helper)
17 //____________________________________________________________________
18 Bool_t AliPWG0Helper::IsEventTriggered(AliESD* aEsd)
20 // check if the event was triggered
23 // ITS_SPD_GFO_L0 : 32
27 ULong64_t triggerMask = aEsd->GetTriggerMask();
29 if (triggerMask&32 && ((triggerMask&1) || (triggerMask&2)))
35 //____________________________________________________________________
36 Bool_t AliPWG0Helper::IsVertexReconstructed(AliESD* aEsd)
38 // checks if the vertex is reasonable
40 const AliESDVertex* vtxESD = aEsd->GetVertex();
42 // the vertex should be reconstructed
43 if (strcmp(vtxESD->GetName(), "default")==0)
47 vtx_res[0] = vtxESD->GetXRes();
48 vtx_res[1] = vtxESD->GetYRes();
49 vtx_res[2] = vtxESD->GetZRes();
51 if (vtx_res[2]==0 || vtx_res[2]>0.1)
57 //____________________________________________________________________
58 Bool_t AliPWG0Helper::IsPrimaryCharged(TParticle* aParticle, Int_t aTotalPrimaries)
61 // Returns if the given particle is a primary particle
62 // This function or a equivalent should be available in some common place of AliRoot
65 // if the particle has a daughter primary, we do not want to count it
66 if (aParticle->GetFirstDaughter() != -1 && aParticle->GetFirstDaughter() < aTotalPrimaries)
68 //AliDebug(AliLog::kDebug+1, "Dropping particle because it has a daughter among the primaries.");
72 Int_t pdgCode = TMath::Abs(aParticle->GetPdgCode());
74 // skip quarks and gluon
75 if (pdgCode <= 10 || pdgCode == 21)
77 //AliDebug(AliLog::kDebug+1, "Dropping particle because it is a quark or gluon.");
81 if (strcmp(aParticle->GetName(),"XXX") == 0)
83 //AliDebug(AliLog::kDebug, Form("WARNING: There is a particle named XXX."));
87 TParticlePDG* pdgPart = aParticle->GetPDG();
89 if (strcmp(pdgPart->ParticleClass(),"Unknown") == 0)
91 //AliDebug(AliLog::kDebug, Form("WARNING: There is a particle with an unknown particle class (pdg code %d).", pdgCode));
95 if (pdgPart->Charge() == 0)
97 //AliDebug(AliLog::kDebug+1, "Dropping particle because it is not charged.");
104 //____________________________________________________________________
105 void AliPWG0Helper::CreateProjections(TH3F* hist)
107 // create projections of 3d hists to all 2d combinations
108 // the histograms are not returned, just use them from memory or use this to create them in a file
110 TH1* proj = hist->Project3D("yx");
111 proj->SetXTitle(hist->GetXaxis()->GetTitle());
112 proj->SetYTitle(hist->GetYaxis()->GetTitle());
114 proj = hist->Project3D("zx");
115 proj->SetXTitle(hist->GetXaxis()->GetTitle());
116 proj->SetYTitle(hist->GetZaxis()->GetTitle());
118 proj = hist->Project3D("zy");
119 proj->SetXTitle(hist->GetYaxis()->GetTitle());
120 proj->SetYTitle(hist->GetZaxis()->GetTitle());