1 /**************************************************************************
2 * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 // --- AliRoot header files ---
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.
29 // rec = new AliPHOSGlobalReconstruction("galice.root");
30 // rec->FastReconstruction(ievent);
31 // TClonesArray *recList = rec->GetRecParticles();
33 // See also $ALICE_ROOT/macros/TestGlobalReconstruction.C
35 // Author: Yuri Kharlov. 17 April 2003
37 #include "AliGenerator.h"
38 #include "AliPHOSGetter.h"
39 #include "AliPHOSFastGlobalReconstruction.h"
41 ClassImp(AliPHOSFastGlobalReconstruction)
43 //____________________________________________________________________________
44 AliPHOSFastGlobalReconstruction::AliPHOSFastGlobalReconstruction(const char* headerFile )
46 // Constructor of fast global reconstruction:
47 // create an instance of the PHOS getter,
48 // create an array or reconstructed particles.
50 fgime = AliPHOSGetter::Instance(headerFile);
51 fGenerator = gAlice->Generator();
52 fParticles = new TClonesArray("TParticle",100);
56 //____________________________________________________________________________
57 AliPHOSFastGlobalReconstruction::~AliPHOSFastGlobalReconstruction()
59 // Destructor of fast global reconstruction:
60 // delete the array of reconstructed particles
61 if (fParticles != 0) {
68 //____________________________________________________________________________
69 void AliPHOSFastGlobalReconstruction::FastReconstruction(Int_t event)
71 // Perform a fast global reconstruction of event numbered "event".
72 // Reconstructed particles will be stored into array recParticles
76 Int_t kf,ks,imom1,imom2,idaug1,idaug2;
78 fgime->Event(event,"X") ;
81 Int_t nPrimaries = fgime->NPrimaries();
82 TClonesArray *primaries = fgime->Primaries();
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)) {
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();
99 new((*fParticles)[fNParticles]) TParticle(kf,ks,imom1,imom2,idaug1,idaug2,p,v);
106 //____________________________________________________________________________
107 Bool_t AliPHOSFastGlobalReconstruction::Detected(TParticle *particle)
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.
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;
122 //____________________________________________________________________________
123 Float_t AliPHOSFastGlobalReconstruction::Efficiency(Float_t pt, Float_t eta)
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
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;
138 //____________________________________________________________________________
139 void AliPHOSFastGlobalReconstruction::SmearMomentum(TLorentzVector &p)
141 // Smear 4-momentum according to known resolution (2% for the moment)
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);
150 p[3] = TMath::Sqrt(p.P()*p.P() + mass*mass);