]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliRunTag.cxx
Base class (AliMisaligner); each detector will provide its derived class,
[u/mrichter/AliRoot.git] / STEER / AliRunTag.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 RunTag class
20 //   This is the class to deal with the tags in the run level
21 //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
22 //-----------------------------------------------------------------
23
24 #include "AliRunTag.h"
25 #include "AliDetectorTag.h"
26 #include "AliEventTag.h"
27
28 ClassImp(AliRunTag)
29
30 //___________________________________________________________________________
31   AliRunTag::AliRunTag() :
32     TObject(),
33     fAliceRunId(-1),
34     fAliceMagneticField(0.0),
35     fAliceRunStartTime(0),
36     fAliceRunStopTime(0),
37     fAlirootVersion(0),
38     fRootVersion(0),
39     fGeant3Version(0),
40     fAliceRunQuality(0),
41     fAliceBeamEnergy(0.0),
42     fAliceBeamType(0),
43     fAliceCalibrationVersion(0),
44     fAliceDataType(0),
45     fNumEvents(0),
46     fNumDetectors(0),
47     fEventTag("AliEventTag", 1000),
48     fDetectorTag(),
49     fLHCTag(), 
50     fQALength(0), 
51     fQA(NULL), 
52     fESLength(0), 
53     fEventSpecies(NULL)
54 {
55   //Default constructor
56 }
57
58 //___________________________________________________________________________
59 AliRunTag::~AliRunTag() {
60   //Destructor
61   fEventTag.Delete();
62   if ( fQA ) 
63     delete [] fQA ; 
64   if ( fEventSpecies )
65     delete [] fEventSpecies ; 
66 }
67
68 //___________________________________________________________________________
69 AliRunTag::AliRunTag(const AliRunTag& tag):
70 TObject(),
71 fAliceRunId(tag.fAliceRunId),
72 fAliceMagneticField(tag.fAliceMagneticField),
73 fAliceRunStartTime(tag.fAliceRunStartTime),
74 fAliceRunStopTime(fAliceRunStopTime),
75 fAlirootVersion(tag.fAlirootVersion),
76 fRootVersion(tag.fRootVersion),
77 fGeant3Version(tag.fGeant3Version),
78 fAliceRunQuality(tag.fAliceRunQuality),
79 fAliceBeamEnergy(tag.fAliceBeamEnergy),
80 fAliceBeamType(tag.fAliceBeamType),
81 fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
82 fAliceDataType(tag.fAliceDataType),
83 fNumEvents(tag.fNumEvents),
84 fNumDetectors(tag.fNumDetectors),
85 fEventTag(tag.fEventTag),
86 fDetectorTag(tag.fDetectorTag),
87 fLHCTag(tag.fLHCTag), 
88 fQALength(tag.fQALength),
89 fQA(NULL), 
90 fESLength(tag.fESLength),
91 fEventSpecies(NULL)
92 {
93   //copy constructor
94   if (fQALength == 0 ) 
95     fQA = NULL ; 
96   else {
97     fQA = new ULong_t[fQALength] ; 
98     memcpy(fQA, tag.fQA, fQALength*sizeof(ULong_t)) ;
99   }
100   if (fESLength == 0 ) 
101     fEventSpecies = NULL ; 
102   else {
103     fEventSpecies = new Bool_t[fESLength] ; 
104     memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
105   }
106 }
107
108 //___________________________________________________________________________
109 AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
110 //assignment operator
111   if(&tag != this) {
112     fAliceRunId               = tag.fAliceRunId ; 
113     fAliceMagneticField       = tag.fAliceMagneticField ;
114     fAliceRunStartTime        = tag.fAliceRunStartTime ; 
115     fAliceRunStopTime         = tag.fAliceRunStopTime ; 
116     fAlirootVersion           = tag.fAlirootVersion ; 
117     fRootVersion              = tag.fRootVersion ;
118     fGeant3Version            = tag.fGeant3Version ; 
119     fAliceRunQuality          = tag.fAliceRunQuality ; 
120     fAliceBeamEnergy          = tag.fAliceBeamEnergy ;
121     fAliceBeamType            = tag.fAliceBeamType ; 
122     fAliceCalibrationVersion  = tag.fAliceCalibrationVersion ; 
123     fAliceDataType            = tag.fAliceDataType ; 
124     fNumEvents                = tag.fNumEvents ;
125     fNumDetectors             = tag.fNumDetectors ; 
126     fEventTag                 = tag.fEventTag ;
127     fDetectorTag              = tag.fDetectorTag ;
128     fLHCTag                   = tag.fLHCTag ;  
129     fQALength                 = tag.fQALength ; 
130     if (fQA) 
131       delete [] fQA ; 
132     if (fQALength == 0 ) 
133       fQA = NULL ; 
134     else {
135       fQA = new ULong_t[fQALength] ; 
136       memcpy(fQA, tag.fQA, fQALength*sizeof(ULong_t)) ;
137     }
138     fESLength                 = tag.fESLength ; 
139     if (fEventSpecies)
140       delete [] fEventSpecies ; 
141     if (fESLength == 0 ) 
142       fEventSpecies = NULL ; 
143     else {
144       fEventSpecies = new Bool_t[fESLength] ; 
145       memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
146     }
147   }
148   return *this ; 
149 }
150
151 //___________________________________________________________________________
152 void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
153   //function that copies the run, lhc and detector levels
154   SetRunId(oldtag->GetRunId());
155   SetMagneticField(oldtag->GetMagneticField());
156   SetRunStartTime(oldtag->GetRunStartTime());
157   SetRunStopTime(oldtag->GetRunStopTime());
158   SetAlirootVersion(oldtag->GetAlirootVersion());
159   SetRootVersion(oldtag->GetRootVersion());
160   SetGeant3Version(oldtag->GetGeant3Version());
161   SetRunQuality(oldtag->GetRunQuality());
162   SetBeamEnergy(oldtag->GetBeamEnergy());
163   SetBeamType(oldtag->GetBeamType());
164   SetCalibVersion(oldtag->GetCalibVersion());
165   SetDataType(oldtag->GetDataType());
166   SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
167   SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMask());
168   SetQA(oldtag->GetQA(), oldtag->GetQALength()) ;  
169         SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;  
170 }
171
172 //___________________________________________________________________________
173 void AliRunTag::SetQA(ULong_t * qa, Int_t qalength) {
174   //Setter for the qa bits 
175   if (qa && qalength > 0) {
176     fQALength = qalength ; 
177     if (fQA) 
178       delete [] fQA ; 
179     fQA = new ULong_t[qalength] ; 
180     memcpy(fQA, qa, qalength*sizeof(ULong_t)) ;
181   }
182 }
183
184 //___________________________________________________________________________
185 void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
186   //setter for the eventspecices 
187   if (es && eslength >0 ) {
188     fESLength = eslength ; 
189     if (fEventSpecies) 
190       delete [] fEventSpecies ; 
191     fEventSpecies = new Bool_t[eslength] ;
192     memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ; 
193   }
194 }
195
196
197 //___________________________________________________________________________
198 void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
199   //Setter for the LHC tags
200   fLHCTag.SetLHCTag(lumin,type);
201 }
202
203 //___________________________________________________________________________
204 void AliRunTag::SetDetectorTag(UInt_t mask) {
205   //Setter for the detector tags
206   fDetectorTag.SetDetectorMask(mask);
207 }
208
209 //___________________________________________________________________________
210 void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
211   //Adds an entry to the event tag TClonesArray
212   new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
213 }
214
215 //___________________________________________________________________________
216 void AliRunTag::Clear(const char *) {
217   //Resets the number of events and detectors
218   fEventTag.Delete();
219   fNumEvents = 0;
220   fDetectorTag.Clear();
221   fNumDetectors = 0;
222 }