]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/macros/testSt12PadsUpEtc.C
In Mapping/macros:
[u/mrichter/AliRoot.git] / MUON / mapping / macros / testSt12PadsUpEtc.C
1 // $Id$
2 // $MpId: testPadsUpEtc.C,v 1.8 2005/10/28 15:36:08 ivana Exp $
3 //
4 // Test macro that starts from a given pad and prints 
5 // all pads up, down, right, left from this pad
6 // (up to the plane border).
7
8 #if !defined(__CINT__) || defined(__MAKECINT__)
9
10 #include "AliMpStation12Type.h"
11 #include "AliMpPlaneType.h"
12 #include "AliMpDataProcessor.h"
13 #include "AliMpDataMap.h"
14 #include "AliMpDataStreams.h"
15 #include "AliMpSector.h"
16 #include "AliMpSectorSegmentation.h"
17 #include "AliMpSectorReader.h"
18
19 #include <Riostream.h>
20
21 #endif
22
23 void testPadsUpEtc(AliMq::Station12Type station, AliMp::PlaneType  plane)
24 {
25   AliMpDataProcessor mp;
26   AliMpDataMap* dataMap = mp.CreateDataMap("data");
27   AliMpDataStreams dataStreams(dataMap);
28
29   AliMpSectorReader r(dataStreams, station, plane);
30   AliMpSector* sector = r.BuildSector();
31   AliMpSectorSegmentation segmentation(sector);
32   
33   AliMpIntPair indices(85, 101);
34   if( plane == AliMp::kNonBendingPlane) indices = AliMpIntPair(129, 10);
35  
36   AliMpPad pad;
37   if (segmentation.HasPad(indices)) {
38           
39     pad = segmentation.PadByIndices(indices);
40     cout << "Pad:      "  << pad << endl << endl;
41   
42     cout << "######### GO UP  ############### " << endl;
43
44     AliMpPadPair nextPads(pad, pad);
45     while (nextPads.GetFirst().IsValid()) {
46       nextPads = segmentation.PadsUp(nextPads.GetFirst());
47       cout << " up    1: "  << nextPads.GetFirst() << endl;    
48       cout << "       2: "  << nextPads.GetSecond() << endl;    
49     }
50
51     cout << "######### GO DOWN  ############### " << endl;
52
53     nextPads = AliMpPadPair(pad, pad);
54     while (nextPads.GetFirst().IsValid()) {
55       nextPads = segmentation.PadsDown(nextPads.GetFirst());
56       cout << " down  1: "  << nextPads.GetFirst() << endl;    
57       cout << "       2: "  << nextPads.GetSecond() << endl;    
58     }
59
60     cout << "######### GO RIGHT  ############### " << endl;
61
62     nextPads = AliMpPadPair(pad, pad);
63     while (nextPads.GetFirst().IsValid()) {
64       nextPads = segmentation.PadsRight(nextPads.GetFirst());
65       cout << " right 1: "  << nextPads.GetFirst() << endl;    
66       cout << "       2: "  << nextPads.GetSecond() << endl;    
67     }
68
69     cout << "######### GO LEFT  ############### " << endl;
70
71     nextPads = AliMpPadPair(pad, pad);
72     while (nextPads.GetFirst().IsValid()) {
73       nextPads = segmentation.PadsLeft(nextPads.GetFirst());
74       cout << " left  1: "  << nextPads.GetFirst() << endl;    
75       cout << "       2: "  << nextPads.GetSecond() << endl;    
76     }
77   }  
78 }
79
80 void testPadsUpEtc()
81 {
82   AliMq::Station12Type  station[2] = { AliMq::kStation1, AliMq::kStation2 }; 
83   AliMp::PlaneType      plane[2]   = { AliMp::kBendingPlane, AliMp::kNonBendingPlane };
84   
85   for ( Int_t is = 0; is < 2; is++ ) {
86     for ( Int_t ip = 0; ip < 2; ip++ ) {
87     
88       cout << "Running testPadsUpEtc for " 
89            << AliMq::Station12TypeName(station[is]) << "  "
90            << AliMp::PlaneTypeName(plane[ip])  << " ... " << endl;
91        
92       testPadsUpEtc(station[is], plane[ip]);
93     
94       cout << "... end running " << endl << endl;
95     }  
96   }   
97 }  
98