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 /// \class AliMUONVDigitStore
20 /// Interface for a digit (or sdigit) container
22 /// It offers methods to Add, Find and Remove single elements, and
23 /// can create iterators to loop over (part of) the elements.
25 /// \author Laurent Aphecetche, Subatech
27 #include "AliMUONVDigitStore.h"
30 #include "AliMUONVDigit.h"
35 ClassImp(AliMUONVDigitStore)
38 //_____________________________________________________________________________
39 AliMUONVDigitStore::AliMUONVDigitStore()
44 //_____________________________________________________________________________
45 AliMUONVDigitStore::~AliMUONVDigitStore()
50 //_____________________________________________________________________________
52 AliMUONVDigitStore::Add(TObject* object)
54 /// Add an object, if it is of type AliMUONVDigit
57 AliMUONVDigit* digit = dynamic_cast<AliMUONVDigit*>(object);
60 AliMUONVDigit* added = Add(*digit,AliMUONVDigitStore::kIgnore);
63 AliError("Could not add digit through Add(TObject*) method");
74 //_____________________________________________________________________________
76 AliMUONVDigitStore::Add(Int_t detElemId,
80 EReplacePolicy replace)
82 /// Add a digit and return it
83 AliMUONVDigit* digit = CreateDigit(detElemId,manuId,manuChannel,cathode);
86 AliMUONVDigit* d = Add(*digit,replace);
93 //_____________________________________________________________________________
95 AliMUONVDigitStore::Create(TTree& tree)
97 /// Create store from the given tree (if possible).
98 TString dataType = ( strcmp(tree.GetName(),"TreeD") == 0 ? "Digit" :
99 (strcmp(tree.GetName(),"TreeS")== 9 ? "SDigit" : "")
101 return static_cast<AliMUONVDigitStore*>(AliMUONVStore::Create(tree,dataType.Data()));
104 //_____________________________________________________________________________
106 AliMUONVDigitStore::GetSize(Int_t detElemId, Int_t cathode) const
108 /// Return the number of digits we have for a given detection element
109 TIter next(CreateIterator(detElemId,detElemId,cathode));
110 AliMUONVDigit* digit;
112 while ( ( digit = static_cast<AliMUONVDigit*>(next()) ) )