2 // $MpId: testExistingPads.C,v 1.12 2005/10/28 15:36:07 ivana Exp $
4 // Test macro for testing which pad is seen as "existing" by
5 // by AliMpSectorSegmentation and AliMpFastSegmentation
7 // root [0] .L testExistingPads.C+
8 // root [1] testExistingPads();
10 #if !defined(__CINT__) || defined(__MAKECINT__)
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"
25 #include <Riostream.h>
31 void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane)
33 AliMpDataProcessor mp;
34 AliMpDataMap* dataMap = mp.CreateDataMap("data");
35 AliMpDataStreams dataStreams(dataMap);
37 AliMpSectorReader r(dataStreams, station, plane);
38 AliMpSector* sector = r.BuildSector();
39 AliMpSectorSegmentation* segmentation = new AliMpSectorSegmentation(sector);
40 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
42 TCanvas* c1 = new TCanvas("view",
43 "AliMpSectorPainter::Draw() output (view per pad)");
44 painter->Draw("ZSSMP");
47 Int_t maxPadIndexX = segmentation->MaxPadIndexX();
48 Int_t maxPadIndexY = segmentation->MaxPadIndexY();
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);
56 TCanvas* c2 = new TCanvas("c2","Only existing pads are filled");
58 for (Int_t i=0; i<maxPadIndexX+1;i++){
59 for (Int_t j=0;j<maxPadIndexY+1;++j){
61 AliMpIntPair indices(i,j);
62 if (segmentation->HasPad(indices)) histo->Fill(i,j);
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);
73 TCanvas* c3 = new TCanvas("c3","Only existing pads are filled");
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){
79 AliMpIntPair indices(i,j);
80 if (fast->HasPad(indices)) histo2->Fill(i,j);
90 void testExistingPads()
92 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
93 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
95 for ( Int_t is = 0; is < 2; is++ ) {
96 for ( Int_t ip = 0; ip < 2; ip++ ) {
98 cout << "Running testExistingPads for "
99 << AliMq::Station12TypeName(station[is]) << " "
100 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
102 testExistingPads(station[is], plane[ip]);
104 cout << "... end running " << endl << endl;