AliGenThetaSlice, first commit. (Jiri Chudoba)
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Mar 2002 10:56:06 +0000 (10:56 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 11 Mar 2002 10:56:06 +0000 (10:56 +0000)
EVGEN/AliGenThetaSlice.cxx [new file with mode: 0644]
EVGEN/AliGenThetaSlice.h [new file with mode: 0644]
EVGEN/EVGENLinkDef.h
EVGEN/Makefile
EVGEN/libEVGEN.pkg

diff --git a/EVGEN/AliGenThetaSlice.cxx b/EVGEN/AliGenThetaSlice.cxx
new file mode 100644 (file)
index 0000000..13819b2
--- /dev/null
@@ -0,0 +1,130 @@
+/**************************************************************************
+ * 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$
+*/
+////////////////////////////////////////////////////////////////////////
+//
+// generates n particles with in the same phi angle, varies theta
+// in equidistant intervals
+// This class is intended to use for studies of TPC response
+// via merging with background event.
+// 
+// Note that for a given theta pt and p are not independent 
+// Range for only one variable (pt or p) should be given.
+// Based on the AliGenBox class written by andreas.morsch@cern.ch
+//
+// Comments and suggestions: Jiri.Chudoba@cern.ch
+//
+////////////////////////////////////////////////////////////////////////
+
+#include "AliGenThetaSlice.h"
+#include "AliRun.h"
+#include "AliConst.h"
+#include "AliPDG.h"
+
+ClassImp(AliGenThetaSlice)
+
+//_____________________________________________________________________________
+AliGenThetaSlice::AliGenThetaSlice()
+    :AliGenerator()
+{
+  //
+  // Default constructor
+  //
+  fIpart=0;
+}
+
+//_____________________________________________________________________________
+AliGenThetaSlice::AliGenThetaSlice(Int_t npart)
+  :AliGenerator(npart)
+{
+  //
+  // Standard constructor
+  //
+  fName  = "ThetaSlice";
+  fTitle = "Particle generator - const. phi, slices in theta";
+  // Generate Proton by default
+  fIpart=kProton;
+}
+
+//_____________________________________________________________________________
+
+void AliGenThetaSlice::Generate()
+{
+  //
+  // Generate one trigger
+  //
+  
+    Float_t polar[3]= {0,0,0};
+    Float_t origin[3];
+    Float_t p[3];
+    Int_t i, j, nt;
+    Double_t pmom, theta, phi, pt;
+    Float_t random[6];
+
+    if (fNpart == 0) return;
+
+    for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    if(fVertexSmear==kPerEvent) {
+       Rndm(random,6);
+       for (j=0;j<3;j++) {
+           origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+       }
+    }
+    Float_t thetaInterval = 0.;
+    if (fNpart > 1) {
+      thetaInterval = (fThetaMax-fThetaMin)/(fNpart-1);
+    }
+    Rndm(random,1);
+    phi=fPhiMin+random[0]*(fPhiMax-fPhiMin);
+    for(i=0;i<fNpart;i++) {
+       Rndm(random,1);
+       theta=fThetaMin+i*thetaInterval;
+       if(TestBit(kMomentumRange)) {
+           pmom=fPMin+random[0]*(fPMax-fPMin);
+           pt=pmom*TMath::Sin(theta);
+       } else {
+           pt=fPtMin+random[0]*(fPtMax-fPtMin);
+           pmom=pt/TMath::Sin(theta);
+       }
+       p[0] = pt*TMath::Cos(phi);
+       p[1] = pt*TMath::Sin(phi);
+       p[2] = pmom*TMath::Cos(theta);
+
+       if(fVertexSmear==kPerTrack) {
+           Rndm(random,6);
+           for (j=0;j<3;j++) {
+               origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
+                   TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
+           }
+       }
+       SetTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+    }
+}
+
+//_____________________________________________________________________________
+
+void AliGenThetaSlice::Init()
+{
+// Initialisation, check consistency of selected ranges
+  if(TestBit(kPtRange)&&TestBit(kMomentumRange)) 
+    Fatal("Init","You should not set the momentum range and the pt range!\n");
+  if((!TestBit(kPtRange))&&(!TestBit(kMomentumRange))) 
+    Fatal("Init","You should set either the momentum or the pt range!\n");
+}
+
diff --git a/EVGEN/AliGenThetaSlice.h b/EVGEN/AliGenThetaSlice.h
new file mode 100644 (file)
index 0000000..1759fb4
--- /dev/null
@@ -0,0 +1,32 @@
+#ifndef ALIGENTHETASLICE_H
+#define ALIGENTHETASLICE_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+/*
+ generates n particles with in the same phi angle, varies theta
+ in equidistant intervals
+ Comments and suggestions: Jiri.Chudoba@cern.ch
+*/
+
+#include "AliGenerator.h"
+class AliGenThetaSlice : public AliGenerator
+{
+ public:
+
+  AliGenThetaSlice();
+  AliGenThetaSlice(Int_t npart);
+  virtual ~AliGenThetaSlice() {}
+  virtual void Generate();
+  virtual void Init();
+  virtual void SetPart(Int_t part) {fIpart=part;}
+protected:
+
+  Int_t fIpart; // Particle type
+
+  ClassDef(AliGenThetaSlice,1) // theta slices phi constant random generator
+};
+
+#endif
index 801ab043b921956c08c3643a0f7c125017753768..7e9e6a45a61b87b6bff87d9cca430d0f1589145a 100644 (file)
@@ -52,6 +52,7 @@
 #pragma link C++ class  AliGenReaderEcalJets++;
 #pragma link C++ class  AliGenGeVSim+;
 #pragma link C++ class  AliGeVSimParticle+;
+#pragma link C++ class  AliGenThetaSlice+; 
 #endif
 
 
index 9208f39538b806949acf41780fdc9dc6acef3e25..c051f72ea8f8b6b279539aca167f150953d0f315 100644 (file)
@@ -27,7 +27,7 @@ SRCS          = AliGenHIJINGpara.cxx AliGenHIJINGparaBa.cxx \
                 AliGenHBTprocessor.cxx \
                AliGenReader.cxx AliGenReaderCwn.cxx AliGenReaderTreeK.cxx \
                AliGenReaderEcalHijing.cxx AliGenReaderEcalJets.cxx \
-       AliGeVSimParticle.cxx AliGenGeVSim.cxx
+               AliGeVSimParticle.cxx AliGenGeVSim.cxx AliGenThetaSlice.cxx
 
 # C++ Headers
 
index b11507a3c57b58e4e5801657e0cb140c2e0fc900..abcc279cec8a221cd0f35d569490d1fdbbbc2e5f 100644 (file)
@@ -16,7 +16,7 @@ SRCS          = AliGenHIJINGpara.cxx AliGenHIJINGparaBa.cxx \
                 AliGenHBTprocessor.cxx \
                 AliGenReader.cxx AliGenReaderCwn.cxx AliGenReaderTreeK.cxx \
                 AliGenReaderEcalHijing.cxx AliGenReaderEcalJets.cxx \
-                AliGeVSimParticle.cxx AliGenGeVSim.cxx
+                AliGeVSimParticle.cxx AliGenGeVSim.cxx AliGenThetaSlice.cxx
 
 # Headerfiles for this particular package (Path respect to own directory)
 HDRS= $(SRCS:.cxx=.h)