//- Modified: NvE $Date$ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
+#include <cstdlib>
#include "AliSignal.h"
#include "AliTrack.h"
#include "Riostream.h"
Int_t n=s.GetNvalues();
Double_t val;
+ Int_t lock;
for (Int_t i=1; i<=n; i++)
{
if (s.GetSignalFlag(i))
{
val=s.GetSignal(i);
+ lock=s.GetLockValue();
+ if (lock) Unlock();
SetSignal(val,i);
+ if (lock) Lock();
}
}
if (s.GetErrorFlag(j))
{
val=s.GetSignalError(j);
+ lock=s.GetLockValue();
+ if (lock) Unlock();
SetSignalError(val,j);
+ if (lock) Lock();
}
}
{
// Reset various signal data according to user selection.
//
-// mode = 0 Reset all signal values and their errors to 0.
-// 1 Reset only signal values
-// 2 Reset only signal errors
+// mode = 0 Reset all signal values, their errors and all waveform histos.
+// 1 Reset only signal values and waveform histos.
+// 2 Reset only signal errors and waveform histos.
+// -1 Reset only signal values.
+// -2 Reset only signal errors.
//
// The default when invoking ResetSignals() corresponds to mode=0.
-//
-// Irrespective of the mode, the waveform histograms are reset.
- if (mode<0 || mode>2)
+ if (abs(mode)>2)
{
cout << " *AliSignal::ResetSignals* Invalid argument mode = " << mode << endl;
cout << " Default mode=0 will be used." << endl;
Int_t sflag=0;
Int_t eflag=0;
- if (fSignals && (mode==0 || mode==1))
+ if (fSignals && (abs(mode)==0 || abs(mode)==1))
{
for (Int_t i=1; i<=fSignals->GetSize(); i++)
{
}
}
- if (fDsignals && (mode==0 || mode==2))
+ if (fDsignals && (abs(mode)==0 || abs(mode)==2))
{
for (Int_t j=1; j<=fDsignals->GetSize(); j++)
{
}
}
- ResetWaveform(0);
+ if (mode>=0) ResetWaveform(0);
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::DeleteSignals(Int_t mode)
{
// Delete storage arrays of various signal data according to user selection.
//
-// mode = 0 Delete arrays of both signal values and their errors.
-// 1 Delete only signal values array
-// 2 Delete only signal errors array
+// mode = 0 Delete arrays of signal values, their errors and all waveform histos.
+// 1 Delete only signal values array and waveform histos.
+// 2 Delete only signal errors array and waveform histos.
+// -1 Delete only signal values array.
+// -2 Delete only signal errors array.
//
// The default when invoking DeleteSignals() corresponds to mode=0.
-//
-// Irrespective of the mode, the waveform histograms are deleted.
- if (mode<0 || mode>2)
+ if (abs(mode)>2)
{
cout << " *AliSignal::DeleteSignals* Invalid argument mode = " << mode << endl;
cout << " Default mode=0 will be used." << endl;
mode=0;
}
- if (fSignals && (mode==0 || mode==1))
+ if (fSignals && (abs(mode)==0 || abs(mode)==1))
{
delete fSignals;
fSignals=0;
}
- if (fDsignals && (mode==0 || mode==2))
+ if (fDsignals && (abs(mode)==0 || abs(mode)==2))
{
delete fDsignals;
fDsignals=0;
delete fSigflags;
fSigflags=0;
}
- else if (mode==1)
+ else if (abs(mode)==1)
{
for (Int_t i=1; i<=fSigflags->GetSize(); i++)
{
SetSigFlags(0,eflag,i);
}
}
- else if (mode==2)
+ else if (abs(mode)==2)
{
for (Int_t j=1; j<=fSigflags->GetSize(); j++)
{
}
}
- DeleteWaveform(0);
+ if (mode>=0) DeleteWaveform(0);
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::SetSignal(Double_t sig,Int_t j)
{
// Store signal value for the j-th (default j=1) slot.
-// Note : The first signal slot is at j=1.
+// Notes :
+// -------
+// 1) The first signal slot is at j=1.
+// 2) In case the 'lock' flag was set for the specified slot, the new
+// signal value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal value.
// In case the value of the index j exceeds the maximum number of reserved
// slots for signal values, the number of reserved slots for the
// signal values is increased automatically.
+ if (GetLockValue(j)) return;
+
if (!fSignals)
{
fSignals=new TArrayF(j);
- ResetSignals(1);
+ ResetSignals(-1);
}
Int_t size=fSignals->GetSize();
{
// Store signal value for the name-specified slot.
//
+// Note :
+// ------
+// In case the 'lock' flag was set for the specified slot, the new
+// signal value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal value.
+//
// This procedure involves a slot-index search based on the specified name
// at each invokation. This may become slow in case many slots have been
// defined and/or when this procedure is invoked many times.
// either directly or via a few invokations of GetSlotIndex().
Int_t j=GetSlotIndex(name);
- if (j>0) SetSignal(sig,j);
+ if (j>0)
+ {
+ if (!GetLockValue(j)) SetSignal(sig,j);
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::AddSignal(Double_t sig,Int_t j)
{
// Add value to the signal of the j-th (default j=1) slot.
-// Note : The first signal slot is at j=1.
+// Notes :
+// -------
+// 1) The first signal slot is at j=1.
+// 2) In case the 'lock' flag was set for the specified slot, the new
+// signal value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal value.
// In case the value of the index j exceeds the maximum number of reserved
// slots for signal values, the number of reserved slots for the
// signal values is increased automatically.
+ if (GetLockValue(j)) return;
+
if (!fSignals)
{
fSignals=new TArrayF(j);
{
// Add value to the signal of the name-specified slot.
//
+// Note :
+// ------
+// In case the 'lock' flag was set for the specified slot, the new
+// signal value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal value.
+//
// This procedure involves a slot-index search based on the specified name
// at each invokation. This may become slow in case many slots have been
// defined and/or when this procedure is invoked many times.
// either directly or via a few invokations of GetSlotIndex().
Int_t j=GetSlotIndex(name);
- if (j>0) AddSignal(sig,j);
+ if (j>0)
+ {
+ if (!GetLockValue(j)) AddSignal(sig,j);
+ }
}
///////////////////////////////////////////////////////////////////////////
Float_t AliSignal::GetSignal(Int_t j,Int_t mode) const
void AliSignal::SetSignalError(Double_t dsig,Int_t j)
{
// Store error on the signal for the j-th (default j=1) slot.
-// Note : The first signal slot is at j=1.
+// Notes :
+// -------
+// 1) The first signal slot is at j=1.
+// 2) In case the 'lock' flag was set for the specified slot, the new
+// signal error value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal error value.
// In case the value of the index j exceeds the maximum number of reserved
// slots for signal error values, the number of reserved slots for the
// signal errors is increased automatically.
+ if (GetLockValue(j)) return;
+
if (!fDsignals)
{
fDsignals=new TArrayF(j);
- ResetSignals(2);
+ ResetSignals(-2);
}
Int_t size=fDsignals->GetSize();
{
// Store error on the signal for the name-specified slot.
//
+// Note :
+// ------
+// In case the 'lock' flag was set for the specified slot, the new
+// signal error value will not be stored.
+// One has to unlock the specified slot first in case one really wants
+// to overwite the signal error value.
+//
// This procedure involves a slot-index search based on the specified name
// at each invokation. This may become slow in case many slots have been
// defined and/or when this procedure is invoked many times.
// either directly or via a few invokations of GetSlotIndex().
Int_t j=GetSlotIndex(name);
- if (j>0) SetSignalError(dsig,j);
+ if (j>0)
+ {
+ if (!GetLockValue(j)) SetSignalError(dsig,j);
+ }
}
///////////////////////////////////////////////////////////////////////////
Float_t AliSignal::GetSignalError(Int_t j) const