]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliEvent.cxx
Prepare for new code
[u/mrichter/AliRoot.git] / RALICE / AliEvent.cxx
index 652ff126a6fb23925c5d7c5fe960c4bc546a356f..e1b33d98bd40fa0afa3c9e5d4f751b8a590e99de 100644 (file)
@@ -13,7 +13,7 @@
  * provided "as is" without express or implied warranty.                  *
  **************************************************************************/
 
-// $Id: AliEvent.cxx,v 1.24 2004/07/06 13:34:16 nick Exp $
+// $Id: AliEvent.cxx,v 1.25 2004/10/20 10:49:44 nick Exp $
 
 ///////////////////////////////////////////////////////////////////////////
 // Class AliEvent
 //        ... // code to create tracks etc... 
 //        ...
 //
-// Note : All quantities are in GeV, GeV/c or GeV/c**2
+// Note : By default all quantities are in meter, GeV, GeV/c or GeV/c**2
+//        but the user can indicate the usage of a different scale for
+//        the metric and/or energy-momentum units via the SetUnitScale()
+//        and SetEscale() memberfunctions, respectively.
+//        The actual metric and energy-momentum unit scales in use can be
+//        obtained via the GetUnitScale() and GetEscale() memberfunctions.
 //
 //--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
-//- Modified: NvE $Date: 2004/07/06 13:34:16 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/10/20 10:49:44 $ UU-SAP Utrecht
 ///////////////////////////////////////////////////////////////////////////
 
+#include <cstdlib>
 #include "AliEvent.h"
 #include "Riostream.h"
  
 ClassImp(AliEvent) // Class implementation to enable ROOT I/O
  
-AliEvent::AliEvent() : AliVertex()
+AliEvent::AliEvent() : AliVertex(),AliTimestamp()
 {
 // Default constructor.
 // All variables initialised to default values.
- fDaytime.Set();
  fRun=0;
  fEvent=0;
- fAproj=0;
- fZproj=0;
- fPnucProj=0;
- fIdProj=0;
- fAtarg=0;
- fZtarg=0;
- fPnucTarg=0;
- fIdTarg=0;
  fDevices=0;
  fDevCopy=0;
  fHits=0;
  fOrdered=0;
  fDisplay=0;
+ fDevs=0;
 }
 ///////////////////////////////////////////////////////////////////////////
-AliEvent::AliEvent(Int_t n) : AliVertex(n)
+AliEvent::AliEvent(Int_t n) : AliVertex(n),AliTimestamp()
 {
 // Create an event to hold initially a maximum of n tracks
 // All variables initialised to default values
@@ -282,22 +280,14 @@ AliEvent::AliEvent(Int_t n) : AliVertex(n)
  {
   cout << " *** This AliVertex initialisation was invoked via the AliEvent ctor." << endl;
  }
- fDaytime.Set();
  fRun=0;
  fEvent=0;
- fAproj=0;
- fZproj=0;
- fPnucProj=0;
- fIdProj=0;
- fAtarg=0;
- fZtarg=0;
- fPnucTarg=0;
- fIdTarg=0;
  fDevices=0;
  fDevCopy=0;
  fHits=0;
  fOrdered=0;
  fDisplay=0;
+ fDevs=0;
 }
 ///////////////////////////////////////////////////////////////////////////
 AliEvent::~AliEvent()
@@ -323,27 +313,24 @@ AliEvent::~AliEvent()
   delete fDisplay;
   fDisplay=0;
  }
