1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 //-----------------------------------------------------------------------------
19 /// \class AliMUONVDigitStore
21 /// Interface for a digit (or sdigit) container
23 /// It offers methods to Add, Find and Remove single elements, and
24 /// can create iterators to loop over (part of) the elements.
26 /// \author Laurent Aphecetche, Subatech
27 //-----------------------------------------------------------------------------
29 #include "AliMUONVDigitStore.h"
32 #include "AliMUONVDigit.h"
38 ClassImp(AliMUONVDigitStore)
41 //_____________________________________________________________________________
42 AliMUONVDigitStore::AliMUONVDigitStore()
47 //_____________________________________________________________________________
48 AliMUONVDigitStore::~AliMUONVDigitStore()
53 //_____________________________________________________________________________
55 AliMUONVDigitStore::Add(TObject* object)
57 /// Add an object, if it is of type AliMUONVDigit
60 AliMUONVDigit* digit = dynamic_cast<AliMUONVDigit*>(object);
63 AliMUONVDigit* added = Add(*digit,AliMUONVDigitStore::kIgnore);
66 AliError("Could not add digit through Add(TObject*) method");
77 //_____________________________________________________________________________
79 AliMUONVDigitStore::Add(Int_t detElemId,
83 EReplacePolicy replace)
85 /// Add a digit and return it
86 AliMUONVDigit* digit = CreateDigit(detElemId,manuId,manuChannel,cathode);
89 AliMUONVDigit* d = Add(*digit,replace);
96 //____________________________________________________________________________
98 AliMUONVDigitStore::Create(const char* digitstoreclassname)
100 /// Create a concrete digitStore, given its classname
102 TClass* classPtr = TClass::GetClass(digitstoreclassname);
103 if (!classPtr || !classPtr->InheritsFrom("AliMUONVDigitStore"))
108 AliMUONVDigitStore* digitStore =
109 reinterpret_cast<AliMUONVDigitStore*>(classPtr->New());
114 //_____________________________________________________________________________
116 AliMUONVDigitStore::Create(TTree& tree)
118 /// Create store from the given tree (if possible).
119 TString dataType = ( strcmp(tree.GetName(),"TreeD") == 0 ? "Digit" :
120 (strcmp(tree.GetName(),"TreeS")== 9 ? "SDigit" : "")
122 return static_cast<AliMUONVDigitStore*>(AliMUONVStore::Create(tree,dataType.Data()));
125 //_____________________________________________________________________________
127 AliMUONVDigitStore::FindObject(const TObject* object) const
129 /// Find an object, if of AliMUONVDigit type.
130 const AliMUONVDigit* digit = dynamic_cast<const AliMUONVDigit*>(object);
133 return FindObject(digit->GetUniqueID());
138 //_____________________________________________________________________________
140 AliMUONVDigitStore::FindObject(UInt_t uniqueID) const
142 /// Find digit by its uniqueID
144 return FindObject(AliMUONVDigit::DetElemId(uniqueID),
145 AliMUONVDigit::ManuId(uniqueID),
146 AliMUONVDigit::ManuChannel(uniqueID),
147 AliMUONVDigit::Cathode(uniqueID));
150 //_____________________________________________________________________________
152 AliMUONVDigitStore::GetSize(Int_t detElemId, Int_t cathode) const
154 /// Return the number of digits we have for a given detection element
155 TIter next(CreateIterator(detElemId,detElemId,cathode));