/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /***************************************************************** AliStarEvent: Event container for star data origin: Mikolaj Krzewicki (mikolaj.krzewicki@cern.ch) *****************************************************************/ #include #include #include "AliStarTrack.h" #include "AliStarEvent.h" ClassImp(AliStarEvent) //______________________________________________________________________________ AliStarEvent::AliStarEvent(): TObject(), fParams(), fTracks(NULL) { //ctor } //______________________________________________________________________________ AliStarEvent::AliStarEvent( Int_t n ): TObject(), fParams(), fTracks(new TObjArray(n) ) { //ctor } //______________________________________________________________________________ AliStarEvent::AliStarEvent( const AliStarEvent& event ): TObject(event), fParams(), fTracks((TObjArray*)(event.fTracks)->Clone()) { //copy ctor memcpy(fParams,event.fParams,fgkNparams*sizeof(Float_t)); } //______________________________________________________________________________ AliStarEvent& AliStarEvent::operator=( const AliStarEvent& event ) { //assignment if (this == &event) return *this; TObject::operator=(event); memcpy(fParams,event.fParams,fgkNparams*sizeof(Float_t)); if (fTracks) fTracks->Delete(); delete fTracks; if (event.fTracks) fTracks = (TObjArray*)(event.fTracks)->Clone(); //deep copy return *this; } //______________________________________________________________________________ void AliStarEvent::SetParams( const Float_t* params ) { //set params memcpy(fParams,params,fgkNparams*sizeof(Float_t)); } //______________________________________________________________________________ AliStarEvent::~AliStarEvent() { //dtor if (fTracks) fTracks->Delete(); delete fTracks; } //______________________________________________________________________________ const AliStarTrack* AliStarEvent::GetTrack( const Int_t i ) const { //get track i if (!fTracks) return NULL; return static_cast(fTracks->At(i)); } //______________________________________________________________________________ void AliStarEvent::AddTrack( AliStarTrack* track ) { //add a new track to collection if (!fTracks) return; fTracks->Add(track); } //______________________________________________________________________________ void AliStarEvent::Reset() { //remove all tracks if any and zero the event information if (!fTracks) { fTracks=new TObjArray(1024); return; } fTracks->Delete(); for (Int_t i=0;i( fTracks->First() ); if (!track) return; track->Print("legend"); fTracks->Print(); } //______________________________________________________________________________ Int_t AliStarEvent::CalculateCentrality( Int_t referenceMultiplicity ) const { // Note Carefully: Centrality is based on refMult. This is the 'reference' multiplicity that is measured // independpently from the TPC. Selecting the centrality bins according to the refMult is something that // is calibrated for each year and each run. You can get the basic information off the web: // For Example .... http://www.star.bnl.gov/protected/common/common2004/trigger2004/200gev/200gevFaq.html // An index pointing to FAQs, Trigger and Centrality data, for all years, is available at: // http://www.star.bnl.gov/public/all // // Note: Add 0.5 to the (int) that is returned by centrality() when using it as an argument for a histogram // that expects (float) or (double) as input parameters. This will place the data point in the center of // the bin, avoids ambiguities, and is best for plotting scatter plots and contour plots. // For example histogram2D[1] -> Fill ( (float)CentralityID + 0.5 , SumData ) ; // // The refMult quoted in the Centrality bins array is the lower limit on refMult Int_t centralityBins [] = { 14 , 31 , 57 , 96 , 150 , 222 , 319 , 441 , 520 , 1000 } ; // Run4 200 GeV Int_t middleBinID [] = { 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ; // ID Number //Info middleBinPercent[] = { 85., 75., 65., 55., 45., 35., 25., 15., 7.5 , 2.5 } ; // Percent Int_t myCentrality ; if ( referenceMultiplicity < centralityBins[0] ) { myCentrality = middleBinID[0] ; } else if ( referenceMultiplicity < centralityBins[1] ) { myCentrality = middleBinID[1] ; } else if ( referenceMultiplicity < centralityBins[2] ) { myCentrality = middleBinID[2] ; } else if ( referenceMultiplicity < centralityBins[3] ) { myCentrality = middleBinID[3] ; } else if ( referenceMultiplicity < centralityBins[4] ) { myCentrality = middleBinID[4] ; } else if ( referenceMultiplicity < centralityBins[5] ) { myCentrality = middleBinID[5] ; } else if ( referenceMultiplicity < centralityBins[6] ) { myCentrality = middleBinID[6] ; } else if ( referenceMultiplicity < centralityBins[7] ) { myCentrality = middleBinID[7] ; } else if ( referenceMultiplicity < centralityBins[8] ) { myCentrality = middleBinID[8] ; } else { myCentrality = middleBinID[9] ; } return myCentrality ; }