]> git.uio.no Git - u/mrichter/AliRoot.git/blame - OADB/AliOADBFillingScheme.cxx
used run 170162 as reference
[u/mrichter/AliRoot.git] / OADB / AliOADBFillingScheme.cxx
CommitLineData
eeb4307b 1//-------------------------------------------------------------------------
2// OADB container for filling scheme information (BX ids, name ...)
3// Author: Michele Floris, CERN
4//-------------------------------------------------------------------------
5
6#include "AliOADBFillingScheme.h"
7#include "TMap.h"
8#include "AliLog.h"
9#include "TBrowser.h"
10#include "TFolder.h"
11#include <iostream>
12
13using namespace std;
14
15ClassImp(AliOADBFillingScheme)
16
17
18AliOADBFillingScheme::AliOADBFillingScheme() : TNamed("AliOADBFillingScheme", "OADB object storing filling scheme infos"), fFSName(""), fBXIds(0){
19 // default ctor
20
21
22}
23AliOADBFillingScheme::AliOADBFillingScheme(char* name) : TNamed(name, "OADB object storing filling scheme infos"), fFSName(""), fBXIds(0){
24 // ctor
25 Init();
26}
27
28void AliOADBFillingScheme::Init() {
29 // initialize pointers
30 fBXIds = new TMap();
31 fFSName = "";
32
33}
34
35AliOADBFillingScheme::~AliOADBFillingScheme(){
36 // dtor
37
38 if(fBXIds) delete fBXIds;
39
40}
41
d60ec0a6 42// AliOADBFillingScheme::AliOADBFillingScheme(const AliOADBFillingScheme& cont) {
43// // Copy ctor
44// AliError("To be implemented");
45// }
46
47// AliOADBFillingScheme& AliOADBFillingScheme::operator=(const AliOADBFillingScheme& cont) {
48// //Assignment operator
49// AliError("To be implemented");
50// }
eeb4307b 51
52// Getters
53
54const char * AliOADBFillingScheme::GetBXIDs(const char * beamSide) const
55{
56 // Returns the bunch crossing numbers for the different beam classes. By default this is empty
57
4e3a6556 58 if (!strcmp(beamSide, "AC") && !(TObjString*)fBXIds->GetValue(beamSide)) {
eeb4307b 59
9d21bb4a 60 TString &bxa = ((TObjString*)fBXIds->GetValue("A"))->String();
61 TString &bxc = ((TObjString*)fBXIds->GetValue("C"))->String();
62 if(bxa.IsNull() && bxc.IsNull()) return "";
63 if(bxc.IsNull()) return bxa.Data();
64 if(bxa.IsNull()) return bxc.Data();
65 static TString bxBoth = bxa.Data();
eeb4307b 66 bxBoth += bxc.Data();
67 return bxBoth.Data();
68
69 }
70
4e3a6556 71 if(!(TObjString*)fBXIds->GetValue(beamSide)) return "";
72
9d21bb4a 73 TString &bx = ((TObjString*)fBXIds->GetValue(beamSide))->String();
74 if(bx.IsNull()) return "";
eeb4307b 75 return bx.Data();
76
77}
78
79void AliOADBFillingScheme::Browse(TBrowser *b)
80{
81 // Browse this object.
82 // If b=0, there is no Browse call TObject::Browse(0) instead.
83 // This means TObject::Inspect() will be invoked indirectly
84
85
86 if (b) {
87 // Creates a folder for each beam type containing the list of corresponding bx ids
88 b->Add(new TObjString(Form("Filling Scheme %s",GetFillingSchemeName())));
89 TIterator * mapIter = fBXIds->MakeIterator();
90 TObjString * key = 0;
91 while ((key = (TObjString*) mapIter->Next())) {
92 TFolder * folder = new TFolder(key->String().Data(), "beam side");
93 TObjString * value = (TObjString*) fBXIds->GetValue(key);
94 TObjArray * tokens = value->String().Tokenize(" ");
95 TIterator * tokIter = tokens->MakeIterator();
96 TObjString * bxNum = 0;
97 while ((bxNum = (TObjString*) tokIter->Next())){
98 folder->Add(bxNum);
99 }
100 b->Add(folder);
101 delete tokIter;
102 }
103 delete mapIter;
104 }
105 else
106 TObject::Browse(b);
107}
108
109void AliOADBFillingScheme::Print(Option_t* option) const {
110 // Print Class contents
111 // Option is passed to TMap::Print
1b94b3b4 112 cout << "Filling scheme Name " << fFSName.Data() << option << endl;
eeb4307b 113 fBXIds->Print(option);
114}