]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testSt12ExistingPads2.C
In Mapping/macros:
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12ExistingPads2.C
CommitLineData
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
530f2f27 5// "existing" by AliMpSectorSegmentation or AliMpFastSegmentation.
72d8f376 6// The loop over pads is performed in two ways:
7// 1) via sector area pad iterator
8// 2) via indices
530f2f27 9// To run macro:
10// root [0] .L testExistingPads2.C+
11// root [1] testExistingPads2();
12
13
14#if !defined(__CINT__) || defined(__MAKECINT__)
15
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"
27
28#include <Riostream.h>
f05d3eb1 29#include <TString.h>
72d8f376 30
530f2f27 31#endif
32
f05d3eb1 33void testExistingPads2(AliMq::Station12Type station, AliMp::PlaneType plane,
34 Bool_t useFastSegmentation = kTRUE)
72d8f376 35{
530f2f27 36 // Read data
37 AliMpDataProcessor mp;
38 AliMpDataMap* dataMap = mp.CreateDataMap("data");
39 AliMpDataStreams dataStreams(dataMap);
40 AliMpSectorReader r(dataStreams, station, plane);
72d8f376 41 AliMpSector* sector = r.BuildSector();
530f2f27 42
43 // Segmentation
44 AliMpVSegmentation* segmentation;
45 if ( useFastSegmentation)
46 segmentation = new AliMpFastSegmentation(new AliMpSectorSegmentation(sector));
47 else
48 segmentation = new AliMpSectorSegmentation(sector);
49
50 // Output files
f05d3eb1 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";
56
57 ofstream out1(out1Name.Data(), ios::out);
58 ofstream out2(out2Name.Data(), ios::out);
72d8f376 59
60 // First loop over indices
61 cout << "Iterating via indices ..." << endl;
62 Int_t counter1 = 0;
cddd101e 63 if ( sector->GetDirection() == AliMp::kX )
530f2f27 64 for (Int_t i=1; i<segmentation->MaxPadIndexX()+1; i++) {
65 for (Int_t j=1; j<segmentation->MaxPadIndexY()+1; j++) {
72d8f376 66 AliMpIntPair indices(i,j);
530f2f27 67 if ( segmentation->HasPad(indices) )
72d8f376 68 out1 << std::setw(4) << ++counter1 << " "
530f2f27 69 << segmentation->PadByIndices(indices) << endl;;
72d8f376 70 }
71 }
72
cddd101e 73 if ( sector->GetDirection() == AliMp::kY )
530f2f27 74 for (Int_t j=1; j<segmentation->MaxPadIndexY()+1; j++) {
75 for (Int_t i=1; i<segmentation->MaxPadIndexX()+1; i++) {
72d8f376 76 AliMpIntPair indices(i,j);
530f2f27 77 if ( segmentation->HasPad(indices) )
72d8f376 78 out1 << std::setw(4) << ++counter1 << " "
530f2f27 79 << segmentation->PadByIndices(indices) << endl;;
72d8f376 80 }
81 }
82
83 // Second loop via pad area iterator
84 cout << "Iterating via iterator ..." << endl;
b031fa57 85 AliMpArea area(TVector2(60.,60.), TVector2(60.,60.) );
530f2f27 86 AliMpVPadIterator* it = segmentation->CreateIterator(area);
72d8f376 87 Int_t counter2 = 0;
88 for (it->First(); ! it->IsDone(); it->Next()){
89
90 out2 << std::setw(4) << ++counter2 << " "
91 << it->CurrentItem() << endl;
92 }
530f2f27 93
94 delete segmentation;
72d8f376 95}
f05d3eb1 96
97void testExistingPads2()
98{
99 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
100 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
101
102 for ( Int_t is = 0; is < 2; is++ ) {
103 for ( Int_t ip = 0; ip < 2; ip++ ) {
104
105 cout << "Running testExistingPads2 for "
106 << AliMq::Station12TypeName(station[is]) << " "
107 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
108
109 testExistingPads2(station[is], plane[ip]);
110
111 cout << "... end running " << endl << endl;
112 }
113 }
114}
115