]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliDetectorTag.cxx
Adding PHOS to EINCLUDE (Solaris x86)
[u/mrichter/AliRoot.git] / STEER / AliDetectorTag.cxx
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 //           Implementation of the DetectorTag class
20 //   This is the class to deal with the tags in the detector level
21 //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
23
24 #include "AliDetectorTag.h"
25 #include "AliLog.h"
26 #include "TObjString.h"
27
28 ClassImp(AliDetectorTag)
29
30 //___________________________________________________________________________
31 AliDetectorTag::AliDetectorTag() :
32   TObject(),
33   fDetectorArray(new TObjArray()),
34   fMask(0),
35   fITSSPD(kFALSE),
36   fITSSDD(kFALSE),
37   fITSSSD(kFALSE),
38   fTPC(kFALSE),
39   fTRD(kFALSE),
40   fTOF(kFALSE),
41   fHMPID(kFALSE),
42   fPHOS(kFALSE),
43   fPMD(kFALSE),
44   fMUON(kFALSE),
45   fFMD(kFALSE),
46   fTZERO(kFALSE),
47   fVZERO(kFALSE),
48   fZDC(kFALSE),
49   fEMCAL(kFALSE)
50 {
51   // Default constructor
52   for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
53 }
54
55 //___________________________________________________________________________
56 AliDetectorTag::AliDetectorTag(const AliDetectorTag & detTag) :
57   TObject(detTag),
58   fDetectorArray(detTag.fDetectorArray),
59   fMask(detTag.fMask),
60   fITSSPD(detTag.fITSSPD),
61   fITSSDD(detTag.fITSSDD),
62   fITSSSD(detTag.fITSSSD),
63   fTPC(detTag.fTPC),
64   fTRD(detTag.fTRD),
65   fTOF(detTag.fTOF),
66   fHMPID(detTag.fHMPID),
67   fPHOS(detTag.fPHOS),
68   fPMD(detTag.fPMD),
69   fMUON(detTag.fMUON),
70   fFMD(detTag.fFMD),
71   fTZERO(detTag.fTZERO),
72   fVZERO(detTag.fVZERO),
73   fZDC(detTag.fZDC),
74   fEMCAL(detTag.fEMCAL)
75  {
76   // DetectorTag copy constructor
77   for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
78 }
79
80 //___________________________________________________________________________
81 AliDetectorTag & AliDetectorTag::operator=(const AliDetectorTag &detTag) {
82   //DetectorTag assignment operator
83   if (this != &detTag) {
84     TObject::operator=(detTag);
85     
86     fDetectorArray = detTag.fDetectorArray;
87     fMask = detTag.fMask;   
88     fITSSPD = detTag.fITSSPD;
89     fITSSDD = detTag.fITSSDD;
90     fITSSSD = detTag.fITSSSD;
91     fTPC = detTag.fTPC;
92     fTRD = detTag.fTRD;
93     fTOF = detTag.fTOF;
94     fHMPID = detTag.fHMPID;
95     fPHOS = detTag.fPHOS;
96     fPMD = detTag.fPMD;
97     fMUON = detTag.fMUON;
98     fFMD = detTag.fFMD;
99     fTZERO = detTag.fTZERO;
100     fVZERO = detTag.fVZERO;
101     fZDC = detTag.fZDC;
102     fEMCAL = detTag.fEMCAL;
103     for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
104   }
105   return *this;
106 }
107
108 //___________________________________________________________________________
109 AliDetectorTag::~AliDetectorTag() {
110   // Destructor
111   delete fDetectorArray;
112 }
113
114 //___________________________________________________________________________
115 void AliDetectorTag::Int2Bin() {
116   // Convert the integer into binary
117   Int_t j=0; 
118   UInt_t mask = fMask;
119   for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
120   while(mask > 0) {
121    fDetectors[j] = mask%2;
122    mask = mask/2;
123    j++; 
124   }
125   SetDetectorConfiguration();
126 }
127
128 //___________________________________________________________________________
129 void AliDetectorTag::SetDetectorConfiguration() {
130   //sets the detector configuration
131   if(fDetectors[0] == 1) {
132     SetITSSPD(); fDetectorArray->Add(new TObjString("SPD"));}
133   if(fDetectors[1] == 1) {
134     SetITSSDD(); fDetectorArray->Add(new TObjString("SDD"));}
135   if(fDetectors[2] == 1) {
136     SetITSSSD(); fDetectorArray->Add(new TObjString("SSD"));}
137   if(fDetectors[3] == 1) {
138     SetTPC(); fDetectorArray->Add(new TObjString("TPC"));}
139   if(fDetectors[4] == 1) {
140     SetTRD(); fDetectorArray->Add(new TObjString("TRD"));}
141   if(fDetectors[5] == 1) {
142     SetTOF(); fDetectorArray->Add(new TObjString("TOF"));}
143   if(fDetectors[6] == 1) {
144     SetHMPID();fDetectorArray->Add(new TObjString("HMPID"));}
145   if(fDetectors[7] == 1) {
146     SetPHOS(); fDetectorArray->Add(new TObjString("PHOS"));}
147   if(fDetectors[9] == 1) {
148     SetPMD(); fDetectorArray->Add(new TObjString("PMD"));}
149   if(fDetectors[10] == 1) {
150     SetMUON(); fDetectorArray->Add(new TObjString("MUON"));}
151   if(fDetectors[12] == 1) {
152     SetFMD(); fDetectorArray->Add(new TObjString("FMD"));}
153   if(fDetectors[13] == 1) {
154     SetTZERO(); fDetectorArray->Add(new TObjString("T0"));}
155   if(fDetectors[14] == 1) {
156     SetVZERO(); fDetectorArray->Add(new TObjString("VZERO"));}
157   if(fDetectors[15] == 1) {
158     SetZDC(); fDetectorArray->Add(new TObjString("ZDC"));}
159   if(fDetectors[18] == 1) {
160     SetEMCAL(); fDetectorArray->Add(new TObjString("EMCAL"));}
161 }
162
163 //___________________________________________________________________________
164 void AliDetectorTag::PrintDetectorMask() {
165   //prints the detector mask
166   AliInfo( Form( "ITS-SPD: %d", GetITSSPD()) );
167   AliInfo( Form( "ITS-SDD: %d", GetITSSDD()) );
168   AliInfo( Form( "ITS-SSD: %d", GetITSSSD()) );
169   AliInfo( Form( "TPC: %d", GetTPC()) );
170   AliInfo( Form( "TRD: %d", GetTRD()) );
171   AliInfo( Form( "TOF: %d", GetTOF()) );
172   AliInfo( Form( "HMPID: %d", GetHMPID()) );
173   AliInfo( Form( "PHOS: %d", GetPHOS()) );
174   AliInfo( Form( "PMD: %d", GetPMD()) );
175   AliInfo( Form( "MUON: %d", GetMUON()) );
176   AliInfo( Form( "FMD: %d", GetFMD()) );
177   AliInfo( Form( "TZERO: %d", GetTZERO()) );
178   AliInfo( Form( "VZERO: %d", GetVZERO()) );
179   AliInfo( Form( "ZDC: %d", GetZDC()) );
180   AliInfo( Form( "EMCAL: %d", GetEMCAL()) );
181 }