From: schutz Date: Fri, 23 May 2003 16:06:59 +0000 (+0000) Subject: New class AliPHOSFastGlobalReconstruction is added X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=commitdiff_plain;h=8b2df7ae4a3fe692c86226109bb993055ab642b5 New class AliPHOSFastGlobalReconstruction is added --- diff --git a/PHOS/AliPHOSFastGlobalReconstruction.cxx b/PHOS/AliPHOSFastGlobalReconstruction.cxx new file mode 100644 index 00000000000..c2f1fd05e27 --- /dev/null +++ b/PHOS/AliPHOSFastGlobalReconstruction.cxx @@ -0,0 +1,152 @@ +/************************************************************************** + * Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +// --- AliRoot header files --- + +// Fast global reconstruction class. +// It performes fast reconstruction for charged particles only, +// assuming that they were detected by all central ALICE detectors but PHOS. +// This class acts as a filter for primary particles, selects them +// and deteriorates their 4-momenta. +// The filter can recognize the primary particle list from different +// event generators: Pythia, Hijing, HIJINGPara. +//! +// Usage: +// rec = new AliPHOSGlobalReconstruction("galice.root"); +// rec->FastReconstruction(ievent); +// TClonesArray *recList = rec->GetRecParticles(); +//! +// See also $ALICE_ROOT/macros/TestGlobalReconstruction.C +//! +// Author: Yuri Kharlov. 17 April 2003 + +#include "AliRun.h" +#include "AliGenerator.h" +#include "AliPHOSGetter.h" +#include "AliPHOSFastGlobalReconstruction.h" + +ClassImp(AliPHOSFastGlobalReconstruction) + +//____________________________________________________________________________ +AliPHOSFastGlobalReconstruction::AliPHOSFastGlobalReconstruction(const char* headerFile ) +{ + // Constructor of fast global reconstruction: + // create an instance of the PHOS getter, + // create an array or reconstructed particles. + + gime = AliPHOSGetter::GetInstance(headerFile); + fGenerator = gAlice->Generator(); + fParticles = new TClonesArray("TParticle",100); + fNParticles = 0; +} + +//____________________________________________________________________________ +AliPHOSFastGlobalReconstruction::~AliPHOSFastGlobalReconstruction() +{ + // Destructor of fast global reconstruction: + // delete the array of reconstructed particles + if (fParticles != 0) { + delete fParticles; + fParticles = 0; + fNParticles = 0; + } +} + +//____________________________________________________________________________ +void AliPHOSFastGlobalReconstruction::FastReconstruction(Int_t event) +{ + // Perform a fast global reconstruction of event numbered "event". + // Reconstructed particles will be stored into array recParticles + + TParticle *primary; + TLorentzVector p,v; + Int_t kf,ks,imom1,imom2,idaug1,idaug2; + + gime->Event(event,"P") ; + fParticles ->Clear(); + fNParticles = 0; + Int_t nPrimaries = gime->NPrimaries(); + TClonesArray *primaries = gime->Primaries(); + + for (Int_t iprim=0; iprimAt(iprim); + if ((strcmp(fGenerator->GetName(),"Pythia") ==0 && primary->GetStatusCode() == 1) || + (strcmp(fGenerator->GetName(),"HIJINGpara")==0 && primary->GetFirstMother()==-1) || + (strcmp(fGenerator->GetName(),"Hijing") ==0 && primary->GetStatusCode() == 3)) { + if (Detected(primary)) { + primary->Momentum(p); + primary->ProductionVertex(v); + kf = primary->GetPdgCode(); + ks = primary->GetStatusCode(); + imom1 = primary->GetFirstMother(); + imom2 = primary->GetSecondMother(); + idaug1 = primary->GetFirstDaughter(); + idaug2 = primary->GetLastDaughter(); + SmearMomentum(p); + new((*fParticles)[fNParticles]) TParticle(kf,ks,imom1,imom2,idaug1,idaug2,p,v); + fNParticles++; + } + } + } +} + +//____________________________________________________________________________ +Bool_t AliPHOSFastGlobalReconstruction::Detected(TParticle *particle) +{ + // Returns kTRUE is a particle is reconstructed, kFALSE otherwise. + // A particle is reconstructed if it is charged and accepted with the + // probability Efficiency(pt,eta) depending on pt and eta. + + Bool_t detected = kFALSE; + if (particle->GetPDG()->Charge() != 0) { + Float_t pt = particle->Pt(); + Float_t eta = particle->Eta(); + if (gRandom->Rndm() < Efficiency(pt,eta)) detected = kTRUE; + } + return detected; +} + +//____________________________________________________________________________ +Float_t AliPHOSFastGlobalReconstruction::Efficiency(Float_t pt, Float_t eta) +{ + // Detection probability vs. pt and eta, i.e. a probability to detect + // a particle with transverse momentum pt and speudorapidity eta. + // For the moment assume that charged particles are detected with + // 80% efficiency within |eta|<0.9 and pt>0.15 GeV, and with 0% efficiency + // beyond that acceptance + + const Float_t kEtaLimit = 0.9; + const Float_t kPtLimit = 0.15; + Float_t efficiency = 0.0; + if (TMath::Abs(eta) < kEtaLimit && pt > kPtLimit) efficiency = 0.80; + return efficiency; +} + +//____________________________________________________________________________ +void AliPHOSFastGlobalReconstruction::SmearMomentum(TLorentzVector &p) +{ + // Smear 4-momentum according to known resolution (2% for the moment) + + const Float_t kAngleResolution = 0.02; + const Float_t kMomentumResolution = 0.02; + Double_t mass = p.M(); + for (Int_t i=0; i<3; i++) { + p[i] *= gRandom->Gaus(1.,kAngleResolution ); + p[i] *= gRandom->Gaus(1.,kMomentumResolution); + } + p[3] = TMath::Sqrt(p.P()*p.P() + mass*mass); +} diff --git a/PHOS/AliPHOSFastGlobalReconstruction.h b/PHOS/AliPHOSFastGlobalReconstruction.h new file mode 100644 index 00000000000..92633507115 --- /dev/null +++ b/PHOS/AliPHOSFastGlobalReconstruction.h @@ -0,0 +1,44 @@ +#ifndef ALIPHOSFASTGLOBALRECONSTRUCTION_H +#define ALIPHOSFASTGLOBALRECONSTRUCTION_H +/* Copyright(c) 1998-2003, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +// Fast global reconstruction class. +// It performes fast reconstruction for charged particles only, +// assuming that they were detected by all central ALICE detectors but PHOS. +// This class acts as a filter for primary particles, selects them +// and deteriorates their 4-momenta. +//! +// Author: Yuri Kharlov. 17 April 2003 + +//_________________________________________________________________________ +class AliGenerator; +class TClonesArray; +class AliPHOSGetter; + +class AliPHOSFastGlobalReconstruction : public TObject { + +public: + AliPHOSFastGlobalReconstruction() {}; + AliPHOSFastGlobalReconstruction(const char* headerFile); + virtual ~AliPHOSFastGlobalReconstruction(); + void FastReconstruction(Int_t event); + TClonesArray *GetRecParticles() const {return fParticles;} + +private: + Bool_t Detected(TParticle *particle); + Float_t Efficiency(Float_t pt, Float_t eta); + void SmearMomentum(TLorentzVector &p); + +private: + AliPHOSGetter *gime; //! Instance of the PHOS getter + AliGenerator *fGenerator; //! MC generator used in simulation + TClonesArray *fParticles; //! Array of reconstructed particles + Int_t fNParticles; //! Number of reconstructed particles + +ClassDef(AliPHOSFastGlobalReconstruction,1) // Fast global reconstruction +}; + +#endif // AliPHOSFASTGLOBALRECONSTRUCTION_H diff --git a/PHOS/PHOSLinkDef.h b/PHOS/PHOSLinkDef.h index acbd677d491..c156a7a6a4e 100644 --- a/PHOS/PHOSLinkDef.h +++ b/PHOS/PHOSLinkDef.h @@ -59,5 +59,6 @@ #pragma link C++ class AliPHOSCalibrationData+; #pragma link C++ class AliPHOSJetFinder+; #pragma link C++ class AliPHOSJet+; +#pragma link C++ class AliPHOSFastGlobalReconstruction+; #endif diff --git a/PHOS/libPHOS.pkg b/PHOS/libPHOS.pkg index c5dda75b997..edec4acadf8 100644 --- a/PHOS/libPHOS.pkg +++ b/PHOS/libPHOS.pkg @@ -25,7 +25,8 @@ SRCS = AliPHOS.cxx AliPHOSv0.cxx AliPHOSv1.cxx AliPHOSv2.cxx \ AliPHOSRaw2Digits.cxx AliPHOSBeamTestEvent.cxx \ AliPHOSCalibrManager.cxx \ AliPHOSConTableDB.cxx AliPHOSCalibrator.cxx\ - AliPHOSCalibrationData.cxx AliPHOSJet.cxx AliPHOSJetFinder.cxx + AliPHOSCalibrationData.cxx AliPHOSJet.cxx AliPHOSJetFinder.cxx \ + AliPHOSFastGlobalReconstruction.cxx HDRS:= $(SRCS:.cxx=.h)