]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testSt12ExistingPads.C
New setting of the cross-section (Bogdan)
[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
f05d3eb1 31void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane)
530f2f27 32{
33 AliMpDataProcessor mp;
34 AliMpDataMap* dataMap = mp.CreateDataMap("data");
35 AliMpDataStreams dataStreams(dataMap);
36
37 AliMpSectorReader r(dataStreams, station, plane);
38 AliMpSector* sector = r.BuildSector();
39 AliMpSectorSegmentation* segmentation = new AliMpSectorSegmentation(sector);
66e0997c 40 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
41
42 TCanvas* c1 = new TCanvas("view",
43 "AliMpSectorPainter::Draw() output (view per pad)");
44 painter->Draw("ZSSMP");
45 c1->Update();
46
530f2f27 47 Int_t maxPadIndexX = segmentation->MaxPadIndexX();
48 Int_t maxPadIndexY = segmentation->MaxPadIndexY();
72d8f376 49
50 // Define histogram limits
51 Int_t nx = (maxPadIndexX/10 + 1)*10;
52 Int_t ny = (maxPadIndexY/10 + 1)*10;
53 TH2C* histo = new TH2C("histo","Existing pads",
54 nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
55
66e0997c 56 TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
57
72d8f376 58 for (Int_t i=0; i<maxPadIndexX+1;i++){
59 for (Int_t j=0;j<maxPadIndexY+1;++j){
66e0997c 60
61 AliMpIntPair indices(i,j);
530f2f27 62 if (segmentation->HasPad(indices)) histo->Fill(i,j);
66e0997c 63 }
64 }
65
66 c2->cd();
67 histo->Draw("box");
530f2f27 68
69 // the same plot with fast segmentation
70 TH2C* histo2 = new TH2C("histo2","Existing pads2",
71 nx, -0.5, nx-0.5, ny, -0.5, ny-0.5);
72
73 TCanvas* c3 = new TCanvas("c3","Only existing pads are filled");
74
75 AliMpFastSegmentation* fast = new AliMpFastSegmentation(segmentation);
76 for (Int_t i=0; i<maxPadIndexX+1;i++){
77 for (Int_t j=0;j<maxPadIndexY+1;++j){
78
79 AliMpIntPair indices(i,j);
80 if (fast->HasPad(indices)) histo2->Fill(i,j);
81 }
82 }
83
84 c3->cd();
85 histo2->Draw("box");
86
87 delete fast;
66e0997c 88}
f05d3eb1 89
90void testExistingPads()
91{
92 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
93 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
94
95 for ( Int_t is = 0; is < 2; is++ ) {
96 for ( Int_t ip = 0; ip < 2; ip++ ) {
97
98 cout << "Running testExistingPads for "
99 << AliMq::Station12TypeName(station[is]) << " "
100 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
101
102 testExistingPads(station[is], plane[ip]);
103
104 cout << "... end running " << endl << endl;
105 }
106 }
107}