]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDetectorTag.cxx
More corrections in return code (trying to make the return code of the GRP private...
[u/mrichter/AliRoot.git] / STEER / AliDetectorTag.cxx
index 365d706d972a003552eaec3eed51d1c4582cfc12..eb384e57c95f8b7c8bac947b0ce164d1a996a1b7 100644 (file)
 //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
 //-----------------------------------------------------------------
 
+#include "TMath.h"
+
 #include "AliDetectorTag.h"
+#include "AliLog.h"
+#include "TObjString.h"
 
 ClassImp(AliDetectorTag)
 
-//______________________________________________________________________________
-AliDetectorTag::AliDetectorTag()
+//___________________________________________________________________________
+AliDetectorTag::AliDetectorTag() :
+  TObject(),
+  fDetectorArray(new TObjArray()),
+  fMask(0),
+  fITSSPD(kFALSE),
+  fITSSDD(kFALSE),
+  fITSSSD(kFALSE),
+  fTPC(kFALSE),
+  fTRD(kFALSE),
+  fTOF(kFALSE),
+  fHMPID(kFALSE),
+  fPHOS(kFALSE),
+  fPMD(kFALSE),
+  fMUON(kFALSE),
+  fFMD(kFALSE),
+  fTZERO(kFALSE),
+  fVZERO(kFALSE),
+  fZDC(kFALSE),
+  fEMCAL(kFALSE)
 {
   // Default constructor
-  fITS = 0;
-  fTPC = 0;
-  fTRD = 0;
-  fTOF = 0;
-  fHMPID = 0;
-  fPHOS = 0;
-  fZDC = 0;
-  fMUON = 0;
-  fABSORBER = 0;
-  fPMD = 0;
-  fRICH = 0;
-  fEMCAL = 0;
-  fVZERO = 0;
-  fTZERO = 0;
+  for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
 }
 
-//______________________________________________________________________________
+//___________________________________________________________________________
 AliDetectorTag::AliDetectorTag(const AliDetectorTag & detTag) :
-  TObject(detTag)
-{
+  TObject(detTag),
+  fDetectorArray(detTag.fDetectorArray),
+  fMask(detTag.fMask),
+  fITSSPD(detTag.fITSSPD),
+  fITSSDD(detTag.fITSSDD),
+  fITSSSD(detTag.fITSSSD),
+  fTPC(detTag.fTPC),
+  fTRD(detTag.fTRD),
+  fTOF(detTag.fTOF),
+  fHMPID(detTag.fHMPID),
+  fPHOS(detTag.fPHOS),
+  fPMD(detTag.fPMD),
+  fMUON(detTag.fMUON),
+  fFMD(detTag.fFMD),
+  fTZERO(detTag.fTZERO),
+  fVZERO(detTag.fVZERO),
+  fZDC(detTag.fZDC),
+  fEMCAL(detTag.fEMCAL)
+ {
   // DetectorTag copy constructor
-  SetITS(detTag.GetITS());
-  SetTPC(detTag.GetTPC());
-  SetTRD(detTag.GetTRD());
-  SetTOF(detTag.GetTOF());
-  SetHMPID(detTag.GetHMPID());
-  SetPHOS(detTag.GetPHOS());
-  SetZDC(detTag.GetZDC());
-  SetMUON(detTag.GetMUON());
-  SetABSORBER(detTag.GetABSORBER());
-  SetPMD(detTag.GetPMD());
-  SetRICH(detTag.GetRICH());
-  SetEMCAL(detTag.GetEMCAL());
-  SetVZERO(detTag.GetVZERO());
-  SetTZERO(detTag.GetTZERO());
+  for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
 }
 
-//______________________________________________________________________________
-AliDetectorTag::~AliDetectorTag()
-{
+//___________________________________________________________________________
+AliDetectorTag & AliDetectorTag::operator=(const AliDetectorTag &detTag) {
+  //DetectorTag assignment operator
+  if (this != &detTag) {
+    TObject::operator=(detTag);
+    
+    fDetectorArray = detTag.fDetectorArray;
+    fMask = detTag.fMask;   
+    fITSSPD = detTag.fITSSPD;
+    fITSSDD = detTag.fITSSDD;
+    fITSSSD = detTag.fITSSSD;
+    fTPC = detTag.fTPC;
+    fTRD = detTag.fTRD;
+    fTOF = detTag.fTOF;
+    fHMPID = detTag.fHMPID;
+    fPHOS = detTag.fPHOS;
+    fPMD = detTag.fPMD;
+    fMUON = detTag.fMUON;
+    fFMD = detTag.fFMD;
+    fTZERO = detTag.fTZERO;
+    fVZERO = detTag.fVZERO;
+    fZDC = detTag.fZDC;
+    fEMCAL = detTag.fEMCAL;
+    for(Int_t k = 0; k < 20; k++) fDetectors[k] = detTag.fDetectors[k];
+  }
+  return *this;
+}
+
+//___________________________________________________________________________
+AliDetectorTag::~AliDetectorTag() {
   // Destructor
+  delete fDetectorArray;
+}
+
+//___________________________________________________________________________
+void AliDetectorTag::Int2Bin() {
+  // Convert the integer into binary
+  Int_t j=0; 
+  UInt_t mask = fMask;
+  for(Int_t k = 0; k < 20; k++) fDetectors[k] = 0;
+  while(mask > 0) {
+   fDetectors[j] = mask%2;
+   mask = mask/2;
+   j++; 
+  }
+  SetDetectorConfiguration();
+}
+
+//___________________________________________________________________________
+UInt_t AliDetectorTag::GetIntDetectorMask() {
+  // Returns the detector mask UInt_t
+  UInt_t mask = 0;
+  for(Int_t k = 0; k < 20; k++) 
+    if(fDetectors[k] == 1) mask += (UInt_t)TMath::Power(2,k);
+  
+  return mask;
+}
+
+//___________________________________________________________________________
+void AliDetectorTag::SetDetectorConfiguration() {
+  //sets the detector configuration
+  if(fDetectors[0] == 1) {
+    SetITSSPD(); fDetectorArray->Add(new TObjString("SPD"));}
+  if(fDetectors[1] == 1) {
+    SetITSSDD(); fDetectorArray->Add(new TObjString("SDD"));}
+  if(fDetectors[2] == 1) {
+    SetITSSSD(); fDetectorArray->Add(new TObjString("SSD"));}
+  if(fDetectors[3] == 1) {
+    SetTPC(); fDetectorArray->Add(new TObjString("TPC"));}
+  if(fDetectors[4] == 1) {
+    SetTRD(); fDetectorArray->Add(new TObjString("TRD"));}
+  if(fDetectors[5] == 1) {
+    SetTOF(); fDetectorArray->Add(new TObjString("TOF"));}
+  if(fDetectors[6] == 1) {
+    SetHMPID();fDetectorArray->Add(new TObjString("HMPID"));}
+  if(fDetectors[7] == 1) {
+    SetPHOS(); fDetectorArray->Add(new TObjString("PHOS"));}
+  if(fDetectors[9] == 1) {
+    SetPMD(); fDetectorArray->Add(new TObjString("PMD"));}
+  if(fDetectors[10] == 1) {
+    SetMUON(); fDetectorArray->Add(new TObjString("MUON"));}
+  if(fDetectors[12] == 1) {
+    SetFMD(); fDetectorArray->Add(new TObjString("FMD"));}
+  if(fDetectors[13] == 1) {
+    SetTZERO(); fDetectorArray->Add(new TObjString("T0"));}
+  if(fDetectors[14] == 1) {
+    SetVZERO(); fDetectorArray->Add(new TObjString("VZERO"));}
+  if(fDetectors[15] == 1) {
+    SetZDC(); fDetectorArray->Add(new TObjString("ZDC"));}
+  if(fDetectors[18] == 1) {
+    SetEMCAL(); fDetectorArray->Add(new TObjString("EMCAL"));}
+}
+
+//___________________________________________________________________________
+void AliDetectorTag::PrintDetectorMask() {
+  //prints the detector mask
+  AliInfo( Form( "ITS-SPD: %d", GetITSSPD()) );
+  AliInfo( Form( "ITS-SDD: %d", GetITSSDD()) );
+  AliInfo( Form( "ITS-SSD: %d", GetITSSSD()) );
+  AliInfo( Form( "TPC: %d", GetTPC()) );
+  AliInfo( Form( "TRD: %d", GetTRD()) );
+  AliInfo( Form( "TOF: %d", GetTOF()) );
+  AliInfo( Form( "HMPID: %d", GetHMPID()) );
+  AliInfo( Form( "PHOS: %d", GetPHOS()) );
+  AliInfo( Form( "PMD: %d", GetPMD()) );
+  AliInfo( Form( "MUON: %d", GetMUON()) );
+  AliInfo( Form( "FMD: %d", GetFMD()) );
+  AliInfo( Form( "TZERO: %d", GetTZERO()) );
+  AliInfo( Form( "VZERO: %d", GetVZERO()) );
+  AliInfo( Form( "ZDC: %d", GetZDC()) );
+  AliInfo( Form( "EMCAL: %d", GetEMCAL()) );
 }