]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSegmentPosition.cxx
- Remove double declaration in Digitizer
[u/mrichter/AliRoot.git] / MUON / AliMUONSegmentPosition.cxx
CommitLineData
74f8c8e3 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
18//===================================================================
19// Segment element position in local coordinates of the detection element
20// Gines MARTINEZ, SUBATECH July 04
21// This class is one of the basic component of
22// AliMUONSegmentationDetectionElement and contains al the
23// info about a segment (pad or strip):
24// Id-indetectionelement, x_local, y_local
25// Detailed information in Alice Technical Note xxxxxxxx (2004)
26//====================================================================
27
212bb69d 28#include <TMath.h>
29
74f8c8e3 30#include "AliMUONSegmentPosition.h"
8c343c7c 31#include "AliLog.h"
74f8c8e3 32
33//___________________________________________
34ClassImp(AliMUONSegmentPosition)
35
6b74910d 36Float_t AliMUONSegmentPosition::fUnit = 0.3 ; // 3mm unit for generation of segmenposition name
37
74f8c8e3 38//
39//___________________________________________
40AliMUONSegmentPosition::AliMUONSegmentPosition() : TNamed()
41{
212bb69d 42//Default constructor
74f8c8e3 43 fChannelId = 0;
44 fX = 0.;
45 fY = 0.;
46}
47//___________________________________________
5d0435dd 48AliMUONSegmentPosition::AliMUONSegmentPosition(Int_t channelId, Float_t x, Float_t y, Int_t cathode) : TNamed()
74f8c8e3 49{
212bb69d 50 // Constructor to be used
51 fName = Name(x,y,cathode);
52 fTitle= Name(x,y,cathode);
74f8c8e3 53 fChannelId = channelId;
54 fX = x;
55 fY = y;
56 fCathode=cathode;
6b74910d 57 fPadSizeX=0.;
58 fPadSizeY=0.;
74f8c8e3 59}
60//_______________________________________________
61AliMUONSegmentPosition::~AliMUONSegmentPosition()
62{
212bb69d 63 // Destructor
74f8c8e3 64}
65//___________________________________________
66Int_t AliMUONSegmentPosition::Compare(const TObject *obj) const
67{
212bb69d 68 // Comparison of two AliMUONSegmentPosition objects
74f8c8e3 69 AliMUONSegmentPosition * myobj = ( AliMUONSegmentPosition *) obj;
70 return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
71}
6b74910d 72
73//___________________________________________
74Float_t AliMUONSegmentPosition::Distance(Float_t x, Float_t y)
75{
76 return TMath::Sqrt( (fX-x)*(fX-x) + (fY-y)*(fY-y) ) ;
77}
74f8c8e3 78//___________________________________________
212bb69d 79TString AliMUONSegmentPosition::Name(Float_t x, Float_t y, Int_t cathode)
80{
81 // Definition of the name of AliMUONSegmentPosition
82 // Our convention since the smaller pad pich is 5 mm is to choice a 3mm unit:
83 // So for a position pair x,y and cathode plane icathode the name will be:
84 // xp = TMath::Nint(x*10./3.);
85 // yp = TMath::Nint(y+10./3.);
86 // sprintf(name,"%d-%d-%d",xp,yp,cathode);
6b74910d 87 Int_t xp = TMath::Nint(x/fUnit);
88 Int_t yp = TMath::Nint(y/fUnit);
212bb69d 89 char name[15];
90 sprintf(name,"%d-%d-%d",xp,yp,cathode);
91 return TString(name);
92}
93//___________________________________________
337c9041 94void AliMUONSegmentPosition::Print(const char* /*opt*/) const
74f8c8e3 95{
212bb69d 96 // Printing AliMUONSegmentManuIndex information
8c343c7c 97 AliInfo(Form("Name=%s Id=%d X=%f Y=%f Cathode=%d\n",fName.Data(),fChannelId, fX, fY,fCathode));
74f8c8e3 98}