+ if (fDevs)
+ {
+  delete fDevs;
+  fDevs=0;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
-AliEvent::AliEvent(const AliEvent& evt) : AliVertex(evt)
+AliEvent::AliEvent(const AliEvent& evt) : AliVertex(evt),AliTimestamp(evt)
 {
 // Copy constructor.
- fDaytime=evt.fDaytime;
  fRun=evt.fRun;
  fEvent=evt.fEvent;
- fAproj=evt.fAproj;
- fZproj=evt.fZproj;
- fPnucProj=evt.fPnucProj;
- fIdProj=evt.fIdProj;
- fAtarg=evt.fAtarg;
- fZtarg=evt.fZtarg;
- fPnucTarg=evt.fPnucTarg;
- fIdTarg=evt.fIdTarg;
  fDevCopy=evt.fDevCopy;
 
  fHits=0;
  fOrdered=0;
  fDisplay=0;
+ fDevs=0;
 
  fDevices=0;
  Int_t ndevs=evt.GetNdevices();
@@ -378,17 +365,9 @@ void AliEvent::Reset()
 
  AliVertex::Reset();
 
fDaytime.Set();
+ Set();
  fRun=0;
  fEvent=0;
- fAproj=0;
- fZproj=0;
- fPnucProj=0;
- fIdProj=0;
- fAtarg=0;
- fZtarg=0;
- fPnucTarg=0;
- fIdTarg=0;
 
  if (fDevices)
  {
@@ -410,6 +389,11 @@ void AliEvent::Reset()
   delete fDisplay;
   fDisplay=0;
  }
+ if (fDevs)
+ {
+  delete fDevs;
+  fDevs=0;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetOwner(Bool_t own)
@@ -446,7 +430,15 @@ void AliEvent::SetDayTime(TTimeStamp& stamp)
 // Set the date and time stamp for this event.
 // An exact copy of the entered date/time stamp will be saved with an
 // accuracy of 1 nanosecond.
- fDaytime=stamp;
+//
+// Note : Since the introduction of the more versatile class AliTimestamp
+//        and the fact that AliEvent has now been derived from it,
+//        this memberfunction has become obsolete.
+//        It is recommended to use the corresponding AliTimestamp
+//        functionality directly for AliEvent instances.
+//        This memberfunction is only kept for backward compatibility.
+
+ Set(stamp.GetDate(),stamp.GetTime(),0,kTRUE,0);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetDayTime(TDatime& stamp)
@@ -454,11 +446,13 @@ void AliEvent::SetDayTime(TDatime& stamp)
 // Set the date and time stamp for this event.
 // The entered date/time will be interpreted as being the local date/time
 // and the accuracy is 1 second.
+//
 // This function with the TDatime argument is mainly kept for backward
-// compatibility reasons. It is recommended to use the corresponding
-// function with the TTimeStamp argument.
+// compatibility reasons.
+// It is recommended to use the corresponding AliTimestamp functionality
+// directly for AliEvent instances.
 
fDaytime.Set(stamp.GetDate(),stamp.GetTime(),0,kFALSE,0);
+ Set(stamp.GetDate(),stamp.GetTime(),0,kFALSE,0);
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetRunNumber(Int_t run)
@@ -476,7 +470,15 @@ void AliEvent::SetEventNumber(Int_t evt)
 TTimeStamp AliEvent::GetDayTime() const
 {
 // Provide the date and time stamp for this event
- return fDaytime;
+//
+// Note : Since the introduction of the more versatile class AliTimestamp
+//        and the fact that AliEvent has now been derived from it,
+//        this memberfunction has become obsolete.
+//        It is recommended to use the corresponding AliTimestamp
+//        functionality directly for AliEvent instances.
+//        This memberfunction is only kept for backward compatibility.
+
+ return (TTimeStamp)(*this);
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetRunNumber() const
@@ -494,93 +496,191 @@ Int_t AliEvent::GetEventNumber() const
 void AliEvent::SetProjectile(Int_t a,Int_t z,Double_t pnuc,Int_t id)
 {
 // Set the projectile A, Z, momentum per nucleon and user defined particle ID.
-// By default the particle ID is set to zero.
- fAproj=a;
- fZproj=z;
- fPnucProj=pnuc;
- fIdProj=id;
+// If not explicitly specified by the user, the projectile particle ID is set
+// to zero by default and will not be stored in the event structure.
+// The projectile specifications will be stored in a device named "Beam"
+// which is an instance of AliSignal.
+// As such these data are easily retrievable from the event structure.
+// However, for backward compatibility reasons the beam data can also be
+// retrieved via memberfunctions like GetProjectileA() etc...
+
+ Int_t newdev=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (!beam)
+ {
+  beam=new AliSignal();
+  beam->SetNameTitle("Beam","Beam and target specifications");
+  newdev=1;
+ }
+
+ if (a || z)
+ {
+  beam->AddNamedSlot("Aproj");
+  beam->SetSignal(a,"Aproj");
+  beam->AddNamedSlot("Zproj");
+  beam->SetSignal(z,"Zproj");
+ }
+ beam->AddNamedSlot("Pnucproj");
+ beam->SetSignal(pnuc,"Pnucproj");
+ if (id)
+ {
+  beam->AddNamedSlot("Idproj");
+  beam->SetSignal(id,"Idproj");
+ }
+
+ if (newdev)
+ {
+  AddDevice(beam);
+  if (fDevCopy) delete beam;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetProjectileA() const
 {
 // Provide the projectile A value.
- return fAproj;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Aproj"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetProjectileZ() const
 {
 // Provide the projectile Z value.
- return fZproj;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Zproj"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Double_t AliEvent::GetProjectilePnuc() const
 {
 // Provide the projectile momentum value per nucleon.
- return fPnucProj;
+ Double_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=beam->GetSignal("Pnucproj");
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetProjectileId() const
 {
 // Provide the user defined particle ID of the projectile.
- return fIdProj;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Idproj"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetTarget(Int_t a,Int_t z,Double_t pnuc,Int_t id)
 {
 // Set the target A, Z, momentum per nucleon and user defined particle ID.
-// By default the particle ID is set to zero.
- fAtarg=a;
- fZtarg=z;
- fPnucTarg=pnuc;
- fIdTarg=id;
+// If not explicitly specified by the user, the target particle ID is set
+// to zero by default and will not be stored in the event structure.
+// The target specifications will be stored in a device named "Beam"
+// which is an instance of AliSignal.
+// As such these data are easily retrievable from the event structure.
+// However, for backward compatibility reasons the beam data can also be
+// retrieved via memberfunctions like GetTargetA() etc...
+
+ Int_t newdev=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (!beam)
+ {
+  beam=new AliSignal();
+  beam->SetNameTitle("Beam","Beam and target specifications");
+  newdev=1;
+ }
+
+ if (a || z)
+ {
+  beam->AddNamedSlot("Atarg");
+  beam->SetSignal(a,"Atarg");
+  beam->AddNamedSlot("Ztarg");
+  beam->SetSignal(z,"Ztarg");
+ }
+ beam->AddNamedSlot("Pnuctarg");
+ beam->SetSignal(pnuc,"Pnuctarg");
+ if (id)
+ {
+  beam->AddNamedSlot("Idtarg");
+  beam->SetSignal(id,"Idtarg");
+ }
+
+ if (newdev)
+ {
+  AddDevice(beam);
+  if (fDevCopy) delete beam;
+ }
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetTargetA() const
 {
 // Provide the target A value.
- return fAtarg;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Atarg"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetTargetZ() const
 {
 // Provide the target Z value.
- return fZtarg;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Ztarg"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Double_t AliEvent::GetTargetPnuc() const
 {
 // Provide the target momentum value per nucleon.
- return fPnucTarg;
+ Double_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=beam->GetSignal("Pnuctarg");
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetTargetId() const
 {
 // Provide the user defined particle ID of the target.
- return fIdTarg;
+ Int_t val=0;
+ AliSignal* beam=(AliSignal*)GetDevice("Beam");
+ if (beam) val=int(beam->GetSignal("Idtarg"));
+ return val;
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::HeaderData() const
+void AliEvent::HeaderData()
 {
 // Provide event header information
  const char* name=GetName();
  const char* title=GetTitle();
- Int_t ndevs=GetNdevices();
  cout << " *" << ClassName() << "::Data*";
  if (strlen(name))  cout << " Name : " << GetName();
  if (strlen(title)) cout << " Title : " << GetTitle();
  cout << endl;
- cout << "  " << fDaytime.AsString() << endl;
- cout << "  Run : " << fRun << " Event : " << fEvent
-      << " Number of devices : " << ndevs << endl;
-
- if (ndevs) ShowDevices();
+ Date(1);
+ cout << "  Run : " << fRun << " Event : " << fEvent << endl;
+ ShowDevices(0);
+ ShowTracks(0);
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::Data(TString f)
+void AliEvent::Data(TString f,TString u)
 {
 // Provide event 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".
+
  HeaderData();
- AliVertex::Data(f);
+ AliVertex::Data(f,u);
 } 
 ///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetNdevices() const
@@ -591,6 +691,21 @@ Int_t AliEvent::GetNdevices() const
  return ndevs;
 } 
 ///////////////////////////////////////////////////////////////////////////
+Int_t AliEvent::GetNdevices(const char* classname) const
+{
+// Provide the number of stored devices of the specified class.
+
+ Int_t ndevs=0;
+ for (Int_t idev=1; idev<=GetNdevices(); idev++)
+ {
+  TObject* obj=GetDevice(idev);
+  if (!obj) continue;
+
+  if (obj->InheritsFrom(classname)) ndevs++;
+ }
+ return ndevs;
+} 
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::AddDevice(TObject& d)
 {
 // Add a device to the event.
@@ -622,6 +737,20 @@ void AliEvent::AddDevice(TObject& d)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliEvent::RemoveDevice(TObject* d)
+{
+// Remove the specified device from the event.
+
+ if (!fDevices || !d) return;
+
+ TObject* obj=fDevices->Remove(d);
+ if (obj)
+ {
+  if (fDevCopy) delete obj;
+  fDevices->Compress();
+ }
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::SetDevCopy(Int_t j)
 {
 // (De)activate the creation of private copies of the added devices.
@@ -731,24 +860,94 @@ TObject* AliEvent::GetDevice(TString name) const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::ShowDevices() const
+TObject* AliEvent::GetIdDevice(Int_t id,TObjArray* devs) const
+{
+// Return the device with identifier "id" from the specified array "devs".
+// In case devs=0 (which is the default) all devices stored in the event
+// structure will be evaluated.
+// Note : In case of multiple occurrences of identifier "id", the first
+//        encountered matching device will be returned.
+
+ TObjArray* arr=devs;
+ if (!arr) arr=fDevices;
+
+ if (!arr || id<0) return 0;
+
+ Int_t idx=0;
+ for (Int_t i=0; i<arr->GetSize(); i++)
+ {
+  TObject* dev=arr->At(i);
+  if (dev)
+  {
+   idx=dev->GetUniqueID();
+   if (idx==id) return dev;
+  }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::GetIdDevice(Int_t id,const char* classname) const
+{
+// Return the device with identifier "id" of the specified class.
+// Note : In case of multiple occurrences of identifier "id", the first
+//        encountered matching device will be returned.
+
+ if (!fDevices || id<0) return 0;
+
+ Int_t idx=0;
+ for (Int_t i=0; i<GetNdevices(); i++)
+ {
+  TObject* dev=fDevices->At(i);
+  if (dev)
+  {
+   idx=dev->GetUniqueID();
+   if (idx==id && dev->InheritsFrom(classname)) return dev;
+  }
+ }
+ return 0; // No matching id found for the specified class
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::ShowDevices(Int_t mode) const
 {
 // Provide an overview of the available devices.
+// The argument mode determines the amount of information as follows :
+// mode = 0 ==> Only printout of the number of devices
+//        1 ==> Provide a listing with 1 line of info for each device
+//
+// The default is mode=1.
+//
  Int_t ndevs=GetNdevices();
  if (ndevs)
  {
-  cout << " The following " << ndevs << " devices are available :" << endl; 
-  for (Int_t i=1; i<=ndevs; i++)
+  if (!mode)
   {
-   TObject* dev=GetDevice(i);
-   if (dev)
+   cout << " There are " << ndevs << " devices available." << endl; 
+  }
+  else
+  {
+   cout << " The following " << ndevs << " devices are available :" << endl; 
+   Int_t nh=0,nw=0;
+   for (Int_t i=1; i<=ndevs; i++)
    {
-    const char* name=dev->GetName();
-    cout << " Device number : " << i;
-    cout << " Class : " << dev->ClassName();
-    if (strlen(name)) cout << " Name : " << name;
-    if (dev->InheritsFrom("AliDevice")) cout << " Nhits : " << ((AliDevice*)dev)->GetNhits();
-    cout << endl;
+    TObject* dev=GetDevice(i);
+    if (dev)
+    {
+     const char* name=dev->GetName();
+     cout << " Device number : " << i;
+     cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID();
+     if (strlen(name)) cout << " Name : " << name;
+     if (dev->InheritsFrom("AliDevice"))
+     {
+      nh=((AliDevice*)dev)->GetNhits();
+      if (nh) cout << " Nhits : " << nh;
+     }
+     if (dev->InheritsFrom("AliSignal"))
+     {
+      nw=((AliSignal*)dev)->GetNwaveforms();
+      if (nw) cout << " Nwaveforms : " << nw;
+     }
+     cout << endl;
+    }
    }
   }
  }
@@ -758,6 +957,81 @@ void AliEvent::ShowDevices() const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+void AliEvent::ShowDevices(const char* classname,Int_t mode) const
+{
+// Provide an overview of the available devices of the specified class.
+// The argument mode determines the amount of information as follows :
+// mode = 0 ==> Only printout of the number of devices
+//        1 ==> Provide a listing with 1 line of info for each device
+//
+// The default is mode=1.
+//
+ Int_t ndevs=GetNdevices();
+ if (ndevs)
+ {
+  Int_t ndevs2=GetNdevices(classname);
+  if (!mode || !ndevs2)
+  {
+   cout << " There are " << ndevs2 << " selected devices available." << endl; 
+  }
+  else
+  {
+   cout << " The following " << ndevs2 << " selected devices are available :" << endl; 
+   Int_t nh=0,nw=0;
+   for (Int_t i=1; i<=ndevs; i++)
+   {
+    TObject* dev=GetDevice(i);
+    if (dev)
+    {
+     if (dev->InheritsFrom(classname))
+     {
+      const char* name=dev->GetName();
+      cout << " Device number : " << i;
+      cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID();
+      if (strlen(name)) cout << " Name : " << name;
+      if (dev->InheritsFrom("AliDevice"))
+      {
+       nh=((AliDevice*)dev)->GetNhits();
+       if (nh) cout << " Nhits : " << nh;
+      }
+      if (dev->InheritsFrom("AliSignal"))
+      {
+       nw=((AliSignal*)dev)->GetNwaveforms();
+       if (nw) cout << " Nwaveforms : " << nw;
+      }
+      cout << endl;
+     }
+    }
+   }
+  }
+ }
+ else
+ {
+  cout << " No devices present for this event." << endl;
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliEvent::GetDevices(const char* classname)
+{
+// Provide the references to the various devices derived from the
+// specified class.
+ if (fDevs) fDevs->Clear();
+
+ Int_t ndev=GetNdevices();
+ for (Int_t idev=1; idev<=ndev; idev++)
+ {
+  TObject* obj=GetDevice(idev);
+  if (!obj) continue;
+
+  if (obj->InheritsFrom(classname))
+  {
+   if (!fDevs) fDevs=new TObjArray();
+   fDevs->Add(obj);
+  }
+ }
+ return fDevs;
+}
+///////////////////////////////////////////////////////////////////////////
 Int_t AliEvent::GetNhits(const char* classname)
 {
 // Provide the number of hits registered to the specified device class.
@@ -783,6 +1057,28 @@ TObjArray* AliEvent::GetHits(const char* classname)
  return fHits;
 }
 ///////////////////////////////////////////////////////////////////////////
+AliSignal* AliEvent::GetIdHit(Int_t id,const char* classname)
+{
+// Return the hit with unique identifier "id" for the specified device class.
+ if (id<0) return 0;
+
+ Int_t nhits=GetNhits(classname);
+ if (!nhits) return 0;
+
+ AliSignal* sx=0;
+ Int_t sid=0;
+ for (Int_t i=0; i<nhits; i++)
+ {
+  sx=(AliSignal*)fHits->At(i);
+  if (sx)
+  {
+   sid=sx->GetUniqueID();
+   if (id==sid) return sx;
+  }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
 void AliEvent::LoadHits(const char* classname)
 {
 // Load the references to the various hits registered to the specified
@@ -813,7 +1109,7 @@ void AliEvent::LoadHits(const char* classname)
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode)
+TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode,Int_t mcal)
 {
 // Order the references to the various hits registered to the specified
 // device class. The ordered array is returned as a TObjArray.
@@ -824,7 +1120,11 @@ TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode)
 // 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).
 //
 // For more extended functionality see class AliDevice.
 
@@ -833,7 +1133,7 @@ TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode)
  LoadHits(classname);
 
  AliDevice dev;
- TObjArray* ordered=dev.SortHits(idx,mode,fHits);
+ TObjArray* ordered=dev.SortHits(idx,mode,fHits,mcal);
 
  if (fHits)
  {
@@ -844,7 +1144,7 @@ TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode)
  return fHits;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode)
+TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode,Int_t mcal)
 {
 // Order the references to the various hits registered to the specified
 // device class. The ordered array is returned as a TObjArray.
@@ -855,7 +1155,11 @@ TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode)
 // 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).
 //
 // For more extended functionality see class AliDevice.
  
@@ -864,7 +1168,7 @@ TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode)
  LoadHits(classname);
 
  AliDevice dev;
- TObjArray* ordered=dev.SortHits(name,mode,fHits);
+ TObjArray* ordered=dev.SortHits(name,mode,fHits,mcal);
 
  if (fHits)
  {
@@ -875,14 +1179,17 @@ TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode)
  return fHits;
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,Int_t idx)
+void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,Int_t idx,Int_t mode)
 {
 // Provide the min. and max. signal values of the various hits registered
 // to the specified device class.
 // The input argument "idx" denotes the index of the signal slots to be investigated.
 // The default is idx=1;
 // 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).
 //
 // For more extended functionality see class AliDevice.
 
@@ -891,26 +1198,29 @@ void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,Int
  LoadHits(classname);
 
  AliDevice dev;
- dev.GetExtremes(vmin,vmax,idx,fHits);
+ dev.GetExtremes(vmin,vmax,idx,fHits,mode);
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,TString name)
+void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,TString name,Int_t mode)
 {
 // Provide the min. and max. signal values of the various hits registered
 // to the specified device class.
 // The input argument "name" denotes the name of the signal slots to be investigated.
 // 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).
 //
 // For more extended functionality see class AliDevice.
 
  LoadHits(classname);
 
  AliDevice dev;
- dev.GetExtremes(vmin,vmax,name,fHits);
+ dev.GetExtremes(vmin,vmax,name,fHits,mode);
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t dp,Int_t mstyle,Int_t mcol)
+void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t dp,Int_t mode,Int_t mcol)
 {
 // 3D color display of the various hits registered to the specified device class.
 // The user can specify the index (default=1) of the signal slot to perform the display for.
@@ -920,11 +1230,14 @@ void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t d
 // to define the 100% scale. The default is scale=-1.
 // In case dp=1 the owning 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).
 //
 // For more extended functionality see class AliDevice.
 //
@@ -943,7 +1256,7 @@ void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t d
  LoadHits(classname);
 
  AliDevice* dev=new AliDevice();
- dev->DisplayHits(idx,scale,fHits,dp,mstyle,mcol);
+ dev->DisplayHits(idx,scale,fHits,dp,mode,mcol);
 
  if (fDisplay)
  {
@@ -953,7 +1266,7 @@ void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t d
  fDisplay=dev;
 }
 ///////////////////////////////////////////////////////////////////////////
-void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_t dp,Int_t mstyle,Int_t mcol)
+void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_t dp,Int_t mode,Int_t mcol)
 {
 // 3D color display of the various hits registered to the specified device class.
 // The user can specify the name of the signal slot to perform the display for.
@@ -965,11 +1278,14 @@ void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_
 // 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).
 //
 // For more extended functionality see class AliDevice.
 //
@@ -986,7 +1302,7 @@ void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_
  LoadHits(classname);
 
  AliDevice* dev=new AliDevice();
- dev->DisplayHits(name,scale,fHits,dp,mstyle,mcol);
+ dev->DisplayHits(name,scale,fHits,dp,mode,mcol);
 
  if (fDisplay)
  {
@@ -996,7 +1312,7 @@ void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_
  fDisplay=dev;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortDevices(const char* classname,TString name,Int_t mode)
+TObjArray* AliEvent::SortDevices(const char* classname,TString name,Int_t mode,Int_t mcal)
 {
 // Order the references to the various devices based on hit signals registered
 // to the specified device class. The ordered array is returned as a TObjArray.
@@ -1007,18 +1323,22 @@ TObjArray* AliEvent::SortDevices(const char* classname,TString name,Int_t mode)
 // 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).
 //
 
- TObjArray* ordered=SortHits(classname,name,mode);
+ TObjArray* ordered=SortHits(classname,name,mode,mcal);
  
  if (!ordered) return 0;
 
- TObjArray* devs=SortDevices(ordered,"*",0);
+ TObjArray* devs=SortDevices(ordered,"*",0,mcal);
  return devs;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortDevices(const char* classname,Int_t idx,Int_t mode)
+TObjArray* AliEvent::SortDevices(const char* classname,Int_t idx,Int_t mode,Int_t mcal)
 {
 // Order the references to the various devices based on hit signals registered
 // to the specified device class. The ordered array is returned as a TObjArray.
@@ -1029,18 +1349,22 @@ TObjArray* AliEvent::SortDevices(const char* classname,Int_t idx,Int_t mode)
 // 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).
 //
 
- TObjArray* ordered=SortHits(classname,idx,mode);
+ TObjArray* ordered=SortHits(classname,idx,mode,mcal);
  
  if (!ordered) return 0;
 
- TObjArray* devs=SortDevices(ordered,0,0);
+ TObjArray* devs=SortDevices(ordered,0,0,mcal);
  return devs;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortDevices(TObjArray* hits,TString name,Int_t mode)
+TObjArray* AliEvent::SortDevices(TObjArray* hits,TString name,Int_t mode,Int_t mcal)
 {
 // Order the references to the various devices based on hit signals contained
 // in the input array. The ordered array is returned as a TObjArray.
@@ -1054,14 +1378,18 @@ TObjArray* AliEvent::SortDevices(TObjArray* hits,TString name,Int_t mode)
 // the input argument "name" is irrelevant.
 // 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 (!hits) return 0;
 
  TObjArray* ordered=hits;
  AliDevice dev;
- if (mode) ordered=dev.SortHits(name,mode,hits);
+ if (mode) ordered=dev.SortHits(name,mode,hits,mcal);
  
  if (!ordered) return 0;
 
@@ -1096,7 +1424,7 @@ TObjArray* AliEvent::SortDevices(TObjArray* hits,TString name,Int_t mode)
  return fOrdered;
 }
 ///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortDevices(TObjArray* hits,Int_t idx,Int_t mode)
+TObjArray* AliEvent::SortDevices(TObjArray* hits,Int_t idx,Int_t mode,Int_t mcal)
 {
 // Order the references to the various devices based on hit signals contained
 // in the input array. The ordered array is returned as a TObjArray.
@@ -1110,14 +1438,18 @@ TObjArray* AliEvent::SortDevices(TObjArray* hits,Int_t idx,Int_t mode)
 // the input argument "idx" is irrelevant.
 // 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 (!hits) return 0;
 
  TObjArray* ordered=hits;
  AliDevice dev;
- if (mode) ordered=dev.SortHits(idx,mode,hits);
+ if (mode) ordered=dev.SortHits(idx,mode,hits,mcal);
  
  if (!ordered) return 0;