// $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 "AliMUONGeometryStore.h"
-
+\
#include "AliMpVSegmentation.h"
+#include "AliMpDEManager.h"
#include "AliLog.h"
-
+/// \cond CLASSIMP
ClassImp(AliMUONSegmentation)
+/// \endcond
//______________________________________________________________________________
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
AliDebug(1, Form("default (empty) ctor this = %p", this));
}
-//______________________________________________________________________________
-AliMUONSegmentation::AliMUONSegmentation(const AliMUONSegmentation& right)
- : TObject(right)
-{
-/// Copy constructor (not implemented)
-
- AliFatal("Copy constructor not provided.");
-}
-
//______________________________________________________________________________
AliMUONSegmentation::~AliMUONSegmentation()
{
AliDebug(1, Form("dtor this = %p", this));
- delete fMpSegmentations;
delete fDESegmentations;
delete fModuleSegmentations[0];
delete fModuleSegmentations[1];
}
-//______________________________________________________________________________
-AliMUONSegmentation&
-AliMUONSegmentation::operator=(const AliMUONSegmentation& right)
+//
+// private functions
+//
+
+//_____________________________________________________________________________
+AliMUONGeometrySegmentation*
+AliMUONSegmentation::GetModuleSegmentation(
+ Int_t moduleId, Int_t cathod, Bool_t warn) const
{
-/// Assignement operator (not implemented)
+/// Return the geometry module segmentation specified by moduleId
- // check assignement to self
- if (this == &right) return *this;
+ if (cathod < 0 || cathod >= 2) {
+ if (warn) {
+ AliWarningStream()
+ << "Cathod: " << cathod << " outside limits" << std::endl;
+ }
+ return 0;
+ }
- AliFatal("Assignement operator not provided.");
-
- return *this;
+ if (moduleId < 0 || moduleId >= fModuleSegmentations[cathod]->GetEntriesFast()) {
+ if (warn) {
+ AliWarningStream()
+ << "Index: " << moduleId << " outside limits" << std::endl;
+ }
+ return 0;
+ }
+
+ return (AliMUONGeometrySegmentation*)
+ fModuleSegmentations[cathod]->At(moduleId);
}
//
// 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)
/// 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;
- }
}
//_____________________________________________________________________________
}
}
-//_____________________________________________________________________________
-AliMUONGeometrySegmentation*
-AliMUONSegmentation::GetModuleSegmentation(
- Int_t moduleId, Int_t cathod, Bool_t warn) const
-{
-/// Return the geometry module specified by moduleId
-
- if (cathod < 0 || cathod >= 2) {
- if (warn) {
- AliWarningStream()
- << "Cathod: " << cathod << " outside limits" << std::endl;
- }
- return 0;
- }
-
- if (moduleId < 0 || moduleId >= fModuleSegmentations[cathod]->GetEntriesFast()) {
- if (warn) {
- AliWarningStream()
- << "Index: " << moduleId << " outside limits" << std::endl;
- }
- return 0;
- }
-
- return (AliMUONGeometrySegmentation*)
- fModuleSegmentations[cathod]->At(moduleId);
-}
-
//_____________________________________________________________________________
AliMUONGeometrySegmentation*
AliMUONSegmentation::GetModuleSegmentationByDEId(
/// Return the geometry module specified by detElemId/cathod
// Get moduleId
- Int_t moduleId = AliMUONGeometryStore::GetModuleId(detElemId);
+ Int_t moduleId = AliMpDEManager::GetGeomModuleId(detElemId);
return GetModuleSegmentation(moduleId, cathod, warn);
}
return moduleSegmentation->GetDESegmentation(detElemId, warn);
}
-//_____________________________________________________________________________
-const AliMpVSegmentation*
-AliMUONSegmentation::GetMpSegmentation(
- Int_t detElemId, Int_t cathod, Bool_t warn) const
-{
-/// Return the mapping segmentation specified by detElemId/cathod
-
-
- // Get DE segmentation
- const AliMUONVGeometryDESegmentation* kdeSegmentation
- = GetDESegmentation(detElemId, cathod, warn);
-
- if ( !kdeSegmentation ) return 0;
-
- return kdeSegmentation->GetMpSegmentation();
-}
-
//_____________________________________________________________________________
Bool_t
AliMUONSegmentation::HasDE(Int_t detElemId, Int_t cathod) const
{
- // Get DE segmentation
+/// Return true if segmentation for detElemId and cathod is defined.
+
const AliMUONVGeometryDESegmentation* kdeSegmentation
= GetDESegmentation(detElemId, cathod, false);
TString
AliMUONSegmentation::GetDEName(Int_t detElemId, Int_t cathod) const
{
+/// Get detection element name
- // Get geometry segmentation
AliMUONGeometrySegmentation* moduleSegmentation
= GetModuleSegmentationByDEId(detElemId, cathod, true);