From f3ed9a445a24b75614a1a5fa5b2de7c622c6c8ec Mon Sep 17 00:00:00 2001 From: ivana Date: Wed, 28 Jan 2009 11:07:09 +0000 Subject: [PATCH] In mapping: Introduced new methods in AliMpSegmentation class for access to AliMpSector, AliMpSlat and AliMpTrigger objects, and replaced code where these objects are accessed via unsafe casting AliMpVSegmentation with use of these new functions. (Ivana, Laurent) --- MUON/AliMUONPainterContourMaker.cxx | 26 ++--- MUON/AliMUONPainterHelper.cxx | 24 +--- MUON/AliMUONSt1GeometryBuilderV2.cxx | 24 ++-- MUON/AliMUONTriggerCircuit.cxx | 7 +- MUON/AliMUONTriggerGUI.cxx | 6 +- MUON/mapping/AliMpBusPatch.cxx | 23 ++-- MUON/mapping/AliMpDCSNamer.cxx | 24 ++-- MUON/mapping/AliMpSectorSegmentation.h | 7 ++ MUON/mapping/AliMpSegmentation.cxx | 141 ++++++++++++++++++++++++ MUON/mapping/AliMpSegmentation.h | 38 ++++++- MUON/mapping/AliMpSlatSegmentation.h | 8 +- MUON/mapping/AliMpStationType.cxx | 1 + MUON/mapping/AliMpStationType.h | 1 + MUON/mapping/AliMpTriggerSegmentation.h | 13 ++- MUON/mapping/AliMpVPainter.cxx | 11 +- MUON/mapping/AliMpVSegmentation.h | 4 + 16 files changed, 264 insertions(+), 94 deletions(-) diff --git a/MUON/AliMUONPainterContourMaker.cxx b/MUON/AliMUONPainterContourMaker.cxx index cbeb36c349d..c7f9f5d5272 100644 --- a/MUON/AliMUONPainterContourMaker.cxx +++ b/MUON/AliMUONPainterContourMaker.cxx @@ -29,10 +29,8 @@ #include "AliMpMotifPosition.h" #include "AliMpMotifType.h" #include "AliMpSector.h" -#include "AliMpSectorSegmentation.h" #include "AliMpSegmentation.h" #include "AliMpSlat.h" -#include "AliMpSlatSegmentation.h" #include "AliMpStationType.h" #include "AliMpVMotif.h" #include "AliCodeTimer.h" @@ -690,25 +688,25 @@ AliMUONPainterContourMaker::FindMotifPosition(Int_t detElemId, Int_t manuId) con AliCodeTimerAuto("") - const AliMpVSegmentation* vseg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); - if (!vseg) - { - AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId)); - } - AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); if ( stationType == AliMp::kStation345 ) { - const AliMpSlatSegmentation* seg = static_cast(vseg); - const AliMpSlat* slat = seg->Slat(); - return slat->FindMotifPosition(manuId); + const AliMpSlat* kSlat + = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId); + if ( ! kSlat ) { + AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId)); + } + return kSlat->FindMotifPosition(manuId); } else { - const AliMpSectorSegmentation* seg = static_cast(vseg); - const AliMpSector* sector = seg->GetSector(); - return sector->GetMotifMap()->FindMotifPosition(manuId); + const AliMpSector* kSector + = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId,manuId); + if ( ! kSector ) { + AliFatal(Form("Could not find motif for DE %d manu %d",detElemId,manuId)); + } + return kSector->GetMotifMap()->FindMotifPosition(manuId); } return 0x0; } diff --git a/MUON/AliMUONPainterHelper.cxx b/MUON/AliMUONPainterHelper.cxx index 1d44d68eed4..aa589f08e38 100644 --- a/MUON/AliMUONPainterHelper.cxx +++ b/MUON/AliMUONPainterHelper.cxx @@ -40,10 +40,8 @@ #include "AliMpPCB.h" #include "AliMpPad.h" #include "AliMpSector.h" -#include "AliMpSectorSegmentation.h" #include "AliMpSegmentation.h" #include "AliMpSlat.h" -#include "AliMpSlatSegmentation.h" #include "AliMpStationType.h" #include "AliMpVPadIterator.h" #include "AliCodeTimer.h" @@ -456,12 +454,7 @@ AliMUONPainterHelper::GetSector(Int_t detElemId, AliMp::PlaneType planeType) con AliMp::CathodType cathodeType = AliMpDEManager::GetCathod(detElemId,planeType); - const AliMpVSegmentation* seg = - AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType); - - const AliMpSectorSegmentation* sectorSeg = static_cast(seg); - return sectorSeg->GetSector(); - + return AliMpSegmentation::Instance()->GetSector(detElemId,cathodeType); } //_____________________________________________________________________________ @@ -472,11 +465,7 @@ AliMUONPainterHelper::GetSlat(Int_t detElemId, AliMp::CathodType cathodeType) co AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); if ( stationType != AliMp::kStation345 ) return 0x0; - const AliMpVSegmentation* seg = - AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,cathodeType); - - const AliMpSlatSegmentation* slatSeg = static_cast(seg); - return slatSeg->Slat(); + return AliMpSegmentation::Instance()->GetSlat(detElemId,cathodeType); } //_____________________________________________________________________________ @@ -484,11 +473,10 @@ const AliMpSlat* AliMUONPainterHelper::GetSlat(Int_t detElemId, Int_t manuId) const { /// Get a given slat - const AliMpVSegmentation* seg = - AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId); - - const AliMpSlatSegmentation* slatSeg = static_cast(seg); - return slatSeg->Slat(); + AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId); + if ( stationType != AliMp::kStation345 ) return 0x0; + + return AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId,manuId); } //_____________________________________________________________________________ diff --git a/MUON/AliMUONSt1GeometryBuilderV2.cxx b/MUON/AliMUONSt1GeometryBuilderV2.cxx index 01ec8352caa..61aaca93719 100644 --- a/MUON/AliMUONSt1GeometryBuilderV2.cxx +++ b/MUON/AliMUONSt1GeometryBuilderV2.cxx @@ -36,7 +36,6 @@ #include "AliMpContainers.h" #include "AliMpConstants.h" #include "AliMpCDB.h" -#include "AliMpSectorSegmentation.h" #include "AliMpSector.h" #include "AliMpRow.h" #include "AliMpVRowSegment.h" @@ -414,16 +413,12 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber) AliFatal("Mapping has to be loaded first !"); } - const AliMpSectorSegmentation* kSegmentation1 - = dynamic_cast( - AliMpSegmentation::Instance() - ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane))); - if ( ! kSegmentation1 ) { + const AliMpSector* kSector1 + = AliMpSegmentation::Instance()->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kBendingPlane)); + if ( ! kSector1 ) { AliFatal("Could not access sector segmentation !"); } - const AliMpSector* kSector1 = kSegmentation1->GetSector(); - //Bool_t reflectZ = true; Bool_t reflectZ = false; //TVector3 where = TVector3(2.5+0.1+0.56+0.001, 2.5+0.1+0.001, 0.); @@ -448,15 +443,12 @@ void AliMUONSt1GeometryBuilderV2::CreateQuadrant(Int_t chamber) // Fix (7) - overlap of SQ42 with MCHL (after moving the whole sector // in the true position) - const AliMpSectorSegmentation* kSegmentation2 - = dynamic_cast( - AliMpSegmentation::Instance() - ->GetMpSegmentation(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane))); - if ( ! kSegmentation2 ) { - AliFatal("Could not access sector segmentation !"); + const AliMpSector* kSector2 + = AliMpSegmentation::Instance() + ->GetSector(100, AliMpDEManager::GetCathod(100, AliMp::kNonBendingPlane)); + if ( ! kSector2 ) { + AliFatal("Could not access sector !"); } - - const AliMpSector* kSector2 = kSegmentation2->GetSector(); //reflectZ = false; reflectZ = true; diff --git a/MUON/AliMUONTriggerCircuit.cxx b/MUON/AliMUONTriggerCircuit.cxx index 721139da8a9..bc91a0b7020 100644 --- a/MUON/AliMUONTriggerCircuit.cxx +++ b/MUON/AliMUONTriggerCircuit.cxx @@ -28,7 +28,6 @@ #include "AliMUONTriggerCircuit.h" #include "AliMUONConstants.h" -#include "AliMpTriggerSegmentation.h" #include "AliMpTrigger.h" #include "AliMpSlat.h" #include "AliMpPCB.h" @@ -238,8 +237,7 @@ void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* localBoard) ->GetMpSegmentation(fCurrentDetElem, AliMp::GetCathodType(icathode)); // get iFirstStrip in this module - const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg); - const AliMpTrigger* t = trig->Slat(); + const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg); const AliMpSlat* slat = t->GetLayer(0); if (iline == 5) icolDo = icol + 1; // special case @@ -328,8 +326,7 @@ void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* localBoard) if (zeroAllYLSB) iStripCircuit = 8; // get iFirstStrip in this module - const AliMpTriggerSegmentation* trig = (AliMpTriggerSegmentation*)(fCurrentSeg); - const AliMpTrigger* t = trig->Slat(); + const AliMpTrigger* t = AliMpSegmentation::Instance()->GetTrigger(fCurrentSeg); const AliMpSlat* slat = t->GetLayer(0); const AliMpPCB* pcb = slat->GetPCB(icol-1); diff --git a/MUON/AliMUONTriggerGUI.cxx b/MUON/AliMUONTriggerGUI.cxx index c70b3088fdd..fd50bb215e6 100644 --- a/MUON/AliMUONTriggerGUI.cxx +++ b/MUON/AliMUONTriggerGUI.cxx @@ -1461,11 +1461,10 @@ void AliMUONTriggerGUI::InitBoards() // x-strips manuIdPrev = 0; - const AliMpTriggerSegmentation *trigseg0 = static_cast(seg0); for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) { for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) { AliMpIntPair indices(ix,iy); - AliMpPad pad = trigseg0->PadByIndices(indices,kFALSE); + AliMpPad pad = seg0->PadByIndices(indices,kFALSE); if (pad.IsValid()) { AliMpIntPair loc = pad.GetLocation(0); Int_t manuId = loc.GetFirst(); @@ -1493,11 +1492,10 @@ void AliMUONTriggerGUI::InitBoards() // y-strips manuIdPrev = 0; - const AliMpTriggerSegmentation *trigseg1 = static_cast(seg1); for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) { for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) { AliMpIntPair indices(ix,iy); - AliMpPad pad = trigseg1->PadByIndices(indices,kFALSE); + AliMpPad pad = seg1->PadByIndices(indices,kFALSE); if (pad.IsValid()) { Int_t nloc = pad.GetNofLocations(); for (Int_t iloc = 0; iloc < nloc; iloc++) { diff --git a/MUON/mapping/AliMpBusPatch.cxx b/MUON/mapping/AliMpBusPatch.cxx index 0b82f3acf82..e001cff4fb5 100644 --- a/MUON/mapping/AliMpBusPatch.cxx +++ b/MUON/mapping/AliMpBusPatch.cxx @@ -29,7 +29,6 @@ #include "AliMpConstants.h" #include "AliMpDEManager.h" #include "AliMpSegmentation.h" -#include "AliMpSlatSegmentation.h" #include "AliMpSlat.h" #include "AliMpPCB.h" #include "AliMpMotifPosition.h" @@ -152,17 +151,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber) if ( AliMpDEManager::GetStationType(fDEId) == AliMp::kStation345 ) { - const AliMpSlatSegmentation* seg0 - = static_cast( - AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath0)); - - const AliMpSlatSegmentation* seg1 - = static_cast( - AliMpSegmentation::Instance()->GetMpSegmentation(fDEId, AliMp::kCath1)); - - const AliMpSlat* slat0 = seg0->Slat(); - const AliMpSlat* slat1 = seg1->Slat(); + const AliMpSlat* kSlat0 + = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath0); + const AliMpSlat* kSlat1 + = AliMpSegmentation::Instance()->GetSlat(fDEId, AliMp::kCath1); Int_t iPcb = 0; Int_t iPcbPrev = -1; @@ -174,8 +167,8 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber) // Loop over manu for (Int_t iManu = 0; iManu < GetNofManus(); ++iManu) { Int_t manuId = GetManuId(iManu); - AliMpMotifPosition* motifPos0 = slat0->FindMotifPosition(manuId); - AliMpMotifPosition* motifPos1 = slat1->FindMotifPosition(manuId); + AliMpMotifPosition* motifPos0 = kSlat0->FindMotifPosition(manuId); + AliMpMotifPosition* motifPos1 = kSlat1->FindMotifPosition(manuId); if ( !motifPos0 && !motifPos1 ) { // should never happen @@ -187,11 +180,11 @@ Bool_t AliMpBusPatch::SetNofManusPerModule(Int_t manuNumber) // find PCB id if ( motifPos0 ) { x = motifPos0->Position().X(); - length = slat0->GetPCB(0)->DX()*2.; + length = kSlat0->GetPCB(0)->DX()*2.; } if ( motifPos1 ) { x = motifPos1->Position().X(); - length = slat1->GetPCB(0)->DX()*2.; + length = kSlat1->GetPCB(0)->DX()*2.; } iPcb = Int_t(x/length + AliMpConstants::LengthTolerance()); diff --git a/MUON/mapping/AliMpDCSNamer.cxx b/MUON/mapping/AliMpDCSNamer.cxx index b374e28f1b3..b2b22acde92 100644 --- a/MUON/mapping/AliMpDCSNamer.cxx +++ b/MUON/mapping/AliMpDCSNamer.cxx @@ -26,10 +26,8 @@ #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" #include "AliMpSector.h" -#include "AliMpSectorSegmentation.h" #include "AliMpSegmentation.h" #include "AliMpSlat.h" -#include "AliMpSlatSegmentation.h" #include "AliMpConstants.h" #include #include @@ -667,11 +665,9 @@ AliMpDCSNamer::ManuId2PCBIndex(Int_t detElemId, Int_t manuId) const AliCodeTimerAuto("") - const AliMpSlatSegmentation* seg = static_cast - (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId)); - if (!seg) return -1; - - const AliMpSlat* slat = seg->Slat(); + const AliMpSlat* slat + = AliMpSegmentation::Instance()->GetSlatByElectronics(detElemId, manuId); + if ( ! slat ) return -1; return slat->FindPCBIndexByMotifPositionID(manuId); } @@ -684,11 +680,10 @@ AliMpDCSNamer::ManuId2Sector(Int_t detElemId, Int_t manuId) const AliCodeTimerAuto("") - const AliMpSectorSegmentation* seg = static_cast - (AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(detElemId,manuId)); - if (!seg) return -1; - - const AliMpSector* sector = seg->GetSector(); + const AliMpSector* sector + = AliMpSegmentation::Instance()->GetSectorByElectronics(detElemId, manuId); + if ( ! sector ) return -1; + const AliMpMotifMap* motifMap = sector->GetMotifMap(); const AliMpMotifPosition* motifPos = motifMap->FindMotifPosition(manuId); @@ -733,9 +728,8 @@ AliMpDCSNamer::NumberOfPCBs(Int_t detElemId) const } else { - const AliMpSlatSegmentation* seg = static_cast - (AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::kCath0)); - const AliMpSlat* slat = seg->Slat(); + const AliMpSlat* slat + = AliMpSegmentation::Instance()->GetSlat(detElemId, AliMp::kCath0); return slat->GetSize(); } } diff --git a/MUON/mapping/AliMpSectorSegmentation.h b/MUON/mapping/AliMpSectorSegmentation.h index 7c4bdfa29b5..16f8dbfd1ea 100755 --- a/MUON/mapping/AliMpSectorSegmentation.h +++ b/MUON/mapping/AliMpSectorSegmentation.h @@ -100,6 +100,8 @@ class AliMpSectorSegmentation : public AliMpVSegmentation AliMp::PlaneType PlaneType() const; + AliMp::StationType StationType() const; + TVector2 Dimensions() const; private: @@ -149,5 +151,10 @@ class AliMpSectorSegmentation : public AliMpVSegmentation inline const AliMpSector* AliMpSectorSegmentation::GetSector() const { return fkSector; } +/// Return station type +inline AliMp::StationType AliMpSectorSegmentation::StationType() const +{ return AliMp::kStation12; } + + #endif //ALI_MP_SECTOR_SEGMENTATION_H diff --git a/MUON/mapping/AliMpSegmentation.cxx b/MUON/mapping/AliMpSegmentation.cxx index d767773166a..b75570ff07e 100644 --- a/MUON/mapping/AliMpSegmentation.cxx +++ b/MUON/mapping/AliMpSegmentation.cxx @@ -332,3 +332,144 @@ AliMpSegmentation::GetMpSegmentationByElectronics( return static_cast(object); } + +//_____________________________________________________________________________ +const AliMpSector* +AliMpSegmentation::GetSector(const AliMpVSegmentation* kSegmentation, + Bool_t warn) const +{ +/// Return sector for given mapping segmentation. +/// If segmentation is not of sector type, zero is returned +/// and an Error is issued if warn is set true (default). + + if ( ! kSegmentation ) return 0; + + if ( kSegmentation->StationType() != AliMp::kStation12 ) { + if ( warn ) { + AliErrorStream() + << "Segmentation is not of sector type" << endl; + } + return 0; + } + + return + static_cast(kSegmentation)->GetSector(); +} + +//_____________________________________________________________________________ +const AliMpSector* +AliMpSegmentation::GetSector(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn) const +{ +/// Return sector for given detElemId and cath. +/// If segmentation is not of sector type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetSector(GetMpSegmentation(detElemId, cath, warn), warn); +} + +//_____________________________________________________________________________ +const AliMpSector* +AliMpSegmentation::GetSectorByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn) const +{ +/// Return sector for given detElemId and elCardID. +/// If segmentation is not of sector type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetSector(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); +} + +//_____________________________________________________________________________ +const AliMpSlat* +AliMpSegmentation::GetSlat(const AliMpVSegmentation* kSegmentation, + Bool_t warn) const +{ +/// Return slat for given mapping segmentation. +/// If segmentation is not of slat type, zero is returned +/// and an Error is issued if warn is set true (default). + + if ( ! kSegmentation ) return 0; + + if ( kSegmentation->StationType() != AliMp::kStation345 ) { + if ( warn ) { + AliErrorStream() + << "Segmentation is not of slat type" << endl; + } + return 0; + } + + return + static_cast(kSegmentation)->Slat(); +} + +//_____________________________________________________________________________ +const AliMpSlat* +AliMpSegmentation::GetSlat(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn) const +{ +/// Return slat for given detElemId and cath. +/// If segmentation is not of slat type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetSlat(GetMpSegmentation(detElemId, cath, warn), warn); +} + +//_____________________________________________________________________________ +const AliMpSlat* +AliMpSegmentation::GetSlatByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn) const +{ +/// Return slat for given detElemId and elCardID. +/// If segmentation is not of slat type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetSlat(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); +} + +//_____________________________________________________________________________ +const AliMpTrigger* +AliMpSegmentation::GetTrigger(const AliMpVSegmentation* kSegmentation, + Bool_t warn) const +{ +/// Return trigger for given mapping segmentation. +/// If segmentation is not of trigger type, zero is returned +/// and an Error is issued if warn is set true (default). + + if ( ! kSegmentation ) return 0; + + if ( kSegmentation->StationType() != AliMp::kStationTrigger ) { + if ( warn ) { + AliErrorStream() + << "Segmentation is not of trigger type" << endl; + } + return 0; + } + + return + static_cast(kSegmentation)->Slat(); +} + +//_____________________________________________________________________________ +const AliMpTrigger* +AliMpSegmentation::GetTrigger(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn) const +{ +/// Return trigger for given detElemId and cath. +/// If segmentation is not of trigger type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetTrigger(GetMpSegmentation(detElemId, cath, warn), warn); +} + +//_____________________________________________________________________________ +const AliMpTrigger* +AliMpSegmentation::GetTriggerByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn) const +{ +/// Return trigger for given detElemId and elCardID. +/// If segmentation is not of trigger type, zero is returned +/// and an Error is issued if warn is set true (default). + + return GetTrigger(GetMpSegmentationByElectronics(detElemId, elCardID, warn), warn); +} diff --git a/MUON/mapping/AliMpSegmentation.h b/MUON/mapping/AliMpSegmentation.h index 5ba5a9ce5f1..5b4820e85b0 100644 --- a/MUON/mapping/AliMpSegmentation.h +++ b/MUON/mapping/AliMpSegmentation.h @@ -12,7 +12,8 @@ /// \brief Singleton container class for mapping segmentations /// /// It provides access to mapping segmentations based on the -/// AliMpVSegmentation interface. \n +/// AliMpVSegmentation interface and to segmentations underlying +/// detectors (sector, slat, trigger). \n /// Mapping segmentations for all detection elements /// are created at the first call to AliMpSegmentation::Instance(). /// The class is a singleton, it has all constructors @@ -41,6 +42,9 @@ class AliMpVSegmentation; class AliMpSegmentation; class AliMpSlatMotifMap; class AliMpDataStreams; +class AliMpSector; +class AliMpSlat; +class AliMpTrigger; class TRootIOCtor; class AliMpSegmentation : public TObject { @@ -55,6 +59,11 @@ class AliMpSegmentation : public TObject { Bool_t warn = true); // methods + + // + // Access to segmentations + // + const AliMpVSegmentation* GetMpSegmentation( Int_t detElemId, AliMp::CathodType cath, Bool_t warn = true) const; @@ -62,7 +71,31 @@ class AliMpSegmentation : public TObject { const AliMpVSegmentation* GetMpSegmentationByElectronics( Int_t detElemId, Int_t elCardID, Bool_t warn = true) const; - + // + // Access to sectors, slats, triggers + // + + const AliMpSector* GetSector(const AliMpVSegmentation* kSegmentation, + Bool_t warn = true) const; + const AliMpSector* GetSector(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn = true) const; + const AliMpSector* GetSectorByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn = true) const; + + const AliMpSlat* GetSlat(const AliMpVSegmentation* kSegmentation, + Bool_t warn = true) const; + const AliMpSlat* GetSlat(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn = true) const; + const AliMpSlat* GetSlatByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn = true) const; + + const AliMpTrigger* GetTrigger(const AliMpVSegmentation* kSegmentation, + Bool_t warn = true) const; + const AliMpTrigger* GetTrigger(Int_t detElemId, AliMp::CathodType cath, + Bool_t warn = true) const; + const AliMpTrigger* GetTriggerByElectronics(Int_t detElemId, Int_t elCardID, + Bool_t warn = true) const; + private: AliMpSegmentation(const AliMpDataStreams& dataStreams); /// Not implemented @@ -72,6 +105,7 @@ class AliMpSegmentation : public TObject { AliMpVSegmentation* CreateMpSegmentation( Int_t detElemId, AliMp::CathodType cath); + AliMpExMap* FillElCardsMap(Int_t detElemId); diff --git a/MUON/mapping/AliMpSlatSegmentation.h b/MUON/mapping/AliMpSlatSegmentation.h index 822a45d23d8..39f6f9f0b82 100644 --- a/MUON/mapping/AliMpSlatSegmentation.h +++ b/MUON/mapping/AliMpSlatSegmentation.h @@ -71,7 +71,9 @@ class AliMpSlatSegmentation : public AliMpVSegmentation void GetAllElectronicCardIDs(TArrayI& ecn) const; - AliMp::PlaneType PlaneType() const; + virtual AliMp::PlaneType PlaneType() const; + + virtual AliMp::StationType StationType() const; TVector2 Dimensions() const; @@ -87,4 +89,8 @@ class AliMpSlatSegmentation : public AliMpVSegmentation ClassDef(AliMpSlatSegmentation,2) // A slat for stations 3,4,5 }; +/// Return station type +inline AliMp::StationType AliMpSlatSegmentation::StationType() const +{ return AliMp::kStation345; } + #endif diff --git a/MUON/mapping/AliMpStationType.cxx b/MUON/mapping/AliMpStationType.cxx index dd5110bc62a..e8b9999714c 100644 --- a/MUON/mapping/AliMpStationType.cxx +++ b/MUON/mapping/AliMpStationType.cxx @@ -21,6 +21,7 @@ TString AliMp::StationTypeName(AliMp::StationType stationType) switch ( stationType ) { case kStation1: return "st1"; break; case kStation2: return "st2"; break; + case kStation12: return "st12"; break; case kStation345: return "slat"; break; case kStationTrigger: return "trigger"; break; } diff --git a/MUON/mapping/AliMpStationType.h b/MUON/mapping/AliMpStationType.h index 5b7c07084bb..93a946f179f 100644 --- a/MUON/mapping/AliMpStationType.h +++ b/MUON/mapping/AliMpStationType.h @@ -21,6 +21,7 @@ namespace AliMp { { kStation1, ///< station 1 (quadrants) kStation2, ///< station 2 (quadrants) + kStation12, ///< station 1,2 (quadrants) kStation345, ///< station 3,4,5 (slats) kStationTrigger ///< trigger stations (slats) }; diff --git a/MUON/mapping/AliMpTriggerSegmentation.h b/MUON/mapping/AliMpTriggerSegmentation.h index 358f76350e3..88940c41360 100644 --- a/MUON/mapping/AliMpTriggerSegmentation.h +++ b/MUON/mapping/AliMpTriggerSegmentation.h @@ -62,8 +62,10 @@ public: virtual void GetAllElectronicCardIDs(TArrayI& ecn) const; - AliMp::PlaneType PlaneType() const; - + virtual AliMp::PlaneType PlaneType() const; + + virtual AliMp::StationType StationType() const; + TVector2 Dimensions() const; private: @@ -71,7 +73,7 @@ private: AliMpTriggerSegmentation(const AliMpTriggerSegmentation& right); /// Not implemented AliMpTriggerSegmentation& operator = (const AliMpTriggerSegmentation& right); - + const AliMpTrigger* fkSlat; ///< Slat Bool_t fIsOwner;///< Trigger slat ownership Int_t fNofStrips; ///< Number of strips in this slat @@ -79,4 +81,9 @@ private: ClassDef(AliMpTriggerSegmentation,3) // Segmentation for slat trigger stations }; +/// Return station type +inline AliMp::StationType AliMpTriggerSegmentation::StationType() const +{ return AliMp::kStationTrigger; } + + #endif diff --git a/MUON/mapping/AliMpVPainter.cxx b/MUON/mapping/AliMpVPainter.cxx index d69991b70c5..4b54106ce08 100755 --- a/MUON/mapping/AliMpVPainter.cxx +++ b/MUON/mapping/AliMpVPainter.cxx @@ -46,7 +46,7 @@ #include "AliMpSlatPainter.h" #include "AliMpIteratorPainter.h" #include "AliMpVPadIterator.h" -#include "AliMpSlatSegmentation.h" +#include "AliMpSegmentation.h" //#include "AliMpSectorSegmentation.h" #include @@ -180,11 +180,20 @@ AliMpVPainter *AliMpVPainter::CreatePainter(TObject *object) // return new AliMpSectorPainter(sectorSegmentation->GetSector()); // } + /* const AliMpSlatSegmentation* slatSegmentation = dynamic_cast(object); if (slatSegmentation) { return new AliMpSlatPainter(slatSegmentation->Slat()); } + */ + const AliMpSlat* kSlat + = AliMpSegmentation::Instance()->GetSlat((AliMpVSegmentation*)object); + if ( kSlat ) + { + return new AliMpSlatPainter(kSlat); + } + } return painter; } diff --git a/MUON/mapping/AliMpVSegmentation.h b/MUON/mapping/AliMpVSegmentation.h index 41719289728..75e0cd24fe2 100644 --- a/MUON/mapping/AliMpVSegmentation.h +++ b/MUON/mapping/AliMpVSegmentation.h @@ -23,6 +23,7 @@ #include "AliMpPadPair.h" #include "AliMpPad.h" #include "AliMpPlaneType.h" +#include "AliMpStationType.h" class AliMpVPadIterator; class AliMpIntPair; @@ -84,6 +85,9 @@ class AliMpVSegmentation : public TObject /// Return the plane type virtual AliMp::PlaneType PlaneType() const = 0; + /// Return the station type + virtual AliMp::StationType StationType() const = 0; + /// Return the half-sizes of the detection element virtual TVector2 Dimensions() const = 0; -- 2.43.0