X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=MUON%2Fmapping%2FAliMpMotifReader.cxx;h=d1e8d811c835ac749d0a490366de64f12314fec0;hb=41c1ed99df67265af5f997e9592c9ce7457b853d;hp=e909e8d6205b70d0abfebdc41a88b92f73f06227;hpb=7d5d0cc5e751bdf612fb78ed7cfe55397a79f855;p=u%2Fmrichter%2FAliRoot.git diff --git a/MUON/mapping/AliMpMotifReader.cxx b/MUON/mapping/AliMpMotifReader.cxx index e909e8d6205..d1e8d811c83 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" @@ -99,7 +99,7 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) AliMpMotifType* motifType = new AliMpMotifType(motifTypeId); - PadMapType positions; + TExMap positions; char line[256]; do { @@ -119,14 +119,11 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) int i,j; strline>>i>>j; -#ifdef WITH_STL - positions[key].first=i; - positions[key].second=j; -#endif -#ifdef WITH_ROOT positions.Add( AliMpExMap::GetIndex(key), - AliMpExMap::GetIndex(AliMpIntPair(i,j)) ); -#endif + 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 = @@ -134,6 +131,7 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) // Station1 & 2 Bergstak connectors have 80 pins, while for stations // 3, 4 and 5 they have 100 pins. Int_t gassiChannel[100]; + for (Int_t i=0; i<100; ++i) gassiChannel[i] = 0; while(1) { Int_t bergNum; TString gcStr; @@ -144,6 +142,10 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) Fatal("BuildMotifType","Berg number > 80 ..."); continue; } + if ( bergNum <= 0 || bergNum >= 101 ) { + AliErrorStream() << "Wrong bergNum: " << bergNum << endl; + return 0; + } gassiChannel[bergNum-1]= atoi(gcStr); } @@ -201,21 +203,6 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) gassiNum = gassiChannel[numBerg-1]; -#ifdef WITH_STL - PadMapTypeIterator iter = positions.find(padName); - if (iter==positions.end()) { - AliWarningStream() - << "Problem: Pad number " << padNum - << " for motif type " << motifTypeId.Data() - << " found in the motifType stream, but not in the padPos stream" << endl; - continue; - } - - ix= iter->second.first; - iy= iter->second.second; -#endif - -#ifdef WITH_ROOT Long_t value = positions.GetValue(AliMpExMap::GetIndex(padName)); if (!value) { AliWarningStream() @@ -225,16 +212,19 @@ AliMpMotifType* AliMpMotifReader::BuildMotifType(const TString& motifTypeId) continue; } - ix = AliMpExMap::GetPair(value).GetFirst(); - iy = AliMpExMap::GetPair(value).GetSecond(); - -#endif - AliMpConnection* connection - = new AliMpConnection(padNum,numBerg,numKapton,gassiNum, AliMpIntPair(ix,iy)); + = new AliMpConnection(padNum,numBerg,numKapton,gassiNum, --value); + + Bool_t ok = motifType->AddConnection(connection); - motifType->AddConnection(AliMpIntPair(ix,iy),connection); + if (!ok) + { + 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; @@ -274,7 +264,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,x*scale/2.,y*scale/2.); in >> i; } res->CalculateDimensions();