]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testExistingPads2.C
Updated for new numbering of motif positions in mapping.
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testExistingPads2.C
CommitLineData
72d8f376 1// $Id$
2//
3// Extended testExistingPads macro for testing which pad is seen as
4// "existing" by AliMpSector.
5// The loop over pads is performed in two ways:
6// 1) via sector area pad iterator
7// 2) via indices
8
9#include <iomanip>
10
11void testExistingPads2(AliMpStationType station = kStation1,
12 AliMpPlaneType plane = kBendingPlane)
13{
14 AliMpReader r(station, plane);
15 AliMpSector* sector = r.BuildSector();
16 AliMpSectorSegmentation segmentation(sector);
17
18 ofstream out1("testExistingPads2.ixiy.out", ios::out);
19 ofstream out2("testExistingPads2.iter.out", ios::out);
20
21 // First loop over indices
22 cout << "Iterating via indices ..." << endl;
23 Int_t counter1 = 0;
24 if ( sector->GetDirection() == kX )
25 for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
26 for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
27 AliMpIntPair indices(i,j);
28 if ( segmentation.HasPad(indices) )
29 out1 << std::setw(4) << ++counter1 << " "
30 << segmentation.PadByIndices(indices) << endl;;
31 }
32 }
33
34 if ( sector->GetDirection() == kY )
35 for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) {
36 for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) {
37 AliMpIntPair indices(i,j);
38 if ( segmentation.HasPad(indices) )
39 out1 << std::setw(4) << ++counter1 << " "
40 << segmentation.PadByIndices(indices) << endl;;
41 }
42 }
43
44 // Second loop via pad area iterator
45 cout << "Iterating via iterator ..." << endl;
46 AliMpArea area(TVector2(600.,600.), TVector2(600.,600.) );
47 AliMpVPadIterator* it = segmentation.CreateIterator(area);
48 Int_t counter2 = 0;
49 for (it->First(); ! it->IsDone(); it->Next()){
50
51 out2 << std::setw(4) << ++counter2 << " "
52 << it->CurrentItem() << endl;
53 }
54}