]>
Commit | Line | Data |
---|---|---|
72d8f376 | 1 | // $Id$ |
a387ee7c | 2 | // $MpId: testExistingPads2.C,v 1.3 2005/08/24 08:53:27 ivana Exp $ |
72d8f376 | 3 | // |
4 | // Extended testExistingPads macro for testing which pad is seen as | |
5 | // "existing" by AliMpSector. | |
6 | // The loop over pads is performed in two ways: | |
7 | // 1) via sector area pad iterator | |
8 | // 2) via indices | |
9 | ||
10 | #include <iomanip> | |
11 | ||
cddd101e | 12 | void testExistingPads2(AliMp::StationType station = AliMp::kStation1, |
13 | AliMp::PlaneType plane = AliMp::kBendingPlane) | |
72d8f376 | 14 | { |
a387ee7c | 15 | AliMpSectorReader r(station, plane); |
72d8f376 | 16 | AliMpSector* sector = r.BuildSector(); |
17 | AliMpSectorSegmentation segmentation(sector); | |
18 | ||
19 | ofstream out1("testExistingPads2.ixiy.out", ios::out); | |
20 | ofstream out2("testExistingPads2.iter.out", ios::out); | |
21 | ||
22 | // First loop over indices | |
23 | cout << "Iterating via indices ..." << endl; | |
24 | Int_t counter1 = 0; | |
cddd101e | 25 | if ( sector->GetDirection() == AliMp::kX ) |
72d8f376 | 26 | for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) { |
27 | for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) { | |
28 | AliMpIntPair indices(i,j); | |
29 | if ( segmentation.HasPad(indices) ) | |
30 | out1 << std::setw(4) << ++counter1 << " " | |
31 | << segmentation.PadByIndices(indices) << endl;; | |
32 | } | |
33 | } | |
34 | ||
cddd101e | 35 | if ( sector->GetDirection() == AliMp::kY ) |
72d8f376 | 36 | for (Int_t j=1; j<segmentation.MaxPadIndexY()+1; j++) { |
37 | for (Int_t i=1; i<segmentation.MaxPadIndexX()+1; i++) { | |
38 | AliMpIntPair indices(i,j); | |
39 | if ( segmentation.HasPad(indices) ) | |
40 | out1 << std::setw(4) << ++counter1 << " " | |
41 | << segmentation.PadByIndices(indices) << endl;; | |
42 | } | |
43 | } | |
44 | ||
45 | // Second loop via pad area iterator | |
46 | cout << "Iterating via iterator ..." << endl; | |
b031fa57 | 47 | AliMpArea area(TVector2(60.,60.), TVector2(60.,60.) ); |
72d8f376 | 48 | AliMpVPadIterator* it = segmentation.CreateIterator(area); |
49 | Int_t counter2 = 0; | |
50 | for (it->First(); ! it->IsDone(); it->Next()){ | |
51 | ||
52 | out2 << std::setw(4) << ++counter2 << " " | |
53 | << it->CurrentItem() << endl; | |
54 | } | |
55 | } |