]>
Commit | Line | Data |
---|---|---|
b9a6a391 | 1 | // $Id$ |
2 | ||
3 | #include <Riostream.h> | |
4 | ||
5 | #include <TCollection.h> | |
6 | #include <TParticle.h> | |
7 | #include <TIterator.h> | |
8 | ||
9 | #include "AliJFMCJet.h" | |
10 | #include "AliJFMCJetFinder.h" | |
11 | ||
12 | ClassImp(AliJFMCJetFinder) | |
13 | ||
14 | AliJFMCJetFinder::AliJFMCJetFinder(Int_t n) : AliJFJetFinder(n), fParticles(NULL), fJet(NULL) | |
15 | { | |
16 | } | |
17 | ||
18 | AliJFMCJetFinder::~AliJFMCJetFinder() | |
19 | { | |
20 | Clean(); | |
21 | } | |
22 | ||
23 | Int_t AliJFMCJetFinder::Init(TClonesArray *particles) | |
24 | { | |
25 | if(particles==NULL) return 0; | |
26 | ||
27 | fParticles=particles; | |
28 | return fParticles->GetEntries(); | |
29 | } | |
30 | ||
31 | Int_t AliJFMCJetFinder::Run() | |
32 | { | |
33 | if(fParticles==NULL) return 0; | |
34 | ||
35 | TIterator *iter=fParticles->MakeIterator(); | |
36 | TParticle *p; | |
37 | ||
38 | while((p=(TParticle*)iter->Next()) != NULL){ | |
39 | if(p->GetPdgCode()==92){ | |
40 | fJets.AddAt(new AliJFMCJet(),fNJets); | |
41 | fJet=(AliJFMCJet*)fJets.At(fNJets); | |
42 | fJet->SetNJet(++fNJets); | |
43 | FollowDaughters(p->GetFirstDaughter(),p->GetLastDaughter()); | |
44 | //cout << "Add new Jet " << fNJets << "with " << fJet->GetE() << " " << fJet->GetE_() << " " << fJet->GetNPart() << endl; | |
45 | fJet->Update(); | |
46 | } | |
47 | } | |
48 | ||
49 | fJets.Sort(); | |
50 | //fJets.Print(); | |
51 | ||
52 | return fNJets; | |
53 | } | |
54 | ||
55 | void AliJFMCJetFinder::Debug() | |
56 | { | |
57 | TIterator *iter=fJets.MakeIterator(); | |
58 | AliJFMCJet *j; | |
59 | ||
60 | while((j=(AliJFMCJet*)iter->Next()) != NULL){ | |
61 | j->Update(); | |
62 | //cout << j << ": " << j->GetNPart() << " " << j->GetNJet() << " " << j->GetPtMax() << endl; | |
63 | j->Print(""); | |
64 | } | |
65 | ||
66 | /* | |
67 | for(Int_t i=0;i<fNJets;i++){ | |
68 | JFJet *j=(JFMCJet*)fJets->At(i); | |
69 | cout << i << ": " << j->GetNPart()<< " " << j->GetNJet() << endl; | |
70 | } | |
71 | */ | |
72 | } | |
73 | ||
74 | void AliJFMCJetFinder::FollowDaughters(Int_t first, Int_t last) | |
75 | { | |
76 | if(last<first) return; | |
77 | ||
78 | for(Int_t i=first-1;i<=last-1;i++){ | |
79 | //Fortran (Pythia/Hijing) has different numbering than TParticle | |
80 | ||
81 | TParticle *p = (TParticle *)fParticles->At(i); | |
82 | if(p->GetStatusCode()!=1){ | |
83 | FollowDaughters(p->GetFirstDaughter(),p->GetLastDaughter()); | |
84 | } | |
85 | else { | |
86 | if(!IsAcceptedParticle(p)) continue; | |
87 | ||
88 | fJet->AddParticle(p); | |
89 | //p->Print(); | |
90 | } | |
91 | } | |
92 | } | |
93 | ||
94 | /* | |
95 | void AliJFMCJetFinder::Clean() | |
96 | { | |
97 | } | |
98 | */ |