// =========
//
// AliDevice m;
+// // Set user defined status word to indicate e.g. readout electronics version
+// m.SetStatus(100201);
// m.SetHitCopy(1);
// m.SetName("OM123");
//
//- Modified: NvE $Date$ Utrecht University
///////////////////////////////////////////////////////////////////////////
+#include <cstdlib>
#include "AliDevice.h"
#include "Riostream.h"
AliDevice::AliDevice() : AliSignal()
{
// Default constructor.
+// The user definable status word is set to zero.
// By default private copies of the recorded hits will be made.
// This implies that by default the device will own the registered hits.
// See the SetHitCopy() memberfunction for further details.
+ fStatus=0;
fHitCopy=1;
fHits=0;
fOrdered=0;
fOrdered=0;
fMarkers=0;
+ fStatus=dev.GetStatus();
fHitCopy=dev.GetHitCopy();
Int_t nhits=dev.GetNhits();
void AliDevice::Reset(Int_t mode)
{
// Reset registered hits and AliSignal attributes.
+// Note : The status word and HitCopy flag are NOT modified.
+// Use SetStatus() and SetHitCopy() to modify these parameters.
// See AliSignal::Reset() for further details.
RemoveHits();
AliSignal::Reset(mode);
return fHitCopy;
}
///////////////////////////////////////////////////////////////////////////
+void AliDevice::SetStatus(Int_t word)
+{
+// Set a user defined status word for this device.
+ fStatus=word;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliDevice::GetStatus() const
+{
+// Provide the user defined status word for this device.
+ return fStatus;
+}
+///////////////////////////////////////////////////////////////////////////
void AliDevice::AddHit(AliSignal& s)
{
// Register an AliSignal object as a hit to this device.
}
}
///////////////////////////////////////////////////////////////////////////
+AliSignal* AliDevice::GetHit(TString name) const
+{
+// Provide the AliSignal object registered as hit with the specified name.
+// Note : The first hit encountered with the specified name will be provided.
+
+ if (!fHits) return 0;
+
+ TString hitname;
+ Int_t nhits=GetNhits();
+ for (Int_t i=0; i<nhits; i++)
+ {
+ AliSignal* sx=(AliSignal*)fHits->At(i);
+ if (sx)
+ {
+ hitname=sx->GetName();
+ if (hitname == name) return sx;
+ }
+ }
+
+ return 0; // No matching name found
+}
+///////////////////////////////////////////////////////////////////////////
AliSignal* AliDevice::GetIdHit(Int_t id) const
{
// Return the hit with unique identifier "id".
}
}
///////////////////////////////////////////////////////////////////////////
-void AliDevice::Data(TString f) const
+void AliDevice::Data(TString f,TString u) const
{
// Print the device and all registered hit info according to the specified
-// coordinate frame.
- AliSignal::Data(f);
+// 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".
+
+ AliSignal::Data(f,u);
Int_t nhits=GetNhits();
if (nhits)
{
}
}
///////////////////////////////////////////////////////////////////////////
-void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx,TObjArray* hits) const
+void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx,TObjArray* hits,Int_t mode) const
{
// Provide the min. and max. signal values of an array of hits.
// The input argument "idx" denotes the index of the signal slots to be investigated.
// The default is idx=1;
// In case hits=0 (default), the registered hits of the current device are used.
// Signals which were declared as "Dead" will be rejected.
-// The gain etc... corrected signals will be used in the process.
+// The gain etc... corrected signals will be used in the process as specified
+// by the "mode" argument. The definition of this "mode" parameter corresponds to
+// the description provided in the GetSignal memberfunction of class AliSignal.
+// The default is mode=1 (for backward compatibility reasons).
vmin=0;
vmax=0;
if (idx > sx->GetNvalues()) continue; // User specified slotindex out of range for this signal
if (sx->GetDeadValue(idx)) continue; // Only take alive signals
- sig=sx->GetSignal(idx,1);
+ sig=sx->GetSignal(idx,mode);
if (i==0)
{
vmin=sig;
}
}
///////////////////////////////////////////////////////////////////////////
-void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray* hits) const
+void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray* hits,Int_t mode) const
{
// Provide the min. and max. signal values of an array of hits.
// The input argument "name" denotes the name of the signal slots to be investigated.
// In case hits=0 (default), the registered hits of the current device are used.
// Signals which were declared as "Dead" will be rejected.
-// The gain etc... corrected signals will be used in the process.
+// The gain etc... corrected signals will be used in the process as specified
+// by the "mode" argument. The definition of this "mode" parameter corresponds to
+// the description provided in the GetSignal memberfunction of class AliSignal.
+// The default is mode=1 (for backward compatibility reasons).
vmin=0;
vmax=0;
if (sx->GetDeadValue(idx)) continue; // Only take alive signals
- sig=sx->GetSignal(idx,1);
+ sig=sx->GetSignal(idx,mode);
if (i==0)
{
vmin=sig;
}
}
///////////////////////////////////////////////////////////////////////////
-TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits)
+TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits,Int_t mcal)
{
// Order the references to an array of hits by looping over the input array "hits"
// and checking the signal value. The ordered array is returned as a TObjArray.
// order (mode=-1) or ordering in increasing order (mode=1).
// The default is mode=-1.
// Signals which were declared as "Dead" will be rejected.
-// The gain etc... corrected signals will be used in the ordering process.
+// The gain etc... corrected signals will be used in the ordering process as
+// specified by the "mcal" argument. The definition of this "mcal" parameter
+// corresponds to the signal correction mode described in the GetSignal
+// memberfunction of class AliSignal.
+// The default is mcal=1 (for backward compatibility reasons).
if (fOrdered)
{
break; // go for next hit
}
- if (mode==-1 && s->GetSignal(idx,1) < ((AliSignal*)fOrdered->At(j))->GetSignal(idx,1)) continue;
- if (mode==1 && s->GetSignal(idx,1) > ((AliSignal*)fOrdered->At(j))->GetSignal(idx,1)) continue;
+ if (mode==-1 && s->GetSignal(idx,mcal) <= ((AliSignal*)fOrdered->At(j))->GetSignal(idx,mcal)) continue;
+ if (mode==1 && s->GetSignal(idx,mcal) >= ((AliSignal*)fOrdered->At(j))->GetSignal(idx,mcal)) continue;
nord++;
for (Int_t k=nord-1; k>j; k--) // create empty position
fOrdered->AddAt(fOrdered->At(k-1),k);
}
fOrdered->AddAt(s,j); // put hit at empty position
- break; // go for next matrix module
+ break; // go for next hit
}
}
return fOrdered;
}
///////////////////////////////////////////////////////////////////////////
-TObjArray* AliDevice::SortHits(TString name,Int_t mode,TObjArray* hits)
+TObjArray* AliDevice::SortHits(TString name,Int_t mode,TObjArray* hits,Int_t mcal)
{
// Order the references to an array of hits by looping over the input array "hits"
// and checking the signal value. The ordered array is returned as a TObjArray.
// order (mode=-1) or ordering in increasing order (mode=1).
// The default is mode=-1.
// Signals which were declared as "Dead" will be rejected.
-// The gain etc... corrected signals will be used in the ordering process.
+// The gain etc... corrected signals will be used in the ordering process as
+// specified by the "mcal" argument. The definition of this "mcal" parameter
+// corresponds to the signal correction mode described in the GetSignal
+// memberfunction of class AliSignal.
+// The default is mcal=1 (for backward compatibility reasons).
if (fOrdered)
{
break; // go for next hit
}
- if (mode==-1 && s->GetSignal(idx,1) < ((AliSignal*)fOrdered->At(j))->GetSignal(idx,1)) continue;
- if (mode==1 && s->GetSignal(idx,1) > ((AliSignal*)fOrdered->At(j))->GetSignal(idx,1)) continue;
+ if (mode==-1 && s->GetSignal(idx,mcal) <= ((AliSignal*)fOrdered->At(j))->GetSignal(idx,mcal)) continue;
+ if (mode==1 && s->GetSignal(idx,mcal) >= ((AliSignal*)fOrdered->At(j))->GetSignal(idx,mcal)) continue;
nord++;
for (Int_t k=nord-1; k>j; k--) // create empty position
fOrdered->AddAt(fOrdered->At(k-1),k);
}
fOrdered->AddAt(s,j); // put hit at empty position
- break; // go for next matrix module
+ break; // go for next hit
}
}
return fOrdered;
}
///////////////////////////////////////////////////////////////////////////
-void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int_t mstyle,Int_t mcol)
+void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int_t mode,Int_t mcol)
{
// 3D color display of an array hits.
// The user can specify the index (default=1) of the signal slot to perform the display for.
// Note that the input array is not modified.
// In case dp=1 the device position will be used, otherwise the hit position will
// be used in the display. The default is dp=0.
-// Via the "mstyle" and "mcol" arguments the user can specify the marker style
-// and color (see TPolyMarker3D) respectively.
-// The defaults are mstyle="large scalable dot" and mcol=blue.
+// Via the "mcol" argument the user can specify the marker color (see TPolyMarker3D).
+// The default is mcol=blue.
// Signals which were declared as "Dead" will not be displayed.
// The gain etc... corrected signals will be used to determine the marker size.
+// The gain correction is performed according to "mode" argument. The definition of this
+// "mode" parameter corresponds to the description provided in the GetSignal
+// memberfunction of class AliSignal.
+// The default is mode=1 (for backward compatibility reasons).
//
// Note :
// ------
if (scale<0)
{
Float_t vmin,vmax;
- GetExtremes(vmin,vmax,idx,hits);
+ GetExtremes(vmin,vmax,idx,hits,mode);
sigmax=fabs(vmax);
if (fabs(vmin)>sigmax) sigmax=fabs(vmin);
}
if (dev) dev->GetPosition(pos,"car");
}
}
- sig=sx->GetSignal(idx,1);
+ sig=sx->GetSignal(idx,mode);
+
+ // Skip dead signals
+ if (fabs(sig) <= 0.) continue;
+
TPolyMarker3D* m=new TPolyMarker3D();
- m->SetMarkerStyle(mstyle);
+ m->SetMarkerStyle(8);
m->SetMarkerColor(mcol);
m->SetMarkerSize(100.*fabs(sig)/sigmax);
m->SetPoint(0,pos[0],pos[1],pos[2]);
}
}
///////////////////////////////////////////////////////////////////////////
-void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,Int_t mstyle,Int_t mcol)
+void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,Int_t mode,Int_t mcol)
{
// 3D color display of an array hits.
// The user can specify the name of the signal slot to perform the display for.
// be used in the display. The default is dp=0.
// The marker size will indicate the percentage of the maximum encountered value
// of the absolute value of the name-specified input signal slots.
-// Via the "mstyle" and "mcol" arguments the user can specify the marker style
-// and color (see TPolyMarker3D) respectively.
-// The defaults are mstyle="large scalable dot" and mcol=blue.
+// Via the "mcol" argument the user can specify the marker color (see TPolyMarker3D).
+// The default is mcol=blue.
// Signals which were declared as "Dead" will not be displayed.
// The gain etc... corrected signals will be used to determine the marker size.
+// The gain correction is performed according to "mode" argument. The definition of this
+// "mode" parameter corresponds to the description provided in the GetSignal
+// memberfunction of class AliSignal.
+// The default is mode=1 (for backward compatibility reasons).
//
// Note :
// ------
if (scale<0)
{
Float_t vmin,vmax;
- GetExtremes(vmin,vmax,name,hits);
+ GetExtremes(vmin,vmax,name,hits,mode);
sigmax=fabs(vmax);
if (fabs(vmin)>sigmax) sigmax=fabs(vmin);
}
if (dev) dev->GetPosition(pos,"car");
}
}
- sig=sx->GetSignal(idx,1);
+ sig=sx->GetSignal(idx,mode);
+
+ // Skip dead signals
+ if (fabs(sig) <= 0.) continue;
+
TPolyMarker3D* m=new TPolyMarker3D();
- m->SetMarkerStyle(mstyle);
+ m->SetMarkerStyle(8);
m->SetMarkerColor(mcol);
m->SetMarkerSize(100.*fabs(sig)/sigmax);
m->SetPoint(0,pos[0],pos[1],pos[2]);