minor coverity defect: added protection for self-assignment
[u/mrichter/AliRoot.git] / MUON / AliMUONDigitStoreVImpl.h
CommitLineData
97d7844b 1#ifndef ALIMUONDIGITSTOREVIMPL_H
2#define ALIMUONDIGITSTOREVIMPL_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5* See cxx source for full Copyright notice */
6
7// $Id$
8
9/// \ingroup base
10/// \class AliMUONDigitStoreVImpl
11/// \brief Base implementation of VDigitStore
12///
13// author Laurent Aphecetche
14
15#ifndef ALIMUONVDIGITSTORE_H
16# include "AliMUONVDigitStore.h"
17#endif
18
19class TClonesArray;
20class AliMUON2DMap;
21
22class AliMUONDigitStoreVImpl : public AliMUONVDigitStore
23{
24 friend class AliMUONDigitStoreVImplIterator;
25
26public:
27 AliMUONDigitStoreVImpl(const char* concreteClassName);
28 AliMUONDigitStoreVImpl(const AliMUONDigitStoreVImpl& rhs);
29 AliMUONDigitStoreVImpl& operator=(const AliMUONDigitStoreVImpl& rhs);
30 virtual ~AliMUONDigitStoreVImpl();
31
32 /// Whether we can be connected to a TTree
33 virtual Bool_t CanConnect() const { return kTRUE; }
34
35 virtual Bool_t Connect(TTree& tree, Bool_t alone = kTRUE) const;
36
37 virtual void Clear(Option_t* opt="");
38
39 virtual AliMUONVDigit* CreateDigit(Int_t detElemId, Int_t manuId,
40 Int_t manuChannel, Int_t cathode) const = 0;
41
42 using AliMUONVDigitStore::Add;
43
44 virtual AliMUONVDigit* Add(const AliMUONVDigit& digit, EReplacePolicy replace);
45
46 virtual TIterator* CreateIterator() const;
47
48 virtual TIterator* CreateIterator(Int_t firstDetElemId,
49 Int_t lastDetElemId,
50 Int_t cathode=2) const;
51
52 virtual TIterator* CreateTrackerIterator() const;
53
54 virtual TIterator* CreateTriggerIterator() const;
55
56 using AliMUONVStore::FindObject;
57
58 virtual AliMUONVDigit* FindObject(UInt_t uniqueID) const;
59
60 virtual AliMUONVDigit* FindObject(Int_t detElemId, Int_t manuId,
61 Int_t manuChannel, Int_t cathode) const;
62
63 using AliMUONVDigitStore::GetSize;
64
65 virtual Int_t GetSize() const;
66
67 virtual AliMUONVDigit* Remove(AliMUONVDigit& digit);
68
69protected:
70 /// Add concrete digit
71 virtual AliMUONVDigit* AddConcreteDigit(TClonesArray& a,
72 const AliMUONVDigit& digit,
73 Int_t index) = 0;
74
75private:
76
77 AliMUONVDigit* Find(const AliMUONVDigit& digit) const;
78
79 void UpdateIndex(const AliMUONVDigit& digit, Int_t index);
80
81 Int_t FindIndex(const AliMUONVDigit& digit) const;
82 Int_t FindIndex(Int_t detElemId, Int_t internalManuId, Int_t manuChannel) const;
83
84 void ReIndex();
85 void ClearIndex();
86
87private:
88 TClonesArray* fDigits; ///< collection of digits
89 AliMUON2DMap* fMap; //!< index map for fast digit retrieval
90 Bool_t fIndexed; //!< whether our internal indices fDEs and fManus are uptodate
91
92 ClassDef(AliMUONDigitStoreVImpl,1) // Implementation of AliMUONVDigitStore
93};
94
95#endif