]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - STEER/AliDetectorTag.cxx
new classes for resonance and V0 analysis (from R. Vernet)
[u/mrichter/AliRoot.git] / STEER / AliDetectorTag.cxx
index 6a87eba5dd47c9346ce0d9861167bbaf285dfd5b..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() :
   TObject(),
+  fDetectorArray(new TObjArray()),
   fMask(0),
   fITSSPD(kFALSE),
   fITSSDD(kFALSE),
@@ -53,6 +57,7 @@ AliDetectorTag::AliDetectorTag() :
 //___________________________________________________________________________
 AliDetectorTag::AliDetectorTag(const AliDetectorTag & detTag) :
   TObject(detTag),
+  fDetectorArray(detTag.fDetectorArray),
   fMask(detTag.fMask),
   fITSSPD(detTag.fITSSPD),
   fITSSDD(detTag.fITSSDD),
@@ -80,6 +85,7 @@ AliDetectorTag & AliDetectorTag::operator=(const AliDetectorTag &detTag) {
   if (this != &detTag) {
     TObject::operator=(detTag);
     
+    fDetectorArray = detTag.fDetectorArray;
     fMask = detTag.fMask;   
     fITSSPD = detTag.fITSSPD;
     fITSSDD = detTag.fITSSDD;
@@ -104,6 +110,7 @@ AliDetectorTag & AliDetectorTag::operator=(const AliDetectorTag &detTag) {
 //___________________________________________________________________________
 AliDetectorTag::~AliDetectorTag() {
   // Destructor
+  delete fDetectorArray;
 }
 
 //___________________________________________________________________________
@@ -120,24 +127,49 @@ void AliDetectorTag::Int2Bin() {
   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();
-  if(fDetectors[1] == 1) SetITSSDD();
-  if(fDetectors[2] == 1) SetITSSSD();
-  if(fDetectors[3] == 1) SetTPC();
-  if(fDetectors[4] == 1) SetTRD();
-  if(fDetectors[5] == 1) SetTOF();
-  if(fDetectors[6] == 1) SetHMPID();
-  if(fDetectors[7] == 1) SetPHOS();
-  if(fDetectors[9] == 1) SetPMD();
-  if(fDetectors[10] == 1) SetMUON();
-  if(fDetectors[12] == 1) SetFMD();
-  if(fDetectors[13] == 1) SetTZERO();
-  if(fDetectors[14] == 1) SetVZERO();
-  if(fDetectors[15] == 1) SetZDC();
-  if(fDetectors[18] == 1) SetEMCAL();
+  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"));}
 }
 
 //___________________________________________________________________________