]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Replacement for testPlaneAreaIterator.C macro
authormartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Jun 2005 10:24:46 +0000 (10:24 +0000)
committermartinez <martinez@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 14 Jun 2005 10:24:46 +0000 (10:24 +0000)
with removing category plane from mapping.
(Ivana)

MUON/mapping/macros/testSectorAreaIterator.C [new file with mode: 0644]

diff --git a/MUON/mapping/macros/testSectorAreaIterator.C b/MUON/mapping/macros/testSectorAreaIterator.C
new file mode 100644 (file)
index 0000000..5477b76
--- /dev/null
@@ -0,0 +1,70 @@
+// $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 quadrant 
+// ---
+
+  Int_t num=0;
+
+  TH2C* histo = new TH2C("pads", "pads", 201, 0, 200, 251, 0, 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 testSectorAreaIterator(AliMpStationType station = kStation1,
+                            AliMpPlaneType planeType = kBendingPlane)
+{
+  AliMpReader reader(station, planeType);  
+  AliMpSector* sector = reader.BuildSector();
+  AliMpSectorSegmentation segmentation(sector);
+
+  AliMpArea area;
+  if ( station == kStation1 )
+    area = AliMpArea(TVector2(450.,450.),TVector2(450.,450.));
+  else   
+    area = AliMpArea(TVector2(600.,600.),TVector2(600.,600.));
+  AliMpVPadIterator* iter = segmentation.CreateIterator(area);
+
+  TCanvas* graph = new TCanvas("Graph");
+  AliMpVPainter::CreatePainter(sector)->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);
+}