-/**************************************************************************
+/*************************************************************************
* Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: The ALICE Off-line Project. *
* 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. *
- **************************************************************************/
-/* $Id$ */
-/** @file AliFMDBaseDigit.cxx
- @author Christian Holm Christensen <cholm@nbi.dk>
- @date Mon Mar 27 12:37:41 2006
- @brief Digits for the FMD
- @ingroup FMD_base
-*/
+ *************************************************************************
+ * $Id$ */
+/**
+ * @file AliFMDBaseDigit.cxx
+ * @author Christian Holm Christensen <cholm@nbi.dk>
+ * @date Mon Mar 27 12:37:41 2006
+ * @brief Digits for the FMD
+ * @ingroup FMD_base
+ */
//////////////////////////////////////////////////////////////////////
//
// Digits classes for the FMD
//////////////////////////////////////////////////////////////////////
#include "AliFMDBaseDigit.h" // ALIFMDDIGIT_H
+#include "AliFMDStripIndex.h"
#include "Riostream.h" // ROOT_Riostream
-#include <TString.h>
+// #include <TString.h>
// #include <AliLog.h>
#include "AliFMDDebug.h" // Better debug macros
//====================================================================
+using std::cout;
+using std::flush;
ClassImp(AliFMDBaseDigit)
#if 0
; // This is here to keep Emacs from indenting the next line
fSector(0),
fStrip(0),
fName("")
-{}
+{
+ //
+ // CTOR
+ //
+}
//____________________________________________________________________
AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector,
Char_t ring,
UShort_t sector,
UShort_t strip)
- : fDetector(detector),
+ : AliDigit(),
+ fDetector(detector),
+ fRing(ring),
+ fSector(sector),
+ fStrip(strip),
+ fName("")
+{
+ //
+ // Creates a base data digit object
+ //
+ // Parameters
+ //
+ // detector Detector # (1, 2, or 3)
+ // ring Ring ID ('I' or 'O')
+ // sector Sector # (For inner/outer rings: 0-19/0-39)
+ // strip Strip # (For inner/outer rings: 0-511/0-255)
+}
+
+//____________________________________________________________________
+AliFMDBaseDigit::AliFMDBaseDigit(Int_t* tracks,
+ UShort_t detector,
+ Char_t ring,
+ UShort_t sector,
+ UShort_t strip)
+ : AliDigit(tracks),
+ fDetector(detector),
fRing(ring),
fSector(sector),
fStrip(strip),
//
// Parameters
//
+ // tracks Array of 3 track labels
// detector Detector # (1, 2, or 3)
// ring Ring ID ('I' or 'O')
// sector Sector # (For inner/outer rings: 0-19/0-39)
AliFMDBaseDigit::Print(Option_t* /* option*/) const
{
// Print digit to standard out
- cout << ClassName() << ": FMD" << GetName() << flush;
+ cout << ClassName() << ": " << GetName() << flush;
}
//____________________________________________________________________
AliFMDBaseDigit::Hash() const
{
// Calculate a hash value based on the detector coordinates.
+#if 1
+ return AliFMDStripIndex::Pack(fDetector, fRing, fSector, fStrip);
+#else
size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1);
return fStrip + fMaxStrips *
(fSector + fMaxSectors * (ringi + fMaxRings * (fDetector - 1)));
+#endif
}
return 1;
}
+//____________________________________________________________________
+void
+AliFMDBaseDigit::AddTrack(Int_t track)
+{
+ //
+ // Add a track referenc
+ //
+ // Parameters:
+ // trackno The track number
+ //
+ if (fTracks[0] == -1) fTracks[0] = track;
+ else if (fTracks[1] == -1) fTracks[1] = track;
+ else if (fTracks[2] == -1) fTracks[2] = track;
+ else
+ AliFMDDebug(1, ("While adding track label to %s for %s: "
+ "All 3 track labels used, can't add "
+ "reference to track %d",
+ ClassName(), GetName(), track));
+}
+
+//____________________________________________________________________
+UShort_t
+AliFMDBaseDigit::GetNTrack() const
+{
+ //
+ // Get the number of track references (max 3)
+ //
+ //
+ // Return:
+ // Number of valid track references.
+ //
+ for (Int_t i = 3; i > 0; i--)
+ if (fTracks[i-1] != -1) return i;
+ return 0;
+}
+
//____________________________________________________________________
//