ROOT logo
#ifndef ALIMUONVDIGITSTORE_H
#define ALIMUONVDIGITSTORE_H

/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
* See cxx source for full Copyright notice                               */

// $Id$

/// \ingroup base
/// \class AliMUONVDigitStore
/// \brief Interface for a digit container
/// 
// Author Laurent Aphecetche, Subatech

#ifndef ALIMUONVSTORE_H
#  include "AliMUONVStore.h"
#endif

#ifndef ALIMUONVDIGIT_H
#  include "AliMUONVDigit.h" // must be there for covariant return type of FindObjet methods
#endif

class AliMUONVDigitStore : public AliMUONVStore
{  
public:
  
  /// Replacement policy : what to do when adding a digit to the store
  enum EReplacePolicy { kAllow, kDeny, kMerge, kIgnore };
  
public:
  AliMUONVDigitStore();
  virtual ~AliMUONVDigitStore();
  
  /// Add an object, if it is of the right class
  virtual Bool_t Add(TObject* object);
  
  /// Create an (empty) object of the same concrete class as *this
  virtual AliMUONVDigitStore* Create() const = 0;
  
  static AliMUONVDigitStore* Create(TTree& tree);
  
  static AliMUONVDigitStore* Create(const char* classname);
  
  /// Create a digit
  virtual AliMUONVDigit* CreateDigit(Int_t detElemId, Int_t manuId,
                                     Int_t manuChannel, Int_t cathode) const = 0;

  /// Add a digit and return the newly created digit
  virtual AliMUONVDigit* Add(Int_t detElemId, 
                             Int_t manuId,
                             Int_t manuChannel,
                             Int_t cathode,
                             EReplacePolicy replace);
  
  /** Add a (s)digit. Digit is adopted. 
    @param digit the digit to be added
    @param replace specify what to do if the digit is already there.
    kAllow means replacement is allowed, kDeny means it is forbidden (in which
    case we return 0x0), and kMerge means both digits will be merged).
  Finally, kIgnore means no check is done at all. This is the most rapid option,
  but also the more dangerous ;-)
  */
  virtual AliMUONVDigit* Add(const AliMUONVDigit& digit, EReplacePolicy replace) = 0;

  /// Create an iterator to loop over all our digits.
  virtual TIterator* CreateIterator() const = 0;
  
  /** Create an iterator to loop over all digits of a group of detection elements,
    and a given cathode (if cathode != -1)
    */
  virtual TIterator* CreateIterator(Int_t firstDetElemId, 
                                    Int_t lastDetElemId,
                                    Int_t cathode=2) const = 0;
  
  /// Create an iterator to loop over tracker digits only
  virtual TIterator* CreateTrackerIterator() const = 0;

  /// Create an iterator to loop over trigger digits only
  virtual TIterator* CreateTriggerIterator() const = 0;

  using AliMUONVStore::FindObject;

  /// Find an object (default is to forward to FindObject(object->GetUniqueID())
  virtual AliMUONVDigit* FindObject(const TObject* object) const;
  
  /// Find an object by its uniqueID
  virtual AliMUONVDigit* FindObject(UInt_t uniqueID) const;
  
  /// Find a digit by the quadruplet (de,manu,channel,cathode)
  virtual AliMUONVDigit* FindObject(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode) const = 0;
  
  /// Number of digits we store
  virtual Int_t GetSize() const = 0;
  
  /// Remove an element
  virtual AliMUONVDigit* Remove(AliMUONVDigit& digit) = 0;
  
  /// Number of digits in a given detection element
  virtual Int_t GetSize(Int_t detElemId) const { return GetSize(detElemId,2); }
  
  /// Number of digits in a given detection element and a given cathode (2 for both cathodes)
  virtual Int_t GetSize(Int_t detElemId, Int_t cathode) const;
  
  /// Whether we have any MC related information (e.g. at least one simulated digit)
  virtual Bool_t HasMCInformation() const = 0;
  
  ClassDef(AliMUONVDigitStore,1) // Digit container interface
};

