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 TCanvas* CreateTCanvas(const TString& name, const TString& title,
32 AliMq::Station12Type station, AliMp::PlaneType plane)
34 TString newName(name);
35 TString newTitle(title);
36 TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane);
39 return new TCanvas(newName.Data(), newTitle.Data());
42 void testExistingPads(AliMq::Station12Type station,AliMp::PlaneType plane)
44 AliMpDataProcessor mp;
45 AliMpDataMap* dataMap = mp.CreateDataMap("data");
46 AliMpDataStreams dataStreams(dataMap);
48 AliMpSectorReader r(dataStreams, station, plane);
49 AliMpSector* sector = r.BuildSector();
50 AliMpSectorSegmentation* segmentation = new AliMpSectorSegmentation(sector);
51 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
53 TCanvas* c1 = CreateTCanvas("view ",
54 "AliMpSectorPainter::Draw() output (view per pad) ",
56 painter->Draw("ZSSMP");
59 Int_t maxPadIndexX = segmentation->MaxPadIndexX();
60 Int_t maxPadIndexY = segmentation->MaxPadIndexY();
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);
68 TCanvas* c2 = CreateTCanvas("c2 ","Only existing pads are filled ",
71 for (Int_t i=0; i<maxPadIndexX+1;i++){
72 for (Int_t j=0;j<maxPadIndexY+1;++j){
74 if ( segmentation->HasPadByIndices(i,j) ) histo->Fill(i,j);
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);
85 TCanvas* c3 = CreateTCanvas("c3 ","Only existing pads are filled ",
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){
92 if ( fast->HasPadByIndices(i,j) ) histo2->Fill(i,j);
102 void testSt12ExistingPads()
104 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
105 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
107 for ( Int_t is = 0; is < 2; is++ ) {
108 for ( Int_t ip = 0; ip < 2; ip++ ) {
110 cout << "Running testExistingPads for "
111 << AliMq::Station12TypeName(station[is]) << " "
112 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
114 testExistingPads(station[is], plane[ip]);
116 cout << "... end running " << endl << endl;