]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
MevSim interfaced through AliGenerator, first commit (Sylwester Radomski et al.)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 24 Mar 2001 10:04:44 +0000 (10:04 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sat, 24 Mar 2001 10:04:44 +0000 (10:04 +0000)
EVGEN/AliGenMevSim.cxx [new file with mode: 0644]
EVGEN/AliGenMevSim.h [new file with mode: 0644]
EVGEN/AliMevSimConfig.cxx [new file with mode: 0644]
EVGEN/AliMevSimConfig.h [new file with mode: 0644]
EVGEN/AliMevSimParticle.cxx [new file with mode: 0644]
EVGEN/AliMevSimParticle.h [new file with mode: 0644]

diff --git a/EVGEN/AliGenMevSim.cxx b/EVGEN/AliGenMevSim.cxx
new file mode 100644 (file)
index 0000000..d9dd96a
--- /dev/null
@@ -0,0 +1,185 @@
+/**************************************************************************
+ * 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$
+*/
+
+//
+// Wrapper for MEVSIM generator.
+// It is using TMevSim to comunicate with fortarn code
+// 
+//     
+// Sylwester Radomski <radomski@if.pw.edu.pl>
+//
+
+//#include "TSystem.h"
+//#include "TUnixSystem.h"
+#include "TParticle.h"
+#include "TMevSim.h"
+
+#include "AliGenMevSim.h"
+#include "AliRun.h"
+
+
+ClassImp(AliGenMevSim)
+
+//____________________________________________________________________________
+AliGenMevSim::AliGenMevSim() : AliGenerator(-1) 
+{
+  //
+  // Standard creator
+  //
+  
+  fConfig = new AliMevSimConfig();
+  fgMCEvGen = new TMevSim();
+  sRandom = fRandom;
+  
+}
+//____________________________________________________________________________
+AliGenMevSim::AliGenMevSim(AliMevSimConfig *config): AliGenerator(-1) {
+
+  fConfig = config;
+  fgMCEvGen = new TMevSim(); 
+  sRandom = fRandom;
+}
+
+//____________________________________________________________________________
+AliGenMevSim::~AliGenMevSim() 
+{
+  //
+  // Standard destructor
+  //
+  if (fgMCEvGen) delete fgMCEvGen;
+}
+//____________________________________________________________________________
+void AliGenMevSim::SetConfig(AliMevSimConfig *config) {
+  
+  fConfig = config;
+}
+//____________________________________________________________________________
+void AliGenMevSim::AddParticleType(AliMevSimParticle *type) {
+
+  ((TMevSim*)fgMCEvGen)->AddPartTypeParams((TMevSimPartTypeParams*)type);
+}
+//____________________________________________________________________________
+void AliGenMevSim::Init() 
+{
+  //
+  // Generator initialisation method
+  //
+
+  // fill data from AliMevSimConfig;
+
+  TMevSim *mevsim = (TMevSim*)fgMCEvGen;
+
+  // geometry & momentum cut
+
+  if (TestBit(kPtRange))  mevsim->SetPtCutRange(fPtMin, fPtMax);
+  
+  if (TestBit(kPhiRange)) // from radians to 0 - 360 deg
+    mevsim->SetPhiCutRange( fPhiMin * 180 / TMath::Pi() , fPhiMax * 180 / TMath::Pi() );
+  
+  if (TestBit(kThetaRange)) // from theta to eta
+    mevsim->SetEtaCutRange( -TMath::Log( TMath::Tan(fThetaMin/2)) , - TMath::Log( TMath::Tan(fThetaMin/2)) );
+
+
+  // mevsim specyfic parameters
+  
+  mevsim->SetModelType(fConfig->fModelType);
+  mevsim->SetReacPlaneCntrl(fConfig->fReacPlaneCntrl);
+  mevsim->SetPsiRParams(fConfig->fPsiRMean, fConfig->fPsiRStDev);
+  mevsim->SetMultFacParams(fConfig->fMultFacMean, fConfig->fMultFacStDev);
+  
+  // mevsim initialisation
+
+  mevsim->Initialize();
+}
+
+//____________________________________________________________________________
+void AliGenMevSim::Generate() 
+{
+  //
+  // Read the formatted output file and load the particles
+  // Temporary solution
+  //
+
+  PDG_t pdg;
+  Float_t orgin[3] = {0,0,0};
+  Float_t polar[3] = {0,0,0};
+  Float_t p[3] = {1,1,1};
+  Float_t time = 0;
+  
+  const Int_t parent = -1;
+  Int_t id;
+
+  // vertexing 
+
+  VertexInternal();
+
+  orgin[0] = fVertex[0];
+  orgin[1] = fVertex[1];
+  orgin[2] = fVertex[2];
+
+  cout << "Vertex ";
+  for (Int_t i =0; i<3; i++)
+    cout << orgin[i] << "\t";
+  cout << endl;
+
+  Int_t nParticles = 0;
+
+  TClonesArray *particles = new TClonesArray("TParticle");
+  TParticle *particle;
+
+  ((TMevSim*)fgMCEvGen)->GenerateEvent();
+  nParticles = ((TMevSim*)fgMCEvGen)->ImportParticles(particles,"");
+
+  cout << "Found " << nParticles << " particles ..." << endl;
+
+
+  for (Int_t i=0; i<nParticles; i++) {
+    
+    particle = (TParticle*) (*particles)[i];
+
+    pdg = (PDG_t) particle->GetPdgCode();
+    p[0] = particle->Px();
+    p[1] = particle->Py();
+    p[2] = particle->Pz();
+    
+    gAlice->SetTrack(fTrackIt, parent, pdg, p, orgin, polar, time, kPPrimary, id);
+
+  }  
+  particles->Clear();
+  if (particles) delete particles;
+}
+//____________________________________________________________________________
+//____________________________________________________________________________
+
+
+#ifndef WIN32
+# define ran ran_
+# define type_of_call
+#else
+# define ran RAN
+# define type_of_call _stdcall
+#endif
+
+extern "C" Float_t type_of_call ran(Int_t &)
+{
+  return sRandom->Rndm(); 
+}
+
+//____________________________________________________________________________
diff --git a/EVGEN/AliGenMevSim.h b/EVGEN/AliGenMevSim.h
new file mode 100644 (file)
index 0000000..ebcf6d3
--- /dev/null
@@ -0,0 +1,41 @@
+#ifndef ALIGENMEVSIM_H
+#define ALIGENMEVSIM_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+// Implementation of the interface for TMevsim
+// Author: Sylwester Radomski <radomski@if.pw.edu.pl>
+
+
+#include "TString.h" 
+
+#include "AliGenerator.h"
+
+#include "AliMevSimConfig.h"
+#include "AliMevSimParticle.h"
+
+
+class AliGenMevSim : public AliGenerator { 
+
+  AliMevSimConfig *fConfig;
+public:
+
+  AliGenMevSim();
+  AliGenMevSim(AliMevSimConfig *config);
+
+  virtual ~AliGenMevSim();
+
+  // 
+  virtual void SetConfig(AliMevSimConfig *config);
+  virtual void AddParticleType(AliMevSimParticle *type);
+
+  virtual void Init();
+  virtual void Generate();
+
+  ClassDef(AliGenMevSim,1) // Interface class for AliMevsim
+    
+};
+#endif
diff --git a/EVGEN/AliMevSimConfig.cxx b/EVGEN/AliMevSimConfig.cxx
new file mode 100644 (file)
index 0000000..68ee230
--- /dev/null
@@ -0,0 +1,101 @@
+
+
+#include "AliMevSimConfig.h"
+
+ClassImp(AliMevSimConfig)
+
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimConfig::AliMevSimConfig() {
+
+  Init();
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimConfig::AliMevSimConfig(Int_t modelType) {
+
+  Init();
+  SetModelType(modelType);
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimConfig::~AliMevSimConfig() {
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliMevSimConfig::Init() {
+
+  // Default Values
+
+  fModelType = 1;
+  fReacPlaneCntrl = 4;
+  fPsiRMean = fPsiRStDev = 0;
+
+  fMultFacMean  = 1.0;
+  fMultFacStDev = 0.0;
+
+  fNStDevMult = fNStDevTemp = fNStDevSigma = 3.0;
+  fNStDevExpVel = fNStdDevPSIr = fNStDevVn = fNStDevMultFac = 3.0;
+  
+  fNIntegPts = fNScanPts = 100;
+
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+void AliMevSimConfig::SetModelType(Int_t modelType) {
+
+  if (modelType < 0 || modelType > kMAX_MODEL)
+    Error("SetModelType","Wrog Model Type indentifier (%d)",modelType);
+
+  fModelType = modelType;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliMevSimConfig::SetRectPlane(Int_t ctrl, Float_t psiRMean, Float_t psiRStDev) {
+
+  if (ctrl < 0 || ctrl > kMAX_CTRL)
+    Error("SetReactPlane","Wrong Control Parameter (%d)", ctrl);
+
+  fReacPlaneCntrl = ctrl;
+  fPsiRMean = psiRMean;
+  fPsiRStDev = psiRStDev;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliMevSimConfig::SetMultFac(Float_t mean, Float_t stDev) {
+  
+  fMultFacMean = mean;
+  fMultFacStDev = stDev;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliMevSimConfig::SetStDev(Float_t mult, Float_t temp, Float_t sigma,
+  Float_t expVel, Float_t psiR, Float_t Vn, Float_t multFac) {
+
+  fNStDevMult = mult;
+  fNStDevTemp = temp;
+  fNStDevSigma = sigma;
+  fNStDevExpVel = expVel;
+  fNStdDevPSIr = psiR;
+  fNStDevVn = Vn;
+  fNStDevMultFac =multFac;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
+
+void AliMevSimConfig::SetGrid(Int_t integr, Int_t scan) {
+
+  fNIntegPts = integr;
+  fNScanPts = scan;
+}
+
+//////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/EVGEN/AliMevSimConfig.h b/EVGEN/AliMevSimConfig.h
new file mode 100644 (file)
index 0000000..4cd72d0
--- /dev/null
@@ -0,0 +1,54 @@
+#ifndef ALIMEVSIMCONFIG_H
+#define ALIMEVSIMCONFIG_H
+
+#include "TObject.h"
+
+class AliGenMevSim;
+
+class AliMevSimConfig : public TObject {
+
+  friend class AliGenMevSim;
+
+ protected:
+
+  static const Int_t kMAX_MODEL = 4;
+  static const Int_t kMAX_CTRL = 4;
+
+  Int_t fModelType;
+
+  Int_t fReacPlaneCntrl;
+  Float_t fPsiRMean, fPsiRStDev;
+
+  Float_t fMultFacMean, fMultFacStDev;
+
+  Float_t fNStDevMult, fNStDevTemp, fNStDevSigma, fNStDevExpVel, fNStdDevPSIr, fNStDevVn, fNStDevMultFac;
+
+  Int_t fNIntegPts;
+  Int_t fNScanPts;
+
+  void Init();
+
+ public:
+
+  AliMevSimConfig();
+  AliMevSimConfig(Int_t modelType);
+
+  ~AliMevSimConfig();
+
+  void SetModelType(Int_t modelType);
+
+  void SetRectPlane(Int_t ctrl, Float_t psiRMean = 0, Float_t psiRStDev = 0);
+  void SetMultFac(Float_t mean, Float_t stDev);
+
+  void SetStDev(Float_t mult, Float_t temp, Float_t sigma,
+               Float_t expVel, Float_t psiR, Float_t Vn, Float_t multFac);
+
+  void SetGrid(Int_t integr, Int_t scan);
+
+
+  ClassDef(AliMevSimConfig,1)
+
+};
+
+
+#endif
diff --git a/EVGEN/AliMevSimParticle.cxx b/EVGEN/AliMevSimParticle.cxx
new file mode 100644 (file)
index 0000000..9597e32
--- /dev/null
@@ -0,0 +1,57 @@
+
+#include "AliMevSimParticle.h"
+
+
+ClassImp(AliMevSimParticle)
+
+   
+///////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimParticle::AliMevSimParticle()
+  : TMevSimPartTypeParams() {
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimParticle::AliMevSimParticle(PDG_t pdg, Int_t multmean, Int_t multvc, 
+                 Float_t tempmean, Float_t tempstdev, Float_t sigmamean,
+                 Float_t sigmastdev, Float_t expvelmean, Float_t expvelstdev)
+
+  : TMevSimPartTypeParams(0, multmean, multvc, tempmean, tempstdev, 
+                         sigmamean, sigmastdev, expvelmean, expvelstdev)  {
+
+
+  // Calculate geant ID from pdg
+  fConv = new TMevSimConverter();
+  fPdg = pdg;
+  if (fConv) fGPid = fConv->IdFromPDG(pdg);  
+
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+AliMevSimParticle::~AliMevSimParticle() {
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+void  AliMevSimParticle::SetPDG(PDG_t pdg) {
+
+  fPdg = pdg;
+  fGPid = fConv->IdFromPDG(pdg);
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+PDG_t AliMevSimParticle::GetPDG() {
+  
+  fPdg = (PDG_t)fConv->PDGFromId(fGPid);
+  return fPdg;
+}
+
+///////////////////////////////////////////////////////////////////////////////////////
+
+
+  
+
diff --git a/EVGEN/AliMevSimParticle.h b/EVGEN/AliMevSimParticle.h
new file mode 100644 (file)
index 0000000..852807d
--- /dev/null
@@ -0,0 +1,41 @@
+
+#ifndef ALIMEVSIMPARTICLE_H
+#define ALIMEVSIMPARTICLE_H
+
+#include "AliPDG.h"
+#include "TMevSimPartTypeParams.h"
+#include "TMevSimConverter.h"
+
+class AliMevSimParticle :public TMevSimPartTypeParams {
+
+ protected:
+  
+  PDG_t fPdg;
+  TMevSimConverter *fConv;
+
+ public:
+  
+  ///////////////////////////////////////////////////////////////////////////////////////
+  
+  AliMevSimParticle();
+  AliMevSimParticle(PDG_t pdg, Int_t multmean, Int_t multvc, 
+                   Float_t tempmean, Float_t tempstdev, Float_t sigmamean,
+                   Float_t sigmastdev, Float_t expvelmean, Float_t expvelstdev);
+  
+  virtual ~AliMevSimParticle();
+  
+  ///////////////////////////////////////////////////////////////////////////////////////
+  
+  virtual void        SetPDG(PDG_t pdg);
+  virtual PDG_t       GetPDG();
+  
+  ///////////////////////////////////////////////////////////////////////////////////////
+  
+  ClassDef(AliMevSimParticle,1)  
+    
+  ///////////////////////////////////////////////////////////////////////////////////////
+    
+};
+
+#endif
+