From f38bbb0b2846aea0b7385adb9c281d6d032fa917 Mon Sep 17 00:00:00 2001 From: morsch Date: Fri, 20 Sep 2002 13:32:51 +0000 Subject: [PATCH] Base classes for fast simulation. First commit. --- FASTSIM/AliFastDetector.cxx | 199 ++++++++++++++++++++++++++++++++++++ FASTSIM/AliFastDetector.h | 58 +++++++++++ FASTSIM/AliFastEvent.cxx | 23 +++++ FASTSIM/AliFastEvent.h | 43 ++++++++ FASTSIM/AliFastParticle.cxx | 23 +++++ FASTSIM/AliFastParticle.h | 20 ++++ FASTSIM/AliFastResponse.cxx | 49 +++++++++ FASTSIM/AliFastResponse.h | 26 +++++ FASTSIM/FASTSIMLinkDef.h | 20 ++++ FASTSIM/libFASTSIM.pkg | 9 ++ 10 files changed, 470 insertions(+) create mode 100644 FASTSIM/AliFastDetector.cxx create mode 100644 FASTSIM/AliFastDetector.h create mode 100644 FASTSIM/AliFastEvent.cxx create mode 100644 FASTSIM/AliFastEvent.h create mode 100644 FASTSIM/AliFastParticle.cxx create mode 100644 FASTSIM/AliFastParticle.h create mode 100644 FASTSIM/AliFastResponse.cxx create mode 100644 FASTSIM/AliFastResponse.h create mode 100644 FASTSIM/FASTSIMLinkDef.h create mode 100644 FASTSIM/libFASTSIM.pkg diff --git a/FASTSIM/AliFastDetector.cxx b/FASTSIM/AliFastDetector.cxx new file mode 100644 index 00000000000..ea938a469bd --- /dev/null +++ b/FASTSIM/AliFastDetector.cxx @@ -0,0 +1,199 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* +$Log$ +*/ + + +#include "AliFastDetector.h" +#include "AliFastResponse.h" +#include "AliGeometry.h" + +#include +#include +#include + +ClassImp(AliFastDetector) +AliFastDetector::AliFastDetector() +{ +// Default Constructor + fName = "FastDetector"; + fTitle = "Fast Detector Base Class"; + fLnkD = 0; + fLnkR = 0; + + fResponses = 0; + fSubdetectors = 0; +} + +AliFastDetector::AliFastDetector(char* Name, char* Title): + TNamed(Name, Title) +{ +// Constructor + fSubdetectors = new TList(); + fResponses = new TList(); +} + +AliFastDetector::~AliFastDetector() +{ +// Destructor + delete fSubdetectors; + delete fResponses; +} + + +void AliFastDetector::Init() +{ +// +// Initialisation +// + TIter nextRes(fResponses); + AliFastResponse *res; + // + // Loop over responses and initialize + while((res = (AliFastResponse*)nextRes())) { + res->Init(); + } + + TIter nextDet(fSubdetectors); + AliFastDetector *det; + // + // Loop over subdetectors and initialize + while((det = (AliFastDetector*)nextDet())) { + det->Init(); + } + // + TObject* obj; + + if ((obj = fResponses->FindObject("Efficiency"))) + { + + fEfficiency = (AliFastResponse*) obj; + printf("Detector %s provides Efficiency: %s\n", + fName.Data(), fEfficiency->GetTitle()); + } + + if ((obj = fResponses->FindObject("Resolution"))) + { + fResolution = (AliFastResponse*) obj; + printf("Detector %s provides Resolution: %s\n", + fName.Data(), fResolution->GetTitle()); + } +} + +Float_t AliFastDetector::EvaluateEfficiency(AliFastParticle* part) +{ + TIter nextDet(fSubdetectors); + AliFastDetector *det; + // + // Loop over subdetectors + Float_t eff = 1; + while((det = (AliFastDetector*)nextDet())) { + eff *= det->EvaluateEfficiency(part); + } + return eff; +} + +Bool_t AliFastDetector::EvaluateAcceptance(AliFastParticle* part) +{ + // + // Loop over subdetectors + Bool_t acc = kFALSE; + + if (fSubdetectors) { + TIter nextDet(fSubdetectors); + AliFastDetector *det; + while((det = (AliFastDetector*)nextDet()) && !acc) { + acc = (acc || det->EvaluateAcceptance(part)); + } + } else { + if (fGeometry) + acc = fGeometry->Impact((TParticle*) part); + } + + return acc; +} + +void AliFastDetector::EvaluateResponse(AliFastParticle* part) +{ + ; +} + +void AliFastDetector:: +AddSubdetector(AliFastDetector *Detector, char* Name) +{ +// +// Add detector to list + fSubdetectors->Add(Detector); +} + + + +void AliFastDetector:: +AddResponse(AliFastResponse *Response) +{ +// +// Add detector to list + fResponses->Add(Response); +} + + +AliFastDetector* AliFastDetector::FirstSubdetector() +{ +// Iterator over generators: Initialisation + fLnkD = fSubdetectors->FirstLink(); + if (fLnkD) { + return (AliFastDetector*) (fLnkD->GetObject()); + } else { + return 0; + } +} + +AliFastDetector* AliFastDetector::NextSubdetector() +{ +// Iterator over generators: Increment + fLnkD = fLnkD->Next(); + if (fLnkD) { + return (AliFastDetector*) (fLnkD->GetObject()); + } else { + return 0; + } +} + + +AliFastResponse* AliFastDetector::FirstResponse() +{ +// Iterator over generators: Initialisation + fLnkR = fResponses->FirstLink(); + if (fLnkR) { + return (AliFastResponse*) (fLnkR->GetObject()); + } else { + return 0; + } +} + +AliFastResponse* AliFastDetector::NextResponse() +{ +// Iterator over generators: Increment + fLnkR = fLnkR->Next(); + if (fLnkR) { + return (AliFastResponse*) (fLnkR->GetObject()); + } else { + return 0; + } +} + + diff --git a/FASTSIM/AliFastDetector.h b/FASTSIM/AliFastDetector.h new file mode 100644 index 00000000000..2ee11869c40 --- /dev/null +++ b/FASTSIM/AliFastDetector.h @@ -0,0 +1,58 @@ +#ifndef ALIFASTDETECTOR_H +#define ALIFASTDETECTOR_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include +class TList; +class TObjLink; +class AliFastResponse; +class AliFastParticle; +class AliGeometry; + +class AliFastDetector : public TNamed { + + public: + AliFastDetector(); + AliFastDetector(char* Name, char* Title); + virtual ~AliFastDetector(); + virtual void Init(); + virtual void SetGeometry(AliGeometry* geom) + {fGeometry = geom;} + + virtual AliGeometry* GetGeometry() const + {return fGeometry;} + // + // Add a new subdetector + virtual void AddSubdetector(AliFastDetector *Detector, char* Name); + virtual TList* Subdetectors() {return fSubdetectors;} + // + // Add a new response + virtual void AddResponse(AliFastResponse *Response); + virtual TList* Responses() {return fResponses;} + virtual Float_t EvaluateEfficiency(AliFastParticle* part); + virtual Bool_t EvaluateAcceptance(AliFastParticle* part); + virtual void EvaluateResponse(AliFastParticle* part); + + // Iterators + AliFastDetector* FirstSubdetector(); + AliFastDetector* NextSubdetector(); + AliFastResponse* FirstResponse(); + AliFastResponse* NextResponse(); + protected: + TList *fSubdetectors; // List of Subdetectors + TList *fResponses; // Responses + TObjLink *fLnkD; // Pointer to detector in list + TObjLink *fLnkR; // Pointer to response in list + AliFastResponse *fEfficiency; // Efficiency Simulation + AliFastResponse *fResolution; // Resolution Simulation + AliGeometry *fGeometry; // Geometry + ClassDef(AliFastDetector,1) // Base class for fast detector +}; + +#endif + + + diff --git a/FASTSIM/AliFastEvent.cxx b/FASTSIM/AliFastEvent.cxx new file mode 100644 index 00000000000..ab8a49651d0 --- /dev/null +++ b/FASTSIM/AliFastEvent.cxx @@ -0,0 +1,23 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* +$Log$ +*/ + + +#include "AliFastEvent.h" + +ClassImp(AliFastEvent) diff --git a/FASTSIM/AliFastEvent.h b/FASTSIM/AliFastEvent.h new file mode 100644 index 00000000000..3854e91f07a --- /dev/null +++ b/FASTSIM/AliFastEvent.h @@ -0,0 +1,43 @@ +#ifndef ALIFASTEVENT_H +#define ALIFASTEVENT_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include +#include + +class AliFastEvent : public TObject { + public: + AliFastEvent(){;} + virtual ~AliFastEvent(){;} + virtual void SetMultiplicty(Int_t mul) + {fMultiplicity = mul;} + virtual Int_t GetMultiplicty(Int_t mul) + {return fMultiplicity;} + virtual void SetVertex(const TArrayF &o) + { + fEventVertex[0] = o.At(0); + fEventVertex[1] = o.At(1); + fEventVertex[2] = o.At(2); + } + + virtual void GetVertex(TArrayF &o) const + { + o[0] = fEventVertex.At(0); + o[1] = fEventVertex.At(1); + o[2] = fEventVertex.At(2); + } + + protected: + Int_t fMultiplicity; // Event Multiplicity + TArrayF fEventVertex; // Event primary vertex + + ClassDef(AliFastEvent,1) // Base class for fast event +}; + +#endif + + + diff --git a/FASTSIM/AliFastParticle.cxx b/FASTSIM/AliFastParticle.cxx new file mode 100644 index 00000000000..5a4b3b85a70 --- /dev/null +++ b/FASTSIM/AliFastParticle.cxx @@ -0,0 +1,23 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* +$Log$ +*/ + + +#include "AliFastParticle.h" + +ClassImp(AliFastParticle) diff --git a/FASTSIM/AliFastParticle.h b/FASTSIM/AliFastParticle.h new file mode 100644 index 00000000000..67e4ed2036c --- /dev/null +++ b/FASTSIM/AliFastParticle.h @@ -0,0 +1,20 @@ +#ifndef ALIFASTPARTICLE_H +#define ALIFASTPARTICLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include +class AliFastParticle : public TParticle { + public: + AliFastParticle(){;} + virtual ~AliFastParticle(){;} + protected: + ClassDef(AliFastParticle,1) // Base class for fast particle +}; + +#endif + + + diff --git a/FASTSIM/AliFastResponse.cxx b/FASTSIM/AliFastResponse.cxx new file mode 100644 index 00000000000..1a29327dfcc --- /dev/null +++ b/FASTSIM/AliFastResponse.cxx @@ -0,0 +1,49 @@ +/************************************************************************** + * Copyright(c) 1998-1999, 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. * + **************************************************************************/ + +/* +$Log$ +*/ + + +#include "AliFastResponse.h" +#include "AliFastParticle.h" + +ClassImp(AliFastResponse) + + +Float_t AliFastResponse::Evaluate(AliFastParticle* part) +{ +// +// Basic implementation of this method +// + Float_t theta = part->Theta(); + Float_t phi = part->Phi(); + Float_t pt = part->Pt(); + Float_t eff = Evaluate(pt, theta, phi); + return eff; +} + +void AliFastResponse::Evaluate(Float_t p, Float_t theta , Float_t phi, + Float_t& pS, Float_t& thetaS, Float_t& phiS) +{ +// +// Basic implementation of this method +// + pS = p; + thetaS = theta; + phiS = phi; +} + diff --git a/FASTSIM/AliFastResponse.h b/FASTSIM/AliFastResponse.h new file mode 100644 index 00000000000..1e666c47044 --- /dev/null +++ b/FASTSIM/AliFastResponse.h @@ -0,0 +1,26 @@ +#ifndef ALIFASTRESPONSE_H +#define ALIFASTRESPONSE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#include +class AliFastParticle; + +class AliFastResponse : public TNamed { + public: + AliFastResponse(){;} + AliFastResponse(char* Name, char* Title) : TNamed(Name, Title) {} + virtual ~AliFastResponse(){} + virtual void Init() = 0; + virtual Float_t Evaluate(Float_t pt, Float_t theta , Float_t phi) + {return -1.;} + virtual void Evaluate(Float_t p, Float_t theta , Float_t phi, + Float_t& pS, Float_t& thetaS, Float_t& phiS); + virtual Float_t Evaluate(AliFastParticle* part); + protected: + ClassDef(AliFastResponse,1) // Base class for fast response +}; + +#endif diff --git a/FASTSIM/FASTSIMLinkDef.h b/FASTSIM/FASTSIMLinkDef.h new file mode 100644 index 00000000000..62884ed4499 --- /dev/null +++ b/FASTSIM/FASTSIMLinkDef.h @@ -0,0 +1,20 @@ +#ifdef __CINT__ +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class AliFastDetector+; +#pragma link C++ class AliFastResponse+; +#pragma link C++ class AliFastParticle+; +#pragma link C++ class AliFastEvent+; +#endif + + + + + diff --git a/FASTSIM/libFASTSIM.pkg b/FASTSIM/libFASTSIM.pkg new file mode 100644 index 00000000000..bb566c09172 --- /dev/null +++ b/FASTSIM/libFASTSIM.pkg @@ -0,0 +1,9 @@ +SRCS = \ +AliFastDetector.cxx \ +AliFastResponse.cxx \ +AliFastParticle.cxx \ +AliFastEvent.cxx + +HDRS:= $(SRCS:.cxx=.h) + +DHDR= FASTSIMLinkDef.h -- 2.43.0