From e0a499624c0cb4753d47b509a73b30e41c809219 Mon Sep 17 00:00:00 2001 From: martinez Date: Mon, 17 Jan 2005 11:09:31 +0000 Subject: [PATCH] - Detection elements segmentations now derived from the AliMUONVGeometryDESegmentation base class - Bool_t return type in segmentation GetPadI/C(...) makes possible to detect not existing pads - Uncommented function AliMUONVGeometryBuilder::MapSV for generating sensitive volume maps (required new version of VMC in Root (v1-0 or more for geant3) ) (Ivana) --- MUON/AliMUONGeometrySVMap.cxx | 4 -- MUON/AliMUONGeometrySegmentation.cxx | 30 +++++++------ MUON/AliMUONSt12QuadrantSegmentation.cxx | 55 +++++++++++++++++++++--- MUON/AliMUONSt12QuadrantSegmentation.h | 13 ++++-- MUON/AliMUONSt345SlatSegmentation.cxx | 4 +- MUON/AliMUONSt345SlatSegmentation.h | 7 ++- MUON/AliMUONVGeometryBuilder.cxx | 18 +------- MUON/libMUONgeometry.pkg | 1 + 8 files changed, 85 insertions(+), 47 deletions(-) diff --git a/MUON/AliMUONGeometrySVMap.cxx b/MUON/AliMUONGeometrySVMap.cxx index 6761d538e5f..43f063c8e33 100644 --- a/MUON/AliMUONGeometrySVMap.cxx +++ b/MUON/AliMUONGeometrySVMap.cxx @@ -134,13 +134,9 @@ void AliMUONStringIntMap::Clear() // Deletes the elements // --- - cout << "######### clearing map " << endl; - fNofItems = 0; fFirstArray.Delete(); fSecondArray.Reset(); - - cout << "######### clearing map done " << endl; } //______________________________________________________________________________ diff --git a/MUON/AliMUONGeometrySegmentation.cxx b/MUON/AliMUONGeometrySegmentation.cxx index 83a4bd796d6..a3210879a2b 100644 --- a/MUON/AliMUONGeometrySegmentation.cxx +++ b/MUON/AliMUONGeometrySegmentation.cxx @@ -22,10 +22,10 @@ // // Author:Ivana Hrivnacova, IPN Orsay -#include "AliSegmentation.h" #include "AliLog.h" #include "AliMUONGeometrySegmentation.h" +#include "AliMUONVGeometryDESegmentation.h" #include "AliMUONGeometryModule.h" #include "AliMUONGeometryDetElement.h" #include "AliMUONGeometryStore.h" @@ -119,8 +119,8 @@ Bool_t AliMUONGeometrySegmentation::Notify(Int_t detElemId) const return false; } - AliSegmentation* segmentation - = (AliSegmentation*) fDESegmentations->Get(detElemId); + AliMUONVGeometryDESegmentation* segmentation + = (AliMUONVGeometryDESegmentation*) fDESegmentations->Get(detElemId); if (!segmentation) { AliError(Form("Segmentation for detection element %d not defined", detElemId)); @@ -141,7 +141,7 @@ Bool_t AliMUONGeometrySegmentation::Notify(Int_t detElemId) const //______________________________________________________________________________ void AliMUONGeometrySegmentation::Add(Int_t detElemId, - AliSegmentation* segmentation) + AliMUONVGeometryDESegmentation* segmentation) { // Add detection element segmentation // --- @@ -156,8 +156,8 @@ void AliMUONGeometrySegmentation::SetPadSize(Float_t p1, Float_t p2) // --- for (Int_t i=0; iGetNofEntries(); i++) { - AliSegmentation* segmentation - = (AliSegmentation*)fDESegmentations->GetEntry(i); + AliMUONVGeometryDESegmentation* segmentation + = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetEntry(i); segmentation->SetPadSize(p1, p2); } } @@ -169,8 +169,8 @@ void AliMUONGeometrySegmentation::SetDAnod(Float_t d) // --- for (Int_t i=0; iGetNofEntries(); i++) { - AliSegmentation* segmentation - = (AliSegmentation*)fDESegmentations->GetEntry(i); + AliMUONVGeometryDESegmentation* segmentation + = (AliMUONVGeometryDESegmentation*)fDESegmentations->GetEntry(i); segmentation->SetDAnod(d); } } @@ -190,35 +190,41 @@ Float_t AliMUONGeometrySegmentation::GetAnod(Int_t detElemId, Float_t xhit) cons } //______________________________________________________________________________ -void AliMUONGeometrySegmentation::GetPadI(Int_t detElemId, +Bool_t AliMUONGeometrySegmentation::GetPadI(Int_t detElemId, Float_t xg, Float_t yg, Float_t zg, Int_t& ix, Int_t& iy) { // Returns pad coordinates (ix,iy) for given real coordinates (x,y) // --- - if (!Notify(detElemId)) return; + if (!Notify(detElemId)) return false; + + if (!fCurrentSegmentation->HasPad(xg, yg, zg)) return false; Float_t xl, yl, zl; fCurrentDetElement->Global2Local(xg, yg, zg, xl, yl, zl); fCurrentSegmentation->GetPadI(xl, yl, zl, ix, iy); + return true; } //______________________________________________________________________________ -void AliMUONGeometrySegmentation::GetPadC(Int_t detElemId, +Bool_t AliMUONGeometrySegmentation::GetPadC(Int_t detElemId, Int_t ix, Int_t iy, Float_t& xg, Float_t& yg, Float_t& zg) { // Transform from pad to real coordinates // --- - if (!Notify(detElemId)) return; + if (!Notify(detElemId)) return false; + + if (!fCurrentSegmentation->HasPad(ix, iy)) return false; Float_t xl, yl, zl; fCurrentSegmentation->GetPadC(ix, iy, xl , yl, zl); fGeometryModule->Local2Global(detElemId, xl, yl, zl, xg, yg, zg); + return true; } diff --git a/MUON/AliMUONSt12QuadrantSegmentation.cxx b/MUON/AliMUONSt12QuadrantSegmentation.cxx index 98a3a9c58e3..3979b9ea1df 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.cxx +++ b/MUON/AliMUONSt12QuadrantSegmentation.cxx @@ -49,7 +49,7 @@ const Float_t AliMUONSt12QuadrantSegmentation::fgkLengthUnit = 0.1; AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( AliMpStationType stationType, AliMpPlaneType planeType) -: AliSegmentation(), +: AliMUONVGeometryDESegmentation(), fSector(0), fSectorSegmentation(0), fSectorIterator(0), @@ -87,7 +87,7 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation( //______________________________________________________________________________ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() -: AliSegmentation(), +: AliMUONVGeometryDESegmentation(), fSector(0), fSectorSegmentation(0), fSectorIterator(0), @@ -115,7 +115,7 @@ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation() //______________________________________________________________________________ AliMUONSt12QuadrantSegmentation::AliMUONSt12QuadrantSegmentation(const AliMUONSt12QuadrantSegmentation& rhs) - : AliSegmentation(rhs) + : AliMUONVGeometryDESegmentation(rhs) { // Copy constructor AliFatal("Copy constructor is not implemented."); @@ -187,6 +187,29 @@ void AliMUONSt12QuadrantSegmentation::SetDAnod(Float_t d) fWireD = d; } +//______________________________________________________________________________ +Bool_t AliMUONSt12QuadrantSegmentation::HasPad(Float_t x, Float_t y, Float_t /*z*/) +{ +// Returns true if a pad exists in the given position + + AliMpPad pad = fSectorSegmentation + ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false); + + return pad.IsValid(); +} + + +//______________________________________________________________________________ +Bool_t AliMUONSt12QuadrantSegmentation::HasPad(Int_t ix, Int_t iy) +{ +// Returns true if a pad with given indices exists + + AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), false); + + return pad.IsValid(); +} + + //______________________________________________________________________________ Float_t AliMUONSt12QuadrantSegmentation::GetAnod(Float_t xhit) const { @@ -220,7 +243,7 @@ void AliMUONSt12QuadrantSegmentation::GetPadI(Float_t x, Float_t y, // --- AliMpPad pad = fSectorSegmentation - ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), false); + ->PadByPosition(TVector2(x/fgkLengthUnit, y/fgkLengthUnit), true); ix = pad.GetIndices().GetFirst(); iy = pad.GetIndices().GetSecond(); @@ -245,7 +268,7 @@ void AliMUONSt12QuadrantSegmentation::GetPadC(Int_t ix, Int_t iy, // If there is no pad, x = 0., y = 0. are returned. // --- - AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy)); + AliMpPad pad = fSectorSegmentation->PadByIndices(AliMpIntPair(ix,iy), true); x = pad.Position().X() * fgkLengthUnit; y = pad.Position().Y() * fgkLengthUnit; @@ -311,20 +334,38 @@ Float_t AliMUONSt12QuadrantSegmentation::Dpy(Int_t isector) const Int_t AliMUONSt12QuadrantSegmentation::Npx() const { // Maximum number of Pads in x +// hard coded for the time being // --- //Fatal("Npx", "Not yet implemented."); - return 142; //hard coded for the time being + switch (fSector->GetDirection()) { + case kX: + return 142; + case kY: + return 108; + default: + AliError("Unknown sector direction"); + return 0; + } } //______________________________________________________________________________ Int_t AliMUONSt12QuadrantSegmentation::Npy() const { // Maximum number of Pads in y +// hard coded for the time being // --- //Fatal("Npy", "Not yet implemented."); - return 213; //hard coded for the time being + switch (fSector->GetDirection()) { + case kX: + return 160; + case kY: + return 213; + default: + AliError("Unknown sector direction"); + return 0; + } } //______________________________________________________________________________ diff --git a/MUON/AliMUONSt12QuadrantSegmentation.h b/MUON/AliMUONSt12QuadrantSegmentation.h index 6575c9ebafd..fe8b2e6d9aa 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.h +++ b/MUON/AliMUONSt12QuadrantSegmentation.h @@ -17,7 +17,7 @@ #include "AliMpStationType.h" #include "AliMpPlaneType.h" -#include "AliSegmentation.h" +#include "AliMUONVGeometryDESegmentation.h" class TObjArray; @@ -28,11 +28,11 @@ class AliMpPad; class AliMUONChamber; -class AliMUONSt12QuadrantSegmentation : public AliSegmentation +class AliMUONSt12QuadrantSegmentation : public AliMUONVGeometryDESegmentation { public: AliMUONSt12QuadrantSegmentation(AliMpStationType stationType, - AliMpPlaneType planeType); + AliMpPlaneType planeType); AliMUONSt12QuadrantSegmentation(); virtual ~AliMUONSt12QuadrantSegmentation(); @@ -48,6 +48,13 @@ class AliMUONSt12QuadrantSegmentation : public AliSegmentation virtual void SetDAnod(Float_t D); // Anode Pitch + // Check if pad exists + // + virtual Bool_t HasPad(Float_t x, Float_t y, Float_t z); + // Returns true if a pad exists in the given position + virtual Bool_t HasPad(Int_t ix, Int_t iy); + // Returns true if a pad with given indices exists + // Transform from pad (wire) to real coordinates and vice versa // virtual Float_t GetAnod(Float_t xhit) const; diff --git a/MUON/AliMUONSt345SlatSegmentation.cxx b/MUON/AliMUONSt345SlatSegmentation.cxx index 6f39ad8acee..6a45aeee983 100644 --- a/MUON/AliMUONSt345SlatSegmentation.cxx +++ b/MUON/AliMUONSt345SlatSegmentation.cxx @@ -35,7 +35,7 @@ ClassImp(AliMUONSt345SlatSegmentation) AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation() - : AliSegmentation(), + : AliMUONVGeometryDESegmentation(), fId(0), fDpx(0), fDpy(0), @@ -61,7 +61,7 @@ AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation() (*fDpxD)[0]=(*fDpxD)[1]=(*fDpxD)[2]=(*fDpxD)[3]=0; } //---------------------------------------------------------------------- -AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs) : AliSegmentation(rhs) +AliMUONSt345SlatSegmentation::AliMUONSt345SlatSegmentation(const AliMUONSt345SlatSegmentation& rhs) : AliMUONVGeometryDESegmentation(rhs) { AliFatal("Not implemented."); } diff --git a/MUON/AliMUONSt345SlatSegmentation.h b/MUON/AliMUONSt345SlatSegmentation.h index 68afee9e009..16c37aaa5b4 100644 --- a/MUON/AliMUONSt345SlatSegmentation.h +++ b/MUON/AliMUONSt345SlatSegmentation.h @@ -13,12 +13,12 @@ // and the differents PCB densities. //********************************************************* -#include "AliSegmentation.h" +#include "AliMUONVGeometryDESegmentation.h" class TArrayF; class TArrayI; -class AliMUONSt345SlatSegmentation : public AliSegmentation +class AliMUONSt345SlatSegmentation : public AliMUONVGeometryDESegmentation { public: AliMUONSt345SlatSegmentation(); @@ -34,6 +34,9 @@ class AliMUONSt345SlatSegmentation : public AliSegmentation virtual void FirstPad(Float_t xhit, Float_t yhit, Float_t dx, Float_t dy); // Initialisation for pad iteration virtual void FirstPad(Float_t xhit, Float_t yhit, Float_t zhit, Float_t dx, Float_t dy); + virtual Bool_t HasPad(Float_t /*x*/, Float_t /*y*/, Float_t /*z*/) { return true; } + virtual Bool_t HasPad(Int_t /*ix*/, Int_t /*iy*/) { return true; } + virtual Float_t GetAnod(Float_t xhit) const; // Anod wire coordinate closest to xhit virtual void GetPadI(Float_t x ,Float_t y ,Int_t &ix,Int_t &iy); // Transform from pad to real coordinates virtual void GetPadI(Float_t x, Float_t y , Float_t z, Int_t &ix, Int_t &iy); diff --git a/MUON/AliMUONVGeometryBuilder.cxx b/MUON/AliMUONVGeometryBuilder.cxx index 0b8f3de117c..72d0a4818df 100644 --- a/MUON/AliMUONVGeometryBuilder.cxx +++ b/MUON/AliMUONVGeometryBuilder.cxx @@ -129,7 +129,6 @@ AliMUONVGeometryBuilder::operator = (const AliMUONVGeometryBuilder& rhs) return path; } -/* //______________________________________________________________________________ void AliMUONVGeometryBuilder::MapSV(const TString& path0, const TString& volName, Int_t detElemId) const @@ -147,8 +146,7 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0, TString volName(path0(npos1, npos2-npos1)); // Check if it is sensitive volume - Int_t moduleId = AliMUONVGeometryDEIndexing::Instance() - ->GetModuleId(detElemId); + Int_t moduleId = AliMUONVGeometryDEIndexing::GetModuleId(detElemId); AliMUONGeometryModule* geometry = GetGeometry(moduleId); if (geometry->IsSensitiveVolume(volName)) { //cout << ".. adding to the map " @@ -169,20 +167,6 @@ void AliMUONVGeometryBuilder::MapSV(const TString& path0, MapSV(path, newName, detElemId); } } -*/ - -//______________________________________________________________________________ -void AliMUONVGeometryBuilder::MapSV(const TString& /*path0*/, - const TString& /*volName*/, - Int_t /*detElemId*/) const -{ -// Update the path with all daughters volumes recursively -// and map it to the detection element Id if it is a sensitive volume -// --- - - AliWarning("Not yet available"); -} - //______________________________________________________________________________ void AliMUONVGeometryBuilder::FillData(Int_t moduleId, Int_t nofDetElements, diff --git a/MUON/libMUONgeometry.pkg b/MUON/libMUONgeometry.pkg index 072c3f26791..22ecea4758f 100644 --- a/MUON/libMUONgeometry.pkg +++ b/MUON/libMUONgeometry.pkg @@ -14,6 +14,7 @@ SRCS = AliMUONGeometryConstituent.cxx \ AliMUONVGeometryBuilder.cxx \ AliMUONGeometryBuilder.cxx \ AliMUONGeometryStore.cxx \ + AliMUONVGeometryDESegmentation.cxx \ AliMUONGeometrySegmentation.cxx HDRS = $(SRCS:.cxx=.h) -- 2.43.0