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 indexing in a detection element |
20 | // Gines MARTINEZ, SUBATECH July 04 |
21 | // This class is the basic component of |
22 | // AliMUONSegmentationDetectionElement and contains al the |
23 | // info about a segment (pad or strip): |
24 | // Id-indetectionelement, ix ,iy |
25 | // Detailed information in Alice Technical Note xxxxxxxx (2004) |
26 | //==================================================================== |
27 | |
212bb69d |
28 | #include <TString.h> |
29 | |
74f8c8e3 |
30 | #include "AliMUONSegmentIndex.h" |
31 | |
32 | //___________________________________________ |
33 | ClassImp(AliMUONSegmentIndex) |
34 | |
35 | // |
36 | //___________________________________________ |
37 | AliMUONSegmentIndex::AliMUONSegmentIndex() : TNamed() |
38 | { |
212bb69d |
39 | // Constructor by default |
74f8c8e3 |
40 | fChannelId = 0; |
41 | fPadX = 0; |
42 | fPadY = 0; |
43 | fCathode=0; |
44 | } |
45 | //___________________________________________ |
46 | AliMUONSegmentIndex::AliMUONSegmentIndex(const Int_t channelId, const Int_t padX, const Int_t padY, const Int_t cathode) : TNamed() |
47 | { |
212bb69d |
48 | // Constructor to be used |
49 | fName = Name(padX, padY, cathode).Data(); |
50 | fTitle = Name(padX, padY, cathode).Data(); |
74f8c8e3 |
51 | fChannelId = channelId; |
52 | fPadX = padX; |
53 | fPadY = padY; |
54 | fCathode=cathode; |
55 | } |
56 | //_______________________________________________ |
57 | AliMUONSegmentIndex::~AliMUONSegmentIndex() |
58 | { |
212bb69d |
59 | // Destructor |
74f8c8e3 |
60 | } |
61 | //___________________________________________ |
62 | Int_t AliMUONSegmentIndex::Compare(const TObject *obj) const |
63 | { |
212bb69d |
64 | // Comparison of two AliMUONSegmentIndex objects |
74f8c8e3 |
65 | AliMUONSegmentIndex * myobj = ( AliMUONSegmentIndex *) obj; |
66 | return (fChannelId > myobj->GetChannelId()) ? 1 : -1; |
67 | } |
212bb69d |
68 | //___________________________________________ |
69 | TString AliMUONSegmentIndex::Name(Int_t padx, Int_t pady, Int_t cathode) |
70 | { |
71 | // Definition of the name of the object |
72 | char name[15]; |
73 | sprintf(name,"%d-%d-%d",padx,pady,cathode); |
74 | return TString(name); |
75 | } |
76 | |
74f8c8e3 |
77 | //___________________________________________ |
78 | void AliMUONSegmentIndex::Print() const |
79 | { |
212bb69d |
80 | // Printing information of AliMUONSegmentIndex |
81 | Info("Print", "Name=%s Id=%d PadX=%d PadY=%d Cathode=%d\n",fName.Data(),fChannelId,fPadX,fPadY,fCathode); |
74f8c8e3 |
82 | } |