]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
More FEE parameters in calibration object
authormbroz <Michal.Broz@cern.ch>
Thu, 8 Jan 2015 15:24:04 +0000 (16:24 +0100)
committermbroz <Michal.Broz@cern.ch>
Thu, 8 Jan 2015 15:24:04 +0000 (16:24 +0100)
AD/ADbase/AliADCalibData.cxx
AD/ADbase/AliADCalibData.h

index 2eced28feca149bb807bfbd25acc62cf10efea28..a77d2ba81af0b270d9482fe8c260dec22cb7365f 100644 (file)
@@ -36,7 +36,17 @@ ClassImp(AliADCalibData)
 AliADCalibData::AliADCalibData():
   fLightYields(NULL),
   fPMGainsA(NULL),
-  fPMGainsB(NULL)
+  fPMGainsB(NULL),
+  fBBAThreshold(0),
+  fBBCThreshold(0) ,  
+  fBGAThreshold(0) ,  
+  fBGCThreshold(0) ,  
+  fBBAForBGThreshold(0) ,  
+  fBBCForBGThreshold(0) ,   
+  fMultV0AThrLow(0) ,  
+  fMultV0AThrHigh(0) , 
+  fMultV0CThrLow(0) ,  
+  fMultV0CThrHigh(0)
 {
   // default constructor
   
@@ -62,6 +72,21 @@ AliADCalibData::AliADCalibData():
        fTriggerCountOffset[i] = 3247;
        fRollOver[i] = 3563;
     }
+    for(int i=0; i<kNCIUBoards ;i++) {
+       fClk1Win1[i] = fClk1Win2[i] = 0;
+       fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+       fClk2Win1[i] = fClk2Win2[i] = 0;
+       fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+       fLatchWin1[i] = fLatchWin2[i] = 0;
+       fResetWin1[i] = fResetWin2[i] = 0;
+       fPedestalSubtraction[i] = kFALSE;
+       }
+    for(Int_t j = 0; j < 16; ++j) {
+       fEnableCharge[j] = fEnableTiming[j] = kFALSE;
+       fPedestalOdd[j] = fPedestalEven[j] = 0;
+       fPedestalCutOdd[j] = fPedestalCutEven[j] = 0;
+       }
+    for(Int_t i = 0; i < 5; ++i) fTriggerSelected[i] = 0;
 
 }
 //________________________________________________________________
@@ -74,7 +99,17 @@ void AliADCalibData::Reset()
 AliADCalibData::AliADCalibData(const char* name) :
   fLightYields(NULL),
   fPMGainsA(NULL),
-  fPMGainsB(NULL)
+  fPMGainsB(NULL),
+  fBBAThreshold(0),
+  fBBCThreshold(0) ,  
+  fBGAThreshold(0) ,  
+  fBGCThreshold(0) ,  
+  fBBAForBGThreshold(0) ,  
+  fBBCForBGThreshold(0) ,   
+  fMultV0AThrLow(0) ,  
+  fMultV0AThrHigh(0) , 
+  fMultV0CThrLow(0) ,  
+  fMultV0CThrHigh(0)
 {
   // Constructor
    TString namst = "Calib_";
@@ -103,6 +138,21 @@ AliADCalibData::AliADCalibData(const char* name) :
        fTriggerCountOffset[i] = 3247;
        fRollOver[i] = 3563;
    }
+    for(int i=0; i<kNCIUBoards ;i++) {
+       fClk1Win1[i] = fClk1Win2[i] = 0;
+       fDelayClk1Win1[i] = fDelayClk1Win2[i] = 0;
+       fClk2Win1[i] = fClk2Win2[i] = 0;
+       fDelayClk2Win1[i] = fDelayClk2Win2[i] = 0;
+       fLatchWin1[i] = fLatchWin2[i] = 0;
+       fResetWin1[i] = fResetWin2[i] = 0;
+       fPedestalSubtraction[i] = kFALSE;
+       }
+    for(Int_t j = 0; j < 16; ++j) {
+       fEnableCharge[j] = fEnableTiming[j] = kFALSE;
+       fPedestalOdd[j] = fPedestalEven[j] = 0;
+       fPedestalCutOdd[j] = fPedestalCutEven[j] = 0;
+       }
+    for(Int_t i = 0; i < 5; ++i) fTriggerSelected[i] = 0;
 }
 
 //________________________________________________________________
