]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testPadDimensions.C
- All mapping enums within namespace (AliMp).
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testPadDimensions.C
1 // $Id$
2 // $MpId: testPadDimensions.C,v 1.6 2005/10/28 15:36:08 ivana Exp $
3 //
4 // Test macro for testing retrieving of pad dimensions from
5 // the map in AliMpSectorSegmentation.
6
7 void testPadDimensions(AliMp::StationType station = AliMp::kStation1,
8                        AliMp::PlaneType plane = AliMp::kBendingPlane,
9                        Bool_t rootInput = false)
10 {
11   AliMpSector *sector = 0;
12   if (!rootInput) {
13     AliMpSectorReader r(station, plane);
14     sector=r.BuildSector();
15   }
16   else  {
17     TString filePath = AliMpFiles::SectorFilePath(station,plane);
18     filePath.ReplaceAll("zones.dat", "sector.root"); 
19
20     TFile f(filePath.Data(), "READ");
21     sector = (AliMpSector*)f.Get("Sector");
22   }  
23
24   AliMpSectorSegmentation segmentation(sector);  
25   segmentation.PrintZones(); 
26   
27   TVector2 previousDimensions;
28   for (Int_t i=1; i<segmentation.MaxPadIndexX()+1;i++) 
29     for (Int_t j=1;j<segmentation.MaxPadIndexY()+1;++j) {
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 }