#endif
 AliMUONVDigitStore.h:1
 AliMUONVDigitStore.h:2
 AliMUONVDigitStore.h:3
 AliMUONVDigitStore.h:4
 AliMUONVDigitStore.h:5
 AliMUONVDigitStore.h:6
 AliMUONVDigitStore.h:7
 AliMUONVDigitStore.h:8
 AliMUONVDigitStore.h:9
 AliMUONVDigitStore.h:10
 AliMUONVDigitStore.h:11
 AliMUONVDigitStore.h:12
 AliMUONVDigitStore.h:13
 AliMUONVDigitStore.h:14
 AliMUONVDigitStore.h:15
 AliMUONVDigitStore.h:16
 AliMUONVDigitStore.h:17
 AliMUONVDigitStore.h:18
 AliMUONVDigitStore.h:19
 AliMUONVDigitStore.h:20
 AliMUONVDigitStore.h:21
 AliMUONVDigitStore.h:22
 AliMUONVDigitStore.h:23
 AliMUONVDigitStore.h:24
 AliMUONVDigitStore.h:25
 AliMUONVDigitStore.h:26
 AliMUONVDigitStore.h:27
 AliMUONVDigitStore.h:28
 AliMUONVDigitStore.h:29
 AliMUONVDigitStore.h:30
 AliMUONVDigitStore.h:31
 AliMUONVDigitStore.h:32
 AliMUONVDigitStore.h:33
 AliMUONVDigitStore.h:34
 AliMUONVDigitStore.h:35
 AliMUONVDigitStore.h:36
 AliMUONVDigitStore.h:37
 AliMUONVDigitStore.h:38
 AliMUONVDigitStore.h:39
 AliMUONVDigitStore.h:40
 AliMUONVDigitStore.h:41
 AliMUONVDigitStore.h:42
 AliMUONVDigitStore.h:43
 AliMUONVDigitStore.h:44
 AliMUONVDigitStore.h:45
 AliMUONVDigitStore.h:46
 AliMUONVDigitStore.h:47
 AliMUONVDigitStore.h:48
 AliMUONVDigitStore.h:49
 AliMUONVDigitStore.h:50
 AliMUONVDigitStore.h:51
 AliMUONVDigitStore.h:52
 AliMUONVDigitStore.h:53
 AliMUONVDigitStore.h:54
 AliMUONVDigitStore.h:55
 AliMUONVDigitStore.h:56
 AliMUONVDigitStore.h:57
 AliMUONVDigitStore.h:58
 AliMUONVDigitStore.h:59
 AliMUONVDigitStore.h:60
 AliMUONVDigitStore.h:61
 AliMUONVDigitStore.h:62
 AliMUONVDigitStore.h:63
 AliMUONVDigitStore.h:64
 AliMUONVDigitStore.h:65
 AliMUONVDigitStore.h:66
 AliMUONVDigitStore.h:67
 AliMUONVDigitStore.h:68
 AliMUONVDigitStore.h:69
 AliMUONVDigitStore.h:70
 AliMUONVDigitStore.h:71
 AliMUONVDigitStore.h:72
 AliMUONVDigitStore.h:73
 AliMUONVDigitStore.h:74
 AliMUONVDigitStore.h:75
 AliMUONVDigitStore.h:76
 AliMUONVDigitStore.h:77
 AliMUONVDigitStore.h:78
 AliMUONVDigitStore.h:79
 AliMUONVDigitStore.h:80
 AliMUONVDigitStore.h:81
 AliMUONVDigitStore.h:82
 AliMUONVDigitStore.h:83
 AliMUONVDigitStore.h:84
 AliMUONVDigitStore.h:85
 AliMUONVDigitStore.h:86
 AliMUONVDigitStore.h:87
 AliMUONVDigitStore.h:88
 AliMUONVDigitStore.h:89
 AliMUONVDigitStore.h:90
 AliMUONVDigitStore.h:91
 AliMUONVDigitStore.h:92
 AliMUONVDigitStore.h:93
 AliMUONVDigitStore.h:94
 AliMUONVDigitStore.h:95
 AliMUONVDigitStore.h:96
 AliMUONVDigitStore.h:97
 AliMUONVDigitStore.h:98
 AliMUONVDigitStore.h:99
 AliMUONVDigitStore.h:100
 AliMUONVDigitStore.h:101
 AliMUONVDigitStore.h:102
 AliMUONVDigitStore.h:103
 AliMUONVDigitStore.h:104
 AliMUONVDigitStore.h:105
 AliMUONVDigitStore.h:106
 AliMUONVDigitStore.h:107
 AliMUONVDigitStore.h:108
 AliMUONVDigitStore.h:109
 AliMUONVDigitStore.h:110