]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RALICE/AliDevice.cxx
13-nov-2005 NvE IceF2k updated to store also the event trigger information in the...
[u/mrichter/AliRoot.git] / RALICE / AliDevice.cxx
index d28ccedbd736b8d1d8fb229307a0d92894790593..89f917c8f2f1b34f08e1afb1a61d5509fc46dc64 100644 (file)
@@ -331,6 +331,28 @@ AliSignal* AliDevice::GetHit(Int_t j) const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
+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".
@@ -377,11 +399,19 @@ void AliDevice::ShowHit(Int_t j) const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-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)
  {
@@ -394,14 +424,17 @@ void AliDevice::Data(TString f) const
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-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;
@@ -421,7 +454,7 @@ void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx,TObjArray* hit
   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;
@@ -435,13 +468,16 @@ void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx,TObjArray* hit
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-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;
@@ -467,7 +503,7 @@ void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray*
 
   if (sx->GetDeadValue(idx)) continue; // Only take alive signals
 
-  sig=sx->GetSignal(idx,1);
+  sig=sx->GetSignal(idx,mode);
   if (i==0)
   {
    vmin=sig;
@@ -481,7 +517,7 @@ void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray*
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-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.
@@ -494,7 +530,11 @@ TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits)
 // 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)
  {
@@ -542,8 +582,8 @@ TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits)
     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
@@ -551,13 +591,13 @@ TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits)
     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.
@@ -570,7 +610,11 @@ TObjArray* AliDevice::SortHits(TString name,Int_t mode,TObjArray* hits)
 // 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)
  {
@@ -623,8 +667,8 @@ TObjArray* AliDevice::SortHits(TString name,Int_t mode,TObjArray* hits)
     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
@@ -632,13 +676,13 @@ TObjArray* AliDevice::SortHits(TString name,Int_t mode,TObjArray* hits)
     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.
@@ -650,11 +694,14 @@ void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int
 // 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 :
 // ------
@@ -682,7 +729,7 @@ void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int
  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);
  }
@@ -717,9 +764,13 @@ void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int
     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]);
@@ -728,7 +779,7 @@ void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int
  }
 }
 ///////////////////////////////////////////////////////////////////////////
-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.
@@ -742,11 +793,14 @@ void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,
 // 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 :
 // ------
@@ -775,7 +829,7 @@ void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,
  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);
  }
@@ -813,9 +867,13 @@ void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,
     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]);