]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testSt12ExistingPads2.C
Update master to aliroot
[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++) {
168e9c4d 66 if ( segmentation->HasPadByIndices(i,j) )
72d8f376 67 out1 << std::setw(4) << ++counter1 << " "
168e9c4d 68 << segmentation->PadByIndices(i,j) << endl;;
72d8f376 69 }
70 }
71
cddd101e 72 if ( sector->GetDirection() == AliMp::kY )
530f2f27 73 for (Int_t j=1; j<segmentation->MaxPadIndexY()+1; j++) {
74 for (Int_t i=1; i<segmentation->MaxPadIndexX()+1; i++) {
168e9c4d 75 if ( segmentation->HasPadByIndices(i,j) )
72d8f376 76 out1 << std::setw(4) << ++counter1 << " "
168e9c4d 77 << segmentation->PadByIndices(i,j) << endl;;
72d8f376 78 }
79 }
80
81 // Second loop via pad area iterator
82 cout << "Iterating via iterator ..." << endl;
6e97fbb8 83 AliMpArea area(60.,60.,60.,60.);
530f2f27 84 AliMpVPadIterator* it = segmentation->CreateIterator(area);
72d8f376 85 Int_t counter2 = 0;
86 for (it->First(); ! it->IsDone(); it->Next()){
87
88 out2 << std::setw(4) << ++counter2 << " "
89 << it->CurrentItem() << endl;
90 }
530f2f27 91
92 delete segmentation;
72d8f376 93}
f05d3eb1 94
6aa39548 95void testSt12ExistingPads2()
f05d3eb1 96{
97 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
98 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
99
100 for ( Int_t is = 0; is < 2; is++ ) {
101 for ( Int_t ip = 0; ip < 2; ip++ ) {
102
103 cout << "Running testExistingPads2 for "
104 << AliMq::Station12TypeName(station[is]) << " "
105 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
106
107 testExistingPads2(station[is], plane[ip]);
108
109 cout << "... end running " << endl << endl;
110 }
111 }
112}
113