From 580c28fdf28199bac1840b049f0aed54a285658e Mon Sep 17 00:00:00 2001 From: martinez Date: Wed, 20 Apr 2005 07:41:57 +0000 Subject: [PATCH] liMUONSt12QuadrantSegmentation.cxx - Npx, Npy implemented using new function from mapping (Ivana) AliMUONTest.cxx AliMUONTest.h - Included Station2 segmentation - Extended printing pads (Ivana) mapping/AliMpPlaneSegmentation.cxx mapping/AliMpPlaneSegmentation.h mapping/AliMpRow.cxx mapping/AliMpRowSegment.cxx mapping/AliMpRowSegment.h mapping/AliMpRowSegmentLSpecial.cxx mapping/AliMpRowSegmentLSpecial.h mapping/AliMpRowSegmentRSpecial.cxx mapping/AliMpRowSegmentRSpecial.h mapping/AliMpSectorSegmentation.cxx mapping/AliMpSectorSegmentation.h mapping/AliMpVRowSegment.h mapping/AliMpVRowSegmentSpecial.cxx mapping/AliMpVRowSegmentSpecial.h mapping/AliMpVSegmentation.h mapping/data/station2/non-bending_plane/zones_special_outer.dat mapping/macros/testAllIndices.C mapping/macros/testAnyPadIterators.C mapping/macros/testExistingPads.C mapping/macros/testMotifTypeIterators.C mapping/macros/testPadDimensions.C mapping/macros/testPlaneAreaIterator.C mapping/macros/testReadMotifType.C - Corrected algorithms for setting global indices for special row segments (to work properly with station2 data) - Corrected zones_special_outer.dat for station2, non-bending_plane - Added new functions to AliMpVSegmentation interface: virtual Int_t MaxPadIndexX() = 0; virtual Int_t MaxPadIndexY() = 0; - Updated test macros to get them working with station2 (Ivana) --- MUON/AliMUONSt12QuadrantSegmentation.cxx | 22 +----- MUON/AliMUONTest.cxx | 67 ++++++++++++++++-- MUON/AliMUONTest.h | 2 + MUON/mapping/AliMpPlaneSegmentation.cxx | 20 ++++++ MUON/mapping/AliMpPlaneSegmentation.h | 3 + MUON/mapping/AliMpRow.cxx | 36 ++++++++-- MUON/mapping/AliMpRowSegment.cxx | 48 +++++++++---- MUON/mapping/AliMpRowSegment.h | 2 +- MUON/mapping/AliMpRowSegmentLSpecial.cxx | 45 +++++++++++- MUON/mapping/AliMpRowSegmentLSpecial.h | 3 +- MUON/mapping/AliMpRowSegmentRSpecial.cxx | 90 +++++++++++++++++++----- MUON/mapping/AliMpRowSegmentRSpecial.h | 1 + MUON/mapping/AliMpSectorSegmentation.cxx | 41 ++++++++++- MUON/mapping/AliMpSectorSegmentation.h | 8 ++- MUON/mapping/AliMpVRowSegment.h | 5 +- MUON/mapping/AliMpVRowSegmentSpecial.cxx | 33 --------- MUON/mapping/AliMpVRowSegmentSpecial.h | 2 +- MUON/mapping/AliMpVSegmentation.h | 3 + 18 files changed, 320 insertions(+), 111 deletions(-) diff --git a/MUON/AliMUONSt12QuadrantSegmentation.cxx b/MUON/AliMUONSt12QuadrantSegmentation.cxx index 4a3454d1118..48d84c123f7 100644 --- a/MUON/AliMUONSt12QuadrantSegmentation.cxx +++ b/MUON/AliMUONSt12QuadrantSegmentation.cxx @@ -378,16 +378,7 @@ Int_t AliMUONSt12QuadrantSegmentation::Npx() const // hard coded for the time being // --- - //Fatal("Npx", "Not yet implemented."); - switch (fSector->GetDirection()) { - case kX: - return 142; - case kY: - return 108; - default: - AliError("Unknown sector direction"); - return 0; - } + return fSectorSegmentation->MaxPadIndexX(); } //______________________________________________________________________________ @@ -397,16 +388,7 @@ Int_t AliMUONSt12QuadrantSegmentation::Npy() const // hard coded for the time being // --- - //Fatal("Npy", "Not yet implemented."); - switch (fSector->GetDirection()) { - case kX: - return 160; - case kY: - return 213; - default: - AliError("Unknown sector direction"); - return 0; - } + return fSectorSegmentation->MaxPadIndexY(); } //______________________________________________________________________________ diff --git a/MUON/AliMUONTest.cxx b/MUON/AliMUONTest.cxx index 7acb4910307..f2535280893 100644 --- a/MUON/AliMUONTest.cxx +++ b/MUON/AliMUONTest.cxx @@ -142,6 +142,51 @@ AliMUONTest::CreateSt1Segmentation(Int_t chamberId, Int_t cathod) return segmentation; } +//________________________________________________________________________ +AliMUONGeometrySegmentation* +AliMUONTest::CreateSt2Segmentation(Int_t chamberId, Int_t cathod) +{ +// Create St1 geometry segmentation for given chamber and cathod + + AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON"); + if (!muon) { + AliFatal("MUON detector not defined."); + return 0; + } + + AliMUONGeometrySegmentation* segmentation + = new AliMUONGeometrySegmentation(muon->Chamber(chamberId).GetGeometry()); + + // Quadrant segmentations: + AliMUONSt12QuadrantSegmentation* bendSt2 + = new AliMUONSt12QuadrantSegmentation(kStation2, kBendingPlane); + AliMUONSt12QuadrantSegmentation* nonbendSt2 + = new AliMUONSt12QuadrantSegmentation(kStation2, kNonBendingPlane); + + // The same configuration for both chambers of Station 2 + Int_t id0 = (chamberId+1)*100; + + // Configure St2 chamber segmentations + if (cathod == 0) { + segmentation->Add(id0, bendSt2); + segmentation->Add(id0 + 1, nonbendSt2); + segmentation->Add(id0 + 50, bendSt2); + segmentation->Add(id0 + 51, nonbendSt2); + } + else if (cathod == 1) { + segmentation->Add(id0, nonbendSt2); + segmentation->Add(id0 + 1, bendSt2); + segmentation->Add(id0 + 50, nonbendSt2); + segmentation->Add(id0 + 51, bendSt2); + } + else { + AliError("Wrong cathod number"); + return 0; + } + + return segmentation; +} + //_____________________________________________________________________________ AliMUONGeometrySegmentation* AliMUONTest::CreateSlatSegmentation(Int_t chamberId, Int_t cathod) @@ -730,8 +775,7 @@ AliMUONTest::CreateSegmentation(Int_t chamberId, Int_t cath) // Station2 case 2: case 3: - AliWarning("Not yet implemented"); - return 0; + return CreateSt2Segmentation(chamberId, cath); break; // Slat stations @@ -866,8 +910,8 @@ void AliMUONTest::ForWhole(AliMUONTests testCase) timer.Start(); // Loop over chambers -// for (Int_t iChamber=0; iChamberGetPadC(detElemId, ix, iy, x, y, z); - if (!success) return; - cout << setw(6) << "counter " << counter++ << " "; cout << "Pad indices: ( " << detElemId << "; " << ix << ", " << iy << " ) " ; - cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl; + + if (success) { + cout << "Pad position: ( " << x << ", " << y << ", " << z << " ); "; + Int_t sector = segmentation->Sector(detElemId, ix, iy); + Float_t dpx = segmentation->Dpx(detElemId, sector); + Float_t dpy = segmentation->Dpy(detElemId, sector); + cout << " dimensions: ( " << dpx << ", " << dpy << " )" << endl; + } + else { + counter--; + cout << "... no pad " << endl; + } } //______________________________________________________________________________ diff --git a/MUON/AliMUONTest.h b/MUON/AliMUONTest.h index 3566c1d311b..6968ce5e0b8 100644 --- a/MUON/AliMUONTest.h +++ b/MUON/AliMUONTest.h @@ -73,6 +73,8 @@ class AliMUONTest : public TObject private: AliMUONGeometrySegmentation* CreateSt1Segmentation( Int_t chamberId, Int_t cathod); + AliMUONGeometrySegmentation* CreateSt2Segmentation( + Int_t chamberId, Int_t cathod); AliMUONGeometrySegmentation* CreateSlatSegmentation( Int_t chamberId, Int_t cathod); AliMUONGeometrySegmentation* CreateTriggerSegmentation( diff --git a/MUON/mapping/AliMpPlaneSegmentation.cxx b/MUON/mapping/AliMpPlaneSegmentation.cxx index 64381f60026..4dedf3a5da0 100644 --- a/MUON/mapping/AliMpPlaneSegmentation.cxx +++ b/MUON/mapping/AliMpPlaneSegmentation.cxx @@ -288,6 +288,26 @@ AliMpPad AliMpPlaneSegmentation::PadByPosition(const TVector2& position, return kTransformer->Transform(pad); } +//______________________________________________________________________________ +Int_t AliMpPlaneSegmentation::MaxPadIndexX() +{ +// Return maximum pad index in x + + Fatal("MaxPadIndexX", " not implemented."); + + return 0; +} + +//______________________________________________________________________________ +Int_t AliMpPlaneSegmentation::MaxPadIndexY() +{ +// Return maximum pad index in y + + Fatal("MaxPadIndexY", " not implemented."); + + return 0; +} + //_____________________________________________________________________________ Bool_t AliMpPlaneSegmentation::HasPad(const AliMpIntPair& indices) const { diff --git a/MUON/mapping/AliMpPlaneSegmentation.h b/MUON/mapping/AliMpPlaneSegmentation.h index c0162b0e38c..dc8f367f69f 100644 --- a/MUON/mapping/AliMpPlaneSegmentation.h +++ b/MUON/mapping/AliMpPlaneSegmentation.h @@ -49,6 +49,9 @@ class AliMpPlaneSegmentation : public AliMpVSegmentation Bool_t warning = kTRUE) const; virtual AliMpPad PadByPosition(const TVector2& position, Bool_t warning = kTRUE) const; + + virtual Int_t MaxPadIndexX(); + virtual Int_t MaxPadIndexY(); virtual Int_t Zone(const AliMpPad& pad, Bool_t warning = kTRUE) const; virtual TVector2 PadDimensions(Int_t zone, Bool_t warning = kTRUE) const; diff --git a/MUON/mapping/AliMpRow.cxx b/MUON/mapping/AliMpRow.cxx index 3ace568e4e3..6096e1b6bad 100755 --- a/MUON/mapping/AliMpRow.cxx +++ b/MUON/mapping/AliMpRow.cxx @@ -301,8 +301,8 @@ void AliMpRow::SetMotifPositions() void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection, AliMpRow* rowBefore) { -// Sets the global indices limits to its row segments, -// motif positions. +// Sets the global indices limits to its row segments, motif positions +// and itself. // --- Int_t ix = AliMpConstants::StartPadIndex(); @@ -333,15 +333,37 @@ void AliMpRow::SetGlobalIndices(AliMpDirection constPadSizeDirection, } // Set (ix, iy) to k-th motif position and update ix - ix = rowSegment->SetIndicesToMotifPosition(k, AliMpIntPair(ix, iy)); + ix = rowSegment->SetIndicesToMotifPosition(k, AliMpIntPair(ix, iy)); } - rowSegment->SetGlobalIndices(); + rowSegment->SetGlobalIndices(rowBefore); } - SetLowIndicesLimit(GetRowSegment(0)->GetLowIndicesLimit()); - SetHighIndicesLimit(GetRowSegment(GetNofRowSegments()-1)->GetHighIndicesLimit()); + // The low/high indices limits has to be taken as the highest/lowest from all + // row segments + Int_t ixl = 9999; + Int_t iyl = 9999; + Int_t ixh = AliMpConstants::StartPadIndex(); + Int_t iyh = AliMpConstants::StartPadIndex(); - return ; + for (Int_t i=0; iGetLowIndicesLimit().GetFirst() < ixl ) + ixl = rowSegment->GetLowIndicesLimit().GetFirst(); + + if ( rowSegment->GetLowIndicesLimit().GetSecond() < iyl ) + iyl = rowSegment->GetLowIndicesLimit().GetSecond(); + + if ( rowSegment->GetHighIndicesLimit().GetFirst() > ixh ) + ixh = rowSegment->GetHighIndicesLimit().GetFirst(); + + if ( rowSegment->GetHighIndicesLimit().GetSecond() > iyh ) + iyh = rowSegment->GetHighIndicesLimit().GetSecond(); + } + + SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); + SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); } //_____________________________________________________________________________ diff --git a/MUON/mapping/AliMpRowSegment.cxx b/MUON/mapping/AliMpRowSegment.cxx index cfcbb22923c..7a25708efd5 100755 --- a/MUON/mapping/AliMpRowSegment.cxx +++ b/MUON/mapping/AliMpRowSegment.cxx @@ -18,6 +18,7 @@ #include "AliMpMotifTypePadIterator.h" #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" +#include "AliMpConstants.h" ClassImp(AliMpRowSegment) @@ -298,26 +299,45 @@ void AliMpRowSegment::SetOffset(const TVector2& offset) fOffset = TVector2(offsetX, offsetY); } +#include //_____________________________________________________________________________ -void AliMpRowSegment::SetGlobalIndices() +void AliMpRowSegment::SetGlobalIndices(AliMpRow* /*rowBefore*/) { // Sets indices limits. // --- - AliMpMotifPosition* firstPos - = GetRow()->GetMotifMap() - ->FindMotifPosition(GetMotifPositionId(0)); - - AliMpMotifPosition* lastPos - = GetRow()->GetMotifMap() - ->FindMotifPosition(GetMotifPositionId(GetNofMotifs()-1)); - - // Check if the motif positions has the limits set - if ( !firstPos->HasValidIndices() || !lastPos->HasValidIndices()) - Fatal("SetGlobalIndices", "Indices of motif positions have to be set first."); + // The low/high indices limits has to be taken as the highest/lowest from all + // motif positions + Int_t ixl = 9999; + Int_t iyl = 9999; + Int_t ixh = AliMpConstants::StartPadIndex(); + Int_t iyh = AliMpConstants::StartPadIndex(); + + for (Int_t i=0; iGetMotifMap()->FindMotifPosition(GetMotifPositionId(i)); + + // Check if the motif positions has the limits set + if ( !mPos->HasValidIndices() ) + Fatal("SetGlobalIndices", + "Indices of motif positions have to be set first."); - SetLowIndicesLimit(firstPos->GetLowIndicesLimit()); - SetHighIndicesLimit(lastPos->GetHighIndicesLimit()); + if ( mPos->GetLowIndicesLimit().GetFirst() < ixl ) + ixl = mPos->GetLowIndicesLimit().GetFirst(); + + if ( mPos->GetLowIndicesLimit().GetSecond() < iyl ) + iyl = mPos->GetLowIndicesLimit().GetSecond(); + + if ( mPos->GetHighIndicesLimit().GetFirst() > ixh ) + ixh = mPos->GetHighIndicesLimit().GetFirst(); + + if ( mPos->GetHighIndicesLimit().GetSecond() > iyh ) + iyh = mPos->GetHighIndicesLimit().GetSecond(); + } + + SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); + SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); } //_____________________________________________________________________________ diff --git a/MUON/mapping/AliMpRowSegment.h b/MUON/mapping/AliMpRowSegment.h index 33d96b76dcb..0abe44a4f07 100755 --- a/MUON/mapping/AliMpRowSegment.h +++ b/MUON/mapping/AliMpRowSegment.h @@ -44,7 +44,7 @@ class AliMpRowSegment : public AliMpVRowSegment // set methods virtual void SetOffset(const TVector2& offset); - virtual void SetGlobalIndices(); + virtual void SetGlobalIndices(AliMpRow* rowBefore); virtual Int_t SetIndicesToMotifPosition(Int_t i, const AliMpIntPair& indices); diff --git a/MUON/mapping/AliMpRowSegmentLSpecial.cxx b/MUON/mapping/AliMpRowSegmentLSpecial.cxx index 30e5b661987..f5244ef6aa8 100755 --- a/MUON/mapping/AliMpRowSegmentLSpecial.cxx +++ b/MUON/mapping/AliMpRowSegmentLSpecial.cxx @@ -205,6 +205,7 @@ TVector2 AliMpRowSegmentLSpecial::Position() const return TVector2(x, y); } +#include //______________________________________________________________________________ Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, const AliMpIntPair& indices) @@ -241,9 +242,10 @@ Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType(); AliMpIntPair high = motifPosition->GetLowIndicesLimit() - + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); + + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); + motifPosition->SetHighIndicesLimit(high); - + // Increment index only if last motif position is processed if (i != GetNofMotifs()-1) return indices.GetFirst(); @@ -252,6 +254,45 @@ Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, return indices.GetFirst() + MaxNofPadsInRow(); //return MaxNofPadsInRow(); } +//______________________________________________________________________________ +void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore) +{ +// Sets indices limits +// The limits are defined as the limits of the smallest rectangle which +// includes all pads of this special row segment. +// --- + + // Low ix + Int_t ixl = GetLowIndicesLimit().GetFirst() + AliMpConstants::StartPadIndex(); + // the pads offset was already defined by Reader + + // High ix + Int_t ixh = ixl + MaxNofPadsInRow() - 1; + + // Low iy + Int_t iyl = AliMpConstants::StartPadIndex(); + if (rowBefore) { + //if (constPadSizeDirection == kY) { + iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1; + //} + /* + else { + AliMpVRowSegment* seg = rowBefore->FindRowSegment(ixl); + AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl); + if (!motPos) + Fatal("SetGlobalIndices", "Motif position in rowBefore not found."); + iyl = motPos->GetHighIndicesLimit().GetSecond()+1; + } + */ + } + + // High iy + Int_t iyh = iyl + GetNofPadRows() - 1; + + SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); + SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); +} + diff --git a/MUON/mapping/AliMpRowSegmentLSpecial.h b/MUON/mapping/AliMpRowSegmentLSpecial.h index a4d5f7bdcf1..d7c4759e55e 100755 --- a/MUON/mapping/AliMpRowSegmentLSpecial.h +++ b/MUON/mapping/AliMpRowSegmentLSpecial.h @@ -37,8 +37,9 @@ class AliMpRowSegmentLSpecial : public AliMpVRowSegmentSpecial virtual TVector2 Position() const; // set methods + virtual void SetGlobalIndices(AliMpRow* rowBefore); virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices); + const AliMpIntPair& indices); protected: // methods diff --git a/MUON/mapping/AliMpRowSegmentRSpecial.cxx b/MUON/mapping/AliMpRowSegmentRSpecial.cxx index 2097282370b..d76cde032c8 100644 --- a/MUON/mapping/AliMpRowSegmentRSpecial.cxx +++ b/MUON/mapping/AliMpRowSegmentRSpecial.cxx @@ -19,6 +19,7 @@ #include "AliMpMotifType.h" #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" +#include "AliMpConstants.h" ClassImp(AliMpRowSegmentRSpecial) @@ -209,7 +210,7 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, // Update low indices limit for this row segment SetGlobalIndicesLow(); - + // Check for consistence if (GetLowIndicesLimit().GetFirst() != indices.GetFirst()) Fatal("SetIndicesToMotifPosition", "Inconsistent indices"); @@ -217,34 +218,85 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, // Get motif position AliMpMotifPosition* motifPosition = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i)); + + // Set limits only once + if ( motifPosition->GetHighIndicesLimit().IsValid() ) + return indices.GetFirst();; // Low limit - AliMpIntPair low = GetLowIndicesLimit(); - - if (! motifPosition->GetHighIndicesLimit().IsValid()) { - motifPosition->SetLowIndicesLimit(low); - } - else { - if (motifPosition->GetLowIndicesLimit().GetFirst() > low.GetFirst()) - motifPosition->SetLowIndicesLimit( - AliMpIntPair(low.GetFirst(), - motifPosition->GetLowIndicesLimit().GetSecond())); - - if (motifPosition->GetLowIndicesLimit().GetSecond() > low.GetSecond()) - motifPosition->SetLowIndicesLimit( - AliMpIntPair(motifPosition->GetLowIndicesLimit().GetFirst(), - low.GetSecond())); - } + // + Int_t ixl = GetLowIndicesLimit().GetFirst(); + Int_t iyl = GetLowIndicesLimit().GetSecond(); + + // Find the most down pad row segment with this motifPositionId. + AliMpVPadRowSegment* padRowSegment = FindPadRowSegment(GetMotifPositionId(i)); + Int_t padRowID = padRowSegment->GetPadRow()->GetID(); + iyl += padRowID; + + // Add pads offset of this motif position in the row segment + for (Int_t im=0; imGetPadRowSegment(im); + if ( rs->GetMotifPositionId() == GetMotifPositionId(i) ) break; + ixl += rs->GetNofPads(); + } + motifPosition->SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); - // High limit + // High limit + // AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType(); AliMpIntPair high = motifPosition->GetLowIndicesLimit() + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); motifPosition->SetHighIndicesLimit(high); - + // No increment index needed (this is always the last element) return indices.GetFirst(); } +//______________________________________________________________________________ +void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore) +{ +// Sets indices limits. +// The limits are defined as the limits of the smallest rectangle which +// includes all pads of this special row segment. +// --- + + // Get first motif position + AliMpMotifPosition* firstMotifPosition + = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(0)); + + // Low ix + Int_t ixl = firstMotifPosition->GetLowIndicesLimit().GetFirst(); + // We have to take the motif position limit + // as it can overlap over more rows and the indices + // of the right border of the precedent normal segment + // differ from one row to another + + // High ix + Int_t ixh = ixl + MaxNofPadsInRow() - 1; + + // Low iy + Int_t iyl = AliMpConstants::StartPadIndex(); + if (rowBefore) { + //if (constPadSizeDirection == kY) { + iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1; + //} + /* + else { + AliMpVRowSegment* seg = rowBefore->FindRowSegment(ixl); + AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl); + if (!motPos) + Fatal("SetGlobalIndices", "Motif position in rowBefore not found."); + iyl = motPos->GetHighIndicesLimit().GetSecond()+1; + } + */ + } + + // High iy + Int_t iyh = iyl + GetNofPadRows() - 1; + + SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); + SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); +} + diff --git a/MUON/mapping/AliMpRowSegmentRSpecial.h b/MUON/mapping/AliMpRowSegmentRSpecial.h index d0423bcd487..d92800b7183 100644 --- a/MUON/mapping/AliMpRowSegmentRSpecial.h +++ b/MUON/mapping/AliMpRowSegmentRSpecial.h @@ -37,6 +37,7 @@ class AliMpRowSegmentRSpecial : public AliMpVRowSegmentSpecial virtual TVector2 Position() const; // set methods + virtual void SetGlobalIndices(AliMpRow* rowBefore); virtual Int_t SetIndicesToMotifPosition(Int_t i, const AliMpIntPair& indices); diff --git a/MUON/mapping/AliMpSectorSegmentation.cxx b/MUON/mapping/AliMpSectorSegmentation.cxx index d6512a6eeb4..62d5b89ef0a 100755 --- a/MUON/mapping/AliMpSectorSegmentation.cxx +++ b/MUON/mapping/AliMpSectorSegmentation.cxx @@ -41,7 +41,9 @@ const Double_t AliMpSectorSegmentation::fgkS2 = 100.; //______________________________________________________________________________ AliMpSectorSegmentation::AliMpSectorSegmentation(const AliMpSector* sector) : AliMpVSegmentation(), - fkSector(sector) + fkSector(sector), + fMaxIndexInX(0), + fMaxIndexInY(0) { // fPadBuffer = new AliMpPad(AliMpPad::Invalid()); @@ -54,7 +56,9 @@ AliMpSectorSegmentation::AliMpSectorSegmentation() : AliMpVSegmentation(), fkSector(0), fPadBuffer(0), - fPadDimensionsMap() + fPadDimensionsMap(), + fMaxIndexInX(0), + fMaxIndexInY(0) { // } @@ -376,7 +380,10 @@ AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices, AliMpMotifPosition* motifPos = FindMotifPosition(indices); if (!motifPos) { - if (warning) Warning("PadByIndices","Pad indices not contained in any motif!"); + if (warning) { + cout << "indices " << indices << endl; + Warning("PadByIndices","Pad indices not contained in any motif!"); + } return AliMpPad::Invalid(); } @@ -464,6 +471,34 @@ AliMpSectorSegmentation::PadByDirection(const TVector2& startPosition, return AliMpPad::Invalid(); } +//______________________________________________________________________________ +Int_t AliMpSectorSegmentation::MaxPadIndexX() +{ +// Return maximum pad index in x + + if (fMaxIndexInX) return fMaxIndexInX; + + for (Int_t i=0; iGetNofRows(); i++) { + Int_t ixh = fkSector->GetRow(i)->GetHighIndicesLimit().GetFirst(); + if ( ixh > fMaxIndexInX ) fMaxIndexInX = ixh; + } + return fMaxIndexInX; +} + +//______________________________________________________________________________ +Int_t AliMpSectorSegmentation::MaxPadIndexY() +{ +// Return maximum pad index in y + + if (fMaxIndexInY) return fMaxIndexInY; + + for (Int_t i=0; iGetNofRows(); i++) { + Int_t iyh = fkSector->GetRow(i)->GetHighIndicesLimit().GetSecond(); + if ( iyh > fMaxIndexInY ) fMaxIndexInY = iyh; + } + return fMaxIndexInY; +} + //______________________________________________________________________________ Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const { diff --git a/MUON/mapping/AliMpSectorSegmentation.h b/MUON/mapping/AliMpSectorSegmentation.h index 9d04aea061d..ebd3de0be22 100755 --- a/MUON/mapping/AliMpSectorSegmentation.h +++ b/MUON/mapping/AliMpSectorSegmentation.h @@ -46,6 +46,9 @@ class AliMpSectorSegmentation : public AliMpVSegmentation Bool_t warning = kTRUE) const; virtual AliMpPad PadByDirection(const TVector2& startPosition, Double_t distance) const; + + virtual Int_t MaxPadIndexX(); + virtual Int_t MaxPadIndexY(); virtual Int_t Zone(const AliMpPad& pad, Bool_t warning = kTRUE) const; virtual TVector2 PadDimensions(Int_t zone, Bool_t warning = kTRUE) const; @@ -88,7 +91,10 @@ class AliMpSectorSegmentation : public AliMpVSegmentation #endif #ifdef WITH_ROOT mutable PadDimensionsMap fPadDimensionsMap; // Map between zone IDs and pad dimensions -#endif +#endif + + Int_t fMaxIndexInX; // maximum pad index in x + Int_t fMaxIndexInY; // maximum pad index in y ClassDef(AliMpSectorSegmentation,1) // Segmentation }; diff --git a/MUON/mapping/AliMpVRowSegment.h b/MUON/mapping/AliMpVRowSegment.h index 6e2dde11290..ce9158c01ef 100755 --- a/MUON/mapping/AliMpVRowSegment.h +++ b/MUON/mapping/AliMpVRowSegment.h @@ -13,6 +13,7 @@ #include #include "AliMpVIndexed.h" +#include "AliMpDirection.h" class AliMpRow; class AliMpVMotif; @@ -42,9 +43,9 @@ class AliMpVRowSegment : public AliMpVIndexed // set methods virtual void SetOffset(const TVector2& offset) = 0; - virtual void SetGlobalIndices() = 0; + virtual void SetGlobalIndices(AliMpRow* rowBefore) = 0; virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) = 0; + const AliMpIntPair& indices) = 0; // get methods virtual AliMpRow* GetRow() const = 0; diff --git a/MUON/mapping/AliMpVRowSegmentSpecial.cxx b/MUON/mapping/AliMpVRowSegmentSpecial.cxx index 23ba8be1e59..736865c13de 100644 --- a/MUON/mapping/AliMpVRowSegmentSpecial.cxx +++ b/MUON/mapping/AliMpVRowSegmentSpecial.cxx @@ -403,39 +403,6 @@ TVector2 AliMpVRowSegmentSpecial::Dimensions() const return TVector2(x, y); } -//______________________________________________________________________________ -void AliMpVRowSegmentSpecial::SetGlobalIndices() -{ -// Sets indices limits. -// --- - - AliMpMotifPosition* firstPos = 0; - AliMpMotifPosition* lastPos = 0; - - for (Int_t i=0;iGetMotifMap() - ->FindMotifPosition(GetMotifPositionId(i)); - - if (!firstPos || - mPos->GetLowIndicesLimit().GetFirst() - < firstPos->GetLowIndicesLimit().GetFirst()) - firstPos = mPos; - - if (!lastPos || - mPos->GetHighIndicesLimit().GetFirst() - >lastPos->GetHighIndicesLimit().GetFirst()) - lastPos = mPos; - } - - // Check if the motif positions has the limits set - if ( !firstPos->HasValidIndices() || !lastPos->HasValidIndices()) - Fatal("SetGlobalIndices", "Indices of motif positions have to be set first."); - - SetLowIndicesLimit(firstPos->GetLowIndicesLimit()); - SetHighIndicesLimit(lastPos->GetHighIndicesLimit()); -} - //______________________________________________________________________________ AliMpRow* AliMpVRowSegmentSpecial::GetRow() const { diff --git a/MUON/mapping/AliMpVRowSegmentSpecial.h b/MUON/mapping/AliMpVRowSegmentSpecial.h index bfbfa614105..0e765e7e21f 100644 --- a/MUON/mapping/AliMpVRowSegmentSpecial.h +++ b/MUON/mapping/AliMpVRowSegmentSpecial.h @@ -49,7 +49,7 @@ class AliMpVRowSegmentSpecial : public AliMpVRowSegment // set methods virtual void SetOffset(const TVector2& /*offset*/) {} - virtual void SetGlobalIndices(); + virtual void SetGlobalIndices(AliMpRow* rowBefore) = 0; virtual Int_t SetIndicesToMotifPosition(Int_t i, const AliMpIntPair& indices) = 0; diff --git a/MUON/mapping/AliMpVSegmentation.h b/MUON/mapping/AliMpVSegmentation.h index 46d5bd7db70..e9338746eb9 100644 --- a/MUON/mapping/AliMpVSegmentation.h +++ b/MUON/mapping/AliMpVSegmentation.h @@ -46,6 +46,9 @@ class AliMpVSegmentation : public TObject virtual AliMpPadPair PadsLeft(const AliMpPad& pad) const; virtual AliMpPadPair PadsRight(const AliMpPad& pad) const; + virtual Int_t MaxPadIndexX() = 0; + virtual Int_t MaxPadIndexY() = 0; + virtual Bool_t HasPad(const AliMpIntPair& indices) const = 0; private: -- 2.39.3