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