1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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 //-----------------------------------------------------------------
25 #include "AliRunTag.h"
26 #include "AliDetectorTag.h"
27 #include "AliEventTag.h"
31 //___________________________________________________________________________
32 AliRunTag::AliRunTag() :
35 fAliceMagneticField(0.0),
36 fAliceDipoleField(0.0),
37 fAliceRunStartTime(0),
45 fAliceRunValidated(0),
46 fAliceRunGlobalQuality(0),
47 fAliceBeamEnergy(0.0),
49 fAliceCalibrationVersion(0),
54 fCollisionTriggers(0),
67 fActiveTriggerClasses(""),
77 //___________________________________________________________________________
78 AliRunTag::~AliRunTag() {
80 // fEventTag.Delete();
84 delete [] fEventSpecies ;
88 //___________________________________________________________________________
89 AliRunTag::AliRunTag(const AliRunTag& tag):
91 fAliceRunId(tag.fAliceRunId),
92 fAliceMagneticField(tag.fAliceMagneticField),
93 fAliceDipoleField(tag.fAliceDipoleField),
94 fAliceRunStartTime(tag.fAliceRunStartTime),
95 fAliceRunStopTime(fAliceRunStopTime),
96 fAlirootVersion(tag.fAlirootVersion),
97 fRootVersion(tag.fRootVersion),
98 fGeant3Version(tag.fGeant3Version),
99 fLHCPeriod(tag.fLHCPeriod),
100 fRecPass(tag.fRecPass),
101 fProductionName(tag.fProductionName),
102 fAliceRunValidated(tag.fAliceRunValidated),
103 fAliceRunGlobalQuality(tag.fAliceRunGlobalQuality),
104 fAliceBeamEnergy(tag.fAliceBeamEnergy),
105 fAliceBeamType(tag.fAliceBeamType),
106 fAliceCalibrationVersion(tag.fAliceCalibrationVersion),
107 fAliceDataType(tag.fAliceDataType),
108 //fNumEvents(tag.fNumEvents),
110 fBeamTriggers(tag.fBeamTriggers),
111 fCollisionTriggers(tag.fCollisionTriggers),
112 fEmptyTriggers(tag.fEmptyTriggers),
113 fASideTriggers(tag.fASideTriggers),
114 fCSideTriggers(tag.fCSideTriggers),
115 fHMTriggers(tag.fHMTriggers),
116 fMuonTriggers(tag.fMuonTriggers),
117 fCollisionRate(tag.fCollisionRate),
118 fMeanVertex(tag.fMeanVertex),
119 fVertexQuality(tag.fVertexQuality),
120 fNumDetectors(tag.fNumDetectors),
122 fDetectorTag(tag.fDetectorTag),
123 fLHCTag(tag.fLHCTag),
124 fActiveTriggerClasses(tag.fActiveTriggerClasses),
126 fQALength(tag.fQALength),
128 fESLength(tag.fESLength),
135 fQAArray = new ULong_t[fQALength] ;
136 memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
139 fEventSpecies = NULL ;
141 fEventSpecies = new Bool_t[fESLength] ;
142 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
144 for (int ifl=0; ifl<tag.fNumFiles; ifl++) {
145 AddFileTag(new AliFileTag(*tag.GetFileTag(ifl)));
151 //___________________________________________________________________________
152 AliRunTag& AliRunTag::operator = (const AliRunTag& tag) {
153 //assignment operator
155 fAliceRunId = tag.fAliceRunId ;
156 fAliceMagneticField = tag.fAliceMagneticField ;
157 fAliceDipoleField = tag.fAliceDipoleField ;
158 fAliceRunStartTime = tag.fAliceRunStartTime ;
159 fAliceRunStopTime = tag.fAliceRunStopTime ;
160 fAlirootVersion = tag.fAlirootVersion ;
161 fRootVersion = tag.fRootVersion ;
162 fGeant3Version = tag.fGeant3Version ;
163 fLHCPeriod = tag.fLHCPeriod ;
164 fRecPass = tag.fRecPass ;
165 fProductionName = tag.fProductionName ;
166 fAliceRunValidated = tag.fAliceRunValidated ;
167 fAliceRunGlobalQuality = tag.fAliceRunGlobalQuality ;
168 fAliceBeamEnergy = tag.fAliceBeamEnergy ;
169 fAliceBeamType = tag.fAliceBeamType ;
170 fAliceCalibrationVersion = tag.fAliceCalibrationVersion ;
171 fAliceDataType = tag.fAliceDataType ;
172 // fNumEvents = tag.fNumEvents ;
173 fNumFiles = tag.fNumFiles;
174 fBeamTriggers = tag.fBeamTriggers;
175 fCollisionTriggers = tag.fCollisionTriggers;
176 fEmptyTriggers = tag.fEmptyTriggers;
177 fASideTriggers = tag.fASideTriggers;
178 fCSideTriggers = tag.fCSideTriggers;
179 fHMTriggers = tag.fHMTriggers;
180 fMuonTriggers = tag.fMuonTriggers;
181 fCollisionRate = tag.fCollisionRate;
182 fMeanVertex = tag.fMeanVertex;
183 fVertexQuality = tag.fVertexQuality;
184 fNumDetectors = tag.fNumDetectors ;
185 fDetectorTag = tag.fDetectorTag ;
186 fLHCTag = tag.fLHCTag ;
187 fActiveTriggerClasses = tag.fActiveTriggerClasses;
189 fQALength = tag.fQALength ;
195 fQAArray = new ULong_t[fQALength] ;
196 memcpy(fQAArray, tag.fQAArray, fQALength*sizeof(ULong_t)) ;
198 fESLength = tag.fESLength ;
200 delete [] fEventSpecies ;
202 fEventSpecies = NULL ;
204 fEventSpecies = new Bool_t[fESLength] ;
205 memcpy(fEventSpecies, tag.fEventSpecies, fESLength*sizeof(Bool_t)) ;
207 for (int ifl=0; ifl<fNumFiles; ifl++) {
208 AddFileTag(new AliFileTag(*tag.GetFileTag(ifl)));
210 // for (int ifile=0; ifile<tag.GetFileTags()->GetEntries(); ifile++)
211 // AddFileTag(*((AliFileTag *) tag.GetFileTags()->At(ifile)));
216 //___________________________________________________________________________
217 void AliRunTag::CopyStandardContent(AliRunTag *oldtag) {
218 //function that copies the run, lhc and detector levels
219 SetRunId(oldtag->GetRunId());
220 SetMagneticField(oldtag->GetMagneticField());
221 SetDipoleField(oldtag->GetDipoleField());
222 SetRunStartTime(oldtag->GetRunStartTime());
223 SetRunStopTime(oldtag->GetRunStopTime());
224 SetAlirootVersion(oldtag->GetAlirootVersion());
225 SetRootVersion(oldtag->GetRootVersion());
226 SetGeant3Version(oldtag->GetGeant3Version());
227 SetLHCPeriod(oldtag->GetLHCPeriod());
228 SetReconstructionPass(oldtag->GetReconstructionPass());
229 SetProductionName(oldtag->GetProductionName());
230 SetRunValidation(oldtag->GetRunValidation());
231 SetRunQuality(oldtag->GetRunQuality());
232 SetBeamEnergy(oldtag->GetBeamEnergy());
233 SetBeamType(oldtag->GetBeamType());
234 SetCalibVersion(oldtag->GetCalibVersion());
235 SetDataType(oldtag->GetDataType());
236 SetBeamTriggers(oldtag->GetBeamTriggers());
237 SetCollisionTriggers(oldtag->GetCollisionTriggers());
238 SetEmptyTriggers(oldtag->GetEmptyTriggers());
239 SetASideTriggers(oldtag->GetASideTriggers());
240 SetCSideTriggers(oldtag->GetCSideTriggers());
241 SetHMTriggers(oldtag->GetHMTriggers());
242 SetMuonTriggers(oldtag->GetMuonTriggers());
243 SetCollisionRate(oldtag->GetCollisionRate());
244 SetMeanVertex(oldtag->GetMeanVertex());
245 SetVertexQuality(oldtag->GetVertexQuality());
246 SetLHCTag(oldtag->GetLHCTag()->GetLuminosity(),oldtag->GetLHCTag()->GetLHCState());
247 SetDetectorTag(oldtag->GetDetectorTags()->GetIntDetectorMaskDAQ(), oldtag->GetDetectorTags()->GetIntDetectorMaskReco());
248 SetActiveTriggerClasses(oldtag->GetActiveTriggerClasses());
249 SetQA(*(oldtag->GetQA())) ;
250 SetQAArray(oldtag->GetQAArray(), oldtag->GetQALength()) ;
251 SetEventSpecies(oldtag->GetEventSpecies(), oldtag->GetESLength()) ;
252 for (int ifile=0; ifile<oldtag->GetNFiles(); ifile++) {
253 AliFileTag *ntag = new AliFileTag();
254 ntag->CopyFileInfo((const AliFileTag &) *(oldtag->GetFileTag(ifile)));
259 void AliRunTag::UpdateFromRunTable(AliRunTag *tabtag)
261 SetBeamTriggers(tabtag->GetBeamTriggers());
262 SetCollisionTriggers(tabtag->GetCollisionTriggers());
263 SetEmptyTriggers(tabtag->GetEmptyTriggers());
264 SetASideTriggers(tabtag->GetASideTriggers());
265 SetCSideTriggers(tabtag->GetCSideTriggers());
266 SetHMTriggers(tabtag->GetHMTriggers());
267 SetMuonTriggers(tabtag->GetMuonTriggers());
268 SetCollisionRate(tabtag->GetCollisionRate());
269 SetMeanVertex(tabtag->GetMeanVertex());
270 SetVertexQuality(tabtag->GetVertexQuality());
271 SetRunQuality(tabtag->GetRunQuality());
272 fLHCTag.UpdateFromRunTable(*tabtag->GetLHCTag());
273 fDetectorTag.UpdateFromRunTable(*tabtag->GetDetectorTags());
276 //___________________________________________________________________________
277 void AliRunTag::SetQAArray(ULong_t * qa, Int_t qalength) {
278 //Setter for the qa bits
279 if (qa && qalength > 0) {
280 fQALength = qalength ;
283 fQAArray = new ULong_t[qalength] ;
284 memcpy(fQAArray, qa, qalength*sizeof(ULong_t)) ;
288 //___________________________________________________________________________
289 void AliRunTag::SetEventSpecies(Bool_t * es, Int_t eslength) {
290 //setter for the eventspecices
291 if (es && eslength >0 ) {
292 fESLength = eslength ;
294 delete [] fEventSpecies ;
295 fEventSpecies = new Bool_t[eslength] ;
296 memcpy(fEventSpecies, es, eslength*sizeof(Bool_t)) ;
301 //___________________________________________________________________________
302 void AliRunTag::SetLHCTag(Float_t lumin, TString type) {
303 //Setter for the LHC tags
304 fLHCTag.SetLuminosity(lumin);
305 fLHCTag.SetLHCState(type);
308 //___________________________________________________________________________
309 void AliRunTag::SetDetectorTag(UInt_t mask, UInt_t maskReco) {
310 //Setter for the detector tags
311 fDetectorTag.SetDetectorMaskDAQ(mask);
313 fDetectorTag.SetDetectorMaskReco(mask);
315 fDetectorTag.SetDetectorMaskReco(maskReco);
318 for (int iter=0; iter<32; iter++)
319 ndet += (mask & (1 << iter)) > 0;
321 fNumDetectors = ndet;
324 //___________________________________________________________________________
325 void AliRunTag::AddEventTag(const AliEventTag & EvTag) {
326 //Adds an entry to the event tag TClonesArray
327 ((AliFileTag *) fFileTags[fNumFiles-1])->AddEventTag(EvTag);
328 // new(fEventTag[fNumEvents++]) AliEventTag(EvTag);
331 void AliRunTag::AddFileTag(AliFileTag *t) {
332 //Adds an entry for each file tag
333 if (fNumFiles == fFileTags.GetSize()-1) fFileTags.Expand(fFileTags.GetSize()*2);
334 // new(fFileTags[fNumFiles++]) AliFileTag(t);
335 fFileTags[fNumFiles++] = t;
338 //___________________________________________________________________________
339 void AliRunTag::Clear(const char *) {
340 //Resets the number of events and detectors
341 // fEventTag.Delete();
350 if ( fEventSpecies ) {
351 delete [] fEventSpecies ;
357 const AliEventTag* AliRunTag::GetEventTag(int evt) const
362 if (evt >= GetNEvents()) return 0;
364 while (curev >= ((AliFileTag *) fFileTags[curf])->GetNEvents()) {
365 curev -= ((AliFileTag *) fFileTags[curf])->GetNEvents();
368 return ((AliFileTag *) fFileTags[curf])->GetEventTag(curev);
371 AliFileTag *AliRunTag::GetFileTagForEvent(int evt)
373 // Returns FileTag in which the given event is
377 if (evt >= GetNEvents()) return 0;
379 while (curev >= ((AliFileTag *) fFileTags[curf])->GetNEvents()) {
380 curev -= ((AliFileTag *) fFileTags[curf])->GetNEvents();
383 return (AliFileTag *) fFileTags[curf];
386 Int_t AliRunTag::GetNEvents() const
389 for (int iter=0; iter<fNumFiles; iter++)
390 evtot += ((AliFileTag *) fFileTags[iter])->GetNEvents();
395 Int_t AliRunTag::GetFileId(const char *guid)
397 for (int iter=0; iter<fNumFiles; iter++) {
398 if (strcmp(((AliFileTag *) fFileTags[iter])->GetGUID(), guid))