]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - VZERO/AliVZEROCalibData.cxx
Few updates (Jochen) and inclusion of on-line PID Simulation (Uwe)
[u/mrichter/AliRoot.git] / VZERO / AliVZEROCalibData.cxx
index d1246825375752d84817f4378ca67eae4ed5c432..5499a419ac99fdee423d3847efe51f5d78afd18f 100644 (file)
@@ -50,7 +50,6 @@ AliVZEROCalibData::AliVZEROCalibData()
         fSigma[t]       = 0.0;        
         fADCmean[t]     = 0.0;      
         fADCsigma[t]    = 0.0;
-        fGain[t]        = 1.0;
     }
     for(int i=0; i<kNCIUBoards ;i++) {
        fTimeResolution[i]  = 25./256.;     // Default time resolution
@@ -90,7 +89,6 @@ AliVZEROCalibData::AliVZEROCalibData(const char* name)
        fSigma[t]       = 0.0;        
        fADCmean[t]     = 0.0;      
        fADCsigma[t]    = 0.0;
-       fGain[t]        = 1.0;
    }
    for(int i=0; i<kNCIUBoards ;i++) {
        fTimeResolution[i]  = 25./256.;    // Default time resolution in ns / channel
@@ -116,8 +114,7 @@ AliVZEROCalibData::AliVZEROCalibData(const AliVZEROCalibData& calibda) :
       fPedestal[t] = calibda.GetPedestal(t);
       fSigma[t]    = calibda.GetSigma(t);
       fADCmean[t]  = calibda.GetADCmean(t);
-      fADCsigma[t] = calibda.GetADCsigma(t);
-      fGain[t]     = calibda.GetGain(t); }
+      fADCsigma[t] = calibda.GetADCsigma(t); }
       
   for(int t=0; t<64; t++) { 
       fMeanHV[t]       = calibda.GetMeanHV(t);
@@ -151,8 +148,7 @@ AliVZEROCalibData &AliVZEROCalibData::operator =(const AliVZEROCalibData& calibd
       fPedestal[t] = calibda.GetPedestal(t);
       fSigma[t]    = calibda.GetSigma(t);
       fADCmean[t]  = calibda.GetADCmean(t);
-      fADCsigma[t] = calibda.GetADCsigma(t);
-      fGain[t]     = calibda.GetGain(t); }
+      fADCsigma[t] = calibda.GetADCsigma(t); }
       
   for(int t=0; t<64; t++) {
       fMeanHV[t]       = calibda.GetMeanHV(t);
@@ -224,8 +220,8 @@ void AliVZEROCalibData::SetParameter(TString name, Int_t val){
        else if(name.Contains("SearchWindow")) SetSearchWindow((UInt_t) val,iBoard);
        else if(name.Contains("TriggerCountOffset")) SetTriggerCountOffset((UInt_t) val,iBoard);
        else if(name.Contains("RollOver")) SetRollOver((UInt_t) val,iBoard);
-       else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,8*iBoard+(iChannel-1));
-       else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-2040.)/112.,8*iBoard+(iChannel-1));
+       else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,iBoard,(iChannel-1));
+       else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-2040.)/112.,iBoard,(iChannel-1));
        else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
 }
 
@@ -279,21 +275,15 @@ void AliVZEROCalibData::SetDeadMap(const Bool_t* deadMap)
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetGain(const Float_t* Gain) 
+void AliVZEROCalibData::SetTimeOffset(Float_t val, Int_t board, Int_t channel)
 {
-  if(Gain) for(int t=0; t<128; t++) fGain[t] = Gain[t];
-  else for(int t=0; t<128; t++) fGain[t] = 0.0;
-}
-
-//________________________________________________________________
-void AliVZEROCalibData::SetTimeOffset(Float_t val, Int_t channel)
-{
-  if((channel>=0) && (channel<64)){
-    fTimeOffset[channel]=val;
-    AliInfo(Form("Time offset for channel %d set to %f",channel,fTimeOffset[channel]));
+  Int_t ch = AliVZEROCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch >= 0){
+    fTimeOffset[ch]=val;
+    AliInfo(Form("Time offset for channel %d set to %f",ch,fTimeOffset[ch]));
   }
   else
-    AliError(Form("Channel %d is not valid",channel));
+    AliError("Board/Channel numbers are not valid");
 }
 
 //________________________________________________________________
@@ -343,6 +333,37 @@ Float_t AliVZEROCalibData::GetMIPperADC(Int_t channel) const {
        return mip; 
        
 }
