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 AliMpSectorSegmentation or AliMpFastSegmentation.
6 // The loop over pads is performed in two ways:
7 // 1) via sector area pad iterator
10 // root [0] .L testExistingPads2.C+
11 // root [1] testExistingPads2();
14 #if !defined(__CINT__) || defined(__MAKECINT__)
16 #include "AliMpStation12Type.h"
17 #include "AliMpPlaneType.h"
18 #include "AliMpDataProcessor.h"
19 #include "AliMpDataMap.h"
20 #include "AliMpDataStreams.h"
21 #include "AliMpSector.h"
22 #include "AliMpSectorReader.h"
23 #include "AliMpSectorSegmentation.h"
24 #include "AliMpFastSegmentation.h"
25 #include "AliMpArea.h"
26 #include "AliMpVPadIterator.h"
28 #include <Riostream.h>
33 void testExistingPads2(AliMq::Station12Type station, AliMp::PlaneType plane,
34 Bool_t useFastSegmentation = kTRUE)
37 AliMpDataProcessor mp;
38 AliMpDataMap* dataMap = mp.CreateDataMap("data");
39 AliMpDataStreams dataStreams(dataMap);
40 AliMpSectorReader r(dataStreams, station, plane);
41 AliMpSector* sector = r.BuildSector();
44 AliMpVSegmentation* segmentation;
45 if ( useFastSegmentation)
46 segmentation = new AliMpFastSegmentation(new AliMpSectorSegmentation(sector));
48 segmentation = new AliMpSectorSegmentation(sector);
51 TString outName = "testExistingPads.";
52 outName += AliMq::Station12TypeName(station);
53 outName += AliMp::PlaneTypeName(plane);
54 TString out1Name = outName + ".ixiy.out";
55 TString out2Name = outName + ".iter.out";
57 ofstream out1(out1Name.Data(), ios::out);
58 ofstream out2(out2Name.Data(), ios::out);
60 // First loop over indices
61 cout << "Iterating via indices ..." << endl;
63 if ( sector->GetDirection() == AliMp::kX )
64 for (Int_t i=1; i<segmentation->MaxPadIndexX()+1; i++) {
65 for (Int_t j=1; j<segmentation->MaxPadIndexY()+1; j++) {
66 if ( segmentation->HasPadByIndices(i,j) )
67 out1 << std::setw(4) << ++counter1 << " "
68 << segmentation->PadByIndices(i,j) << endl;;
72 if ( sector->GetDirection() == AliMp::kY )
73 for (Int_t j=1; j<segmentation->MaxPadIndexY()+1; j++) {
74 for (Int_t i=1; i<segmentation->MaxPadIndexX()+1; i++) {
75 if ( segmentation->HasPadByIndices(i,j) )
76 out1 << std::setw(4) << ++counter1 << " "
77 << segmentation->PadByIndices(i,j) << endl;;
81 // Second loop via pad area iterator
82 cout << "Iterating via iterator ..." << endl;
83 AliMpArea area(TVector2(60.,60.), TVector2(60.,60.) );
84 AliMpVPadIterator* it = segmentation->CreateIterator(area);
86 for (it->First(); ! it->IsDone(); it->Next()){
88 out2 << std::setw(4) << ++counter2 << " "
89 << it->CurrentItem() << endl;
95 void testSt12ExistingPads2()
97 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
98 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
100 for ( Int_t is = 0; is < 2; is++ ) {
101 for ( Int_t ip = 0; ip < 2; ip++ ) {
103 cout << "Running testExistingPads2 for "
104 << AliMq::Station12TypeName(station[is]) << " "
105 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
107 testExistingPads2(station[is], plane[ip]);
109 cout << "... end running " << endl << endl;