Updated for modifs in AliMpFiles
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testPadDimensions.C
CommitLineData
66e0997c 1// $Id$
57ff4119 2// $MpId: testPadDimensions.C,v 1.6 2005/10/28 15:36:08 ivana Exp $
66e0997c 3//
4// Test macro for testing retrieving of pad dimensions from
5// the map in AliMpSectorSegmentation.
6
7void testPadDimensions(AliMpStationType station = kStation1,
334be4b7 8 AliMpPlaneType plane = kBendingPlane,
9 Bool_t rootInput = false)
66e0997c 10{
334be4b7 11 AliMpSector *sector = 0;
12 if (!rootInput) {
13 AliMpSectorReader r(station, plane);
14 sector=r.BuildSector();
15 }
16 else {
57ff4119 17 TString filePath = AliMpFiles::SectorFilePath(station,plane);
334be4b7 18 filePath.ReplaceAll("zones.dat", "sector.root");
19
20 TFile f(filePath.Data(), "READ");
21 sector = (AliMpSector*)f.Get("Sector");
22 }
23
66e0997c 24 AliMpSectorSegmentation segmentation(sector);
72d8f376 25 segmentation.PrintZones();
26
66e0997c 27 TVector2 previousDimensions;
72d8f376 28 for (Int_t i=1; i<segmentation.MaxPadIndexX()+1;i++)
29 for (Int_t j=1;j<segmentation.MaxPadIndexY()+1;++j) {
66e0997c 30
31 AliMpIntPair indices(i,j);
32 if (segmentation.HasPad(indices)) {
33
34 // Check pad dimensions
35 AliMpPad pad = segmentation.PadByIndices(indices);
36 TVector2 dimensions = segmentation.PadDimensions(segmentation.Zone(pad));
37
38 if ( dimensions.X() != previousDimensions.X() ||
39 dimensions.Y() != previousDimensions.Y() ) {
40
41 // Print dimensions
42 cout << "Pad: " << indices;
43 cout << " dimensions: (" << dimensions.X() << ", " << dimensions.Y() << ")"
44 << endl;
45
46 previousDimensions = dimensions;
47 }
48 }
49 }
50}