+
+//________________________________________________________________
+Float_t AliVZEROCalibData::GetGain(Int_t channel) const
+{
+  // Computes the PM gain factors
+  // Argument passed is the PM number (aliroot numbering)
+  Float_t a[64] = {-39.68,-35.83,-36.92,-36.42,-37.02,-37.50,-43.05,-39.39,
+                  -36.62,-36.93,-37.30,-36.46,-39.51,-40.32,-39.92,-39.20,
+                  -35.39,-37.95,-38.85,-42.76,-40.68,-40.32,-39.00,-37.36,
+                  -39.64,-38.86,-37.59,-39.59,-37.97,-36.32,-38.88,-41.35,
+                  -36.01,-36.82,-39.48,-36.86,-38.22,-32.55,-39.44,-35.08,
+                  -29.91,-37.88,-33.25,-36.49,-37.25,-35.89,-40.31,-39.15,
+                  -41.71,-37.07,-38.94,-36.04,-36.62,-32.96,-36.99,-30.71,
+                  -36.66,-37.23,-35.98,-36.56,-35.64,-36.97,-35.88,-38.78};
+  Float_t b[64] = {  7.40,  6.83,  7.02,  6.94,  7.03,  7.04,  7.79,  7.27,
+                    6.92,  6.96,  7.01,  6.90,  7.28,  7.38,  7.33,  7.23,
+                    6.71,  7.05,  7.17,  7.69,  7.41,  7.38,  7.21,  7.11,
+                    7.26,  7.12,  6.98,  7.35,  6.99,  6.79,  7.13,  7.58,
+                    6.95,  7.01,  7.33,  7.01,  7.21,  6.01,  7.34,  6.44,
+                    5.68,  7.12,  6.07,  6.92,  7.04,  6.82,  7.04,  7.24,
+                    7.53,  6.99,  7.10,  6.89,  7.07,  6.35,  6.88,  5.77,
+                    6.81,  7.01,  6.89,  6.84,  6.68,  6.95,  6.73,  7.14};
+
+  // High Voltage retrieval from Calibration Data Base:  
+  Float_t hv = fMeanHV[channel];
+  Float_t gain = 0;
+  if (hv>0)
+    gain = TMath::Exp(a[channel]+b[channel]*TMath::Log(hv));
+  return gain;
+}
+
 //________________________________________________________________
 void AliVZEROCalibData::SetTimeResolution(UShort_t *resols){
        // Set Time Resolution of the TDC
@@ -534,21 +555,22 @@ void AliVZEROCalibData::SetRollOver(UInt_t offset, Int_t board)
 }
 
 //________________________________________________________________
-void AliVZEROCalibData::SetDiscriThr(Float_t thr, Int_t channel)
+void AliVZEROCalibData::SetDiscriThr(Float_t thr, Int_t board, Int_t channel)
 {
   // Set the TDC discriminator
   // threshold values expressed in units of ADC
-  if((channel>=0) && (channel<64)){
+  Int_t ch = AliVZEROCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch >= 0){
     if (thr > 0) {
-      fDiscriThr[channel]=thr;
-      AliInfo(Form("Discriminator threshold for channel %d set to %f",channel,fDiscriThr[channel]));
+      fDiscriThr[ch]=thr;
+      AliInfo(Form("Discriminator threshold for channel %d set to %f",ch,fDiscriThr[ch]));
     }
     else {
-      AliWarning(Form("Ignore wrong threshold value (%f) for channel %d !",thr,channel));
+      AliWarning(Form("Ignore wrong threshold value (%f) for channel %d !",thr,ch));
     }
   }
   else
-    AliError(Form("Channel %d is not valid",channel));
+    AliError("Board/Channel numbers are not valid");
 }
 
 //________________________________________________________________
@@ -559,3 +581,34 @@ void AliVZEROCalibData::SetDiscriThr(const Float_t* thresholds)
   if(thresholds) for(int t=0; t<64; t++) fDiscriThr[t] = thresholds[t];
   else for(int t=0; t<64; t++) fDiscriThr[t] = 2.5;
 }
+
+Int_t AliVZEROCalibData::GetOfflineChannelNumber(Int_t board, Int_t channel)
+{
+  // Get the offline channel number from
+  // the FEE board and channel indexes
+
+  if (board < 0 || board >= 8) {
+    AliErrorClass(Form("Wrong FEE board number: %d",board));
+    return -1;
+  }
+  if (channel < 0 || channel >= 8) {
+    AliErrorClass(Form("Wrong FEE channel number: %d",channel));
+    return -1;
+  }
+
+  Int_t offCh = (board < 4) ? (8 * board + 32) : (8 * board -32);
+  offCh += (7 - channel);
+
+  return offCh;
+}
+
+Int_t AliVZEROCalibData::GetBoardNumber(Int_t channel)
+{
+  // Get FEE board number
+  // from offline channel index
+  if (channel >= 0 && channel < 32) return (channel / 8 + 4);
+  if (channel >=32 && channel < 64) return (channel / 8 - 4);
+
+  AliErrorClass(Form("Wrong channel index: %d",channel));
+  return -1;
+}