]>
Commit | Line | Data |
---|---|---|
8b2df7ae | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id$ */ | |
17 | ||
18 | // --- AliRoot header files --- | |
19 | ||
20 | // Fast global reconstruction class. | |
21 | // It performes fast reconstruction for charged particles only, | |
22 | // assuming that they were detected by all central ALICE detectors but PHOS. | |
23 | // This class acts as a filter for primary particles, selects them | |
24 | // and deteriorates their 4-momenta. | |
25 | // The filter can recognize the primary particle list from different | |
26 | // event generators: Pythia, Hijing, HIJINGPara. | |
27 | //! | |
28 | // Usage: | |
29 | // rec = new AliPHOSGlobalReconstruction("galice.root"); | |
30 | // rec->FastReconstruction(ievent); | |
31 | // TClonesArray *recList = rec->GetRecParticles(); | |
32 | //! | |
33 | // See also $ALICE_ROOT/macros/TestGlobalReconstruction.C | |
34 | //! | |
35 | // Author: Yuri Kharlov. 17 April 2003 | |
36 | ||
8b2df7ae | 37 | #include "AliGenerator.h" |
38 | #include "AliPHOSGetter.h" | |
39 | #include "AliPHOSFastGlobalReconstruction.h" | |
40 | ||
41 | ClassImp(AliPHOSFastGlobalReconstruction) | |
42 | ||
43 | //____________________________________________________________________________ | |
44 | AliPHOSFastGlobalReconstruction::AliPHOSFastGlobalReconstruction(const char* headerFile ) | |
45 | { | |
46 | // Constructor of fast global reconstruction: | |
47 | // create an instance of the PHOS getter, | |
48 | // create an array or reconstructed particles. | |
49 | ||
e957fea8 | 50 | fgime = AliPHOSGetter::Instance(headerFile); |
8b2df7ae | 51 | fGenerator = gAlice->Generator(); |
52 | fParticles = new TClonesArray("TParticle",100); | |
53 | fNParticles = 0; | |
54 | } | |
55 | ||
56 | //____________________________________________________________________________ | |
57 | AliPHOSFastGlobalReconstruction::~AliPHOSFastGlobalReconstruction() | |
58 | { | |
59 | // Destructor of fast global reconstruction: | |
60 | // delete the array of reconstructed particles | |
61 | if (fParticles != 0) { | |
62 | delete fParticles; | |
63 | fParticles = 0; | |
64 | fNParticles = 0; | |
65 | } | |
66 | } | |
67 | ||
68 | //____________________________________________________________________________ | |
69 | void AliPHOSFastGlobalReconstruction::FastReconstruction(Int_t event) | |
70 | { | |
71 | // Perform a fast global reconstruction of event numbered "event". | |
72 | // Reconstructed particles will be stored into array recParticles | |
73 | ||
74 | TParticle *primary; | |
75 | TLorentzVector p,v; | |
76 | Int_t kf,ks,imom1,imom2,idaug1,idaug2; | |
77 | ||
e957fea8 | 78 | fgime->Event(event,"X") ; |
8b2df7ae | 79 | fParticles ->Clear(); |
80 | fNParticles = 0; | |
e957fea8 | 81 | Int_t nPrimaries = fgime->NPrimaries(); |
82 | TClonesArray *primaries = fgime->Primaries(); | |
8b2df7ae | 83 | |
84 | for (Int_t iprim=0; iprim<nPrimaries; iprim++) { | |
85 | primary = (TParticle*)primaries->At(iprim); | |
86 | if ((strcmp(fGenerator->GetName(),"Pythia") ==0 && primary->GetStatusCode() == 1) || | |
87 | (strcmp(fGenerator->GetName(),"HIJINGpara")==0 && primary->GetFirstMother()==-1) || | |
88 | (strcmp(fGenerator->GetName(),"Hijing") ==0 && primary->GetStatusCode() == 3)) { | |
89 | if (Detected(primary)) { | |
90 | primary->Momentum(p); | |
91 | primary->ProductionVertex(v); | |
92 | kf = primary->GetPdgCode(); | |
93 | ks = primary->GetStatusCode(); | |
94 | imom1 = primary->GetFirstMother(); | |
95 | imom2 = primary->GetSecondMother(); | |
96 | idaug1 = primary->GetFirstDaughter(); | |
97 | idaug2 = primary->GetLastDaughter(); | |
98 | SmearMomentum(p); | |
99 | new((*fParticles)[fNParticles]) TParticle(kf,ks,imom1,imom2,idaug1,idaug2,p,v); | |
100 | fNParticles++; | |
101 | } | |
102 | } | |
103 | } | |
104 | } | |
105 | ||
106 | //____________________________________________________________________________ | |
107 | Bool_t AliPHOSFastGlobalReconstruction::Detected(TParticle *particle) | |
108 | { | |
109 | // Returns kTRUE is a particle is reconstructed, kFALSE otherwise. | |
110 | // A particle is reconstructed if it is charged and accepted with the | |
111 | // probability Efficiency(pt,eta) depending on pt and eta. | |
112 | ||
113 | Bool_t detected = kFALSE; | |
114 | if (particle->GetPDG()->Charge() != 0) { | |
115 | Float_t pt = particle->Pt(); | |
116 | Float_t eta = particle->Eta(); | |
117 | if (gRandom->Rndm() < Efficiency(pt,eta)) detected = kTRUE; | |
118 | } | |
119 | return detected; | |
120 | } | |
121 | ||
122 | //____________________________________________________________________________ | |
123 | Float_t AliPHOSFastGlobalReconstruction::Efficiency(Float_t pt, Float_t eta) | |
124 | { | |
125 | // Detection probability vs. pt and eta, i.e. a probability to detect | |
126 | // a particle with transverse momentum pt and speudorapidity eta. | |
127 | // For the moment assume that charged particles are detected with | |
128 | // 80% efficiency within |eta|<0.9 and pt>0.15 GeV, and with 0% efficiency | |
129 | // beyond that acceptance | |
130 | ||
131 | const Float_t kEtaLimit = 0.9; | |
132 | const Float_t kPtLimit = 0.15; | |
133 | Float_t efficiency = 0.0; | |
134 | if (TMath::Abs(eta) < kEtaLimit && pt > kPtLimit) efficiency = 0.80; | |
135 | return efficiency; | |
136 | } | |
137 | ||
138 | //____________________________________________________________________________ | |
139 | void AliPHOSFastGlobalReconstruction::SmearMomentum(TLorentzVector &p) | |
140 | { | |
141 | // Smear 4-momentum according to known resolution (2% for the moment) | |
142 | ||
143 | const Float_t kAngleResolution = 0.02; | |
144 | const Float_t kMomentumResolution = 0.02; | |
145 | Double_t mass = p.M(); | |
146 | for (Int_t i=0; i<3; i++) { | |
147 | p[i] *= gRandom->Gaus(1.,kAngleResolution ); | |
148 | p[i] *= gRandom->Gaus(1.,kMomentumResolution); | |
149 | } | |
150 | p[3] = TMath::Sqrt(p.P()*p.P() + mass*mass); | |
151 | } |