]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Mapping test macros (D. Guez, I. Hrivnacova)
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2005 05:51:08 +0000 (05:51 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 28 Jan 2005 05:51:08 +0000 (05:51 +0000)
18 files changed:
MUON/mapping/macros/empty.C [new file with mode: 0644]
MUON/mapping/macros/mlibs.C [new file with mode: 0644]
MUON/mapping/macros/testAllIndices.C [new file with mode: 0644]
MUON/mapping/macros/testAnyPadIterators.C [new file with mode: 0644]
MUON/mapping/macros/testExistingPads.C [new file with mode: 0644]
MUON/mapping/macros/testGraphics.C [new file with mode: 0644]
MUON/mapping/macros/testMotifTypeIterators.C [new file with mode: 0644]
MUON/mapping/macros/testNeighboursPadIterator.C [new file with mode: 0644]
MUON/mapping/macros/testPadDimensions.C [new file with mode: 0644]
MUON/mapping/macros/testPadsUpEtc.C [new file with mode: 0644]
MUON/mapping/macros/testPlaneAreaIterator.C [new file with mode: 0644]
MUON/mapping/macros/testPlaneFind.C [new file with mode: 0644]
MUON/mapping/macros/testPrintLimits.C [new file with mode: 0644]
MUON/mapping/macros/testReadMotifType.C [new file with mode: 0644]
MUON/mapping/macros/testReadSector.C [new file with mode: 0644]
MUON/mapping/macros/testSectorFind.C [new file with mode: 0644]
MUON/mapping/macros/testSectorPadIterators.C [new file with mode: 0644]
MUON/mapping/macros/testUpdateGlobalIndices.C [new file with mode: 0644]

diff --git a/MUON/mapping/macros/empty.C b/MUON/mapping/macros/empty.C
new file mode 100644 (file)
index 0000000..03eb769
--- /dev/null
@@ -0,0 +1,7 @@
+// $Id$
+//
+// Empty macro used to override a user defined logoff script.
+
+void empty() 
+{
+}  
diff --git a/MUON/mapping/macros/mlibs.C b/MUON/mapping/macros/mlibs.C
new file mode 100644 (file)
index 0000000..864d2b3
--- /dev/null
@@ -0,0 +1,23 @@
+// $Id$
+//
+// Macro for loading libraries for mapping in AliRoot
+
+void mlibs() 
+{
+  // add include path
+  // gSystem->SetIncludePath(" -I$MINSTALL/include");
+  
+  // set path to mapping
+  if (! gSystem->Getenv("MINSTALL")) {    
+    TString dirPath = gSystem->Getenv("ALICE_ROOT");
+    dirPath += "/MUON/mapping"; 
+    gSystem->Setenv("MINSTALL", dirPath.Data());
+    //cout << "AliMpFiles top path set to " << dirPath << endl;          
+  }
+
+  // load Root libraries
+  gSystem->Load("libPhysics"); 
+  
+  // load mapping library
+  gSystem->Load("libMUONmapping"); 
+}  
diff --git a/MUON/mapping/macros/testAllIndices.C b/MUON/mapping/macros/testAllIndices.C
new file mode 100644 (file)
index 0000000..b2b1430
--- /dev/null
@@ -0,0 +1,61 @@
+// $Id$
+//
+// Test macro for testing which pad is seen as "existing" by AliMpSector.
+
+void testAllIndices() 
+{
+  if (!gInterpreter->IsLoaded("mlibs.C")){ 
+    gROOT->LoadMacro("mlibs.C");
+    gInterpreter->ProcessLine("mlibs()");
+  }  
+
+  AliMpReader r(kStation1, kNonBendingPlane);
+
+  AliMpSector *sector=r.BuildSector();
+  AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+
+  TCanvas* c1 = new TCanvas("view",
+                            "MSectorPainter::Draw() output (view per pad)");
+  painter->Draw("ZSSMP");
+  c1->Update();
+
+  TH2C* histo = new TH2C("histo","Existing pads",90,-0.5,89.5,
+                                                 230,-0.5,229.5);
+  TH2F* histo2 = new TH2F("histo2","Existing positions",950/2,0,950,
+                                                        950/2,0,950);
+  TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
+  TCanvas* c3 = new TCanvas("c3","Positions");
+
+  AliMpSectorSegmentation segmentation(sector);
+  
+  
+  for (Int_t irow=0;irow<sector->GetNofRows();irow++){
+    AliMpRow* row = sector->GetRow(irow);
+    
+    for (Int_t  iseg=0;iseg<row->GetNofRowSegments();iseg++){
+      AliMpVRowSegment* seg = row->GetRowSegment(iseg);
+      
+      for (Int_t imot=0;imot<seg->GetNofMotifs();imot++){
+        AliMpMotifPosition* motifPos 
+         = sector->GetMotifMap()->FindMotifPosition(seg->GetMotifPositionId(imot));
+         
+        for (Int_t gassNum=0;gassNum<64;gassNum++){
+          if (motifPos->GetMotif()->GetMotifType()->FindConnectionByGassiNum(gassNum)){
+          
+            AliMpPad pad = segmentation.PadByLocation(AliMpIntPair(motifPos->GetID(),gassNum));
+            if (pad != AliMpPad::Invalid()) {
+              histo->Fill (pad.GetIndices().GetFirst(),
+                          pad.GetIndices().GetSecond());
+              histo2->Fill(pad.Position().X(),
+                           pad.Position().Y());
+            }
+          }
+        }
+      }
+    }
+  }
+  c2->cd();
+  histo->Draw("col");
+  c3->cd();
+  histo2->Draw("box");
+}
diff --git a/MUON/mapping/macros/testAnyPadIterators.C b/MUON/mapping/macros/testAnyPadIterators.C
new file mode 100644 (file)
index 0000000..4b478c6
--- /dev/null
@@ -0,0 +1,64 @@
+// $Id$
+//
+// Test macro for reading  sector, and iterate over it
+
+class AliMpVPadIterator;
+void MarkPads(AliMpVPadIterator& it,Int_t xmax,Int_t ymax,Bool_t print=kTRUE)
+{
+// This function works with pad iterator, no matter which kind of iterator
+// it is. So it can be uses for drawing all pad of the sector (AliMpSectorPadIterator)
+// or all pad around a given pad (AliMpNeighboursPadIterator), as with pads
+// of a given motif type (AliMpMotifTypePadIterator)
+
+  Int_t num=0;
+
+  for (it.First(); ! it.IsDone(); it.Next()){
+    AliMpIntPair indices = it.CurrentItem().GetIndices();
+    if (print) cout<<"Iterator number "<< num++ << " at "<< indices <<endl;
+    TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax,
+                                   (Double_t)indices.GetSecond()/ymax,
+                                   2);
+    marker->Draw();
+  }
+}
+
+void testAnyPadIterators(AliMpStationType station = kStation1,
+                         AliMpPlaneType plane = kBendingPlane, 
+                         Int_t i=50, Int_t j=50)
+{
+  AliMpReader r(station, plane);
+  AliMpSector* sect = r.BuildSector();
+    
+  TCanvas *canv = new TCanvas("canv");
+  canv->Divide(2,2);
+  //canv_1->Divide(2);
+  
+  canv->cd(1);
+  MarkPads(AliMpSectorPadIterator(sect), 150,250,kFALSE);
+  canv->cd(2);
+  AliMpVMotif* motif = sect->FindMotif(TVector2(200,30));
+
+  if (motif) {
+    AliMpMotifType* motifType = motif->GetMotifType();
+    MarkPads(AliMpMotifTypePadIterator(motifType),15,15);
+    cout<<"______________ MotifType ____________________________"<<endl;
+  } else cout<<"No motif found at given position..."<<endl;
+  
+  canv->cd(3);
+  //MarkPads(*AliMpPadIteratorPtr(AliMpSectorSegmentation(sect)->CreateIterator(AliMpIntPair(i,j)))
+  AliMpSectorSegmentation segm(sect);
+  AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j));
+  MarkPads(AliMpNeighboursPadIterator(&AliMpSectorSegmentation(sect),pad)
+           ,i+8,j+8);
+  cout<<"________________ Neighbours __________________________"<<endl;
+  canv->cd(4);
+  Int_t motifPosId = 1010; 
+  if (plane == kNonBendingPlane) motifPosId = 4010;
+  AliMpMotifPosition* motifPos = sect->GetMotifMap()->FindMotifPosition(motifPosId);
+  if (motifPos){
+    //MarkPads(*AliMpPadIteratorPtr(motifPos->CreateIterator()),15,15);
+    MarkPads(AliMpMotifPositionPadIterator(motifPos),15,15);
+    cout<<"_________________ MotifPosition _________________________"<<endl;
+  }
+
+}
diff --git a/MUON/mapping/macros/testExistingPads.C b/MUON/mapping/macros/testExistingPads.C
new file mode 100644 (file)
index 0000000..a91c819
--- /dev/null
@@ -0,0 +1,33 @@
+// $Id$
+//
+// Test macro for testing which pad is seen as "existing" by AliMpSector.
+
+void testExistingPads(AliMpStationType station = kStation1,
+                      AliMpPlaneType plane = kBendingPlane) 
+{
+  AliMpReader r(station, plane);
+
+  AliMpSector *sector=r.BuildSector();
+  AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+
+  TCanvas* c1 = new TCanvas("view",
+                            "AliMpSectorPainter::Draw() output (view per pad)");
+  painter->Draw("ZSSMP");
+  c1->Update();
+
+  TH2C* histo = new TH2C("histo","Existing pads",150,-0.5,149.5,
+                                               200,-0.5,199.5);
+  TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
+
+  AliMpSectorSegmentation segmentation(sector);
+  for (Int_t i=0; i<150;i++){
+    for (Int_t j=0;j<200;++j){
+
+      AliMpIntPair indices(i,j);
+      if (segmentation.HasPad(indices)) histo->Fill(i,j);
+    }
+  }
+
+  c2->cd();
+  histo->Draw("box");
+}
diff --git a/MUON/mapping/macros/testGraphics.C b/MUON/mapping/macros/testGraphics.C
new file mode 100644 (file)
index 0000000..8bfafe3
--- /dev/null
@@ -0,0 +1,82 @@
+// $Id$
+//
+// Test macro for drawing sector data.
+
+void testGraphics(AliMpStationType station = kStation1,
+                  AliMpPlaneType plane = kBendingPlane) 
+{
+  AliMpReader r(station, plane);
+  AliMpSector *sector=r.BuildSector();
+  AliMpVPainter *painter=AliMpVPainter::CreatePainter(sector);
+
+  TCanvas* canvas = new TCanvas();
+  TCanvas* c[4];
+  for (int i=0;i<4;++i) {
+    c[i] = new TCanvas();
+    c[i]->Divide(2,2);
+  }  
+
+ //first, paint the whole sector
+  canvas->cd();
+  painter->Draw("");
+  //now paint each rows
+  c[0]->cd(1);
+  painter->Draw("R");
+  //paint each row segments in each row
+  c[0]->cd(2);
+  painter->Draw("RS");
+  //paint each motifs, in each row segments in each row
+  c[0]->cd(3);
+  painter->Draw("RSMP");
+  //paint each pads, in each motifs, in each row segments in each row
+  c[0]->cd(4);
+  painter->Draw("RSMT");
+
+  ///////////////////////////////
+  //now paint each rows, wwith its name
+  c[1]->cd(1);
+  painter->Draw("RT");
+  //paint each row segments in each row, and its name
+  c[1]->cd(2);
+  painter->Draw("RST");
+  //paint each motifs, in each row segments in each row
+  c[1]->cd(3);
+  painter->Draw("RSMX");
+  c[1]->cd(4);
+  painter->Draw("RSMI");
+
+  ///////////////////////////////
+  //now paint each zones
+  c[2]->cd(1);
+  painter->Draw("Z");
+  //paint each sub-zones, in each zones
+  c[2]->cd(2);
+  painter->Draw("ZS");
+  //paint each row segments, in each sub-zone, ...
+  c[2]->cd(3);
+  painter->Draw("ZSS");
+  // each motifs, in each row segments, ...
+  c[2]->cd(4);
+  painter->Draw("ZSSM");
+
+  ///////////////////////////////
+  //now paint each zones with its name
+  c[3]->cd(1);
+  painter->Draw("ZT");
+  //paint each sub-zones, in each zones with its name
+  c[3]->cd(2);
+  painter->Draw("ZST");
+  //paint each row segments, in each sub-zone, ... with its name
+  c[3]->cd(3);
+  painter->Draw("ZSST");
+  // each motifs, in each row segments, ... with its name
+  c[3]->cd(4);
+  painter->Draw("ZSSMT");
+  // now, draw a specific motif, in a whole canvas, and
+  // print all its pad names
+  Int_t id = sector->GetRow(5)->GetRowSegment(0)->GetMotifPositionId(0);
+  AliMpMotifPosition* motifPos = sector->GetMotifMap()->FindMotifPosition(id);
+  motifPainter = AliMpVPainter::CreatePainter(motifPos);
+  TCanvas* onepad = new TCanvas("onepad","One motif");
+  motifPainter->Draw("PT");
+}
diff --git a/MUON/mapping/macros/testMotifTypeIterators.C b/MUON/mapping/macros/testMotifTypeIterators.C
new file mode 100644 (file)
index 0000000..7ff7167
--- /dev/null
@@ -0,0 +1,61 @@
+// $Id$
+//
+// Test macro for reading motif type data and iterate over them.
+
+void testMotifTypeIterators(AliMpStationType station = kStation1,
+                            AliMpPlaneType plane = kBendingPlane)
+{
+  TString names="ABCDEFGHI";
+  //TString names="FEG";
+    
+  TH2C* histos[] = new TH2C* [names.Length()];
+  TCanvas* canv[] = new TCanvas* [1+(names.Length()-1)/4];
+  Int_t i;
+  for (i=0;i<1+(names.Length()-1)/4;++i){
+    // canv[i] = new TCanvas(Form("canv%d",i),"Iterator viewing...");
+               // CINT limitation on DEC
+              
+    TString cname("canv"); cname += i;
+    canv[i] = new TCanvas(cname.Data(),"Iterator viewing...");
+    
+    canv[i]->Divide(2,2); 
+  }
+    
+  AliMpReader r(station, plane);
+  //r.SetVerboseLevel(2);
+
+  for (i=0;i<names.Length();++i){
+    AliMpMotifType *mt = r.BuildMotifType(names[i]);
+    canv[i/4]->cd(1+ (i%4));
+    //histos[i] = new TH2C(Form("h%d",i),Form("Motif type %c",names[i]),
+    //                     mt->GetNofPadsX(),-0.5,mt->GetNofPadsX()-0.5,
+    //                     mt->GetNofPadsY(),-0.5,mt->GetNofPadsY()-0.5);
+               // CINT limitation on DEC
+
+    TString hname("h"); hname += i;
+    TString mname = names(i,1);               
+
+    histos[i] = new TH2C(hname.Data(), mname.Data(),
+                         mt->GetNofPadsX(),-0.5,mt->GetNofPadsX()-0.5,
+                         mt->GetNofPadsY(),-0.5,mt->GetNofPadsY()-0.5);
+
+    cout<<"Motif Type "<<mt->GetID()<<endl;
+    cout<<"--------------------------------"<<endl;
+    Int_t num=0;
+
+    AliMpMotifTypePadIterator it = AliMpMotifTypePadIterator(mt);
+
+    for (it.First(); ! it.IsDone(); it.Next()) {
+      cout << "Iterator " << num << ' '<< it.CurrentItem().GetIndices() << endl;
+      ++num;
+      histos[i]->Fill(it.CurrentItem().GetIndices().GetFirst(),
+                      it.CurrentItem().GetIndices().GetSecond(),num);
+    }
+
+    delete mt;
+
+    histos[i]->Draw("text");
+    canv[i/4]->Update();
+    
+  }
+}
diff --git a/MUON/mapping/macros/testNeighboursPadIterator.C b/MUON/mapping/macros/testNeighboursPadIterator.C
new file mode 100644 (file)
index 0000000..8cca310
--- /dev/null
@@ -0,0 +1,38 @@
+// $Id$
+//
+// Test macro for reading  sector, and iterate over it
+
+void testNeighboursPadIterator(AliMpStationType station = kStation1,
+                               AliMpPlaneType plane = kBendingPlane, 
+                               Int_t i=50, Int_t j=50)
+{
+  if (!gInterpreter->IsLoaded("mlibs.C")){ 
+    gROOT->LoadMacro("mlibs.C");
+    gInterpreter->ProcessLine("mlibs()");
+  }  
+
+  AliMpReader r(station, plane);
+  AliMpSector* sect = r.BuildSector();
+  AliMpSectorSegmentation segm(sect);  
+  
+  TCanvas *can = new TCanvas("canv");
+
+  const Double_t xmax=75;
+  const Double_t ymax=120;
+  
+  Int_t num=0;
+
+  AliMpPad pad = segm.PadByIndices(AliMpIntPair(i,j));
+  AliMpNeighboursPadIterator it = AliMpNeighboursPadIterator(&segm, pad,kFALSE);
+  
+  for (it.First(); ! it.IsDone(); it.Next()) {
+    AliMpIntPair indices = it.CurrentItem().GetIndices();
+    cout<<"Iterator number "<< num++ << " at "<< indices <<endl;
+    TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax,
+                                   (Double_t)indices.GetSecond()/ymax,
+                                   2);
+    marker->Draw();
+  }
+  
+  delete sect;
+}
diff --git a/MUON/mapping/macros/testPadDimensions.C b/MUON/mapping/macros/testPadDimensions.C
new file mode 100644 (file)
index 0000000..064c016
--- /dev/null
@@ -0,0 +1,36 @@
+// $Id$
+//
+// Test macro for testing retrieving of pad dimensions from
+// the map in AliMpSectorSegmentation.
+
+void testPadDimensions(AliMpStationType station = kStation1,
+                       AliMpPlaneType plane = kBendingPlane) 
+{
+  AliMpReader r(station, plane);
+  AliMpSector* sector=r.BuildSector();
+  AliMpSectorSegmentation segmentation(sector);  
+
+  TVector2 previousDimensions;
+  for (Int_t i=0; i<150;i++) 
+    for (Int_t j=0;j<200;++j) {
+
+      AliMpIntPair indices(i,j);
+      if (segmentation.HasPad(indices)) {
+
+        // Check pad dimensions
+       AliMpPad pad = segmentation.PadByIndices(indices);
+       TVector2 dimensions = segmentation.PadDimensions(segmentation.Zone(pad));
+       
+       if ( dimensions.X() != previousDimensions.X() || 
+            dimensions.Y() != previousDimensions.Y() ) {
+
+          // Print dimensions
+         cout << "Pad: " << indices;
+         cout << "  dimensions: (" << dimensions.X() << ", " << dimensions.Y() << ")" 
+              << endl;
+          
+         previousDimensions = dimensions;
+        }           
+     }
+   }
+}
diff --git a/MUON/mapping/macros/testPadsUpEtc.C b/MUON/mapping/macros/testPadsUpEtc.C
new file mode 100644 (file)
index 0000000..f24406c
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+//
+// Test macro that starts from a given pad and prints 
+// all pads up, down, right, left from this pad
+// (up to the plane border).
+
+void testPadsUpEtc(AliMpStationType station = kStation1,
+                   AliMpPlaneType  planeType = kBendingPlane)
+{
+  AliMpPlane* plane = AliMpPlane::Create(station, planeType);
+  AliMpPlaneSegmentation planeSegmentation(plane);
+  
+  //AliMpIntPair indices(85, 101);
+  AliMpIntPair indices(-129, 10);
+  AliMpPad pad;
+  if (planeSegmentation.HasPad(indices)) {
+         
+    pad = planeSegmentation.PadByIndices(indices);
+    cout << "Pad:      "  << pad << endl << endl;
+  
+    cout << "######### GO UP  ############### " << endl;
+
+    AliMpPadPair nextPads(pad, pad);
+    while (nextPads.GetFirst().IsValid()) {
+      nextPads = planeSegmentation.PadsUp(nextPads.GetFirst());
+      cout << " up    1: "  << nextPads.GetFirst() << endl;    
+      cout << "       2: "  << nextPads.GetSecond() << endl;    
+    }
+
+    cout << "######### GO DOWN  ############### " << endl;
+
+    nextPads = AliMpPadPair(pad, pad);
+    while (nextPads.GetFirst().IsValid()) {
+      nextPads = planeSegmentation.PadsDown(nextPads.GetFirst());
+      cout << " down  1: "  << nextPads.GetFirst() << endl;    
+      cout << "       2: "  << nextPads.GetSecond() << endl;    
+    }
+
+    cout << "######### GO RIGHT  ############### " << endl;
+
+    nextPads = AliMpPadPair(pad, pad);
+    while (nextPads.GetFirst().IsValid()) {
+      nextPads = planeSegmentation.PadsRight(nextPads.GetFirst());
+      cout << " right 1: "  << nextPads.GetFirst() << endl;    
+      cout << "       2: "  << nextPads.GetSecond() << endl;    
+    }
+
+    cout << "######### GO LEFT  ############### " << endl;
+
+    nextPads = AliMpPadPair(pad, pad);
+    while (nextPads.GetFirst().IsValid()) {
+      nextPads = planeSegmentation.PadsLeft(nextPads.GetFirst());
+      cout << " left  1: "  << nextPads.GetFirst() << endl;    
+      cout << "       2: "  << nextPads.GetSecond() << endl;    
+    }
+  }  
+}
diff --git a/MUON/mapping/macros/testPlaneAreaIterator.C b/MUON/mapping/macros/testPlaneAreaIterator.C
new file mode 100644 (file)
index 0000000..6aa2d03
--- /dev/null
@@ -0,0 +1,68 @@
+// $Id$
+//
+// Test macro for iterating over the whole plane
+
+#include <iomanip>
+
+class AliMpVPadIterator;
+
+void MarkPads(AliMpVPadIterator& it, Double_t xmax, Double_t ymax, 
+              Bool_t print = kTRUE)
+{
+// Marks pads according their position.
+// Fills histogram with pad indices.
+// Measures time that takes processing of full plane. 
+// ---
+
+  Int_t num=0;
+
+  TH2C* histo = new TH2C("pads", "pads", 401, -200, 200, 501, -250, 250); 
+
+  TStopwatch timer;
+  timer.Start();  
+
+  for (it.First(); ! it.IsDone(); it.Next()){
+   
+    if (print) cout << endl 
+                    << setw(5) << ++num 
+                    << " " << it.CurrentItem() << endl;   
+    
+    // mark pads positions
+    TVector2 posi = it.CurrentItem().Position();
+    TMarker* marker = new TMarker( posi.X()/xmax, posi.Y()/ymax, 2);
+    marker->Draw();
+
+    // fill pads indices in the histogram
+    histo->Fill(it.CurrentItem().GetIndices().GetFirst(),
+                it.CurrentItem().GetIndices().GetSecond());            
+  }
+  
+  TCanvas *canv2 = new TCanvas("canv2");
+  canv2->cd();
+  //histo->SetMinimum(1.5);
+  histo->Draw("box");
+
+  timer.Stop();
+  //timer.Print();
+}
+
+void testPlaneAreaIterator(AliMpStationType station = kStation1,
+                  AliMpPlaneType planeType = kBendingPlane, 
+                  AliMpArea area = AliMpArea(TVector2(0.,0.),TVector2(900.,900.)))
+{
+  AliMpPlane* plane = AliMpPlane::Create(station, planeType);
+  AliMpPlaneSegmentation planeSeg(plane);
+  AliMpVPadIterator* iter = planeSeg.CreateIterator(area);
+
+  TCanvas* graph = new TCanvas("Graph");
+  graph->Divide(2);
+  graph->cd(1);
+  AliMpVPainter::CreatePainter(plane->GetFrontSector())->Draw("ZSSMP");
+  graph->cd(2);
+  AliMpVPainter::CreatePainter(plane->GetBackSector())->Draw("ZSSMP");
+  TCanvas *canv = new TCanvas("canv");
+  canv->Range(-1,-1,1,1);
+  
+  MarkPads(*iter, TMath::Abs(area.Position().X())+area.Dimensions().X(),
+                  TMath::Abs(area.Position().Y())+area.Dimensions().Y(), kTRUE);
+}
diff --git a/MUON/mapping/macros/testPlaneFind.C b/MUON/mapping/macros/testPlaneFind.C
new file mode 100644 (file)
index 0000000..c3ff1a1
--- /dev/null
@@ -0,0 +1,66 @@
+// $Id$
+//
+// Test macro that runs the segmentation circle test
+// (finds pad by location, position and indices in a circle)
+// over the whole plane.
+
+void testPlane(AliMpPlane* plane)
+{
+  AliMpPlaneSegmentation planeSegmentation(plane);
+  
+  //AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+  //painter->Draw("ZSSMP");
+
+  for (Int_t isec=0; isec<4; isec++) {
+             // 0  x>=0, y>=0
+             // 1  x>=0, y <0
+             // 2  x <0, y>=0
+             // 3  x <0, y <0
+
+    cout << "Verifying sector " << isec << "....." << endl;
+    
+    for (Int_t i = AliMpConstants::StartPadIndex(); i<AliMpConstants::StartPadIndex()+90; i++){
+     
+      Int_t iscale = 1;
+      if (isec >1) iscale = -1;
+    
+      cout << "Verifying column " << i << "....." << endl;
+
+      for (Int_t j = AliMpConstants::StartPadIndex(); j<AliMpConstants::StartPadIndex()+20; j++) {
+
+        Int_t jscale = 1;  
+        if (isec == 1 || isec == 3) jscale = -1;
+       
+       if (planeSegmentation.HasPad(AliMpIntPair(i*iscale, j*jscale))) {
+       
+         planeSegmentation.PadByIndices(AliMpIntPair(i*iscale, j*jscale)).Print();
+          cout << "test result " 
+              << planeSegmentation.CircleTest(AliMpIntPair(i*iscale, j*jscale))
+              << endl;    
+       }
+       else {
+         cout << " has not indices  " << AliMpIntPair(i*iscale, j*jscale) << endl;
+       }  
+      }
+    }
+  }  
+}
+
+void testPlaneFind(AliMpStationType station = kStation1,
+                   AliMpPlaneType planeType = kBendingPlane)
+{
+  cout << endl;
+
+  cout << "Testing plane1 ..." << endl;
+  AliMpPlane* plane1 = AliMpPlane::Create(station, planeType);
+  testPlane(plane1);
+  delete plane1;
+  cout << endl; 
+
+  cout << "Testing plane2 ..." << endl; 
+  AliMpPlane* plane2 
+    = AliMpPlane::Create(station, planeType, 
+                         TVector2(), TVector2(-10., 10.), TVector2(), TVector2());
+  testPlane(plane2);
+  delete plane2;  
+}
diff --git a/MUON/mapping/macros/testPrintLimits.C b/MUON/mapping/macros/testPrintLimits.C
new file mode 100644 (file)
index 0000000..ad19e83
--- /dev/null
@@ -0,0 +1,71 @@
+// $Id$
+//
+// Test macro for making an output file, where all mapping elements
+// indices & positions are written.
+
+void testPrintLimits(AliMpStationType station = kStation1,
+                    AliMpPlaneType plane = kBendingPlane, ostream& out=cout)
+{
+  AliMpReader r(station, plane);
+
+  AliMpSector *sector=r.BuildSector();
+
+  AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+  painter->Draw("ZSSMP");
+
+  AliMpIntPair low,high;
+  TVector2 rlow,rhigh;
+
+  for (Int_t irow=0;irow<sector->GetNofRows();irow++){
+    // For each row
+
+    AliMpRow* row = sector->GetRow(irow);
+    low  = row->GetLowIndicesLimit();
+    high = row->GetHighIndicesLimit();
+    rlow = TVector2(row->Position().X()-row->Dimensions().X(),
+                    row->Position().Y()-row->Dimensions().Y());
+    rhigh = TVector2(row->Position().X()+row->Dimensions().X(),
+                     row->Position().Y()+row->Dimensions().Y());
+    out<<"_______________________________________________________________"<<endl;
+    out<<"Row "<<irow<<" between "<<low<<" and "<<high
+       <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
+       <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
+    out<<"_______________________________________________________________"<<endl;
+  
+    for (Int_t iseg=0;iseg<row->GetNofRowSegments();iseg++){
+      // For each row segment  
+  
+      AliMpVRowSegment* seg = row->GetRowSegment(iseg);
+      low  = seg->GetLowIndicesLimit();
+      high = seg->GetHighIndicesLimit();
+      rlow = TVector2(seg->Position().X()-seg->Dimensions().X(),
+                      seg->Position().Y()-seg->Dimensions().Y());
+      rhigh = TVector2(seg->Position().X()+seg->Dimensions().X(),
+                       seg->Position().Y()+seg->Dimensions().Y());
+      out<<"-----------------------------------------------------------"<<endl;
+      out<<"     Segment "<<iseg<<" between "<<low<<" and "<<high
+         <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
+         <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
+      out<<"-----------------------------------------------------------"<<endl;
+
+      for (Int_t imotif=0;imotif<seg->GetNofMotifs();imotif++){
+         // For each motif pos
+  
+        AliMpMotifPosition* motifPos 
+          = sector->GetMotifMap()
+             ->FindMotifPosition(seg->GetMotifPositionId(imotif));
+        AliMpVMotif* motif = motifPos->GetMotif();
+      
+        low  = motifPos->GetLowIndicesLimit();
+        high = motifPos->GetHighIndicesLimit();
+        rlow = TVector2(motifPos->Position().X()-motif->Dimensions().X(),
+                  motifPos->Position().Y()-motif->Dimensions().Y());
+        rhigh = TVector2(motifPos->Position().X()+motif->Dimensions().X(),
+                   motifPos->Position().Y()+motif->Dimensions().Y());
+        out<<"          Motif "<<imotif<<" between "<<low<<" and "<<high
+           <<"-->("<<rlow.X()<<','<<rlow.Y()<<") and ("
+           <<rhigh.X()<<','<<rhigh.Y()<<')'<<endl;
+      }
+    }
+  }
+}
diff --git a/MUON/mapping/macros/testReadMotifType.C b/MUON/mapping/macros/testReadMotifType.C
new file mode 100644 (file)
index 0000000..e587b66
--- /dev/null
@@ -0,0 +1,15 @@
+// $Id$
+//
+// Test macro for reading motif type data.
+
+void testReadMotifType(AliMpStationType station = kStation1,
+                       AliMpPlaneType plane = kBendingPlane)
+{
+  AliMpReader r(station, plane);
+  //r.SetVerboseLevel(2);
+
+  TString names="ABCDEFGHIJKLMN";
+  for (Int_t i=0;i<names.Length();++i){
+     r.BuildMotifType(names[i])->Print("G");
+  }
+}
diff --git a/MUON/mapping/macros/testReadSector.C b/MUON/mapping/macros/testReadSector.C
new file mode 100644 (file)
index 0000000..8edd615
--- /dev/null
@@ -0,0 +1,96 @@
+// $Id$
+//
+// Test macro for reading sector data.
+
+void testReadSector(AliMpStationType station = kStation1,
+                    AliMpPlaneType plane = kBendingPlane) 
+{
+  AliMpReader reader(station, plane);  
+  //reader.SetVerboseLevel(1);
+  
+  // Read data 
+  AliMpSector* sector = reader.BuildSector();
+  
+  cout << endl;
+
+  // Sector geometry
+  sector->PrintGeometry();
+
+  cout << endl;
+
+  // Find row test
+  cout << "0th row low border " << sector->FindRow(TVector2(0., 0.))->GetID() << endl;
+  cout << "in 0th row         " << sector->FindRow(TVector2(0., 25.))->GetID() << endl;
+  cout << "0th row up border  " << sector->FindRow(TVector2(0., 67.2))->GetID() << endl;
+  cout << "in 4th row         " << sector->FindRow(TVector2(0., 300.))->GetID() << endl;
+  if (plane == kBendingPlane)
+    cout << "12th row up border " << sector->FindRow(TVector2(0., 894.6))->GetID() << endl;
+  if (plane == kNonBendingPlane)
+    cout << "12th row up border " << sector->FindRow(TVector2(0., 848.4))->GetID() << endl;
+  cout << endl;
+  
+  // Find motif position test
+  for (Int_t i=1; i<4 ; i++) {
+    for (Int_t j=0; j<5; j++) {
+
+      Int_t start = 0;
+      if (plane == kBendingPlane) start = 0;
+      if (plane == kNonBendingPlane) start = 3000;
+    
+      Int_t id = start + i*1010 + 5*j;
+
+      cout << "Motif pos " << id;
+      if (!sector->FindRowSegment(id)) {
+         cout << " not found." << endl;
+      }
+      else {    
+         cout << " found in : "
+              << sector->FindRow(id)->GetID() << " row, "
+              << " motif id: "
+              << sector->FindRowSegment(id)->GetMotif(0)->GetID().Data()
+             << endl;
+      }      
+    }     
+  }
+
+  cout << endl;
+
+  // Find motif by coordinates test
+  for (Int_t i=0; i<2 ; i++) {
+    TVector2 pos(5., 186. - i*20.);  // i=0 in motif 1001,
+                                     // i=1 outside (below) motif 1001
+    AliMpMotif* motif = sector->FindMotif(pos);
+    cout << "In the position " << pos.X() << " " << pos.Y();
+    
+    if (motif)
+      cout << " found motif " << motif->GetID() << endl;
+    else  
+      cout << " motif not found " << endl;
+  }
+
+  // Find special motif test
+  if (plane == kNonBendingPlane)
+    for (Int_t i=0; i<6 ; i++) {
+      Int_t id = 4001 + i;
+      cout << "Motif pos " << id;
+      if (!sector->FindRowSegment(id)) {
+         cout << " not found." << endl;
+      }
+      else {    
+         cout << " found in : "
+              << sector->FindRow(id)->GetID() << " row, "
+             << " position : "
+             << sector->FindPosition(id).X() << "  " <<  sector->FindPosition(id).Y()
+             << endl;
+      }
+    }           
+  cout << endl;
+
+  // Motif map
+  sector->GetMotifMap()->Print();    
+  
+  delete sector;
+}                             
+      
+
diff --git a/MUON/mapping/macros/testSectorFind.C b/MUON/mapping/macros/testSectorFind.C
new file mode 100644 (file)
index 0000000..d3e42c8
--- /dev/null
@@ -0,0 +1,22 @@
+// $Id$
+//
+// Test macro for which verify that all FindPosition, FindIndices
+// and FindLocation methods are consistents between them.
+
+void testSectorFind(AliMpStationType station = kStation1,
+                    AliMpPlaneType plane = kBendingPlane)
+{
+  AliMpReader r(station, plane);
+
+  AliMpSector *sector=r.BuildSector();
+  AliMpSectorSegmentation segmentation(sector);
+  AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+  painter->Draw("ZSSMP");
+
+  for (Int_t i=0; i<90;i++){
+    cout<<"Verifying column "<<i<<"....."<<endl;
+
+    for (Int_t j=0;j<230;++j)
+      segmentation.CircleTest(AliMpIntPair(i,j));    
+  }
+}
diff --git a/MUON/mapping/macros/testSectorPadIterators.C b/MUON/mapping/macros/testSectorPadIterators.C
new file mode 100644 (file)
index 0000000..7ebd455
--- /dev/null
@@ -0,0 +1,30 @@
+// $Id$
+//
+// Test macro for reading  sector, and iterate over it
+
+void testSectorPadIterators(AliMpStationType station = kStation1,
+                            AliMpPlaneType plane = kBendingPlane)
+{
+  AliMpReader r(station, plane);
+  AliMpSector* sect = r.BuildSector();
+  
+  Int_t num=0;
+  
+  TCanvas *can = new TCanvas("canv");
+
+  const Double_t xmax=150;
+  const Double_t ymax=250;
+
+  AliMpSectorPadIterator it = AliMpSectorPadIterator(sect);
+
+  for (it.First(); ! it.IsDone(); it.Next()) {
+    AliMpIntPair indices = it.CurrentItem().GetIndices();
+    cout<<"Iterator number "<< num++ << " at "<< indices <<endl;
+    TMarker* marker = new TMarker( (Double_t)indices.GetFirst() /xmax,
+                                   (Double_t)indices.GetSecond()/ymax,
+                                   2);
+    marker->Draw();
+  }
+  
+  delete sect;
+}
diff --git a/MUON/mapping/macros/testUpdateGlobalIndices.C b/MUON/mapping/macros/testUpdateGlobalIndices.C
new file mode 100644 (file)
index 0000000..c033d98
--- /dev/null
@@ -0,0 +1,20 @@
+// $Id$
+//
+// Tests updating global indices of motif positions from file.
+
+void testUpdateGlobalIndices()
+{
+  AliMpReader reader(kStation1, kNonBendingPlane);  
+  //reader.SetVerboseLevel(1);
+  
+  // Read data 
+  AliMpSector* sector = reader.BuildSector();
+
+  sector->GetMotifMap()->UpdateGlobalIndices("motif_map.dat");  
+  
+  AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
+  TCanvas* canvas = new TCanvas();
+  canvas->cd();
+  painter->Draw("ZSSMI");
+}