]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsimTR.cxx
add jet shape analysis classes
[u/mrichter/AliRoot.git] / TRD / AliTRDsimTR.cxx
index b940f7b8f285599fff6bcbfd1a34e9ae02c2b817..24bea907edbde7db40ab4c08bfec807a3d147474 100644 (file)
 //                                                                        //
 ////////////////////////////////////////////////////////////////////////////
 
-#include <stdlib.h>
-
 #include <TH1.h>
 #include <TRandom.h>
 #include <TMath.h>
-#include <TParticle.h>
 #include <TVirtualMC.h>
 #include <TVirtualMCStack.h>
 
 #include "AliModule.h"
-#include "AliLog.h"
-#include "AliMC.h"
 
 #include "AliTRDsimTR.h"
 
@@ -170,32 +165,21 @@ AliTRDsimTR::AliTRDsimTR(const AliTRDsimTR &s)
   // AliTRDsimTR copy constructor
   //
 
-  if (((AliTRDsimTR &) s).fNFoils) {
-    delete [] ((AliTRDsimTR &) s).fNFoils;
-  }
-  ((AliTRDsimTR &) s).fNFoils   = new Int_t[fNFoilsDim];
+  fNFoils   = new Int_t[fNFoilsDim];
   for (Int_t iFoil = 0; iFoil < fNFoilsDim; iFoil++) {
-    ((AliTRDsimTR &) s).fNFoils[iFoil]   = fNFoils[iFoil];
+    fNFoils[iFoil]   = ((AliTRDsimTR &) s).fNFoils[iFoil];
   }  
 
-  if (((AliTRDsimTR &) s).fNFoilsUp) {
-    delete [] ((AliTRDsimTR &) s).fNFoilsUp;
-  }
-  ((AliTRDsimTR &) s).fNFoilsUp = new Double_t[fNFoilsDim];
+  fNFoilsUp = new Double_t[fNFoilsDim];
   for (Int_t iFoil = 0; iFoil < fNFoilsDim; iFoil++) {
-    ((AliTRDsimTR &) s).fNFoilsUp[iFoil] = fNFoilsUp[iFoil];
+    fNFoilsUp[iFoil] = ((AliTRDsimTR &) s).fNFoilsUp[iFoil];
   }  
 
-  if (((AliTRDsimTR &) s).fSigma) {
-    delete [] ((AliTRDsimTR &) s).fSigma;
-  }
-  ((AliTRDsimTR &) s).fSigma    = new Double_t[fSpNBins];
+  fSigma    = new Double_t[fSpNBins];
   for (Int_t iBin = 0; iBin < fSpNBins; iBin++) {
-    ((AliTRDsimTR &) s).fSigma[iBin]     = fSigma[iBin];
+    fSigma[iBin]     = ((AliTRDsimTR &) s).fSigma[iBin];
   }  
 
-  fSpectrum->Copy(*((AliTRDsimTR &) s).fSpectrum);
-
 }
 
 //_____________________________________________________________________________
@@ -235,6 +219,7 @@ AliTRDsimTR &AliTRDsimTR::operator=(const AliTRDsimTR &s)
   //
 
   if (this != &s) ((AliTRDsimTR &) s).Copy(*this);
+  this->Init();
 
   return *this;
 
@@ -288,8 +273,6 @@ void AliTRDsimTR::Copy(TObject &s) const
     ((AliTRDsimTR &) s).fSigma[iBin]     = fSigma[iBin];
   }  
 
-  fSpectrum->Copy(*((AliTRDsimTR &) s).fSpectrum);
-
 }
 
 //_____________________________________________________________________________
