// $Id$
//
+// ----------------------------
// Class AliMUONSegmentation
// ----------------------------
// Manager class for geometry construction via geometry builders.
-//
// Author: Ivana Hrivnacova, IPN Orsay
#include <iostream>
#include "AliMUONSegmentation.h"
#include "AliMUONVGeometryDESegmentation.h"
#include "AliMUONGeometrySegmentation.h"
-#include "AliMUONGeometryDEIndexing.h"
+#include "AliMUONGeometryStore.h"
+
+#include "AliMpVSegmentation.h"
+
#include "AliLog.h"
//______________________________________________________________________________
AliMUONSegmentation::AliMUONSegmentation(Int_t nofModules)
: TObject(),
+ fMpSegmentations(0),
fDESegmentations(0)
{
/// Standard constructor
+ // Create array for mapping segmentations
+ fMpSegmentations = new TObjArray();
+ fMpSegmentations->SetOwner(kTRUE);
+
// Create array for DE segmentations
fDESegmentations = new TObjArray();
fDESegmentations->SetOwner(kTRUE);
//______________________________________________________________________________
AliMUONSegmentation::AliMUONSegmentation()
: TObject(),
+ fMpSegmentations(0),
fDESegmentations(0)
{
/// Default constructor
AliMUONSegmentation::AliMUONSegmentation(const AliMUONSegmentation& right)
: TObject(right)
{
-/// Copy constructor (not implemented)
+/// Protected copy constructor (not implemented)
AliFatal("Copy constructor not provided.");
}
AliDebug(1, Form("dtor this = %p", this));
+ delete fMpSegmentations;
delete fDESegmentations;
delete fModuleSegmentations[0];
delete fModuleSegmentations[1];
AliMUONSegmentation&
AliMUONSegmentation::operator=(const AliMUONSegmentation& right)
{
-/// Assignement operator (not implemented)
+/// Protected assignement operator (not implemented)
// check assignement to self
if (this == &right) return *this;
// public functions
//
+//_____________________________________________________________________________
+void AliMUONSegmentation::AddMpSegmentation(AliMpVSegmentation* segmentation)
+{
+/// Add the mapping segmentation to the array if not present
+
+ Bool_t isPresent = false;
+ for (Int_t i=0; i<fMpSegmentations->GetEntries(); i++)
+ if ( (AliMpVSegmentation*)fMpSegmentations->At(i) == segmentation ) {
+ isPresent = true;
+ break;
+ }
+
+ if (!isPresent) fMpSegmentations->Add(segmentation);
+}
+
//_____________________________________________________________________________
void AliMUONSegmentation::AddDESegmentation(
- AliMUONVGeometryDESegmentation* segmentation)
+ AliMUONVGeometryDESegmentation* segmentation)
{
/// Add the DE segmentation to the array
fDESegmentations->Add(segmentation);
+
+ // Deregister the mapping segmentation contained in DE segmentation
+ // from fMpSegmentations, if present
+ const AliMpVSegmentation* kmpSeg = segmentation->GetMpSegmentation();
+
+ for (Int_t i=0; i<fMpSegmentations->GetEntries(); i++)
+ if ( (const AliMpVSegmentation*)fMpSegmentations->At(i) == kmpSeg ) {
+ fMpSegmentations->RemoveAt(i);
+ break;
+ }
}
//_____________________________________________________________________________
/// Return the geometry module specified by detElemId/cathod
// Get moduleId
- Int_t moduleId = AliMUONGeometryDEIndexing::GetModuleId(detElemId);
+ Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
return GetModuleSegmentation(moduleId, cathod, warn);
}
if ( !moduleSegmentation ) return 0;
- return moduleSegmentation->GetDESegmentation(detElemId);
+ return moduleSegmentation->GetDESegmentation(detElemId, warn);
}
//_____________________________________________________________________________
Bool_t
AliMUONSegmentation::HasDE(Int_t detElemId, Int_t cathod) const
{
- // Get geometry segmentation
- AliMUONGeometrySegmentation* moduleSegmentation
- = GetModuleSegmentationByDEId(detElemId, cathod, false);
+ // Get DE segmentation
+ const AliMUONVGeometryDESegmentation* kdeSegmentation
+ = GetDESegmentation(detElemId, cathod, false);
- return ( moduleSegmentation != 0 );
+ return ( kdeSegmentation != 0 );
}