// Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
//-----------------------------------------------------------------
-#include <stdlib.h>
-#include <Riostream.h>
-
#include "AliRunTag.h"
-#include "AliLHCTag.h"
#include "AliDetectorTag.h"
#include "AliEventTag.h"
ClassImp(AliRunTag)
-TClonesArray *AliRunTag::fgEvents = 0;
-TClonesArray *AliRunTag::fgDetectors = 0;
-
-//______________________________________________________________________________
-AliRunTag::AliRunTag()
+//___________________________________________________________________________
+ AliRunTag::AliRunTag() :
+ TObject(),
+ fAliceRunId(-1),
+ fAliceMagneticField(0.0),
+ fAliceRunStartTime(0),
+ fAliceRunStopTime(0),
+ fAlirootVersion(0),
+ fRootVersion(0),
+ fGeant3Version(0),
+ fAliceRunQuality(0),
+ fAliceBeamEnergy(0.0),
+ fAliceBeamType(0),
+ fAliceCalibrationVersion(0),
+ fAliceDataType(0),
+ fNumEvents(0),
+ fNumDetectors(0),
+ fEventTag("AliEventTag", 1000),
+ fDetectorTag(),
+ fLHCTag(),
+ fQA(),
+ fQALength(0),
+ fQAArray(NULL),
+ fESLength(0),
+ fEventSpecies(NULL)
{
- if (!fgEvents) fgEvents = new TClonesArray("AliEventTag", 1000);
- fEventTag = fgEvents;
- fNumEvents = 0;
-
- if (!fgDetectors) fgDetectors = new TClonesArray("AliDetectorTag", 1000);
- fDetectorTag = fgDetectors;
- fNumDetectors = 0;
-
- fAliceMagneticField = 0.0;
- fAliceRunStartTime = 0;
- fAliceRunStopTime = 0;
- fAliceReconstructionVersion = 0;
- fAliceRunQuality = 0;
- fAliceBeamEnergy = 0.0;
- fAliceCalibrationVersion = 0;
- fAliceDataType = 0;
+ //Default constructor
}
-//______________________________________________________________________________
-AliRunTag::~AliRunTag()
-{
+//___________________________________________________________________________
+AliRunTag::~AliRunTag() {
+ //Destructor
+ fEventTag.Delete();
+ if ( fQAArray )
+ delete [] fQAArray ;
+ if ( fEventSpecies )
+ delete [] fEventSpecies ;
}
-//______________________________________________________________________________
-void AliRunTag::SetLHCTag(Float_t lumin, char *type)
+//___________________________________________________________________________
+AliRunTag::AliRunTag(const AliRunTag& tag):
+TObject(),
+fAliceRunId(tag.fAliceRunId),
+fAliceMagneticField(tag.fAliceMagneticField),
+fAliceRunStartTime(tag.fAliceRunStartTime),
+fAliceRunStopTime(fAliceRunStopTime),
+fAlirootVersion(tag.fAlirootVersion),
+fRootVersion(tag.fRootVersion),
+fGeant3Version(tag.fGeant3Version),
+fAliceRunQuality(tag.fAliceRunQuality),
+fAliceBeamEnergy(tag.fAliceBeamEnergy),
+fAliceBeamType(tag.fAliceBeamType),
+fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
+fAliceDataType(tag.fAliceDataType),
+fNumEvents(tag.fNumEvents),
+fNumDetectors(tag.fNumDetectors),
+fEventTag(tag.fEventTag),
+fDetectorTag(tag.fDetectorTag),
+fLHCTag(tag.fLHCTag),
+fQA(tag.fQA),
+fQALength(tag.fQALength),
+fQAArray(NULL),
+fESLength(tag.fESLength),
+fEventSpecies(NULL)
{
+ //copy constructor
+ if (fQALength == 0 )
+ fQAArray = NULL ;
+ else {
+ fQAArray = new ULong_t[fQALength] ;
+ memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
+ }
+ if (fESLength == 0 )
+ fEventSpecies = NULL ;
+ else {
+ fEventSpecies = new Bool_t[fESLength] ;
+ memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
+ }
+}
+
+//___________________________________________________________________________
+AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
+//assignment operator
+ if(&tag != this) {
+ fAliceRunId = tag.fAliceRunId ;
+ fAliceMagneticField = tag.fAliceMagneticField ;
+ fAliceRunStartTime = tag.fAliceRunStartTime ;
+ fAliceRunStopTime = tag.fAliceRunStopTime ;
+ fAlirootVersion = tag.fAlirootVersion ;
+ fRootVersion = tag.fRootVersion ;
+ fGeant3Version = tag.fGeant3Version ;
+ fAliceRunQuality = tag.fAliceRunQuality ;
+ fAliceBeamEnergy = tag.fAliceBeamEnergy ;
+ fAliceBeamType = tag.fAliceBeamType ;
+ fAliceCalibrationVersion = tag.fAliceCalibrationVersion ;
+ fAliceDataType = tag.fAliceDataType ;
+ fNumEvents = tag.fNumEvents ;
+ fNumDetectors = tag.fNumDetectors ;
+ fEventTag = tag.fEventTag ;
+ fDetectorTag = tag.fDetectorTag ;
+ fLHCTag = tag.fLHCTag ;
+ fQA = tag.fQA ;
+ fQALength = tag.fQALength ;
+ if (fQAArray)
+ delete [] fQAArray ;
+ if (fQALength == 0 )
+ fQAArray = NULL ;
+ else {
+ fQAArray = new ULong_t[fQALength] ;
+ memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
+ }
+ fESLength = tag.fESLength ;
+ if (fEventSpecies)
+ delete [] fEventSpecies ;
+ if (fESLength == 0 )
+ fEventSpecies = NULL ;
+ else {
+ fEventSpecies = new Bool_t[fESLength] ;
+ memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
+ }
+ }
+ return *this ;
+}
+
+//___________________________________________________________________________
+void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
+ //function that copies the run, lhc and detector levels
+ SetRunId(oldtag->GetRunId());
+ SetMagneticField(oldtag->GetMagneticField());
+ SetRunStartTime(oldtag->GetRunStartTime());
+ SetRunStopTime(oldtag->GetRunStopTime());
+ SetAlirootVersion(oldtag->GetAlirootVersion());
+ SetRootVersion(oldtag->GetRootVersion());
+ SetGeant3Version(oldtag->GetGeant3Version());
+ SetRunQuality(oldtag->GetRunQuality());
+ SetBeamEnergy(oldtag->GetBeamEnergy());
+ SetBeamType(oldtag->GetBeamType());
+ SetCalibVersion(oldtag->GetCalibVersion());
+ SetDataType(oldtag->GetDataType());
+ SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
+ SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMask());
+ SetQA(*(oldtag->GetQA())) ;
+ SetQAArray(oldtag->GetQAArray(), oldtag->GetQALength()) ;
+ SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;
+}
+
+//___________________________________________________________________________
+void AliRunTag::SetQAArray(ULong_t * qa, Int_t qalength) {
+ //Setter for the qa bits
+ if (qa && qalength > 0) {
+ fQALength = qalength ;
+ if (fQAArray)
+ delete [] fQAArray ;
+ fQAArray = new ULong_t[qalength] ;
+ memcpy(fQAArray, qa, qalength*sizeof(ULong_t)) ;
+ }
+}
+
+//___________________________________________________________________________
+void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
+ //setter for the eventspecices
+ if (es && eslength >0 ) {
+ fESLength = eslength ;
+ if (fEventSpecies)
+ delete [] fEventSpecies ;
+ fEventSpecies = new Bool_t[eslength] ;
+ memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ;
+ }
+}
+
+
+//___________________________________________________________________________
+void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
+ //Setter for the LHC tags
fLHCTag.SetLHCTag(lumin,type);
}
-//______________________________________________________________________________
-void AliRunTag::SetDetectorTag(AliDetectorTag *DetTag)
-{
- TClonesArray &detectors = *fDetectorTag;
- new(detectors[fNumDetectors++]) AliDetectorTag(DetTag);
+//___________________________________________________________________________
+void AliRunTag::SetDetectorTag(UInt_t mask) {
+ //Setter for the detector tags
+ fDetectorTag.SetDetectorMask(mask);
}
-//______________________________________________________________________________
-void AliRunTag::AddEventTag(const AliEventTag & EvTag)
-{
- TClonesArray &events = *fEventTag;
- new(events[fNumEvents++]) AliEventTag(EvTag);
+//___________________________________________________________________________
+void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
+ //Adds an entry to the event tag TClonesArray
+ new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
}
-//______________________________________________________________________________
-void AliRunTag::Clear(const char *)
-{
+//___________________________________________________________________________
+void AliRunTag::Clear(const char *) {
+ //Resets the number of events and detectors
+ fEventTag.Delete();
fNumEvents = 0;
+ fDetectorTag.Clear();
fNumDetectors = 0;
}