@@ -445,7 +428,7 @@ Int_t AliTRDsimTR::TrPhotons(Float_t p, Float_t mass
     energykeV = fSpectrum->GetBinCenter(iBin);
     energyeV  = energykeV * 1.0e3;
 
-    sigma    = Sigma(energykeV);
+    sigma     = Sigma(energykeV);
 
     csi1      = fFoilOmega / energyeV;
     csi2      = fGapOmega  / energyeV;
@@ -480,10 +463,10 @@ Int_t AliTRDsimTR::TrPhotons(Float_t p, Float_t mass
   Int_t   nPhCand = gRandom->Poisson(nTr);
   
   // Link the MC stack and get info about parent electron
-  TVirtualMCStack *stack = gMC->GetStack();
+  TVirtualMCStack *stack = TVirtualMC::GetMC()->GetStack();
   Int_t    track = stack->GetCurrentTrackNumber();
   Double_t px, py, pz, ptot;
-  gMC->TrackMomentum(px,py,pz,ptot);
+  TVirtualMC::GetMC()->TrackMomentum(px,py,pz,ptot);
   ptot = TMath::Sqrt(px*px+py*py+pz*pz);
   px /= ptot;
   py /= ptot;
@@ -493,8 +476,8 @@ Int_t AliTRDsimTR::TrPhotons(Float_t p, Float_t mass
   Double_t x;
   Double_t y;
   Double_t z; 
-  gMC->TrackPosition(x,y,z);
-  Double_t t = gMC->TrackTime();  
+  TVirtualMC::GetMC()->TrackPosition(x,y,z);
+  Double_t t = TVirtualMC::GetMC()->TrackTime();  
 
   // Counter for TR analysed in custom code (e < 15keV)
   nPhoton = 0;  
@@ -698,44 +681,46 @@ Double_t AliTRDsimTR::GetMuXe(Double_t energyMeV)
                     , 5.00000E+00, 6.00000E+00, 8.00000E+00
                    , 1.00000E+01, 1.50000E+01, 2.00000E+01 };
 
 return Interpolate(energyMeV,en,mu,kN);
+ return Interpolate(energyMeV,en,mu,kN);
 
 }
 
 //_____________________________________________________________________________
-Double_t AliTRDsimTR::GetMuBu(Double_t energyMeV)
+Double_t AliTRDsimTR::GetMuAr(Double_t energyMeV)
 {
   //
-  // Returns the photon absorbtion cross section for isobutane
+  // Returns the photon absorbtion cross section for argon
   //
 
-  const Int_t kN = 36;
-
-  Double_t mu[kN] = { 0.38846E+03, 0.12291E+03, 0.53225E+02
-                    , 0.16091E+02, 0.69114E+01, 0.36541E+01
-                    , 0.22282E+01, 0.11149E+01, 0.72887E+00
-                    , 0.45053E+00, 0.38167E+00, 0.33920E+00
-                    , 0.32155E+00, 0.30949E+00, 0.29960E+00
-                    , 0.28317E+00, 0.26937E+00, 0.24228E+00
-                    , 0.22190E+00, 0.19289E+00, 0.17288E+00
-                    , 0.15789E+00, 0.14602E+00, 0.12829E+00
-                    , 0.11533E+00, 0.10310E+00, 0.93790E-01
-                    , 0.80117E-01, 0.63330E-01, 0.53229E-01
-                    , 0.46390E-01, 0.41425E-01, 0.34668E-01
-                   , 0.30267E-01, 0.23910E-01, 0.20509E-01 };
+  const Int_t kN = 38;
 
-  Double_t en[kN] = { 0.10000E-02, 0.15000E-02, 0.20000E-02
-                    , 0.30000E-02, 0.40000E-02, 0.50000E-02
-                    , 0.60000E-02, 0.80000E-02, 0.10000E-01
-                    , 0.15000E-01, 0.20000E-01, 0.30000E-01
-                    , 0.40000E-01, 0.50000E-01, 0.60000E-01
-                    , 0.80000E-01, 0.10000E+00, 0.15000E+00
-                    , 0.20000E+00, 0.30000E+00, 0.40000E+00
-                    , 0.50000E+00, 0.60000E+00, 0.80000E+00
-                    , 0.10000E+01, 0.12500E+01, 0.15000E+01
-                    , 0.20000E+01, 0.30000E+01, 0.40000E+01
-                    , 0.50000E+01, 0.60000E+01, 0.80000E+01
-                   , 0.10000E+02, 0.15000E+02, 0.20000E+02 };
+  Double_t mu[kN] = { 3.184E+03, 1.105E+03, 5.120E+02
+                    , 1.703E+02, 1.424E+02, 1.275E+03
+                    , 7.572E+02, 4.225E+02, 2.593E+02
+                    , 1.180E+02, 6.316E+01, 1.983E+01
+                    , 8.629E+00, 2.697E+00, 1.228E+00
+                    , 7.012E-01, 4.664E-01, 2.760E-01
+                    , 2.043E-01, 1.427E-01, 1.205E-01
+                    , 9.953E-02, 8.776E-02, 7.958E-02
+                    , 7.335E-02, 6.419E-02, 5.762E-02
+                    , 5.150E-02, 4.695E-02, 4.074E-02
+                    , 3.384E-02, 3.019E-02, 2.802E-02
+                    , 2.667E-02, 2.517E-02, 2.451E-02
+                    , 2.418E-02, 2.453E-02 };
+
+  Double_t en[kN] = { 1.00000E-03, 1.50000E-03, 2.00000E-03  
+                    , 3.00000E-03, 3.20290E-03, 3.20290E-03  
+                    , 4.00000E-03, 5.00000E-03, 6.00000E-03  
+                    , 8.00000E-03, 1.00000E-02, 1.50000E-02  
+                    , 2.00000E-02, 3.00000E-02, 4.00000E-02  
+                    , 5.00000E-02, 6.00000E-02, 8.00000E-02  
+                    , 1.00000E-01, 1.50000E-01, 2.00000E-01  
+                    , 3.00000E-01, 4.00000E-01, 5.00000E-01  
+                    , 6.00000E-01, 8.00000E-01, 1.00000E+00  
+                    , 1.25000E+00, 1.50000E+00, 2.00000E+00  
+                    , 3.00000E+00, 4.00000E+00, 5.00000E+00  
+                    , 6.00000E+00, 8.00000E+00, 1.00000E+01  
+                   , 1.50000E+01, 2.00000E+01 };
 
   return Interpolate(energyMeV,en,mu,kN);
 
@@ -943,7 +928,9 @@ Double_t AliTRDsimTR::GetMuAi(Double_t energyMeV)
 
 //_____________________________________________________________________________
 Double_t AliTRDsimTR::Interpolate(Double_t energyMeV
-                              , Double_t *en, Double_t *mu, Int_t n)
+                                , Double_t *en
+                                , const Double_t * const mu
+                                , Int_t n)
 {
   //
   // Interpolates the photon absorbtion cross section 
@@ -965,7 +952,7 @@ Double_t AliTRDsimTR::Interpolate(Double_t energyMeV
 
 //_____________________________________________________________________________
 Int_t AliTRDsimTR::Locate(Double_t *xv, Int_t n, Double_t xval
-                      , Int_t &kl, Double_t &dx) 
+                        , Int_t &kl, Double_t &dx) 
 {
   //
   // Locates a point (xval) in a 1-dim grid (xv(n))