]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/macros/testGraphicsSlat.C
Update master to aliroot
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testGraphicsSlat.C
CommitLineData
1a4f7d81 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16// $Id$
17// $MpId: $
18
19//
20// Test macro for drawing slat motifs with real contours
21// Christian Finck, Subatech
22//
23#if !defined(__CINT__) || defined(__MAKECINT__)
24
25// MUON includes
f05d3eb1 26#include "AliMpStationType.h"
27#include "AliMpStation12Type.h"
28#include "AliMpPlaneType.h"
29#include "AliMpDataProcessor.h"
30#include "AliMpDataMap.h"
31#include "AliMpDataStreams.h"
1a4f7d81 32#include "AliMpSt345Reader.h"
f7c30ed6 33#include "AliMpPCB.h"
1a4f7d81 34#include "AliMpSlat.h"
35#include "AliMpVPainter.h"
bde6e10f 36#include "AliMpMotifReader.h"
37#include "AliMpMotifType.h"
38#include "AliMpMotifPosition.h"
39#include "AliMpMotif.h"
cf268f96 40#include "AliMpSlatMotifMap.h"
f05d3eb1 41#include "AliMpDataStreams.h"
42
bde6e10f 43#include "TVector2.h"
44#include "TCanvas.h"
f05d3eb1 45
1a4f7d81 46#endif
47
1c4729e8 48void testGraphicsMotif(Option_t* motifType = "R43", Double_t padsizex=5.0, Double_t padsizey=0.5)
bde6e10f 49{
50 // Warning : this function leaks memory. But should be fine as only used
51 // interactively to check a few motifs at once...
52 //
f05d3eb1 53 AliMpDataProcessor mp;
54 AliMpDataMap* dataMap = mp.CreateDataMap("data");
55 AliMpDataStreams dataStreams(dataMap);
56
57 AliMp::StationType station = AliMp::kStation345;
58 AliMq::Station12Type station12 = AliMq::kNotSt12;
59 AliMp::PlaneType plane = AliMp::kBendingPlane;
60
61 AliMpMotifReader reader(dataStreams, station, station12, plane);
bde6e10f 62 AliMpMotifType* type = reader.BuildMotifType(motifType);
63 if (!type)
64 {
65 cerr << "Motif not found" << endl;
66 return;
67 }
f7c30ed6 68 type->Print("G");
1c4729e8 69 AliMpMotif* motif = new AliMpMotif(motifType,type,padsizex,padsizey);
70 AliMpMotifPosition* pos = new AliMpMotifPosition(0,motif,0,0);
bde6e10f 71 AliMpVPainter* painter = AliMpVPainter::CreatePainter(pos);
72 if (!painter)
73 {
74 cerr << "Could not get a painter !" << endl;
75 return;
76 }
f7c30ed6 77 new TCanvas(motifType,motifType);
78 painter->Draw("PT");
bde6e10f 79}
1a4f7d81 80
81//112230N
82//112233NR3
83//220000N
84//122000NR1
85//112200NR2
cf268f96 86void testGraphicsSlat(AliMp::PlaneType planeType = AliMp::kBendingPlane,
1a4f7d81 87 Option_t* option = "PMCI",
88 Bool_t saveJPG = false)
89{
90 // P plane
91 // M motif
92 // P pad
93 // I indices
94
f05d3eb1 95 AliMpDataProcessor mp;
96 AliMpDataMap* dataMap = mp.CreateDataMap("data");
97 AliMpDataStreams dataStreams(dataMap);
98
99 AliMpSlatMotifMap* motifMap = new AliMpSlatMotifMap();
100 AliMpSt345Reader* reader = new AliMpSt345Reader(dataStreams, motifMap);
101
f7c30ed6 102 // PMPT to get manu channels numbering
103
1a4f7d81 104 Char_t *slatName[19] = {"122000SR1", "112200SR2", "122200S", "222000N", "220000N",
105 "122000NR1", "112200NR2", "122200N",
106 "122330N", "112233NR3", "112230N", "222330N", "223300N", "333000N", "330000N",
107 "112233N", "222333N", "223330N", "333300N"};
108
109 TCanvas *c1[19];
110 Char_t c1Name[255];
111 Char_t c1NameJpg[255];
cf268f96 112
1c4729e8 113 for (Int_t i = 0; i < 19; i++) {
1a4f7d81 114 sprintf(c1Name, "%s%d", "c1", i);
115 c1[i]= new TCanvas(c1Name,slatName[i],10,10,1200,800);
116
117 Char_t* slatType = slatName[i];
f05d3eb1 118
1a4f7d81 119 AliMpSlat* slat = reader->ReadSlat(slatType, planeType);
120 AliMpVPainter* painter = AliMpVPainter::CreatePainter(slat);
121 painter->Draw(option);
122
cf268f96 123 if (planeType == AliMp::kNonBendingPlane)
1a4f7d81 124 sprintf(c1NameJpg, "%s%s", slatName[i], "_NonBending.jpg");
125 else
126 sprintf(c1NameJpg, "%s%s", slatName[i], "_Bending.jpg");
127
128 if (saveJPG) c1[i]->Print(c1NameJpg);
129 }
1a4f7d81 130}
f7c30ed6 131
132void testGraphicsPCB(const char* pcbName="S2B",
133 Option_t* option = "MZT",
134 Bool_t savePNG = false)
135{
136
137 TCanvas* c = new TCanvas(pcbName,pcbName,10,10,1200,800);
138
f05d3eb1 139 AliMpDataProcessor mp;
140 AliMpDataMap* dataMap = mp.CreateDataMap("data");
141 AliMpDataStreams dataStreams(dataMap);
142
143 AliMpSlatMotifMap* motifMap = new AliMpSlatMotifMap();
144 AliMpSt345Reader* reader = new AliMpSt345Reader(dataStreams, motifMap);
f7c30ed6 145 AliMpPCB* pcb = reader->ReadPCB(pcbName);
146 if (!pcb)
147 {
148 cerr << "PCB " << pcbName << " does not exist" << endl;
149 return;
150 }
151
152 AliMpVPainter* painter = AliMpVPainter::CreatePainter(pcb);
153 painter->Draw(option);
154
155 if (savePNG) c->Print(Form("%s-%s.png",pcbName,option));
156
157}