AddTimeStamp was always increasing track length but accounting
[u/mrichter/AliRoot.git] / MFT / AliMFTPlane.cxx
CommitLineData
820b4d9e 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//====================================================================================================================================================
17//
18// Class for the description of the structure for the planes of the ALICE Muon Forward Tracker
19//
20// Contact author: antonio.uras@cern.ch
21//
22//====================================================================================================================================================
23
24#include "TNamed.h"
25#include "THnSparse.h"
26#include "TClonesArray.h"
820b4d9e 27#include "TAxis.h"
28#include "TPave.h"
29#include "TCanvas.h"
30#include "TH2D.h"
31#include "TEllipse.h"
32#include "TMath.h"
33#include "AliLog.h"
d4643a10 34#include "AliMFTConstants.h"
35#include "AliMFTPlane.h"
36
37const Double_t AliMFTPlane::fRadiusMin = AliMFTConstants::fRadiusMin;
38const Double_t AliMFTPlane::fActiveSuperposition = AliMFTConstants::fActiveSuperposition;
39const Double_t AliMFTPlane::fHeightActive = AliMFTConstants::fHeightActive;
40const Double_t AliMFTPlane::fHeightReadout = AliMFTConstants::fHeightReadout;
41const Double_t AliMFTPlane::fSupportExtMargin = AliMFTConstants::fSupportExtMargin;
820b4d9e 42
43ClassImp(AliMFTPlane)
44
45//====================================================================================================================================================
46
47AliMFTPlane::AliMFTPlane():
48 TNamed(),
d4643a10 49 fPlaneNumber(-1),
820b4d9e 50 fZCenter(0),
51 fRMinSupport(0),
52 fRMax(0),
53 fRMaxSupport(0),
54 fPixelSizeX(0),
55 fPixelSizeY(0),
56 fThicknessActive(0),
57 fThicknessSupport(0),
58 fThicknessReadout(0),
59 fZCenterActiveFront(0),
60 fZCenterActiveBack(0),
61 fEquivalentSilicon(0),
62 fEquivalentSiliconBeforeFront(0),
63 fEquivalentSiliconBeforeBack(0),
64 fActiveElements(0),
65 fReadoutElements(0),
bcaf50eb 66 fSupportElements(0),
67 fHasPixelRectangularPatternAlongY(kFALSE)
820b4d9e 68{
69
820b4d9e 70 // default constructor
71
72}
73
74//====================================================================================================================================================
75
76AliMFTPlane::AliMFTPlane(const Char_t *name, const Char_t *title):
77 TNamed(name, title),
d4643a10 78 fPlaneNumber(-1),
820b4d9e 79 fZCenter(0),
80 fRMinSupport(0),
81 fRMax(0),
82 fRMaxSupport(0),
83 fPixelSizeX(0),
84 fPixelSizeY(0),
85 fThicknessActive(0),
86 fThicknessSupport(0),
87 fThicknessReadout(0),
88 fZCenterActiveFront(0),
89 fZCenterActiveBack(0),
90 fEquivalentSilicon(0),
91 fEquivalentSiliconBeforeFront(0),
92 fEquivalentSiliconBeforeBack(0),
d4643a10 93 fActiveElements(new TClonesArray("THnSparseC")),
94 fReadoutElements(new TClonesArray("THnSparseC")),
bcaf50eb 95 fSupportElements(new TClonesArray("THnSparseC")),
96 fHasPixelRectangularPatternAlongY(kFALSE)
820b4d9e 97{
98
d4643a10 99 // constructor
820b4d9e 100
101}
102
103//====================================================================================================================================================
104
105AliMFTPlane::AliMFTPlane(const AliMFTPlane& plane):
106 TNamed(plane),
107 fPlaneNumber(plane.fPlaneNumber),
108 fZCenter(plane.fZCenter),
109 fRMinSupport(plane.fRMinSupport),
110 fRMax(plane.fRMax),
111 fRMaxSupport(plane.fRMaxSupport),
112 fPixelSizeX(plane.fPixelSizeX),
113 fPixelSizeY(plane.fPixelSizeY),
114 fThicknessActive(plane.fThicknessActive),
115 fThicknessSupport(plane.fThicknessSupport),
116 fThicknessReadout(plane.fThicknessReadout),
117 fZCenterActiveFront(plane.fZCenterActiveFront),
118 fZCenterActiveBack(plane.fZCenterActiveBack),
119 fEquivalentSilicon(plane.fEquivalentSilicon),
120 fEquivalentSiliconBeforeFront(plane.fEquivalentSiliconBeforeFront),
121 fEquivalentSiliconBeforeBack(plane.fEquivalentSiliconBeforeBack),
d4643a10 122 fActiveElements(new TClonesArray("THnSparseC")),
123 fReadoutElements(new TClonesArray("THnSparseC")),
bcaf50eb 124 fSupportElements(new TClonesArray("THnSparseC")),
125 fHasPixelRectangularPatternAlongY(plane.fHasPixelRectangularPatternAlongY)
820b4d9e 126{
127
128 // copy constructor
d4643a10 129
130 *fActiveElements = *plane.fActiveElements;
131 *fReadoutElements = *plane.fReadoutElements;
132 *fSupportElements = *plane.fSupportElements;
820b4d9e 133
134}
135
136//====================================================================================================================================================
137
138AliMFTPlane& AliMFTPlane::operator=(const AliMFTPlane& plane) {
139
140 // Assignment operator
141
142 // check assignement to self
d4643a10 143 if (this != &plane) {
820b4d9e 144
d4643a10 145 // base class assignement
146 TNamed::operator=(plane);
147
bcaf50eb 148 fPlaneNumber = plane.fPlaneNumber;
149 fZCenter = plane.fZCenter;
150 fRMinSupport = plane.fRMinSupport;
151 fRMax = plane.fRMax;
152 fRMaxSupport = plane.fRMaxSupport;
153 fPixelSizeX = plane.fPixelSizeX;
154 fPixelSizeY = plane.fPixelSizeY;
155 fThicknessActive = plane.fThicknessActive;
156 fThicknessSupport = plane.fThicknessSupport;
157 fThicknessReadout = plane.fThicknessReadout;
158 fZCenterActiveFront = plane.fZCenterActiveFront;
159 fZCenterActiveBack = plane.fZCenterActiveBack;
160 fEquivalentSilicon = plane.fEquivalentSilicon;
161 fEquivalentSiliconBeforeFront = plane.fEquivalentSiliconBeforeFront;
162 fEquivalentSiliconBeforeBack = plane.fEquivalentSiliconBeforeBack;
163 *fActiveElements = *plane.fActiveElements;
164 *fReadoutElements = *plane.fReadoutElements;
165 *fSupportElements = *plane.fSupportElements;
166 fHasPixelRectangularPatternAlongY = plane.fHasPixelRectangularPatternAlongY;
d4643a10 167 }
820b4d9e 168
169 return *this;
d4643a10 170
820b4d9e 171}
172
173//====================================================================================================================================================
174
175Bool_t AliMFTPlane::Init(Int_t planeNumber,
176 Double_t zCenter,
177 Double_t rMin,
178 Double_t rMax,
179 Double_t pixelSizeX,
180 Double_t pixelSizeY,
181 Double_t thicknessActive,
182 Double_t thicknessSupport,
bcaf50eb 183 Double_t thicknessReadout,
184 Bool_t hasPixelRectangularPatternAlongY) {
820b4d9e 185
186 AliDebug(1, Form("Initializing Plane Structure for Plane %s", GetName()));
187
188 fPlaneNumber = planeNumber;
189 fZCenter = zCenter;
190 fRMinSupport = rMin;
191 fRMax = rMax;
192 fPixelSizeX = pixelSizeX;
193 fPixelSizeY = pixelSizeY;
194 fThicknessActive = thicknessActive;
195 fThicknessSupport = thicknessSupport;
196 fThicknessReadout = thicknessReadout;
197
bcaf50eb 198 fHasPixelRectangularPatternAlongY = hasPixelRectangularPatternAlongY;
199
820b4d9e 200 fZCenterActiveFront = fZCenter - 0.5*fThicknessSupport - 0.5*fThicknessActive;
201 fZCenterActiveBack = fZCenter + 0.5*fThicknessSupport + 0.5*fThicknessActive;
202
58b93f36 203// if (fRMinSupport <= fRadiusMin) fRMinSupport = fRadiusMin;
204// else {
205// fRMinSupport = fRadiusMin + (fHeightActive-fActiveSuperposition) * Int_t((fRMinSupport-fRadiusMin)/(fHeightActive-fActiveSuperposition));
206// }
820b4d9e 207
208 if (fRMax < fRMinSupport+fHeightActive) fRMax = fRMinSupport + fHeightActive;
209
210 fRMax = fRMinSupport + (fHeightActive-fActiveSuperposition) *
211 (Int_t((fRMax-fRMinSupport-fHeightActive)/(fHeightActive-fActiveSuperposition))+1) + fHeightActive;
212
d4643a10 213 fRMaxSupport = TMath::Sqrt(fHeightActive*(2.*rMax-fHeightActive) + fRMax*fRMax) + fSupportExtMargin;
820b4d9e 214
215 return kTRUE;
216
217}
218
219//====================================================================================================================================================
220
221Bool_t AliMFTPlane::CreateStructure() {
222
223 Int_t nBins[3]={0};
224 Double_t minPosition[3]={0}, maxPosition[3]={0};
225
226 // ------------------- support element -------------------------------------------------
227
228 nBins[0] = 1;
229 nBins[1] = 1;
230 nBins[2] = 1;
231
232 minPosition[0] = -1.*fRMaxSupport;
233 minPosition[1] = -1.*fRMaxSupport;
234 minPosition[2] = fZCenter - 0.5*fThicknessSupport;
235
236 maxPosition[0] = +1.*fRMaxSupport;
237 maxPosition[1] = +1.*fRMaxSupport;
238 maxPosition[2] = fZCenter + 0.5*fThicknessSupport;
239
240 new ((*fSupportElements)[fSupportElements->GetEntries()]) THnSparseC(Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()),
241 Form("MFTSupportElemHist_%02d%03d", fPlaneNumber, fSupportElements->GetEntries()),
242 3, nBins, minPosition, maxPosition);
243
244 // ------------------- det elements: active + readout ----------------------------------
245
246 Double_t lowEdgeActive = -1.*fRMax;
247 Double_t supEdgeActive = lowEdgeActive + fHeightActive;
248 Double_t zMin = 0.;
249 Bool_t isFront = kTRUE;
250
251 while (supEdgeActive < fRMax+0.01) {
252
253 if (isFront) zMin = fZCenter - 0.5*fThicknessSupport - fThicknessActive;
254 else zMin = fZCenter + 0.5*fThicknessSupport;
255
256 Double_t extLimitAtLowEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(lowEdgeActive))));
257 Double_t extLimitAtSupEdgeActive = TMath::Sqrt((fRMax-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMax - (fRMax-TMath::Abs(supEdgeActive))));
258
259 // creating new det element: active + readout
260
261 Double_t extLimitDetElem = TMath::Max(extLimitAtLowEdgeActive, extLimitAtSupEdgeActive);
262
263 if (supEdgeActive<-1.*fRMinSupport+0.01 || lowEdgeActive>1.*fRMinSupport-0.01) { // single element covering the row
264
265 nBins[0] = TMath::Nint(2.*extLimitDetElem/fPixelSizeX);
266 nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
267 nBins[2] = 1;
268
269 minPosition[0] = -1.*extLimitDetElem;
270 minPosition[1] = lowEdgeActive;
271 minPosition[2] = zMin;
272
273 maxPosition[0] = +1.*extLimitDetElem;
274 maxPosition[1] = supEdgeActive;
275 maxPosition[2] = zMin+fThicknessActive;
276
277 new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
278 Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
279 3, nBins, minPosition, maxPosition);
280
281 if (supEdgeActive>0.) {
282 minPosition[1] = supEdgeActive;
283 maxPosition[1] = supEdgeActive+fHeightReadout;
284 }
285 else {
286 minPosition[1] = lowEdgeActive-fHeightReadout;
287 maxPosition[1] = lowEdgeActive;
288 }
289
290 new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
291 Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
292 3, nBins, minPosition, maxPosition);
293
294 }
295
296 else { // two elements covering the row
297
298 Double_t intLimitAtLowEdge = 0., intLimitAtSupEdge = 0.;
299 if (fRMinSupport-TMath::Abs(lowEdgeActive)>0.) intLimitAtLowEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(lowEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(lowEdgeActive))));
300 if (fRMinSupport-TMath::Abs(supEdgeActive)>0.) intLimitAtSupEdge = TMath::Sqrt((fRMinSupport-TMath::Abs(supEdgeActive)) * TMath::Abs(2*fRMinSupport - (fRMinSupport-TMath::Abs(supEdgeActive))));
301 Double_t intLimitDetElem = TMath::Max(intLimitAtLowEdge, intLimitAtSupEdge);
302
303 nBins[0] = TMath::Nint((extLimitDetElem-intLimitDetElem)/fPixelSizeX);
304 nBins[1] = TMath::Nint(fHeightActive/fPixelSizeY);
305 nBins[2] = 1;
306
307 // left element
308
309 minPosition[0] = -1.*extLimitDetElem;
310 minPosition[1] = lowEdgeActive;
311 minPosition[2] = zMin;
312
313 maxPosition[0] = -1.*intLimitDetElem;
314 maxPosition[1] = supEdgeActive;
315 maxPosition[2] = zMin+fThicknessActive;
316
317 new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
318 Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
319 3, nBins, minPosition, maxPosition);
320
321 if (supEdgeActive>0.) {
322 minPosition[1] = supEdgeActive;
323 maxPosition[1] = supEdgeActive+fHeightReadout;
324 }
325 else {
326 minPosition[1] = lowEdgeActive-fHeightReadout;
327 maxPosition[1] = lowEdgeActive;
328 }
329
330 new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
331 Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
332 3, nBins, minPosition, maxPosition);
333
334 // right element
335
336 minPosition[0] = +1.*intLimitDetElem;
337 minPosition[1] = lowEdgeActive;
338 minPosition[2] = zMin;
339
340 maxPosition[0] = +1.*extLimitDetElem;
341 maxPosition[1] = supEdgeActive;
342 maxPosition[2] = zMin+fThicknessActive;
343
344 new ((*fActiveElements)[fActiveElements->GetEntries()]) THnSparseC(Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
345 Form("MFTActiveElemHist_%02d%03d", fPlaneNumber, fActiveElements->GetEntries()),
346 3, nBins, minPosition, maxPosition);
347
348 if (supEdgeActive>0.) {
349 minPosition[1] = supEdgeActive;
350 maxPosition[1] = supEdgeActive+fHeightReadout;
351 }
352 else {
353 minPosition[1] = lowEdgeActive-fHeightReadout;
354 maxPosition[1] = lowEdgeActive;
355 }
356
357 new ((*fReadoutElements)[fReadoutElements->GetEntries()]) THnSparseC(Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
358 Form("MFTReadoutElemHist_%02d%03d", fPlaneNumber, fReadoutElements->GetEntries()),
359 3, nBins, minPosition, maxPosition);
360
361 }
362
363 lowEdgeActive += fHeightActive - fActiveSuperposition;
364 supEdgeActive = lowEdgeActive + fHeightActive;
365 isFront = !isFront;
366
367 }
368
369 AliDebug(1, Form("Structure completed for MFT plane %s", GetName()));
370
371 return kTRUE;
372
373}
374
375//====================================================================================================================================================
376
377THnSparseC* AliMFTPlane::GetActiveElement(Int_t id) {
378
379 if (id<0 || id>=GetNActiveElements()) return NULL;
380 else return (THnSparseC*) fActiveElements->At(id);
381
382}
383
384//====================================================================================================================================================
385
386THnSparseC* AliMFTPlane::GetReadoutElement(Int_t id) {
387
388 if (id<0 || id>=GetNReadoutElements()) return NULL;
389 else return (THnSparseC*) fReadoutElements->At(id);
390
391}
392
393//====================================================================================================================================================
394
395THnSparseC* AliMFTPlane::GetSupportElement(Int_t id) {
396
397 if (id<0 || id>=GetNSupportElements()) return NULL;
398 else return (THnSparseC*) fSupportElements->At(id);
399
400}
401
402//====================================================================================================================================================
403
d4643a10 404void AliMFTPlane::DrawPlane(Option_t *opt) {
820b4d9e 405
406 // ------------------- "FRONT" option ------------------
407
408 if (!strcmp(opt, "front")) {
409
410 TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
411 cnv->Draw();
412
820b4d9e 413 TH2D *h = new TH2D("tmp", GetName(),
414 1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(),
415 1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
416 h->SetXTitle("x [cm]");
417 h->SetYTitle("y [cm]");
418 h->Draw();
419
d4643a10 420 AliInfo("Created hist");
820b4d9e 421
422 TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
423 TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
424 supportExt->SetFillColor(kCyan-10);
425 supportExt -> Draw("same");
426 supportInt -> Draw("same");
427
820b4d9e 428 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
820b4d9e 429 if (!IsFront(GetActiveElement(iEl))) continue;
430 TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(),
431 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
432 GetActiveElement(iEl)->GetAxis(0)->GetXmax(),
433 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
434 pave -> SetFillColor(kGreen);
435 pave -> Draw("same");
436 }
437
438 for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
820b4d9e 439 if (!IsFront(GetReadoutElement(iEl))) continue;
440 TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(),
441 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
442 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(),
443 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
444 pave -> SetFillColor(kRed);
445 pave -> Draw("same");
446 }
447
448 }
449
450 // ------------------- "BACK" option ------------------
451
452 else if (!strcmp(opt, "back")) {
453
454 TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
455 cnv->Draw();
456
457 TH2D *h = new TH2D("tmp", GetName(),
458 1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(),
459 1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
460 h->SetXTitle("x [cm]");
461 h->SetYTitle("y [cm]");
462 h->Draw();
463
464 TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
465 TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
466 supportExt -> SetFillColor(kCyan-10);
467 supportExt -> Draw("same");
468 supportInt -> Draw("same");
469
470 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
471 if (IsFront(GetActiveElement(iEl))) continue;
472 TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(),
473 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
474 GetActiveElement(iEl)->GetAxis(0)->GetXmax(),
475 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
476 pave -> SetFillColor(kGreen);
477 pave -> Draw("same");
478 }
479
480 for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
481 if (IsFront(GetReadoutElement(iEl))) continue;
482 TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(),
483 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
484 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(),
485 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
486 pave -> SetFillColor(kRed);
487 pave -> Draw("same");
488 }
489
490 }
491
492 // ------------------- "BOTH" option ------------------
493
494 else if (!strcmp(opt, "both")) {
495
496 TCanvas *cnv = new TCanvas("cnv", GetName(), 900, 900);
497 cnv->Draw();
498
499 TH2D *h = new TH2D("tmp", GetName(),
500 1, 1.1*GetSupportElement(0)->GetAxis(0)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(0)->GetXmax(),
501 1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
502 h->SetXTitle("x [cm]");
503 h->SetYTitle("y [cm]");
504 h->Draw();
505
506 TEllipse *supportExt = new TEllipse(0.0, 0.0, fRMaxSupport, fRMaxSupport);
507 TEllipse *supportInt = new TEllipse(0.0, 0.0, fRMinSupport, fRMinSupport);
508 supportExt -> SetFillColor(kCyan-10);
509 supportExt -> Draw("same");
510 supportInt -> Draw("same");
511
512 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
513 if (IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmin()<0.) {
514 TPave *pave = new TPave(GetActiveElement(iEl)->GetAxis(0)->GetXmin(),
515 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
516 TMath::Min(GetActiveElement(iEl)->GetAxis(0)->GetXmax(), 0.),
517 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
518 pave -> SetFillColor(kGreen);
519 pave -> Draw("same");
520 }
521 else if (!IsFront(GetActiveElement(iEl)) && GetActiveElement(iEl)->GetAxis(0)->GetXmax()>0.) {
522 TPave *pave = new TPave(TMath::Max(GetActiveElement(iEl)->GetAxis(0)->GetXmin(), 0.),
523 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
524 GetActiveElement(iEl)->GetAxis(0)->GetXmax(),
525 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
526 pave -> SetFillColor(kGreen);
527 pave -> Draw("same");
528 }
529 }
530
531 for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
532 if (IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmin()<0.) {
533 TPave *pave = new TPave(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(),
534 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
535 TMath::Min(GetReadoutElement(iEl)->GetAxis(0)->GetXmax(), 0.),
536 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
537 pave -> SetFillColor(kRed);
538 pave -> Draw("same");
539 }
540 else if (!IsFront(GetReadoutElement(iEl)) && GetReadoutElement(iEl)->GetAxis(0)->GetXmax()>0.) {
541 TPave *pave = new TPave(TMath::Max(GetReadoutElement(iEl)->GetAxis(0)->GetXmin(), 0.),
542 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
543 GetReadoutElement(iEl)->GetAxis(0)->GetXmax(),
544 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
545 pave -> SetFillColor(kRed);
546 pave -> Draw("same");
547 }
548 }
549
550 }
551
552 // ------------------- "PROFILE" option ------------------
553
554 else if (!strcmp(opt, "profile")) {
555
556 TCanvas *cnv = new TCanvas("cnv", GetName(), 300, 900);
557 cnv->Draw();
558
559 TH2D *h = new TH2D("tmp", GetName(),
560 1, fZCenter-0.5, fZCenter+0.5,
561 1, 1.1*GetSupportElement(0)->GetAxis(1)->GetXmin(), 1.1*GetSupportElement(0)->GetAxis(1)->GetXmax());
562 h->SetXTitle("z [cm]");
563 h->SetYTitle("y [cm]");
564 h->Draw();
565
566 TPave *supportExt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMaxSupport,
567 GetSupportElement(0)->GetAxis(2)->GetXmax(), fRMaxSupport);
568 TPave *supportInt = new TPave(GetSupportElement(0)->GetAxis(2)->GetXmin(), -fRMinSupport,
569 GetSupportElement(0)->GetAxis(2)->GetXmax(), fRMinSupport);
570 supportExt -> SetFillColor(kCyan-10);
571 supportInt -> SetFillColor(kCyan-10);
572 supportExt -> SetBorderSize(1);
573 supportInt -> SetBorderSize(1);
574 supportExt -> Draw("same");
575 supportInt -> Draw("same");
576
577 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
578 TPave * pave = 0;
579 if (IsFront(GetActiveElement(iEl))) {
580 pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmax() -
581 5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()),
582 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
583 GetActiveElement(iEl)->GetAxis(2)->GetXmax(),
584 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
585 }
586 else {
587 pave = new TPave(GetActiveElement(iEl)->GetAxis(2)->GetXmin(),
588 GetActiveElement(iEl)->GetAxis(1)->GetXmin(),
589 GetActiveElement(iEl)->GetAxis(2)->GetXmin() +
590 5*(GetActiveElement(iEl)->GetAxis(2)->GetXmax()-GetActiveElement(iEl)->GetAxis(2)->GetXmin()),
591 GetActiveElement(iEl)->GetAxis(1)->GetXmax(), 1);
592 }
593 pave -> SetFillColor(kGreen);
594 pave -> Draw("same");
595 }
596
597 for (Int_t iEl=0; iEl<GetNReadoutElements(); iEl++) {
598 TPave *pave = 0;
599 if (IsFront(GetReadoutElement(iEl))) {
600 pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmax() -
601 5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()),
602 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
603 GetReadoutElement(iEl)->GetAxis(2)->GetXmax(),
604 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
605 }
606 else {
607 pave = new TPave(GetReadoutElement(iEl)->GetAxis(2)->GetXmin(),
608 GetReadoutElement(iEl)->GetAxis(1)->GetXmin(),
609 GetReadoutElement(iEl)->GetAxis(2)->GetXmin() +
610 5*(GetReadoutElement(iEl)->GetAxis(2)->GetXmax()-GetReadoutElement(iEl)->GetAxis(2)->GetXmin()),
611 GetReadoutElement(iEl)->GetAxis(1)->GetXmax(), 1);
612 }
613 pave -> SetFillColor(kRed);
614 pave -> Draw("same");
615 }
616
617 }
618
619}
620
621//====================================================================================================================================================
622
53b30119 623Int_t AliMFTPlane::GetNumberOfChips(Option_t *opt) {
624
625 Int_t nChips = 0;
626
627 if (!strcmp(opt, "front")) {
628 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
629 if (!IsFront(GetActiveElement(iEl))) continue;
630 Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
631 nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
632 }
633 }
634
635 else if (!strcmp(opt, "back")) {
636 for (Int_t iEl=0; iEl<GetNActiveElements(); iEl++) {
637 if (IsFront(GetActiveElement(iEl))) continue;
638 Double_t length = GetActiveElement(iEl)->GetAxis(0)->GetXmax() - GetActiveElement(iEl)->GetAxis(0)->GetXmin();
639 nChips += Int_t (length/AliMFTConstants::fWidthChip) + 1;
640 }
641 }
642
643 return nChips;
644
645}
646
647//====================================================================================================================================================