1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
20 // Class with functions for testing
22 // Author: Ivana Hrivnacova, IPN Orsay
24 #include <TStopwatch.h>
25 #include <Riostream.h>
28 #include "AliSegmentation.h"
31 #include "AliMUONTest.h"
33 #include "AliMUONConstants.h"
34 #include "AliMUONGeometryModule.h"
35 #include "AliMUONGeometryStore.h"
36 #include "AliMUONGeometrySegmentation.h"
37 #include "AliMUONSt12QuadrantSegmentation.h"
41 //__________________________________________________________________
42 AliMUONTest::AliMUONTest(const TString& configMacro)
45 // Standard Constructor
48 gAlice->Init(configMacro.Data());
51 //__________________________________________________________________
52 AliMUONTest::AliMUONTest()
55 // Default Constructor
59 //____________________________________________________________________
60 AliMUONTest::AliMUONTest(const AliMUONTest& rhs)
63 // Protected copy constructor
65 AliFatal("Not implemented.");
68 //____________________________________________________________________
69 AliMUONTest::~AliMUONTest()
74 //________________________________________________________________________
75 AliMUONTest& AliMUONTest::operator = (const AliMUONTest& rhs)
77 // Protected assignement operator
79 if (this == &rhs) return *this;
81 AliFatal("Not implemented.");
90 //______________________________________________________________________________
91 void AliMUONTest::DetElemTransforms()
94 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
96 AliFatal("MUON detector not defined.");
100 // Loop over chambers
101 for (Int_t i=0; i<AliMUONConstants::NCh(); i++) {
103 AliMUONGeometryModule* geometry = muon->Chamber(i).GetGeometry();
104 AliMUONGeometryStore* detElements = geometry->GetDetElementStore();
106 // Loop over detection elements
107 for (Int_t j=0; j<detElements->GetNofEntries(); j++) {
109 //Int_t detElemId = geometry->GetDetElemId(j);
110 Int_t detElemId = detElements->GetEntry(j)->GetUniqueID();
111 cout << "Detection element Id: " << detElemId << endl;
114 geometry->Local2Global(detElemId, 0., 0., 0., x, y, z);
115 cout << " Global DE position: "
116 << x << ", " << y << ", " << z << endl;
119 geometry->Global2Local(detElemId, 0., 0., 0., x2, y2, z2);
120 cout << " ALIC center in the local frame: "
121 << x2 << ", " << y2 << ", " << z2 << endl;
124 geometry->Global2Local(detElemId, x, y, z, x3, y3, z3);
125 cout << " Back in the local frame: "
126 << x3 << ", " << y3 << ", " << z3 << endl;
132 //______________________________________________________________________________
133 void AliMUONTest::PrintPadPositions1()
135 // Build new segmentations (based on the detection element local
136 // segmentations), iterate over all segmentations and print global
139 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
141 AliFatal("MUON detector not defined.");
145 // Loop over chambers
146 for (Int_t i=0; i<1; i++) {
148 // Create chamber segmentations
149 AliMUONGeometrySegmentation* seg[2];
150 seg[0] = new AliMUONGeometrySegmentation(muon->Chamber(i).GetGeometry());
151 seg[1] = new AliMUONGeometrySegmentation(muon->Chamber(i).GetGeometry());
153 // Quadrant segmentations:
154 AliMUONSt12QuadrantSegmentation* bendSt1
155 = new AliMUONSt12QuadrantSegmentation(kStation1, kBendingPlane);
156 AliMUONSt12QuadrantSegmentation* nonbendSt1
157 = new AliMUONSt12QuadrantSegmentation(kStation1, kNonBendingPlane);
159 // The same configuration for both chambers of Station 1
160 Int_t id0 = (i+1)*100;
162 // Configure St1 chamber segmentations
163 seg[0]->Add(id0, bendSt1);
164 seg[0]->Add(id0 + 1, nonbendSt1);
165 seg[0]->Add(id0 + 50, nonbendSt1);
166 seg[0]->Add(id0 + 51, bendSt1);
168 seg[1]->Add(id0, nonbendSt1);
169 seg[1]->Add(id0 + 1, bendSt1);
170 seg[1]->Add(id0 + 50, bendSt1);
171 seg[1]->Add(id0 + 51, nonbendSt1);
173 // Iterate over the whole plane and return pad indices and
174 // global/local positions
175 cout << "Go to loop over pads" << endl;
176 for (Int_t cath=0; cath<2; cath++) {
178 cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
179 cout << "===================================" << endl;
184 for ( seg[cath]->FirstPad(100, 70., 70., 0., 80., 80.);
185 seg[cath]->MorePads(100);
186 seg[cath]->NextPad(100) )
188 cout << setw(6) << "counter " << counter++ << " ";
190 Int_t ix = seg[cath]->Ix();
191 Int_t iy = seg[cath]->Iy();
192 Int_t deId = seg[cath]->DetElemId();
193 cout << "Pad indices: ( " << deId << "; " << ix << ", " << iy << " ) " ;
196 seg[cath]->GetPadC(deId, ix, iy, x, y, z);
197 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;
205 //________________________________________________________________________
206 void AliMUONTest::PrintPadPositions2()
208 // Iterate over all chamber segmentations and prints
209 // global pad positions
211 AliMUON* muon = (AliMUON*)gAlice->GetModule("MUON");
213 AliFatal("MUON detector not defined.");
217 // Loop over chambers
218 for (Int_t i=0; i<1; i++) {
220 // Create chamber segmentations
221 AliSegmentation* seg[2];
222 seg[0] = muon->Chamber(i).SegmentationModel(0);
223 seg[1] = muon->Chamber(i).SegmentationModel(1);
225 // Iterate over the whole plane and return pad indices and
226 // global/local positions
227 cout << "Go to loop over pads" << endl;
228 for (Int_t cath=0; cath<2; cath++) {
230 cout << setw(6) << "Pads in chamber " << i << " cathod " << cath << endl;
231 cout << "===================================" << endl;
236 for ( seg[cath]->FirstPad(70., 70., 0., 80., 80.);
237 seg[cath]->MorePads();
238 seg[cath]->NextPad() )
240 cout << setw(6) << "counter " << counter++ << " ";
242 Int_t ix = seg[cath]->Ix();
243 Int_t iy = seg[cath]->Iy();
244 cout << "Pad indices: ( " << ix << ", " << iy << " ) " ;
247 seg[cath]->GetPadC(ix, iy, x, y, z);
248 cout << "Pad position: ( " << x << ", " << y << ", " << z << " )" << endl;