]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - FMD/AliFMDCalibFaker.cxx
Updated reconstruction to (optionally) make angle correction.
[u/mrichter/AliRoot.git] / FMD / AliFMDCalibFaker.cxx
index d7491c9e0327ec4dbc777cd399fe63969cdd5da1..604a10fcf712c0ebab2fc56fa7bdc838fb4cf2f8 100644 (file)
@@ -27,8 +27,9 @@
 // the bit mask passed to the constructor, or added by `AddCalib'.
 //
 // The default is to write all calibration parameters to a local
-// storage `local://cdb' which is a directory in the current
-// directory. 
+// storage `local://$ALICE_ROOT' which is were the sources live (sigh!
+// - why oh why do we need to shit where we eat - it's just not
+// healty).
 //                                                       
 #include "AliLog.h"               // ALILOG_H
 #include "AliFMDCalibFaker.h"      // ALIFMDCALIBFAKER_H
@@ -44,6 +45,7 @@
 // #include <TMath.h>
 #include <TROOT.h>
 #include <TRandom.h>
+#include <TF1.h>
 
 //====================================================================
 ClassImp(AliFMDCalibFaker)
@@ -88,7 +90,7 @@ AliFMDCalibFaker::Exec(Option_t*)
   // Make the objects. 
   AliCDBManager*     cdb      = AliCDBManager::Instance();
   AliFMDParameters*  param    = AliFMDParameters::Instance();
-  Float_t            maxADC   = param->GetAltroChannelSize();
+  Float_t            maxADC   = 1.F*param->GetAltroChannelSize();
   TObjArray          cleanup;
 
   if (GetTitle() && GetTitle()[0] != '\0') { 
@@ -99,8 +101,12 @@ AliFMDCalibFaker::Exec(Option_t*)
     
   AliCDBMetaData* meta = 0;
   if (TESTBIT(fMask, kPulseGain)) {
-    if (fGain <= 0) 
-      fGain      = (param->GetVA1MipRange() * param->GetEdepMip() / maxADC);
+    // Info("Exec","Default gain to %f = %d * %f / %d", 
+    //      (param->GetVA1MipRange() * param->GetEdepMip() / maxADC),
+    //      param->GetVA1MipRange(), param->GetEdepMip(), Int_t(maxADC));
+    if (fGain <= 0) {
+      fGain = (param->GetVA1MipRange() * param->GetEdepMip() / maxADC);
+    }
     fThreshold = fThresholdFactor * param->GetEdepMip();
     AliFMDCalibGain* gain = MakePulseGain();
     AliCDBId         id(AliFMDParameters::PulseGainPath(), fRunMin, fRunMax);
@@ -114,7 +120,7 @@ AliFMDCalibFaker::Exec(Option_t*)
     fPedestalMin = TMath::Max(TMath::Min(fPedestalMin, maxADC), 0.F);
     fPedestalMax = TMath::Max(TMath::Min(fPedestalMax, maxADC), fPedestalMin);
     AliFMDCalibPedestal* pedestal = MakePedestal();
-    AliCDBId             id(AliFMDParameters::PedestalPath(), fRunMin, fRunMax);
+    AliCDBId             id(AliFMDParameters::PedestalPath(),fRunMin,fRunMax);
     MAKE_META(meta);
     meta->SetProperty("key1", pedestal);
     cdb->Put(pedestal, id, meta);
@@ -145,7 +151,8 @@ AliFMDCalibFaker::Exec(Option_t*)
   if (TESTBIT(fMask, kSampleRate)) {
     fRate = TMath::Max(TMath::Min(fRate, UShort_t(8)), UShort_t(1));
     AliFMDCalibSampleRate* rate = MakeSampleRate();
-    AliCDBId               id(AliFMDParameters::SampleRatePath(),fRunMin,fRunMax);
+    AliCDBId               id(AliFMDParameters::SampleRatePath(),
+                             fRunMin,fRunMax);
     MAKE_META(meta);
     meta->SetProperty("key1", rate);
     cdb->Put(rate, id, meta);
@@ -155,7 +162,8 @@ AliFMDCalibFaker::Exec(Option_t*)
   if (TESTBIT(fMask, kStripRange)) {
     fRate = TMath::Max(TMath::Min(fRate, UShort_t(8)), UShort_t(1));
     AliFMDCalibStripRange* range = MakeStripRange();
-    AliCDBId               id(AliFMDParameters::StripRangePath(),fRunMin,fRunMax);
+    AliCDBId               id(AliFMDParameters::StripRangePath(),
+                             fRunMin,fRunMax);
     MAKE_META(meta);
     meta->SetProperty("key1", range);
     cdb->Put(range, id, meta);
@@ -200,22 +208,52 @@ AliFMDCalibFaker::MakePulseGain() const
   return gain;
 }
 
+//__________________________________________________________________
+Float_t 
+AliFMDCalibFaker::MakeNoise(Char_t ring, UShort_t str) const
+{
+  const UShort_t innerN    = 512;
+  const UShort_t outerN    = 256;
+  const UShort_t innerCut  = 350;
+  const UShort_t outerCut  = 190;
+  const Float_t  innerBase =   1.2;
+  const Float_t  outerBase =   2.1;
+  const Float_t  innerInc  =   0.5;
+  const Float_t  outerInc  =   0.8;
+  Float_t cut, base, inc, n;
+  switch (ring) {
+  case 'I': 
+    cut = innerCut; base = innerBase; inc = innerInc; n = innerN; break;
+  case 'O': 
+    cut = outerCut; base = outerBase; inc = outerInc; n = outerN; break;
+  default:
+    return -1;
+  }
+  Float_t bare = base + (str < cut ? 
+                        str / cut * inc : 
+                        inc  - (str - cut) / (n - cut) * inc);
+  return bare + gRandom->Uniform(-.07, .07);
+}
+  
 //__________________________________________________________________
 AliFMDCalibPedestal*
 AliFMDCalibFaker::MakePedestal() const
 {
   // Make the actual data
   AliFMDCalibPedestal*  pedestal  = new AliFMDCalibPedestal;
+  
   for (UShort_t det = 1; det <= 3; det++) {
-    Char_t rings[] = { 'I', (det == 1 ? '\0' : 'O'), '\0' };
+    Char_t rings[] = { 'I', 'O', '\0' };
     for (Char_t* ring = rings; *ring != '\0'; ring++) {
+      if (*ring == 'O' && det == 1) continue;
       UShort_t nSec = ( *ring == 'I' ? 20  :  40 );
       UShort_t nStr = ( *ring == 'I' ? 512 : 256 );
       for (UShort_t sec = 0; sec < nSec; sec++) {
         for (UShort_t str = 0; str < nStr; str++) {
-          pedestal->Set(det, *ring, sec, str,
-                       gRandom->Uniform(fPedestalMin, fPedestalMax), 1.5);
-        }
+         Float_t noise = MakeNoise(*ring, str);
+         Float_t ped   = gRandom->Uniform(fPedestalMin, fPedestalMax);
+          pedestal->Set(det, *ring, sec, str, ped, noise);
+       }
       }
     }
   }