Adding FASTSIM code (lost during the merge with VMC)
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Nov 2002 09:07:07 +0000 (09:07 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 7 Nov 2002 09:07:07 +0000 (09:07 +0000)
FASTSIM/AliFastDetector.cxx [new file with mode: 0644]
FASTSIM/AliFastDetector.h [new file with mode: 0644]
FASTSIM/AliFastEvent.cxx [new file with mode: 0644]
FASTSIM/AliFastEvent.h [new file with mode: 0644]
FASTSIM/AliFastParticle.cxx [new file with mode: 0644]
FASTSIM/AliFastParticle.h [new file with mode: 0644]
FASTSIM/AliFastResponse.cxx [new file with mode: 0644]
FASTSIM/AliFastResponse.h [new file with mode: 0644]
FASTSIM/FASTSIMLinkDef.h [new file with mode: 0644]
FASTSIM/fastGen.C [new file with mode: 0644]
FASTSIM/libFASTSIM.pkg [new file with mode: 0644]

diff --git a/FASTSIM/AliFastDetector.cxx b/FASTSIM/AliFastDetector.cxx
new file mode 100644 (file)
index 0000000..8bc30e9
--- /dev/null
@@ -0,0 +1,202 @@
+/**************************************************************************
+ * 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$
+Revision 1.1  2002/09/20 13:32:51  morsch
+Base classes for fast simulation. First commit.
+
+*/
+
+
+#include "AliFastDetector.h"
+#include "AliFastResponse.h"
+#include "AliGeometry.h"
+
+#include <TList.h>
+#include <TIterator.h>
+#include <TString.h>
+
+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 (file)
index 0000000..2ee1186
--- /dev/null
@@ -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 <TNamed.h>
+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 (file)
index 0000000..906a3b8
--- /dev/null
@@ -0,0 +1,26 @@
+/**************************************************************************
+ * 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$
+Revision 1.1  2002/09/20 13:32:51  morsch
+Base classes for fast simulation. First commit.
+
+*/
+
+
+#include "AliFastEvent.h"
+
+ClassImp(AliFastEvent)
diff --git a/FASTSIM/AliFastEvent.h b/FASTSIM/AliFastEvent.h
new file mode 100644 (file)
index 0000000..3854e91
--- /dev/null
@@ -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 <TObject.h>
+#include <TArrayF.h>
+
+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 (file)
index 0000000..693ea2f
--- /dev/null
@@ -0,0 +1,26 @@
+/**************************************************************************
+ * 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$
+Revision 1.1  2002/09/20 13:32:51  morsch
+Base classes for fast simulation. First commit.
+
+*/
+
+
+#include "AliFastParticle.h"
+
+ClassImp(AliFastParticle)
diff --git a/FASTSIM/AliFastParticle.h b/FASTSIM/AliFastParticle.h
new file mode 100644 (file)
index 0000000..67e4ed2
--- /dev/null
@@ -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 <TParticle.h>
+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 (file)
index 0000000..a8b0a98
--- /dev/null
@@ -0,0 +1,52 @@
+/**************************************************************************
+ * 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$
+Revision 1.1  2002/09/20 13:32:51  morsch
+Base classes for fast simulation. First commit.
+
+*/
+
+
+#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 (file)
index 0000000..1e666c4
--- /dev/null
@@ -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 <TNamed.h>
+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 (file)
index 0000000..62884ed
--- /dev/null
@@ -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/fastGen.C b/FASTSIM/fastGen.C
new file mode 100644 (file)
index 0000000..35b1bb9
--- /dev/null
@@ -0,0 +1,106 @@
+AliGenerator*  CreateGenerator();
+
+void fastGen(Int_t nev = 1, char* filename = "galice.root")
+{
+//
+//                        Construction
+//
+//  Output file
+    TFile*  file         = new TFile(filename, "recreate");
+//  Create stack
+    AliStack* stack      = new AliStack(10000);
+    stack->MakeTree(0, filename);
+
+//  Create Header
+    AliHeader* header    = new AliHeader();
+//  Create Header Tree
+    TTree* treeE         = new TTree("TE","Headers");
+    treeE->Branch("Header", "AliHeader", &header, 4000, 0);
+    treeE->Write();
+//
+//  Create and Initialize Generator
+    AliGenerator *gener = CreateGenerator();
+    gener->Init();
+    gener->SetStack(stack);
+    
+//
+//                        Event Loop
+//
+    Int_t iev;
+     
+    for (iev = 0; iev < nev; iev++) {
+
+       printf("\n \n Event number %d \n \n", iev);
+       
+//  Initialize event
+       header->Reset(0,iev);
+       stack->BeginEvent(iev);
+
+//  Generate event
+       gener->Generate();
+//  Analysis
+       Int_t npart = stack->GetNprimary();
+       printf("Analyse %d Particles\n", npart);
+       for (Int_t part=0; part<npart; part++) {
+           TParticle *MPart = stack->Particle(part);
+           Int_t mpart  = MPart->GetPdgCode();
+           printf("Particle %d\n", mpart);
+       }
+       
+//  Finish event
+       header->SetNprimary(stack->GetNprimary());
+       header->SetNtrack(stack->GetNtrack());  
+//      I/O
+//     
+//     stack->FinishEvent();
+//     header->SetStack(stack);
+//     treeE->Fill();
+//     Reset stack
+
+       stack->Reset();
+    } // event loop
+//
+//                         Termination
+//  Generator
+    gener->FinishRun();
+//  Header
+    treeE->Write(0,TObject::kOverwrite);
+    delete treeE;   treeE = 0;
+//  Stack
+    stack->FinishRun();
+//  Write file
+    gener->Write();
+    file->Write();
+}
+
+
+AliGenerator*  CreateGenerator()
+{
+    gener = new AliGenPythia(1);
+//
+//
+//   vertex position and smearing 
+    gener->SetVertexSmear(kPerEvent);
+//   structure function
+    gener->SetStrucFunc(kGRVHO);
+//   charm, beauty, charm_unforced, beauty_unforced, jpsi, jpsi_chi, mb
+    gener->SetProcess(kPyJets);
+//   Centre of mass energy 
+    gener->SetEnergyCMS(14000.);
+//   Pt transfer of the hard scattering
+    gener->SetPtHard(5.,5.1);
+//   Initialize generator    
+    return gener;
+}
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FASTSIM/libFASTSIM.pkg b/FASTSIM/libFASTSIM.pkg
new file mode 100644 (file)
index 0000000..bb566c0
--- /dev/null
@@ -0,0 +1,9 @@
+SRCS          =   \
+AliFastDetector.cxx \
+AliFastResponse.cxx \
+AliFastParticle.cxx \
+AliFastEvent.cxx 
+
+HDRS:= $(SRCS:.cxx=.h) 
+
+DHDR= FASTSIMLinkDef.h