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 for electronics |
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, #manu, #manuchannel |
25 | // Detailed information in Alice Technical Note xxxxxxxx (2004) |
26 | //==================================================================== |
27 | |
212bb69d |
28 | #include <TString.h> |
74f8c8e3 |
29 | |
30 | #include "AliMUONSegmentManuIndex.h" |
31 | |
32 | //___________________________________________ |
33 | ClassImp(AliMUONSegmentManuIndex) |
34 | |
35 | // |
36 | //___________________________________________ |
37 | AliMUONSegmentManuIndex::AliMUONSegmentManuIndex() |
38 | { |
212bb69d |
39 | //Default constructor |
74f8c8e3 |
40 | fChannelId= 0;; // Id of the channel within the detection element |
41 | fManuId= 0;; // Manu id in the detection element |
42 | fBusPatchId= 0;; // BusPatchId in the detection element up to 4 for slats |
43 | fManuChannelId= 0;; |
44 | } |
45 | //___________________________________________ |
46 | AliMUONSegmentManuIndex::AliMUONSegmentManuIndex(const Int_t channelId, const Int_t manuId, const Int_t busPatchId, Int_t manuChannelId) : TNamed() |
47 | { |
212bb69d |
48 | // Constructor to be used |
49 | fName = Name(manuId, manuChannelId).Data(); |
50 | fTitle= Name(manuId, manuChannelId).Data(); |
74f8c8e3 |
51 | fChannelId = channelId; |
52 | fManuId = manuId; |
53 | fBusPatchId = busPatchId; |
54 | fManuChannelId = manuChannelId; |
55 | } |
56 | //_______________________________________________ |
57 | AliMUONSegmentManuIndex::~AliMUONSegmentManuIndex() |
58 | { |
212bb69d |
59 | // Destructor |
74f8c8e3 |
60 | } |
61 | //___________________________________________ |
62 | Int_t AliMUONSegmentManuIndex::Compare(const TObject *obj) const |
63 | { |
212bb69d |
64 | // Comparison of two AliMUONSegmentManuIndex objects |
74f8c8e3 |
65 | AliMUONSegmentManuIndex * myobj = ( AliMUONSegmentManuIndex *) obj; |
66 | return (fChannelId > myobj->GetChannelId()) ? 1 : -1; |
67 | } |
68 | //___________________________________________ |
212bb69d |
69 | TString AliMUONSegmentManuIndex::Name(Int_t manuid, Int_t manuchannel) |
70 | { |
71 | // Definition of the name for TMap indexing |
72 | char name[15]; |
73 | Int_t absid = manuid*64 + manuchannel; |
74 | sprintf(name,"%d",absid); |
75 | return TString(name); |
76 | } |
77 | //___________________________________________ |
74f8c8e3 |
78 | void AliMUONSegmentManuIndex::Print() const |
79 | { |
212bb69d |
80 | // Printing AliMUONSegmentManuIndex information |
81 | Info("Print","Name=%s Id=%d BusPatch=%d ManuId=%d ManuChannelId=%d\n",fName.Data(),fChannelId,fBusPatchId,fManuId,fManuChannelId); |
74f8c8e3 |
82 | } |