// In case the offset value was not set, offset=0 will be assumed.
// 2 : Same as mode=1 but gain, offset dead flag etc... are taken from
// the AliDevice which owns this AliSignal object.
+// The corresponding AliDevice slot is obtained via matching of
+// the slotnames. In case this fails, the slotindex "j" of the
+// input argument will be used.
// In case this AliSignal object has no parent AliDevice, just
// the j-th signal is returned (like with mode=0).
// 3 : The j-th signal is corrected using the corresponding calibration
// In case the j-th slot was marked dead, 0 is returned.
// In case no calibration function is present, just the j-th signal
// is returned (like with mode=0).
-// 4 : Same as mode=3 but the calibration function is taken from
-// the AliDevice which owns this AliSignal object.
+// 4 : Same as mode=3 but the calibration function and dead flag are
+// taken from the AliDevice which owns this AliSignal object.
+// The corresponding AliDevice slot is obtained via matching of
+// the slotnames. In case this fails, the slotindex "j" of the
+// input argument will be used.
// 5 : Same as mode=2 but in case no parent AliDevice is present
// an automatic switch to mode=1 will be made.
// 6 : Same as mode=4 but in case no parent AliDevice is present
// an automatic switch to mode=3 will be made.
+// 7 : Same as mode=3 but in case no calibration function is present
+// an automatic switch to mode=4 will be made.
+// 8 : Same as mode=7 but also the corresponding dead flag of the
+// parent device (if any) will be checked.
+// If either the dead flag of the requested signal slot of this
+// AliSignal object or the corresponding parent device slot is
+// set, 0 is returned.
//
// <0 : The corresponding de-correction or de-calibration is performed
//
//
// The default is mode=0.
- if (abs(mode)>6) return 0;
+ if (abs(mode)>8) return 0;
+ Int_t jcal=j;
Float_t sig=0;
Float_t gain=1;
Float_t offset=0;
+ // Get the corresponding slot index (and dead flag) of the parent device
+ Int_t pj=0;
+ Int_t pdead=0;
+ AliSignal* parent=(AliSignal*)GetDevice();
+ if ((abs(mode)==2 || abs(mode)>=4) && parent)
+ {
+ TString name=GetSlotName(j);
+ if (strlen(name.Data())) pj=parent->GetSlotIndex(name);
+ if (abs(mode)==8 && pj) pdead=parent->GetDeadValue(pj);
+ }
+ if (mode==8) mode=7;
+ if (mode==-8) mode=-7;
+
AliSignal* sx=(AliSignal*)this;
- if (abs(mode)==2 || abs(mode)>=4) sx=(AliSignal*)GetDevice();
+
+ TF1* f=0;
+ if (mode==7)
+ {
+ f=sx->GetCalFunction(jcal);
+ if (f)
+ {
+ mode=3;
+ }
+ else
+ {
+ mode=4;
+ }
+ }
+ if (mode==-7)
+ {
+ f=sx->GetDecalFunction(jcal);
+ if (f)
+ {
+ mode=-3;
+ }
+ else
+ {
+ mode=-4;
+ }
+ }
+
+ if (abs(mode)==2 || abs(mode)>=4)
+ {
+ sx=(AliSignal*)GetDevice();
+ if (pj) jcal=pj;
+ }
if (!sx && abs(mode)>=5) sx=(AliSignal*)this;
if (mode==5) mode=2;
if (mode==-5) mode=-2;
if (mode==0 || !sx) return sig;
// Check for the dead flag setting
- if (sx->GetDeadValue(j)) return 0;
+ if (sx->GetDeadValue(jcal) || pdead) return 0;
// (De)correct the signal for the gain and offset
if (abs(mode)==1 || abs(mode)==2)
{
- if (sx->GetGainFlag(j)) gain=sx->GetGain(j);
- if (sx->GetOffsetFlag(j)) offset=sx->GetOffset(j);
+ if (sx->GetGainFlag(jcal)) gain=sx->GetGain(jcal);
+ if (sx->GetOffsetFlag(jcal)) offset=sx->GetOffset(jcal);
if (fabs(gain)>0.)
{
// (De)calibrate the signal with the corresponding (de)calibration function
if (abs(mode)==3 || abs(mode)==4)
{
- TF1* f=sx->GetCalFunction(j);
- if (mode<0) f=sx->GetDecalFunction(j);
+ f=sx->GetCalFunction(jcal);
+ if (mode<0) f=sx->GetDecalFunction(jcal);
if (f) sig=f->Eval(sig);
return sig;
}
{
// Provide signal value of the name-specified slot.
// In case no signal is present, 0 is returned.
-// The parameter "mode" allows for automatic gain etc... correction of the signal.
-//
-// mode = 0 : Just the j-th signal is returned.
-// 1 : The j-th signal is corrected for the gain, offset, dead flag etc...
-// In case the gain value was not set, gain=1 will be assumed.
-// In case the gain value was 0, a signal value of 0 is returned.
-// In case the offset value was not set, offset=0 will be assumed.
-// In case the j-th slot was marked dead, 0 is returned.
-//
-// The corrected signal (sigc) is determined as follows :
-//
-// sigc=(signal/gain)-offset
+// The parameter "mode" allows for automatic (de)calibration of the signal
+// (e.g. gain etc... correction or via explicit (de)calibration functions).
+// For further details about the (de)calibration modes, please refer to the
+// corresponding slot-index based memberfunction.
//
// The default is mode=0.
//
return val;
}
///////////////////////////////////////////////////////////////////////////
-void AliSignal::Data(TString f) const
+void AliSignal::Data(TString f,TString u) const
{
// Provide all signal information within the coordinate frame f.
+//
+// The string argument "u" allows to choose between different angular units
+// in case e.g. a spherical frame is selected.
+// u = "rad" : angles provided in radians
+// "deg" : angles provided in degrees
+//
+// The defaults are f="car" and u="rad".
const char* name=GetName();
const char* title=GetTitle();
if (strlen(title)) cout << " Title : " << title;
cout << endl;
cout << " Position";
- AliPosition::Data(f);
+ AliPosition::Data(f,u);
if (fDevice)
{
const char* devname=fDevice->GetName();