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