]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDsimTR.cxx
A new (kIBModel4) revised version of the Inner Barrel from Mario
[u/mrichter/AliRoot.git] / TRD / AliTRDsimTR.cxx
index f34dacaec9540f12979c6b7b82d763b867f656c8..24bea907edbde7db40ab4c08bfec807a3d147474 100644 (file)
@@ -165,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);
-
 }
 
 //_____________________________________________________________________________
@@ -230,6 +219,7 @@ AliTRDsimTR &AliTRDsimTR::operator=(const AliTRDsimTR &s)
   //
 
   if (this != &s) ((AliTRDsimTR &) s).Copy(*this);
+  this->Init();
 
   return *this;
 
@@ -283,8 +273,6 @@ void AliTRDsimTR::Copy(TObject &s) const
     ((AliTRDsimTR &) s).fSigma[iBin]     = fSigma[iBin];
   }  
 
-  fSpectrum->Copy(*((AliTRDsimTR &) s).fSpectrum);
-
 }
 
 //_____________________________________________________________________________
@@ -475,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;
@@ -488,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;