From 168e9c4d964fb4c171ece6ecd58086a307241034 Mon Sep 17 00:00:00 2001 From: hristov Date: Tue, 31 Mar 2009 09:44:00 +0000 Subject: [PATCH] Replacement of AliMpIntPair object with algoritmic encoding of pair of integers (proposed by Laurent); this speeds up all Segmentation search functions (see timeMapping2.out in mapping/macros). Ivana & Laurent --- EVE/EveDet/AliEveMUONChamberData.cxx | 3 +- .../AliHLTMUONHitReconstructorComponent.cxx | 8 +- ...liHLTMUONTriggerReconstructorComponent.cxx | 2 +- .../utils/AliHLTMUONDataCheckerComponent.cxx | 4 +- MUON/AliMUONCDB.cxx | 8 +- MUON/AliMUONCluster.cxx | 28 +-- MUON/AliMUONCluster.h | 8 +- MUON/AliMUONClusterFinderMLEM.cxx | 21 +- MUON/AliMUONClusterFinderPeakCOG.cxx | 7 +- MUON/AliMUONClusterFinderPeakFit.cxx | 7 +- MUON/AliMUONClusterSplitterMLEM.cxx | 8 +- MUON/AliMUONDataInterface.cxx | 6 +- MUON/AliMUONDigitMaker.cxx | 17 +- MUON/AliMUONDigitizerV3.cxx | 15 +- MUON/AliMUONESDInterface.cxx | 5 +- MUON/AliMUONMCDataInterface.cxx | 10 +- MUON/AliMUONManuPadPainter.cxx | 9 +- MUON/AliMUONPainterContourMaker.cxx | 18 +- MUON/AliMUONPainterHelper.cxx | 4 +- MUON/AliMUONPedestalEventGenerator.cxx | 3 +- MUON/AliMUONPreClusterFinderV2.cxx | 6 +- MUON/AliMUONResponseTrigger.cxx | 10 +- MUON/AliMUONResponseTriggerV1.cxx | 17 +- MUON/AliMUONResponseV0.cxx | 6 +- MUON/AliMUONSimpleClusterServer.cxx | 4 +- MUON/AliMUONTrackHitPattern.cxx | 10 +- MUON/AliMUONTrackerData.cxx | 7 +- MUON/AliMUONTriggerCircuit.cxx | 21 +- MUON/AliMUONTriggerDisplay.cxx | 6 +- MUON/AliMUONTriggerEfficiencyCells.cxx | 2 +- MUON/AliMUONTriggerElectronics.cxx | 8 +- MUON/AliMUONTriggerGUI.cxx | 39 ++-- MUON/AliMUONTriggerGUIbdmap.cxx | 22 ++- MUON/AliMUONTriggerGUIboard.cxx | 17 +- MUON/AliMUONTriggerGUIdimap.cxx | 2 +- MUON/CMake_libMUONmapping.txt | 4 +- MUON/Doxymodules.h | 4 + MUON/MUONClusterInfo.C | 2 +- MUON/MUONResoEffChamber.C | 1 - MUON/MUONStatusMap.C | 1 - MUON/MUONmappingLinkDef.h | 3 - MUON/libMUONmapping.pkg | 4 +- MUON/mapping/AliMpArrayI.cxx | 15 +- MUON/mapping/AliMpArrayI.h | 7 +- MUON/mapping/AliMpConnection.cxx | 61 +++--- MUON/mapping/AliMpConnection.h | 55 +++--- MUON/mapping/AliMpDDLStore.cxx | 12 +- MUON/mapping/AliMpDDLStore.h | 5 +- MUON/mapping/AliMpDEManager.cxx | 8 +- MUON/mapping/AliMpDEManager.h | 5 +- MUON/mapping/AliMpDEStore.cxx | 1 - MUON/mapping/AliMpDEStore.h | 1 - MUON/mapping/AliMpDEVisu.cxx | 2 +- MUON/mapping/AliMpDetElement.cxx | 2 +- MUON/mapping/AliMpEncodePair.cxx | 61 ++++++ MUON/mapping/AliMpEncodePair.h | 29 +++ MUON/mapping/AliMpExMap.cxx | 84 ++++---- MUON/mapping/AliMpExMap.h | 21 +- MUON/mapping/AliMpExMapIterator.cxx | 9 +- MUON/mapping/AliMpExMapIterator.h | 5 +- MUON/mapping/AliMpFastSegmentation.cxx | 100 +++++----- MUON/mapping/AliMpFastSegmentation.h | 8 +- MUON/mapping/AliMpFrtCrocusConstants.cxx | 7 +- MUON/mapping/AliMpFrtCrocusConstants.h | 4 +- MUON/mapping/AliMpIteratorPainter.cxx | 4 +- MUON/mapping/AliMpLocalBoard.cxx | 6 +- MUON/mapping/AliMpLocalBoard.h | 5 +- MUON/mapping/AliMpManuStore.cxx | 33 ++-- MUON/mapping/AliMpManuStore.h | 6 +- MUON/mapping/AliMpMotif.cxx | 43 +++-- MUON/mapping/AliMpMotif.h | 9 +- MUON/mapping/AliMpMotifMap.cxx | 21 +- MUON/mapping/AliMpMotifPainter.cxx | 35 ++-- MUON/mapping/AliMpMotifPosition.cxx | 15 +- MUON/mapping/AliMpMotifPosition.h | 2 +- .../mapping/AliMpMotifPositionPadIterator.cxx | 11 +- MUON/mapping/AliMpMotifReader.cxx | 17 +- MUON/mapping/AliMpMotifReader.h | 1 - MUON/mapping/AliMpMotifSpecial.cxx | 88 +++++---- MUON/mapping/AliMpMotifSpecial.h | 14 +- MUON/mapping/AliMpMotifType.cxx | 94 ++++----- MUON/mapping/AliMpMotifType.h | 19 +- MUON/mapping/AliMpMotifTypePadIterator.cxx | 96 ++++++---- MUON/mapping/AliMpMotifTypePadIterator.h | 9 +- MUON/mapping/AliMpPCB.cxx | 27 +-- MUON/mapping/AliMpPCBPadIterator.cxx | 63 +++--- MUON/mapping/AliMpPCBPadIterator.h | 10 +- MUON/mapping/AliMpPad.cxx | 163 ++++++++++++---- MUON/mapping/AliMpPad.h | 45 +++-- MUON/mapping/AliMpRow.cxx | 40 ++-- MUON/mapping/AliMpRowSegment.cxx | 53 ++--- MUON/mapping/AliMpRowSegment.h | 9 +- MUON/mapping/AliMpRowSegmentLSpecial.cxx | 51 +++-- MUON/mapping/AliMpRowSegmentLSpecial.h | 4 +- MUON/mapping/AliMpRowSegmentRSpecial.cxx | 39 ++-- MUON/mapping/AliMpRowSegmentRSpecial.h | 4 +- MUON/mapping/AliMpSector.cxx | 15 +- MUON/mapping/AliMpSector.h | 12 +- MUON/mapping/AliMpSectorPadIterator.cxx | 1 - MUON/mapping/AliMpSectorReader.cxx | 3 +- MUON/mapping/AliMpSectorReader.h | 1 - MUON/mapping/AliMpSectorSegmentation.cxx | 181 +++++++++--------- MUON/mapping/AliMpSectorSegmentation.h | 19 +- MUON/mapping/AliMpSlatSegmentation.cxx | 128 ++++++------- MUON/mapping/AliMpSlatSegmentation.h | 10 +- MUON/mapping/AliMpTriggerSegmentation.cxx | 53 ++--- MUON/mapping/AliMpTriggerSegmentation.h | 6 +- MUON/mapping/AliMpVIndexed.cxx | 173 +++++++++++++++-- MUON/mapping/AliMpVIndexed.h | 58 +++--- MUON/mapping/AliMpVMotif.cxx | 33 +++- MUON/mapping/AliMpVMotif.h | 13 +- MUON/mapping/AliMpVRowSegment.h | 4 +- MUON/mapping/AliMpVRowSegmentSpecial.cxx | 25 +-- MUON/mapping/AliMpVRowSegmentSpecial.h | 6 +- MUON/mapping/AliMpVSegmentation.cxx | 92 +-------- MUON/mapping/AliMpVSegmentation.h | 28 +-- MUON/mapping/macros/testSt12AllIndices.C | 5 +- MUON/mapping/macros/testSt12AnyPadIterators.C | 22 +-- MUON/mapping/macros/testSt12ExistingPads.C | 6 +- MUON/mapping/macros/testSt12ExistingPads2.C | 10 +- MUON/mapping/macros/testSt12IndicesLimits.C | 27 +-- .../macros/testSt12MotifTypeIterators.C | 7 +- MUON/mapping/macros/testSt12PadDimensions.C | 7 +- MUON/mapping/macros/testSt12PrintLimits.C | 17 +- .../macros/testSt12SectorAreaIterator.C | 3 +- MUON/mapping/macros/testSt12SectorFind.C | 2 +- .../macros/testSt12SectorPadIterators.C | 10 +- MUON/mapping/macros/timeMapping.C | 14 +- MUON/mapping/macros/timeMapping2.C | 14 +- MUON/mapping/macros/timeMapping2.out | 38 ++-- 130 files changed, 1629 insertions(+), 1339 deletions(-) create mode 100644 MUON/mapping/AliMpEncodePair.cxx create mode 100644 MUON/mapping/AliMpEncodePair.h diff --git a/EVE/EveDet/AliEveMUONChamberData.cxx b/EVE/EveDet/AliEveMUONChamberData.cxx index 97168140e90..1e8813f11e6 100644 --- a/EVE/EveDet/AliEveMUONChamberData.cxx +++ b/EVE/EveDet/AliEveMUONChamberData.cxx @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -229,7 +230,7 @@ void AliEveMUONChamberData::RegisterDigit(Int_t detElemId, Int_t cathode, Int_t const AliMpVSegmentation* vseg = AliMpSegmentation::Instance() ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode)); - AliMpPad pad = vseg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + AliMpPad pad = vseg->PadByIndices(ix,iy,kTRUE); locP[0] = pad.Position().X(); locP[1] = pad.Position().Y(); diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx index d4f87f8fe3a..99d480de71f 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONHitReconstructorComponent.cxx @@ -962,19 +962,19 @@ int AliHLTMUONHitReconstructorComponent::ReadLutFromCDB() for (Int_t iX = 0; iX<= maxIX ; iX++) for (Int_t iY = 0; iY<= maxIY ; iY++) { - if (not seg->HasPad(AliMpIntPair(iX,iY))) continue; + if (not seg->HasPadByIndices(iX,iY)) continue; - AliMpPad pad = seg->PadByIndices(AliMpIntPair(iX,iY), kFALSE); + AliMpPad pad = seg->PadByIndices(iX,iY, kFALSE); // Getting Manu id - manuId = pad.GetLocation().GetFirst(); + manuId = pad.GetManuId(); manuId &= 0x7FF; // 11 bits if(!calibData.Pedestals(detElemId, manuId)) continue; buspatchId = ddlStore->GetBusPatchId(detElemId,manuId); // Getting channel id - channelId = pad.GetLocation().GetSecond(); + channelId = pad.GetManuChannel(); channelId &= 0x3F; // 6 bits idManuChannel = buspatchId << 11; diff --git a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx index 43c6bbe22cd..d196352de17 100644 --- a/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx +++ b/HLT/MUON/OnlineAnalysis/AliHLTMUONTriggerReconstructorComponent.cxx @@ -980,7 +980,7 @@ int AliHLTMUONTriggerReconstructorComponent::ReadLutFromCDB() Int_t offset = 0; if (iCathode && localBoard->GetSwitch(6)) offset = -8; - AliMpPad pad = seg->PadByLocation(AliMpIntPair(boardId, bitxy+offset), kFALSE); + AliMpPad pad = seg->PadByLocation(boardId, bitxy+offset, kFALSE); if (! pad.IsValid()) { diff --git a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx index 7231499a3f5..827ba75de62 100644 --- a/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx +++ b/HLT/MUON/utils/AliHLTMUONDataCheckerComponent.cxx @@ -1813,7 +1813,7 @@ bool AliHLTMUONDataCheckerComponent::CheckRawDataBlock( continue; } - AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId, channelId), warn); + AliMpPad pad = seg->PadByLocation(manuId, channelId, warn); if (not pad.IsValid()) { HLTError("Problem found with data block %d, fDataType = '%s'," @@ -2458,7 +2458,7 @@ bool AliHLTMUONDataCheckerComponent::CheckChannelsBlock( } AliMpPad pad = seg->PadByLocation( - AliMpIntPair(channel.fManu, channel.fChannelAddress), + channel.fManu, channel.fChannelAddress, warn ); if (not pad.IsValid()) diff --git a/MUON/AliMUONCDB.cxx b/MUON/AliMUONCDB.cxx index f7059d641f5..2f638f5fb8f 100644 --- a/MUON/AliMUONCDB.cxx +++ b/MUON/AliMUONCDB.cxx @@ -118,7 +118,7 @@ void getBoundaries(const AliMUONVStore& store, Int_t dim, for ( Int_t manuChannel = 0; manuChannel < value->Size(); ++manuChannel ) { - AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE); + AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); if (!pad.IsValid()) continue; for ( Int_t i = 0; i < dim; ++i ) @@ -297,7 +297,7 @@ AliMUONCDB::Plot(const AliMUONVStore& store, const char* name, Int_t nbins) for ( Int_t manuChannel = 0; manuChannel < param->Size(); ++manuChannel ) { - AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE); + AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); if (!pad.IsValid()) continue; ++n; @@ -872,7 +872,7 @@ AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore) for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE); + AliMpPad pad = seg->PadByLocation(manuId,manuChannel,kFALSE); if (pad.IsValid()) { @@ -886,7 +886,7 @@ AliMUONCDB::MakeNeighbourStore(AliMUONVStore& neighbourStore) AliMpPad* p = static_cast(tmp.UncheckedAt(i)); Int_t x; // Bool_t ok = - calibParam->PackValues(p->GetLocation().GetFirst(),p->GetLocation().GetSecond(),x); + calibParam->PackValues(p->GetManuId(),p->GetManuChannel(),x); // if (!ok) // { // AliError("Could not pack value. Something is seriously wrong. Please check"); diff --git a/MUON/AliMUONCluster.cxx b/MUON/AliMUONCluster.cxx index d12ee700c52..1e251071e9d 100644 --- a/MUON/AliMUONCluster.cxx +++ b/MUON/AliMUONCluster.cxx @@ -22,9 +22,11 @@ #include #include "AliMUONCluster.h" +#include "AliMUONPad.h" + +#include "AliMpEncodePair.h" #include "AliLog.h" -#include "AliMUONPad.h" //----------------------------------------------------------------------------- /// \class AliMUONCluster @@ -504,43 +506,43 @@ AliMUONCluster::Multiplicity(Int_t cathode) const } //_____________________________________________________________________________ -AliMpIntPair +Long_t AliMUONCluster::NofPads(Int_t statusMask, Bool_t matchMask) const { /// Number of pads satisfying (or not, depending matchMask) a - /// given mask + /// given mask Int_t nx, ny; TVector2 dim0(MinPadDimensions(0,statusMask,matchMask)); TVector2 dim1(MinPadDimensions(1,statusMask,matchMask)); - AliMpIntPair npad0(NofPads(0,statusMask,matchMask)); - AliMpIntPair npad1(NofPads(1,statusMask,matchMask)); + Long_t npad0(NofPads(0,statusMask,matchMask)); + Long_t npad1(NofPads(1,statusMask,matchMask)); if ( TMath::Abs( (dim0-dim1).X() ) < 1E-3 ) { - nx = TMath::Max( npad0.GetFirst(), npad1.GetFirst() ); + nx = TMath::Max( AliMp::PairFirst(npad0), AliMp::PairFirst(npad1) ); } else { - nx = dim0.X() < dim1.X() ? npad0.GetFirst() : npad1.GetFirst(); + nx = dim0.X() < dim1.X() ? AliMp::PairFirst(npad0) : AliMp::PairFirst(npad1); } if ( TMath::Abs( (dim0-dim1).Y() ) < 1E-3 ) { - ny = TMath::Max( npad0.GetSecond(), npad1.GetSecond() ); + ny = TMath::Max( AliMp::PairSecond(npad0), AliMp::PairSecond(npad1) ); } else { - ny = dim0.Y() < dim1.Y() ? npad0.GetSecond() : npad1.GetSecond(); + ny = dim0.Y() < dim1.Y() ? AliMp::PairSecond(npad0) : AliMp::PairSecond(npad1); } - return AliMpIntPair(nx,ny); + return AliMp::Pair(nx,ny); } //_____________________________________________________________________________ -AliMpIntPair +Long_t AliMUONCluster::NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const { @@ -550,7 +552,7 @@ AliMUONCluster::NofPads(Int_t cathode, Int_t n = Multiplicity(cathode); if (!n) { - return AliMpIntPair(0,0); + return 0; } Double_t* x = new Double_t[n]; Double_t* y = new Double_t[n]; @@ -573,7 +575,7 @@ AliMUONCluster::NofPads(Int_t cathode, delete[] x; delete[] y; - return AliMpIntPair(cx,cy); + return AliMp::Pair(cx,cy); } //_____________________________________________________________________________ diff --git a/MUON/AliMUONCluster.h b/MUON/AliMUONCluster.h index c40c231e7e5..7182f17e477 100644 --- a/MUON/AliMUONCluster.h +++ b/MUON/AliMUONCluster.h @@ -27,8 +27,8 @@ #ifndef ALI_MP_DIRECTION_H # include "AliMpDirection.h" #endif -#ifndef ALI_MP_INT_PAIR_H -# include "AliMpIntPair.h" +#ifndef ALI_MP_ENCODE_PAIR_H +# include "AliMpEncodePair.h" #endif #ifndef ROOT_TObjArray @@ -102,10 +102,10 @@ public: Int_t Multiplicity(Int_t cathode) const; /// Compute number of pads in X and Y direction for a given cathode. - AliMpIntPair NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const; + Long_t NofPads(Int_t cathode, Int_t statusMask, Bool_t matchMask) const; /// Number of pads in (X,Y) direction, whatever the cathode. - AliMpIntPair NofPads(Int_t statusMask, Bool_t matchMask=kTRUE) const; + Long_t NofPads(Int_t statusMask, Bool_t matchMask=kTRUE) const; /// Return true as the function Compare is implemented Bool_t IsSortable() const { return kTRUE; } diff --git a/MUON/AliMUONClusterFinderMLEM.cxx b/MUON/AliMUONClusterFinderMLEM.cxx index 888edf48e71..fc7f535032a 100644 --- a/MUON/AliMUONClusterFinderMLEM.cxx +++ b/MUON/AliMUONClusterFinderMLEM.cxx @@ -1586,19 +1586,19 @@ void AliMUONClusterFinderMLEM::AddVirtualPad(AliMUONCluster& cluster) Bool_t same = kFALSE; if (TMath::Abs(dim0.Y()-dim1.Y()) < fgkDistancePrecision) same = kTRUE; // the same pad size on both planes - AliMpIntPair cn; + Long_t cn; Bool_t check[2] = {kFALSE, kFALSE}; Int_t nxy[2]; nxy[0] = nxy[1] = 0; for (Int_t inb = 0; inb < 2; ++inb) { cn = cluster.NofPads(nonb[inb], 0, kTRUE); - if (inb == 0 && cn.GetFirst() == 2) check[inb] = kTRUE; // check non-bending plane - else if (inb == 1 && cn.GetSecond() == 2) check[inb] = kTRUE; // check bending plane + if (inb == 0 && AliMp::PairFirst(cn) == 2) check[inb] = kTRUE; // check non-bending plane + else if (inb == 1 && AliMp::PairSecond(cn) == 2) check[inb] = kTRUE; // check bending plane if (same) { - nxy[0] = TMath::Max (nxy[0], cn.GetFirst()); - nxy[1] = TMath::Max (nxy[1], cn.GetSecond()); + nxy[0] = TMath::Max (nxy[0], AliMp::PairFirst(cn)); + nxy[1] = TMath::Max (nxy[1], AliMp::PairSecond(cn)); if (inb == 0 && nxy[0] < 2) nonb[inb] = !nonb[inb]; - else if (inb == 1 && cn.GetSecond() < 2) nonb[inb] = !nonb[inb]; + else if (inb == 1 && AliMp::PairSecond(cn) < 2) nonb[inb] = !nonb[inb]; } } if (same) { @@ -1663,8 +1663,7 @@ void AliMUONClusterFinderMLEM::AddVirtualPad(AliMUONCluster& cluster) //AliMpPad mppad = fkSegmentation[nonb[inb]]->PadByPosition(pos,kTRUE); AliMpPad mppad = fkSegmentation[nonb[inb]]->PadByPosition(pos,kFALSE); if (!mppad.IsValid()) continue; // non-existing pad - cn = mppad.GetIndices(); - AliMUONPad muonPad(fDetElemId, nonb[inb], cn.GetFirst(), cn.GetSecond(), + AliMUONPad muonPad(fDetElemId, nonb[inb], mppad.GetIx(), mppad.GetIy(), mppad.Position().X(), mppad.Position().Y(), mppad.Dimensions().X(), mppad.Dimensions().Y(), 0); if (inb == 0) muonPad.SetCharge(TMath::Min (amax[j]/100, 5.)); @@ -1697,10 +1696,10 @@ void AliMUONClusterFinderMLEM::PadsInXandY(AliMUONCluster& cluster, Bool_t mustMatch(kTRUE); - AliMpIntPair cn = cluster.NofPads(statusToTest,mustMatch); + Long_t cn = cluster.NofPads(statusToTest,mustMatch); - nInX = cn.GetFirst(); - nInY = cn.GetSecond(); + nInX = AliMp::PairFirst(cn); + nInY = AliMp::PairSecond(cn); } //_____________________________________________________________________________ diff --git a/MUON/AliMUONClusterFinderPeakCOG.cxx b/MUON/AliMUONClusterFinderPeakCOG.cxx index fa0302cf956..004a52862e8 100644 --- a/MUON/AliMUONClusterFinderPeakCOG.cxx +++ b/MUON/AliMUONClusterFinderPeakCOG.cxx @@ -34,6 +34,7 @@ #include "AliMpPad.h" #include "AliMpVSegmentation.h" +#include "AliMpEncodePair.h" #include "AliLog.h" #include "AliRunLoader.h" @@ -941,10 +942,10 @@ void AliMUONClusterFinderPeakCOG::PadsInXandY(AliMUONCluster& cluster, Bool_t mustMatch(kTRUE); - AliMpIntPair cn = cluster.NofPads(statusToTest,mustMatch); + Long_t cn = cluster.NofPads(statusToTest,mustMatch); - nInX = cn.GetFirst(); - nInY = cn.GetSecond(); + nInX = AliMp::PairFirst(cn); + nInY = AliMp::PairSecond(cn); } //_____________________________________________________________________________ diff --git a/MUON/AliMUONClusterFinderPeakFit.cxx b/MUON/AliMUONClusterFinderPeakFit.cxx index b5a76e14505..f0739afd02b 100644 --- a/MUON/AliMUONClusterFinderPeakFit.cxx +++ b/MUON/AliMUONClusterFinderPeakFit.cxx @@ -38,6 +38,7 @@ #include "AliMpDEManager.h" #include "AliMpPad.h" #include "AliMpVSegmentation.h" +#include "AliMpEncodePair.h" #include "AliLog.h" #include "AliRunLoader.h" @@ -1149,10 +1150,10 @@ void AliMUONClusterFinderPeakFit::PadsInXandY(AliMUONCluster& cluster, Bool_t mustMatch(kTRUE); - AliMpIntPair cn = cluster.NofPads(statusToTest,mustMatch); + Long_t cn = cluster.NofPads(statusToTest,mustMatch); - nInX = cn.GetFirst(); - nInY = cn.GetSecond(); + nInX = AliMp::PairFirst(cn); + nInY = AliMp::PairSecond(cn); } //_____________________________________________________________________________ diff --git a/MUON/AliMUONClusterSplitterMLEM.cxx b/MUON/AliMUONClusterSplitterMLEM.cxx index 589b91db195..b2efc607a84 100644 --- a/MUON/AliMUONClusterSplitterMLEM.cxx +++ b/MUON/AliMUONClusterSplitterMLEM.cxx @@ -36,6 +36,8 @@ #include "AliMpDEManager.h" #include "AliMUONMathieson.h" +#include "AliMpEncodePair.h" + #include "AliLog.h" #include @@ -333,9 +335,9 @@ AliMUONClusterSplitterMLEM::Fit(const AliMUONCluster& cluster, //const Int_t kStatusToTest(1); const Int_t kStatusToTest(AliMUONClusterFinderMLEM::GetUseForFitFlag()); - AliMpIntPair nofPads = cluster.NofPads(kStatusToTest); - Int_t nInX = nofPads.GetFirst(); - Int_t nInY = nofPads.GetSecond(); + Long_t nofPads = cluster.NofPads(kStatusToTest); + Int_t nInX = AliMp::PairFirst(nofPads); + Int_t nInY = AliMp::PairSecond(nofPads); if (fDebug) { Int_t npadOK = 0; diff --git a/MUON/AliMUONDataInterface.cxx b/MUON/AliMUONDataInterface.cxx index 89eed913b78..72c171400e4 100644 --- a/MUON/AliMUONDataInterface.cxx +++ b/MUON/AliMUONDataInterface.cxx @@ -28,7 +28,7 @@ #include "AliMUONVTriggerStore.h" #include "AliMpCDB.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpDEManager.h" #include "AliMpConstants.h" #include "AliMpCDB.h" @@ -807,8 +807,8 @@ TIterator* AliMUONDataInterface::GetIterator(IteratorType type, Int_t x, Int_t y AliMUONVDigitStore* store = DigitStore(fCurrentEvent); if (store == 0x0) return 0x0; - AliMpIntPair pair = AliMpDEManager::GetDetElemIdRange(chamber); - fIterator = store->CreateIterator(pair.GetFirst(), pair.GetSecond(), cathode); + MpPair_t pair = AliMpDEManager::GetDetElemIdRange(chamber); + fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode); if (fIterator == 0x0) return 0x0; fCurrentIteratorType = kDigitIteratorByChamberAndCathode; fDataX = chamber; diff --git a/MUON/AliMUONDigitMaker.cxx b/MUON/AliMUONDigitMaker.cxx index 2b4010c576a..7605a47206e 100644 --- a/MUON/AliMUONDigitMaker.cxx +++ b/MUON/AliMUONDigitMaker.cxx @@ -262,7 +262,7 @@ AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader) AliMp::CathodType cathodeType = de->GetCathodType(seg->PlaneType()); - AliMpPad pad = seg->PadByLocation(AliMpIntPair(manuId,channelId),kFALSE); + AliMpPad pad = seg->PadByLocation(manuId,channelId,kFALSE); if (!pad.IsValid()) { @@ -281,10 +281,9 @@ AliMUONDigitMaker::ReadTrackerDDL(AliRawReader* rawReader) continue; } - digit->SetPadXY(pad.GetIndices().GetFirst(), - pad.GetIndices().GetSecond()); + digit->SetPadXY(pad.GetIx(),pad.GetIy()); - digit->SetADC(charge); + digit->SetADC(charge); } @@ -542,7 +541,7 @@ Int_t AliMUONDigitMaker::TriggerDigits(Int_t nBoard, Int_t offset = 0; if (iCath && localBoard->GetSwitch(6)) offset = -8; - AliMpPad pad = seg->PadByLocation(AliMpIntPair(nBoard,ibitxy+offset),kTRUE); + AliMpPad pad = seg->PadByLocation(nBoard,ibitxy+offset,kTRUE); if (!pad.IsValid()) { @@ -551,8 +550,8 @@ Int_t AliMUONDigitMaker::TriggerDigits(Int_t nBoard, continue; } - n = pad.GetLocation(0).GetFirst(); // always take first location so that digits are not inserted several times - b = pad.GetLocation(0).GetSecond(); + n = pad.GetLocalBoardId(0); // always take first location so that digits are not inserted several times + b = pad.GetLocalBoardChannel(0); AliDebug(1,Form("Using localBoard %d ixy %d instead of %d,%d", n,b,nBoard,ibitxy)); @@ -566,8 +565,8 @@ Int_t AliMUONDigitMaker::TriggerDigits(Int_t nBoard, continue; } - Int_t padX = pad.GetIndices().GetFirst(); - Int_t padY = pad.GetIndices().GetSecond(); + Int_t padX = pad.GetIx(); + Int_t padY = pad.GetIy(); // fill digit digit->SetPadXY(padX,padY); diff --git a/MUON/AliMUONDigitizerV3.cxx b/MUON/AliMUONDigitizerV3.cxx index 90af9c5c556..9daf909502b 100644 --- a/MUON/AliMUONDigitizerV3.cxx +++ b/MUON/AliMUONDigitizerV3.cxx @@ -35,7 +35,6 @@ #include "AliMpConstants.h" #include "AliMpDEIterator.h" #include "AliMpDEManager.h" -#include "AliMpIntPair.h" #include "AliMpPad.h" #include "AliMpStationType.h" #include "AliMpVSegmentation.h" @@ -559,11 +558,11 @@ AliMUONDigitizerV3::GenerateNoisyDigitsForOneCathode(AliMUONVDigitStore& digitSt do { ix = gRandom->Integer(maxIx+1); iy = gRandom->Integer(maxIy+1); - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + pad = seg->PadByIndices(ix,iy,kFALSE); } while ( !pad.IsValid() ); - Int_t manuId = pad.GetLocation().GetFirst(); - Int_t manuChannel = pad.GetLocation().GetSecond(); + Int_t manuId = pad.GetManuId(); + Int_t manuChannel = pad.GetManuChannel(); AliMUONVCalibParam* pedestals = fCalibrationData->Pedestals(detElemId,manuId); @@ -677,11 +676,11 @@ AliMUONDigitizerV3::GenerateNoisyDigitsForTrigger(AliMUONVDigitStore& digitStore pad[1] = seg1->PadByPosition(TVector2(x,y),kFALSE); for ( Int_t cathode = 0; cathode < 2; ++cathode ){ - Int_t manuId = pad[cathode].GetLocation(0).GetFirst(); - Int_t manuChannel = pad[cathode].GetLocation(0).GetSecond(); + Int_t manuId = pad[cathode].GetLocalBoardId(0); + Int_t manuChannel = pad[cathode].GetLocalBoardChannel(0); d[cathode] = digitStore.CreateDigit(detElemId,manuId,manuChannel,cathode); - ix = pad[cathode].GetIndices().GetFirst(); - iy = pad[cathode].GetIndices().GetSecond(); + ix = pad[cathode].GetIx(); + iy = pad[cathode].GetIy(); d[cathode]->SetPadXY(ix,iy); //d[cathode].SetSignal(1); //d[cathode].SetPhysicsSignal(0); diff --git a/MUON/AliMUONESDInterface.cxx b/MUON/AliMUONESDInterface.cxx index 9f482a92b4c..8f03df68bad 100644 --- a/MUON/AliMUONESDInterface.cxx +++ b/MUON/AliMUONESDInterface.cxx @@ -35,7 +35,6 @@ #include "AliMpExMapIterator.h" #include "AliMpVSegmentation.h" #include "AliMpSegmentation.h" -#include "AliMpIntPair.h" #include "AliMpPad.h" #include "AliESDEvent.h" @@ -796,7 +795,7 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& /// Transfert data from ESDMuon pad to MUON digit const AliMpVSegmentation* seg = AliMpSegmentation::Instance()->GetMpSegmentationByElectronics(esdPad.GetDetElemId(), esdPad.GetManuId()); - AliMpPad pad = seg->PadByLocation(AliMpIntPair(esdPad.GetManuId(), esdPad.GetManuChannel()), kFALSE); + AliMpPad pad = seg->PadByLocation(esdPad.GetManuId(), esdPad.GetManuChannel(), kFALSE); digit.Saturated(esdPad.IsSaturated()); digit.Used(kFALSE); @@ -804,7 +803,7 @@ void AliMUONESDInterface::ESDToMUON(const AliESDMuonPad& esdPad, AliMUONVDigit& digit.SetUniqueID(esdPad.GetUniqueID()); digit.SetCharge(esdPad.GetCharge()); digit.SetADC(esdPad.GetADC()); - digit.SetPadXY(pad.GetIndices().GetFirst(), pad.GetIndices().GetSecond()); + digit.SetPadXY(pad.GetIx(), pad.GetIy()); } diff --git a/MUON/AliMUONMCDataInterface.cxx b/MUON/AliMUONMCDataInterface.cxx index ef54adcb17f..5dfb2a05fe4 100644 --- a/MUON/AliMUONMCDataInterface.cxx +++ b/MUON/AliMUONMCDataInterface.cxx @@ -36,7 +36,7 @@ #include "AliMUONRegionalTrigger.h" #include "AliMUONGlobalTrigger.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpDEManager.h" #include "AliMpConstants.h" #include "AliMpCDB.h" @@ -1010,8 +1010,8 @@ TIterator* AliMUONMCDataInterface::GetIterator(IteratorType type, Int_t x, Int_t AliMUONVDigitStore* store = SDigitStore(fCurrentEvent); if (store == 0x0) return 0x0; - AliMpIntPair pair = AliMpDEManager::GetDetElemIdRange(chamber); - fIterator = store->CreateIterator(pair.GetFirst(), pair.GetSecond(), cathode); + MpPair_t pair = AliMpDEManager::GetDetElemIdRange(chamber); + fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode); if (fIterator == 0x0) return 0x0; fCurrentIteratorType = kSDigitIteratorByChamberAndCathode; fDataX = chamber; @@ -1052,8 +1052,8 @@ TIterator* AliMUONMCDataInterface::GetIterator(IteratorType type, Int_t x, Int_t AliMUONVDigitStore* store = DigitStore(fCurrentEvent); if (store == 0x0) return 0x0; - AliMpIntPair pair = AliMpDEManager::GetDetElemIdRange(chamber); - fIterator = store->CreateIterator(pair.GetFirst(), pair.GetSecond(), cathode); + MpPair_t pair = AliMpDEManager::GetDetElemIdRange(chamber); + fIterator = store->CreateIterator(AliMp::PairFirst(pair), AliMp::PairSecond(pair), cathode); if (fIterator == 0x0) return 0x0; fCurrentIteratorType = kDigitIteratorByChamberAndCathode; fDataX = chamber; diff --git a/MUON/AliMUONManuPadPainter.cxx b/MUON/AliMUONManuPadPainter.cxx index a8e4774a97b..31b37f33c81 100644 --- a/MUON/AliMUONManuPadPainter.cxx +++ b/MUON/AliMUONManuPadPainter.cxx @@ -155,7 +155,7 @@ AliMUONManuPadPainter::NameAtPosition(Double_t x, Double_t y) const if ( pad.IsValid() ) { - name = Form("%s%d",PathName().Data(),pad.GetLocation().GetSecond()); + name = Form("%s%d",PathName().Data(),pad.GetManuChannel()); } return name; @@ -182,7 +182,7 @@ AliMUONManuPadPainter::Describe(const AliMUONVTrackerData& data, Int_t dataIndex if ( pad.IsValid() ) { - Double_t value = data.Channel(fDetElemId,fManuId,pad.GetLocation().GetSecond(),dataIndex); + Double_t value = data.Channel(fDetElemId,fManuId,pad.GetManuChannel(),dataIndex); return AliMUONPainterHelper::Instance()->FormatValue(data.DimensionName(dataIndex).Data(),value); } @@ -210,8 +210,7 @@ AliMUONManuPadPainter::DrawHistogramClone(Double_t* values) const AliMUONTrackerDataHistogrammer tdh(*data,0,-1); - fHistogram = tdh.CreateChannelHisto(fDetElemId, fManuId, - pad.GetLocation().GetSecond()); + fHistogram = tdh.CreateChannelHisto(fDetElemId, fManuId, pad.GetManuChannel()); if (fHistogram) { new TCanvas(); @@ -325,7 +324,7 @@ AliMUONManuPadPainter::PaintOutline(Int_t color, Int_t, Double_t x, Double_t y) // find pad to be drawn AliMpPad pad = PadByPosition(x,y); - Int_t id = AliMUONVDigit::BuildUniqueID(fDetElemId,fManuId,pad.GetLocation().GetSecond(),cathode); + Int_t id = AliMUONVDigit::BuildUniqueID(fDetElemId,fManuId,pad.GetManuChannel(),cathode); PaintPad(id); } diff --git a/MUON/AliMUONPainterContourMaker.cxx b/MUON/AliMUONPainterContourMaker.cxx index c85a307eab9..6fe5190b406 100644 --- a/MUON/AliMUONPainterContourMaker.cxx +++ b/MUON/AliMUONPainterContourMaker.cxx @@ -748,35 +748,35 @@ AliMUONPainterContourMaker::GenerateManuContour(const char* name, if ( connection ) { - AliMpIntPair indices = connection->LocalIndices(); + Int_t ix = connection->GetLocalIx(); + Int_t iy = connection->GetLocalIy(); Bool_t left(kTRUE); Bool_t right(kTRUE); Bool_t top(kTRUE); Bool_t bottom(kTRUE); - if ( !motifType->FindConnectionByLocalIndices(indices+AliMpIntPair(1,0)) ) + if ( ! motifType->FindConnectionByLocalIndices(ix+1, iy) ) { right = kFALSE; } - if ( !motifType->FindConnectionByLocalIndices(indices+AliMpIntPair(-1,0)) ) + if ( ! motifType->FindConnectionByLocalIndices(ix-1, iy) ) { left = kFALSE; } - if ( !motifType->FindConnectionByLocalIndices(indices+AliMpIntPair(0,1)) ) + if ( ! motifType->FindConnectionByLocalIndices(ix, iy+1) ) { top = kFALSE; } - if ( !motifType->FindConnectionByLocalIndices(indices+AliMpIntPair(0,-1)) ) + if ( ! motifType->FindConnectionByLocalIndices(ix, iy-1) ) { bottom = kFALSE; } AliDebug(3,Form("indices=(%3d,%3d) L %d R %d T %d B %d", - indices.GetFirst(),indices.GetSecond(), - left,right,top,bottom)); + ix,iy, left,right,top,bottom)); - TVector2 position = motif->PadPositionLocal(indices); - TVector2 dimensions = motif->GetPadDimensions(indices); + TVector2 position = motif->PadPositionLocal(ix,iy); + TVector2 dimensions = motif->GetPadDimensionsByIndices(ix, iy); if ( !left || !right || !top || !bottom ) { diff --git a/MUON/AliMUONPainterHelper.cxx b/MUON/AliMUONPainterHelper.cxx index 89edf7918f7..7002ef5ae04 100644 --- a/MUON/AliMUONPainterHelper.cxx +++ b/MUON/AliMUONPainterHelper.cxx @@ -321,8 +321,8 @@ AliMUONPainterHelper::GeneratePadStore(Int_t detElemId) Double_t x,y,z; Local2Global(detElemId,localPosition.X(),localPosition.Y(),0, x,y,z); - Int_t manuId = pad.GetLocation().GetFirst(); - Int_t manuChannel = pad.GetLocation().GetSecond(); + Int_t manuId = pad.GetManuId(); + Int_t manuChannel = pad.GetManuChannel(); AliMUONVCalibParam* param = fPadStore->Get(detElemId,manuId); param->SetValueAsDouble(manuChannel,0,x); param->SetValueAsDouble(manuChannel,1,y); diff --git a/MUON/AliMUONPedestalEventGenerator.cxx b/MUON/AliMUONPedestalEventGenerator.cxx index bad184684fd..b07d17ee912 100644 --- a/MUON/AliMUONPedestalEventGenerator.cxx +++ b/MUON/AliMUONPedestalEventGenerator.cxx @@ -31,7 +31,6 @@ #include "AliMpConstants.h" #include "AliMpDEStore.h" #include "AliMpDetElement.h" -#include "AliMpIntPair.h" #include "AliMpPlaneType.h" #include "AliRawDataHeaderSim.h" #include "AliRunLoader.h" @@ -385,7 +384,7 @@ AliMUONPedestalEventGenerator::GenerateDigits(AliMUONVDigitStore& digitStore) { // This is a poor's man way of knowing if that channel really exists. // Better and safer way (but much slower too) would be to check pad existence - // using AliMpVSegmentation::PadByLocation(AliMpIntPair(manuId,manuChannel)) + // using AliMpVSegmentation::PadByLocation(manuId,manuChannel) continue; } else if ( mean < 1 || mean > 4095 ) diff --git a/MUON/AliMUONPreClusterFinderV2.cxx b/MUON/AliMUONPreClusterFinderV2.cxx index 873b4ec0a65..ddef7d81bd2 100644 --- a/MUON/AliMUONPreClusterFinderV2.cxx +++ b/MUON/AliMUONPreClusterFinderV2.cxx @@ -120,7 +120,7 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad) // Check neighbours TObjArray neighbours; - AliMpPad p = fkSegmentations[pad->Cathode()]->PadByIndices(AliMpIntPair(pad->Ix(),pad->Iy()),kTRUE); + AliMpPad p = fkSegmentations[pad->Cathode()]->PadByIndices(pad->Ix(),pad->Iy(),kTRUE); Int_t nn = fkSegmentations[pad->Cathode()]->GetNeighbours(p,neighbours); for (Int_t in = 0; in < nn; ++in) { @@ -131,8 +131,8 @@ AliMUONPreClusterFinderV2::AddPad(AliMUONCluster& cluster, AliMUONPad* pad) while ( ( p2 = static_cast(next2()) ) ) { - if ( !p2->IsUsed() && p2->Ix()==p1->GetIndices().GetFirst() - && p2->Iy() == p1->GetIndices().GetSecond() && + if ( !p2->IsUsed() && p2->Ix()==p1->GetIx() + && p2->Iy() == p1->GetIy() && p2->Cathode() == pad->Cathode() ) { AddPad(cluster,p2); diff --git a/MUON/AliMUONResponseTrigger.cxx b/MUON/AliMUONResponseTrigger.cxx index c46d286ac26..addb7b54480 100644 --- a/MUON/AliMUONResponseTrigger.cxx +++ b/MUON/AliMUONResponseTrigger.cxx @@ -114,8 +114,8 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits) ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE); - Int_t ix = pad.GetIndices().GetFirst(); - Int_t iy = pad.GetIndices().GetSecond(); + Int_t ix = pad.GetIx(); + Int_t iy = pad.GetIy(); AliDebug(1,Form("xhit,yhit=%e,%e lx,ly,lz=%e,%e,%e ix,iy=%d,%d", xhit,yhit,x,y,z,ix,iy)); @@ -128,8 +128,8 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits) xhit,yhit,x,y,z,ix,iy)); continue; } - AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocation(0).GetFirst(), - pad.GetLocation(0).GetSecond(),cath); + AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0), + pad.GetLocalBoardChannel(0),cath); d->SetPadXY(ix,iy); //FIXME : a trigger digit can have several locations. @@ -138,7 +138,7 @@ AliMUONResponseTrigger::DisIntegrate(const AliMUONHit& hit, TList& digits) if(fTriggerEfficiency){ if(cath==0){ - Int_t nboard = pad.GetLocation(0).GetFirst(); + Int_t nboard = pad.GetLocalBoardId(0); fTriggerEfficiency->IsTriggered(detElemId, nboard, isTrig[0], isTrig[1]); } diff --git a/MUON/AliMUONResponseTriggerV1.cxx b/MUON/AliMUONResponseTriggerV1.cxx index 4d8070ec7cb..5fcb648ef87 100644 --- a/MUON/AliMUONResponseTriggerV1.cxx +++ b/MUON/AliMUONResponseTriggerV1.cxx @@ -158,11 +158,11 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits ->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath)); AliMpPad pad = seg->PadByPosition(TVector2(x,y),kFALSE); - Int_t ix = pad.GetIndices().GetFirst(); - Int_t iy = pad.GetIndices().GetSecond(); + Int_t ix = pad.GetIx(); + Int_t iy = pad.GetIy(); - AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocation(0).GetFirst(), - pad.GetLocation(0).GetSecond(), + AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocalBoardId(0), + pad.GetLocalBoardChannel(0), cath); d->SetPadXY(ix,iy); @@ -170,7 +170,7 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits if(fTriggerEfficiency){ if(cath==0){ - Int_t nboard = pad.GetLocation(0).GetFirst(); + Int_t nboard = pad.GetLocalBoardId(0); fTriggerEfficiency->IsTriggered(detElemId, nboard, isTrig[0], isTrig[1]); } @@ -197,8 +197,7 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits Int_t ixNeigh = ( cath == 0 ) ? ix : xList[i]; Int_t iyNeigh = ( cath == 0 ) ? yList[i] : iy; - AliMpIntPair pairNeigh = AliMpIntPair(ixNeigh,iyNeigh); - AliMpPad padNeigh = seg->PadByIndices(pairNeigh,kFALSE); + AliMpPad padNeigh = seg->PadByIndices(ixNeigh,iyNeigh,kFALSE); if(padNeigh.IsValid()){ // existing neighbourg Int_t dix=-(ixNeigh-ix); @@ -217,8 +216,8 @@ void AliMUONResponseTriggerV1::DisIntegrate(const AliMUONHit& hit, TList& digits else qp = 0; if (qp == 1) { // this digit is fired - AliMUONDigit* dNeigh = new AliMUONDigit(detElemId,padNeigh.GetLocation(0).GetFirst(), - padNeigh.GetLocation(0).GetSecond(), + AliMUONDigit* dNeigh = new AliMUONDigit(detElemId,padNeigh.GetLocalBoardId(0), + padNeigh.GetLocalBoardChannel(0), cath); dNeigh->SetPadXY(ixNeigh,iyNeigh); diff --git a/MUON/AliMUONResponseV0.cxx b/MUON/AliMUONResponseV0.cxx index 78b04a1f7b4..0d7d59791b7 100644 --- a/MUON/AliMUONResponseV0.cxx +++ b/MUON/AliMUONResponseV0.cxx @@ -328,9 +328,9 @@ AliMUONResponseV0::DisIntegrate(const AliMUONHit& hit, TList& digits) { // If we're above threshold, then we create a digit, // and fill it with relevant information, including electronics. - AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetLocation().GetFirst(), - pad.GetLocation().GetSecond(),cath); - d->SetPadXY(pad.GetIndices().GetFirst(),pad.GetIndices().GetSecond()); + AliMUONDigit* d = new AliMUONDigit(detElemId,pad.GetManuId(), + pad.GetManuChannel(),cath); + d->SetPadXY(pad.GetIx(),pad.GetIy()); d->SetCharge(icharge); digits.Add(d); } diff --git a/MUON/AliMUONSimpleClusterServer.cxx b/MUON/AliMUONSimpleClusterServer.cxx index 9a4cbf801be..1d97cb7631c 100644 --- a/MUON/AliMUONSimpleClusterServer.cxx +++ b/MUON/AliMUONSimpleClusterServer.cxx @@ -325,7 +325,7 @@ AliMUONSimpleClusterServer::UseDigits(TIter& next, AliMUONVDigitStore* digitStor Int_t detElemId = d->DetElemId(); const AliMpVSegmentation* seg = AliMpSegmentation::Instance()-> GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode)); - AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy)); + AliMpPad pad = seg->PadByIndices(ix,iy); TClonesArray* padArray = PadArray(detElemId,cathode); if (!padArray) @@ -357,7 +357,7 @@ AliMUONSimpleClusterServer::FindMCLabel(const AliMUONCluster& cluster, Int_t det for (Int_t iCath = 0; iCath < 2; iCath++) { AliMpPad pad = seg[AliMp::GetCathodType(iCath)]->PadByPosition(cluster.Position(), kFALSE); if (pad.IsValid()) { - digit[iCath] = fDigitStore->FindObject(detElemId, pad.GetLocation().GetFirst(), pad.GetLocation().GetSecond(), iCath); + digit[iCath] = fDigitStore->FindObject(detElemId, pad.GetManuId(), pad.GetManuChannel(), iCath); if (digit[iCath]) nTracks[iCath] = digit[iCath]->Ntracks(); } } diff --git a/MUON/AliMUONTrackHitPattern.cxx b/MUON/AliMUONTrackHitPattern.cxx index af97de09dcf..e516d3e3d02 100644 --- a/MUON/AliMUONTrackHitPattern.cxx +++ b/MUON/AliMUONTrackHitPattern.cxx @@ -434,7 +434,7 @@ AliMUONTrackHitPattern::FindPadMatchingTrack(const AliMUONVDigitStore& digitStor const AliMpVSegmentation* seg = AliMpSegmentation::Instance() ->GetMpSegmentation(currDetElemId,AliMp::GetCathodType(cathode)); - AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + AliMpPad pad = seg->PadByIndices(ix,iy,kTRUE); Float_t xlocal1 = pad.Position().X(); Float_t ylocal1 = pad.Position().Y(); Float_t dpx = pad.Dimensions().X(); @@ -534,7 +534,7 @@ Int_t AliMUONTrackHitPattern::FindPadMatchingTrig(const AliMUONVDigitStore& digi const AliMpVSegmentation* seg = AliMpSegmentation::Instance() ->GetMpSegmentation(currDetElemId,AliMp::GetCathodType(cathode)); - AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + AliMpPad pad = seg->PadByIndices(ix,iy,kTRUE); Float_t xlocal1 = pad.Position().X(); Float_t ylocal1 = pad.Position().Y(); Float_t dpx = pad.Dimensions().X(); @@ -558,8 +558,7 @@ Int_t AliMUONTrackHitPattern::FindPadMatchingTrig(const AliMUONVDigitStore& digi yCoorAtPadZ=y; if(cathode==kBending) trigDigitBendPlane = idigit; for (Int_t loc=0; locPadByPosition(pos,kFALSE); for (Int_t loc=0; loc #include #include @@ -1078,9 +1079,9 @@ AliMUONTrackerData::GetDEManu(const AliMUONVCalibParam& param, { // we (probably) get a manu serial number Int_t serial = param.ID0(); - AliMpIntPair pair = AliMpManuStore::Instance()->GetDetElemIdManu(serial); - detElemId = pair.GetFirst(); - manuId = pair.GetSecond(); + MpPair_t pair = AliMpManuStore::Instance()->GetDetElemIdManu(serial); + detElemId = AliMp::PairFirst(pair); + manuId = AliMp::PairSecond(pair); if ( !detElemId ) { AliError(Form("DE %d manuId %d from serial %d is not correct !", diff --git a/MUON/AliMUONTriggerCircuit.cxx b/MUON/AliMUONTriggerCircuit.cxx index 255b4854389..02d8d6c9f77 100644 --- a/MUON/AliMUONTriggerCircuit.cxx +++ b/MUON/AliMUONTriggerCircuit.cxx @@ -39,6 +39,7 @@ #include "AliMpLocalBoard.h" #include "AliMpConstants.h" #include "AliMpPad.h" +#include "AliMpEncodePair.h" #include "AliRun.h" #include "AliLog.h" @@ -146,8 +147,8 @@ void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* const localBoard) Int_t zeroDown = localBoard->GetSwitch(AliMpLocalBoard::kZeroDown); Int_t zeroUp = localBoard->GetSwitch(AliMpLocalBoard::kZeroUp); - Int_t iline = localBoard->GetPosition().GetFirst(); - Int_t icol = localBoard->GetPosition().GetSecond(); + Int_t iline = AliMp::PairFirst(localBoard->GetPosition()); + Int_t icol = AliMp::PairSecond(localBoard->GetPosition()); if ( iline == 5 ) --icol; //--- first plane @@ -186,7 +187,7 @@ void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* const localBoard) Int_t icolUp = icol; // check if we need to move to another detElemId - AliMpPad pad = fkCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iLastStripMiddle+1),kFALSE); + AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iLastStripMiddle+1,kFALSE); if (pad.IsValid()) { // upper strips within same detElemId iFirstStripUp = iLastStripMiddle; @@ -226,7 +227,7 @@ void AliMUONTriggerCircuit::LoadYPos(AliMpLocalBoard* const localBoard) Int_t icolDo = icol; // check if we need to move to another detElemId - AliMpPad pad = fkCurrentSeg->PadByIndices(AliMpIntPair(icol-1,iFirstStripMiddle-1),kFALSE); + AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,iFirstStripMiddle-1,kFALSE); if (pad.IsValid()) { // lower strips within same detElemId iFirstStripDo = iFirstStripMiddle - 8; iLastStripDo = iFirstStripDo + 8; @@ -270,7 +271,7 @@ void AliMUONTriggerCircuit::FillXstrips(const Int_t icol, Double_t xyGlobal[2] = {0.}; for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) { - AliMpPad pad = fkCurrentSeg->PadByIndices(AliMpIntPair(icol-1,istrip),kTRUE); + AliMpPad pad = fkCurrentSeg->PadByIndices(icol-1,istrip,kTRUE); if ( !pad.IsValid() ) { StdoutToAliError(cout << "Pad not found in seg " << endl; fkCurrentSeg->Print(); @@ -311,8 +312,8 @@ void AliMUONTriggerCircuit::LoadXPos(AliMpLocalBoard* const localBoard) Int_t iLastStrip = 0; Bool_t doubling = kFALSE; - Int_t iline = localBoard->GetPosition().GetFirst(); - Int_t icol = localBoard->GetPosition().GetSecond(); + Int_t iline = AliMp::PairFirst(localBoard->GetPosition()); + Int_t icol = AliMp::PairSecond(localBoard->GetPosition()); if ( iline == 5 ) --icol; fCurrentDetElem = AliMpDDLStore::Instance()->GetDEfromLocalBoard(fCurrentLocalBoard, ichamber); @@ -351,7 +352,7 @@ void AliMUONTriggerCircuit::FillYstrips(const Int_t iFirstStrip, const Int_t iLa for (Int_t istrip = iFirstStrip; istrip < iLastStrip; ++istrip) { - AliMpPad pad = fkCurrentSeg->PadByIndices(AliMpIntPair(istrip,0),kTRUE); + AliMpPad pad = fkCurrentSeg->PadByIndices(istrip,0,kTRUE); if ( !pad.IsValid() ) { @@ -427,8 +428,8 @@ Int_t AliMUONTriggerCircuit::FirstStrip(AliMpLocalBoard* localBoard) Int_t iFirstStrip = -1; Int_t boardNumber = atoi(localBoard->GetName()+6); - Int_t iline = localBoard->GetPosition().GetFirst(); - Int_t icol = localBoard->GetPosition().GetSecond(); + Int_t iline = AliMp::PairFirst(localBoard->GetPosition()); + Int_t icol = AliMp::PairSecond(localBoard->GetPosition()); if ( iline == 5 ) --icol; switch (boardNumber) diff --git a/MUON/AliMUONTriggerDisplay.cxx b/MUON/AliMUONTriggerDisplay.cxx index bc55f72da71..691b3fa5f8f 100644 --- a/MUON/AliMUONTriggerDisplay.cxx +++ b/MUON/AliMUONTriggerDisplay.cxx @@ -224,9 +224,9 @@ Bool_t AliMUONTriggerDisplay::InitOrDisplayTriggerInfo(TH1* inputHisto, TH2* dis AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(1))}; if(iLoc==0){ - AliMpPad pad1 = seg[1]->PadByLocation(AliMpIntPair(iBoard,0),kFALSE); + AliMpPad pad1 = seg[1]->PadByLocation(iBoard,0,kFALSE); yWidthSlat = pad1.Dimensions().Y(); - AliMpPad pad0 = seg[0]->PadByLocation(AliMpIntPair(iBoard,0),kFALSE); + AliMpPad pad0 = seg[0]->PadByLocation(iBoard,0,kFALSE); xOffsetLine = TMath::Abs(pad0.Position().X()) + pad0.Dimensions().X(); xWidthCol = 2.* pad0.Dimensions().X(); } @@ -253,7 +253,7 @@ Bool_t AliMUONTriggerDisplay::InitOrDisplayTriggerInfo(TH1* inputHisto, TH2* dis Int_t offset = 0; if (cath && localBoard->GetSwitch(6)) offset = -8; - AliMpPad pad = seg[cath]->PadByLocation(AliMpIntPair(iBoard,iStrip+offset),kFALSE); + AliMpPad pad = seg[cath]->PadByLocation(iBoard,iStrip+offset,kFALSE); if (!pad.IsValid()) continue; diff --git a/MUON/AliMUONTriggerEfficiencyCells.cxx b/MUON/AliMUONTriggerEfficiencyCells.cxx index d4146f22ed8..d1a5f99c4b8 100755 --- a/MUON/AliMUONTriggerEfficiencyCells.cxx +++ b/MUON/AliMUONTriggerEfficiencyCells.cxx @@ -683,7 +683,7 @@ Bool_t AliMUONTriggerEfficiencyCells::GetListsForCheck(const Char_t* cdbStorage, AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(iCath)); Int_t nStrips=0; for (Int_t iStrip = 0; iStrip < 16; ++iStrip) { - AliMpPad pad = seg->PadByLocation(AliMpIntPair(iBoard,iStrip),kFALSE); + AliMpPad pad = seg->PadByLocation(iBoard,iStrip,kFALSE); if (!pad.IsValid()) continue; nStrips++; padFired = (TH3F*)fFiredStrips->At(iCath); diff --git a/MUON/AliMUONTriggerElectronics.cxx b/MUON/AliMUONTriggerElectronics.cxx index 361fedb03c4..88dcaf2ad4e 100644 --- a/MUON/AliMUONTriggerElectronics.cxx +++ b/MUON/AliMUONTriggerElectronics.cxx @@ -195,15 +195,13 @@ void AliMUONTriggerElectronics::Feed(const AliMUONVDigitStore& digitStore) AliDebug(3,Form("cathode %d ix %d iy %d ",cathode,ix,iy)); - AliMpPad pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + AliMpPad pad = seg->PadByIndices(ix,iy,kTRUE); for (Int_t i=0; iLocalBoard(nboard); diff --git a/MUON/AliMUONTriggerGUI.cxx b/MUON/AliMUONTriggerGUI.cxx index 55584cb2313..e980bfb91f6 100644 --- a/MUON/AliMUONTriggerGUI.cxx +++ b/MUON/AliMUONTriggerGUI.cxx @@ -32,7 +32,7 @@ #include "AliMpSegmentation.h" #include "AliMpVSegmentation.h" #include "AliMpTriggerSegmentation.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpCDB.h" #include "AliMpDEManager.h" #include "AliMpDEIterator.h" @@ -1472,11 +1472,9 @@ void AliMUONTriggerGUI::InitBoards() manuIdPrev = 0; for (Int_t ix = 0; ix <= seg0->MaxPadIndexX(); ix++) { for (Int_t iy = 0; iy <= seg0->MaxPadIndexY(); iy++) { - AliMpIntPair indices(ix,iy); - AliMpPad pad = seg0->PadByIndices(indices,kFALSE); + AliMpPad pad = seg0->PadByIndices(ix,iy,kFALSE); if (pad.IsValid()) { - AliMpIntPair loc = pad.GetLocation(0); - Int_t manuId = loc.GetFirst(); + Int_t manuId = pad.GetLocalBoardId(0); if (manuId != manuIdPrev) { AliMpLocalBoard *mpboard = AliMpDDLStore::Instance()->GetLocalBoard(manuId); manuIdPrev = manuId; @@ -1503,13 +1501,11 @@ void AliMUONTriggerGUI::InitBoards() manuIdPrev = 0; for (Int_t ix = 0; ix <= seg1->MaxPadIndexX(); ix++) { for (Int_t iy = 0; iy <= seg1->MaxPadIndexY(); iy++) { - AliMpIntPair indices(ix,iy); - AliMpPad pad = seg1->PadByIndices(indices,kFALSE); + AliMpPad pad = seg1->PadByIndices(ix,iy,kFALSE); if (pad.IsValid()) { Int_t nloc = pad.GetNofLocations(); for (Int_t iloc = 0; iloc < nloc; iloc++) { - AliMpIntPair loc = pad.GetLocation(iloc); - Int_t manuId = loc.GetFirst(); + Int_t manuId = pad.GetLocalBoardId(iloc); if (manuId != manuIdPrev) { manuIdPrev = manuId; boardIdTmp = cIdtobId[manuId]; @@ -1646,7 +1642,7 @@ void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board) for (Int_t ix = 0; ix <= maxX; ix++) { for (Int_t iy = 0; iy <= maxY; iy++) { - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + pad = seg->PadByIndices(ix,iy,kFALSE); if (!pad.IsValid()) continue; @@ -1702,7 +1698,7 @@ void AliMUONTriggerGUI::SetStripBoxes(AliMUONTriggerGUIboard *board) for (Int_t ix = 0; ix <= maxX; ix++) { for (Int_t iy = 0; iy <= maxY; iy++) { - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + pad = seg->PadByIndices(ix,iy,kFALSE); if (!pad.IsValid()) continue; @@ -1788,9 +1784,9 @@ void AliMUONTriggerGUI::CreateDigitStore() maxY = seg->MaxPadIndexY(); if (ix > maxX) printf("Index x > maximum!\n"); if (iy > maxY) printf("Index y > maximum!\n"); - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); - manuId = pad.GetLocation(0).GetFirst(); - manuChannel = pad.GetLocation(0).GetSecond(); + pad = seg->PadByIndices(ix,iy,kTRUE); + manuId = pad.GetLocalBoardId(0); + manuChannel = pad.GetLocalBoardChannel(0); dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow); dig->SetCharge(charge); @@ -1813,9 +1809,9 @@ void AliMUONTriggerGUI::CreateDigitStore() maxY = seg->MaxPadIndexY(); if (ix > maxX) printf("Index x > maximum!\n"); if (iy > maxY) printf("Index y > maximum!\n"); - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); - manuId = pad.GetLocation(0).GetFirst(); - manuChannel = pad.GetLocation(0).GetSecond(); + pad = seg->PadByIndices(ix,iy,kTRUE); + manuId = pad.GetLocalBoardId(0); + manuChannel = pad.GetLocalBoardChannel(0); dig = fDigitStore->Add(detElemId,manuId,manuChannel,cathode,AliMUONVDigitStore::kAllow); dig->SetCharge(charge); @@ -1844,8 +1840,8 @@ void AliMUONTriggerGUI::PrintDigitStore() const chamber = 11+i; - AliMpIntPair deRange = AliMpDEManager::GetDetElemIdRange(chamber-1); - TIter next(fDigitStore->CreateIterator(deRange.GetFirst(),deRange.GetSecond())); + MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1); + TIter next(fDigitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange))); AliMUONVDigit *mdig; while ( ( mdig = static_cast(next())) ) @@ -1858,9 +1854,8 @@ void AliMUONTriggerGUI::PrintDigitStore() const charge = (Int_t)mdig->Charge(); seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode)); - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); - AliMpIntPair ind = pad.GetIndices(); - + pad = seg->PadByIndices(ix,iy,kTRUE); + printf("Digit: detElemId %4d cath %1d ix %2d iy %3d charge %1d \n",detElemId,cathode,ix,iy,charge); } diff --git a/MUON/AliMUONTriggerGUIbdmap.cxx b/MUON/AliMUONTriggerGUIbdmap.cxx index 6be90a7bf98..22fdbbcdbc1 100644 --- a/MUON/AliMUONTriggerGUIbdmap.cxx +++ b/MUON/AliMUONTriggerGUIbdmap.cxx @@ -37,21 +37,23 @@ #include "AliRunLoader.h" #include "AliMUONVDigit.h" -#include "AliMpVSegmentation.h" -#include "AliMpSegmentation.h" #include "AliMUONGeometryTransformer.h" -#include "AliMpDEIterator.h" #include "AliMUONLocalTrigger.h" #include "AliMUONLocalTriggerBoard.h" #include "AliMUONTriggerCrateStore.h" #include "AliMUONMCDataInterface.h" #include "AliMUONTriggerStoreV1.h" #include "AliMUONDigitStoreV1.h" -#include "AliMpDEManager.h" - #include "AliMUONTriggerGUIboard.h" #include "AliMUONTriggerGUIbdmap.h" +#include "AliMpDEManager.h" +#include "AliMpDEIterator.h" +#include "AliMpEncodePair.h" +#include "AliMpVSegmentation.h" +#include "AliMpSegmentation.h" + + /// \cond CLASSIMP ClassImp(AliMUONTriggerGUIbdmap) /// \endcond @@ -883,8 +885,8 @@ void AliMUONTriggerGUIbdmap::DrawDigits(Bool_t bx, Bool_t by) chamber = 11+i; - AliMpIntPair deRange = AliMpDEManager::GetDetElemIdRange(chamber-1); - TIter next(digitStore->CreateIterator(deRange.GetFirst(),deRange.GetSecond())); + MpPair_t deRange = AliMpDEManager::GetDetElemIdRange(chamber-1); + TIter next(digitStore->CreateIterator(AliMp::PairFirst(deRange),AliMp::PairSecond(deRange))); AliMUONVDigit *mdig; while ( ( mdig = static_cast(next())) ) @@ -910,7 +912,7 @@ void AliMUONTriggerGUIbdmap::DrawDigits(Bool_t bx, Bool_t by) seg = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId, AliMp::GetCathodType(cathode)); - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + pad = seg->PadByIndices(ix,iy,kTRUE); //if (cathode == 0) printf("GUI x: ix %d iy %d \n",ix,iy); //if (cathode == 1) printf("GUI y: ix %d iy %d \n",ix,iy); @@ -1225,7 +1227,7 @@ void AliMUONTriggerGUIbdmap::DrawStrips(Bool_t bx, Bool_t by) for (Int_t ix = 0; ix <= maxX; ix++) { for (Int_t iy = 0; iy <= maxY; iy++) { - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + pad = seg->PadByIndices(ix,iy,kFALSE); if (!pad.IsValid()) continue; @@ -1320,7 +1322,7 @@ void AliMUONTriggerGUIbdmap::DrawStrips(Bool_t bx, Bool_t by) for (Int_t ix = 0; ix <= maxX; ix++) { for (Int_t iy = 0; iy <= maxY; iy++) { - pad = seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + pad = seg->PadByIndices(ix,iy,kFALSE); if (!pad.IsValid()) continue; diff --git a/MUON/AliMUONTriggerGUIboard.cxx b/MUON/AliMUONTriggerGUIboard.cxx index 7d4bfb36383..b112b02749f 100644 --- a/MUON/AliMUONTriggerGUIboard.cxx +++ b/MUON/AliMUONTriggerGUIboard.cxx @@ -183,8 +183,7 @@ void AliMUONTriggerGUIboard::MakeGeometry() for (Int_t ich = 0; ich < kNMT; ich++) { if (fNPadsX[ich]) { pad = (AliMpPad*)fPadsX[ich]->At(0); - AliMpIntPair loc = pad->GetLocation(0); - fIdCircuit = loc.GetFirst(); + fIdCircuit = pad->GetLocalBoardId(0); break; } } @@ -211,17 +210,15 @@ void AliMUONTriggerGUIboard::MakeGeometry() Int_t padyIy = -1, padyIx1 = +999, padyIx2 = -999; for (Int_t ip = 0; ip < fNPadsX[0]; ip++) { pad = (AliMpPad*)fPadsX[0]->At(ip); - AliMpIntPair ind = pad->GetIndices(); - padxIx = ind.GetFirst(); - padxIy1 = TMath::Min(padxIy1,ind.GetSecond()); - padxIy2 = TMath::Max(padxIy2,ind.GetSecond()); + padxIx = pad->GetIx(); + padxIy1 = TMath::Min(padxIy1,pad->GetIy()); + padxIy2 = TMath::Max(padxIy2,pad->GetIy()); } for (Int_t ip = 0; ip < fNPadsY[0]; ip++) { pad = (AliMpPad*)fPadsY[0]->At(ip); - AliMpIntPair ind = pad->GetIndices(); - padyIy = ind.GetSecond(); - padyIx1 = TMath::Min(padyIx1,ind.GetFirst()); - padyIx2 = TMath::Max(padyIx2,ind.GetFirst()); + padyIy = pad->GetIy(); + padyIx1 = TMath::Min(padyIx1,pad->GetIx()); + padyIx2 = TMath::Max(padyIx2,pad->GetIx()); } fXSix = padxIx; fXSiy1 = padxIy1; diff --git a/MUON/AliMUONTriggerGUIdimap.cxx b/MUON/AliMUONTriggerGUIdimap.cxx index 3c5dbbbf15a..8a355543f47 100644 --- a/MUON/AliMUONTriggerGUIdimap.cxx +++ b/MUON/AliMUONTriggerGUIdimap.cxx @@ -477,7 +477,7 @@ void AliMUONTriggerGUIdimap::DrawMaps(Int_t chamber) const AliMpVSegmentation* seg2 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cathode-1)); - AliMpPad mpad = seg2->PadByIndices(AliMpIntPair(ix,iy),kTRUE); + AliMpPad mpad = seg2->PadByIndices(ix,iy,kTRUE); // get the pad position and dimensions Float_t xlocal1 = mpad.Position().X(); diff --git a/MUON/CMake_libMUONmapping.txt b/MUON/CMake_libMUONmapping.txt index f8b8e70d14e..544e5470093 100644 --- a/MUON/CMake_libMUONmapping.txt +++ b/MUON/CMake_libMUONmapping.txt @@ -11,8 +11,7 @@ set(SRCS mapping/AliMpConstants.cxx mapping/AliMpFiles.cxx mapping/AliMpPad.cxx - mapping/AliMpPadIteratorPtr.cxx - mapping/AliMpPadPair.cxx + mapping/AliMpEncodePair.cxx mapping/AliMpVIndexed.cxx mapping/AliMpVPadIterator.cxx mapping/AliMpVSegmentation.cxx @@ -39,7 +38,6 @@ set(SRCS ${SRCS} # Category sector # set(SRCS ${SRCS} - mapping/AliMpNeighboursPadIterator.cxx mapping/AliMpPadRow.cxx mapping/AliMpPadRowLSegment.cxx mapping/AliMpPadRowRSegment.cxx diff --git a/MUON/Doxymodules.h b/MUON/Doxymodules.h index 85d5990d8c9..991241c4535 100644 --- a/MUON/Doxymodules.h +++ b/MUON/Doxymodules.h @@ -27,6 +27,10 @@ * @{ * \namespace AliMp * \brief The namespace for mapping enums and related functions + * + * \namespace AliMq + * \brief The special namespace only for St12StationType + * */ /** @defgroup basic mp_basic diff --git a/MUON/MUONClusterInfo.C b/MUON/MUONClusterInfo.C index 81764f1a805..da211cffc57 100644 --- a/MUON/MUONClusterInfo.C +++ b/MUON/MUONClusterInfo.C @@ -164,7 +164,7 @@ void MUONClusterInfo(Int_t nevents = -1, const char* esdFileName = "AliESDs.root // pad location const AliMpVSegmentation* seg = AliMpSegmentation::Instance()-> GetMpSegmentation(digit->DetElemId(),AliMp::GetCathodType(digit->Cathode())); - AliMpPad pad = seg->PadByIndices(AliMpIntPair(digit->PadX(), digit->PadY())); + AliMpPad pad = seg->PadByIndices(digit->PadX(), digit->PadY()); // calibration parameters AliMUONVCalibParam* ped = calibData->Pedestals(digit->DetElemId(), digit->ManuId()); diff --git a/MUON/MUONResoEffChamber.C b/MUON/MUONResoEffChamber.C index 19500204935..d60a85aa4ac 100644 --- a/MUON/MUONResoEffChamber.C +++ b/MUON/MUONResoEffChamber.C @@ -73,7 +73,6 @@ #include "AliMUONTrackExtrap.h" #include "AliMpVSegmentation.h" -#include "AliMpIntPair.h" #include "AliMpDEManager.h" #endif diff --git a/MUON/MUONStatusMap.C b/MUON/MUONStatusMap.C index 41b7e6f5c92..b7c99409e58 100644 --- a/MUON/MUONStatusMap.C +++ b/MUON/MUONStatusMap.C @@ -32,7 +32,6 @@ #include "AliMpConstants.h" #include "AliMpDDLStore.h" #include "AliMpDetElement.h" -#include "AliMpIntPair.h" #include "AliMpManuIterator.h" #include "Riostream.h" #endif diff --git a/MUON/MUONmappingLinkDef.h b/MUON/MUONmappingLinkDef.h index 6fc8d1529cc..d5e237a3dd8 100644 --- a/MUON/MUONmappingLinkDef.h +++ b/MUON/MUONmappingLinkDef.h @@ -12,11 +12,9 @@ #pragma link C++ class AliMpArea+; #pragma link C++ class AliMpConstants+; #pragma link C++ class AliMpPad+; -#pragma link C++ class AliMpPadPair+; #pragma link C++ class AliMpVIndexed+; #pragma link C++ class AliMpVSegmentation+; #pragma link C++ class AliMpVPadIterator+; -#pragma link C++ class AliMpPadIteratorPtr+; #pragma link C++ class AliMpDataProcessor+; #pragma link C++ class AliMpDataStreams+; #pragma link C++ class AliMpDataMap+; @@ -63,7 +61,6 @@ #pragma link C++ class AliMpSectorAreaHPadIterator+; #pragma link C++ class AliMpSectorAreaVPadIterator+; #pragma link C++ class AliMpSectorSegmentation+; -#pragma link C++ class AliMpNeighboursPadIterator+; #pragma link C++ class AliMpZone+; #pragma link C++ class AliMpSubZone+; #pragma link C++ class AliMpRow+; diff --git a/MUON/libMUONmapping.pkg b/MUON/libMUONmapping.pkg index 1f06226e6f6..f3c8640f900 100644 --- a/MUON/libMUONmapping.pkg +++ b/MUON/libMUONmapping.pkg @@ -16,8 +16,7 @@ SRCS += \ mapping/AliMpConstants.cxx \ mapping/AliMpFiles.cxx \ mapping/AliMpPad.cxx \ - mapping/AliMpPadIteratorPtr.cxx \ - mapping/AliMpPadPair.cxx \ + mapping/AliMpEncodePair.cxx \ mapping/AliMpVIndexed.cxx \ mapping/AliMpVPadIterator.cxx \ mapping/AliMpVSegmentation.cxx \ @@ -42,7 +41,6 @@ SRCS += \ # Category sector # SRCS += \ - mapping/AliMpNeighboursPadIterator.cxx \ mapping/AliMpPadRow.cxx \ mapping/AliMpPadRowLSegment.cxx \ mapping/AliMpPadRowRSegment.cxx \ diff --git a/MUON/mapping/AliMpArrayI.cxx b/MUON/mapping/AliMpArrayI.cxx index f6f89fcc805..2e578bd1ece 100644 --- a/MUON/mapping/AliMpArrayI.cxx +++ b/MUON/mapping/AliMpArrayI.cxx @@ -47,7 +47,8 @@ AliMpArrayI::AliMpArrayI(Bool_t sort) fSort(sort), fNofValues(0), fValues(fgkDefaultSize), - fLimits(INT_MIN,INT_MAX) + fMinValue(INT_MAX), + fMaxValue(INT_MIN) { /// Standard & default constructor @@ -59,7 +60,8 @@ AliMpArrayI::AliMpArrayI(TRootIOCtor* /*ioCtor*/) fSort(), fNofValues(), fValues(), - fLimits() + fMinValue(), + fMaxValue() { /// IO constructor } @@ -122,8 +124,8 @@ Bool_t AliMpArrayI::Add(Int_t value, Bool_t warn) ++fNofValues; // Update linits - if ( value < fLimits.GetFirst() ) fLimits.SetFirst(value); - if ( value > fLimits.GetSecond() ) fLimits.SetSecond(value); + if ( value < fMinValue ) fMinValue = value; + if ( value > fMaxValue ) fMaxValue = value;; return true; } @@ -180,7 +182,8 @@ void AliMpArrayI::Reset() fValues.Set(fgkDefaultSize); fNofValues = 0; - fLimits = AliMpIntPair(INT_MIN,INT_MAX); + fMinValue = INT_MAX; + fMaxValue = INT_MIN; } //_____________________________________________________________________________ @@ -219,7 +222,7 @@ Bool_t AliMpArrayI::HasValue(Int_t value) const if ( ! fNofValues ) return false; - if ( value < fLimits.GetFirst() || value > fLimits.GetSecond() ) + if ( value < fMinValue || value > fMaxValue ) return false; for ( Int_t i=0; i #include @@ -52,9 +50,10 @@ class AliMpArrayI : public TObject Bool_t fSort; ///< Option to sort the values Int_t fNofValues; ///< Number of values in the array TArrayI fValues; ///< Array of values - AliMpIntPair fLimits; ///< The minimum and maximum values in the array + Int_t fMinValue; ///< The minimum value in the array + Int_t fMaxValue; ///< The maximum value in the array - ClassDef(AliMpArrayI,1) // Helper class for sorted integer array + ClassDef(AliMpArrayI,2) // Helper class for sorted integer array }; #endif //ALI_MP_EX_MAP_H diff --git a/MUON/mapping/AliMpConnection.cxx b/MUON/mapping/AliMpConnection.cxx index 80d7c08c485..38135542baf 100755 --- a/MUON/mapping/AliMpConnection.cxx +++ b/MUON/mapping/AliMpConnection.cxx @@ -26,6 +26,8 @@ //----------------------------------------------------------------------------- #include "AliMpConnection.h" +#include "AliMpEncodePair.h" + #include "AliLog.h" /// \cond CLASSIMP @@ -33,60 +35,73 @@ ClassImp(AliMpConnection) /// \endcond //_____________________________________________________________________________ -AliMpConnection::AliMpConnection(Int_t padNum, Int_t bergNum,Int_t kaptonNum, - Int_t gassiNum, const AliMpIntPair& localIndices) +AliMpConnection::AliMpConnection(Int_t padNum, + Int_t bergNum, + Int_t kaptonNum, + Int_t gassiNum, + MpPair_t localIndices) : TObject(), - fPadNum(padNum), fBergNum(bergNum), fKaptonNum(kaptonNum), fGassiNum(gassiNum), + fLocalIndices(localIndices), fOwner(0) { /// Standard constructor - SetUniqueID(localIndices.GetFirst() | ( localIndices.GetSecond() << 16 )); + AliDebug(1,Form("this=%p padNum=%d bergNum=%d kaptonNum=%d gassiNum=%d", + this,padNum,bergNum,kaptonNum,gassiNum)); + SetUniqueID(padNum); +} - AliDebug(1,Form("this=%p padNum=%d bergNum=%d kaptonNum=%d gassiNum=%d", - this,padNum,bergNum,kaptonNum,gassiNum)); +//_____________________________________________________________________________ +AliMpConnection::AliMpConnection(TRootIOCtor* /*ioCtor*/) + : TObject(), + fBergNum(), + fKaptonNum(), + fGassiNum(), + fLocalIndices(), + fOwner() +{ +/// Root IO constructor + AliDebug(1,Form("this=%p",this)); } - +/* //_____________________________________________________________________________ AliMpConnection::AliMpConnection() : TObject(), - fPadNum(-1), fBergNum(-1), fKaptonNum(-1), fGassiNum(-1), + fLocalIndices(-1) fOwner(0) { /// Default constructor - AliDebug(1,Form("this=%p",this)); -} + AliDebug(1,Form("this=%p",this)); +} +*/ //_____________________________________________________________________________ AliMpConnection::~AliMpConnection() { /// Destructor + AliDebug(1,Form("this=%p")); } -/* //_____________________________________________________________________________ -void -AliMpConnection::SetLocalIndices(const AliMpIntPair& pair) +Int_t AliMpConnection::GetLocalIx() const { - SetUniqueID(pair.GetFirst() | ( pair.GetSecond() << 16 )); -} -*/ +/// Return local ix -//_____________________________________________________________________________ -AliMpIntPair AliMpConnection::LocalIndices() const + return AliMp::PairFirst(fLocalIndices); +} + +Int_t AliMpConnection::GetLocalIy() const { -/// Return local indices +/// Return local iy - Int_t f = GetUniqueID() & 0xFFFF; - Int_t s = ( ( GetUniqueID() & 0xFFFF0000 ) >> 16); - return AliMpIntPair(f,s); -} + return AliMp::PairSecond(fLocalIndices); +} diff --git a/MUON/mapping/AliMpConnection.h b/MUON/mapping/AliMpConnection.h index f8edeedfb0f..6d6937531e4 100755 --- a/MUON/mapping/AliMpConnection.h +++ b/MUON/mapping/AliMpConnection.h @@ -16,33 +16,42 @@ #include #include "AliMpMotifType.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include class AliMpConnection : public TObject { public: - AliMpConnection(); - AliMpConnection(Int_t padNum,Int_t bergNum,Int_t kaptonNum,Int_t gassiNum, - const AliMpIntPair& localIndices); + AliMpConnection(Int_t padNum, + Int_t bergNum, + Int_t kaptonNum, + Int_t gassiNum, + MpPair_t localIndices); + AliMpConnection(TRootIOCtor* /*ioCtor*/); + //AliMpConnection(); virtual ~AliMpConnection(); // // accessors // /// Return Berg connector number - Int_t GetBergNum() const {return fBergNum;} + Int_t GetBergNum() const { return fBergNum; } /// Return kapton connector number - Int_t GetKaptonNum() const {return fKaptonNum;} + Int_t GetKaptonNum() const { return fKaptonNum; } /// Return manu channel number - Int_t GetManuChannel() const { return fGassiNum; } + Int_t GetManuChannel() const { return fGassiNum; } /// Return pad number - Int_t GetPadNum() const {return fPadNum;} + Int_t GetPadNum() const { return GetUniqueID(); } + + /// Return encoded local indices + MpPair_t GetLocalIndices() const { return fLocalIndices; } + Int_t GetLocalIx() const; + Int_t GetLocalIy() const; + /// Return the motif type which contains this connection - AliMpMotifType *GetOwner() const {return fOwner;} + AliMpMotifType *GetOwner() const { return fOwner; } - AliMpIntPair LocalIndices() const; TString PadName() const; // @@ -50,36 +59,32 @@ class AliMpConnection : public TObject // /// Set Gassiplex channel number - void SetGassiNum(Int_t n) { fGassiNum = n; } + void SetGassiNum(Int_t n) { fGassiNum = n; } /// Set the motif type which contains this connection - void SetOwner(AliMpMotifType *owner) {fOwner=owner;} - - // void SetLocalIndices(const AliMpIntPair& pair); + void SetOwner(AliMpMotifType *owner) { fOwner=owner; } private: + /// Not implemented + AliMpConnection(); /// Not implemented AliMpConnection(const AliMpConnection& right); /// Not implemented AliMpConnection& operator=(const AliMpConnection& right); // data members - Int_t fPadNum; ///< Pad number - Int_t fBergNum; ///< Berg connector number - Int_t fKaptonNum; ///< Kapton connector number - Int_t fGassiNum; ///< Gassiplex channel number + Int_t fBergNum; ///< Berg connector number + Int_t fKaptonNum; ///< Kapton connector number + Int_t fGassiNum; ///< Gassiplex channel number + MpPair_t fLocalIndices; ///< Local indices AliMpMotifType *fOwner; ///< The motif type which contains this connection - ClassDef(AliMpConnection,1) // Connection description + ClassDef(AliMpConnection,2) // Connection description }; // inline functions - /// Return the pad number converted to a name +/// Return the pad number converted to a name inline TString AliMpConnection::PadName() const -{ return fOwner->PadName(fPadNum); } - -// /// Return the local indices of this pad in the motif -//inline AliMpIntPair AliMpConnection::LocalIndices() const -//{ return fOwner->FindLocalIndicesByConnection(this);} +{ return fOwner->PadName(GetUniqueID()); } #endif //ALI_MP_CONNECTION_H diff --git a/MUON/mapping/AliMpDDLStore.cxx b/MUON/mapping/AliMpDDLStore.cxx index 51d04613e3d..f92e6982964 100644 --- a/MUON/mapping/AliMpDDLStore.cxx +++ b/MUON/mapping/AliMpDDLStore.cxx @@ -46,6 +46,8 @@ #include "AliMpSegmentation.h" #include "AliMpVSegmentation.h" #include "AliMpStringObjMap.h" +#include "AliMpEncodePair.h" +#include "AliMpIntPair.h" #include "AliLog.h" @@ -820,9 +822,11 @@ Int_t AliMpDDLStore::GetBusPatchId(Int_t detElemId, Int_t manuId) const { //______________________________________________________________________________ -AliMpIntPair AliMpDDLStore::GetLinkPortId(Int_t busPatchId) const { +Long_t AliMpDDLStore::GetLinkPortId(Int_t busPatchId) const { - /// Return link port for a given frtId and global busPatchId + /// Get link port and DSP from busPatch id. + /// Return -1 if the value is not valid + /// (the validity has to be tested in the client code) AliMpBusPatch* busPatch = GetBusPatch(busPatchId); Int_t ddlId = busPatch->GetDdlId(); @@ -881,7 +885,7 @@ Int_t AliMpDDLStore::GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberI TString name(localBoard->GetName()); - Int_t line = localBoard->GetPosition().GetFirst(); + Int_t line = AliMp::PairFirst(localBoard->GetPosition()); ++line; name.Replace(4,1,Form("%d", line)); @@ -903,7 +907,7 @@ Int_t AliMpDDLStore::GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t cham TString name(localBoard->GetName()); - Int_t line = localBoard->GetPosition().GetFirst(); + Int_t line = AliMp::PairFirst(localBoard->GetPosition()); --line; name.Replace(4,1,Form("%d", line)); diff --git a/MUON/mapping/AliMpDDLStore.h b/MUON/mapping/AliMpDDLStore.h index 0ef7b5a63e6..d9645c23bde 100644 --- a/MUON/mapping/AliMpDDLStore.h +++ b/MUON/mapping/AliMpDDLStore.h @@ -18,7 +18,6 @@ #define ALI_MP_DDL_STORE_H #include "AliMpExMap.h" -#include "AliMpIntPair.h" #include "AliMpRegionalTrigger.h" #include #include @@ -62,10 +61,8 @@ class AliMpDDLStore : public TObject { Int_t GetDDLfromBus(Int_t busPatchId) const; Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const; - - /// Get link port and DSP from busPatch id - AliMpIntPair GetLinkPortId(Int_t busPatchId) const; + Long_t GetLinkPortId(Int_t busPatchId) const; /// Print info of all manus void PrintAllManu() const; diff --git a/MUON/mapping/AliMpDEManager.cxx b/MUON/mapping/AliMpDEManager.cxx index e85b8491ad4..0b308e12ae3 100644 --- a/MUON/mapping/AliMpDEManager.cxx +++ b/MUON/mapping/AliMpDEManager.cxx @@ -30,6 +30,7 @@ #include "AliMpDetElement.h" #include "AliMpConstants.h" #include "AliMpCathodType.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -245,13 +246,14 @@ Int_t AliMpDEManager::GetNofDEInChamber(Int_t chamberId, Bool_t warn) } //______________________________________________________________________________ -AliMpIntPair AliMpDEManager::GetDetElemIdRange(Int_t chamberId) +MpPair_t AliMpDEManager::GetDetElemIdRange(Int_t chamberId) { /// Return the detection element Id range for given chamberId +/// es encoded pair - if ( ! IsValidChamberId(chamberId) ) return AliMpIntPair::Invalid(); + if ( ! IsValidChamberId(chamberId) ) return 0; - return AliMpIntPair( + return AliMp::Pair( (chamberId+1)*fgkCoefficient, (chamberId+1)*fgkCoefficient + GetNofDEInChamber(chamberId) - 1); diff --git a/MUON/mapping/AliMpDEManager.h b/MUON/mapping/AliMpDEManager.h index 0849742d94c..74afdd57bd8 100644 --- a/MUON/mapping/AliMpDEManager.h +++ b/MUON/mapping/AliMpDEManager.h @@ -29,6 +29,7 @@ #include "AliMpStationType.h" #include "AliMpStation12Type.h" #include "AliMpDEIterator.h" +#include "AliMpEncodePair.h" class AliMpDetElement; class TString; @@ -53,8 +54,8 @@ class AliMpDEManager : public TObject { static AliMpDetElement* GetDetElement(Int_t detElemId, Bool_t warn = true); static AliMpDetElement* GetDetElement(const TString& deName, Bool_t warn = true); - static Int_t GetNofDEInChamber(Int_t chamberId, Bool_t warn = true); - static AliMpIntPair GetDetElemIdRange(Int_t chamberId); + static Int_t GetNofDEInChamber(Int_t chamberId, Bool_t warn = true); + static MpPair_t GetDetElemIdRange(Int_t chamberId); private: /// Not implemented diff --git a/MUON/mapping/AliMpDEStore.cxx b/MUON/mapping/AliMpDEStore.cxx index 2a01b9f2cbc..091e94daf79 100644 --- a/MUON/mapping/AliMpDEStore.cxx +++ b/MUON/mapping/AliMpDEStore.cxx @@ -33,7 +33,6 @@ #include "AliMpFiles.h" #include "AliMpDataStreams.h" #include "AliMpHelper.h" -#include "AliMpIntPair.h" #include "AliMpConstants.h" #include "AliMpExMapIterator.h" diff --git a/MUON/mapping/AliMpDEStore.h b/MUON/mapping/AliMpDEStore.h index 4bead3a2ff3..cd41a1dc7b7 100644 --- a/MUON/mapping/AliMpDEStore.h +++ b/MUON/mapping/AliMpDEStore.h @@ -21,7 +21,6 @@ #include "AliMpPlaneType.h" #include "AliMpStationType.h" #include "AliMpStation12Type.h" -#include "AliMpIntPair.h" class AliMpDetElement; class AliMpDataStreams; diff --git a/MUON/mapping/AliMpDEVisu.cxx b/MUON/mapping/AliMpDEVisu.cxx index 4d35e0addec..bf8da4fe5ae 100644 --- a/MUON/mapping/AliMpDEVisu.cxx +++ b/MUON/mapping/AliMpDEVisu.cxx @@ -359,7 +359,7 @@ void AliMpDEVisu::HandleMovement(Int_t eventType, Int_t eventX, Int_t eventY, TO return; } - Int_t manu = pad.GetLocation().GetFirst(); + Int_t manu = pad.GetManuId(); fNumberEntry->SetNumber(manu); diff --git a/MUON/mapping/AliMpDetElement.cxx b/MUON/mapping/AliMpDetElement.cxx index 69cb7a07c05..7eae3c32eaa 100644 --- a/MUON/mapping/AliMpDetElement.cxx +++ b/MUON/mapping/AliMpDetElement.cxx @@ -310,7 +310,7 @@ AliMpDetElement::AddManu(Int_t manuId) for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i ) { - if ( seg->PadByLocation(AliMpIntPair(manuId,i),kFALSE).IsValid() ) + if ( seg->PadByLocation(manuId,i,kFALSE).IsValid() ) { ++n; fTrackerChannels.Add((Long_t)AliMpPadUID::BuildUniqueID(fId,manuId,i), diff --git a/MUON/mapping/AliMpEncodePair.cxx b/MUON/mapping/AliMpEncodePair.cxx new file mode 100644 index 00000000000..e4e04c72e7f --- /dev/null +++ b/MUON/mapping/AliMpEncodePair.cxx @@ -0,0 +1,61 @@ +/************************************************************************** +* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* * +* Author: The ALICE Off-line Project. * +* Contributors are mentioned in the code where appropriate. * +* * +* Permission to use, copy, modify and distribute this software and its * +* documentation strictly for non-commercial purposes is hereby granted * +* without fee, provided that the above copyright notice appears in all * +* copies and that both the copyright notice and this permission notice * +* appear in the supporting documentation. The authors make no claims * +* about the suitability of this software for any purpose. It is * +* provided "as is" without express or implied warranty. * +**************************************************************************/ + +// $Id$ + +#include "AliMpEncodePair.h" + +#include + +//_______________________________________________________________________ +MpPair_t AliMp::Pair(Int_t first, Int_t second) +{ +/// See also AliMp::PairFirst(), AliMp::PairSecond() +/// \author L. Aphecetche, SUBATECH + + return (( first << 16 ) | second); +} + +//_______________________________________________________________________ +Int_t AliMp::PairFirst(MpPair_t pair ) +{ +/// See also AliMp::Pair(), AliMp::PairSecond() +/// \author L. Aphecetche, SUBATECH + + return ( pair & 0xFFFF0000 ) >> 16; +} + +//_______________________________________________________________________ +Int_t AliMp::PairSecond(MpPair_t pair) +{ +/// See also AliMp::Pair(), AliMp::PairFirst() +/// \author L. Aphecetche, SUBATECH + + return pair & 0xFFFF; +} + +//_______________________________________________________________________ +ostream& AliMp::PairPut(ostream& stream, MpPair_t pair) +{ + if ( pair >= 0 ) { + stream << '(' << AliMp::PairFirst(pair) + << ',' << AliMp::PairSecond(pair) << ')'; + return stream; + } + else { + stream << "AliMpIntPair::Invalid"; + return stream; + } +} diff --git a/MUON/mapping/AliMpEncodePair.h b/MUON/mapping/AliMpEncodePair.h new file mode 100644 index 00000000000..b420fbe12f7 --- /dev/null +++ b/MUON/mapping/AliMpEncodePair.h @@ -0,0 +1,29 @@ +#ifndef ALIMPENCODEPAIR_H +#define ALIMPENCODEPAIR_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * +* See cxx source for full Copyright notice */ + +// $Id$ + +#include +#include + +typedef Int_t MpPair_t; + +namespace AliMp +{ + /// Encode the pair of integers to another integer. + MpPair_t Pair(Int_t first, Int_t second); + + /// Decode the first integer from encoded pair + Int_t PairFirst(MpPair_t pair); + + /// Decode the second integer from encoded pair + Int_t PairSecond(MpPair_t pair); + + /// A special printing for encoded pair. + ostream& PairPut(ostream& s, MpPair_t pair); +} + +#endif //ALIMPENCODEPAIR_H diff --git a/MUON/mapping/AliMpExMap.cxx b/MUON/mapping/AliMpExMap.cxx index 043aec11301..08b29558aab 100644 --- a/MUON/mapping/AliMpExMap.cxx +++ b/MUON/mapping/AliMpExMap.cxx @@ -25,7 +25,6 @@ //----------------------------------------------------------------------------- #include "AliMpExMap.h" -#include "AliMpIntPair.h" #include "AliMpExMapIterator.h" #include "AliLog.h" @@ -57,27 +56,6 @@ const TString AliMpExMap::fgkCharacterMap // static methods // -//______________________________________________________________________________ -Long_t AliMpExMap::GetIndex(const AliMpIntPair& pair) -{ -/// Convert the pair of integers to integer. - - if ( pair.GetFirst() >= 0xFFFF || pair.GetSecond() >= 0xFFFF ) - { - AliFatalClass("Index out of limit"); - return 0; - } - - return 1 + ( pair.GetFirst() | ( pair.GetSecond() << 16 ) ); - -// if (pair.GetFirst() >= fgkSeparator1 || pair.GetSecond() >= fgkSeparator1) { -// AliFatalClass("Index out of limit."); -// exit(1); -// } -// -// return pair.GetFirst()*fgkSeparator1 + pair.GetSecond() + 1; -} - //_____________________________________________________________________________ Long_t AliMpExMap::GetIndex(const TString& s) { @@ -95,17 +73,6 @@ Long_t AliMpExMap::GetIndex(const TString& s) return index; } -//______________________________________________________________________________ -AliMpIntPair AliMpExMap::GetPair(Long_t index) -{ -/// Convert the integer index to the pair of integers. - -// return AliMpIntPair((index-1)/fgkSeparator1,(index-1)%fgkSeparator1); - return AliMpIntPair( - ( (index-1) & 0xFFFF ) , - ( (index-1) & 0xFFFF0000 ) >> 16 ); -} - //_____________________________________________________________________________ TString AliMpExMap::GetString(Long_t index) { @@ -178,6 +145,47 @@ AliMpExMap::~AliMpExMap() /// Destructor } +// +// private static methods +// + +//______________________________________________________________________________ +Long_t AliMpExMap::GetIndex(Int_t first, Int_t second) +{ +/// Convert the pair of integers to integer. + + if ( first >= 0xFFFF || second >= 0xFFFF ) + { + AliFatalClass("Index out of limit"); + return 0; + } + + return 1 + ( first | ( second << 16 ) ); + +// if (pair.GetFirst() >= fgkSeparator1 || pair.GetSecond() >= fgkSeparator1) { +// AliFatalClass("Index out of limit."); +// exit(1); +// } +// +// return pair.GetFirst()*fgkSeparator1 + pair.GetSecond() + 1; +} + +//______________________________________________________________________________ +Int_t AliMpExMap::GetPairFirst(Long_t index) +{ +/// Return first integer from index (encoded pair) + + return (index-1) & 0xFFFF ; +} + +//______________________________________________________________________________ +Int_t AliMpExMap::GetPairSecond(Long_t index) +{ +/// Return second integer from index (encoded pair) + + return ( (index-1) & 0xFFFF0000 ) >> 16 ; +} + // // private methods // @@ -272,12 +280,12 @@ void AliMpExMap::Print(Option_t* opt) const } //_____________________________________________________________________________ -void AliMpExMap::Add(const AliMpIntPair& key, TObject* object) +void AliMpExMap::Add(Int_t keyFirst, Int_t keySecond, TObject* object) { /// Add object with its key to the map and arrays - fMap.Add(GetIndex(key), (Long_t)object); - AddKey(GetIndex(key)); + fMap.Add(GetIndex(keyFirst, keySecond), (Long_t)object); + AddKey(GetIndex(keyFirst, keySecond)); fObjects.Add(object); } @@ -345,12 +353,12 @@ AliMpExMap::CreateIterator() const } //_____________________________________________________________________________ -TObject* AliMpExMap::GetValue(const AliMpIntPair& key) const +TObject* AliMpExMap::GetValue(Int_t keyFirst, Int_t keySecond) const { /// Return the object associated with the given key if found, /// otherwise return 0 - return reinterpret_cast(fMap.GetValue(GetIndex(key))); + return reinterpret_cast(fMap.GetValue(GetIndex(keyFirst, keySecond))); } //_____________________________________________________________________________ diff --git a/MUON/mapping/AliMpExMap.h b/MUON/mapping/AliMpExMap.h index 45ce6679bcf..b965e058884 100644 --- a/MUON/mapping/AliMpExMap.h +++ b/MUON/mapping/AliMpExMap.h @@ -21,7 +21,6 @@ #include #include -class AliMpIntPair; class AliMpExMapIterator; class TString; @@ -39,20 +38,16 @@ class AliMpExMap : public TObject // static methods - // conversion between varius keys and Long_t - // - static Long_t GetIndex(const AliMpIntPair& pair); + // conversion between String and Long_t static Long_t GetIndex(const TString& s); - - static AliMpIntPair GetPair(Long_t index); - static TString GetString(Long_t index); + static TString GetString(Long_t index); // methods from base class virtual void Clear(Option_t* opt=""); virtual void Print(Option_t* opt="") const; // set methods - void Add(const AliMpIntPair& key, TObject* object); + void Add(Int_t keyFirst, Int_t keySecond, TObject* object); void Add(const TString& key, TObject* object); void Add(Int_t key, TObject* object); @@ -63,7 +58,7 @@ class AliMpExMap : public TObject Int_t GetSize() const; Int_t GetCapacity() const; - TObject* GetValue(const AliMpIntPair& key) const; + TObject* GetValue(Int_t keyFirst, Int_t keySecond) const; TObject* GetValue(const TString& key) const; TObject* GetValue(Int_t key) const; @@ -71,6 +66,12 @@ class AliMpExMap : public TObject private: // methods + + // conversion between Int_t pair key and Long_t + static Long_t GetIndex(Int_t first, Int_t second); + static Int_t GetPairFirst(Long_t index); + static Int_t GetPairSecond(Long_t index); + void FillMap(); void AddKey(Long_t key); void Copy(TObject& dest) const; @@ -80,7 +81,7 @@ class AliMpExMap : public TObject static const Bool_t fgkDefaultOwnership; ///< Default ownership static const Int_t fgkSeparator1; ///< \brief the separator used for conversion - /// of AliMpIntPair to Int_t + /// of Int_t pair to Int_t static const Int_t fgkSeparator2; ///< \brief the separator used for conversion /// of TString to Int_t static const TString fgkCharacterMap; ///< \brief the string mapping characters diff --git a/MUON/mapping/AliMpExMapIterator.cxx b/MUON/mapping/AliMpExMapIterator.cxx index 6ea13b36ed0..a963770ff25 100644 --- a/MUON/mapping/AliMpExMapIterator.cxx +++ b/MUON/mapping/AliMpExMapIterator.cxx @@ -23,10 +23,10 @@ //----------------------------------------------------------------------------- #include "AliMpExMapIterator.h" +#include "AliMpExMap.h" #include "AliLog.h" -#include "AliMpExMap.h" -#include "AliMpIntPair.h" + #include #include #include @@ -135,7 +135,7 @@ AliMpExMapIterator::Next(Int_t& key) //_____________________________________________________________________________ TObject* -AliMpExMapIterator::Next(AliMpIntPair& key) +AliMpExMapIterator::Next(Int_t& keyFirst, Int_t& keySecond) { /// Return the next object in iteration and fill the key. /// The returned object must not be deleted by the user. @@ -143,7 +143,8 @@ AliMpExMapIterator::Next(AliMpIntPair& key) Long_t index; TObject* o(0x0); Next(index,o); - key = AliMpExMap::GetPair(index); + keyFirst = AliMpExMap::GetPairFirst(index); + keySecond = AliMpExMap::GetPairSecond(index); return o; } diff --git a/MUON/mapping/AliMpExMapIterator.h b/MUON/mapping/AliMpExMapIterator.h index 5eb697d7a23..fdf6db0b313 100644 --- a/MUON/mapping/AliMpExMapIterator.h +++ b/MUON/mapping/AliMpExMapIterator.h @@ -17,7 +17,6 @@ #endif class AliMpExMap; -class AliMpIntPair; class TString; class TExMapIter; @@ -25,6 +24,8 @@ class TExMapIter; class AliMpExMapIterator : public TIterator { public: + friend class AliMpExMap; + AliMpExMapIterator(const AliMpExMap& theMap); AliMpExMapIterator(const AliMpExMapIterator& rhs); AliMpExMapIterator& operator=(const AliMpExMapIterator& rhs); @@ -39,7 +40,7 @@ public: // Iterating with retrieving a key TObject* Next(Int_t& key); - TObject* Next(AliMpIntPair& key); + TObject* Next(Int_t& keyFirst, Int_t& keySecond); TObject* Next(TString& key); virtual void Reset(); diff --git a/MUON/mapping/AliMpFastSegmentation.cxx b/MUON/mapping/AliMpFastSegmentation.cxx index aa46b410bf8..f20dc4bd300 100644 --- a/MUON/mapping/AliMpFastSegmentation.cxx +++ b/MUON/mapping/AliMpFastSegmentation.cxx @@ -36,6 +36,8 @@ #include "AliMpSector.h" #include "AliMpSlat.h" #include "AliMpVPadIterator.h" +#include "AliMpEncodePair.h" + #include /// \cond CLASSIMP @@ -116,11 +118,11 @@ fPosition() for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - if ( vseg->HasPadByLocation(AliMpIntPair(manuId,manuChannel)) ) + if ( vseg->HasPadByLocation(manuId,manuChannel) ) { - AliMpPad pad = vseg->PadByLocation(AliMpIntPair(manuId,manuChannel)); + AliMpPad pad = vseg->PadByLocation(manuId,manuChannel); - fIxIy.Add(Encode(pad.GetIndices().GetFirst(),pad.GetIndices().GetSecond()),1+index); + fIxIy.Add(Encode(pad.GetIx(),pad.GetIy()),1+index); } } } @@ -161,17 +163,18 @@ AliMpFastSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours, //_____________________________________________________________________________ AliMpPad -AliMpFastSegmentation::PadByLocation(const AliMpIntPair& location, Bool_t warning) const +AliMpFastSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel, + Bool_t warning) const { /// Get the pad by location, using the manuid map. - Int_t index = fManuId.GetValue(Encode2(location.GetFirst())); + Int_t index = fManuId.GetValue(Encode2(manuId)); if (!index) { if (warning) - { - AliWarning(Form("Manu ID %d not found",location.GetFirst())); + { + AliWarning(Form("Manu ID %d not found",manuId)); Print(); } return AliMpPad::Invalid(); @@ -187,28 +190,27 @@ AliMpFastSegmentation::PadByLocation(const AliMpIntPair& location, Bool_t warnin } AliMpVMotif* motif = motifPos->GetMotif(); - AliMpIntPair localIndices = - motif->GetMotifType()->FindLocalIndicesByGassiNum(location.GetSecond()); + MpPair_t localIndices + = motif->GetMotifType()->FindLocalIndicesByGassiNum(manuChannel); - if (!localIndices.IsValid()) - { - if (warning) - { - AliWarning(Form("The pad number %d doesn't exists", - location.GetSecond())); + if ( localIndices < 0 ) + { + if (warning) + { + AliWarning(Form("The pad number %d doesn't exists", manuChannel)); Print(); - } - return AliMpPad::Invalid(); - } + } + return AliMpPad::Invalid(); + } #ifdef CHECK - AliMpPad pad1 = AliMpPad(location, + AliMpPad pad1 = AliMpPad(manuId, manuChannel, motifPos->GlobalIndices(localIndices), motifPos->Position() + motif->PadPositionLocal(localIndices) - fPosition, - motif->GetPadDimensions(localIndices)); - AliMpPad pad2 = fHelper->PadByLocation(location,warning); + motif->GetPadDimensionsByIndices(localIndices)); + AliMpPad pad2 = fHelper->PadByLocation(manuId, manuChannel,warning); if ( pad1 != pad2 ) { Print(); @@ -218,12 +220,12 @@ AliMpFastSegmentation::PadByLocation(const AliMpIntPair& location, Bool_t warnin } #endif - return AliMpPad(location, + return AliMpPad(manuId, manuChannel, motifPos->GlobalIndices(localIndices), motifPos->Position() + motif->PadPositionLocal(localIndices) - fPosition, - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //_____________________________________________________________________________ @@ -236,18 +238,17 @@ AliMpFastSegmentation::InternalMotifPosition(Int_t index) const //_____________________________________________________________________________ AliMpPad -AliMpFastSegmentation::PadByIndices (const AliMpIntPair& indices, Bool_t warning) const +AliMpFastSegmentation::PadByIndices (Int_t ix, Int_t iy, Bool_t warning) const { /// Get pad by indices - Int_t index = fIxIy.GetValue(Encode(indices.GetFirst(),indices.GetSecond())); + Int_t index = fIxIy.GetValue(Encode(ix, iy)); if ( !index ) { if (warning) { - AliWarning(Form("ManuID not found for pad indices (%d,%d)", - indices.GetFirst(),indices.GetSecond())); + AliWarning(Form("ManuID not found for pad indices (%d,%d)", ix, iy)); Print(); } return AliMpPad::Invalid(); @@ -264,39 +265,38 @@ AliMpFastSegmentation::PadByIndices (const AliMpIntPair& indices, Bool_t warning AliMpVMotif* motif = motifPos->GetMotif(); AliMpMotifType* motifType = motif->GetMotifType(); - AliMpIntPair localIndices(indices-motifPos->GetLowIndicesLimit()); + MpPair_t localIndices(AliMp::Pair(ix, iy) - motifPos->GetLowIndicesLimit()); AliMpConnection* connection = motifType->FindConnectionByLocalIndices(localIndices); if (!connection) - { - if ( warning ) - { - AliWarning(Form("No connection for pad indices (%d,%d)", - indices.GetFirst(),indices.GetSecond())); + { + if ( warning ) + { + AliWarning(Form("No connection for pad indices (%d,%d)", ix, iy)); } return AliMpPad::Invalid(); - } + } #ifdef CHECK - AliMpPad pad2 = fHelper->PadByIndices(indices,warning); - AliMpPad pad1 = AliMpPad(AliMpIntPair(motifPos->GetID(),connection->GetManuChannel()), - indices, + AliMpPad pad2 = fHelper->PadByIndices(ix, iy, warning); + AliMpPad pad1 = AliMpPad(motifPos->GetID(),connection->GetManuChannel(), + ix, iy, motifPos->Position() + motif->PadPositionLocal(localIndices) - fPosition, - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); assert(pad1==pad2); #endif - return AliMpPad(AliMpIntPair(motifPos->GetID(),connection->GetManuChannel()), - indices, + return AliMpPad(motifPos->GetID(),connection->GetManuChannel(), + ix, iy, motifPos->Position() + motif->PadPositionLocal(localIndices) - fPosition, - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } @@ -350,18 +350,18 @@ AliMpFastSegmentation::GetAllElectronicCardIDs(TArrayI& ecn) const //_____________________________________________________________________________ Bool_t -AliMpFastSegmentation::HasPadByIndices(const AliMpIntPair& indices) const +AliMpFastSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const { /// Whether there is a pad at the given indices - Int_t index = fIxIy.GetValue(Encode(indices.GetFirst(),indices.GetSecond())); + Int_t index = fIxIy.GetValue(Encode(ix, iy)); if ( !index ) return kFALSE; AliMpMotifPosition* mp = InternalMotifPosition(index); - Bool_t r1 = mp->HasPadByIndices(indices); + Bool_t r1 = mp->HasPadByIndices(AliMp::Pair(ix, iy)); #ifdef CHECK - Bool_t r2 = fHelper->HasPadByIndices(indices); + Bool_t r2 = fHelper->HasPadByIndices(ix, iy); assert(r1==r2); #endif @@ -370,19 +370,19 @@ AliMpFastSegmentation::HasPadByIndices(const AliMpIntPair& indices) const //_____________________________________________________________________________ Bool_t -AliMpFastSegmentation::HasPadByLocation(const AliMpIntPair& location) const +AliMpFastSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const { /// Whether there is a pad at the given location (de,manuid) - Int_t index = fManuId.GetValue(Encode2(location.GetFirst())); + Int_t index = fManuId.GetValue(Encode2(manuId)); if (!index) return kFALSE; AliMpMotifPosition* mp = InternalMotifPosition(index); - Bool_t r1 = mp->HasPadByManuChannel(location.GetSecond()); + Bool_t r1 = mp->HasPadByManuChannel(manuChannel); #ifdef CHECK - Bool_t r2 = fHelper->HasPadByLocation(location); + Bool_t r2 = fHelper->HasPadByLocation(manuId, manuChannel); assert(r1==r2); #endif @@ -442,7 +442,7 @@ AliMpFastSegmentation::MotifPosition(Int_t manuId) const it->First(); AliMpPad pad = it->CurrentItem(); delete it; - AliWarning(Form("DE %04d Manu ID %04d not found",pad.GetLocation().GetFirst(),manuId)); + AliWarning(Form("DE %04d Manu ID %04d not found",pad.GetManuId(),manuId)); return 0x0; } diff --git a/MUON/mapping/AliMpFastSegmentation.h b/MUON/mapping/AliMpFastSegmentation.h index 6d15981a09e..6bb09177b41 100644 --- a/MUON/mapping/AliMpFastSegmentation.h +++ b/MUON/mapping/AliMpFastSegmentation.h @@ -47,11 +47,11 @@ public: Bool_t includeSelf=kFALSE, Bool_t includeVoid=kFALSE) const; - virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const; - virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const; + virtual Bool_t HasPadByIndices(Int_t ix, Int_t iy) const; + virtual Bool_t HasPadByLocation(Int_t manuId, Int_t manuChannel) const; - virtual AliMpPad PadByLocation(const AliMpIntPair& location, Bool_t warning = true) const; - virtual AliMpPad PadByIndices (const AliMpIntPair& indices, Bool_t warning = true) const; + virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning = true) const; + virtual AliMpPad PadByIndices (Int_t ix, Int_t iy, Bool_t warning = true) const; virtual AliMpPad PadByPosition(const TVector2& position, Bool_t warning = true) const; virtual Int_t MaxPadIndexX() const; diff --git a/MUON/mapping/AliMpFrtCrocusConstants.cxx b/MUON/mapping/AliMpFrtCrocusConstants.cxx index c2ba0198c6d..a423884fbaf 100644 --- a/MUON/mapping/AliMpFrtCrocusConstants.cxx +++ b/MUON/mapping/AliMpFrtCrocusConstants.cxx @@ -114,12 +114,11 @@ Int_t AliMpFrtCrocusConstants::GetIdFromBotAddress(UInt_t add) //______________________________________________________________________________ -AliMpIntPair AliMpFrtCrocusConstants::GetLinkPortId(Int_t index) +MpPair_t AliMpFrtCrocusConstants::GetLinkPortId(Int_t index) { /// Return the linkPort/dspId by index - if (index >= fgkNofBusPatches) - return AliMpIntPair(-1,-1); + if ( index >= fgkNofBusPatches ) return -1; Int_t dspId; if (index < fgkOffset) @@ -127,7 +126,7 @@ AliMpIntPair AliMpFrtCrocusConstants::GetLinkPortId(Int_t index) else dspId = 1; - return AliMpIntPair(dspId, fgkLinkPorts[index]); + return AliMp::Pair(dspId, fgkLinkPorts[index]); } diff --git a/MUON/mapping/AliMpFrtCrocusConstants.h b/MUON/mapping/AliMpFrtCrocusConstants.h index b3a17d75874..692a6999d87 100644 --- a/MUON/mapping/AliMpFrtCrocusConstants.h +++ b/MUON/mapping/AliMpFrtCrocusConstants.h @@ -16,7 +16,7 @@ #include #include "AliMpArrayI.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" class AliMpFrtCrocusConstants : public TObject { @@ -31,7 +31,7 @@ class AliMpFrtCrocusConstants : public TObject { // get methods static Int_t GetNofDsps(); static Int_t GetNofBusPatches(); - static AliMpIntPair GetLinkPortId(Int_t index); + static MpPair_t GetLinkPortId(Int_t index); // return VME top address static UInt_t GetTopAddress(Int_t id); diff --git a/MUON/mapping/AliMpIteratorPainter.cxx b/MUON/mapping/AliMpIteratorPainter.cxx index 6ec36b06286..9812662fc20 100644 --- a/MUON/mapping/AliMpIteratorPainter.cxx +++ b/MUON/mapping/AliMpIteratorPainter.cxx @@ -121,7 +121,7 @@ AliMpIteratorPainter::Paint(Option_t*) TVector2 bl = padPadPos - padPadDim; TVector2 ur = padPadPos + padPadDim; - Int_t manuId = pad->GetLocation().GetFirst(); + Int_t manuId = pad->GetManuId(); Style_t sty = gVirtualX->GetFillStyle(); @@ -146,7 +146,7 @@ AliMpIteratorPainter::Paint(Option_t*) gVirtualX->SetTextSize(10); gVirtualX->SetTextAlign(22); gPad->PaintText((bl.X()+ur.X())/2.0,(bl.Y()+ur.Y())/2.0, - Form("%d",pad->GetLocation().GetSecond())); + Form("%d",pad->GetManuChannel())); gVirtualX->SetTextSize(textSize); diff --git a/MUON/mapping/AliMpLocalBoard.cxx b/MUON/mapping/AliMpLocalBoard.cxx index c3efaa88756..661c1356df6 100644 --- a/MUON/mapping/AliMpLocalBoard.cxx +++ b/MUON/mapping/AliMpLocalBoard.cxx @@ -24,7 +24,7 @@ #include "AliMpLocalBoard.h" #include "AliMpConstants.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -177,7 +177,7 @@ Int_t AliMpLocalBoard::GetSwitch(Int_t index) const } //______________________________________________________________________________ -AliMpIntPair AliMpLocalBoard::GetPosition() const +MpPair_t AliMpLocalBoard::GetPosition() const { /// gives position of the local board in (line, col) @@ -185,6 +185,6 @@ AliMpIntPair AliMpLocalBoard::GetPosition() const Int_t iLine = boardName[4] - '0'; Int_t iCol = boardName[2] - '0'; - return (AliMpIntPair(iLine, iCol)); + return AliMp::Pair(iLine, iCol); } diff --git a/MUON/mapping/AliMpLocalBoard.h b/MUON/mapping/AliMpLocalBoard.h index 26a9f9321d0..add3114d425 100644 --- a/MUON/mapping/AliMpLocalBoard.h +++ b/MUON/mapping/AliMpLocalBoard.h @@ -15,7 +15,8 @@ #include -#include "AliMpArrayI.h" +#include "AliMpArrayI.h" +#include "AliMpEncodePair.h" class TString; @@ -85,7 +86,7 @@ class AliMpLocalBoard : public TNamed /// given position (line, col) - AliMpIntPair GetPosition() const; + MpPair_t GetPosition() const; // Id to be copy to or from diff --git a/MUON/mapping/AliMpManuStore.cxx b/MUON/mapping/AliMpManuStore.cxx index 085609420aa..8fb5777490b 100644 --- a/MUON/mapping/AliMpManuStore.cxx +++ b/MUON/mapping/AliMpManuStore.cxx @@ -33,8 +33,8 @@ #include "AliMpDataStreams.h" #include "AliMpFiles.h" #include "AliMpHelper.h" -#include "AliMpIntPair.h" #include "AliMpConstants.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -239,7 +239,7 @@ void AliMpManuStore::ReplaceManu(Int_t detElemId, Int_t manuId, Int_t serialNb) /// As TExMap has no replcae function, we have to rebuild map once again. /// Not yet in use, declared private. - Long_t index = AliMpExMap::GetIndex(AliMpIntPair(detElemId, manuId)); + Long_t index = AliMp::Pair(detElemId, manuId); TExMap newManuToSerialNbs; // Loop over map @@ -337,18 +337,20 @@ Bool_t AliMpManuStore::WriteData(const TString& outDir) Long_t key; Long_t value; while ( ( it2.Next(key, value) ) ) { - AliMpIntPair pair = AliMpExMap::GetPair(key); + Int_t pairFirst = AliMp::PairFirst(key); - if ( pair.GetFirst() != detElemId ) continue; + if ( pairFirst != detElemId ) continue; + Int_t manuId = AliMp::PairSecond(key); + AliDebugStream(3) - << "Go to write " << key << " " << pair << " " << value << endl; + << "Go to write " << key << " " + << pairFirst << " " << manuId << " " << value << endl; - Int_t manuId = pair.GetSecond(); static Int_t manuMask = AliMpConstants::ManuMask(AliMp::kNonBendingPlane); TString planeName = PlaneTypeName(AliMp::kBendingPlane); - if ( pair.GetSecond()> manuMask ) { + if ( manuId> manuMask ) { planeName = PlaneTypeName(AliMp::kNonBendingPlane); manuId -= manuMask; } @@ -392,7 +394,7 @@ Bool_t AliMpManuStore::AddManu(Int_t detElemId, Int_t manuId, Int_t serialNb) { /// Add manu to the map - Long_t index = AliMpExMap::GetIndex(AliMpIntPair(detElemId, manuId)); + Long_t index = AliMp::Pair(detElemId, manuId); AliDebugStream(2) << "Adding (" << detElemId << "," << manuId @@ -405,9 +407,8 @@ Bool_t AliMpManuStore::AddManu(Int_t detElemId, Int_t manuId, Int_t serialNb) if ( fgWarnIfDoublon ) { AliWarningStream() << "Serial number " << serialNb - << " already present for (detElemId, manuId) = " << AliMpExMap::GetPair(value) - << ", it will nod be added for (" - << detElemId << "," << manuId << ")" << endl; + << " already present for (detElemId, manuId) = " ; + AliMp::PairPut(AliWarningStream(), (MpPair_t) value) << endl; } return kFALSE; } @@ -423,20 +424,18 @@ Int_t AliMpManuStore::GetManuSerial(Int_t detElemId, Int_t manuId) const { /// Return manu serial number for given detElemId and manuId - Long_t index = AliMpExMap::GetIndex(AliMpIntPair(detElemId, manuId)); + Long_t index = AliMp::Pair(detElemId, manuId); // cout << index << " " << fManuToSerialNbs.GetValue(index) << endl; return fManuToSerialNbs.GetValue(index); } //______________________________________________________________________________ -AliMpIntPair AliMpManuStore::GetDetElemIdManu(Int_t manuSerial) const +MpPair_t AliMpManuStore::GetDetElemIdManu(Int_t manuSerial) const { /// Return detElemId and manuId for given manu serial number +/// as encoded pair - Long_t value = fSerialNbToManus.GetValue(Long_t(manuSerial)); - // cout << manuSerial << " " << value << endl; - - return AliMpExMap::GetPair(value); + return fSerialNbToManus.GetValue(Long_t(manuSerial)); } diff --git a/MUON/mapping/AliMpManuStore.h b/MUON/mapping/AliMpManuStore.h index 881c3bd5a93..30cf5ad1504 100644 --- a/MUON/mapping/AliMpManuStore.h +++ b/MUON/mapping/AliMpManuStore.h @@ -17,7 +17,7 @@ #include "AliMpPlaneType.h" #include "AliMpStationType.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include #include @@ -46,8 +46,8 @@ class AliMpManuStore : public TObject { Int_t NofManus() const; Int_t NofManus(Int_t detElemId) const; - Int_t GetManuSerial(Int_t detElemId, Int_t manuId) const; - AliMpIntPair GetDetElemIdManu(Int_t manuSerial) const; + Int_t GetManuSerial(Int_t detElemId, Int_t manuId) const; + MpPair_t GetDetElemIdManu(Int_t manuSerial) const; private: AliMpManuStore(const AliMpDataStreams& dataStreams); diff --git a/MUON/mapping/AliMpMotif.cxx b/MUON/mapping/AliMpMotif.cxx index 5090237bbad..a1aa22da3e8 100755 --- a/MUON/mapping/AliMpMotif.cxx +++ b/MUON/mapping/AliMpMotif.cxx @@ -29,7 +29,7 @@ #include "AliMpMotif.h" #include "AliMpConstants.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpMotifType.h" /// \cond CLASSIMP @@ -63,18 +63,26 @@ AliMpMotif::~AliMpMotif() //_____________________________________________________________________________ -TVector2 AliMpMotif::GetPadDimensions(const AliMpIntPair& localIndices) const +TVector2 AliMpMotif::GetPadDimensionsByIndices(MpPair_t localIndices) const { /// Give the dimension of the specified pad in the motif - if (GetMotifType()->HasPadByLocalIndices(localIndices)) + if ( GetMotifType()->HasPadByLocalIndices(localIndices) ) return fPadDimensions; else { - Warning("GetPadDimensions","indices outside range"); + Warning("GetPadDimensionsByIndices","indices outside range"); return TVector2(0.,0.); } } +//_____________________________________________________________________________ +TVector2 AliMpMotif::GetPadDimensionsByIndices(Int_t ixLocal, Int_t iyLocal) const +{ + /// Give the dimension of the specified pad in the motif + + return GetPadDimensionsByIndices(AliMp::Pair(ixLocal, iyLocal)); +} + //_____________________________________________________________________________ TVector2 AliMpMotif::Dimensions() const { @@ -85,18 +93,28 @@ TVector2 AliMpMotif::Dimensions() const } //_____________________________________________________________________________ -TVector2 AliMpMotif::PadPositionLocal(const AliMpIntPair& localIndices) const +TVector2 AliMpMotif::PadPositionLocal(MpPair_t localIndices) const +{ + /// Give the local position of the pad number (ix,iy) + /// (0,0 is the center of the motif) + + return PadPositionLocal(AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices)); +} + +//_____________________________________________________________________________ +TVector2 AliMpMotif::PadPositionLocal(Int_t ixLocal, Int_t iyLocal) const { /// Give the local position of the pad number (ix,iy) /// (0,0 is the center of the motif) TVector2 dim=Dimensions(); - return TVector2((2.*localIndices.GetFirst()+1.)*fPadDimensions.X()-dim.X(), - (2.*localIndices.GetSecond()+1.)*fPadDimensions.Y()-dim.Y()); + return TVector2((2.*ixLocal+1.)*fPadDimensions.X()-dim.X(), + (2.*iyLocal+1.)*fPadDimensions.Y()-dim.Y()); } //_____________________________________________________________________________ -AliMpIntPair AliMpMotif::PadIndicesLocal(const TVector2& localPos) const +MpPair_t AliMpMotif::PadIndicesLocal(const TVector2& localPos) const { /// Return the pad indices from a given local position /// or (-1,-1) if this position doesn't correspond to any valid @@ -109,15 +127,16 @@ AliMpIntPair AliMpMotif::PadIndicesLocal(const TVector2& localPos) const if ( lowerLeft.X() < - AliMpConstants::LengthTolerance() || lowerLeft.Y() < - AliMpConstants::LengthTolerance() ) { - return AliMpIntPair::Invalid(); + return -1; } Int_t ix = (Int_t)(lowerLeft.X()/(2.*fPadDimensions.X())); Int_t iy = (Int_t)(lowerLeft.Y()/(2.*fPadDimensions.Y())); - if (!GetMotifType()->FindConnectionByLocalIndices(AliMpIntPair(ix,iy))) + if ( ! GetMotifType()->FindConnectionByLocalIndices(ix,iy) ) { - return AliMpIntPair::Invalid(); + return -1; } - return AliMpIntPair(ix,iy); + + return AliMp::Pair(ix,iy); } diff --git a/MUON/mapping/AliMpMotif.h b/MUON/mapping/AliMpMotif.h index 7b6d1a4abdf..3277c1a4916 100755 --- a/MUON/mapping/AliMpMotif.h +++ b/MUON/mapping/AliMpMotif.h @@ -14,6 +14,7 @@ #define ALI_MP_MOTIF_H #include "AliMpVMotif.h" +#include "AliMpEncodePair.h" #include #include @@ -30,14 +31,16 @@ class AliMpMotif : public AliMpVMotif // Access methods virtual Int_t GetNofPadDimensions() const; virtual TVector2 GetPadDimensions(Int_t /*i*/ = 0) const; - virtual TVector2 GetPadDimensions(const AliMpIntPair& localIndices) const; + virtual TVector2 GetPadDimensionsByIndices(MpPair_t localIndices) const; + virtual TVector2 GetPadDimensionsByIndices(Int_t ixLocal, Int_t iyLocal) const; // Geometry virtual TVector2 Dimensions() const; // Other methods - virtual TVector2 PadPositionLocal(const AliMpIntPair& localIndices) const; - virtual AliMpIntPair PadIndicesLocal(const TVector2& localPos) const; + virtual TVector2 PadPositionLocal(MpPair_t localIndices) const; + virtual TVector2 PadPositionLocal(Int_t ixLocal, Int_t iyLocal) const; + virtual MpPair_t PadIndicesLocal(const TVector2& localPos) const; private: // methods diff --git a/MUON/mapping/AliMpMotifMap.cxx b/MUON/mapping/AliMpMotifMap.cxx index 12903973564..35fb10002e9 100755 --- a/MUON/mapping/AliMpMotifMap.cxx +++ b/MUON/mapping/AliMpMotifMap.cxx @@ -35,6 +35,7 @@ #include "AliMpMotifSpecial.h" #include "AliMpMotifType.h" #include "AliMpMotifPosition.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -123,10 +124,10 @@ void AliMpMotifMap::PrintMotifPosition2( { /// Print the motif position. - cout << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " " - << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() << " " - << setw(3) << motifPosition->GetHighIndicesLimit().GetFirst() << " " - << setw(3) << motifPosition->GetHighIndicesLimit().GetSecond() << " " + cout << setw(3) << motifPosition->GetLowLimitIx() << " " + << setw(3) << motifPosition->GetLowLimitIy() << " " + << setw(3) << motifPosition->GetHighLimitIx() << " " + << setw(3) << motifPosition->GetHighLimitIy() << " " << motifPosition->GetID() << " "; } @@ -386,7 +387,9 @@ void AliMpMotifMap::FillMotifPositionMap2() AliMpMotifPosition* motifPosition(0x0); while ( ( motifPosition = static_cast(next()) ) ) { - fMotifPositions2.Add(motifPosition->GetLowIndicesLimit(), motifPosition); + fMotifPositions2.Add(motifPosition->GetLowLimitIx(), + motifPosition->GetLowLimitIy(), + motifPosition); } } @@ -418,8 +421,8 @@ void AliMpMotifMap::PrintGlobalIndices(const char* fileName) const while ( ( motifPosition = static_cast(next()) ) ) { out << setw(5) << motifPosition->GetID() << " " - << setw(3) << motifPosition->GetLowIndicesLimit().GetFirst() << " " - << setw(3) << motifPosition->GetLowIndicesLimit().GetSecond() + << setw(3) << motifPosition->GetLowLimitIx() << " " + << setw(3) << motifPosition->GetLowLimitIy() << endl; } out << endl; @@ -450,7 +453,7 @@ void AliMpMotifMap::UpdateGlobalIndices(const char* fileName) << "Processing " << motifPosition->GetID() << " " << offx << " " << offy << endl; - motifPosition->SetLowIndicesLimit(AliMpIntPair(offx, offy)); + motifPosition->SetLowIndicesLimit(offx, offy); Int_t offx2 = offx + motifPosition->GetMotif()->GetMotifType()->GetNofPadsX() - 1; @@ -458,7 +461,7 @@ void AliMpMotifMap::UpdateGlobalIndices(const char* fileName) Int_t offy2 = offy + motifPosition->GetMotif()->GetMotifType()->GetNofPadsY() - 1; - motifPosition->SetHighIndicesLimit(AliMpIntPair(offx2, offy2)); + motifPosition->SetHighIndicesLimit(offx2, offy2); } else { AliWarningStream() diff --git a/MUON/mapping/AliMpMotifPainter.cxx b/MUON/mapping/AliMpMotifPainter.cxx index 8a39222cfbd..bbc5f39f361 100755 --- a/MUON/mapping/AliMpMotifPainter.cxx +++ b/MUON/mapping/AliMpMotifPainter.cxx @@ -25,19 +25,19 @@ // Authors: David Guez, IPN Orsay //----------------------------------------------------------------------------- -#include #include "AliMpMotifPainter.h" #include "AliMpGraphContext.h" #include "AliMpMotifPosition.h" #include "AliMpMotifType.h" #include "AliMpMotif.h" #include "AliMpConnection.h" -#include "AliMpIntPair.h" #include "AliLog.h" #include #include +#include + /// \cond CLASSIMP ClassImp(AliMpMotifPainter) /// \endcond @@ -140,12 +140,12 @@ void AliMpMotifPainter::Paint(Option_t *option) case 'I':{ switch (option[1]){ case '+' : - str = Form("(%d,%d)",fMotifPos->GetHighIndicesLimit().GetFirst(), - fMotifPos->GetHighIndicesLimit().GetSecond()); + str = Form("(%d,%d)",fMotifPos->GetHighLimitIx(), + fMotifPos->GetHighLimitIy()); break; default: - str = Form("(%d,%d)",fMotifPos->GetLowIndicesLimit().GetFirst(), - fMotifPos->GetLowIndicesLimit().GetSecond()); + str = Form("(%d,%d)",fMotifPos->GetLowLimitIx(), + fMotifPos->GetLowLimitIy()); } } break; @@ -166,15 +166,14 @@ void AliMpMotifPainter::Paint(Option_t *option) AliMpMotifType *motifType = fMotifPos->GetMotif()->GetMotifType(); for (Int_t j=motifType->GetNofPadsY()-1;j>=0;j--){ for (Int_t i=0;iGetNofPadsX();i++){ - AliMpIntPair indices(i,j); AliMpConnection* connect = - motifType->FindConnectionByLocalIndices(indices); + motifType->FindConnectionByLocalIndices(i,j); if (connect){ TVector2 realPadPos = - GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(indices); + GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(i,j); TVector2 padPadPos,padPadDim; gr->RealToPad(realPadPos, - fMotifPos->GetMotif()->GetPadDimensions(indices), + fMotifPos->GetMotif()->GetPadDimensionsByIndices(i,j), padPadPos,padPadDim); TVector2 bl = padPadPos - padPadDim; TVector2 ur = padPadPos + padPadDim; @@ -262,13 +261,13 @@ void AliMpMotifPainter::PaintContour(Option_t* option, Bool_t fill) for (Int_t j = 0; j < motifType->GetNofPadsY(); j++){ - AliMpIntPair indices = AliMpIntPair(i,j); - AliMpConnection* connect = motifType->FindConnectionByLocalIndices(indices); + AliMpConnection* connect = motifType->FindConnectionByLocalIndices(i,j); if (connect){ TVector2 realPadPos = - GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(indices); - gr->RealToPad(realPadPos, fMotifPos->GetMotif()->GetPadDimensions(indices), + GetPosition()+fMotifPos->GetMotif()->PadPositionLocal(i,j); + gr->RealToPad(realPadPos, + fMotifPos->GetMotif()->GetPadDimensionsByIndices(i,j), padPadPos, padPadDim); TVector2 bl = padPadPos - padPadDim; @@ -292,21 +291,21 @@ void AliMpMotifPainter::PaintContour(Option_t* option, Bool_t fill) gVirtualX->SetFillColor(csty); } - if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i,j-1))) + if (!motifType->FindConnectionByLocalIndices(i,j-1)) { gPad->PaintLine(bl.X()-xlw, bl.Y(), bl.X()+ padPadDim.X()*2 + xlw, bl.Y()); } - if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i,j+1))) + if (!motifType->FindConnectionByLocalIndices(i,j+1)) { gPad->PaintLine(bl.X()-xlw, bl.Y() + padPadDim.Y()*2, bl.X()+ padPadDim.X()*2+xlw, bl.Y() + padPadDim.Y()*2); } - if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i-1,j))) + if (!motifType->FindConnectionByLocalIndices(i-1,j)) { gPad->PaintLine(bl.X(), bl.Y(), bl.X(), bl.Y()+ padPadDim.Y()*2); } - if (!motifType->FindConnectionByLocalIndices(AliMpIntPair(i+1,j))) + if (!motifType->FindConnectionByLocalIndices(i+1,j)) { gPad->PaintLine(bl.X()+padPadDim.X()*2, bl.Y(), bl.X()+padPadDim.X()*2, bl.Y()+ padPadDim.Y()*2); } diff --git a/MUON/mapping/AliMpMotifPosition.cxx b/MUON/mapping/AliMpMotifPosition.cxx index 38ff2f06df5..9d37e702e71 100755 --- a/MUON/mapping/AliMpMotifPosition.cxx +++ b/MUON/mapping/AliMpMotifPosition.cxx @@ -69,16 +69,17 @@ AliMpVPadIterator* AliMpMotifPosition::CreateIterator() const } //______________________________________________________________________________ -Bool_t AliMpMotifPosition::HasPadByIndices(const AliMpIntPair& indices) const +Bool_t AliMpMotifPosition::HasPadByIndices(MpPair_t indices) const { /// Return true if pad with the specified indices exists in /// this motif position. - if (!HasIndices(indices)) return kFALSE; + if ( ! HasIndices(indices) ) return kFALSE; if (fMotif->GetMotifType()->IsFull()) return kTRUE; - return fMotif->GetMotifType()->HasPadByLocalIndices(indices-GetLowIndicesLimit()); + return fMotif->GetMotifType()->HasPadByLocalIndices( + indices - GetLowIndicesLimit()); } //______________________________________________________________________________ @@ -118,10 +119,10 @@ AliMpMotifPosition::Print(Option_t* option) const << GetMotif()->GetID() << " at (" << Position().X() << "," << Position().Y() << ") " - << " iMin=(" << GetLowIndicesLimit().GetFirst() - << "," << GetLowIndicesLimit().GetSecond() - << ") iMax=(" << GetHighIndicesLimit().GetFirst() - << "," << GetHighIndicesLimit().GetSecond() + << " iMin=(" << GetLowLimitIx() + << "," << GetLowLimitIy() + << ") iMax=(" << GetHighLimitIx() + << "," << GetHighLimitIy() << ")" << std::endl; if ( option && option[0] == 'M' ) diff --git a/MUON/mapping/AliMpMotifPosition.h b/MUON/mapping/AliMpMotifPosition.h index de26abd943f..5931ce93a21 100755 --- a/MUON/mapping/AliMpMotifPosition.h +++ b/MUON/mapping/AliMpMotifPosition.h @@ -33,7 +33,7 @@ class AliMpMotifPosition : public AliMpVIndexed // get methods Int_t GetID() const; AliMpVMotif* GetMotif() const; - Bool_t HasPadByIndices(const AliMpIntPair& indices) const; + Bool_t HasPadByIndices(MpPair_t indices) const; Bool_t HasPadByManuChannel(Int_t manuChannel) const; // Geometry diff --git a/MUON/mapping/AliMpMotifPositionPadIterator.cxx b/MUON/mapping/AliMpMotifPositionPadIterator.cxx index 1a9778a3610..0b653f32d67 100755 --- a/MUON/mapping/AliMpMotifPositionPadIterator.cxx +++ b/MUON/mapping/AliMpMotifPositionPadIterator.cxx @@ -29,6 +29,7 @@ #include "AliMpMotifPosition.h" #include "AliMpMotifType.h" #include "AliMpConnection.h" +#include "AliMpEncodePair.h" /// \cond CLASSIMP ClassImp(AliMpMotifPositionPadIterator) @@ -148,14 +149,16 @@ AliMpPad AliMpMotifPositionPadIterator::CurrentItem() const if (!fkMotifPos) return AliMpPad::Invalid(); else { - AliMpIntPair ind = fIterator.CurrentItem().GetIndices(); + MpPair_t ind = fIterator.CurrentItem().GetIndices(); AliMpMotifType* mt = fkMotifPos->GetMotif()->GetMotifType(); AliMpConnection* connect = mt->FindConnectionByLocalIndices(ind); - return AliMpPad(AliMpIntPair(fkMotifPos->GetID(),connect->GetManuChannel()), + return AliMpPad( + fkMotifPos->GetID(),connect->GetManuChannel(), fkMotifPos->GlobalIndices(ind), - fkMotifPos->Position()+fkMotifPos->GetMotif()->PadPositionLocal(ind), - fkMotifPos->GetMotif()->GetPadDimensions(ind)); + fkMotifPos->Position()+ + fkMotifPos->GetMotif()->PadPositionLocal(ind), + fkMotifPos->GetMotif()->GetPadDimensionsByIndices(ind)); } } diff --git a/MUON/mapping/AliMpMotifReader.cxx b/MUON/mapping/AliMpMotifReader.cxx index 11bf503cc0b..39bfc2216c9 100644 --- a/MUON/mapping/AliMpMotifReader.cxx +++ b/MUON/mapping/AliMpMotifReader.cxx @@ -33,7 +33,7 @@ #include "AliMpMotifSpecial.h" #include "AliMpMotifType.h" #include "AliMpConnection.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -120,7 +120,10 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) int i,j; strline>>i>>j; positions.Add( AliMpExMap::GetIndex(key), - AliMpExMap::GetIndex(AliMpIntPair(i,j)) ); + AliMp::Pair(i,j) + 1 ); + // we have to add 1 to the AliMp::Pair in order to + // its value always != 0, as the TExMap returns 0 value + // if given key does not exists } while (!padPosStream.eof()); const Int_t knbergpins = @@ -204,11 +207,8 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) continue; } - ix = AliMpExMap::GetPair(value).GetFirst(); - iy = AliMpExMap::GetPair(value).GetSecond(); - AliMpConnection* connection - = new AliMpConnection(padNum,numBerg,numKapton,gassiNum, AliMpIntPair(ix,iy)); + = new AliMpConnection(padNum,numBerg,numKapton,gassiNum, --value); Bool_t ok = motifType->AddConnection(connection); @@ -217,6 +217,9 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) AliFatal("Could not add connection"); } + ix = AliMp::PairFirst(value); + iy = AliMp::PairSecond(value); + if (ix>=nofPadsX) nofPadsX=ix+1; if (iy>=nofPadsY) nofPadsY=iy+1; @@ -256,7 +259,7 @@ AliMpMotifReader::BuildMotifSpecial(const TString& motifID, in >> i; while (!in.eof()){ in >>j >>x >> y; - res->SetPadDimensions(AliMpIntPair(i,j),TVector2(x*scale/2.,y*scale/2.)); + res->SetPadDimensions(i,j,TVector2(x*scale/2.,y*scale/2.)); in >> i; } res->CalculateDimensions(); diff --git a/MUON/mapping/AliMpMotifReader.h b/MUON/mapping/AliMpMotifReader.h index 62e76892dc4..cec944df560 100644 --- a/MUON/mapping/AliMpMotifReader.h +++ b/MUON/mapping/AliMpMotifReader.h @@ -18,7 +18,6 @@ #include "AliMpStationType.h" #include "AliMpStation12Type.h" #include "AliMpPlaneType.h" -#include "AliMpIntPair.h" #include #include diff --git a/MUON/mapping/AliMpMotifSpecial.cxx b/MUON/mapping/AliMpMotifSpecial.cxx index 3f79ed7f9ff..d190c826a3b 100755 --- a/MUON/mapping/AliMpMotifSpecial.cxx +++ b/MUON/mapping/AliMpMotifSpecial.cxx @@ -28,7 +28,7 @@ #include "AliMpMotifSpecial.h" #include "AliMpMotifType.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpConstants.h" #include "AliLog.h" @@ -72,38 +72,35 @@ AliMpMotifSpecial::~AliMpMotifSpecial() // -// private methods +// public methods // //______________________________________________________________________________ -Int_t AliMpMotifSpecial::VectorIndex(const AliMpIntPair& indices) const +TVector2 +AliMpMotifSpecial::GetPadDimensionsByIndices(MpPair_t localIndices) const { -/// Transform indices to linear vector index +/// Return the dimensions of pad located at the given indices - return indices.GetFirst()*GetMotifType()->GetNofPadsY() + indices.GetSecond(); + return GetPadDimensionsByIndices(AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices)); } - -// -// public methods -// - //______________________________________________________________________________ TVector2 -AliMpMotifSpecial::GetPadDimensions(const AliMpIntPair& localIndices) const +AliMpMotifSpecial::GetPadDimensionsByIndices(Int_t ixLocal, Int_t iyLocal) const { /// Return the dimensions of pad located at the given indices - if (GetMotifType()->HasPadByLocalIndices(localIndices)) { - if (!fPadDimensionsVector.GetValue(localIndices)) { - Warning("GetPadDimensions","Indices outside limits"); + if ( GetMotifType()->HasPadByLocalIndices(ixLocal, iyLocal) ) { + if (!fPadDimensionsVector.GetValue(ixLocal, iyLocal)) { + Warning("GetPadDimensionsByIndices","Indices outside limits"); return TVector2(0.,0.); } else - return *((TVector2*)fPadDimensionsVector.GetValue(localIndices)); + return *((TVector2*)fPadDimensionsVector.GetValue(ixLocal, iyLocal)); } else { - Warning("GetPadDimensions","Indices outside limits"); + Warning("GetPadDimensionsByIndices","Indices outside limits"); return TVector2(0.,0.); } } @@ -144,7 +141,7 @@ void AliMpMotifSpecial::CalculateDimensions() for (i=0;iGetNofPadsX();++i) { Double_t trSizeY=0.; for (j=0;jGetNofPadsY();++j) { - TVector2 dim = GetPadDimensions(AliMpIntPair(i,j)); + TVector2 dim = GetPadDimensionsByIndices(i,j); trSizeY+=dim.Y(); tabSizeX[j]+=dim.X(); } @@ -169,31 +166,43 @@ TVector2 AliMpMotifSpecial::Dimensions() const //______________________________________________________________________________ TVector2 -AliMpMotifSpecial::PadPositionLocal(const AliMpIntPair& localIndices) const +AliMpMotifSpecial::PadPositionLocal(MpPair_t localIndices) const +{ + /// Give the local position of the pad number (ix,iy) + /// (0,0 is the center of the motif) + + return PadPositionLocal(AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices)); + +} + +//______________________________________________________________________________ +TVector2 +AliMpMotifSpecial::PadPositionLocal(Int_t ixLocal, Int_t iyLocal) const { /// Give the local position of the pad number (ix,iy) /// (0,0 is the center of the motif) - TVector2 dim = GetPadDimensions(localIndices); + TVector2 dim = GetPadDimensionsByIndices(ixLocal, iyLocal); Double_t posX= dim.X(); - for (Int_t i=0;iGetNofPadsY()) { - TVector2 padDim = GetPadDimensions(AliMpIntPair(0,j)); + TVector2 padDim = GetPadDimensionsByIndices(0,j); y-=2.*padDim.Y(); if (y<0.) break; j++; @@ -216,7 +225,7 @@ AliMpIntPair AliMpMotifSpecial::PadIndicesLocal(const TVector2& localPos) const // Test if it's outside limits if (j==GetMotifType()->GetNofPadsY()){ Warning("PadIndicesLocal","The position is outside the motif"); - return AliMpIntPair::Invalid(); + return -1; } @@ -225,7 +234,7 @@ AliMpIntPair AliMpMotifSpecial::PadIndicesLocal(const TVector2& localPos) const Double_t x=pos.X(); while (iGetNofPadsX()) { - TVector2 padDim = GetPadDimensions(AliMpIntPair(i,j)); + TVector2 padDim = GetPadDimensionsByIndices(i,j); x-=2.*padDim.X(); if (x<0.) break; i++; @@ -236,27 +245,40 @@ AliMpIntPair AliMpMotifSpecial::PadIndicesLocal(const TVector2& localPos) const if (i==GetMotifType()->GetNofPadsX()){ Warning("PadIndicesLocal","The position is outside the motif"); - return AliMpIntPair::Invalid(); + return -1; } // then return the found (i,j) - return AliMpIntPair(i,j); + return AliMp::Pair(i,j); } + +//______________________________________________________________________________ +void AliMpMotifSpecial::SetPadDimensions(MpPair_t localIndices, + const TVector2& dimensions) +{ + /// Set the dimensions of the pad located at \a localIndices to the given + /// \a dimensions + + SetPadDimensions(AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices), + dimensions); +} + //______________________________________________________________________________ -void AliMpMotifSpecial::SetPadDimensions(const AliMpIntPair& localIndices, +void AliMpMotifSpecial::SetPadDimensions(Int_t ixLocal, Int_t iyLocal, const TVector2& dimensions) { /// Set the dimensions of the pad located at \a localIndices to the given /// \a dimensions - if ( !GetMotifType()->HasPadByLocalIndices(localIndices)){ + if ( ! GetMotifType()->HasPadByLocalIndices(ixLocal, iyLocal) ) { Warning("SetPadDimensions","Pad indices outside limits"); return; } // fill the dimensions map vector TVector2* dimensionsObj = new TVector2(dimensions); - fPadDimensionsVector.Add(localIndices, dimensionsObj); + fPadDimensionsVector.Add(ixLocal, iyLocal, dimensionsObj); // fill the vector of different pad dimensions // only if these dimensions are not yet present diff --git a/MUON/mapping/AliMpMotifSpecial.h b/MUON/mapping/AliMpMotifSpecial.h index b5605d64e24..d70d8c961fd 100755 --- a/MUON/mapping/AliMpMotifSpecial.h +++ b/MUON/mapping/AliMpMotifSpecial.h @@ -29,12 +29,15 @@ class AliMpMotifSpecial : public AliMpVMotif virtual ~AliMpMotifSpecial(); // Access methods - virtual TVector2 GetPadDimensions(const AliMpIntPair& localIndices) const; + virtual TVector2 GetPadDimensionsByIndices(MpPair_t localIndices) const; + virtual TVector2 GetPadDimensionsByIndices(Int_t ixLocal, Int_t iyLocal) const; virtual Int_t GetNofPadDimensions() const; virtual TVector2 GetPadDimensions(Int_t i) const; // Set methods - void SetPadDimensions(const AliMpIntPair& localIndices, + void SetPadDimensions(MpPair_t localIndices, + const TVector2& dimensions); + void SetPadDimensions(Int_t ixLocal, Int_t iyLocal, const TVector2& dimensions); // Geometry @@ -42,14 +45,13 @@ class AliMpMotifSpecial : public AliMpVMotif virtual TVector2 Dimensions() const; // Other methods - virtual TVector2 PadPositionLocal(const AliMpIntPair& localIndices) const; - virtual AliMpIntPair PadIndicesLocal(const TVector2& localPos) const; + virtual TVector2 PadPositionLocal(MpPair_t localIndices) const; + virtual TVector2 PadPositionLocal(Int_t ixLocal, Int_t iyLocal) const; + virtual MpPair_t PadIndicesLocal(const TVector2& localPos) const; private: /// Not implemented AliMpMotifSpecial(); - // methods - Int_t VectorIndex(const AliMpIntPair& indices) const; // data members TVector2 fDimensions; ///< motif dimensions diff --git a/MUON/mapping/AliMpMotifType.cxx b/MUON/mapping/AliMpMotifType.cxx index 8e41ab3ae11..5b169501140 100755 --- a/MUON/mapping/AliMpMotifType.cxx +++ b/MUON/mapping/AliMpMotifType.cxx @@ -25,18 +25,21 @@ // Authors: David Guez, Ivana Hrivnacova; IPN Orsay //----------------------------------------------------------------------------- -#include #include "AliMpMotifType.h" #include "AliMpExMapIterator.h" #include "AliMpMotifTypePadIterator.h" #include "AliMpConnection.h" #include "AliMpConstants.h" -#include "AliLog.h" #include "AliMpFiles.h" -#include "TSystem.h" +#include "AliMpEncodePair.h" +#include "AliLog.h" + +#include #include +#include + /// \cond CLASSIMP ClassImp(AliMpMotifType) /// \endcond @@ -186,8 +189,8 @@ AliMpMotifType::AddConnection(AliMpConnection* connection) if (!connection) return kFALSE; - Int_t ix = connection->LocalIndices().GetFirst(); - Int_t iy = connection->LocalIndices().GetSecond(); + Int_t ix = connection->GetLocalIx(); + Int_t iy = connection->GetLocalIy(); Int_t manuChannel = connection->GetManuChannel(); @@ -198,7 +201,8 @@ AliMpMotifType::AddConnection(AliMpConnection* connection) Int_t index = ix + iy*AliMpConstants::ManuNofChannels(); - AliMpConnection* c = FindConnectionByLocalIndices(connection->LocalIndices()); + AliMpConnection* c = FindConnectionByLocalIndices( + connection->GetLocalIndices()); if (c) { @@ -238,13 +242,20 @@ AliMpMotifType::FindConnectionByPadNum(Int_t padNum) const //______________________________________________________________________________ AliMpConnection* -AliMpMotifType::FindConnectionByLocalIndices(const AliMpIntPair& localIndices) const +AliMpMotifType::FindConnectionByLocalIndices(MpPair_t localIndices) const +{ + /// Retrieve the AliMpConnection pointer from its position (in pad unit) + + return FindConnectionByLocalIndices(AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices)); +} + +//______________________________________________________________________________ +AliMpConnection* +AliMpMotifType::FindConnectionByLocalIndices(Int_t ix, Int_t iy) const { /// Retrieve the AliMpConnection pointer from its position (in pad unit) - Int_t ix = localIndices.GetFirst(); - Int_t iy = localIndices.GetSecond(); - if ( ix < fNofPadsX && iy < fNofPadsY && ix >= 0 && iy >= 0 ) { Int_t index = ix + iy*fMaxNofPads; @@ -307,82 +318,79 @@ AliMpMotifType::FindConnectionByBergNum(Int_t bergNum) const //______________________________________________________________________________ -AliMpIntPair AliMpMotifType::FindLocalIndicesByConnection(const AliMpConnection* connection) const +MpPair_t AliMpMotifType::FindLocalIndicesByConnection(const AliMpConnection* connection) const { /// Reurn the pad position from the connection pointer. - return connection->LocalIndices(); + return connection->GetLocalIndices(); } //______________________________________________________________________________ -AliMpIntPair AliMpMotifType::FindLocalIndicesByPadNum(Int_t padNum) const +MpPair_t AliMpMotifType::FindLocalIndicesByPadNum(Int_t padNum) const { /// Retrieve the AliMpConnection pointer from its pad num AliMpConnection* connection = FindConnectionByPadNum(padNum); - if (connection) - { - return connection->LocalIndices(); - } - else - return AliMpIntPair::Invalid(); + if ( ! connection) return -1; + + return connection->GetLocalIndices(); } //______________________________________________________________________________ -AliMpIntPair AliMpMotifType::FindLocalIndicesByGassiNum(Int_t gassiNum) const +MpPair_t AliMpMotifType::FindLocalIndicesByGassiNum(Int_t gassiNum) const { /// Return the connection for the given gassiplex number AliMpConnection* connection = FindConnectionByGassiNum(gassiNum); - if (connection) - { - return connection->LocalIndices(); - } - else - return AliMpIntPair::Invalid(); + if ( ! connection) return -1; + + return connection->GetLocalIndices(); } //______________________________________________________________________________ -AliMpIntPair AliMpMotifType::FindLocalIndicesByKaptonNum(Int_t kaptonNum) const +MpPair_t AliMpMotifType::FindLocalIndicesByKaptonNum(Int_t kaptonNum) const { /// Give the connection related to the given kapton number AliMpConnection* connection = FindConnectionByKaptonNum(kaptonNum); - if (connection) - { - return connection->LocalIndices(); - } - else - return AliMpIntPair::Invalid(); + if ( ! connection) return -1; + + return connection->GetLocalIndices(); } //______________________________________________________________________________ -AliMpIntPair AliMpMotifType::FindLocalIndicesByBergNum(Int_t bergNum) const +MpPair_t AliMpMotifType::FindLocalIndicesByBergNum(Int_t bergNum) const { /// Retrieve the connection from a Berg connector number AliMpConnection* connection = FindConnectionByBergNum(bergNum); - if (connection) - { - return connection->LocalIndices(); - } - else - return AliMpIntPair::Invalid(); + if ( ! connection) return -1; + + return connection->GetLocalIndices(); } //______________________________________________________________________________ Bool_t -AliMpMotifType::HasPadByLocalIndices(const AliMpIntPair& localIndices) const +AliMpMotifType::HasPadByLocalIndices(MpPair_t localIndices) const { /// Return true if the pad indexed by \a localIndices has a connection return ( FindConnectionByLocalIndices(localIndices) != 0x0 ); } +//______________________________________________________________________________ +Bool_t +AliMpMotifType::HasPadByLocalIndices(Int_t localIx, Int_t localIy) const +{ + /// Return true if the pad indexed by \a localIndices has a connection + + return ( FindConnectionByLocalIndices(localIx, localIy) != 0x0 ); +} + //______________________________________________________________________________ Bool_t AliMpMotifType::HasPadByManuChannel(Int_t manuChannel) const @@ -424,7 +432,7 @@ void AliMpMotifType::Print(Option_t *option) const for (Int_t j=fNofPadsY-1;j>=0;j--){ for (Int_t i=0;iGetBergNum() << "\t1\t" << con->GetPadNum() << "\t-" << endl; diff --git a/MUON/mapping/AliMpMotifType.h b/MUON/mapping/AliMpMotifType.h index 61d13ff65b0..8be6b252f33 100755 --- a/MUON/mapping/AliMpMotifType.h +++ b/MUON/mapping/AliMpMotifType.h @@ -15,7 +15,7 @@ #include -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #ifndef ROOT_TObjArray # include @@ -42,16 +42,18 @@ class AliMpMotifType : public TObject // find methods AliMpConnection *FindConnectionByPadNum(Int_t padNum) const; AliMpConnection *FindConnectionByLocalIndices( - const AliMpIntPair& localIndices) const; + MpPair_t localIndices) const; + AliMpConnection *FindConnectionByLocalIndices( + Int_t localIx, Int_t localIy) const; AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const; AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const; AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const; - AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const; - AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const; - AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const; - AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const; - AliMpIntPair FindLocalIndicesByConnection( + MpPair_t FindLocalIndicesByPadNum(Int_t padNum) const; + MpPair_t FindLocalIndicesByGassiNum(Int_t gassiNum) const; + MpPair_t FindLocalIndicesByKaptonNum(Int_t kaptonNum) const; + MpPair_t FindLocalIndicesByBergNum(Int_t bergNum) const; + MpPair_t FindLocalIndicesByConnection( const AliMpConnection* connection) const; // set methods @@ -76,7 +78,8 @@ class AliMpMotifType : public TObject TString PadName(Int_t padNum) const; - Bool_t HasPadByLocalIndices(const AliMpIntPair& localIndices) const; + Bool_t HasPadByLocalIndices(MpPair_t localIndices) const; + Bool_t HasPadByLocalIndices(Int_t localIx, Int_t localIy) const; Bool_t HasPadByManuChannel(Int_t manuChannel) const; diff --git a/MUON/mapping/AliMpMotifTypePadIterator.cxx b/MUON/mapping/AliMpMotifTypePadIterator.cxx index 9b4e68d1b77..f60a6a675b7 100755 --- a/MUON/mapping/AliMpMotifTypePadIterator.cxx +++ b/MUON/mapping/AliMpMotifTypePadIterator.cxx @@ -27,6 +27,7 @@ #include "AliMpMotifTypePadIterator.h" #include "AliMpMotifType.h" +#include "AliMpEncodePair.h" /// \cond CLASSIMP ClassImp(AliMpMotifTypePadIterator) @@ -36,7 +37,8 @@ ClassImp(AliMpMotifTypePadIterator) AliMpMotifTypePadIterator::AliMpMotifTypePadIterator(): AliMpVPadIterator(), fkMotifType(0), - fCurrentPosition(AliMpIntPair::Invalid()) + fCurrentIx(-1), + fCurrentIy(-1) { /// Default constructor, set the current position to "invalid" } @@ -46,7 +48,8 @@ AliMpMotifTypePadIterator::AliMpMotifTypePadIterator( const AliMpMotifType* motifType) : AliMpVPadIterator(), fkMotifType(motifType), - fCurrentPosition(AliMpIntPair::Invalid()) + fCurrentIx(-1), + fCurrentIy(-1) { /// Standard constructor, let *this to invalid position } @@ -56,7 +59,8 @@ AliMpMotifTypePadIterator::AliMpMotifTypePadIterator( const AliMpMotifTypePadIterator& right) : AliMpVPadIterator(right), fkMotifType(right.fkMotifType), - fCurrentPosition(right.fCurrentPosition) + fCurrentIx(right.fCurrentIx), + fCurrentIy(right.fCurrentIy) { /// Copy constructor @@ -85,7 +89,8 @@ AliMpMotifTypePadIterator::operator = (const AliMpMotifTypePadIterator& right) AliMpVPadIterator::operator=(right); fkMotifType = right.fkMotifType; - fCurrentPosition = right.fCurrentPosition; + fCurrentIx = right.fCurrentIx; + fCurrentIy = right.fCurrentIy; return *this; } @@ -95,20 +100,32 @@ AliMpMotifTypePadIterator::operator = (const AliMpMotifTypePadIterator& right) // //______________________________________________________________________________ -AliMpIntPair -AliMpMotifTypePadIterator::FindFirstPadInLine(AliMpIntPair indices) const +Bool_t +AliMpMotifTypePadIterator::FindFirstPadInLine(Int_t ix, Int_t iy, + Int_t& newIx, Int_t& newIy) const { /// Find the indices of the first pad in the same line /// as the \a indices, and in column, at least equal, to the /// one of \a indices - if (!fkMotifType) return AliMpIntPair::Invalid(); - - while (indices.GetFirst() < fkMotifType->GetNofPadsX()) { - if (fkMotifType->HasPadByLocalIndices(indices)) return indices; - indices += AliMpIntPair(1,0); + if ( ! fkMotifType ) { + newIx = -1; + newIy = -1; + return false; + } + + while ( ix < fkMotifType->GetNofPadsX() ) { + if ( fkMotifType->HasPadByLocalIndices(ix, iy) ) { + newIx = ix; + newIy = iy; + return true; + } + ix++; } - return AliMpIntPair::Invalid(); + + newIx = -1; + newIy = -1; + return false; } //______________________________________________________________________________ @@ -116,7 +133,7 @@ Bool_t AliMpMotifTypePadIterator::IsValid() const { /// Is the iterator in a valid position? - return fkMotifType!=0 && fCurrentPosition.IsValid(); + return fkMotifType!=0 && fCurrentIx >=0 && fCurrentIy >=0; } // @@ -129,12 +146,14 @@ void AliMpMotifTypePadIterator::First() /// Reset the iterator, so that it points to the first available /// pad in the motif type - if (!fkMotifType) { - Invalidate(); - return ; + if ( ! fkMotifType ) { + Invalidate(); + return ; } - fCurrentPosition = AliMpIntPair(0,0); - if (fkMotifType->HasPadByLocalIndices(fCurrentPosition)) return; + + fCurrentIx = 0; + fCurrentIy = 0; + if ( fkMotifType->HasPadByLocalIndices(fCurrentIx, fCurrentIy) ) return; // if (0,0) is not available @@ -150,18 +169,20 @@ void AliMpMotifTypePadIterator::Next() { /// Move the iterator to the next valid pad. - //if (!IsValid()) return *this; - if (!IsValid()) return; - - while (fCurrentPosition.GetSecond() < fkMotifType->GetNofPadsY()){ - AliMpIntPair nextTry - = FindFirstPadInLine(fCurrentPosition + AliMpIntPair(1,0)); - if (nextTry.IsValid()){ - fCurrentPosition = nextTry; - return; - } - fCurrentPosition.SetFirst(-1); - fCurrentPosition.SetSecond(fCurrentPosition.GetSecond()+1); + if ( ! IsValid() ) return; + + while ( fCurrentIy < fkMotifType->GetNofPadsY() ) { + Int_t nextTryIx, nextTryIy; + Bool_t result + = FindFirstPadInLine(fCurrentIx+1, fCurrentIy, nextTryIx, nextTryIy); + + if ( result ){ + fCurrentIx = nextTryIx; + fCurrentIy = nextTryIy; + return; + } + fCurrentIx = -1; + fCurrentIy++; } // if the loop is finished, there's not available pads at all... @@ -174,7 +195,7 @@ Bool_t AliMpMotifTypePadIterator::IsDone() const { /// Is the iterator in the end ? - return !IsValid(); + return ! IsValid(); } //______________________________________________________________________________ @@ -182,11 +203,12 @@ AliMpPad AliMpMotifTypePadIterator::CurrentItem() const { /// Return current pad. - if (!fkMotifType) - return AliMpPad::Invalid(); + if ( ! fkMotifType ) + return AliMpPad::Invalid(); else - return AliMpPad(AliMpIntPair::Invalid(), - fCurrentPosition,TVector2(),TVector2()); + return AliMpPad(0, 0, + fCurrentIx, fCurrentIy, + TVector2(),TVector2()); } //______________________________________________________________________________ @@ -194,7 +216,7 @@ void AliMpMotifTypePadIterator::Invalidate() { /// Let the iterator point to the invalid position - fCurrentPosition = AliMpIntPair::Invalid(); - + fCurrentIx = -1; + fCurrentIy = -1; } diff --git a/MUON/mapping/AliMpMotifTypePadIterator.h b/MUON/mapping/AliMpMotifTypePadIterator.h index f41c6fe0728..d672499e531 100755 --- a/MUON/mapping/AliMpMotifTypePadIterator.h +++ b/MUON/mapping/AliMpMotifTypePadIterator.h @@ -14,7 +14,6 @@ #define ALI_MP_MOTIF_TYPE_PAD_ITERATOR_H #include "AliMpVPadIterator.h" -#include "AliMpIntPair.h" class AliMpMotifType; @@ -38,12 +37,14 @@ class AliMpMotifTypePadIterator : public AliMpVPadIterator private: // private methods - AliMpIntPair FindFirstPadInLine(AliMpIntPair indices) const; - Bool_t IsValid() const; + Bool_t FindFirstPadInLine(Int_t ix, Int_t iy, + Int_t& newIx, Int_t& newIy) const; + Bool_t IsValid() const; // private data members const AliMpMotifType* fkMotifType;///< the motif type over which iterate - AliMpIntPair fCurrentPosition; ///< the current position inside the motif type + Int_t fCurrentIx; ///< the current ix position inside the motif type + Int_t fCurrentIy; ///< the current iy position inside the motif type ClassDef(AliMpMotifTypePadIterator,2) // iterator over motif's pads }; diff --git a/MUON/mapping/AliMpPCB.cxx b/MUON/mapping/AliMpPCB.cxx index d4905f426ac..c4a18bcd0b8 100644 --- a/MUON/mapping/AliMpPCB.cxx +++ b/MUON/mapping/AliMpPCB.cxx @@ -172,8 +172,8 @@ AliMpPCB::AliMpPCB(const char* id, AliMpMotifSpecial* ms) TVector2 position(ms->Dimensions()); AliMpMotifPosition* mp = new AliMpMotifPosition(-1,ms,position); - mp->SetLowIndicesLimit(AliMpIntPair(fIxmin,fIymin)); - mp->SetHighIndicesLimit(AliMpIntPair(fIxmax,fIymax)); + mp->SetLowIndicesLimit(fIxmin,fIymin); + mp->SetHighIndicesLimit(fIxmax,fIymax); fMotifPositions.AddLast(mp); } @@ -289,8 +289,8 @@ AliMpPCB::Add(AliMpMotifType* mt, Int_t ix, Int_t iy) Int_t ixmax = ixmin + mt->GetNofPadsX() - 1; Int_t iymax = iymin + mt->GetNofPadsY() - 1; - mp->SetLowIndicesLimit(AliMpIntPair(ixmin,iymin)); - mp->SetHighIndicesLimit(AliMpIntPair(ixmax,iymax)); + mp->SetLowIndicesLimit(ixmin,iymin); + mp->SetHighIndicesLimit(ixmax,iymax); fMotifPositions.AddLast(mp); @@ -353,7 +353,7 @@ AliMpPCB::Clone(const TArrayI& manuids, Int_t ixOffset, Double_t xOffset) const return 0; } - AliMpIntPair shift(-fIxmin+ixOffset,0); + MpPair_t shift = AliMp::Pair(-fIxmin+ixOffset,0); // Then change the internal MotifPositions wrt manu id // and position (offset in x). @@ -364,17 +364,17 @@ AliMpPCB::Clone(const TArrayI& manuids, Int_t ixOffset, Double_t xOffset) const TVector2 pos(mp->Position()); pos += TVector2(xOffset,0); mp->SetPosition(pos); - AliMpIntPair offset(ixOffset,0); - AliMpIntPair low(mp->GetLowIndicesLimit()); + MpPair_t offset = AliMp::Pair(ixOffset,0); + MpPair_t low = mp->GetLowIndicesLimit(); low += shift; mp->SetLowIndicesLimit(low); - AliMpIntPair high(mp->GetHighIndicesLimit()); + MpPair_t high = mp->GetHighIndicesLimit(); high += shift; mp->SetHighIndicesLimit(high); } - pcb->fIxmin += shift.GetFirst(); - pcb->fIxmax += shift.GetFirst(); + pcb->fIxmin += AliMp::PairFirst(shift); + pcb->fIxmax += AliMp::PairFirst(shift); pcb->fXoffset = xOffset; pcb->fActiveXmin += xOffset; @@ -494,7 +494,7 @@ AliMpPCB::FindMotifPosition(Int_t ix, Int_t iy) const for (Int_t i = 0; i < fMotifPositions.GetEntriesFast(); ++i ) { AliMpMotifPosition* mp = (AliMpMotifPosition*)fMotifPositions[i]; - if ( mp->HasPadByIndices(AliMpIntPair(ix,iy)) ) + if ( mp->HasPadByIndices(AliMp::Pair(ix,iy)) ) { return mp; } @@ -516,9 +516,10 @@ AliMpPCB::FindMotifPosition(Double_t x, Double_t y) const TVector2 localPos( TVector2(x,y) - mp->Position() ); - AliMpIntPair localIndices(mp->GetMotif()->PadIndicesLocal(localPos)); + MpPair_t localIndices(mp->GetMotif()->PadIndicesLocal(localPos)); - if ( localIndices.IsValid() && mp->GetMotif()->GetMotifType()->HasPadByLocalIndices(localIndices) ) + if ( localIndices >= 0 && + mp->GetMotif()->GetMotifType()->HasPadByLocalIndices(localIndices) ) { return mp; } diff --git a/MUON/mapping/AliMpPCBPadIterator.cxx b/MUON/mapping/AliMpPCBPadIterator.cxx index a417700ae0f..4160d376061 100644 --- a/MUON/mapping/AliMpPCBPadIterator.cxx +++ b/MUON/mapping/AliMpPCBPadIterator.cxx @@ -24,6 +24,7 @@ #include "AliMpPCB.h" #include "AliMpSlat.h" #include "AliMpSlatSegmentation.h" +#include "AliMpEncodePair.h" #include "Riostream.h" #include "TMath.h" @@ -43,13 +44,13 @@ ClassImp(AliMpPCBPadIterator) //_____________________________________________________________________________ AliMpPCBPadIterator::AliMpPCBPadIterator(const AliMpSlat* slat, - const AliMpArea& area) + const AliMpArea& area) : AliMpVPadIterator(), fkSlat(slat), fSlatSegmentation(new AliMpSlatSegmentation(slat)), -fMinIndices(), -fMaxIndices(), -fOffset(0,0), +fMinIndices(0), +fMaxIndices(0), +fOffset(0), fCurrentPad(), fIsDone(kTRUE) { @@ -131,15 +132,15 @@ AliMpPCBPadIterator::CropArea(const AliMpArea& area) Int_t iymax = first->Iymin() + TMath::CeilNint((ymax-first->Ymin())/first->PadSizeY()) - 1; - fMinIndices.Set(ixmin,iymin); - fMaxIndices.Set(ixmax,iymax); + fMinIndices = AliMp::Pair(ixmin,iymin); + fMaxIndices = AliMp::Pair(ixmax,iymax); AliDebug(3,Form("Paddified cropped area (%d,%d)->(%d,%d) %d,%d ; %d,%d", ixmin,iymin,ixmax,iymax, - fMinIndices.GetFirst(),fMinIndices.GetSecond(), - fMaxIndices.GetFirst(),fMaxIndices.GetSecond())); + AliMp::PairFirst(fMinIndices),AliMp::PairSecond(fMinIndices), + AliMp::PairFirst(fMaxIndices),AliMp::PairSecond(fMaxIndices))); - return fMinIndices.IsValid() && fMaxIndices.IsValid(); + return fMinIndices >= 0 && fMaxIndices >= 0; } //_____________________________________________________________________________ @@ -161,23 +162,21 @@ AliMpPCBPadIterator::First() /// AliDebug(3,Form("area = (%d,%d)->(%d,%d)", - fMinIndices.GetFirst(),fMinIndices.GetSecond(), - fMaxIndices.GetFirst(),fMaxIndices.GetSecond())); + AliMp::PairFirst(fMinIndices),AliMp::PairSecond(fMinIndices), + AliMp::PairFirst(fMaxIndices),AliMp::PairSecond(fMaxIndices))); fOffset = fMinIndices; fIsDone = kFALSE; - SetPad(fCurrentPad,fOffset); - if (!fCurrentPad.IsValid()) Next(); - if ( !fCurrentPad.IsValid() ) + SetPad(fCurrentPad,AliMp::PairFirst(fOffset),AliMp::PairSecond(fOffset)); + if ( ! fCurrentPad.IsValid() ) Next(); + if ( ! fCurrentPad.IsValid() ) { // did not find any valid pad in there, bailing out. fIsDone = kTRUE; AliError(Form("Could not initiate iterator for slat %s. " " Please check the area you gave : %d,%d to %d,%d", fkSlat->GetName(), - fMinIndices.GetFirst(), - fMinIndices.GetSecond(), - fMaxIndices.GetFirst(), - fMaxIndices.GetSecond())); + AliMp::PairFirst(fMinIndices),AliMp::PairSecond(fMinIndices), + AliMp::PairFirst(fMaxIndices),AliMp::PairSecond(fMaxIndices))); return; } } @@ -192,13 +191,13 @@ AliMpPCBPadIterator::GetNextPosition(Int_t& ix, Int_t& iy) ++ix; - if ( ix > fMaxIndices.GetFirst() ) + if ( ix > AliMp::PairFirst(fMaxIndices) ) { // Go back leftmost position... - ix = fMinIndices.GetFirst(); + ix = AliMp::PairFirst(fMinIndices); // ... and up ++iy; - if ( iy > fMaxIndices.GetSecond() ) + if ( iy > AliMp::PairSecond(fMaxIndices) ) { return false; } @@ -214,7 +213,7 @@ AliMpPCBPadIterator::Invalidate() /// /// Invalidate the iterator. /// - fOffset = AliMpIntPair::Invalid(); + fOffset = 0; fCurrentPad = AliMpPad::Invalid(); fIsDone = kTRUE; } @@ -245,10 +244,10 @@ AliMpPCBPadIterator::Next() AliMpPad pad(fCurrentPad); int n = 0; - Int_t ix(fOffset.GetFirst()); - Int_t iy(fOffset.GetSecond()); + Int_t ix(AliMp::PairFirst(fOffset)); + Int_t iy(AliMp::PairSecond(fOffset)); - while ( ( pad == fCurrentPad || !pad.IsValid() ) && n<100 ) + while ( ( pad == fCurrentPad || ! pad.IsValid() ) && n<100 ) { ++n; if (GetNextPosition(ix,iy)==kFALSE) @@ -256,7 +255,7 @@ AliMpPCBPadIterator::Next() Invalidate(); return; } - SetPad(pad,AliMpIntPair(ix,iy)); + SetPad(pad,ix,iy); } if ( n>=100 ) { @@ -273,23 +272,23 @@ AliMpPCBPadIterator::Print(Option_t*) const cout << Form("fkSlat=%p fSlatSegmentation=%p (%s)",fkSlat,fSlatSegmentation, fkSlat->GetName()) << endl << Form("minIndices=(%d,%d) maxIndices=(%d,%d)", - fMinIndices.GetFirst(),fMinIndices.GetSecond(), - fMaxIndices.GetFirst(),fMaxIndices.GetSecond()) << endl + AliMp::PairFirst(fMinIndices),AliMp::PairSecond(fMinIndices), + AliMp::PairFirst(fMaxIndices),AliMp::PairSecond(fMaxIndices)) << endl << Form("currentOffset=(%d,%d) isdone=%d currentpad=", - fOffset.GetFirst(),fOffset.GetSecond(),IsDone()) << endl; + AliMp::PairFirst(fOffset),AliMp::PairSecond(fOffset)) << endl; fCurrentPad.Print(); } //_____________________________________________________________________________ void -AliMpPCBPadIterator::SetPad(AliMpPad& pad, const AliMpIntPair& indices) +AliMpPCBPadIterator::SetPad(AliMpPad& pad, Int_t ix, Int_t iy) { /// /// Sets the current pad. /// - pad = fSlatSegmentation->PadByIndices(indices,kFALSE); + pad = fSlatSegmentation->PadByIndices(ix, iy,kFALSE); if (pad.IsValid()) { - fOffset = indices; + fOffset = AliMp::Pair(ix,iy); } } diff --git a/MUON/mapping/AliMpPCBPadIterator.h b/MUON/mapping/AliMpPCBPadIterator.h index a1dd1473b19..c99391e834c 100644 --- a/MUON/mapping/AliMpPCBPadIterator.h +++ b/MUON/mapping/AliMpPCBPadIterator.h @@ -41,18 +41,18 @@ private: Bool_t GetNextPosition(Int_t& ix, Int_t& iy); Bool_t CropArea(const AliMpArea& area); - void SetPad(AliMpPad& pad, const AliMpIntPair& indices); + void SetPad(AliMpPad& pad, Int_t ix, Int_t iy); private: const AliMpSlat* fkSlat; //!< the slat we're iterating over AliMpSlatSegmentation* fSlatSegmentation; //!< segmentation pointer - AliMpIntPair fMinIndices; //!< indices of bottom left of region to iterate over - AliMpIntPair fMaxIndices; //!< indices of top right of region to iterate over - AliMpIntPair fOffset; //!< current position + MpPair_t fMinIndices; //!< indices of bottom left of region to iterate over + MpPair_t fMaxIndices; //!< indices of top right of region to iterate over + MpPair_t fOffset; //!< current position AliMpPad fCurrentPad; //!< current pad Bool_t fIsDone; //!< whether we've finished or not - ClassDef(AliMpPCBPadIterator,2) // Pad iterator for a zone of constant density, for St345. + ClassDef(AliMpPCBPadIterator,0) // Pad iterator for a zone of constant density, for St345. }; #endif diff --git a/MUON/mapping/AliMpPad.cxx b/MUON/mapping/AliMpPad.cxx index c845909b414..3184ca4fca8 100755 --- a/MUON/mapping/AliMpPad.cxx +++ b/MUON/mapping/AliMpPad.cxx @@ -28,6 +28,7 @@ //----------------------------------------------------------------------------- #include "AliMpPad.h" +#include "AliMpEncodePair.h" #include "AliLog.h" #include @@ -59,14 +60,15 @@ ostream& operator<<(ostream& out,const TVector2& v) //_____________________________________________________________________________ -AliMpPad::AliMpPad(const AliMpIntPair& location,const AliMpIntPair& indices, +AliMpPad::AliMpPad(Int_t manuId, Int_t channel, + Int_t ix, Int_t iy, const TVector2& position,const TVector2& dimensions, Bool_t validity) : TObject(), - fLocations(0), + fLLocations(0), fNofLocations(0), - fLocation(location), - fIndices(indices), + fLLocation(AliMp::Pair(manuId, channel)), + fLIndices(AliMp::Pair(ix, iy)), fPosition(position), fDimensions(dimensions), fValidity(validity) @@ -78,14 +80,34 @@ AliMpPad::AliMpPad(const AliMpIntPair& location,const AliMpIntPair& indices, /// It is aimed to be used by MSegmentation methods, and never from outside.... } +//_____________________________________________________________________________ +AliMpPad::AliMpPad(Int_t manuId, Int_t channel, + MpPair_t indices, + const TVector2& position,const TVector2& dimensions, + Bool_t validity) + : TObject(), + fLLocations(0), + fNofLocations(0), + fLLocation(AliMp::Pair(manuId, channel)), + fLIndices(indices), + fPosition(position), + fDimensions(dimensions), + fValidity(validity) +{ +/// Standard constructor \n +/// Be carefull : this constructor doesn't check the validity of +/// the correspondance between location and indices. +/// By default, validity is set true. +/// It is aimed to be used by MSegmentation methods, and never from outside.... +} //_____________________________________________________________________________ AliMpPad::AliMpPad() : TObject(), - fLocations(0), + fLLocations(0), fNofLocations(0), - fLocation(AliMpIntPair::Invalid()), - fIndices(AliMpIntPair::Invalid()), + fLLocation(0), + fLIndices(0), fPosition(-1.,-1.), fDimensions(0.,0.), fValidity(false) @@ -93,14 +115,13 @@ AliMpPad::AliMpPad() /// Default constructor - creates pad in invalid state } - //_____________________________________________________________________________ AliMpPad::AliMpPad(const AliMpPad& rhs) : TObject(rhs), - fLocations(0), + fLLocations(0), fNofLocations(0), - fLocation(AliMpIntPair::Invalid()), - fIndices(AliMpIntPair::Invalid()), + fLLocation(0), + fLIndices(0), fPosition(-1.,-1.), fDimensions(0.,0.), fValidity(false) @@ -115,7 +136,7 @@ AliMpPad::~AliMpPad() { /// Destructor - delete [] fLocations; + delete [] fLLocations; } //_____________________________________________________________________________ @@ -130,18 +151,18 @@ AliMpPad& AliMpPad::operator = (const AliMpPad& rhs) TObject::operator=(rhs); // assignment operator - fLocation = rhs.fLocation; - fIndices = rhs.fIndices; + fLLocation = rhs.fLLocation; + fLIndices = rhs.fLIndices; fPosition.Set(rhs.fPosition); fDimensions.Set(rhs.fDimensions); fValidity = rhs.fValidity; - fLocations = 0; + fLLocations = 0; fNofLocations = rhs.fNofLocations; if ( rhs.GetNofLocations() ) { - fLocations = new AliMpIntPair[fgkMaxNofLocations]; + fLLocations = new MpPair_t[fgkMaxNofLocations]; for ( UInt_t i=0; i right.GetIx() ) return kFALSE; + if ( left.GetIy() < right.GetIy() ) return kTRUE; + return kFALSE; } //_____________________________________________________________________________ -Bool_t AliMpPad::AddLocation(const AliMpIntPair& location, Bool_t warn) +Bool_t AliMpPad::AddLocation(Int_t localBoardId, Int_t localBoardChannel, + Bool_t warn) { /// Add location to the collection if not yet present and /// if collection is not yet full \n @@ -203,31 +228,65 @@ Bool_t AliMpPad::AddLocation(const AliMpIntPair& location, Bool_t warn) // Check maximum number limit if ( GetNofLocations() == fgkMaxNofLocations ) { if (warn) { - AliWarningStream() << "Cannot add location: " - << location + AliWarningStream() << "Cannot add location: (" + << localBoardId << "," << localBoardChannel << ")." << " Maximum number has been reached." << endl; } return false; } // Check if location is present - if ( HasLocation(location) ) { + if ( HasLocation(localBoardId, localBoardChannel) ) { if (warn) { AliWarningStream() << "Cannot add location: " - << location + << localBoardId << "," << localBoardChannel << ")." << " Location is already present." << endl; } return false; } // Add location - if ( ! fLocations) - fLocations = new AliMpIntPair[fgkMaxNofLocations]; + if ( ! fLLocations) + fLLocations = new MpPair_t[fgkMaxNofLocations]; - fLocations[fNofLocations++] = location; + fLLocations[fNofLocations++] + = AliMp::Pair(localBoardId, localBoardChannel); + return true; } +//_____________________________________________________________________________ +Int_t AliMpPad::GetManuId() const +{ +/// Return pad manu Id + + return AliMp::PairFirst(fLLocation); +} + +//_____________________________________________________________________________ +Int_t AliMpPad::GetManuChannel() const +{ +/// Return pad manu channel + + return AliMp::PairSecond(fLLocation); +} + +//_____________________________________________________________________________ +Int_t AliMpPad::GetIx() const +{ +/// Return pad index ix + + return AliMp::PairFirst(fLIndices); +} + +//_____________________________________________________________________________ +Int_t AliMpPad::GetIy() const +{ +/// Return pad index iy + + return AliMp::PairSecond(fLIndices); +} + //_____________________________________________________________________________ void AliMpPad::PrintOn(ostream& out) const { @@ -238,8 +297,10 @@ void AliMpPad::PrintOn(ostream& out) const return; } - out << "Pad: Location " << fLocation - << " Indices " << fIndices + out << "Pad: Location "; + AliMp::PairPut(out, fLLocation) + << " Indices "; + AliMp::PairPut(out,fLIndices) << " Position " << fPosition << " Dimensions " << fDimensions; @@ -248,7 +309,7 @@ void AliMpPad::PrintOn(ostream& out) const out << " Other locations: "; for (Int_t i=0; i=GetNofLocations() ) - return AliMpIntPair::Invalid(); + if ( !fLLocations || i<0 || i>=GetNofLocations() ) + return 0; - return fLocations[i]; + return fLLocations[i]; } //_____________________________________________________________________________ -Bool_t AliMpPad::HasLocation(const AliMpIntPair& location) const +Int_t AliMpPad::GetLocalBoardId(Int_t i) const { -/// Return true if given location is present either as fLocation +/// Return i-th other local board Id associated with this pad + + if ( !fLLocations || i<0 || i>=GetNofLocations() ) + return 0; + + return AliMp::PairFirst(fLLocations[i]); +} + +//_____________________________________________________________________________ +Int_t AliMpPad::GetLocalBoardChannel(Int_t i) const +{ +/// Return i-th other local board channel associated with this pad + + if ( !fLLocations || i<0 || i>=GetNofLocations() ) + return 0; + + return AliMp::PairSecond(fLLocations[i]); +} + +//_____________________________________________________________________________ +Bool_t AliMpPad::HasLocation(Int_t localBoardId, Int_t localBoardChannel) const +{ +/// Return true if given location is present either as fLLocation /// or in the collectio - if (fLocation == location) return true; + MpPair_t location = AliMp::Pair(localBoardId, localBoardChannel); + + if (fLLocation == location) return true; for ( Int_t i=0; i +#include "AliMpEncodePair.h" -#include "AliMpIntPair.h" +#include #include #include @@ -23,9 +23,15 @@ class AliMpPad : public TObject { public: - AliMpPad(const AliMpIntPair& location, const AliMpIntPair& indices, + AliMpPad(Int_t manuId, Int_t channel, + Int_t ix, Int_t iy, const TVector2& position, const TVector2& dimensions, Bool_t validity = true); + AliMpPad(Int_t manuId, Int_t channel, + MpPair_t indices, + const TVector2& position, const TVector2& dimensions, + Bool_t validity = true); + AliMpPad(); AliMpPad(const AliMpPad& src); virtual ~AliMpPad(); @@ -52,15 +58,22 @@ class AliMpPad : public TObject // // set methods // - Bool_t AddLocation(const AliMpIntPair& location, Bool_t warn = true); + Bool_t AddLocation(Int_t localBoardId, Int_t localBoardChannel, + Bool_t warn = true); // // get methods // - /// Return pad location - AliMpIntPair GetLocation() const {return fLocation;} - /// Return pad indices - AliMpIntPair GetIndices() const {return fIndices;} + /// Return pad location as encoded pair (manuId, manuChannel) + MpPair_t GetLocation() const { return fLLocation; } + Int_t GetManuId() const; + Int_t GetManuChannel() const; + + /// Return pad indices as encoded pair (ix, iy) + MpPair_t GetIndices() const { return fLIndices; } + Int_t GetIx() const; + Int_t GetIy() const; + /// Return the pad position (in cm) TVector2 Position() const {return fPosition ;} /// Return the pad dimensions (in cm) @@ -69,23 +82,27 @@ class AliMpPad : public TObject Bool_t IsValid() const {return fValidity ;} Int_t GetNofLocations() const; - AliMpIntPair GetLocation(Int_t i) const; - Bool_t HasLocation(const AliMpIntPair& location) const; + MpPair_t GetLocation(Int_t i) const; + Int_t GetLocalBoardId(Int_t i) const; + Int_t GetLocalBoardChannel(Int_t i) const; + + Bool_t HasLocation(Int_t localBoardId, Int_t localBoardChannel) const; private: + // static data members static const Int_t fgkMaxNofLocations; ///< \brief maximum number of pad locations /// in the collection // data members - AliMpIntPair* fLocations; ///< collection of pad locations + MpPair_t* fLLocations; ///< collection of pad locations - encoded pair (localBoardId, localBoardChannel) UInt_t fNofLocations; ///< number of locations in fLocations - AliMpIntPair fLocation; ///< pad location - AliMpIntPair fIndices; ///< pad indices + MpPair_t fLLocation; ///< pad location as encoded pair (manuId, manuChannel) + MpPair_t fLIndices; ///< pad indices as encoded pair (ix, iy) TVector2 fPosition; ///< the pad position (in cm) TVector2 fDimensions; ///< the pad dimensions (in cm) Bool_t fValidity; ///< validity - ClassDef(AliMpPad,2) //utility class for the motif type + ClassDef(AliMpPad,3) //utility class for the motif type }; ostream& operator << (ostream &out, const AliMpPad& op); diff --git a/MUON/mapping/AliMpRow.cxx b/MUON/mapping/AliMpRow.cxx index 8c6d6520564..c3669f73b94 100755 --- a/MUON/mapping/AliMpRow.cxx +++ b/MUON/mapping/AliMpRow.cxx @@ -87,7 +87,7 @@ AliMpVRowSegment* AliMpRow::FindRowSegment(Int_t ix) const AliMpVRowSegment* segment = GetRowSegment(i); if (!dynamic_cast(segment) && - segment->GetHighIndicesLimit().GetFirst() >= ix) + segment->GetHighLimitIx() >= ix) return segment; } @@ -113,7 +113,7 @@ AliMpRow::FindMotifPosition(AliMpVRowSegment* segment, Int_t ix) const return 0; } - if (motifPosition->GetHighIndicesLimit().GetFirst()>=ix) + if (motifPosition->GetHighLimitIx()>=ix) return motifPosition; } @@ -131,8 +131,7 @@ void AliMpRow::SetHighIndicesLimits(Int_t iy) for (Int_t j=0; jSetHighIndicesLimit( - AliMpIntPair(rowSegment->GetHighIndicesLimit().GetFirst(),iy)); + ->SetHighIndicesLimit(rowSegment->GetHighLimitIx(),iy); for (Int_t k=0; kGetNofMotifs(); k++) { @@ -141,8 +140,7 @@ void AliMpRow::SetHighIndicesLimits(Int_t iy) = GetMotifMap()->FindMotifPosition(motifPositionId); motifPosition - ->SetHighIndicesLimit( - AliMpIntPair(motifPosition->GetHighIndicesLimit().GetFirst(), iy)); + ->SetHighIndicesLimit(motifPosition->GetHighLimitIx(), iy); } } @@ -247,7 +245,7 @@ void AliMpRow::SetMotifPositions() // set the initial value to of HighIndicesLimit() Invalid() // (this is used for calculation of indices in case of // special row segments) - motifPosition->SetHighIndicesLimit(AliMpIntPair::Invalid()); + motifPosition->SetHighIndicesLimit(0, 0, false); //Bool_t warn = (rowSegment->GetNofMotifs()==1); Bool_t warn = true; @@ -275,14 +273,14 @@ void AliMpRow::SetGlobalIndices(AliMp::Direction constPadSizeDirection, for (Int_t j=0; jGetLowIndicesLimit().GetFirst(); + ix += rowSegment->GetLowLimitIx(); for (Int_t k=0; kGetNofMotifs(); k++) { // Find the y index value of the low edge if (rowBefore) { if (constPadSizeDirection == AliMp::kY) { - iy = rowBefore->GetHighIndicesLimit().GetSecond()+1; + iy = rowBefore->GetHighLimitIy()+1; } else { AliMpVRowSegment* seg = rowBefore->FindRowSegment(ix); @@ -291,13 +289,13 @@ void AliMpRow::SetGlobalIndices(AliMp::Direction constPadSizeDirection, if (!motPos) Fatal("SetGlobalIndices", "Motif position in rowBefore not found."); - iy = motPos->GetHighIndicesLimit().GetSecond()+1; + iy = motPos->GetHighLimitIy()+1; } } } // Set (ix, iy) to k-th motif position and update ix - ix = rowSegment->SetIndicesToMotifPosition(k, AliMpIntPair(ix, iy)); + ix = rowSegment->SetIndicesToMotifPosition(k, AliMp::Pair(ix, iy)); } rowSegment->SetGlobalIndices(rowBefore); } @@ -313,21 +311,21 @@ void AliMpRow::SetGlobalIndices(AliMp::Direction constPadSizeDirection, AliMpVRowSegment* rowSegment = GetRowSegment(i); - if ( rowSegment->GetLowIndicesLimit().GetFirst() < ixl ) - ixl = rowSegment->GetLowIndicesLimit().GetFirst(); + if ( rowSegment->GetLowLimitIx() < ixl ) + ixl = rowSegment->GetLowLimitIx(); - if ( rowSegment->GetLowIndicesLimit().GetSecond() < iyl ) - iyl = rowSegment->GetLowIndicesLimit().GetSecond(); + if ( rowSegment->GetLowLimitIy() < iyl ) + iyl = rowSegment->GetLowLimitIy(); - if ( rowSegment->GetHighIndicesLimit().GetFirst() > ixh ) - ixh = rowSegment->GetHighIndicesLimit().GetFirst(); + if ( rowSegment->GetHighLimitIx() > ixh ) + ixh = rowSegment->GetHighLimitIx(); - if ( rowSegment->GetHighIndicesLimit().GetSecond() > iyh ) - iyh = rowSegment->GetHighIndicesLimit().GetSecond(); + if ( rowSegment->GetHighLimitIy() > iyh ) + iyh = rowSegment->GetHighLimitIy(); } - SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); - SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); + SetLowIndicesLimit(ixl, iyl); + SetHighIndicesLimit(ixh, iyh); } //_____________________________________________________________________________ diff --git a/MUON/mapping/AliMpRowSegment.cxx b/MUON/mapping/AliMpRowSegment.cxx index 84d12b1feb3..c51cc6a1a4c 100755 --- a/MUON/mapping/AliMpRowSegment.cxx +++ b/MUON/mapping/AliMpRowSegment.cxx @@ -34,6 +34,7 @@ #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" #include "AliMpConstants.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -46,12 +47,12 @@ ClassImp(AliMpRowSegment) //_____________________________________________________________________________ AliMpRowSegment::AliMpRowSegment(AliMpRow* row, AliMpVMotif* motif, - AliMpIntPair padOffset, + Int_t padOffsetX, Int_t padOffsetY, Int_t nofMotifs, Int_t motifPositionId, Int_t motifPositionDId) : AliMpVRowSegment(), fNofMotifs(nofMotifs), - fPadOffset(padOffset), + fLPadOffset(AliMp::Pair(padOffsetX,padOffsetY)), fOffset(TVector2()), fRow(row), fMotif(motif), @@ -61,14 +62,14 @@ AliMpRowSegment::AliMpRowSegment(AliMpRow* row, AliMpVMotif* motif, /// Standard constructor // Keep pad offset in the low indices limits - SetLowIndicesLimit(padOffset); + SetLowIndicesLimit(fLPadOffset); } //_____________________________________________________________________________ AliMpRowSegment::AliMpRowSegment() : AliMpVRowSegment(), fNofMotifs(0), - fPadOffset(AliMpIntPair()), + fLPadOffset(0), fOffset(TVector2()), fRow(0), fMotif(0), @@ -84,7 +85,7 @@ AliMpRowSegment::~AliMpRowSegment() /// Destructor } -// +// // private methods // @@ -274,21 +275,22 @@ void AliMpRowSegment::SetOffset(const TVector2& offset) AliMpMotifTypePadIterator iter(fMotif->GetMotifType()); iter.First(); - AliMpIntPair localPos = iter.CurrentItem().GetIndices(); + + Int_t ix = iter.CurrentItem().GetIx(); + Int_t iy = iter.CurrentItem().GetIy(); Double_t offsetX = offset.X() - + 2.*fPadOffset.GetFirst() * fMotif->GetPadDimensions(localPos).X() + + 2.*AliMp::PairFirst(fLPadOffset) * fMotif->GetPadDimensionsByIndices(ix, iy).X() + fMotif->Dimensions().X(); Double_t offsetY = offset.Y() - + fPadOffset.GetSecond() * fMotif->GetPadDimensions(localPos).Y(); + + AliMp::PairSecond(fLPadOffset) * fMotif->GetPadDimensionsByIndices(ix, iy).Y(); fOffset = TVector2(offsetX, offsetY); } -#include //_____________________________________________________________________________ void AliMpRowSegment::SetGlobalIndices(AliMpRow* /*rowBefore*/) { @@ -311,26 +313,25 @@ void AliMpRowSegment::SetGlobalIndices(AliMpRow* /*rowBefore*/) Fatal("SetGlobalIndices", "Indices of motif positions have to be set first."); - if ( mPos->GetLowIndicesLimit().GetFirst() < ixl ) - ixl = mPos->GetLowIndicesLimit().GetFirst(); + if ( mPos->GetLowLimitIx() < ixl ) + ixl = mPos->GetLowLimitIx(); - if ( mPos->GetLowIndicesLimit().GetSecond() < iyl ) - iyl = mPos->GetLowIndicesLimit().GetSecond(); + if ( mPos->GetLowLimitIy() < iyl ) + iyl = mPos->GetLowLimitIy(); - if ( mPos->GetHighIndicesLimit().GetFirst() > ixh ) - ixh = mPos->GetHighIndicesLimit().GetFirst(); + if ( mPos->GetHighLimitIx() > ixh ) + ixh = mPos->GetHighLimitIx(); - if ( mPos->GetHighIndicesLimit().GetSecond() > iyh ) - iyh = mPos->GetHighIndicesLimit().GetSecond(); + if ( mPos->GetHighLimitIy() > iyh ) + iyh = mPos->GetHighLimitIy(); } - SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); - SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); + SetLowIndicesLimit(ixl, iyl); + SetHighIndicesLimit(ixh, iyh); } //_____________________________________________________________________________ -Int_t AliMpRowSegment::SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) +Int_t AliMpRowSegment::SetIndicesToMotifPosition(Int_t i, MpPair_t indices) { /// Set global indices to i-th motif position and returns next index /// in x. @@ -340,18 +341,18 @@ Int_t AliMpRowSegment::SetIndicesToMotifPosition(Int_t i, = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i)); // Low limit - AliMpIntPair low = indices + AliMpIntPair(0, GetLowIndicesLimit().GetSecond()); + MpPair_t low = indices + AliMp::Pair(0, GetLowLimitIy()); motifPosition->SetLowIndicesLimit(low); // High limit AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType(); - AliMpIntPair high - = motifPosition->GetLowIndicesLimit() - + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); + MpPair_t high + = motifPosition->GetLowIndicesLimit() + + AliMp::Pair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); motifPosition->SetHighIndicesLimit(high); // Return next index in x - return high.GetFirst()+1; + return AliMp::PairFirst(high)+1; // return motifType->GetNofPadsX(); } diff --git a/MUON/mapping/AliMpRowSegment.h b/MUON/mapping/AliMpRowSegment.h index eef81f52c0b..eec9dd21792 100755 --- a/MUON/mapping/AliMpRowSegment.h +++ b/MUON/mapping/AliMpRowSegment.h @@ -19,12 +19,12 @@ class AliMpRow; class AliMpVMotif; -class AliMpIntPair; class AliMpRowSegment : public AliMpVRowSegment { public: - AliMpRowSegment(AliMpRow* row, AliMpVMotif* motif, AliMpIntPair padOffset, + AliMpRowSegment(AliMpRow* row, AliMpVMotif* motif, + Int_t padOffsetX, Int_t padOffsetY, Int_t nofMotifs, Int_t motifPositionId, Int_t motifPositionDId); AliMpRowSegment(); virtual ~AliMpRowSegment(); @@ -47,8 +47,7 @@ class AliMpRowSegment : public AliMpVRowSegment // set methods virtual void SetOffset(const TVector2& offset); virtual void SetGlobalIndices(AliMpRow* rowBefore); - virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices); + virtual Int_t SetIndicesToMotifPosition(Int_t i, MpPair_t indices); // get methods virtual AliMpRow* GetRow() const; @@ -71,7 +70,7 @@ class AliMpRowSegment : public AliMpVRowSegment // data members Int_t fNofMotifs; ///< number of motifs - AliMpIntPair fPadOffset; ///< the offset in nof pads + MpPair_t fLPadOffset; ///< the offset in nof pads TVector2 fOffset; ///< \brief the position of the centre of the first motif /// (x wtr to left border, y wtr to row center) AliMpRow* fRow; ///< the row containing this segment diff --git a/MUON/mapping/AliMpRowSegmentLSpecial.cxx b/MUON/mapping/AliMpRowSegmentLSpecial.cxx index d19220f3512..d665f77b2e0 100755 --- a/MUON/mapping/AliMpRowSegmentLSpecial.cxx +++ b/MUON/mapping/AliMpRowSegmentLSpecial.cxx @@ -38,6 +38,7 @@ #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" #include "AliMpConstants.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -153,18 +154,17 @@ void AliMpRowSegmentLSpecial::UpdatePadsOffset() // Get the the pads offset of the neighbour row segment // (the first normal segment) - AliMpIntPair offset = neighbour->GetLowIndicesLimit(); + MpPair_t offset = neighbour->GetLowIndicesLimit(); // Find max nof pads in a row Int_t maxNofPads = MaxNofPadsInRow(); // Set limits - SetLowIndicesLimit(offset - AliMpIntPair(maxNofPads, 0)); + SetLowIndicesLimit(offset - AliMp::Pair(maxNofPads, 0)); // Reset limits in the neighbour row segment // (pad offset is now included in the special segment) - neighbour->SetLowIndicesLimit( - AliMpIntPair(0, neighbour->GetLowIndicesLimit().GetSecond())); + neighbour->SetLowIndicesLimit(0, neighbour->GetLowLimitIy()); } //______________________________________________________________________________ @@ -224,8 +224,7 @@ TVector2 AliMpRowSegmentLSpecial::Position() const #include //______________________________________________________________________________ -Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) +Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, MpPair_t indices) { /// Set global indices to i-th motif position and returns next index in x. @@ -234,40 +233,40 @@ Int_t AliMpRowSegmentLSpecial::SetIndicesToMotifPosition(Int_t i, = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i)); // Low limit - AliMpIntPair low - = AliMpIntPair(GetLowIndicesLimit().GetFirst() + AliMpConstants::StartPadIndex(), - indices.GetSecond()) + MpPair_t low + = AliMp::Pair(GetLowLimitIx() + AliMpConstants::StartPadIndex(), + AliMp::PairSecond(indices)) + FindRelativeLowIndicesOf(GetMotifPositionId(i)); - if (! motifPosition->GetHighIndicesLimit().IsValid()) { + if (! motifPosition->IsHighLimitValid()) { motifPosition->SetLowIndicesLimit(low); } else { - if (motifPosition->GetLowIndicesLimit().GetFirst() > low.GetFirst()) + if ( motifPosition->GetLowLimitIx() > AliMp::PairFirst(low) ) motifPosition->SetLowIndicesLimit( - AliMpIntPair(low.GetFirst(), - motifPosition->GetLowIndicesLimit().GetSecond())); + AliMp::PairFirst(low), + motifPosition->GetLowLimitIy()); - if (motifPosition->GetLowIndicesLimit().GetSecond() > low.GetSecond()) + if ( motifPosition->GetLowLimitIy() > AliMp::PairSecond(low) ) motifPosition->SetLowIndicesLimit( - AliMpIntPair(motifPosition->GetLowIndicesLimit().GetFirst(), - low.GetSecond())); + motifPosition->GetLowLimitIx(), + AliMp::PairSecond(low) ); } // High limit AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType(); - AliMpIntPair high + MpPair_t high = motifPosition->GetLowIndicesLimit() - + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); + + AliMp::Pair(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(); + if ( i != GetNofMotifs()-1 ) + return AliMp::PairFirst(indices); //return 0; else - return indices.GetFirst() + MaxNofPadsInRow(); + return AliMp::PairFirst(indices) + MaxNofPadsInRow(); //return MaxNofPadsInRow(); } //______________________________________________________________________________ @@ -278,7 +277,7 @@ void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore) /// includes all pads of this special row segment. // Low ix - Int_t ixl = GetLowIndicesLimit().GetFirst() + AliMpConstants::StartPadIndex(); + Int_t ixl = GetLowLimitIx() + AliMpConstants::StartPadIndex(); // the pads offset was already defined by Reader // High ix @@ -288,7 +287,7 @@ void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore) Int_t iyl = AliMpConstants::StartPadIndex(); if (rowBefore) { //if (constPadSizeDirection == kY) { - iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1; + iyl = rowBefore->GetHighLimitIy()+1; //} /* else { @@ -296,7 +295,7 @@ void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore) AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl); if (!motPos) Fatal("SetGlobalIndices", "Motif position in rowBefore not found."); - iyl = motPos->GetHighIndicesLimit().GetSecond()+1; + iyl = motPos->GetHighLimitIy()+1; } */ } @@ -304,8 +303,8 @@ void AliMpRowSegmentLSpecial::SetGlobalIndices(AliMpRow* rowBefore) // High iy Int_t iyh = iyl + GetNofPadRows() - 1; - SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); - SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); + SetLowIndicesLimit(ixl, iyl); + SetHighIndicesLimit(ixh, iyh); } diff --git a/MUON/mapping/AliMpRowSegmentLSpecial.h b/MUON/mapping/AliMpRowSegmentLSpecial.h index 6a8368fe73d..b85dc689fd9 100755 --- a/MUON/mapping/AliMpRowSegmentLSpecial.h +++ b/MUON/mapping/AliMpRowSegmentLSpecial.h @@ -20,7 +20,6 @@ class AliMpRow; class AliMpPadRow; class AliMpVPadRowSegment; -class AliMpIntPair; class AliMpRowSegmentLSpecial : public AliMpVRowSegmentSpecial { @@ -39,8 +38,7 @@ class AliMpRowSegmentLSpecial : public AliMpVRowSegmentSpecial // set methods virtual void SetGlobalIndices(AliMpRow* rowBefore); - virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices); + virtual Int_t SetIndicesToMotifPosition(Int_t i, MpPair_t indices); protected: // methods diff --git a/MUON/mapping/AliMpRowSegmentRSpecial.cxx b/MUON/mapping/AliMpRowSegmentRSpecial.cxx index 7ab4e5acb5d..f9054d11e48 100644 --- a/MUON/mapping/AliMpRowSegmentRSpecial.cxx +++ b/MUON/mapping/AliMpRowSegmentRSpecial.cxx @@ -105,10 +105,10 @@ void AliMpRowSegmentRSpecial::SetGlobalIndicesLow() // Set low indices limit to continue indices of the // preceding row segment - Int_t ix = rowSegment->GetHighIndicesLimit().GetFirst() + 1; - Int_t iy = rowSegment->GetLowIndicesLimit().GetSecond(); + Int_t ix = rowSegment->GetHighLimitIx() + 1; + Int_t iy = rowSegment->GetLowLimitIy(); - SetLowIndicesLimit(AliMpIntPair(ix, iy)); + SetLowIndicesLimit(ix, iy); } // @@ -219,8 +219,7 @@ TVector2 AliMpRowSegmentRSpecial::Position() const } //______________________________________________________________________________ -Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) +Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, MpPair_t indices) { /// Set global indices to i-th motif position and returns next index in x. @@ -228,7 +227,7 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, SetGlobalIndicesLow(); // Check for consistence - if (GetLowIndicesLimit().GetFirst() != indices.GetFirst()) + if ( GetLowLimitIx() != AliMp::PairFirst(indices) ) AliFatal("Inconsistent indices"); // Get motif position @@ -236,13 +235,13 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(i)); // Set limits only once - if ( motifPosition->GetHighIndicesLimit().IsValid() ) - return indices.GetFirst();; + if ( motifPosition->IsHighLimitValid() ) + return AliMp::PairFirst(indices); // Low limit // - Int_t ixl = GetLowIndicesLimit().GetFirst(); - Int_t iyl = GetLowIndicesLimit().GetSecond(); + Int_t ixl = GetLowLimitIx(); + Int_t iyl = GetLowLimitIy(); // Find the most down pad row segment with this motifPositionId. AliMpVPadRowSegment* padRowSegment = FindPadRowSegment(GetMotifPositionId(i)); @@ -250,23 +249,23 @@ Int_t AliMpRowSegmentRSpecial::SetIndicesToMotifPosition(Int_t i, 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)); + motifPosition->SetLowIndicesLimit(ixl, iyl); // High limit // AliMpMotifType* motifType = motifPosition->GetMotif()->GetMotifType(); - AliMpIntPair high + MpPair_t high = motifPosition->GetLowIndicesLimit() - + AliMpIntPair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); + + AliMp::Pair(motifType->GetNofPadsX()-1, motifType->GetNofPadsY()-1); motifPosition->SetHighIndicesLimit(high); // No increment index needed (this is always the last element) - return indices.GetFirst(); + return AliMp::PairFirst(indices); } //______________________________________________________________________________ @@ -281,7 +280,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore) = GetRow()->GetMotifMap()->FindMotifPosition(GetMotifPositionId(0)); // Low ix - Int_t ixl = firstMotifPosition->GetLowIndicesLimit().GetFirst(); + Int_t ixl = firstMotifPosition->GetLowLimitIx(); // 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 @@ -294,7 +293,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore) Int_t iyl = AliMpConstants::StartPadIndex(); if (rowBefore) { //if (constPadSizeDirection == kY) { - iyl = rowBefore->GetHighIndicesLimit().GetSecond()+1; + iyl = rowBefore->GetHighLimitIy()+1; //} /* else { @@ -302,7 +301,7 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore) AliMpMotifPosition* motPos = rowBefore->FindMotifPosition(seg, ixl); if (!motPos) Fatal("SetGlobalIndices", "Motif position in rowBefore not found."); - iyl = motPos->GetHighIndicesLimit().GetSecond()+1; + iyl = motPos->GetHighLimitIy()+1; } */ } @@ -310,8 +309,8 @@ void AliMpRowSegmentRSpecial::SetGlobalIndices(AliMpRow* rowBefore) // High iy Int_t iyh = iyl + GetNofPadRows() - 1; - SetLowIndicesLimit(AliMpIntPair(ixl, iyl)); - SetHighIndicesLimit(AliMpIntPair(ixh, iyh)); + SetLowIndicesLimit(ixl, iyl); + SetHighIndicesLimit(ixh, iyh); } diff --git a/MUON/mapping/AliMpRowSegmentRSpecial.h b/MUON/mapping/AliMpRowSegmentRSpecial.h index 16d7d76949e..7c55a58749f 100644 --- a/MUON/mapping/AliMpRowSegmentRSpecial.h +++ b/MUON/mapping/AliMpRowSegmentRSpecial.h @@ -20,7 +20,6 @@ class AliMpRow; class AliMpPadRow; class AliMpVPadRowSegment; -class AliMpIntPair; class AliMpRowSegmentRSpecial : public AliMpVRowSegmentSpecial { @@ -40,8 +39,7 @@ class AliMpRowSegmentRSpecial : public AliMpVRowSegmentSpecial // set methods virtual void SetGlobalIndices(AliMpRow* rowBefore); - virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices); + virtual Int_t SetIndicesToMotifPosition(Int_t i, MpPair_t indices); protected: // methods diff --git a/MUON/mapping/AliMpSector.cxx b/MUON/mapping/AliMpSector.cxx index 12b271a622e..c9115865ded 100755 --- a/MUON/mapping/AliMpSector.cxx +++ b/MUON/mapping/AliMpSector.cxx @@ -32,7 +32,7 @@ #include "AliMpVRowSegment.h" #include "AliMpVMotif.h" #include "AliMpMotifMap.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpConstants.h" #include "AliLog.h" @@ -55,7 +55,7 @@ AliMpSector::AliMpSector(const TString& id, Int_t nofZones, Int_t nofRows, fDirection(direction), fMinPadDimensions(TVector2(1.e6, 1.e6)), fMaxPadDimensions(), - fMaxPadIndices(AliMpIntPair::Invalid()), + fLMaxPadIndices(0), fNofPads(0) { /// Standard constructor @@ -82,7 +82,7 @@ AliMpSector::AliMpSector() fDirection(AliMp::kX), fMinPadDimensions(TVector2(0., 0.)), fMaxPadDimensions(), - fMaxPadIndices(AliMpIntPair::Invalid()), + fLMaxPadIndices(0), fNofPads(0) { /// Default constructor @@ -164,7 +164,6 @@ void AliMpSector::SetGlobalIndices() /// Set the indices limits to all indexed elements /// (row, row segment, motif positions). - AliMpIntPair indices(0,0); AliMpRow* rowBefore=0; for (Int_t i=0; iSetGlobalIndices(fDirection, rowBefore); @@ -201,20 +200,20 @@ void AliMpSector::SetMaxPadIndices() { /// Set maximum pad indices in x, y - if ( fMaxPadIndices != AliMpIntPair::Invalid() ) return; + if ( fLMaxPadIndices != 0 ) return; Int_t maxIndexInX = 0; Int_t maxIndexInY = 0; for (Int_t i=0; iGetHighIndicesLimit().GetFirst(); + Int_t ixh = GetRow(i)->GetHighLimitIx(); if ( ixh > maxIndexInX ) maxIndexInX = ixh; - Int_t iyh = GetRow(i)->GetHighIndicesLimit().GetSecond(); + Int_t iyh = GetRow(i)->GetHighLimitIy(); if ( iyh > maxIndexInY ) maxIndexInY = iyh; } - fMaxPadIndices = AliMpIntPair(maxIndexInX, maxIndexInY); + fLMaxPadIndices = AliMp::Pair(maxIndexInX, maxIndexInY); } diff --git a/MUON/mapping/AliMpSector.h b/MUON/mapping/AliMpSector.h index 1c8cbfd23e5..f324a488388 100755 --- a/MUON/mapping/AliMpSector.h +++ b/MUON/mapping/AliMpSector.h @@ -17,7 +17,7 @@ #include "AliMpDirection.h" #include "AliMpPlaneType.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include #include @@ -75,7 +75,7 @@ class AliMpSector : public TNamed TVector2 GetMinPadDimensions() const; TVector2 GetMaxPadDimensions() const; - AliMpIntPair GetMaxPadIndices() const; + MpPair_t GetMaxPadIndices() const; Int_t GetNofPads() const; AliMpMotifMap* GetMotifMap() const; @@ -109,10 +109,10 @@ class AliMpSector : public TNamed AliMp::Direction fDirection; ///< the direction of constant pad size TVector2 fMinPadDimensions; ///< minimum pad dimensions TVector2 fMaxPadDimensions; ///< miximum pad dimensions - AliMpIntPair fMaxPadIndices; ///< maximum pad indices + MpPair_t fLMaxPadIndices; ///< maximum pad indices Int_t fNofPads; ///< total number of pads - ClassDef(AliMpSector,1) // Sector + ClassDef(AliMpSector,2) // Sector }; // inline functions @@ -130,8 +130,8 @@ inline TVector2 AliMpSector::GetMaxPadDimensions() const { return fMaxPadDimensions; } /// Return maximum pad indices -inline AliMpIntPair AliMpSector::GetMaxPadIndices() const -{ return fMaxPadIndices; } +inline MpPair_t AliMpSector::GetMaxPadIndices() const +{ return fLMaxPadIndices; } /// Return total number of pads inline Int_t AliMpSector::GetNofPads() const diff --git a/MUON/mapping/AliMpSectorPadIterator.cxx b/MUON/mapping/AliMpSectorPadIterator.cxx index 91a8d7e982f..b4301cbb803 100755 --- a/MUON/mapping/AliMpSectorPadIterator.cxx +++ b/MUON/mapping/AliMpSectorPadIterator.cxx @@ -27,7 +27,6 @@ #include "AliMpSectorPadIterator.h" -#include "AliMpIntPair.h" #include "AliMpSector.h" #include "AliMpMotifType.h" diff --git a/MUON/mapping/AliMpSectorReader.cxx b/MUON/mapping/AliMpSectorReader.cxx index a3ddc66a3f6..72c3f1be44c 100755 --- a/MUON/mapping/AliMpSectorReader.cxx +++ b/MUON/mapping/AliMpSectorReader.cxx @@ -43,7 +43,6 @@ #include "AliMpMotifSpecial.h" #include "AliMpMotifType.h" #include "AliMpConnection.h" -#include "AliMpIntPair.h" #include "AliMpDirection.h" #include "AliMpConstants.h" @@ -272,7 +271,7 @@ void AliMpSectorReader::ReadRowSegmentsData(istream& in, // Create row segment and add it to its zone, row AliMpVRowSegment* rowSegment - = new AliMpRowSegment(row, motif, AliMpIntPair(offX, offY), nofMotifs, + = new AliMpRowSegment(row, motif, offX, offY, nofMotifs, firstMotifPositionId, firstMotifPositionDId); subZone->AddRowSegment(rowSegment); diff --git a/MUON/mapping/AliMpSectorReader.h b/MUON/mapping/AliMpSectorReader.h index c84c3f5843b..d44ba95d2b5 100755 --- a/MUON/mapping/AliMpSectorReader.h +++ b/MUON/mapping/AliMpSectorReader.h @@ -18,7 +18,6 @@ #include "AliMpStation12Type.h" #include "AliMpPlaneType.h" #include "AliMpXDirection.h" -#include "AliMpIntPair.h" #include diff --git a/MUON/mapping/AliMpSectorSegmentation.cxx b/MUON/mapping/AliMpSectorSegmentation.cxx index b4879b2237e..78810fdf7e4 100755 --- a/MUON/mapping/AliMpSectorSegmentation.cxx +++ b/MUON/mapping/AliMpSectorSegmentation.cxx @@ -38,13 +38,12 @@ #include "AliMpVMotif.h" #include "AliMpMotifPosition.h" #include "AliMpConnection.h" -#include "AliMpNeighboursPadIterator.h" #include "AliMpSectorAreaHPadIterator.h" #include "AliMpSectorAreaVPadIterator.h" #include "AliMpSectorPadIterator.h" -#include "AliMpIntPair.h" #include "AliMpArea.h" #include "AliMpConstants.h" +#include "AliMpEncodePair.h" #include "AliLog.h" @@ -172,31 +171,31 @@ void AliMpSectorSegmentation::FillPadDimensionsMap() //______________________________________________________________________________ AliMpMotifPosition* -AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const +AliMpSectorSegmentation::FindMotifPosition(Int_t ix, Int_t iy) const { /// Find the motif position which contains the given pad indices /// return 0 if not found - switch (fkSector->GetDirection()) { + switch ( fkSector->GetDirection() ) { case AliMp::kX : { // Case where all the pads have the same size along X direction - for (Int_t irow=0; irowGetNofRows(); ++irow) { + for ( Int_t irow=0; irowGetNofRows(); ++irow ) { AliMpRow* row = fkSector->GetRow(irow); - if (row->GetLowIndicesLimit().GetFirst()<=indices.GetFirst() && - row->GetHighIndicesLimit().GetFirst()>=indices.GetFirst()) { + if ( row->GetLowLimitIx() <= ix && + row->GetHighLimitIx()>= ix ) { - for (Int_t iseg=0;isegGetNofRowSegments();++iseg){ + for ( Int_t iseg=0;isegGetNofRowSegments();++iseg ) { AliMpVRowSegment* seg = row->GetRowSegment(iseg); - if (seg->GetLowIndicesLimit().GetFirst()<=indices.GetFirst() && - seg->GetHighIndicesLimit().GetFirst()>=indices.GetFirst()) { + if ( seg->GetLowLimitIx() <= ix && + seg->GetHighLimitIx() >= ix ) { AliMpMotifPosition* motifPos; - for (Int_t imot=0;imotGetNofMotifs();++imot) { + for ( Int_t imot=0;imotGetNofMotifs();++imot ) { motifPos = fkSector->GetMotifMap() ->FindMotifPosition(seg->GetMotifPositionId(imot)); - if (motifPos && motifPos->HasPadByIndices(indices)) return motifPos; + if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix,iy))) return motifPos; } } } @@ -211,32 +210,32 @@ AliMpSectorSegmentation::FindMotifPosition(const AliMpIntPair& indices) const // look for the row which contains the indices AliMpRow* row=0; Int_t irow; - for (irow=0; irowGetNofRows(); ++irow) { + for ( irow=0; irowGetNofRows(); ++irow ) { row = fkSector->GetRow(irow); AliMpVRowSegment* lastSeg = row->GetRowSegment(row->GetNofRowSegments()-1); - if (lastSeg->GetLowIndicesLimit().GetSecond()<=indices.GetSecond() && - lastSeg->GetHighIndicesLimit().GetSecond()>=indices.GetSecond()) break; + if ( lastSeg->GetLowLimitIy() <= iy && + lastSeg->GetHighLimitIy() >= iy ) break; // NOTE : We use the last row segment in order to ensure that // we are not on a special motif } - if (irow==fkSector->GetNofRows()) return 0; + if ( irow==fkSector->GetNofRows() ) return 0; // look for the row segment, in the found row, which contains the indices AliMpVRowSegment* seg=0; Int_t iseg; - for (iseg=0;isegGetNofRowSegments();++iseg){ + for ( iseg=0;isegGetNofRowSegments();++iseg ) { seg = row->GetRowSegment(iseg); - if (seg->HasIndices(indices)) break; + if (seg->HasIndices(AliMp::Pair(ix, iy))) break; } - if (iseg==row->GetNofRowSegments()) return 0; + if ( iseg==row->GetNofRowSegments() ) return 0; // look for the motif position which contains the indices AliMpMotifPosition* motifPos=0; Int_t imot=0; - for (imot=0;imotGetNofMotifs();++imot) { + for ( imot=0;imotGetNofMotifs();++imot ) { motifPos = fkSector->GetMotifMap() ->FindMotifPosition(seg->GetMotifPositionId(imot)); - if (motifPos && motifPos->HasPadByIndices(indices)) break; + if (motifPos && motifPos->HasPadByIndices(AliMp::Pair(ix, iy))) break; } if (imot==seg->GetNofMotifs()) return 0; @@ -259,7 +258,7 @@ AliMpSectorSegmentation::PadByXDirection(const TVector2& startPosition, // Search in X direction AliMpPad pad; - TVector2 position(startPosition); + TVector2 position(startPosition); do { pad = PadByPosition(position, false); position += TVector2(stepX, 0.); @@ -333,16 +332,6 @@ AliMpSectorSegmentation::CreateIterator() const return new AliMpSectorPadIterator(fkSector); } -//______________________________________________________________________________ -AliMpVPadIterator* -AliMpSectorSegmentation::CreateIterator(const AliMpPad& centerPad, - Bool_t includeCenter) const -{ - /// Create the neighbours pad iterator. - - return new AliMpNeighboursPadIterator(this, centerPad, includeCenter); -} - //______________________________________________________________________________ Int_t AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbours, @@ -355,44 +344,50 @@ AliMpSectorSegmentation::GetNeighbours(const AliMpPad& pad, TObjArray& neighbour //______________________________________________________________________________ AliMpPad -AliMpSectorSegmentation::PadByLocation(const AliMpIntPair& location, +AliMpSectorSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const { /// Find the pad which corresponds to the given location - if ((*fPadBuffer).GetLocation()==location) return (*fPadBuffer); + + + if ( fPadBuffer->GetManuId() == manuId && + fPadBuffer->GetManuChannel() == manuChannel ) return (*fPadBuffer); AliMpMotifPosition* motifPos = - fkSector->GetMotifMap()->FindMotifPosition(location.GetFirst()); + fkSector->GetMotifMap()->FindMotifPosition(manuId); if (!motifPos){ if (warning) Warning("PadByLocation","The pad motif position ID doesn't exists"); return AliMpPad::Invalid(); } AliMpVMotif* motif = motifPos->GetMotif(); - AliMpIntPair localIndices = - motif->GetMotifType()->FindLocalIndicesByGassiNum(location.GetSecond()); - if (! localIndices.IsValid()) { + MpPair_t localIndices = + motif->GetMotifType()->FindLocalIndicesByGassiNum(manuChannel); + if ( localIndices < 0 ) { if (warning) Warning("PadByLocation","The pad number doesn't exists"); return AliMpPad::Invalid(); } TVector2 delta = motif->PadPositionLocal(localIndices); - return (*fPadBuffer) = AliMpPad(location, + + return (*fPadBuffer) = AliMpPad(manuId, manuChannel, motifPos->GlobalIndices(localIndices), motifPos->Position()+delta, - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //______________________________________________________________________________ AliMpPad -AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices, - Bool_t warning ) const +AliMpSectorSegmentation::PadByIndices(Int_t ix, Int_t iy, Bool_t warning ) const { /// Find the pad which corresponds to the given indices - if ((*fPadBuffer).GetIndices()==indices) return (*fPadBuffer); - - AliMpMotifPosition* motifPos = FindMotifPosition(indices); + + if ( fPadBuffer->GetIx() == ix && + fPadBuffer->GetIy() == iy ) return (*fPadBuffer); + + MpPair_t indices = AliMp::Pair(ix, iy); + AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy); if (!motifPos) { if (warning) Warning("PadByIndices","Pad indices not contained in any motif!"); @@ -401,7 +396,7 @@ AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices, // retrieve the local indices in the found motif AliMpVMotif* motif = motifPos->GetMotif(); - AliMpIntPair localIndices = indices - motifPos->GetLowIndicesLimit(); + MpPair_t localIndices = indices - motifPos->GetLowIndicesLimit(); AliMpConnection* connection= motif->GetMotifType()->FindConnectionByLocalIndices(localIndices); @@ -414,10 +409,10 @@ AliMpSectorSegmentation::PadByIndices(const AliMpIntPair& indices, TVector2 localPos = motif->PadPositionLocal(localIndices); return (*fPadBuffer) - = AliMpPad(AliMpIntPair(motifPos->GetID(),connection->GetManuChannel()), - indices, + = AliMpPad(motifPos->GetID(),connection->GetManuChannel(), + ix, iy, motifPos->Position()+localPos, - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //______________________________________________________________________________ @@ -427,8 +422,8 @@ AliMpSectorSegmentation::PadByPosition(const TVector2& position, { /// Find the pad which corresponds to the given position - if ((*fPadBuffer).Position().X()==position.X() && - (*fPadBuffer).Position().Y()==position.Y()) return (*fPadBuffer); + if (fPadBuffer->Position().X()==position.X() && + fPadBuffer->Position().Y()==position.Y()) return (*fPadBuffer); Int_t motifPosID = fkSector->FindMotifPositionId(position); AliMpMotifPosition* motifPos @@ -441,10 +436,10 @@ AliMpSectorSegmentation::PadByPosition(const TVector2& position, } AliMpVMotif* motif = motifPos->GetMotif(); - AliMpIntPair localIndices + MpPair_t localIndices = motif->PadIndicesLocal(position-motifPos->Position()); - - if ( ! localIndices.IsValid() ) { + + if ( localIndices < 0 ) { if (warning) Warning("PadByPosition","Position outside motif limits"); return AliMpPad::Invalid(); } @@ -458,10 +453,10 @@ AliMpSectorSegmentation::PadByPosition(const TVector2& position, } return (*fPadBuffer) - = AliMpPad(AliMpIntPair(motifPosID,connect->GetManuChannel()), + = AliMpPad(motifPosID, connect->GetManuChannel(), motifPos->GlobalIndices(localIndices), motifPos->Position()+motif->PadPositionLocal(localIndices), - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } @@ -489,11 +484,13 @@ AliMpSectorSegmentation::PadByDirection(const TVector2& startPosition, //_____________________________________________________________________________ Bool_t -AliMpSectorSegmentation::HasPadByIndices(const AliMpIntPair& indices) const +AliMpSectorSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const { /// Whether or not we have a pad at indices=(ix,iy) - AliMpMotifPosition* motifPos = FindMotifPosition(indices); + MpPair_t indices = AliMp::Pair(ix, iy); + + AliMpMotifPosition* motifPos = FindMotifPosition(ix, iy); if (motifPos) return motifPos->HasPadByIndices(indices); @@ -502,32 +499,24 @@ AliMpSectorSegmentation::HasPadByIndices(const AliMpIntPair& indices) const //_____________________________________________________________________________ Bool_t -AliMpSectorSegmentation::HasPadByLocation(const AliMpIntPair& location) const +AliMpSectorSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const { /// Whether or not we have a pad at location=(manuId,manuChannel) - AliMpMotifPosition* motifPos = - fkSector->GetMotifMap()->FindMotifPosition(location.GetFirst()); + AliMpMotifPosition* motifPos + = fkSector->GetMotifMap()->FindMotifPosition(manuId); - if ( motifPos ) return motifPos->HasPadByManuChannel(location.GetSecond()); + if ( motifPos ) return motifPos->HasPadByManuChannel(manuChannel); return kFALSE; } -//______________________________________________________________________________ -Bool_t AliMpSectorSegmentation::HasPad(const AliMpIntPair& indices) const -{ -/// Does the pad specified by \a indices exist ? - - return PadByIndices(indices,kFALSE) != AliMpPad::Invalid(); -} - //______________________________________________________________________________ Int_t AliMpSectorSegmentation::MaxPadIndexX() const { /// Return maximum pad index in x - return fkSector->GetMaxPadIndices().GetFirst(); + return AliMp::PairFirst(fkSector->GetMaxPadIndices()); } //______________________________________________________________________________ @@ -535,7 +524,7 @@ Int_t AliMpSectorSegmentation::MaxPadIndexY() const { /// Return maximum pad index in y - return fkSector->GetMaxPadIndices().GetSecond(); + return AliMp::PairSecond(fkSector->GetMaxPadIndices()); } //______________________________________________________________________________ @@ -668,38 +657,46 @@ TVector2 AliMpSectorSegmentation::GetMinPadDimensions() const } //______________________________________________________________________________ -Bool_t AliMpSectorSegmentation::CircleTest(const AliMpIntPair& indices) const +Bool_t AliMpSectorSegmentation::CircleTest(Int_t ix, Int_t iy) const { /// Verify that all methods for retrieving pads are consistents between them. /// Return true if the pad with specified indices was found and verified, /// false otherwise. - if (!HasPad(indices)) return false; + if ( ! HasPadByIndices(ix, iy) ) return false; // Verify the indice->location->position->indice way - AliMpIntPair location = PadByIndices(indices).GetLocation(); - TVector2 position = PadByLocation(location).Position(); - AliMpIntPair retIndices = PadByPosition(position).GetIndices(); + AliMpPad pad1 = PadByIndices(ix, iy); + AliMpPad pad2 = PadByLocation(pad1.GetManuId(), pad1.GetManuChannel()); + AliMpPad pad3 = PadByPosition(pad2.Position()); + + MpPair_t retIndices = pad3.GetIndices(); - if (retIndices != indices) { - cout << "Pad " << indices << " lead to inconsistency" << endl; + if ( retIndices != AliMp::Pair(ix, iy) ) { + cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl; cout << "in indice->location->position->indice way..." << endl; - cout << "starting from " << indices << "-->" << location << "-->" - << '(' << position.X() << ',' << position.Y() << ')' - << " and retIndices: " << retIndices << endl; + cout << "starting from indices " << pad1 << endl + << "--> location " << pad2 << endl + << "--> position " + << '(' << pad3.Position().X() << ',' << pad3.Position().Y() << ')' + << endl << endl; } - // Verify the indice->position->location->indice way - position = PadByIndices(indices).Position(); - location = PadByPosition(position).GetLocation(); - retIndices = PadByLocation(location).GetIndices(); - - if (retIndices != indices) { - cout << "Pad " << indices << " lead to inconsistency" << endl; - cout << "in indice->position->location->indice way..." <position->location->indice way + AliMpPad pad2bis = PadByPosition(pad1.Position()); + AliMpPad pad3bis = PadByLocation(pad2bis.GetManuId(), pad2bis.GetManuChannel()); + + retIndices = pad3bis.GetIndices(); + + if ( retIndices != AliMp::Pair(ix, iy) ) { + cout << "Pad (" << ix << ',' << iy << ") lead to inconsistency" << endl; + cout << "in indice->position->location->indice way..." << endl; + cout << "starting from indices " << pad1 << endl + << "--> position " + << '(' << pad2bis.Position().X() << ',' << pad2bis.Position().Y() << ')' << endl + << "--> location " << pad3bis + << endl << endl; } return true; diff --git a/MUON/mapping/AliMpSectorSegmentation.h b/MUON/mapping/AliMpSectorSegmentation.h index 9e4bcb60090..e747348b9c7 100755 --- a/MUON/mapping/AliMpSectorSegmentation.h +++ b/MUON/mapping/AliMpSectorSegmentation.h @@ -26,7 +26,6 @@ class AliMpSector; class AliMpMotifPosition; class AliMpVPadIterator; -class AliMpIntPair; class AliMpArea; class AliMpSectorSegmentation : public AliMpVSegmentation @@ -39,27 +38,23 @@ class AliMpSectorSegmentation : public AliMpVSegmentation // factory methods virtual AliMpVPadIterator* CreateIterator(const AliMpArea& area) const; virtual AliMpVPadIterator* CreateIterator() const; - - AliMpVPadIterator* CreateIterator(const AliMpPad& centerPad, - Bool_t includeCenter=kFALSE) const; virtual Int_t GetNeighbours(const AliMpPad& pad, TObjArray& neighbours, Bool_t includeSelf = kFALSE, Bool_t includeVoid = kFALSE) const; // methods - virtual AliMpPad PadByLocation(const AliMpIntPair& location, + virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning = kTRUE) const; - virtual AliMpPad PadByIndices (const AliMpIntPair& indices, + virtual AliMpPad PadByIndices (Int_t ix, Int_t iy, Bool_t warning = kTRUE) const; virtual AliMpPad PadByPosition(const TVector2& position , Bool_t warning = kTRUE) const; virtual AliMpPad PadByDirection(const TVector2& startPosition, Double_t distance) const; - virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const; - virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const; - virtual Bool_t HasPad(const AliMpIntPair& indices) const; + virtual Bool_t HasPadByIndices(Int_t ix, Int_t iy) const; + virtual Bool_t HasPadByLocation(Int_t manuId, Int_t manuChannel) const; virtual Int_t MaxPadIndexX() const; virtual Int_t MaxPadIndexY() const; @@ -82,7 +77,7 @@ class AliMpSectorSegmentation : public AliMpVSegmentation virtual TVector2 PadDimensions(Int_t zone, Bool_t warning = kTRUE) const; TVector2 GetMinPadDimensions() const; - Bool_t CircleTest(const AliMpIntPair& indices) const; + Bool_t CircleTest(Int_t ix, Int_t iy) const; void PrintZones() const; const AliMpSector* GetSector() const; @@ -94,7 +89,7 @@ class AliMpSectorSegmentation : public AliMpVSegmentation AliMpSectorSegmentation& operator = (const AliMpSectorSegmentation& right); static const Double_t fgkS1; ///< the separators used for conversion - static const Double_t fgkS2; ///< of TVector2 to Long_t + static const Double_t fgkS2; ///< of TVector2 to MpPair_t // methods Long_t GetIndex(const TVector2& vector2) const; @@ -102,7 +97,7 @@ class AliMpSectorSegmentation : public AliMpVSegmentation // methods void FillPadDimensionsMap(); - AliMpMotifPosition* FindMotifPosition(const AliMpIntPair& indices) const; + AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const; virtual AliMpPad PadByXDirection(const TVector2& startPosition, Double_t maxX) const; virtual AliMpPad PadByYDirection(const TVector2& startPosition, diff --git a/MUON/mapping/AliMpSlatSegmentation.cxx b/MUON/mapping/AliMpSlatSegmentation.cxx index 2333ea5fed8..e47af8e11b2 100644 --- a/MUON/mapping/AliMpSlatSegmentation.cxx +++ b/MUON/mapping/AliMpSlatSegmentation.cxx @@ -36,6 +36,7 @@ #include "AliMpMotifType.h" #include "AliMpSlat.h" #include "AliMpSlatPadIterator.h" +#include "AliMpEncodePair.h" /// \cond CLASSIMP ClassImp(AliMpSlatSegmentation) @@ -155,18 +156,6 @@ AliMpSlatSegmentation::GetName() const return name.Data(); } -//_____________________________________________________________________________ -Bool_t -AliMpSlatSegmentation::HasPad(const AliMpIntPair& indices) const -{ - /// - /// Test if this slat has a pad located at the position referenced - /// by the integer indices. - /// - - return PadByIndices(indices,kFALSE) != AliMpPad::Invalid(); -} - //_____________________________________________________________________________ Int_t AliMpSlatSegmentation::MaxPadIndexX() const @@ -200,7 +189,7 @@ AliMpSlatSegmentation::NofPads() const //_____________________________________________________________________________ AliMpPad -AliMpSlatSegmentation::PadByLocation(const AliMpIntPair& location, +AliMpSlatSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const { /// @@ -211,44 +200,42 @@ AliMpSlatSegmentation::PadByLocation(const AliMpIntPair& location, /// /// AliMpPad::Invalid() is returned if there's no pad at the given location. /// - Int_t manuID = location.GetFirst(); - - AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(manuID); + AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(manuId); if (!motifPos) - { - if (warning) - { - AliWarning(Form("Manu ID %d not found in slat %s", - manuID, fkSlat->GetID())); + { + if (warning) + { + AliWarning(Form("Manu ID %d not found in slat %s", + manuId, fkSlat->GetID())); } return AliMpPad::Invalid(); - } + } AliMpVMotif* motif = motifPos->GetMotif(); - AliMpIntPair localIndices = - motif->GetMotifType()->FindLocalIndicesByGassiNum(location.GetSecond()); + MpPair_t localIndices = + motif->GetMotifType()->FindLocalIndicesByGassiNum(manuChannel); - if (!localIndices.IsValid()) - { - if (warning) - { - AliWarning(Form("The pad number %d doesn't exists", - location.GetSecond())); - } - return AliMpPad::Invalid(); - } + if ( localIndices < 0 ) + { + if (warning) + { + AliWarning(Form("The pad number %d doesn't exists", + manuChannel)); + } + return AliMpPad::Invalid(); + } - return AliMpPad(location, + return AliMpPad(manuId, manuChannel, motifPos->GlobalIndices(localIndices), motifPos->Position() + motif->PadPositionLocal(localIndices) - fkSlat->Position(), - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //_____________________________________________________________________________ AliMpPad -AliMpSlatSegmentation::PadByIndices(const AliMpIntPair& indices, +AliMpSlatSegmentation::PadByIndices(Int_t ix, Int_t iy, Bool_t warning) const { /// @@ -263,39 +250,38 @@ AliMpSlatSegmentation::PadByIndices(const AliMpIntPair& indices, /// is exactly as the one in AliMpSectorSegmentation. /// See if we can merge them somehow. - AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(indices.GetFirst(), - indices.GetSecond()); + AliMpMotifPosition* motifPos = fkSlat->FindMotifPosition(ix,iy); + if (!motifPos) - { - if ( warning ) - { - AliWarning(Form("No motif found containing pad location (%d,%d)", - indices.GetFirst(),indices.GetSecond())); - } - return AliMpPad::Invalid(); - } + { + if ( warning ) + { + AliWarning(Form("No motif found containing pad location (%d,%d)",ix,iy)); + } + return AliMpPad::Invalid(); + } AliMpVMotif* motif = motifPos->GetMotif(); AliMpMotifType* motifType = motif->GetMotifType(); - AliMpIntPair localIndices(indices-motifPos->GetLowIndicesLimit()); - AliMpConnection* connection = motifType->FindConnectionByLocalIndices(localIndices); + MpPair_t localIndices = AliMp::Pair(ix,iy) - motifPos->GetLowIndicesLimit(); + AliMpConnection* connection + = motifType->FindConnectionByLocalIndices(localIndices); if (!connection) - { - if ( warning ) - { - AliWarning(Form("No connection for pad location (%d,%d)", - indices.GetFirst(),indices.GetSecond())); + { + if ( warning ) + { + AliWarning(Form("No connection for pad location (%d,%d)",ix,iy)); } return AliMpPad::Invalid(); - } - - return AliMpPad(AliMpIntPair(motifPos->GetID(),connection->GetManuChannel()), - indices, + } + + return AliMpPad(motifPos->GetID(),connection->GetManuChannel(), + ix, iy, motifPos->Position() + motif->PadPositionLocal(localIndices) - fkSlat->Position(), - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //_____________________________________________________________________________ @@ -331,8 +317,7 @@ AliMpSlatSegmentation::PadByPosition(const TVector2& position, AliMpVMotif* motif = motifPos->GetMotif(); blPos -= motifPos->Position(); - AliMpIntPair localIndices - = motif->PadIndicesLocal(blPos); + MpPair_t localIndices = motif->PadIndicesLocal(blPos); AliMpConnection* connect = motif->GetMotifType()->FindConnectionByLocalIndices(localIndices); @@ -341,19 +326,19 @@ AliMpSlatSegmentation::PadByPosition(const TVector2& position, { if (warning) { - AliWarning(Form("Slat %s localIndices (%d,%d) outside motif %s limits", - fkSlat->GetID(),localIndices.GetFirst(), - localIndices.GetSecond(),motif->GetID().Data())); + AliWarning(Form("Slat %s localIndices (%d,%d) outside motif %s limits", + fkSlat->GetID(),AliMp::PairFirst(localIndices), + AliMp::PairSecond(localIndices),motif->GetID().Data())); } return AliMpPad::Invalid(); } - return AliMpPad(AliMpIntPair(motifPos->GetID(),connect->GetManuChannel()), + return AliMpPad(motifPos->GetID(),connect->GetManuChannel(), motifPos->GlobalIndices(localIndices), motifPos->Position() + motif->PadPositionLocal(localIndices) - fkSlat->Position(), - motif->GetPadDimensions(localIndices)); + motif->GetPadDimensionsByIndices(localIndices)); } //_____________________________________________________________________________ @@ -385,27 +370,26 @@ AliMpSlatSegmentation::Slat() const //_____________________________________________________________________________ Bool_t -AliMpSlatSegmentation::HasPadByIndices(const AliMpIntPair& indices) const +AliMpSlatSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const { /// Tell whether we have a pad at indices=(ix,iy) - AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(indices.GetFirst(), - indices.GetSecond()); + AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(ix, iy); - if (motifPos) return motifPos->HasPadByIndices(indices); + if (motifPos) return motifPos->HasPadByIndices(AliMp::Pair(ix, iy)); return kFALSE; } //_____________________________________________________________________________ Bool_t -AliMpSlatSegmentation::HasPadByLocation(const AliMpIntPair& location) const +AliMpSlatSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const { /// Tell whether we have a pad at location=(manuId,manuChannel) - AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(location.GetFirst()); + AliMpMotifPosition* motifPos = Slat()->FindMotifPosition(manuId); - if ( motifPos ) return motifPos->HasPadByManuChannel(location.GetSecond()); + if ( motifPos ) return motifPos->HasPadByManuChannel(manuChannel); return kFALSE; } diff --git a/MUON/mapping/AliMpSlatSegmentation.h b/MUON/mapping/AliMpSlatSegmentation.h index 01af41c99cb..cb51d1a4f96 100644 --- a/MUON/mapping/AliMpSlatSegmentation.h +++ b/MUON/mapping/AliMpSlatSegmentation.h @@ -50,16 +50,14 @@ class AliMpSlatSegmentation : public AliMpVSegmentation const char* GetName() const; - Bool_t HasPad(const AliMpIntPair& indices) const; - Int_t MaxPadIndexX() const; Int_t MaxPadIndexY() const; Int_t NofPads() const; - virtual AliMpPad PadByLocation(const AliMpIntPair& location, + virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const; - virtual AliMpPad PadByIndices(const AliMpIntPair& indices, + virtual AliMpPad PadByIndices(Int_t ix, Int_t iy, Bool_t warning) const; virtual AliMpPad PadByPosition(const TVector2& position, @@ -77,9 +75,9 @@ class AliMpSlatSegmentation : public AliMpVSegmentation TVector2 Dimensions() const; - virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const; + virtual Bool_t HasPadByIndices(Int_t ix, Int_t iy) const; - virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const; + virtual Bool_t HasPadByLocation(Int_t manuId, Int_t manuChannel) const; virtual Int_t GetNofElectronicCards() const; diff --git a/MUON/mapping/AliMpTriggerSegmentation.cxx b/MUON/mapping/AliMpTriggerSegmentation.cxx index 9e8f2f8e568..01d50c2e4aa 100644 --- a/MUON/mapping/AliMpTriggerSegmentation.cxx +++ b/MUON/mapping/AliMpTriggerSegmentation.cxx @@ -77,7 +77,7 @@ AliMpTriggerSegmentation::AliMpTriggerSegmentation( { for ( Int_t iy = 0; iy <= MaxPadIndexY(); ++iy ) { - if ( HasPad(AliMpIntPair(ix,iy)) ) + if ( HasPadByIndices(ix,iy) ) { ++fNofStrips; } @@ -164,18 +164,6 @@ AliMpTriggerSegmentation::GetName() const return name.Data(); } -//_____________________________________________________________________________ -Bool_t -AliMpTriggerSegmentation::HasPad(const AliMpIntPair& indices) const -{ - /// - /// Test if this slat has a pad located at the position referenced - /// by the integer indices. - /// - - return PadByIndices(indices,kFALSE) != AliMpPad::Invalid(); -} - //_____________________________________________________________________________ Int_t AliMpTriggerSegmentation::MaxPadIndexX() const @@ -200,7 +188,7 @@ AliMpTriggerSegmentation::MaxPadIndexY() const //_____________________________________________________________________________ AliMpPad -AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location, +AliMpTriggerSegmentation::PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const { /// @@ -212,33 +200,31 @@ AliMpTriggerSegmentation::PadByLocation(const AliMpIntPair& location, /// AliMpPad::Invalid() is returned if there's no pad at the given location. /// AliMpPad pad; - AliMpIntPair invloc; for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) { AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i); - AliMpPad pi = seg->PadByLocation(location,kFALSE); + AliMpPad pi = seg->PadByLocation(manuId,manuChannel,kFALSE); if ( pi.IsValid() ) { if ( !pad.IsValid() ) { // uses PadByIndices to get the complete list of locations - return PadByIndices(pi.GetIndices(),warning); + return PadByIndices(pi.GetIx(), pi.GetIy(), warning); } } } if ( warning && !pad.IsValid() ) { - AliWarning(Form("No pad found at location (%d,%d)",location.GetFirst(), - location.GetSecond())); + AliWarning(Form("No pad found at location (%d,%d)", manuId, manuChannel)); } return pad; } //_____________________________________________________________________________ AliMpPad -AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices, - Bool_t warning) const +AliMpTriggerSegmentation::PadByIndices(Int_t ix, Int_t iy, + Bool_t warning) const { /// /// Returns the pad specified by its integer indices. @@ -250,29 +236,29 @@ AliMpTriggerSegmentation::PadByIndices(const AliMpIntPair& indices, /// AliMpPad pad; - AliMpIntPair invloc; - + for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) { AliMpVSegmentation* seg = fkSlat->GetLayerSegmentation(i); - AliMpPad pi = seg->PadByIndices(indices,kFALSE); + AliMpPad pi = seg->PadByIndices(ix,iy,kFALSE); if ( pi.IsValid() ) { if ( !pad.IsValid() ) { - pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions()); - pad.AddLocation(pi.GetLocation()); + pad = AliMpPad(0, 0, + pi.GetIndices(), + pi.Position(),pi.Dimensions()); + pad.AddLocation(pi.GetManuId(), pi.GetManuChannel()); } else { - pad.AddLocation(pi.GetLocation()); + pad.AddLocation(pi.GetManuId(), pi.GetManuChannel()); } } } if ( warning && !pad.IsValid() ) { - AliWarning(Form("No pad found at indices (%d,%d)",indices.GetFirst(), - indices.GetSecond())); + AliWarning(Form("No pad found at indices (%d,%d)",ix, iy)); } return pad; @@ -291,7 +277,6 @@ AliMpTriggerSegmentation::PadByPosition(const TVector2& position, /// AliMpPad::Invalid() is returned if there's no pad at the given location. /// AliMpPad pad; - AliMpIntPair invloc; for ( Int_t i = 0; i < fkSlat->GetSize(); ++i ) { @@ -301,12 +286,14 @@ AliMpTriggerSegmentation::PadByPosition(const TVector2& position, { if ( !pad.IsValid() ) { - pad = AliMpPad(invloc,pi.GetIndices(),pi.Position(),pi.Dimensions()); - pad.AddLocation(pi.GetLocation()); + pad = AliMpPad(0, 0, + pi.GetIndices(), + pi.Position(),pi.Dimensions()); + pad.AddLocation(pi.GetManuId(), pi.GetManuChannel()); } else { - pad.AddLocation(pi.GetLocation()); + pad.AddLocation(pi.GetManuId(), pi.GetManuChannel()); } } } diff --git a/MUON/mapping/AliMpTriggerSegmentation.h b/MUON/mapping/AliMpTriggerSegmentation.h index b02b6321292..e2626ce9bfa 100644 --- a/MUON/mapping/AliMpTriggerSegmentation.h +++ b/MUON/mapping/AliMpTriggerSegmentation.h @@ -43,16 +43,14 @@ public: Bool_t includeVoid=kFALSE) const; const char* GetName() const; - Bool_t HasPad(const AliMpIntPair& indices) const; - Int_t MaxPadIndexX() const; Int_t MaxPadIndexY() const; Int_t NofPads() const { return fNofStrips; } - virtual AliMpPad PadByLocation(const AliMpIntPair& location, + virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, Bool_t warning) const; - virtual AliMpPad PadByIndices(const AliMpIntPair& indices, + virtual AliMpPad PadByIndices(Int_t ix, Int_t iy, Bool_t warning) const; virtual AliMpPad PadByPosition(const TVector2& position, diff --git a/MUON/mapping/AliMpVIndexed.cxx b/MUON/mapping/AliMpVIndexed.cxx index a069e976e79..4d2313b1650 100755 --- a/MUON/mapping/AliMpVIndexed.cxx +++ b/MUON/mapping/AliMpVIndexed.cxx @@ -31,21 +31,13 @@ ClassImp(AliMpVIndexed) /// \endcond -//_____________________________________________________________________________ -AliMpVIndexed::AliMpVIndexed(const AliMpIntPair& lowLimit, - const AliMpIntPair& highLimit) - : TObject(), - fLowIndicesLimit(lowLimit), - fHighIndicesLimit(highLimit) -{ -/// Standard constructor -} - //_____________________________________________________________________________ AliMpVIndexed::AliMpVIndexed() : TObject(), - fLowIndicesLimit(AliMpIntPair::Invalid()), - fHighIndicesLimit(AliMpIntPair::Invalid()) + fLowLimit(0), + fHighLimit(0), + fLowValid(false), + fHighValid(false) { /// Default constructor } @@ -56,25 +48,87 @@ AliMpVIndexed::~AliMpVIndexed() /// Destructor } - //_____________________________________________________________________________ -AliMpIntPair AliMpVIndexed::GlobalIndices(const AliMpIntPair& localIndices) const +MpPair_t AliMpVIndexed::GlobalIndices(MpPair_t localIndices) const { /// Return the global indices corresponding to the given local indices. - return GetLowIndicesLimit()+localIndices; + return fLowLimit + localIndices; +} + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GlobalIx(Int_t localIx) const +{ +/// Return the global indices ix corresponding to the given local indices + + return GetLowLimitIx() + localIx; +} + + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GlobalIy(Int_t localIy) const +{ +/// Return the global indices iy corresponding to the given local indices + + return GetLowLimitIy() + localIy; +} + +//_____________________________________________________________________________ +void AliMpVIndexed::SetLowIndicesLimit(MpPair_t limit, Bool_t valid) +{ +/// Set low indices limit + + fLowLimit = limit; + fLowValid = valid ; +} + +//_____________________________________________________________________________ +void AliMpVIndexed::SetLowIndicesLimit(Int_t ix, Int_t iy, Bool_t valid) +{ +/// Set low indices limit + + fLowLimit = AliMp::Pair(ix, iy); + fLowValid = valid; +} + +//_____________________________________________________________________________ +void AliMpVIndexed::SetHighIndicesLimit(MpPair_t limit, Bool_t valid) +{ +/// Set high indices limit + + fHighLimit = limit; + fHighValid = valid ; +} + +//_____________________________________________________________________________ +void AliMpVIndexed::SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid) +{ +/// Set high indices limit + fHighLimit = AliMp::Pair(ix, iy); + fHighValid = valid; } //_____________________________________________________________________________ -Bool_t AliMpVIndexed::HasIndices(const AliMpIntPair& indices) const +Bool_t AliMpVIndexed::HasIndices(MpPair_t indices) const +{ +/// Return true in the specified indices are within the limits. + + return ( AliMp::PairFirst(indices) >= GetLowLimitIx() && + AliMp::PairSecond(indices) >= GetLowLimitIy() && + AliMp::PairFirst(indices) <= GetHighLimitIx() && + AliMp::PairSecond(indices) <= GetHighLimitIy() ); +} + +//_____________________________________________________________________________ +Bool_t AliMpVIndexed::HasIndices(Int_t ix, Int_t iy) const { /// Return true in the specified indices are within the limits. - return (indices.GetFirst() >= fLowIndicesLimit.GetFirst() && - indices.GetSecond() >= fLowIndicesLimit.GetSecond() && - indices.GetFirst() <= fHighIndicesLimit.GetFirst() && - indices.GetSecond() <= fHighIndicesLimit.GetSecond() ); + return (ix >= GetLowLimitIx() && + iy >= GetLowLimitIy() && + ix <= GetHighLimitIx() && + iy <= GetHighLimitIy() ); } //_____________________________________________________________________________ @@ -82,8 +136,85 @@ Bool_t AliMpVIndexed::HasValidIndices() const { /// Returns true if both indices limits have valid values. - return (fLowIndicesLimit.IsValid() && fHighIndicesLimit.IsValid() ); + return ( fLowValid && fHighValid ); } +//_____________________________________________________________________________ +MpPair_t AliMpVIndexed::GetLowIndicesLimit() const +{ +/// Return low indices limit + + // if ( ! fLowValid ) return 0; + + return fLowLimit; +} + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GetLowLimitIx() const +{ +/// Return low indices ix limit + + // if ( ! fLowValid ) return 0; + + return AliMp::PairFirst(fLowLimit); +} + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GetLowLimitIy() const +{ +/// Return low indices iy limit + + // if ( ! fLowValid ) return 0; + + return AliMp::PairSecond(fLowLimit); +} + +//_____________________________________________________________________________ +Bool_t AliMpVIndexed::IsLowLimitValid() const +{ +/// Return true, if low indices limit is set + + return fLowValid; +} + +//_____________________________________________________________________________ +MpPair_t AliMpVIndexed::GetHighIndicesLimit() const +{ +/// Return high indices limit + + // if ( ! fHighValid ) return 0; + + return fHighLimit; +} + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GetHighLimitIx() const +{ +/// Return high indices ix limit + + // if ( ! fHighValid ) return 0; + + return AliMp::PairFirst(fHighLimit); +} + +//_____________________________________________________________________________ +Int_t AliMpVIndexed::GetHighLimitIy() const +{ +/// Return high indices iy limit + + // if ( ! fHighValid ) return 0; + + return AliMp::PairSecond(fHighLimit); +} + +//_____________________________________________________________________________ +Bool_t AliMpVIndexed::IsHighLimitValid() const +{ +/// Return true, if high indices limit is set + + return fHighValid; +} + + diff --git a/MUON/mapping/AliMpVIndexed.h b/MUON/mapping/AliMpVIndexed.h index 9d81452beae..015af2a1a38 100755 --- a/MUON/mapping/AliMpVIndexed.h +++ b/MUON/mapping/AliMpVIndexed.h @@ -15,56 +15,56 @@ #include -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" class AliMpVPadIterator; class AliMpVIndexed : public TObject { public: - AliMpVIndexed(const AliMpIntPair& lowLimit, const AliMpIntPair& highLimit); AliMpVIndexed(); virtual ~AliMpVIndexed(); // methods /// Create iterator over this element virtual AliMpVPadIterator* CreateIterator() const = 0; - virtual AliMpIntPair GlobalIndices(const AliMpIntPair& localIndices) const; + + virtual MpPair_t GlobalIndices(MpPair_t localIndices) const; + virtual Int_t GlobalIx(Int_t localIx) const; + virtual Int_t GlobalIy(Int_t localIy) const; // set methods - void SetLowIndicesLimit(const AliMpIntPair& limit); - void SetHighIndicesLimit(const AliMpIntPair& limit); + void SetLowIndicesLimit(MpPair_t limit, Bool_t valid = true); + void SetLowIndicesLimit(Int_t ix, Int_t iy, Bool_t valid = true); + + void SetHighIndicesLimit(MpPair_t limit, Bool_t valid = true); + void SetHighIndicesLimit(Int_t ix, Int_t iy, Bool_t valid = true); // get methods - Bool_t HasIndices(const AliMpIntPair& indices) const; - Bool_t HasValidIndices() const; - AliMpIntPair GetLowIndicesLimit() const; - AliMpIntPair GetHighIndicesLimit() const; + Bool_t HasIndices(MpPair_t indices) const; + Bool_t HasIndices(Int_t ix, Int_t iy) const; + Bool_t HasValidIndices() const; + + MpPair_t GetLowIndicesLimit() const; + Int_t GetLowLimitIx() const; + Int_t GetLowLimitIy() const; + Bool_t IsLowLimitValid() const; + + MpPair_t GetHighIndicesLimit() const; + Int_t GetHighLimitIx() const; + Int_t GetHighLimitIy() const; + Bool_t IsHighLimitValid() const; + private: // data members - AliMpIntPair fLowIndicesLimit; ///< the lowest global pad indices - AliMpIntPair fHighIndicesLimit; ///< the hihgest global pad indices + MpPair_t fLowLimit; ///< the lowest global pad indices + MpPair_t fHighLimit; ///< the highest global pad indices + Bool_t fLowValid; ///< true, if low indices limit is set + Bool_t fHighValid; ///< true, if high indices imit is set - ClassDef(AliMpVIndexed,1) // A motif position + ClassDef(AliMpVIndexed,2) // A motif position }; -// inline functions - -/// Set low indices limit -inline void AliMpVIndexed::SetLowIndicesLimit(const AliMpIntPair& limit) -{ fLowIndicesLimit = limit; } - -/// Set high indices limit -inline void AliMpVIndexed::SetHighIndicesLimit(const AliMpIntPair& limit) -{ fHighIndicesLimit = limit; } - -/// Return low indices limit -inline AliMpIntPair AliMpVIndexed::GetLowIndicesLimit() const -{ return fLowIndicesLimit; } - -/// Return high indices limit -inline AliMpIntPair AliMpVIndexed::GetHighIndicesLimit() const -{ return fHighIndicesLimit; } #endif //ALI_MP_V_INDEXED_H diff --git a/MUON/mapping/AliMpVMotif.cxx b/MUON/mapping/AliMpVMotif.cxx index 0d85b8cc0a9..eff2e057766 100755 --- a/MUON/mapping/AliMpVMotif.cxx +++ b/MUON/mapping/AliMpVMotif.cxx @@ -28,7 +28,7 @@ #include "AliMpVMotif.h" #include "AliMpMotifType.h" -#include "AliMpIntPair.h" +#include "AliMpEncodePair.h" #include "AliMpConnection.h" #include @@ -71,8 +71,8 @@ AliMpVMotif::FindConnectionByLocalPos(const TVector2& localPos) const /// Return the local indices from the local /// (x,y) position - AliMpIntPair padIndices=PadIndicesLocal(localPos); - if (padIndices.GetFirst()>=0) + MpPair_t padIndices = PadIndicesLocal(localPos); + if ( padIndices > 0 ) return fMotifType->FindConnectionByLocalIndices(padIndices); else return 0; @@ -98,9 +98,8 @@ void AliMpVMotif::Print(Option_t *option) const cout<<"-----------------------------------"<GetNofPadsY()-1;j>=0;j--){ for (Int_t i=0;iGetNofPadsX();i++){ - AliMpIntPair indices = AliMpIntPair(i,j); - if (fMotifType->FindConnectionByLocalIndices(indices)){ - TVector2 pos = PadPositionLocal(indices); + if (fMotifType->FindConnectionByLocalIndices(i,j)){ + TVector2 pos = PadPositionLocal(i,j); cout<Print(option); } - +/* +//_____________________________________________________________________________ +void AliMpVMotif::PadLIndicesLocal(const TVector2& localPos, + Int_t& ixLocal, Int_t& iyLocal) const +{ + /// Fill the pad indices ix from a given local position + /// or (-1,-1) if this position doesn't correspond to any valid + /// connection + + MpPair_t indices = PadIndicesLocal(localPos); + + if ( indices < 0 ) { + ixLocal = -1; + iyLocal = -1; + } + else { + ixLocal = AliMp::PairFirst(indices); + iyLocal = AliMp::PairSecond(indices); + } +} +*/ diff --git a/MUON/mapping/AliMpVMotif.h b/MUON/mapping/AliMpVMotif.h index 6bdaf9b7c6e..d19726d42cc 100755 --- a/MUON/mapping/AliMpVMotif.h +++ b/MUON/mapping/AliMpVMotif.h @@ -13,13 +13,14 @@ #ifndef ALI_MP_V_MOTIF_H #define ALI_MP_V_MOTIF_H +#include "AliMpEncodePair.h" + #include #include #include class AliMpMotifType; class AliMpConnection; -class AliMpIntPair; class AliMpVMotif : public TObject { @@ -36,7 +37,9 @@ class AliMpVMotif : public TObject /// Return the i-th pad dimensions virtual TVector2 GetPadDimensions(Int_t i) const=0; /// Return the dimensions of the pad specified by localIndices - virtual TVector2 GetPadDimensions(const AliMpIntPair& localIndices) const=0; + virtual TVector2 GetPadDimensionsByIndices(MpPair_t localIndices) const=0; + /// Return the dimensions of the pad specified by localIndices + virtual TVector2 GetPadDimensionsByIndices(Int_t ixLocal, Int_t iyLocal) const=0; // Geometry /// Return dimensions @@ -46,9 +49,11 @@ class AliMpVMotif : public TObject AliMpConnection *FindConnectionByLocalPos(const TVector2& localPos) const; virtual void Print(Option_t *option) const; /// Return local position of the pad specified by local indices - virtual TVector2 PadPositionLocal(const AliMpIntPair& localIndices) const=0; + virtual TVector2 PadPositionLocal(MpPair_t localIndices) const=0; + /// Return local position of the pad specified by local indices + virtual TVector2 PadPositionLocal(Int_t ixLocal, Int_t iyLocal) const=0; /// Return local indices of the pad specified by local position - virtual AliMpIntPair PadIndicesLocal(const TVector2& localPos) const=0; + virtual MpPair_t PadIndicesLocal(const TVector2& localPos) const=0; private: /// Not implemented diff --git a/MUON/mapping/AliMpVRowSegment.h b/MUON/mapping/AliMpVRowSegment.h index ab3f7a0ba7f..b818300a1cd 100755 --- a/MUON/mapping/AliMpVRowSegment.h +++ b/MUON/mapping/AliMpVRowSegment.h @@ -19,7 +19,6 @@ class AliMpRow; class AliMpVMotif; -class AliMpIntPair; class AliMpVRowSegment : public AliMpVIndexed { @@ -70,8 +69,7 @@ class AliMpVRowSegment : public AliMpVIndexed /// Set global indices limits. virtual void SetGlobalIndices(AliMpRow* rowBefore) = 0; /// Set global indices to i-th motif position and returns next index in x. - virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) = 0; + virtual Int_t SetIndicesToMotifPosition(Int_t i, MpPair_t indices) = 0; // // get methods diff --git a/MUON/mapping/AliMpVRowSegmentSpecial.cxx b/MUON/mapping/AliMpVRowSegmentSpecial.cxx index e3c4f40c429..004e3773b1d 100644 --- a/MUON/mapping/AliMpVRowSegmentSpecial.cxx +++ b/MUON/mapping/AliMpVRowSegmentSpecial.cxx @@ -127,35 +127,38 @@ AliMpVRowSegmentSpecial::FindPadRowSegment(Int_t motifPositionId) const } //______________________________________________________________________________ -AliMpIntPair +MpPair_t AliMpVRowSegmentSpecial::FindRelativeLowIndicesOf(Int_t motifPositionId) const { /// Return the lowest pad indices where the motif of the given position ID /// exist in this segment. - AliMpIntPair ans(0,1000); - AliMpIntPair ans0 = ans; + Int_t ans0Ix = 0; + Int_t ans0Iy = 1000; + Int_t ansIx = 0; + Int_t ansIy = 1000; + Int_t maxNofPadsX=0; for (Int_t i=0; iGetNofPadRowSegments(); j++) { + for ( Int_t j=0; jGetNofPadRowSegments(); j++ ) { AliMpVPadRowSegment* padRowSegment = padRow->GetPadRowSegment(j); nofPadsX += padRowSegment->GetNofPads(); if (padRowSegment->GetMotifPositionId() == motifPositionId) { - if (ans.GetFirst() < nofPadsX) ans.SetFirst(nofPadsX); - if (ans.GetSecond()>i) ans.SetSecond(i); - // ans.First = max (nof pads of this pos ID) - // ans.Second = min of pad row number + if ( ansIx < nofPadsX ) ansIx = nofPadsX; + if ( ansIy >i ) ansIy = i; + // ansIx = max (nof pads of this pos ID) + // ansIy = min of pad row number } } - if (nofPadsX > maxNofPadsX) maxNofPadsX = nofPadsX; + if ( nofPadsX > maxNofPadsX ) maxNofPadsX = nofPadsX; } - if (ans == ans0) return AliMpIntPair::Invalid(); + if ( ansIx == ans0Ix && ansIy == ans0Iy ) return -1; - return AliMpIntPair(maxNofPadsX-ans.GetFirst(), ans.GetSecond()); + return AliMp::Pair(maxNofPadsX-ansIx, ansIy); } //______________________________________________________________________________ diff --git a/MUON/mapping/AliMpVRowSegmentSpecial.h b/MUON/mapping/AliMpVRowSegmentSpecial.h index 7e6c0c20b82..b97a6cf8366 100644 --- a/MUON/mapping/AliMpVRowSegmentSpecial.h +++ b/MUON/mapping/AliMpVRowSegmentSpecial.h @@ -24,7 +24,6 @@ class AliMpRow; class AliMpPadRow; class AliMpVPadRowSegment; -class AliMpIntPair; class AliMpVRowSegmentSpecial : public AliMpVRowSegment { @@ -70,8 +69,7 @@ class AliMpVRowSegmentSpecial : public AliMpVRowSegment /// Set global indices limits. virtual void SetGlobalIndices(AliMpRow* rowBefore) = 0; /// Set global indices to i-th motif position and returns next index in x. - virtual Int_t SetIndicesToMotifPosition(Int_t i, - const AliMpIntPair& indices) = 0; + virtual Int_t SetIndicesToMotifPosition(Int_t i, MpPair_t indices) = 0; // // get methods @@ -87,7 +85,7 @@ class AliMpVRowSegmentSpecial : public AliMpVRowSegment virtual TVector2 MotifCenterSlow(Int_t motifPositionId) const = 0; AliMpPadRow* FindPadRow(Double_t y) const; AliMpVPadRowSegment* FindPadRowSegment(Int_t motifPositionId) const; - AliMpIntPair FindRelativeLowIndicesOf(Int_t motifPositionId) const; + MpPair_t FindRelativeLowIndicesOf(Int_t motifPositionId) const; Int_t MaxNofPadsInRow() const; Bool_t HasMotif(const AliMpVMotif* motif) const; diff --git a/MUON/mapping/AliMpVSegmentation.cxx b/MUON/mapping/AliMpVSegmentation.cxx index 24fecd72754..9b501487c1c 100644 --- a/MUON/mapping/AliMpVSegmentation.cxx +++ b/MUON/mapping/AliMpVSegmentation.cxx @@ -57,21 +57,6 @@ AliMpVSegmentation::~AliMpVSegmentation() /// Destructor } -//_____________________________________________________________________________ -AliMpPadPair AliMpVSegmentation::FindPads(const TVector2& position1, - const TVector2& position2) const -{ -/// Return a pair of pads with specified position. -/// If both pads are identical, the second pad in pair is set to invalid. - - AliMpPad pad1 = PadByPosition(position1, false); - AliMpPad pad2 = PadByPosition(position2, false); - - if (pad1 == pad2) pad2 = AliMpPad::Invalid(); - - return AliMpPadPair(pad1, pad2); -} - //_____________________________________________________________________________ Int_t AliMpVSegmentation::GetNeighbours(const AliMpPad& pad, @@ -184,93 +169,24 @@ AliMpVSegmentation::GetNeighbours(const AliMpPad& pad, // public methods // -//_____________________________________________________________________________ -AliMpPadPair AliMpVSegmentation::PadsUp(const AliMpPad& pad) const -{ -/// Return a pair of pads neighbouring up to the specified pad. -/// If there is only one neighbouring pad, -/// the second pad in pair is invalid. - - TVector2 position1 - = pad.Position()+ TVector2((-1.)*AliMpConstants::LengthStep(), - pad.Dimensions().Y()+ AliMpConstants::LengthStep()); - TVector2 position2 - = pad.Position()+ TVector2(AliMpConstants::LengthStep(), - pad.Dimensions().Y()+ AliMpConstants::LengthStep()); - - return FindPads(position1, position2); -} - -//_____________________________________________________________________________ -AliMpPadPair AliMpVSegmentation::PadsDown(const AliMpPad& pad) const -{ -/// Return a pair of pads neighbouring down to the specified pad. -/// If there is only one neighbouring pad, -/// the second pad in pair is invalid. - - TVector2 position1 - = pad.Position()- TVector2(AliMpConstants::LengthStep(), - pad.Dimensions().Y()+ AliMpConstants::LengthStep()); - - TVector2 position2 - = pad.Position()- TVector2((-1.)*AliMpConstants::LengthStep(), - pad.Dimensions().Y()+ AliMpConstants::LengthStep()); - - return FindPads(position1, position2); -} - -//_____________________________________________________________________________ -AliMpPadPair AliMpVSegmentation::PadsLeft(const AliMpPad& pad) const -{ -/// Return a pair of pads neighbouring left to the specified pad. -/// If there is only one neighbouring pad, -/// the second in pair is invalid. - - TVector2 position1 - = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), - AliMpConstants::LengthStep()); - TVector2 position2 - = pad.Position() - TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), - (-1.)*AliMpConstants::LengthStep()); - - return FindPads(position1, position2); -} - -//_____________________________________________________________________________ -AliMpPadPair AliMpVSegmentation::PadsRight(const AliMpPad& pad) const -{ -/// Return a pair of pads neighbouring right to the specified pad. -/// If there is only one neighbouring pad, -/// the second in pair is invalid. - - TVector2 position1 - = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), - (-1.)*AliMpConstants::LengthStep()); - TVector2 position2 - = pad.Position() + TVector2(pad.Dimensions().X() + AliMpConstants::LengthStep(), - AliMpConstants::LengthStep()); - - return FindPads(position1, position2); -} - //_____________________________________________________________________________ Bool_t -AliMpVSegmentation::HasPadByIndices(const AliMpIntPair& indices) const +AliMpVSegmentation::HasPadByIndices(Int_t ix, Int_t iy) const { /// Default implementation. Must be overwritten if can be made more /// efficient in the child class - return (PadByIndices(indices,kFALSE) != AliMpPad::Invalid()); + return ( PadByIndices(ix, iy, kFALSE) != AliMpPad::Invalid() ); } //_____________________________________________________________________________ Bool_t -AliMpVSegmentation::HasPadByLocation(const AliMpIntPair& location) const +AliMpVSegmentation::HasPadByLocation(Int_t manuId, Int_t manuChannel) const { /// Default implementation. Must be overwritten if can be made more /// efficient in the child class - return (PadByLocation(location,kFALSE) != AliMpPad::Invalid()); + return (PadByLocation(manuId, manuChannel, kFALSE) != AliMpPad::Invalid()); } //_____________________________________________________________________________ diff --git a/MUON/mapping/AliMpVSegmentation.h b/MUON/mapping/AliMpVSegmentation.h index 52f7cb1699a..244b689b835 100644 --- a/MUON/mapping/AliMpVSegmentation.h +++ b/MUON/mapping/AliMpVSegmentation.h @@ -20,13 +20,11 @@ #include -#include "AliMpPadPair.h" #include "AliMpPad.h" #include "AliMpPlaneType.h" #include "AliMpStationType.h" class AliMpVPadIterator; -class AliMpIntPair; class AliMpArea; class AliMpMotifPosition; @@ -58,30 +56,21 @@ class AliMpVSegmentation : public TObject Bool_t includeVoid=kFALSE) const = 0; /// Find pad by location - virtual AliMpPad PadByLocation(const AliMpIntPair& location, - Bool_t warning = true) const = 0; + virtual AliMpPad PadByLocation(Int_t manuId, Int_t manuChannel, + Bool_t warning = true) const = 0; /// Find pad by indices - virtual AliMpPad PadByIndices (const AliMpIntPair& indices, + virtual AliMpPad PadByIndices (Int_t ix, Int_t iy, Bool_t warning = true) const = 0; /// Find pad by position virtual AliMpPad PadByPosition(const TVector2& position, Bool_t warning = true) const = 0; - - virtual AliMpPadPair PadsUp(const AliMpPad& pad) const; - virtual AliMpPadPair PadsDown(const AliMpPad& pad) const; - virtual AliMpPadPair PadsLeft(const AliMpPad& pad) const; - virtual AliMpPadPair PadsRight(const AliMpPad& pad) const; - /// Return true if the pad with given indices exists. /// Compared with the PadByIndices method, this one can generally be implemented /// faster, as one does not have to create an AliMpPad object... - virtual Bool_t HasPadByIndices(const AliMpIntPair& indices) const; + virtual Bool_t HasPadByIndices(Int_t ix, Int_t iy) const; /// Return true if the pad with given location exists - virtual Bool_t HasPadByLocation(const AliMpIntPair& location) const; - - /// For backward compatibility - virtual Bool_t HasPad(const AliMpIntPair& indices) const { return HasPadByIndices(indices); } + virtual Bool_t HasPadByLocation(Int_t manuId, Int_t manuChannel) const; /// Return maximum pad index in X direction virtual Int_t MaxPadIndexX() const = 0; @@ -113,13 +102,8 @@ class AliMpVSegmentation : public TObject /// Return the position of the origine of the detection element virtual TVector2 Position() const = 0; - - - private: - // methods - AliMpPadPair FindPads(const TVector2& position1, - const TVector2& position2) const; + ClassDef(AliMpVSegmentation,1) // Segmentation }; diff --git a/MUON/mapping/macros/testSt12AllIndices.C b/MUON/mapping/macros/testSt12AllIndices.C index 27e1be0d536..f33701a89d1 100644 --- a/MUON/mapping/macros/testSt12AllIndices.C +++ b/MUON/mapping/macros/testSt12AllIndices.C @@ -91,10 +91,9 @@ void testAllIndices(AliMq::Station12Type station, AliMp::PlaneType plane) for ( Int_t gassNum=0; gassNum<64; gassNum++ ) { if (motifPos->GetMotif()->GetMotifType()->FindConnectionByGassiNum(gassNum)){ - AliMpPad pad = segmentation.PadByLocation(AliMpIntPair(motifPos->GetID(),gassNum)); + AliMpPad pad = segmentation.PadByLocation(motifPos->GetID(),gassNum); if (pad != AliMpPad::Invalid()) { - histo->Fill(pad.GetIndices().GetFirst(), - pad.GetIndices().GetSecond()); + histo->Fill(pad.GetIx(), pad.GetIy()); histo2->Fill(pad.Position().X(), pad.Position().Y()); } diff --git a/MUON/mapping/macros/testSt12AnyPadIterators.C b/MUON/mapping/macros/testSt12AnyPadIterators.C index afdd3a34e9e..f82e0882958 100644 --- a/MUON/mapping/macros/testSt12AnyPadIterators.C +++ b/MUON/mapping/macros/testSt12AnyPadIterators.C @@ -18,9 +18,9 @@ #include "AliMpVMotif.h" #include "AliMpVPadIterator.h" #include "AliMpSectorPadIterator.h" -#include "AliMpNeighboursPadIterator.h" #include "AliMpMotifPositionPadIterator.h" #include "AliMpConstants.h" +#include "AliMpEncodePair.h" #include #include @@ -51,18 +51,20 @@ void MarkPads(AliMpVPadIterator& it,Int_t xmax,Int_t ymax,Bool_t print=kTRUE) Int_t num=0; for (it.First(); ! it.IsDone(); it.Next()){ - AliMpIntPair indices = it.CurrentItem().GetIndices(); - if (print) cout<<"Iterator number "<< num << " at "<< indices <Draw(); } } -void testAnyPadIterators(AliMq::Station12Type station, AliMp::PlaneType plane, - Int_t i=50, Int_t j=50) +void testAnyPadIterators(AliMq::Station12Type station, AliMp::PlaneType plane) { AliMpDataProcessor mp; AliMpDataMap* dataMap = mp.CreateDataMap("data"); @@ -91,12 +93,6 @@ void testAnyPadIterators(AliMq::Station12Type station, AliMp::PlaneType plane, else cout << "No motif found at given position..." << endl; - canv->cd(3); - AliMpPad pad = segmentation.PadByIndices(AliMpIntPair(i,j)); - AliMpNeighboursPadIterator itn(&segmentation,pad); - MarkPads(itn,i+8,j+8); - cout<<"________________ Neighbours __________________________"<cd(4); Int_t motifPosId = 20 | AliMpConstants::ManuMask(plane); if ( plane == AliMp::kNonBendingPlane ) motifPosId = 19; diff --git a/MUON/mapping/macros/testSt12ExistingPads.C b/MUON/mapping/macros/testSt12ExistingPads.C index 54b148ae1ec..cbaceff0423 100644 --- a/MUON/mapping/macros/testSt12ExistingPads.C +++ b/MUON/mapping/macros/testSt12ExistingPads.C @@ -71,8 +71,7 @@ void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane) for (Int_t i=0; iHasPad(indices)) histo->Fill(i,j); + if ( segmentation->HasPadByIndices(i,j) ) histo->Fill(i,j); } } @@ -90,8 +89,7 @@ void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane) for (Int_t i=0; iHasPad(indices)) histo2->Fill(i,j); + if ( fast->HasPadByIndices(i,j) ) histo2->Fill(i,j); } } diff --git a/MUON/mapping/macros/testSt12ExistingPads2.C b/MUON/mapping/macros/testSt12ExistingPads2.C index 7e4e7473397..39ab8f2cbb8 100644 --- a/MUON/mapping/macros/testSt12ExistingPads2.C +++ b/MUON/mapping/macros/testSt12ExistingPads2.C @@ -63,20 +63,18 @@ void testExistingPads2(AliMq::Station12Type station, AliMp::PlaneType plane, if ( sector->GetDirection() == AliMp::kX ) for (Int_t i=1; iMaxPadIndexX()+1; i++) { for (Int_t j=1; jMaxPadIndexY()+1; j++) { - AliMpIntPair indices(i,j); - if ( segmentation->HasPad(indices) ) + if ( segmentation->HasPadByIndices(i,j) ) out1 << std::setw(4) << ++counter1 << " " - << segmentation->PadByIndices(indices) << endl;; + << segmentation->PadByIndices(i,j) << endl;; } } if ( sector->GetDirection() == AliMp::kY ) for (Int_t j=1; jMaxPadIndexY()+1; j++) { for (Int_t i=1; iMaxPadIndexX()+1; i++) { - AliMpIntPair indices(i,j); - if ( segmentation->HasPad(indices) ) + if ( segmentation->HasPadByIndices(i,j) ) out1 << std::setw(4) << ++counter1 << " " - << segmentation->PadByIndices(indices) << endl;; + << segmentation->PadByIndices(i,j) << endl;; } } diff --git a/MUON/mapping/macros/testSt12IndicesLimits.C b/MUON/mapping/macros/testSt12IndicesLimits.C index 440e0803e55..4e569e9e662 100644 --- a/MUON/mapping/macros/testSt12IndicesLimits.C +++ b/MUON/mapping/macros/testSt12IndicesLimits.C @@ -18,6 +18,7 @@ #include "AliMpMotifMap.h" #include "AliMpMotifPosition.h" #include "AliMpMotifType.h" +#include "AliMpEncodePair.h" #include #include @@ -39,19 +40,19 @@ void testIndicesLimits(AliMq::Station12Type station,AliMp::PlaneType plane) // Loop over rows for (Int_t i=0; iGetNofRows(); i++) { AliMpRow* row = sector->GetRow(i); - cout << i - << "th row limits: " - << row->GetLowIndicesLimit() << " " - << row->GetHighIndicesLimit() << endl; - + + cout << i << "th row limits: "; + AliMp::PairPut(cout, row->GetLowIndicesLimit()) << " "; + AliMp::PairPut(cout, row->GetHighIndicesLimit()) << endl; + // Loop over row segments for (Int_t j=0; jGetNofRowSegments(); j++) { AliMpVRowSegment* rowSegment = row->GetRowSegment(j); cout << " " << j - << "th row segment limits: " - << rowSegment->GetLowIndicesLimit() << " " - << rowSegment->GetHighIndicesLimit() << endl; + << "th row segment limits: "; + AliMp::PairPut(cout, rowSegment->GetLowIndicesLimit()) << " "; + AliMp::PairPut(cout, rowSegment->GetHighIndicesLimit()) << endl; // Loop over motif positions for (Int_t k=0; kGetNofMotifs(); k++) { @@ -59,11 +60,11 @@ void testIndicesLimits(AliMq::Station12Type station,AliMp::PlaneType plane) AliMpMotifPosition* mPos = sector->GetMotifMap()->FindMotifPosition(mposID); if (mPos) { - cout << " " - << mPos->GetID() - << " motif position limits: " - << mPos->GetLowIndicesLimit() << " " - << mPos->GetHighIndicesLimit() << endl; + cout << " " + << mPos->GetID() + << " motif position limits: "; + AliMp::PairPut(cout, mPos->GetLowIndicesLimit()) << " "; + AliMp::PairPut(cout, mPos->GetHighIndicesLimit()) << endl; } else { cerr << "Motif position " diff --git a/MUON/mapping/macros/testSt12MotifTypeIterators.C b/MUON/mapping/macros/testSt12MotifTypeIterators.C index ffab3ab09f9..e342f660ba0 100644 --- a/MUON/mapping/macros/testSt12MotifTypeIterators.C +++ b/MUON/mapping/macros/testSt12MotifTypeIterators.C @@ -13,6 +13,7 @@ #include "AliMpMotifReader.h" #include "AliMpMotifType.h" #include "AliMpMotifTypePadIterator.h" +#include "AliMpEncodePair.h" #include #include @@ -115,10 +116,10 @@ void testMotifTypeIterators(AliMq::Station12Type station, AliMp::PlaneType plane AliMpMotifTypePadIterator it = AliMpMotifTypePadIterator(mt); for (it.First(); ! it.IsDone(); it.Next()) { - cout << "Iterator " << num << ' '<< it.CurrentItem().GetIndices() << endl; + cout << "Iterator " << num << ' '; + AliMp::PairPut(cout, it.CurrentItem().GetIndices()) << endl; ++num; - histo->Fill(it.CurrentItem().GetIndices().GetFirst(), - it.CurrentItem().GetIndices().GetSecond(),num); + histo->Fill(it.CurrentItem().GetIx(), it.CurrentItem().GetIy(),num); } //delete mt; diff --git a/MUON/mapping/macros/testSt12PadDimensions.C b/MUON/mapping/macros/testSt12PadDimensions.C index 2f753b695c8..4523dfb03da 100644 --- a/MUON/mapping/macros/testSt12PadDimensions.C +++ b/MUON/mapping/macros/testSt12PadDimensions.C @@ -34,18 +34,17 @@ void testPadDimensions(AliMq::Station12Type station, AliMp::PlaneType plane) for (Int_t i=1; i #include @@ -51,7 +52,7 @@ void testPrintLimits(AliMq::Station12Type station, AliMp::PlaneType plane, AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector); painter->Draw("ZSSMP"); - AliMpIntPair low,high; + Long_t low,high; TVector2 rlow,rhigh; for (Int_t irow=0;irowGetNofRows();irow++){ @@ -65,8 +66,10 @@ void testPrintLimits(AliMq::Station12Type station, AliMp::PlaneType plane, rhigh = TVector2(row->Position().X()+row->Dimensions().X(), row->Position().Y()+row->Dimensions().Y()); out<<"_______________________________________________________________"<("<(" <Position().X()+seg->Dimensions().X(), seg->Position().Y()+seg->Dimensions().Y()); out<<"-----------------------------------------------------------"<("<Position().Y()-motif->Dimensions().Y()); rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(), motifPos->Position().Y()+motif->Dimensions().Y()); - out<<" Motif "<("<Draw(); // fill pads indices in the histogram - histo->Fill(it.CurrentItem().GetIndices().GetFirst(), - it.CurrentItem().GetIndices().GetSecond()); + histo->Fill(it.CurrentItem().GetIx(), it.CurrentItem().GetIy()); } TCanvas* canv2 = CreateTCanvas("canv2 ", " ", station, plane); diff --git a/MUON/mapping/macros/testSt12SectorFind.C b/MUON/mapping/macros/testSt12SectorFind.C index 172da291463..2e71531b8c4 100644 --- a/MUON/mapping/macros/testSt12SectorFind.C +++ b/MUON/mapping/macros/testSt12SectorFind.C @@ -52,7 +52,7 @@ void testSectorFind(AliMq::Station12Type station, AliMp::PlaneType plane) cout<<"Verifying column "< #include @@ -54,11 +55,12 @@ void testSectorPadIterators(AliMq::Station12Type station, AliMp::PlaneType plane AliMpSectorPadIterator it = AliMpSectorPadIterator(sector); for (it.First(); ! it.IsDone(); it.Next()) { - AliMpIntPair indices = it.CurrentItem().GetIndices(); - cout<<"Iterator number "<< num << " at "<< indices <Draw(); } diff --git a/MUON/mapping/macros/timeMapping.C b/MUON/mapping/macros/timeMapping.C index 96a504c7672..c597089bd5c 100644 --- a/MUON/mapping/macros/timeMapping.C +++ b/MUON/mapping/macros/timeMapping.C @@ -85,8 +85,6 @@ // on revision before 31082 (where AliMpVSegmentation did not have the HasPadBy... // methods). -#define HASPAD - //______________________________________________________________________________ Int_t StationId(Int_t detElemId) { @@ -137,12 +135,11 @@ void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId) { for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy ) { - seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + seg->PadByIndices(ix,iy,kFALSE); } } } -#ifdef HASPAD { AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId)); @@ -150,11 +147,10 @@ void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId) { for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy ) { - seg->HasPadByIndices(AliMpIntPair(ix,iy)); + seg->HasPadByIndices(ix,iy); } } } -#endif } //______________________________________________________________________________ @@ -168,20 +164,18 @@ void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId) for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE); + seg->PadByLocation(manuId,manuChannel,kFALSE); } } -#ifdef HASPAD { AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId)); for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - seg->HasPadByLocation(AliMpIntPair(manuId,manuChannel)); + seg->HasPadByLocation(manuId,manuChannel); } } -#endif } diff --git a/MUON/mapping/macros/timeMapping2.C b/MUON/mapping/macros/timeMapping2.C index 6df7aeb9b8f..cb3bcd24e85 100644 --- a/MUON/mapping/macros/timeMapping2.C +++ b/MUON/mapping/macros/timeMapping2.C @@ -33,8 +33,6 @@ // on revision before 31082 (where AliMpVSegmentation did not have the HasPadBy... // methods). -#define HASPAD - //______________________________________________________________________________ Int_t StationId(Int_t detElemId) { @@ -84,12 +82,11 @@ void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId) { for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy ) { - seg->PadByIndices(AliMpIntPair(ix,iy),kFALSE); + seg->PadByIndices(ix,iy,kFALSE); } } } -#ifdef HASPAD { AliCodeTimerAutoGeneral(Form("HasPadByIndices-St%d",stationId)); @@ -97,11 +94,10 @@ void ByIndices(const AliMpVSegmentation* seg, Int_t detElemId) { for ( Int_t iy = 0; iy < seg->MaxPadIndexY(); ++iy ) { - seg->HasPadByIndices(AliMpIntPair(ix,iy)); + seg->HasPadByIndices(ix,iy); } } } -#endif } //______________________________________________________________________________ @@ -115,20 +111,18 @@ void ByLocation(const AliMpVSegmentation* seg, Int_t detElemId, Int_t manuId) for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - seg->PadByLocation(AliMpIntPair(manuId,manuChannel),kFALSE); + seg->PadByLocation(manuId,manuChannel,kFALSE); } } -#ifdef HASPAD { AliCodeTimerAutoGeneral(Form("HasPadByLocation-St%d",stationId)); for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel ) { - seg->HasPadByLocation(AliMpIntPair(manuId,manuChannel)); + seg->HasPadByLocation(manuId,manuChannel); } } -#endif } diff --git a/MUON/mapping/macros/timeMapping2.out b/MUON/mapping/macros/timeMapping2.out index ad67c6dd78f..9f7bfee72c2 100644 --- a/MUON/mapping/macros/timeMapping2.out +++ b/MUON/mapping/macros/timeMapping2.out @@ -1,19 +1,19 @@ I-AliCDBManager::SetDefaultStorage: Setting Default storage to: local://$ALICE_ROOT/OCDB W-AliCDBManager::Get: Run number explicitly set in query: CDB cache temporarily disabled! AliMpDCSNamer - ManuId2PCBIndex R:0.0523s C:0.0600s (9676 slices) - ManuId2Sector R:0.0344s C:0.0400s (7152 slices) + ManuId2PCBIndex R:0.0547s C:0.0500s (9676 slices) + ManuId2Sector R:0.0340s C:0.0400s (7152 slices) AliMpDetElement AddManu - R:1.4517s C:1.4000s (16828 slices) - slat R:0.7501s C:0.7100s (9676 slices) - st12 R:0.5489s C:0.5300s (7152 slices) + R:1.2222s C:1.1300s (16828 slices) + slat R:0.6143s C:0.5500s (9676 slices) + st12 R:0.4522s C:0.4000s (7152 slices) AliMpFastSegmentation AliMpFastSegmentation - AliMpSectorSegmentation R:0.0807s C:0.0800s (4 slices) - AliMpSlatSegmentation R:0.0973s C:0.0500s (38 slices) + AliMpSectorSegmentation R:0.0538s C:0.0400s (4 slices) + AliMpSlatSegmentation R:0.0713s C:0.0600s (38 slices) General - timeMapping2 Load mapping R:2.6892s C:2.6000s (1 slices) + timeMapping2 Load mapping R:2.3564s C:2.2400s (1 slices) ************************************ * Row * pI.fMemRe * sname * ************************************ @@ -21,18 +21,18 @@ General * 1 * 107 * 1 * ************************************ AliMpMotifMap - GetMotifPosition R:0.0658s C:0.1000s (7152 slices) + GetMotifPosition R:0.0664s C:0.0600s (7152 slices) General ByIndices - HasPadByIndices-St12 R:0.1710s C:0.1600s (32 slices) - HasPadByIndices-St345 R:0.1198s C:0.1000s (280 slices) - PadByIndices-St12 R:0.5098s C:0.5000s (32 slices) - PadByIndices-St345 R:0.4567s C:0.4500s (280 slices) + HasPadByIndices-St12 R:0.1396s C:0.1700s (32 slices) + HasPadByIndices-St345 R:0.1047s C:0.1400s (280 slices) + PadByIndices-St12 R:0.3865s C:0.3700s (32 slices) + PadByIndices-St345 R:0.3665s C:0.3100s (280 slices) ByLocation - HasPadByLocation-St12 R:0.0730s C:0.0600s (7152 slices) - HasPadByLocation-St345 R:0.0979s C:0.1100s (9676 slices) - PadByLocation-St12 R:0.3791s C:0.3600s (7152 slices) - PadByLocation-St345 R:0.4947s C:0.4700s (9676 slices) + HasPadByLocation-St12 R:0.0567s C:0.0400s (7152 slices) + HasPadByLocation-St345 R:0.0765s C:0.0500s (9676 slices) + PadByLocation-St12 R:0.2710s C:0.3000s (7152 slices) + PadByLocation-St345 R:0.3558s C:0.3500s (9676 slices) ByPosition - PadByPosition-St12 R:7.0682s C:7.0700s (32 slices) - PadByPosition-St345 R:2.0758s C:2.1200s (280 slices) + PadByPosition-St12 R:6.9957s C:7.0200s (32 slices) + PadByPosition-St345 R:1.6446s C:1.6300s (280 slices) -- 2.43.5