12-oct-2004 NvE Display facility introduced in AliDevice and device backward linking updated for
new "owning device" in AliSignal.
13-oct-2004 NvE Hit investigation facilities extended in AliDevice and AliEvent.
15-oct-2004 NvE Optimisation of MC parameters for nucleus-nucleus and astrophysics processes introduced
in AliCollider. Also facilities added to provide full user control.
// Example :
// ---------
// AliAttrib a;
-// a.SetGain(250.7);
// a.SetSlotName("PMT amplitude in Volt");
-// a.SetGain(1340,3);
+// a.SetGain(250.7);
+// a.SetSlotName("Time of flight in ns",2);
+// a.SetOffset(-22.5,2);
// a.SetSlotName("PMT amplitude in ADC",3);
+// a.SetGain(1340,3);
+// a.SetSlotName("TDC",4);
+// a.SetOffset(10.75,"TDC");
// a.SetEdgeOn(3);
-// a.SetOffset(-22.5,2);
-// a.SetSlotName("Time of flight in ns",2);
// a.SetDead(1);
// a.List();
//
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliCollider.cxx,v 1.11 2004/03/12 09:18:24 nick Exp $
+// $Id: AliCollider.cxx,v 1.12 2004/05/04 15:33:04 nick Exp $
///////////////////////////////////////////////////////////////////////////
// Class AliCollider
//
//
//--- Author: Nick van Eijndhoven 22-nov-2002 Utrecht University
-//- Modified: NvE $Date: 2004/03/12 09:18:24 $ Utrecht University
+//- Modified: NvE $Date: 2004/05/04 15:33:04 $ Utrecht University
///////////////////////////////////////////////////////////////////////////
#include "AliCollider.h"
{
// Default constructor.
// All variables initialised to default values.
+//
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// nucleus-nucleus interactions and astrophysical processes.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of the SetUserControl memberfunction.
+//
+// Refer to the SetElastic memberfunction for the inclusion of elastic
+// and diffractive processes.
+// By default these processes are not included.
+
fVertexmode=0; // No vertex structure creation
fResolution=1e-5; // Standard resolution is 0.1 micron
fRunnum=0;
fEventnum=0;
fPrintfreq=1;
+ fUserctrl=0; // Automatic optimisation of some MC parameters
+ fElastic=0; // No elastic and diffractive processes
fEvent=0;
return fPrintfreq;
}
///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetUserControl(Int_t flag)
+{
+// Set the user control flag w.r.t. disabling automatic optimisation
+// of some Pythia default MC parameters for soft interactions in view of
+// nucleus-nucleus collisions and astrophysical processes.
+// Flag = 0 : Limited user control (automatic optimisation enabled)
+// 1 : Full user control (automatic optimisation disabled)
+// By default the user control is set to 0 (i.e. automatic optimisation).
+// See the Init() memberfunctions for further details w.r.t. the optimisations.
+ fUserctrl=flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::GetUserControl() const
+{
+// Provide the value of the user control flag.
+ return fUserctrl;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliCollider::SetElastic(Int_t flag)
+{
+// Set the flag w.r.t. inclusion of elastic and diffractive processes.
+// By default these processes are not included.
+// Flag = 0 : Do not include elastic and diffractive processes
+// 1 : Elastic and diffractive processes will be included
+ fElastic=flag;
+}
+///////////////////////////////////////////////////////////////////////////
+Int_t AliCollider::GetElastic() const
+{
+// Provide the value of the control flag for elastic and diffractive processes.
+ return fElastic;
+}
+///////////////////////////////////////////////////////////////////////////
void AliCollider::Init(char* frame,char* beam,char* target,Float_t win)
{
// Initialisation of the underlying Pythia generator package.
+// The event number is reset to 0.
// This routine just invokes TPythia6::Initialize(...) and the arguments
// have the corresponding meaning.
-// The event number is reset to 0.
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// astrophysical processes.
+// The optimisations consist of :
+// * Usage of real photons for photon beams of targets
+// * Minimum CMS energy of 3 GeV for the event
+// * Activation of the default K factor values
+// with separate settings for ordinary and color annihilation graphs.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of invoking the SetUserControl memberfunction before this initialisation.
+// Note that the inclusion of elastic and diffractive processes is controlled
+// by invokation of the SetElastic memberfunction before this initialisation,
+// irrespective of the UserControl selection.
+
+ if (!fUserctrl) // Optimisation of some MC parameters
+ {
+ SetMSTP(14,10); // Real photons for photon beams or targets
+ SetPARP(2,3.); // Minimum CMS energy for the event
+ SetMSTP(33,2); // Activate K factor. Separate for ordinary and color annih. graphs
+ }
+
+ if (fElastic) SetMSEL(2); // Include low-Pt, elastic and diffractive events
+
fEventnum=0;
fNucl=0;
fFrame=frame;
{
// Initialisation of the underlying Pythia generator package for the generation
// of nucleus-nucleus interactions.
+// The event number is reset to 0.
// In addition to the Pythia standard arguments 'frame' and 'win', the user
// can specify here (Z,A) values of the projectile and target nuclei.
//
// Note : The 'win' value denotes either the cms energy per nucleon-nucleon collision
// (i.e. frame="cms") or the momentum per nucleon in all other cases.
//
-// The event number is reset to 0.
+// Some Pythia default MC parameters are automatically modified to provide
+// more suitable running conditions for soft processes in view of
+// nucleus-nucleus interactions and astrophysical processes.
+// The optimisations consist of :
+// * Minimum CMS energy of 3 GeV for the event
+// * Activation of the default K factor values
+// with separate settings for ordinary and color annihilation graphs.
+// The user may initialise the generator with all the default Pythia
+// parameters and obtain full user control to modify the settings by means
+// of invoking the SetUserControl memberfunction before this initialisation.
+// Note that the inclusion of elastic and diffractive processes is controlled
+// by invokation of the SetElastic memberfunction before this initialisation,
+// irrespective of the UserControl selection.
+
+ if (!fUserctrl) // Optimisation of some MC parameters
+ {
+ SetPARP(2,3.); // Minimum CMS energy for the event
+ SetMSTP(33,2); // Activate K factor. Separate for ordinary and color annih. graphs
+ }
+
+ if (fElastic) SetMSEL(2); // Include low-Pt, elastic and diffractive events
+
fEventnum=0;
fNucl=1;
fFrame=frame;
}
}
- if (mlist && !(fEventnum%fPrintfreq)) cout << endl; // Create empty output line after the event
+ if (!(fEventnum%fPrintfreq) && (mlist || fEvent))
+ {
+ if (fEvent)
+ {
+ cout << " Number of tracks in the event structure : "
+ << fEvent->GetNtracks() << endl;
+ }
+ cout << endl; // Create empty output line after the event
+ }
if (fOutTree && fSelect) fOutTree->Fill();
}
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-// $Id: AliCollider.h,v 1.8 2004/02/13 11:08:16 nick Exp $
+// $Id: AliCollider.h,v 1.9 2004/05/04 15:33:04 nick Exp $
#include "TPythia6.h"
#include "TString.h"
AliEvent* GetEvent(Int_t select=0) const; // Provide pointer to the generated event structure
void SetSpectatorPmin(Float_t pmin); // Set minimal momentum for spectator track to be stored
Float_t GetSpectatorPmin() const; // Provide the minimal momentum for spectator tracks
+ void SetUserControl(Int_t flag); // Selection of full user control w.r.t. MC parameters.
+ Int_t GetUserControl() const; // Provide the value of the user control flag.
+ void SetElastic(Int_t flag); // Selection flag for elastic and diffractive processes.
+ Int_t GetElastic() const; // Provide the value of the elastic selection flag.
protected:
Int_t fVertexmode; // The vertex structure creation mode
AliRandom fRan; // Random number generator
AliEvent* fEvent; // The produced event structure
Float_t fSpecpmin; // The minimal momentum for spectator tracks to be stored
+ Int_t fUserctrl; // Flag to denote the user control selection w.r.t. MC parameters
+ Int_t fElastic; // Flag to denote inclusion of elastic and difractive processes.
TFile* fOutFile; // The user defined output data file
TTree* fOutTree; // The standard ROOT output tree
fHitCopy=1;
fHits=0;
fOrdered=0;
+ fMarkers=0;
}
///////////////////////////////////////////////////////////////////////////
AliDevice::~AliDevice()
delete fOrdered;
fOrdered=0;
}
+
+ if (fMarkers)
+ {
+ delete fMarkers;
+ fMarkers=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
AliDevice::AliDevice(const AliDevice& dev) : AliSignal(dev)
fHits=0;
fOrdered=0;
+ fMarkers=0;
fHitCopy=dev.GetHitCopy();
fHits->Add(sx->Clone());
AliSignal* s=(AliSignal*)fHits->Last();
s->ResetLinks((AliDevice*)&dev);
- s->AddLink(this);
+ s->SetDevice(this);
}
else
{
void AliDevice::AddHit(AliSignal& s)
{
// Register an AliSignal object as a hit to this device.
-// Note : A (backward) link to this device is added to the first slot of
-// the AliSignal if there was no link to this device already present.
+// Note : In case this device owns the AliSignal object, the pointer to
+// this device will be stored in the special owning device
+// pointer of the AliSignal object.
+// In case this device does not own the AliSignal object, a (backward)
+// link to this device is added to the first slot of the AliSignal
+// if there was no link to this device already present.
+
if (!fHits)
{
fHits=new TObjArray(1);
if (&s==fHits->At(i)) return;
}
- // Set the (backward) link to this device.
- Int_t nlinks=GetNlinks(this);
- if (!nlinks) s.AddLink(this);
+ // Check for existing (backward) link to this device.
+ Int_t nlinks=s.GetNlinks(this);
if (fHitCopy)
{
fHits->Add(s.Clone());
+ // Remove unnecessary backward link(s) from the various slots
+ // and set the owning link to this device
+ AliSignal* sx=(AliSignal*)fHits->Last();
+ if (nlinks) sx->ResetLinks(this);
+ sx->SetDevice(this);
}
else
{
fHits->Add(&s);
+ // Set (backward) link to the this device
+ if (!nlinks) s.AddLink(this);
}
}
///////////////////////////////////////////////////////////////////////////
delete fOrdered;
fOrdered=0;
}
+ if (fMarkers)
+ {
+ delete fMarkers;
+ fMarkers=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
Int_t AliDevice::GetNhits() const
}
}
///////////////////////////////////////////////////////////////////////////
+void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx,TObjArray* hits) 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.
+
+ vmin=0;
+ vmax=0;
+
+ if (!hits) hits=fHits;
+
+ if (idx<=0 || !hits) return;
+
+ Int_t nhits=hits->GetEntries();
+
+ Float_t sig=0;
+ for (Int_t i=0; i<nhits; i++)
+ {
+ AliSignal* sx=(AliSignal*)hits->At(i);
+
+ if (!sx) continue;
+ 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);
+ if (i==0)
+ {
+ vmin=sig;
+ vmax=sig;
+ }
+ else
+ {
+ if (sig<vmin) vmin=sig;
+ if (sig>vmax) vmax=sig;
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliDevice::GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray* hits) 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.
+
+ vmin=0;
+ vmax=0;
+
+ if (!hits) hits=fHits;
+
+ if (!hits) return;
+
+ Int_t nhits=hits->GetEntries();
+
+ Int_t idx=0; // The signal slotindex to perform the sorting on
+
+ Float_t sig=0;
+ for (Int_t i=0; i<nhits; i++)
+ {
+ AliSignal* sx=(AliSignal*)hits->At(i);
+
+ if (!sx) continue;
+
+ // Obtain the slotindex corresponding to the user selection
+ idx=sx->GetSlotIndex(name);
+ if (!idx) continue;
+
+ if (sx->GetDeadValue(idx)) continue; // Only take alive signals
+
+ sig=sx->GetSignal(idx,1);
+ if (i==0)
+ {
+ vmin=sig;
+ vmax=sig;
+ }
+ else
+ {
+ if (sig<vmin) vmin=sig;
+ if (sig>vmax) vmax=sig;
+ }
+ }
+}
+///////////////////////////////////////////////////////////////////////////
TObjArray* AliDevice::SortHits(Int_t idx,Int_t mode,TObjArray* hits)
{
// 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.
// In case hits=0 (default), the registered hits of the current device are used.
-// Note that the original hit array in not modified.
+// Note that the original hit array is not modified.
// A "hit" represents an abstract object which is derived from AliSignal.
// The user can specify the index of the signal slot to perform the sorting on.
// By default the slotindex will be 1.
// 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.
// In case hits=0 (default), the registered hits of the current device are used.
-// Note that the input array in not modified.
+// Note that the input array is not modified.
// A "hit" represents an abstract object which is derived from AliSignal.
// The user can specify the name of the signal slot to perform the sorting on.
// In case no matching slotname is found, the signal will be skipped.
return fOrdered;
}
///////////////////////////////////////////////////////////////////////////
+void AliDevice::DisplayHits(Int_t idx,Float_t scale,TObjArray* hits,Int_t dp,Int_t mstyle,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.
+// The marker size will indicate the absolute value of the signal (specified by the slotindex)
+// as a percentage of the input argument "scale".
+// In case scale<0 the maximum absolute signal value encountered in the hit array will be used
+// to define the 100% scale. The default is scale=-1.
+// In case hits=0 (default), the registered hits of the current device are used.
+// 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.
+// Signals which were declared as "Dead" will not be displayed.
+// The gain etc... corrected signals will be used to determine the marker size.
+//
+// Note :
+// ------
+// Before any display activity, a TCanvas and a TView have to be initiated
+// first by the user like for instance
+//
+// TCanvas* c1=new TCanvas("c1","c1");
+// TView* view=new TView(1);
+// view->SetRange(-1000,-1000,-1000,1000,1000,1000);
+// view->ShowAxis();
+
+ Int_t thisdev=0; // Indicate whether this is the owning device or not
+ if (!hits)
+ {
+ hits=fHits;
+ thisdev=1;
+ }
+
+ if (idx<=0 || !hits) return;
+
+ Int_t nhits=hits->GetEntries();
+ if (!nhits) return;
+
+ Float_t sigmax=fabs(scale);
+ if (scale<0)
+ {
+ Float_t vmin,vmax;
+ GetExtremes(vmin,vmax,idx,hits);
+ sigmax=fabs(vmax);
+ if (fabs(vmin)>sigmax) sigmax=fabs(vmin);
+ }
+
+ if (sigmax <=0) return;
+
+ if (fMarkers)
+ {
+ delete fMarkers;
+ fMarkers=0;
+ }
+ fMarkers=new TObjArray(nhits);
+ fMarkers->SetOwner();
+
+ Float_t pos[3];
+ GetPosition(pos,"car");
+
+ Float_t sig=0;
+ for (Int_t ih=0; ih<nhits; ih++)
+ {
+ AliSignal* sx=(AliSignal*)hits->At(ih);
+ if (!sx) continue;
+ if (!dp)
+ {
+ sx->GetPosition(pos,"car");
+ }
+ else
+ {
+ if (!thisdev)
+ {
+ AliDevice* dev=sx->GetDevice();
+ if (dev) dev->GetPosition(pos,"car");
+ }
+ }
+ sig=sx->GetSignal(idx,1);
+ TPolyMarker3D* m=new TPolyMarker3D();
+ m->SetMarkerStyle(mstyle);
+ m->SetMarkerColor(mcol);
+ m->SetMarkerSize(100.*fabs(sig)/sigmax);
+ m->SetPoint(0,pos[0],pos[1],pos[2]);
+ fMarkers->Add(m);
+ m->Draw();
+ }
+}
+///////////////////////////////////////////////////////////////////////////
+void AliDevice::DisplayHits(TString name,Float_t scale,TObjArray* hits,Int_t dp,Int_t mstyle,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.
+// The marker size will indicate the absolute value of the signal (specified by the slotname)
+// as a percentage of the input argument "scale".
+// In case scale<0 the maximum absolute signal value encountered in the hit array will be used
+// to define the 100% scale. The default is scale=-1.
+// In case hits=0 (default), the registered hits of the current device are used.
+// 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.
+// 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.
+// Signals which were declared as "Dead" will not be displayed.
+// The gain etc... corrected signals will be used to determine the marker size.
+//
+// Note :
+// ------
+// Before any display activity, a TCanvas and a TView have to be initiated
+// first by the user like for instance
+//
+// TCanvas* c1=new TCanvas("c1","c1");
+// TView* view=new TView(1);
+// view->SetRange(-1000,-1000,-1000,1000,1000,1000);
+// view->ShowAxis();
+
+ Int_t thisdev=0; // Indicate whether this is the owning device or not
+ if (!hits)
+ {
+ hits=fHits;
+ thisdev=1;
+ }
+
+ if (!hits) return;
+
+ Int_t nhits=hits->GetEntries();
+
+ if (!nhits) return;
+
+ Float_t sigmax=fabs(scale);
+ if (scale<0)
+ {
+ Float_t vmin,vmax;
+ GetExtremes(vmin,vmax,name,hits);
+ sigmax=fabs(vmax);
+ if (fabs(vmin)>sigmax) sigmax=fabs(vmin);
+ }
+
+ if (sigmax <=0) return;
+
+ if (fMarkers)
+ {
+ delete fMarkers;
+ fMarkers=0;
+ }
+ fMarkers=new TObjArray(nhits);
+ fMarkers->SetOwner();
+
+ Float_t pos[3];
+ GetPosition(pos,"car");
+
+ Int_t idx=0; // The slot index corresponding to the user specified name
+ Float_t sig=0;
+ for (Int_t ih=0; ih<nhits; ih++)
+ {
+ AliSignal* sx=(AliSignal*)hits->At(ih);
+ if (!sx) continue;
+ idx=sx->GetSlotIndex(name);
+ if (!idx) continue;
+ if (!dp)
+ {
+ sx->GetPosition(pos,"car");
+ }
+ else
+ {
+ if (!thisdev)
+ {
+ AliDevice* dev=sx->GetDevice();
+ if (dev) dev->GetPosition(pos,"car");
+ }
+ }
+ sig=sx->GetSignal(idx,1);
+ TPolyMarker3D* m=new TPolyMarker3D();
+ m->SetMarkerStyle(mstyle);
+ m->SetMarkerColor(mcol);
+ m->SetMarkerSize(100.*fabs(sig)/sigmax);
+ m->SetPoint(0,pos[0],pos[1],pos[2]);
+ fMarkers->Add(m);
+ m->Draw();
+ }
+}
+///////////////////////////////////////////////////////////////////////////
TObject* AliDevice::Clone(const char* name) const
{
// Make a deep copy of the current object and provide the pointer to the copy.
// $Id$
+#include "TPolyMarker3D.h"
+
#include "AliSignal.h"
class AliDevice : public AliSignal
virtual void Reset(Int_t mode=0); // Reset registered hits and AliSignal attributes
void ShowHit(Int_t j=0) const; // Show data of the j-th hit (j=0 means all hits)
virtual void Data(TString f="car") const; // Print device and all signal info for coord. frame f
+ void GetExtremes(Float_t& vmin,Float_t& vmax,Int_t idx=1,TObjArray* hits=0) const; // Get min. and max. signal value
+ void GetExtremes(Float_t& vmin,Float_t& vmax,TString name,TObjArray* hits=0) const;// Get min. and max. signal value
TObjArray* SortHits(TString name,Int_t mode=-1,TObjArray* hits=0); // Sort hits by named signal value
TObjArray* SortHits(Int_t idx=1,Int_t mode=-1,TObjArray* hits=0); // Sort hits by indexed signal value
+ void DisplayHits(TString name,Float_t scale=-1,TObjArray* hits=0,Int_t dp=0,Int_t mstyle=8,Int_t mcol=4);// Hit disp.
+ void DisplayHits(Int_t idx=1,Float_t scale=-1,TObjArray* hits=0,Int_t dp=0,Int_t mstyle=8,Int_t mcol=4); // Hit disp.
protected:
Int_t fHitCopy; // Flag to denote making private copies of added hits
TObjArray* fHits; // Array to hold the registered hits
TObjArray* fOrdered; //! Temp. array to hold the ordered hits
+ TObjArray* fMarkers; //! Temp. array to hold the 3D markers for the hit display
- ClassDef(AliDevice,3) // Signal (Hit) handling of a generic device.
+ ClassDef(AliDevice,4) // Signal (Hit) handling of a generic device.
};
#endif
* provided "as is" without express or implied warranty. *
**************************************************************************/
-// $Id: AliEvent.cxx,v 1.23 2004/07/01 14:28:50 nick Exp $
+// $Id: AliEvent.cxx,v 1.24 2004/07/06 13:34:16 nick Exp $
///////////////////////////////////////////////////////////////////////////
// Class AliEvent
// Note : All quantities are in GeV, GeV/c or GeV/c**2
//
//--- Author: Nick van Eijndhoven 27-may-2001 UU-SAP Utrecht
-//- Modified: NvE $Date: 2004/07/01 14:28:50 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/07/06 13:34:16 $ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
#include "AliEvent.h"
fDevices=0;
fDevCopy=0;
fHits=0;
+ fOrdered=0;
+ fDisplay=0;
}
///////////////////////////////////////////////////////////////////////////
AliEvent::AliEvent(Int_t n) : AliVertex(n)
fDevices=0;
fDevCopy=0;
fHits=0;
+ fOrdered=0;
+ fDisplay=0;
}
///////////////////////////////////////////////////////////////////////////
AliEvent::~AliEvent()
delete fHits;
fHits=0;
}
+ if (fOrdered)
+ {
+ delete fOrdered;
+ fOrdered=0;
+ }
+ if (fDisplay)
+ {
+ delete fDisplay;
+ fDisplay=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
AliEvent::AliEvent(const AliEvent& evt) : AliVertex(evt)
fIdTarg=evt.fIdTarg;
fDevCopy=evt.fDevCopy;
+ fHits=0;
+ fOrdered=0;
+ fDisplay=0;
+
fDevices=0;
Int_t ndevs=evt.GetNdevices();
if (ndevs)
}
}
}
-
- fHits=0;
- if (evt.fHits)
- {
- Int_t nhits=evt.fHits->GetEntries();
- if (nhits)
- {
- fHits=new TObjArray(nhits);
- for (Int_t ih=0; ih<nhits; ih++)
- {
- AliSignal* sx=(AliSignal*)evt.fHits->At(ih);
- fHits->Add(sx);
- }
- }
- }
}
///////////////////////////////////////////////////////////////////////////
void AliEvent::Reset()
delete fHits;
fHits=0;
}
+ if (fOrdered)
+ {
+ delete fOrdered;
+ fOrdered=0;
+ }
+ if (fDisplay)
+ {
+ delete fDisplay;
+ fDisplay=0;
+ }
}
///////////////////////////////////////////////////////////////////////////
void AliEvent::SetOwner(Bool_t own)
}
}
///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortHits(TObjArray* hits,Int_t idx,Int_t mode)
+TObjArray* AliEvent::SortHits(const char* classname,Int_t idx,Int_t mode)
{
-// 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.
-// Note that the input array is not modified.
+// Order the references to the various hits registered to the specified
+// device class. The ordered array is returned as a TObjArray.
// A "hit" represents an abstract object which is derived from AliSignal.
// The user can specify the index of the signal slot to perform the sorting on.
// By default the slotindex will be 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.
+//
+// For more extended functionality see class AliDevice.
+
+ if (idx<=0 || abs(mode)!=1) return 0;
+
+ LoadHits(classname);
+
+ AliDevice dev;
+ TObjArray* ordered=dev.SortHits(idx,mode,fHits);
if (fHits)
{
delete fHits;
fHits=0;
}
-
- if (idx<=0 || abs(mode)!=1 || !hits) return fHits;
-
- AliDevice dev;
- TObjArray* ordered=dev.SortHits(idx,mode,hits);
if (ordered) fHits=new TObjArray(*ordered);
return fHits;
}
///////////////////////////////////////////////////////////////////////////
-TObjArray* AliEvent::SortHits(TObjArray* hits,TString name,Int_t mode)
+TObjArray* AliEvent::SortHits(const char* classname,TString name,Int_t mode)
{
-// 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.
-// Note that the input array is not modified.
+// Order the references to the various hits registered to the specified
+// device class. The ordered array is returned as a TObjArray.
// A "hit" represents an abstract object which is derived from AliSignal.
// The user can specify the name of the signal slot to perform the sorting on.
// In case no matching slotname is found, the signal will be skipped.
// 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.
+//
+// For more extended functionality see class AliDevice.
+
+ if (abs(mode)!=1) return 0;
+
+ LoadHits(classname);
+
+ AliDevice dev;
+ TObjArray* ordered=dev.SortHits(name,mode,fHits);
if (fHits)
{
delete fHits;
fHits=0;
}
+ if (ordered) fHits=new TObjArray(*ordered);
+ return fHits;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,Int_t idx)
+{
+// 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.
+//
+// For more extended functionality see class AliDevice.
+
+ if (idx<=0) return;
+
+ LoadHits(classname);
+
+ AliDevice dev;
+ dev.GetExtremes(vmin,vmax,idx,fHits);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,TString name)
+{
+// 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.
+//
+// For more extended functionality see class AliDevice.
+
+ LoadHits(classname);
+
+ AliDevice dev;
+ dev.GetExtremes(vmin,vmax,name,fHits);
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::DisplayHits(const char* classname,Int_t idx,Float_t scale,Int_t dp,Int_t mstyle,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.
+// The marker size will indicate the absolute value of the signal (specified by the slotindex)
+// as a percentage of the input argument "scale".
+// In case scale<0 the maximum absolute signal value encountered in the hit array will be used
+// 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.
+// Signals which were declared as "Dead" will not be displayed.
+// The gain etc... corrected signals will be used to determine the marker size.
+//
+// For more extended functionality see class AliDevice.
+//
+// Note :
+// ------
+// Before any display activity, a TCanvas and a TView have to be initiated
+// first by the user like for instance
+//
+// TCanvas* c1=new TCanvas("c1","c1");
+// TView* view=new TView(1);
+// view->SetRange(-1000,-1000,-1000,1000,1000,1000);
+// view->ShowAxis();
+
+ if (idx<=0) return;
+
+ LoadHits(classname);
+
+ AliDevice* dev=new AliDevice();
+ dev->DisplayHits(idx,scale,fHits,dp,mstyle,mcol);
+
+ if (fDisplay)
+ {
+ delete fDisplay;
+ fDisplay=0;
+ }
+ fDisplay=dev;
+}
+///////////////////////////////////////////////////////////////////////////
+void AliEvent::DisplayHits(const char* classname,TString name,Float_t scale,Int_t dp,Int_t mstyle,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.
+// The marker size will indicate the absolute value of the signal (specified by the slotname)
+// as a percentage of the input argument "scale".
+// In case scale<0 the maximum absolute signal value encountered in the hit array will be used
+// 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.
+// 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.
+// Signals which were declared as "Dead" will not be displayed.
+// The gain etc... corrected signals will be used to determine the marker size.
+//
+// For more extended functionality see class AliDevice.
+//
+// Note :
+// ------
+// Before any display activity, a TCanvas and a TView have to be initiated
+// first by the user like for instance
+//
+// TCanvas* c1=new TCanvas("c1","c1");
+// TView* view=new TView(1);
+// view->SetRange(-1000,-1000,-1000,1000,1000,1000);
+// view->ShowAxis();
+
+ LoadHits(classname);
+
+ AliDevice* dev=new AliDevice();
+ dev->DisplayHits(name,scale,fHits,dp,mstyle,mcol);
+
+ if (fDisplay)
+ {
+ delete fDisplay;
+ fDisplay=0;
+ }
+ fDisplay=dev;
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliEvent::SortDevices(const char* classname,TString name,Int_t mode)
+{
+// 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.
+// A "hit" represents an abstract object which is derived from AliSignal.
+// The user can specify the name of the signal slot to perform the sorting on.
+// In case no matching slotname is found, the signal will be skipped.
+// Via the "mode" argument the user can specify ordering in decreasing
+// 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.
+//
+
+ TObjArray* ordered=SortHits(classname,name,mode);
+
+ if (!ordered) return 0;
+
+ TObjArray* devs=SortDevices(ordered,"*",0);
+ return devs;
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliEvent::SortDevices(const char* classname,Int_t idx,Int_t mode)
+{
+// 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.
+// A "hit" represents an abstract object which is derived from AliSignal.
+// The user can specify the index of the signal slot to perform the sorting on.
+// By default the slotindex will be 1.
+// Via the "mode" argument the user can specify ordering in decreasing
+// 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.
+//
+
+ TObjArray* ordered=SortHits(classname,idx,mode);
- if (abs(mode)!=1 || !hits) return fHits;
+ if (!ordered) return 0;
+ TObjArray* devs=SortDevices(ordered,0,0);
+ return devs;
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliEvent::SortDevices(TObjArray* hits,TString name,Int_t mode)
+{
+// Order the references to the various devices based on hit signals contained
+// in the input array. The ordered array is returned as a TObjArray.
+// A "hit" represents an abstract object which is derived from AliSignal.
+// The user can specify the name of the signal slot to perform the sorting on.
+// In case no matching slotname is found, the signal will be skipped.
+// Via the "mode" argument the user can specify ordering in decreasing
+// order (mode=-1), ordering in increasing order (mode=1) or no ordering (mode=0).
+// The latter option provides a means to quickly obtain an ordered devices list
+// when the hits in the array were already ordered by the user. In this case
+// 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.
+//
+
+ if (!hits) return 0;
+
+ TObjArray* ordered=hits;
AliDevice dev;
- TObjArray* ordered=dev.SortHits(name,mode,hits);
- if (ordered) fHits=new TObjArray(*ordered);
- return fHits;
+ if (mode) ordered=dev.SortHits(name,mode,hits);
+
+ if (!ordered) return 0;
+
+ if (fOrdered)
+ {
+ fOrdered->Clear();
+ }
+ else
+ {
+ fOrdered=new TObjArray();
+ }
+
+ Int_t nhits=ordered->GetEntries();
+ Int_t exist=0;
+ for (Int_t ih=0; ih<nhits; ih++)
+ {
+ AliSignal* sx=(AliSignal*)ordered->At(ih);
+ if (!sx) continue;
+ AliDevice* dx=sx->GetDevice();
+ exist=0;
+ for (Int_t id=0; id<fOrdered->GetEntries(); id++)
+ {
+ AliDevice* odx=(AliDevice*)fOrdered->At(id);
+ if (dx==odx)
+ {
+ exist=1;
+ break;
+ }
+ }
+ if (!exist) fOrdered->Add(dx);
+ }
+ return fOrdered;
+}
+///////////////////////////////////////////////////////////////////////////
+TObjArray* AliEvent::SortDevices(TObjArray* hits,Int_t idx,Int_t mode)
+{
+// Order the references to the various devices based on hit signals contained
+// in the input array. The ordered array is returned as a TObjArray.
+// A "hit" represents an abstract object which is derived from AliSignal.
+// The user can specify the index of the signal slot to perform the sorting on.
+// By default the slotindex will be 1.
+// Via the "mode" argument the user can specify ordering in decreasing
+// order (mode=-1), ordering in increasing order (mode=1) or no ordering (mode=0).
+// The latter option provides a means to quickly obtain an ordered devices list
+// when the hits in the array were already ordered by the user. In this case
+// 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.
+//
+
+ if (!hits) return 0;
+
+ TObjArray* ordered=hits;
+ AliDevice dev;
+ if (mode) ordered=dev.SortHits(idx,mode,hits);
+
+ if (!ordered) return 0;
+
+ if (fOrdered)
+ {
+ fOrdered->Clear();
+ }
+ else
+ {
+ fOrdered=new TObjArray();
+ }
+
+ Int_t nhits=ordered->GetEntries();
+ Int_t exist=0;
+ for (Int_t ih=0; ih<nhits; ih++)
+ {
+ AliSignal* sx=(AliSignal*)ordered->At(ih);
+ if (!sx) continue;
+ AliDevice* dx=sx->GetDevice();
+ exist=0;
+ for (Int_t id=0; id<fOrdered->GetEntries(); id++)
+ {
+ AliDevice* odx=(AliDevice*)fOrdered->At(id);
+ if (dx==odx)
+ {
+ exist=1;
+ break;
+ }
+ }
+ if (!exist) fOrdered->Add(dx);
+ }
+ return fOrdered;
}
///////////////////////////////////////////////////////////////////////////
TObject* AliEvent::Clone(const char* name) const
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-// $Id: AliEvent.h,v 1.17 2004/06/29 11:29:37 nick Exp $
+// $Id: AliEvent.h,v 1.18 2004/07/06 13:34:17 nick Exp $
#include <math.h>
TObject* GetDevice(TString name) const; // Provide device with name "name"
Int_t GetNhits(const char* classname); // Provide number of hits for the specified device class
TObjArray* GetHits(const char* classname); // Provide refs to all hits of the specified device class
- TObjArray* SortHits(TObjArray* hits,TString name,Int_t mode=-1); // Sort hits by named signal value
- TObjArray* SortHits(TObjArray* hits,Int_t idx=1,Int_t mode=-1); // Sort hits by indexed signal value
+ TObjArray* SortHits(const char* classname,TString name,Int_t mode=-1); // Sort hits by named signal value
+ TObjArray* SortHits(const char* classname,Int_t idx=1,Int_t mode=-1); // Sort hits by indexed signal value
+ void GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,Int_t idx=1); // Get min. and max. signal value
+ void GetExtremes(const char* classname,Float_t& vmin,Float_t& vmax,TString name);// Get min. and max. signal value
+ void DisplayHits(const char* classname,TString name,Float_t scale=-1,Int_t dp=0,Int_t mstyle=8,Int_t mcol=4);
+ void DisplayHits(const char* classname,Int_t idx=1,Float_t scale=-1,Int_t dp=0,Int_t mstyle=8,Int_t mcol=4);
+ TObjArray* SortDevices(const char* classname,TString name,Int_t mode=-1); // Sort devices by signal value
+ TObjArray* SortDevices(const char* classname,Int_t idx=1,Int_t mode=-1); // Sort devices by signal value
+ TObjArray* SortDevices(TObjArray* hits,TString name,Int_t mode=-1); // Sort devices by signal value
+ TObjArray* SortDevices(TObjArray* hits,Int_t idx=1,Int_t mode=-1); // Sort devices by signal value
protected:
TTimeStamp fDaytime; // The date and time stamp
Int_t fDevCopy; // Flag to denote creation of private copies of the devices
void LoadHits(const char* classname); // Load references to the hits registered to the specified device class
TObjArray* fHits; //! Temp. array to hold references to the registered AliDevice hits
+ TObjArray* fOrdered; //! Temp. array to hold references to various ordered objects
+ TObject* fDisplay; //! Temp. pointer to hold objects which serve event displays
- ClassDef(AliEvent,15) // Creation and investigation of an Alice physics event.
+ ClassDef(AliEvent,16) // Creation and investigation of an Alice physics event.
};
#endif
//
// AliSignal q; // In the example below a signal contains the
// // following data : timing, ADC and dE/dx
-// q.SetName("TOF hit");
+// q.SetNameTitle("Hybrid","Test for multiple signal data");
// q.SetPosition(pos,"car");
// q.SetPositionErrors(err,"car");
// signal=82.5; // e.g. signal time in ns
// error=2.01;
// offset=0.003;
+// q.SetSlotName("TOF");
// q.SetSignal(signal,1);
// q.SetSignalError(error,1);
// q.SetOffset(offset,1);
// signal=268.1; // e.g. ADC value of signal
// error=3.75;
// gain=120.78;
-// q.SetSignal(signal,2);
-// q.SetSignalError(error,2);
-// q.SetGain(gain,2);
+// // Addressing via name specification instead of index
+// q.SetSlotName("ADC");
+// q.SetSignal(signal,"ADC");
+// q.SetSignalError(error,"ADC");
+// q.SetGain(gain,"ADC");
// signal=23.7; // e.g. corresponding dE/dx value
// error=0.48;
// offset=0.2;
// gain=150;
+// q.SetSlotName("dE/dx");
// q.SetSignal(signal,3);
// q.SetSignalError(error,3);
// q.SetOffset(offset,3);
// q.SetGain(gain,3);
//
+// Float_t dedx=q.GetSignal("dE/dx");
+//
//--- Author: Nick van Eijndhoven 23-jan-1999 UU-SAP Utrecht
//- Modified: NvE $Date$ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
fDsignals=0;
fWaveforms=0;
fLinks=0;
+ fDevice=0;
}
///////////////////////////////////////////////////////////////////////////
AliSignal::~AliSignal()
fWaveforms=0;
fLinks=0;
+ // Don't copy the owning device pointer for the copy
+ fDevice=0;
+
Int_t n=s.GetNvalues();
Double_t val;
for (Int_t i=1; i<=n; i++)
}
if (fLinks) fLinks->Reset();
+ fDevice=0;
}
///////////////////////////////////////////////////////////////////////////
void AliSignal::ResetSignals(Int_t mode)
cout << endl;
cout << " Position";
Ali3Vector::Data(f);
+ if (fDevice)
+ {
+ const char* devname=fDevice->GetName();
+ const char* devtitle=fDevice->GetTitle();
+ cout << " Owned by device : " << fDevice->ClassName();
+ if (strlen(devname)) cout << " Name : " << devname;
+ if (strlen(devtitle)) cout << " Title : " << devtitle;
+ cout << endl;
+ }
List(-1);
}
return swap;
}
///////////////////////////////////////////////////////////////////////////
+void AliSignal::SetDevice(TObject* dev)
+{
+// Store the pointer to the device which owns this AliSignal object.
+// This memberfunction is meant for internal use in AliDevice.
+ fDevice=dev;
+}
+///////////////////////////////////////////////////////////////////////////
+AliDevice* AliSignal::GetDevice() const
+{
+// Provide the pointer to the device which owns this AliSignal object.
+ return (AliDevice*)fDevice;
+}
+///////////////////////////////////////////////////////////////////////////
TObject* AliSignal::Clone(const char* name) const
{
// Make a deep copy of the current object and provide the pointer to the copy.
#include "AliAttrib.h"
#include "AliObjMatrix.h"
+class AliDevice;
+
class AliSignal : public TNamed,public AliPosition,public AliAttrib
{
public:
void ResetLinks(TObject* obj,TString name,Int_t k=0); // Reset link(s) to object obj for name-specified slot
void SetSwapMode(Int_t swap=1); // Set swapmode flag for the link storage
Int_t GetSwapMode() const; // Provide swapmode flag for the link storage
+ void SetDevice(TObject* dev); // Store pointer to the device that owns this signal
+ AliDevice* GetDevice() const; // Provide pointer to the owning device
protected:
TArrayF* fSignals; // Signal values
TArrayF* fDsignals; // Errors on signal values
TObjArray* fWaveforms; // The 1D histograms containing the signal waveforms
AliObjMatrix* fLinks; // Pointers of objects related to the various slots
+ TObject* fDevice; // Pointer to the device that owns this signal
- ClassDef(AliSignal,12) // Generic handling of (extrapolated) detector signals.
+ ClassDef(AliSignal,13) // Generic handling of (extrapolated) detector signals.
};
#endif
Default for AliDevice changed such that now all registered hits are by default owned
by the AliDevice object.
06-oct-2004 NvE Full support for data access via slotname specification introduced in AliAttrib and AliSignal.
+07-oct-2004 NvE Docs of AliAttrib and AliSignal updated for new data access via slotname specification.
+12-oct-2004 NvE Display facility introduced in AliDevice and device backward linking updated for
+ new "owning device" in AliSignal.
+13-oct-2004 NvE Hit investigation facilities extended in AliDevice and AliEvent.
+15-oct-2004 NvE Optimisation of MC parameters for nucleus-nucleus and astrophysics processes introduced
+ in AliCollider. Also facilities added to provide full user control.
goto end
:end
+rem --- Go back to original directory
+cd scripts
rem --- End of script ---