]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testSt12ExistingPads.C
Replacement of AliMpIntPair object with algoritmic
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12ExistingPads.C
CommitLineData
66e0997c 1// $Id$
57ff4119 2// $MpId: testExistingPads.C,v 1.12 2005/10/28 15:36:07 ivana Exp $
66e0997c 3//
530f2f27 4// Test macro for testing which pad is seen as "existing" by
5// by AliMpSectorSegmentation and AliMpFastSegmentation
6// To run macro:
7// root [0] .L testExistingPads.C+
8// root [1] testExistingPads();
66e0997c 9
530f2f27 10#if !defined(__CINT__) || defined(__MAKECINT__)
11
12#include "AliMpStation12Type.h"
13#include "AliMpPlaneType.h"
14#include "AliMpDataProcessor.h"
15#include "AliMpDataMap.h"
16#include "AliMpDataStreams.h"
17#include "AliMpSector.h"
18#include "AliMpSectorReader.h"
19#include "AliMpSectorSegmentation.h"
20#include "AliMpFastSegmentation.h"
21#include "AliMpArea.h"
22#include "AliMpVPadIterator.h"
23#include "AliMpVPainter.h"
24
25#include <Riostream.h>
26#include <TCanvas.h>
27#include <TH2.h>
28
530f2f27 29#endif
334be4b7 30
6aa39548 31TCanvas* CreateTCanvas(const TString& name, const TString& title,
32 AliMq::Station12Type station, AliMp::PlaneType plane)
33{
34 TString newName(name);
35 TString newTitle(title);
36 TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane);
37 newName += unique;
38 newTitle += unique;
39 return new TCanvas(newName.Data(), newTitle.Data());
40}
41
f05d3eb1 42void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane)
530f2f27 43{
44 AliMpDataProcessor mp;
45 AliMpDataMap* dataMap = mp.CreateDataMap("data");
46 AliMpDataStreams dataStreams(dataMap);
47
48 AliMpSectorReader r(dataStreams, station, plane);
49 AliMpSector* sector = r.BuildSector();
50 AliMpSectorSegmentation* segmentation = new AliMpSectorSegmentation(sector);
66e0997c 51 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
52
6aa39548 53 TCanvas* c1 = CreateTCanvas("view ",
54 "AliMpSectorPainter::Draw() output (view per pad) ",
55 station, plane);
66e0997c 56 painter->Draw("ZSSMP");
57 c1->Update();
58
530f2f27 59 Int_t maxPadIndexX = segmentation->MaxPadIndexX();
60 Int_t maxPadIndexY = segmentation->MaxPadIndexY();
72d8f376 61
62 // Define histogram limits
63 Int_t nx = (maxPadIndexX/10 + 1)*10;
64 Int_t ny = (maxPadIndexY/10 + 1)*10;
65 TH2C* histo = new TH2C("histo","Existing pads",
66 nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
67
6aa39548 68 TCanvas* c2 = CreateTCanvas("c2 ","Only existing pads are filled ",
69 station, plane);
66e0997c 70
72d8f376 71 for (Int_t i=0; i<maxPadIndexX+1;i++){
72 for (Int_t j=0;j<maxPadIndexY+1;++j){
66e0997c 73
168e9c4d 74 if ( segmentation->HasPadByIndices(i,j) ) histo->Fill(i,j);
66e0997c 75 }
76 }
77
78 c2->cd();
79 histo->Draw("box");
530f2f27 80
81 // the same plot with fast segmentation
82 TH2C* histo2 = new TH2C("histo2","Existing pads2",
83 nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
84
6aa39548 85 TCanvas* c3 = CreateTCanvas("c3 ","Only existing pads are filled ",
86 station, plane);
530f2f27 87
88 AliMpFastSegmentation* fast = new AliMpFastSegmentation(segmentation);
89 for (Int_t i=0; i<maxPadIndexX+1;i++){
90 for (Int_t j=0;j<maxPadIndexY+1;++j){
91
168e9c4d 92 if ( fast->HasPadByIndices(i,j) ) histo2->Fill(i,j);
530f2f27 93 }
94 }
95
96 c3->cd();
97 histo2->Draw("box");
98
99 delete fast;
66e0997c 100}
f05d3eb1 101
6aa39548 102void testSt12ExistingPads()
f05d3eb1 103{
104 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
105 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
106
107 for ( Int_t is = 0; is < 2; is++ ) {
108 for ( Int_t ip = 0; ip < 2; ip++ ) {
109
110 cout << "Running testExistingPads for "
111 << AliMq::Station12TypeName(station[is]) << " "
112 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
113
114 testExistingPads(station[is], plane[ip]);
115
116 cout << "... end running " << endl << endl;
117 }
118 }
119}