]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testGraphicsSlat.C
- All mapping enums within namespace (AliMp).
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testGraphicsSlat.C
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
26 #include "AliMpSt345Reader.h"
27 #include "AliMpSlat.h"
28 #include "AliMpVPainter.h"
29 #include "AliMpMotifReader.h"
30 #include "AliMpMotifType.h"
31 #include "AliMpMotifPosition.h"
32 #include "AliMpMotif.h"
33 #include "TVector2.h"
34 #include "TCanvas.h"
35 #endif
36
37 void testGraphicsMotif(Option_t* motifType = "R43", const TVector2& padSizes = TVector2(2.5,0.5))
38 {
39   // Warning : this function leaks memory. But should be fine as only used 
40   // interactively to check a few motifs at once...
41   //
42   AliMpMotifReader reader(AliMp::kStation345,AliMp::kBendingPlane);
43   AliMpMotifType* type = reader.BuildMotifType(motifType);
44   if (!type)
45   {
46     cerr << "Motif not found" << endl;
47     return;
48   }
49   AliMpMotif* motif = new AliMpMotif(motifType,type,padSizes);
50   AliMpMotifPosition* pos = new AliMpMotifPosition(0,motif,TVector2(0,0));
51   AliMpVPainter* painter = AliMpVPainter::CreatePainter(pos);
52   if (!painter)
53   {
54     cerr << "Could not get a painter !" << endl;
55     return;
56   }
57   TCanvas* c = new TCanvas();
58   painter->Draw("MP");
59 }
60
61 //112230N
62 //112233NR3
63 //220000N
64 //122000NR1
65 //112200NR2
66 void testGraphicsSlat(AliMpPlaneType planeType = AliMp::kBendingPlane, 
67                       Option_t* option = "PMCI",
68                       Bool_t saveJPG = false)
69 {
70   // P plane
71   // M motif
72   // P pad
73   // I indices
74
75   Char_t *slatName[19] = {"122000SR1", "112200SR2", "122200S", "222000N", "220000N",
76                           "122000NR1", "112200NR2", "122200N",
77                           "122330N", "112233NR3", "112230N", "222330N", "223300N", "333000N", "330000N",
78                           "112233N", "222333N", "223330N", "333300N"};
79                           
80   TCanvas *c1[19];
81   Char_t c1Name[255];
82   Char_t c1NameJpg[255];
83
84   for (Int_t i = 0; i < 19; i++) {
85     sprintf(c1Name, "%s%d", "c1", i);
86     c1[i]= new TCanvas(c1Name,slatName[i],10,10,1200,800);     
87
88     Char_t* slatType = slatName[i];
89     AliMpSt345Reader* reader = new AliMpSt345Reader();
90     AliMpSlat* slat = reader->ReadSlat(slatType, planeType);
91     AliMpVPainter* painter = AliMpVPainter::CreatePainter(slat);
92     painter->Draw(option);
93   
94     if (planeType == kNonBendingPlane)
95       sprintf(c1NameJpg, "%s%s", slatName[i], "_NonBending.jpg");
96     else 
97       sprintf(c1NameJpg, "%s%s", slatName[i], "_Bending.jpg");
98     
99     if (saveJPG) c1[i]->Print(c1NameJpg);
100   }
101  
102 }