2 // $MpId: testExistingPads2.C,v 1.3 2005/08/24 08:53:27 ivana Exp $
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
12 void testExistingPads2(AliMp::StationType station = AliMp::kStation1,
13 AliMp::PlaneType plane = AliMp::kBendingPlane)
15 AliMpSectorReader r(station, plane);
16 AliMpSector* sector = r.BuildSector();
17 AliMpSectorSegmentation segmentation(sector);
19 ofstream out1("testExistingPads2.ixiy.out", ios::out);
20 ofstream out2("testExistingPads2.iter.out", ios::out);
22 // First loop over indices
23 cout << "Iterating via indices ..." << endl;
25 if ( sector->GetDirection() == AliMp::kX )
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;;
35 if ( sector->GetDirection() == AliMp::kY )
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;;
45 // Second loop via pad area iterator
46 cout << "Iterating via iterator ..." << endl;
47 AliMpArea area(TVector2(60.,60.), TVector2(60.,60.) );
48 AliMpVPadIterator* it = segmentation.CreateIterator(area);
50 for (it->First(); ! it->IsDone(); it->Next()){
52 out2 << std::setw(4) << ++counter2 << " "
53 << it->CurrentItem() << endl;