@@ -341,6 +391,38 @@ void AliADCalibData::SetParameter(TString name, Int_t val){
        else if(name.Contains("RollOver")) SetRollOver((UInt_t) val,iBoard);
        else if(name.Contains("DelayHit")) SetTimeOffset(0.01*(Float_t)val,iBoard,(iChannel-1));
        else if(name.Contains("DiscriThr")) SetDiscriThr(((Float_t)val-1040.)/112.,iBoard,(iChannel-1));
+               
+       else if(name.Contains("DelayClk1Win1")) SetDelayClk1Win1((UShort_t) val,iBoard);
+       else if(name.Contains("Clk1Win1")) SetClk1Win1((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk1Win2")) SetDelayClk1Win2((UShort_t) val,iBoard);
+       else if(name.Contains("Clk1Win2")) SetClk1Win2((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk2Win1")) SetDelayClk2Win1((UShort_t) val,iBoard);
+       else if(name.Contains("Clk2Win1")) SetClk2Win1((UShort_t) val,iBoard);
+       else if(name.Contains("DelayClk2Win2")) SetDelayClk2Win2((UShort_t) val,iBoard);
+       else if(name.Contains("Clk2Win2")) SetClk2Win2((UShort_t) val,iBoard);
+       else if(name.Contains("LatchWin1")) SetLatchWin1((UShort_t) val,iBoard);
+       else if(name.Contains("LatchWin2")) SetLatchWin2((UShort_t) val,iBoard);
+       else if(name.Contains("ResetWin1")) SetResetWin1((UShort_t) val,iBoard);
+       else if(name.Contains("ResetWin2")) SetResetWin2((UShort_t) val,iBoard);
+       else if(name.Contains("PedestalSubtraction")) SetPedestalSubtraction((Bool_t) val,iBoard);
+       else if(name.Contains("BBAThreshold")) SetBBAThreshold((UShort_t) val);
+       else if(name.Contains("BBCThreshold")) SetBBCThreshold((UShort_t) val);
+       else if(name.Contains("BGAThreshold")) SetBGAThreshold((UShort_t) val);
+       else if(name.Contains("BGCThreshold")) SetBGCThreshold((UShort_t) val);
+       else if(name.Contains("BBAForBGThreshold")) SetBBAForBGThreshold((UShort_t) val);
+       else if(name.Contains("BBCForBGThreshold")) SetBBCForBGThreshold((UShort_t) val);
+       else if(name.Contains("MultV0AThrLow")) SetMultV0AThrLow((UShort_t) val);
+       else if(name.Contains("MultV0AThrHigh")) SetMultV0AThrHigh((UShort_t) val);
+       else if(name.Contains("MultV0CThrLow")) SetMultV0CThrLow((UShort_t) val);
+       else if(name.Contains("MultV0CThrHigh")) SetMultV0CThrHigh((UShort_t) val);
+       else if(name.Contains("TriggerSelect")) SetTriggerSelected((UShort_t) val, iChannel-1 );
+       else if(name.Contains("EnableCharge")) SetEnableCharge((Bool_t) val, iBoard , iChannel-1);
+       else if(name.Contains("EnableTiming")) SetEnableTiming((Bool_t) val, iBoard , iChannel-1);
+       else if(name.Contains("PedOdd")) SetOnlinePedestal((UShort_t) val, 1, iBoard, iChannel-1);
+       else if(name.Contains("PedEven")) SetOnlinePedestal((UShort_t) val, 0, iBoard, iChannel-1);
+       else if(name.Contains("PedCutOdd")) SetOnlinePedestalCut((UShort_t) val, 1, iBoard, iChannel-1);
+       else if(name.Contains("PedCutEven")) SetOnlinePedestalCut((UShort_t) val, 0, iBoard, iChannel-1);
+       
        else AliError(Form("No Setter found for FEE parameter : %s",name.Data()));
        //
        delete nameSplit;
@@ -637,6 +719,372 @@ void AliADCalibData::SetDiscriThr(const Float_t* thresholds)
   else for(int t=0; t<16; t++) fDiscriThr[t] = 2.5;
 }
 
+
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestalCut(UShort_t val,Int_t integrator, Int_t channel)
+{
+       // Set Pedestal Cut of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) fPedestalCutOdd[channel] = val;
+               else fPedestalCutEven[channel] = val;
+       } else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestalCut(UShort_t val,Int_t integrator, Int_t board, Int_t channel)
+{
+  Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch>=0 && ch<16) {
+               if(integrator) fPedestalCutOdd[ch] = val;
+               else fPedestalCutEven[ch] = val;
+  }
+  else
+    AliError("Board/Channel numbers are not valid");
+}
+//________________________________________________________________
+UShort_t AliADCalibData::GetOnlinePedestalCut(Int_t integrator, Int_t channel)
+{
+       // Get Pedestal Cut of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) return(fPedestalCutOdd[channel]);
+               else return(fPedestalCutEven[channel]);
+       }else AliError(Form("Impossible to read at : Channel %d",channel));
+       return 0;
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t channel)
+{
+       // Set Pedestal of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) fPedestalOdd[channel] = val;
+               else fPedestalEven[channel] = val;
+       } else AliError(Form("Impossible to write at : Channel %d ; Integrator %d ",channel,integrator));
+}
+//________________________________________________________________
+void AliADCalibData::SetOnlinePedestal(UShort_t val,Int_t integrator, Int_t board, Int_t channel)
+{
+  Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+  if(ch>=0 && ch<16) {
+               if(integrator) fPedestalOdd[ch] = val;
+               else fPedestalEven[ch] = val;
+  }
+  else
+    AliError("Board/Channel numbers are not valid");
+}
+//________________________________________________________________
+UShort_t AliADCalibData::GetOnlinePedestal(Int_t integrator, Int_t channel)
+{
+       // Get Pedestal of individual channel 
+       if(channel>=0 && channel<16) {
+               if(integrator) return(fPedestalOdd[channel]);
+               else return(fPedestalEven[channel]);
+       } else AliError(Form("Impossible to read at : Channel %d",channel));
+       return 0;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableCharge(Bool_t val, Int_t channel)
+{
+       // Set the channels enabled for Charge triggers
+       if(channel>=0 && channel<16) fEnableCharge[channel] = val;
+       else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+Bool_t AliADCalibData::GetEnableCharge(Int_t channel)
+{
+       // Get the channels enabled for Charge triggers
+       if(channel>=0 && channel<16) return(fEnableCharge[channel]);
+       else AliError(Form("Impossible to read at : Channel %d",channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableTiming(Bool_t val, Int_t channel)
+{
+       // Set the channels enabled for Timing triggers
+       if(channel>=0 && channel<16) fEnableTiming[channel] = val;
+       else AliError(Form("Impossible to write at : Channel %d",channel));
+}
+//________________________________________________________________
+Bool_t AliADCalibData::GetEnableTiming(Int_t channel)
+{
+       // Get the channels enabled for Timing triggers
+       if(channel>=0 && channel<16) return(fEnableTiming[channel]);
+       else AliError(Form("Impossible to read at : Channel %d",channel));
+       return kFALSE;
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableCharge(Bool_t val,Int_t board, Int_t channel)
+{
+       Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+       // Set the channels enabled for Charge triggers
+       if(ch>=0) fEnableCharge[ch] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetEnableTiming(Bool_t val,Int_t board, Int_t channel)
+{
+       Int_t ch = AliADCalibData::GetOfflineChannelNumber(board,channel);
+       // Set the channels enabled for Timing triggers
+       if(ch>=0) fEnableTiming[ch] = val;
+       else AliError(Form("Impossible to write at : Board %d ; Channel %d",board,channel));
+}
+//________________________________________________________________
+void AliADCalibData::SetTriggerSelected(UShort_t trigger, Int_t output)
+{
+       // Set the trigger selected on the outputs to CTP
+       if(output>=0 && output<5) fTriggerSelected[output] = trigger;
+       else AliError(Form("Trigger output number %d not valid",output));
+}
+
+//________________________________________________________________
+void AliADCalibData::SetClk1Win1(UShort_t* clks)
+{
+       // Set Win clock of BB
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win1(clks[t],t);
+       else AliError("Profil Clock1 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win1(UShort_t* clks)
+{
+       // Set Win clock of BB
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win1(clks[t],t);
+       else AliError("Profil Clock2 Win1 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win1(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk1Win1[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win1 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win1(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk2Win1[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win1 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win2(UShort_t* clks)
+{
+       // Set Win clock of BG
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk1Win2(clks[t],t);
+       else AliError("Profil Clock1 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win2(UShort_t* clks)
+{
+       // Set Win clock of BG
+       if(clks) for(int t=0; t<kNCIUBoards; t++) SetClk2Win2(clks[t],t);
+       else AliError("Profil Clock2 Win2 Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetClk1Win2(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk1Win2[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock1 Win2 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetClk2Win2(UShort_t clk, Int_t board)
+{
+       // Set Win clock of BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fClk2Win2[board] = clk;
+               if(!IsClkValid(clk)) AliWarning(Form("Profil Clock2 Win2 of board %d is not valid : %d",board,clk));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win1(UShort_t* delays)
+{
+       // Set Delay for Win clock of BB
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win1(delays[t],t);
+       else AliError("Profil Clock1 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win1(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BB
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk1Win1[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win1(UShort_t* delays)
+{
+       // Set Delay for Win clock of BB
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win1(delays[t],t);
+       else AliError("Profil Clock2 Win1 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win1(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BB
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win1 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk2Win1[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win2(UShort_t* delays)
+{
+       // Set Delay for Win clock of BG
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk1Win2(delays[t],t);
+       else AliError("Profil Clock1 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk1Win2(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BG
+       if(delay>1023){
+               AliWarning(Form("Profil Clock1 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk1Win2[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win2(UShort_t* delays)
+{
+       // Set Delay for Win clock of BG
+       if(delays) for(int t=0; t<kNCIUBoards; t++) SetDelayClk2Win2(delays[t],t);
+       else AliError("Profil Clock2 Win2 Delays Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetDelayClk2Win2(UShort_t delay, Int_t board)
+{
+       // Set Delay for Win clock of BG
+       if(delay>1023){
+               AliWarning(Form("Profil Clock2 Win2 Delay of board %d should be less 1023 is currently %d. Truncated to the first 10 bits",board, delay));
+               delay = delay & 0x3FF;
+       }
+       if((board>=0) && (board<kNCIUBoards))   fDelayClk2Win2[board] = delay;
+       else AliError(Form("Trying to write out of the array Board = %d",board));
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin1(UShort_t *latchs){
+       // Set Latch Win clock for BB
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin1(latchs[t],t);
+       else AliError("Latch Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin1(UShort_t latch, Int_t board)
+{
+       // Set Latch Win clock for BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fLatchWin1[board] = latch;
+               if(!IsClkValid(latch)) AliWarning(Form("Latch Win1 of board %d is not valid : %d",board,latch));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin2(UShort_t *latchs){
+       // Set Latch Win clock for BG
+       if(latchs) for(int t=0; t<kNCIUBoards; t++) SetLatchWin2(latchs[t],t);
+       else AliError("Latch Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetLatchWin2(UShort_t latch, Int_t board)
+{
+       // Set Latch Win clock for BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fLatchWin2[board] = latch;
+               if(!IsClkValid(latch)) AliWarning(Form("Latch Win2 of board %d is not valid : %d",board,latch));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin1(UShort_t *resets){
+       // Set Reset Win clock for BB
+       if(resets) for(int t=0; t<kNCIUBoards; t++) SetResetWin1(resets[t],t);
+       else AliError("Reset Win1 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin1(UShort_t reset, Int_t board)
+{
+       // Set Reset Win clock for BB
+       if((board>=0) && (board<kNCIUBoards)) {
+               fResetWin1[board] = reset;
+               if(!IsClkValid(reset)) AliWarning(Form("Reset Win1 of board %d is not valid : %d",board,reset));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin2(UShort_t *resets){
+       // Set Reset Win clock for BG
+       if(resets)  for(int t=0; t<kNCIUBoards; t++) SetResetWin2(resets[t],t);
+       else AliError("Reset Win2 profil Not defined.");
+}
+//________________________________________________________________
+void AliADCalibData::SetResetWin2(UShort_t reset, Int_t board)
+{
+       // Set Reset Win clock for BG
+       if((board>=0) && (board<kNCIUBoards)) {
+               fResetWin2[board] = reset;
+               if(!IsClkValid(reset)) AliWarning(Form("Reset Win2 of board %d is not valid : %d",board,reset));
+       }else {
+               AliError(Form("Impossible to Write at Board %d",board));
+       }
+}
+//________________________________________________________________
+void AliADCalibData::SetPedestalSubtraction(Bool_t *peds){
+       // Set Pedestal Subtraction Parameter
+       if(peds)  for(int t=0; t<kNCIUBoards; t++) SetPedestalSubtraction(peds[t],t);
+       else AliError("Pedestal Subtraction Not defined.");
+       
+}
+//________________________________________________________________
+void AliADCalibData::SetPedestalSubtraction(Bool_t ped, Int_t board)
+{
+       // Set Pedestal Subtraction Parameter
+       if((board>=0) && (board<kNCIUBoards)) fPedestalSubtraction[board] = ped;
+       else AliError(Form("Board %d is not valid",board));
+}
+
+//________________________________________________________________
+Bool_t AliADCalibData::IsClkValid(UShort_t clock) const {
+       // Check if the given clock has a valid profil.
+       Bool_t word[5];
+       Bool_t isValid = kTRUE;
+       Short_t risingEdge = 0;
+       Short_t fallingEdge = 0;
+       for(int i=0 ; i<5 ; i++) word[i] = (clock >> i) & 0x1;
+       
+       if(word[0] != word[4]){
+               if(word[4]) fallingEdge++;
+               else risingEdge++;
+       }       
+       for(int i=1 ; i<5 ; i++){
+               if(word[i] != word[i-1]) {
+                       if(word[i-1]) fallingEdge++;
+                       else risingEdge++;
+               }
+       }
+       if((fallingEdge>1)||(risingEdge>1)) isValid = kFALSE;
+       if(((risingEdge==0)&&(fallingEdge==0)) &&(!word[0]))  isValid = kFALSE;
+       return isValid;
+}
+
 //________________________________________________________________
 Int_t AliADCalibData::GetOfflineChannelNumber(Int_t board, Int_t channel)
 {
index a574c92d532637a3c1ebcd5f0e8b73b5b19868e8..ad410068eac8ff45bd4a895f4d9b6bc66abe9f5b 100644 (file)
@@ -61,6 +61,62 @@ class AliADCalibData: public TNamed {
   Float_t  GetDiscriThr(Int_t channel) const {return fDiscriThr[channel];}
   Float_t* GetDiscriThr()   const {return (Float_t*)fDiscriThr;}
   Float_t  GetCalibDiscriThr(Int_t channel, Bool_t scaled);
+  
+  UShort_t * GetClk1Win1() const {return (UShort_t*)fClk1Win1;};
+  UShort_t GetClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win1[board]:0);};
+  UShort_t * GetClk2Win1() const {return (UShort_t*)fClk2Win1;};
+  UShort_t GetClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win1[board]:0);};
+
+  UShort_t * GetClk1Win2() const {return (UShort_t*)fClk1Win2;};
+  UShort_t GetClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk1Win2[board]:0);};
+  UShort_t * GetClk2Win2() const {return (UShort_t*)fClk2Win2;};
+  UShort_t GetClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fClk2Win2[board]:0);};
+
+  UShort_t * GetDelayClk1Win1() const {return (UShort_t*)fDelayClk1Win1;};
+  UShort_t GetDelayClk1Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win1[board]:0);};
+  UShort_t * GetDelayClk2Win1() const {return (UShort_t*)fDelayClk2Win1;};
+  UShort_t GetDelayClk2Win1(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win1[board]:0);};
+  
+  UShort_t * GetDelayClk1Win2() const {return (UShort_t*)fDelayClk1Win2;};
+  UShort_t GetDelayClk1Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk1Win2[board]:0);};
+  UShort_t * GetDelayClk2Win2() const {return (UShort_t*)fDelayClk2Win2;};
+  UShort_t GetDelayClk2Win2(Int_t board ) const {return ((board>=0 && board<kNCIUBoards)?fDelayClk2Win2[board]:0);};
+  
+  UShort_t * GetLatchWin1() const {return (UShort_t*)fLatchWin1;};
+  UShort_t GetLatchWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin1[board]:0);};
+  UShort_t * GetLatchWin2() const {return (UShort_t*)fLatchWin2;};
+  UShort_t GetLatchWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fLatchWin2[board]:0);};
+  
+  UShort_t * GetResetWin1() const {return (UShort_t*)fResetWin1;};
+  UShort_t GetResetWin1(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin1[board]:0);};
+  UShort_t * GetResetWin2() const {return (UShort_t*)fResetWin2;};
+  UShort_t GetResetWin2(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fResetWin2[board]:0);};
+  
+  Bool_t * GetPedestalSubtraction() const {return (Bool_t*) fPedestalSubtraction;};
+  Bool_t GetPedestalSubtraction(Int_t board ) const  {return ((board>=0 && board<kNCIUBoards)?fPedestalSubtraction[board]:0);};
+
+  UShort_t GetBBAThreshold() const {return fBBAThreshold;};
+  UShort_t GetBBCThreshold() const {return fBBCThreshold;};
+
+  UShort_t GetBGAThreshold() const {return fBGAThreshold;};
+  UShort_t GetBGCThreshold() const {return fBGCThreshold;};
+
+  UShort_t GetBBAForBGThreshold() const {return fBBAForBGThreshold;};
+  UShort_t GetBBCForBGThreshold() const {return fBBCForBGThreshold;};
+  
+  UShort_t GetMultV0AThrLow() const {return fMultV0AThrLow;};
+  UShort_t GetMultV0AThrHigh() const {return fMultV0AThrHigh;};
+
+  UShort_t GetMultV0CThrLow() const {return fMultV0CThrLow;};
+  UShort_t GetMultV0CThrHigh() const {return fMultV0CThrHigh;};
+
+  UShort_t GetTriggerSelected(Int_t output) const {return ((output>=0 && output<5)?fTriggerSelected[output]:0);};
+  
+  Bool_t GetEnableCharge(Int_t channel);
+  Bool_t GetEnableTiming(Int_t channel);
+  UShort_t GetOnlinePedestal(Int_t integrator, Int_t channel);
+  UShort_t GetOnlinePedestalCut(Int_t integrator, Int_t channel);
+
 
   static Int_t GetBoardNumber(Int_t channel);
   static Int_t GetFEEChannelNumber(Int_t channel);
@@ -109,13 +165,73 @@ class AliADCalibData: public TNamed {
   void     SetDiscriThr(Float_t thr, Int_t board, Int_t channel);
   void     SetDiscriThr(const Float_t* thresholds);
 
+  void SetClk1Win1(UShort_t* clks);
+  void SetClk1Win1(UShort_t clk, Int_t board);
+  void SetClk2Win1(UShort_t* clks);
+  void SetClk2Win1(UShort_t clk, Int_t board);
+  
+  void SetClk1Win2(UShort_t* clks);
+  void SetClk1Win2(UShort_t clk, Int_t board);
+  void SetClk2Win2(UShort_t* clks);
+  void SetClk2Win2(UShort_t clk, Int_t board);
+  
+  void SetDelayClk1Win1(UShort_t* delays);
+  void SetDelayClk1Win1(UShort_t delay, Int_t board);
+  void SetDelayClk2Win1(UShort_t* delays);
+  void SetDelayClk2Win1(UShort_t delay, Int_t board);
+  
+  void SetDelayClk1Win2(UShort_t* delays);
+  void SetDelayClk1Win2(UShort_t delay, Int_t board);
+  void SetDelayClk2Win2(UShort_t* delays);
+  void SetDelayClk2Win2(UShort_t delay, Int_t board);
+  
+  void SetLatchWin1(UShort_t *latchs);
+  void SetLatchWin1(UShort_t latch, Int_t board);
+  void SetLatchWin2(UShort_t *latchs);
+  void SetLatchWin2(UShort_t latch, Int_t board);
+  
+  void SetResetWin1(UShort_t *resets);
+  void SetResetWin1(UShort_t reset, Int_t board);
+  void SetResetWin2(UShort_t *resets);
+  void SetResetWin2(UShort_t reset, Int_t board);
+  
+  void SetPedestalSubtraction(Bool_t *peds);
+  void SetPedestalSubtraction(Bool_t ped, Int_t board);
+  
+  void SetBBAThreshold(UShort_t th) {fBBAThreshold = th;};
+  void SetBBCThreshold(UShort_t th) {fBBCThreshold = th;};
+
+  void SetBGAThreshold(UShort_t th) {fBGAThreshold = th;};
+  void SetBGCThreshold(UShort_t th) {fBGCThreshold = th;};
+
+  void SetBBAForBGThreshold(UShort_t th) {fBBAForBGThreshold = th;};
+  void SetBBCForBGThreshold(UShort_t th) {fBBCForBGThreshold = th;};
+  
+  
+  void SetMultV0AThrLow(UShort_t th) {fMultV0AThrLow = th;};
+  void SetMultV0AThrHigh(UShort_t th) {fMultV0AThrHigh = th;};
+  
+  void SetMultV0CThrLow(UShort_t th) {fMultV0CThrLow = th;};
+  void SetMultV0CThrHigh(UShort_t th) {fMultV0CThrHigh = th;};
+  
+  void SetTriggerSelected(UShort_t trigger, Int_t output);
+  
+  void SetEnableCharge(Bool_t val, Int_t board, Int_t channel);
+  void SetEnableTiming(Bool_t val, Int_t board, Int_t channel);
+  void SetEnableCharge(Bool_t val, Int_t channel);
+  void SetEnableTiming(Bool_t val, Int_t channel);
+  void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+  void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t board, Int_t channel);
+  void SetOnlinePedestal(UShort_t val, Int_t integrator, Int_t channel);
+  void SetOnlinePedestalCut(UShort_t val, Int_t integrator, Int_t channel);
 
  protected:
   void     InitLightYields();
   void     InitPMGains();
+  Bool_t   IsClkValid(UShort_t clock) const;
 
-  Float_t  fPedestal[32];     // Mean pedestal values
-  Float_t  fSigma[32];        // Sigmas of pedestal peaks
+  Float_t  fPedestal[32];     // Mean pedestal values - used offline
+  Float_t  fSigma[32];        // Sigmas of pedestal peaks - used offline
   Float_t  fADCmean[32];      // ADC mean values
   Float_t  fADCsigma[32];     // ADC sigma values
   Float_t  fMeanHV[16];        // Mean PMT HV needed to compute MIP value
@@ -131,6 +247,37 @@ class AliADCalibData: public TNamed {
   UInt_t   fSearchWindow[kNCIUBoards];// HPTDC search window (25ns units)
   UInt_t   fTriggerCountOffset[kNCIUBoards]; // HPTDC trigger count offset (25ns units)
   UInt_t   fRollOver[kNCIUBoards]; // HPTDC roll-over (25ns units)
+  
+  UShort_t fClk1Win1[kNCIUBoards]; //Profil of the Clock 1  of the Window 1 (BB window)
+  UShort_t fClk2Win1[kNCIUBoards]; //Profil of the Clock 2  of the Window 1 (BB window)
+  UShort_t fClk1Win2[kNCIUBoards]; //Profil of the Clock 1  of the Window 2 (BG window)
+  UShort_t fClk2Win2[kNCIUBoards]; //Profil of the Clock 2  of the Window 2 (BG window)
+  UShort_t fDelayClk1Win1[kNCIUBoards]; // Delays of the Clock 1  of the Window 1 (BB window)
+  UShort_t fDelayClk2Win1[kNCIUBoards]; // Delays of the Clock 2 of the Window 1 (BB window)
+  UShort_t fDelayClk1Win2[kNCIUBoards]; // Delays of the Clock 1  of the Window 2 (BG window)
+  UShort_t fDelayClk2Win2[kNCIUBoards]; // Delays of the Clock 2 of the Window 2 (BG window)
+  UShort_t fLatchWin1[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 1 (BB window)
+  UShort_t fLatchWin2[kNCIUBoards]; //Profil of the Clock of the Latch signal of Window 2 (BG window)
+  UShort_t fResetWin1[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 1 (BB window)
+  UShort_t fResetWin2[kNCIUBoards]; //Profil of the Clock of the Reset signal of Window 2 (BG window)
+  Bool_t   fPedestalSubtraction[kNCIUBoards]; // Flag to en(dis)able pedestal subtraction before centrality trigger calculation
+  UShort_t fBBAThreshold;  // Minimum bias Threshold in number of channel hit for ADA
+  UShort_t fBBCThreshold;  // Minimum bias Threshold in number of channel hit for ADC
+  UShort_t fBGAThreshold;  // Beam Gas Threshold in number of channel hit for ADA
+  UShort_t fBGCThreshold;  // Beam Gas Threshold in number of channel hit for ADC
+  UShort_t fBBAForBGThreshold;  // BBA threshold for Beam Gas triggers (i.e. BBA and BGC)
+  UShort_t fBBCForBGThreshold;  // BBC threshold for Beam Gas triggers (i.e. BBC and BGA)
+  UShort_t fMultV0AThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0AThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0CThrLow;  // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fMultV0CThrHigh; // Threshold used for multiplicity triggers (i.e. MTA and MTC)
+  UShort_t fTriggerSelected[5]; // Triggers selected on the 5 outputs to CTP
+  Bool_t   fEnableCharge[16]; // Flag to know is a channel is participating to the Charge triggers
+  Bool_t   fEnableTiming[16]; // Flag to know is a channel is participating to the Timing triggers
+  UShort_t fPedestalOdd[16]; // Pedestals for the Odd integrators
+  UShort_t fPedestalEven[16]; // Pedestals for the Even integrators
+  UShort_t fPedestalCutOdd[16]; // Pedestals Cut for the Odd integrators
+  UShort_t fPedestalCutEven[16]; // Pedestals Cut for the Even integrators
 
   Float_t  fDiscriThr[16];     // Discriminator thresholds