]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDSimParam.cxx
Add a protection againts runs with missing DCS information in the OCDB
[u/mrichter/AliRoot.git] / TRD / AliTRDSimParam.cxx
index f8614987891dd0d0eb31a0d5bf4c46750692133c..f19617bdac8105a4062769aa5ced5a4196d2fca1 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "AliTRDSimParam.h"
 #include "AliTRDCommonParam.h"
+#include "AliLog.h"
 
 ClassImp(AliTRDSimParam)
 
@@ -99,6 +100,8 @@ AliTRDSimParam::AliTRDSimParam()
   ,fTimeCoupling(0.0)
   ,fTimeStructOn(kFALSE)
   ,fPRFOn(kFALSE)
+  ,fNTimeBins(0)
+  ,fNTBoverwriteOCDB(kFALSE)
 {
   //
   // Default constructor
@@ -121,9 +124,7 @@ void AliTRDSimParam::Init()
   fNoise             = 1250.0;
   fADCoutRange       = 1023.0;          // 10-bit ADC
   fADCinRange        = 2000.0;          // 2V input range
-  // Go back to 0 again, just to be consistent with reconstruction
-  fADCbaseline       =      0;
-  //fADCbaseline       =   10;
+  fADCbaseline       =   10;
 
   // Diffusion on
   fDiffusionOn       = kTRUE;
@@ -152,6 +153,10 @@ void AliTRDSimParam::Init()
   // The pad response function
   fPRFOn             = kTRUE;
 
+  // The number of time bins
+  fNTimeBins         = 24;
+  fNTBoverwriteOCDB  = kFALSE;
+
   ReInit();
 
 }
@@ -199,6 +204,8 @@ AliTRDSimParam::AliTRDSimParam(const AliTRDSimParam &p)
   ,fTimeCoupling(p.fTimeCoupling)
   ,fTimeStructOn(p.fTimeStructOn)
   ,fPRFOn(p.fPRFOn)
+  ,fNTimeBins(p.fNTimeBins)
+  ,fNTBoverwriteOCDB(p.fNTBoverwriteOCDB)
 {
   //
   // Copy constructor
@@ -206,20 +213,14 @@ AliTRDSimParam::AliTRDSimParam(const AliTRDSimParam &p)
 
   Int_t iBin = 0;
 
-  if (((AliTRDSimParam &) p).fTRFsmp) {
-    delete [] ((AliTRDSimParam &) p).fTRFsmp;
-  }
-  ((AliTRDSimParam &) p).fTRFsmp = new Float_t[fTRFbin];
+  fTRFsmp = new Float_t[fTRFbin];
   for (iBin = 0; iBin < fTRFbin; iBin++) {
-    ((AliTRDSimParam &) p).fTRFsmp[iBin] = fTRFsmp[iBin];
+    fTRFsmp[iBin] = ((AliTRDSimParam &) p).fTRFsmp[iBin];
   }                                                                             
 
-  if (((AliTRDSimParam &) p).fCTsmp) {
-    delete [] ((AliTRDSimParam &) p).fCTsmp;
-  }
-  ((AliTRDSimParam &) p).fCTsmp  = new Float_t[fTRFbin];
+  fCTsmp  = new Float_t[fTRFbin];
   for (iBin = 0; iBin < fTRFbin; iBin++) {
-    ((AliTRDSimParam &) p).fCTsmp[iBin] = fCTsmp[iBin];
+    fCTsmp[iBin]  = ((AliTRDSimParam &) p).fCTsmp[iBin];
   }                                                                             
 
 }
@@ -231,9 +232,53 @@ AliTRDSimParam &AliTRDSimParam::operator=(const AliTRDSimParam &p)
   // Assignment operator
   //
 
-  if (this != &p) {
-    ((AliTRDSimParam &) p).Copy(*this);
+  if (this == &p) {
+    return *this;
+  }
+
+  Init();
+
+  fGasGain          = p.fGasGain;
+  fNoise            = p.fNoise;
+  fChipGain         = p.fChipGain;
+  fADCoutRange      = p.fADCoutRange;
+  fADCinRange       = p.fADCinRange;
+  fADCbaseline      = p.fADCbaseline;
+  fDiffusionOn      = p.fDiffusionOn;
+  fElAttachOn       = p.fElAttachOn;
+  fElAttachProp     = p.fElAttachProp;
+  fTRFOn            = p.fTRFOn;
+  fTRFsmp           = 0;
+  fTRFbin           = p.fTRFbin;
+  fTRFlo            = p.fTRFlo;
+  fTRFhi            = p.fTRFhi;
+  fTRFwid           = p.fTRFwid;
+  fCTOn             = p.fCTOn;
+  fCTsmp            = 0;
+  fPadCoupling      = p.fPadCoupling;
+  fTimeCoupling     = p.fTimeCoupling;
+  fTimeStructOn     = p.fTimeStructOn;
+  fPRFOn            = p.fPRFOn;
+  fNTimeBins        = p.fNTimeBins;
+  fNTBoverwriteOCDB = p.fNTBoverwriteOCDB;
+
+  Int_t iBin = 0;
+
+  if (fTRFsmp) {
+    delete[] fTRFsmp;
   }
+  fTRFsmp = new Float_t[fTRFbin];
+  for (iBin = 0; iBin < fTRFbin; iBin++) {
+    fTRFsmp[iBin] = ((AliTRDSimParam &) p).fTRFsmp[iBin];
+  }                                                                             
+
+  if (fCTsmp) {
+    delete[] fCTsmp;
+  }
+  fCTsmp  = new Float_t[fTRFbin];
+  for (iBin = 0; iBin < fTRFbin; iBin++) {
+    fCTsmp[iBin]  = ((AliTRDSimParam &) p).fCTsmp[iBin];
+  }                                                                             
 
   return *this;
 
@@ -269,6 +314,8 @@ void AliTRDSimParam::Copy(TObject &p) const
   target->fPadCoupling        = fPadCoupling;
   target->fTimeCoupling       = fTimeCoupling;
   target->fPRFOn              = fPRFOn;
+  target->fNTimeBins          = fNTimeBins;
+  target->fNTBoverwriteOCDB   = fNTBoverwriteOCDB;
 
   if (target->fTRFsmp) {
     delete[] target->fTRFsmp;