X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2FAliMUONClusterStoreV1.cxx;h=95b6e96ad019e61235cccbf2d4aec25c4553bd2c;hb=6cf643869d006dcfcc68ae9fee7f686c27cc4298;hp=7adfb67891604cbcbd17a29e6216d79c534bfc2a;hpb=3d1463c8f7148e36069c24f20cde34e096d5d6a9;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/AliMUONClusterStoreV1.cxx b/MUON/AliMUONClusterStoreV1.cxx index 7adfb678916..95b6e96ad01 100644 --- a/MUON/AliMUONClusterStoreV1.cxx +++ b/MUON/AliMUONClusterStoreV1.cxx @@ -54,7 +54,6 @@ fClusters(new TObjArray(AliMpConstants::NofChambers())) for ( Int_t i = 0; i < fClusters->GetSize(); ++i ) { TClonesArray* tca = new TClonesArray("AliMUONRawCluster",100); - tca->SetOwner(kTRUE); fClusters->AddAt(tca,i); } AliDebug(1,""); @@ -87,18 +86,48 @@ AliMUONClusterStoreV1::~AliMUONClusterStoreV1() } //_____________________________________________________________________________ -Bool_t -AliMUONClusterStoreV1::Add(const AliMUONRawCluster& cluster) +AliMUONVCluster* AliMUONClusterStoreV1::CreateCluster(Int_t /*chamberId*/, Int_t detElemId, Int_t /*clusterIndex*/) const +{ + /// Create a cluster + AliMUONVCluster* vCluster = new AliMUONRawCluster(); + (static_cast (vCluster))->SetDetElemId(detElemId); + return vCluster; +} + +//_____________________________________________________________________________ +AliMUONVCluster* +AliMUONClusterStoreV1::Add(const AliMUONVCluster& vCluster) { /// Add a cluster to this store - Int_t iChamber = AliMpDEManager::GetChamberId(cluster.GetDetElemId()); + const AliMUONRawCluster* cluster = dynamic_cast(&vCluster); + + if (!cluster) + { + AliError(Form("Cluster is not of the expected type (%s vs AliMUONRawCluster)", + vCluster.ClassName())); + return 0x0; + } + + Int_t iChamber = AliMpDEManager::GetChamberId(cluster->GetDetElemId()); TClonesArray* array = ChamberClusters(iChamber); if (!array) { - return kFALSE; + return 0x0; } - new((*array)[array->GetLast()+1]) AliMUONRawCluster(cluster); - return kTRUE; + + return new((*array)[array->GetLast()+1]) AliMUONRawCluster(*cluster); +} + +//_____________________________________________________________________________ +AliMUONVCluster* AliMUONClusterStoreV1::Add(Int_t chamberId, Int_t detElemId, Int_t /*clusterIndex*/) +{ + /// Add a cluster to this store + TClonesArray* array = ChamberClusters(chamberId); + if (!array) return 0x0; + + AliMUONVCluster* vCluster = static_cast (new((*array)[array->GetLast()+1]) AliMUONRawCluster()); + (static_cast (vCluster))->SetDetElemId(detElemId); + return vCluster; } //_____________________________________________________________________________ @@ -166,8 +195,8 @@ AliMUONClusterStoreV1::Connect(TTree& tree, Bool_t alone) const } //_____________________________________________________________________________ -AliMUONRawCluster* -AliMUONClusterStoreV1::Remove(AliMUONRawCluster& cluster) +AliMUONVCluster* +AliMUONClusterStoreV1::Remove(AliMUONVCluster& cluster) { /// Remove a cluster Int_t iChamber = AliMpDEManager::GetChamberId(cluster.GetDetElemId()); @@ -177,7 +206,7 @@ AliMUONClusterStoreV1::Remove(AliMUONRawCluster& cluster) { array->Compress(); } - return static_cast(o); + return static_cast(o); } //_____________________________________________________________________________ @@ -221,3 +250,4 @@ AliMUONClusterStoreV1::GetSize() const } return n; } +