2 // $MpId: testAllIndices.C,v 1.7 2005/08/24 08:53:27 ivana Exp $
4 // Test macro for testing which pad is seen as "existing" by AliMpSector.
6 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include "AliMpStation12Type.h"
9 #include "AliMpPlaneType.h"
10 #include "AliMpDataProcessor.h"
11 #include "AliMpDataMap.h"
12 #include "AliMpDataStreams.h"
13 #include "AliMpSector.h"
14 #include "AliMpSectorReader.h"
15 #include "AliMpSectorSegmentation.h"
16 #include "AliMpVPainter.h"
18 #include "AliMpVRowSegment.h"
19 #include "AliMpMotifMap.h"
20 #include "AliMpMotifPosition.h"
21 #include "AliMpMotifType.h"
23 #include <Riostream.h>
30 TCanvas* CreateTCanvas(const TString& name, const TString& title,
31 AliMq::Station12Type station, AliMp::PlaneType plane)
33 TString newName(name);
34 TString newTitle(title);
35 TString unique = AliMq::Station12TypeName(station) + AliMp::PlaneTypeName(plane);
38 return new TCanvas(newName.Data(), newTitle.Data());
41 void testAllIndices(AliMq::Station12Type station, AliMp::PlaneType plane)
43 AliMpDataProcessor mp;
44 AliMpDataMap* dataMap = mp.CreateDataMap("data");
45 AliMpDataStreams dataStreams(dataMap);
47 AliMpSectorReader r(dataStreams, station, plane);
49 AliMpSector *sector=r.BuildSector();
50 AliMpSectorSegmentation segmentation(sector);
51 AliMpVPainter* painter = AliMpVPainter::CreatePainter(sector);
53 TCanvas* c1 = CreateTCanvas("view ",
54 "MSectorPainter::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);
70 if (station == AliMq::kStation2) {
74 TH2F* histo2 = new TH2F("histo2","Existing positions",
75 nx2, 0, nx2*2, ny2, 0, ny2*2);
78 TCanvas* c2 = CreateTCanvas("c2 ", "Only existing pads are filled ", station, plane);
79 TCanvas* c3 = CreateTCanvas("c3 ", "Positions ", station, plane);
81 for ( Int_t irow=0; irow<sector->GetNofRows(); irow++ ) {
82 AliMpRow* row = sector->GetRow(irow);
84 for ( Int_t iseg=0; iseg<row->GetNofRowSegments(); iseg++ ) {
85 AliMpVRowSegment* seg = row->GetRowSegment(iseg);
87 for ( Int_t imot=0; imot<seg->GetNofMotifs(); imot++) {
88 AliMpMotifPosition* motifPos
89 = sector->GetMotifMap()->FindMotifPosition(seg->GetMotifPositionId(imot));
91 for ( Int_t gassNum=0; gassNum<64; gassNum++ ) {
92 if (motifPos->GetMotif()->GetMotifType()->FindConnectionByGassiNum(gassNum)){
94 AliMpPad pad = segmentation.PadByLocation(AliMpIntPair(motifPos->GetID(),gassNum));
95 if (pad != AliMpPad::Invalid()) {
96 histo->Fill(pad.GetIndices().GetFirst(),
97 pad.GetIndices().GetSecond());
98 histo2->Fill(pad.Position().X(),
112 void testSt12AllIndices()
114 AliMq::Station12Type station[2] = { AliMq::kStation1, AliMq::kStation2 };
115 AliMp::PlaneType plane[2] = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
117 for ( Int_t is = 0; is < 2; is++ ) {
118 for ( Int_t ip = 0; ip < 2; ip++ ) {
120 cout << "Running testAllIndices for "
121 << AliMq::Station12TypeName(station[is]) << " "
122 << AliMp::PlaneTypeName(plane[ip]) << " ... " << endl;
124 testAllIndices(station[is], plane[ip]);
126 cout << "... end running " << endl << endl;