Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testExistingPads.C
CommitLineData
66e0997c 1// $Id$
57ff4119 2// $MpId: testExistingPads.C,v 1.12 2005/10/28 15:36:07 ivana Exp $
66e0997c 3//
4// Test macro for testing which pad is seen as "existing" by AliMpSector.
5
6void testExistingPads(AliMpStationType station = kStation1,
334be4b7 7 AliMpPlaneType plane = kBendingPlane,
8 Bool_t rootInput = false)
66e0997c 9{
334be4b7 10 AliMpSector *sector = 0;
11 if (!rootInput) {
12 AliMpSectorReader r(station, plane);
13 sector=r.BuildSector();
14 }
15 else {
57ff4119 16 TString filePath = AliMpFiles::SectorFilePath(station,plane);
334be4b7 17 filePath.ReplaceAll("zones.dat", "sector.root");
18
19 TFile f(filePath.Data(), "READ");
20 sector = (AliMpSector*)f.Get("Sector");
21 }
22
72d8f376 23 AliMpSectorSegmentation segmentation(sector);
66e0997c 24 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
25
26 TCanvas* c1 = new TCanvas("view",
27 "AliMpSectorPainter::Draw() output (view per pad)");
28 painter->Draw("ZSSMP");
29 c1->Update();
30
72d8f376 31 Int_t maxPadIndexX = segmentation.MaxPadIndexX();
32 Int_t maxPadIndexY = segmentation.MaxPadIndexY();
33
34 // Define histogram limits
35 Int_t nx = (maxPadIndexX/10 + 1)*10;
36 Int_t ny = (maxPadIndexY/10 + 1)*10;
37 TH2C* histo = new TH2C("histo","Existing pads",
38 nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
39
66e0997c 40 TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
41
42 AliMpSectorSegmentation segmentation(sector);
72d8f376 43 for (Int_t i=0; i<maxPadIndexX+1;i++){
44 for (Int_t j=0;j<maxPadIndexY+1;++j){
66e0997c 45
46 AliMpIntPair indices(i,j);
47 if (segmentation.HasPad(indices)) histo->Fill(i,j);
48 }
49 }
50
51 c2->cd();
52 histo->Draw("box");
53}