]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testAllIndices.C
Updated for new numbering of motif positions in mapping.
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testAllIndices.C
1 // $Id$
2 //
3 // Test macro for testing which pad is seen as "existing" by AliMpSector.
4
5 void testAllIndices(AliMpStationType station = kStation1,
6                     AliMpPlaneType plane = kBendingPlane) 
7 {
8   AliMpReader r(station, plane);
9
10   AliMpSector *sector=r.BuildSector();
11   AliMpSectorSegmentation segmentation(sector);
12   AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
13
14   TCanvas* c1 = new TCanvas("view",
15                             "MSectorPainter::Draw() output (view per pad)");
16   painter->Draw("ZSSMP");
17   c1->Update();
18
19   Int_t maxPadIndexX = segmentation.MaxPadIndexX();
20   Int_t maxPadIndexY = segmentation.MaxPadIndexY();
21   
22   // Define histogram limits
23   Int_t nx = (maxPadIndexX/10 + 1)*10;
24   Int_t ny = (maxPadIndexY/10 + 1)*10;
25   TH2C* histo  = new TH2C("histo","Existing pads", 
26                           nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
27
28   Int_t nx2 = 950/2;
29   Int_t ny2 = 950/2;
30   if (station == kStation2) {
31     nx2 = 1200/2;
32     ny2 = 1200/2;
33   }
34   TH2F* histo2 = new TH2F("histo2","Existing positions",
35                           nx2, 0, nx2*2, ny2, 0, ny2*2);
36
37   // Define canvas
38   TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
39   TCanvas* c3 = new TCanvas("c3","Positions");
40   
41   for (Int_t irow=0;irow<sector->GetNofRows();irow++){
42     AliMpRow* row = sector->GetRow(irow);
43     
44     for (Int_t  iseg=0;iseg<row->GetNofRowSegments();iseg++){
45       AliMpVRowSegment* seg = row->GetRowSegment(iseg);
46       
47       for (Int_t imot=0;imot<seg->GetNofMotifs();imot++){
48         AliMpMotifPosition* motifPos 
49          = sector->GetMotifMap()->FindMotifPosition(seg->GetMotifPositionId(imot));
50          
51         for (Int_t gassNum=0;gassNum<64;gassNum++){
52           if (motifPos->GetMotif()->GetMotifType()->FindConnectionByGassiNum(gassNum)){
53           
54             AliMpPad pad = segmentation.PadByLocation(AliMpIntPair(motifPos->GetID(),gassNum));
55             if (pad != AliMpPad::Invalid()) {
56               histo->Fill (pad.GetIndices().GetFirst(),
57                           pad.GetIndices().GetSecond());
58               histo2->Fill(pad.Position().X(),
59                            pad.Position().Y());
60             }
61           }
62         }
63       }
64     }
65   }
66   c2->cd();
67   histo->Draw("col");
68   c3->cd();
69   histo2->Draw("box");
70 }