addressing specific signals or devices during data analysis.
Memberfunction GetIdHit introduced in AliDevice and AliEvent and AliJet::GetIdTrack
optimised for speed.
Memberfunction GetIdDevice introduced in AliEvent.
}
}
///////////////////////////////////////////////////////////////////////////
+AliSignal* AliDevice::GetIdHit(Int_t id) const
+{
+// Return the hit with unique identifier "id".
+ if (!fHits || id<0) return 0;
+
+ AliSignal* sx=0;
+ Int_t sid=0;
+ for (Int_t i=0; i<GetNhits(); i++)
+ {
+ sx=(AliSignal*)fHits->At(i);
+ if (sx)
+ {
+ sid=sx->GetUniqueID();
+ if (id==sid) return sx;
+ }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
TObjArray* AliDevice::GetHits()
{
// Provide the references to all the registered hits.
void RemoveHits(); // Remove all AliSignals as hits from this module
Int_t GetNhits() const; // Provide number of registered hits
AliSignal* GetHit(Int_t j) const; // Access to the AliSignal registered as hit number j
+ AliSignal* GetIdHit(Int_t id) const; // Provide the hit with unique identifier "id"
TObjArray* GetHits(); // Provide the references to all the registered hits
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)
TObjArray* fOrdered; //! Temp. array to hold the ordered hits
TObjArray* fMarkers; //! Temp. array to hold the 3D markers for the hit display
- ClassDef(AliDevice,4) // Signal (Hit) handling of a generic device.
+ ClassDef(AliDevice,5) // Signal (Hit) handling of a generic device.
};
#endif
* 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
// 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/06 13:34:16 $ UU-SAP Utrecht
+//- Modified: NvE $Date: 2004/10/20 10:49:44 $ UU-SAP Utrecht
///////////////////////////////////////////////////////////////////////////
#include "AliEvent.h"
}
}
///////////////////////////////////////////////////////////////////////////
+TObject* AliEvent::GetIdDevice(Int_t id) const
+{
+// Return the device with unique identifier "id".
+ 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) return dev;
+ }
+ }
+ return 0; // No matching id found
+}
+///////////////////////////////////////////////////////////////////////////
void AliEvent::ShowDevices() const
{
// Provide an overview of the available devices.
{
const char* name=dev->GetName();
cout << " Device number : " << i;
- cout << " Class : " << dev->ClassName();
+ cout << " Class : " << dev->ClassName() << " Id : " << dev->GetUniqueID();
if (strlen(name)) cout << " Name : " << name;
if (dev->InheritsFrom("AliDevice")) cout << " Nhits : " << ((AliDevice*)dev)->GetNhits();
cout << endl;
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
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice */
-// $Id: AliEvent.h,v 1.18 2004/07/06 13:34:17 nick Exp $
+// $Id: AliEvent.h,v 1.19 2004/10/20 10:49:44 nick Exp $
#include <math.h>
Int_t GetNdevices() const; // Provide the number of devices
void ShowDevices() const; // Provide on overview of the available devices
TObject* GetDevice(Int_t i) const; // Provide i-th device of the event
- TObject* GetDevice(TString name) const; // Provide device with name "name"
+ TObject* GetDevice(TString name) const; // Provide the device with name "name"
+ TObject* GetIdDevice(Int_t id) const; // Provide the device with unique identifier "id"
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
+ AliSignal* GetIdHit(Int_t id,const char* classname); // Provide hit with unique "id" for the specified device class
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
TObjArray* fOrdered; //! Temp. array to hold references to various ordered objects
TObject* fDisplay; //! Temp. pointer to hold objects which serve event displays
- ClassDef(AliEvent,16) // Creation and investigation of an Alice physics event.
+ ClassDef(AliEvent,17) // Creation and investigation of an Alice physics event.
};
#endif
AliTrack* AliJet::GetIdTrack(Int_t id) const
{
// Return the track with user identifier "id" of this jet
+ if (!fTracks) return 0;
+
AliTrack* tx=0;
- AliTrack* t=0;
- if (!fTracks)
- {
- cout << " *AliJet*::GetIdTrack* No tracks present." << endl;
- return 0;
- }
- else
+ for (Int_t i=0; i<fNtrk; i++)
{
- for (Int_t i=0; i<fNtrk; i++)
- {
- tx=(AliTrack*)fTracks->At(i);
- if (id == tx->GetId()) t=tx;
- }
- return t;
+ tx=(AliTrack*)fTracks->At(i);
+ if (id == tx->GetId()) return tx;
}
+ return 0; // No matching id found
}
///////////////////////////////////////////////////////////////////////////
Double_t AliJet::GetPt()
// The default when invoking Reset() corresponds to mode=0.
//
// Note : In all cases the storage of the various links will be reset.
+// The UniqueID, name and title will NOT be reset.
+// In case the user wants to reset these attributes, this has to
+// be done explicitly via the SET facilities.
//
// The usage of mode=0 allows to re-use the allocated memory for new
// signal (and error) values. This behaviour is preferable (i.e. faster)
const char* name=GetName();
const char* title=GetTitle();
- cout << " *" << ClassName() << "::Data*";
+ cout << " *" << ClassName() << "::Data* Id :" << GetUniqueID();
if (strlen(name)) cout << " Name : " << name;
if (strlen(title)) cout << " Title : " << title;
cout << endl;
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.
+26-nov-2004 NvE Printout of UniqueID added in AliSignal::Data() and AliEvent::ShowDevices() in view of
+ addressing specific signals or devices during data analysis.
+ Memberfunction GetIdHit introduced in AliDevice and AliEvent and AliJet::GetIdTrack
+ optimised for speed.
+ Memberfunction GetIdDevice introduced in AliEvent.