BmnRoot
Loading...
Searching...
No Matches
BmnOfflineQaSteering.h
Go to the documentation of this file.
1#include <iostream>
2#include <fstream>
3#include <sstream>
4#include <vector>
5#include <TNamed.h>
6#include <TMath.h>
7#include <TVector3.h>
8#include <TSystem.h>
9#include <TObjArray.h>
10#include <TObjString.h>
11
12#include <BmnGemStripStationSet.h>
13#include <BmnSiliconStationSet.h>
14#include <BmnCSCStationSet.h>
15
16#ifndef BMNOFFLINEQASTEERING_H
17#define BMNOFFLINEQASTEERING_H 1
18
19using namespace std;
20using namespace TMath;
21
22class BmnOfflineQaSteering : public TNamed {
23public:
24
26 // BmnOfflineQaSteering(TString) {};
27
29
30 pair <Int_t, Int_t> GetCanvasSizes(Int_t run, TString setup, TString name, TString dim) {
31 for (auto it : fCanvasAttributes) {
32 if (TString(it[0]).Atoi() == run && it[1] == setup && name.Contains(TString(it[2]).Data())) {
33 return (dim == "1d") ? make_pair(TString(it[3]).Atoi(), TString(it[4]).Atoi()) :
34 (dim == "2d") ? make_pair(TString(it[5]).Atoi(), TString(it[6]).Atoi()) :
35 make_pair(-1, -1);
36 }
37 }
38 return make_pair(-1, -1);
39 }
40
41 Int_t GetNCanvases() {
42 return fNCanvases;
43 }
44
45 Int_t GetNReleases() {
46 return fNReleases;
47 }
48
49 vector <TString> GetListOfReleases() {
50 return fListReleases;
51 }
52
53 vector <TString> GetListOfCanvases() {
54 return fListCanvases;
55 }
56
57 pair <Int_t, Int_t> GetBorderRuns(Int_t period, TString setup = "BM@N") {
58 if (period == 6 && setup == "SRC")
59 return make_pair(-1, -1);
60 return fBorderRuns.find(make_pair(period, setup))->second;
61 }
62
63 vector <TString> GetDetectors(Int_t period, TString setup = "BM@N") {
64 if (period == 6 && setup == "SRC") {
65 // Configuration does not exist !!!
66 vector <TString> tmp;
67 tmp.resize(0);
68 return tmp;
69 } else
70 return fDetectors.find(make_pair(period, setup))->second;
71 }
72
73 vector <TString> GetTriggers(Int_t period, TString setup = "BM@N") {
74 if (period == 6 && setup == "SRC") {
75 // Configuration does not exist !!!
76 vector <TString> tmp;
77 tmp.resize(0);
78 return tmp;
79 } else
80 return fTriggers.find(make_pair(period, setup))->second;
81 }
82
83 pair <Int_t, TString> GetRunAndSetupByRunId(Int_t id) {
84 const Int_t nPeriods = 2;
85 const Int_t nSetups = 2;
86
87 Int_t runPeriods[nPeriods] = {6, 7};
88 TString setups[nSetups] = {"BM@N", "SRC"};
89
90 for (Int_t iPeriod = 0; iPeriod < nPeriods; iPeriod++)
91 for (Int_t iSetup = 0; iSetup < nSetups; iSetup++)
92 if (id >= GetBorderRuns(runPeriods[iPeriod], setups[iSetup]).first && id <= GetBorderRuns(runPeriods[iPeriod], setups[iSetup]).second)
93 return make_pair(runPeriods[iPeriod], setups[iSetup]);
94
95 return make_pair(-1, "");
96 }
97
98 Int_t GetNumberOfDets(Int_t period, TString setup, TString type) {
99 // Possible det. types are: coordinate, time, calorimeter
100 if (type != "coordinate" && type != "time" && type != "calorimeter")
101 return -1;
102 Int_t detCounter = 0;
103 for (size_t iDet = 0; iDet < GetDetectors(period, setup).size(); iDet++) {
104 TString det = GetDetectors(period, setup)[iDet];
105
106 if (type == "coordinate") {
107 if (det.Contains("GEM") || det.Contains("SILICON") || det.Contains("CSC"))
108 detCounter++;
109 } else if (type == "time") {
110 if (det.Contains("TOF400") || det.Contains("TOF700") || det.Contains("MWPC") || det.Contains("DCH"))
111 detCounter++;
112 } else if (type == "calorimeter") {
113 if (det.Contains("ECAL") || det.Contains("ZDC"))
114 detCounter++;
115 }
116 }
117 return detCounter;
118 }
119
121 TString gPathConfig = gSystem->Getenv("VMCWORKDIR");
122
123 TString gPathGemConfig = gPathConfig + "/parameters/gem/XMLConfigs/";
124 TString gPathSilConfig = gPathConfig + "/parameters/silicon/XMLConfigs/";
125 TString gPathCscConfig = gPathConfig + "/parameters/csc/XMLConfigs/";
126
127 const Int_t nPeriods = 2;
128 const Int_t nSetups = 2;
129
130 Int_t runPeriods[nPeriods] = {6, 7};
131 TString setups[nSetups] = {"BM@N", "SRC"};
132
133 TString confGEM = "";
134 TString confSIL = "";
135 TString confCSC = "";
136
137 for (Int_t iPeriod = 0; iPeriod < nPeriods; iPeriod++)
138 for (Int_t iSetup = 0; iSetup < nSetups; iSetup++)
139 if (id >= GetBorderRuns(runPeriods[iPeriod], setups[iSetup]).first && id <= GetBorderRuns(runPeriods[iPeriod], setups[iSetup]).second) {
140
141 if (iPeriod == 0 && iSetup == 0) {
142 // RUN6, BM@N
143
144 confGEM = "GemRunSpring2017.xml";
145 confSIL = "SiliconRunSpring2017.xml";
146 } else if (iPeriod == 1 && iSetup == 0) {
147 // RUN7, BM@N
148
149 confGEM = "GemRunSpring2018.xml";
150 confSIL = "SiliconRunSpring2018.xml";
151 confCSC = "CSCRunSpring2018.xml";
152 } else if (iPeriod == 1 && iSetup == 1) {
153 // RUN7, SRC
154
155 confGEM = "GemRunSRCSpring2018.xml";
156 confSIL = "SiliconRunSRCSpring2018.xml";
157 confCSC = "CSCRunSRCSpring2018.xml";
158 }
159
160 if (!gem)
161 gem = new BmnGemStripStationSet(gPathGemConfig + confGEM);
162
163 if (!silicon)
164 silicon = new BmnSiliconStationSet(gPathSilConfig + confSIL);
165
166 if (!confCSC.IsNull() && !csc)
167 csc = new BmnCSCStationSet(gPathCscConfig + confCSC);
168 }
169 }
170
171 vector <Double_t> GetAxisAttributes(TString);
172
173private:
174 void ParseSteerFile(TString f = "qaOffline.dat");
175
176 Int_t fNCanvases;
177 Int_t fNReleases;
178
179 vector <TString> fListCanvases;
180 vector <TString> fListReleases;
181
182 vector <vector <TString>> fCanvasAttributes;
183
184 map <pair <Int_t, TString>, pair <Int_t, Int_t>> fBorderRuns; // (period, setup) --> (start, finish)
185 map <pair <Int_t, TString>, vector <TString>> fDetectors; // (period, setup) --> list of detectors
186 map <pair <Int_t, TString>, vector <TString>> fTriggers; // (period, setup) --> list of triggers
187
188 ClassDef(BmnOfflineQaSteering, 1);
189};
190
191#endif
float f
Definition P4_F32vec4.h:21
void SetGeometriesByRunId(Int_t id, BmnGemStripStationSet *&gem, BmnSiliconStationSet *&silicon, BmnCSCStationSet *&csc)
pair< Int_t, Int_t > GetCanvasSizes(Int_t run, TString setup, TString name, TString dim)
Int_t GetNumberOfDets(Int_t period, TString setup, TString type)
vector< TString > GetListOfReleases()
vector< TString > GetDetectors(Int_t period, TString setup="BM@N")
vector< Double_t > GetAxisAttributes(TString)
virtual ~BmnOfflineQaSteering()
pair< Int_t, TString > GetRunAndSetupByRunId(Int_t id)
vector< TString > GetTriggers(Int_t period, TString setup="BM@N")
pair< Int_t, Int_t > GetBorderRuns(Int_t period, TString setup="BM@N")
vector< TString > GetListOfCanvases()
const UInt_t dim
-clang-format
Definition setup.py:1
STL namespace.