-
Notifications
You must be signed in to change notification settings - Fork 494
Expand file tree
/
Copy pathCreateModuleConfig.C
More file actions
138 lines (128 loc) · 5 KB
/
CreateModuleConfig.C
File metadata and controls
138 lines (128 loc) · 5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#if !defined(__CLING__) || defined(__ROOTCLING__)
#include "FairLogger.h"
#include "CCDB/CcdbApi.h"
#include "ZDCBase/ModuleConfig.h"
#include "ZDCBase/Constants.h"
#include <string>
#include <TFile.h>
#include <map>
#endif
using namespace o2::zdc;
using namespace std;
void CreateModuleConfig(long tmin = 0, long tmax = -1,
std::string ccdbHost = "http://ccdb-test.cern.ch:8080")
{
ModuleConfig conf;
int modID;
//-------------------------------------------
// Up to 8 modules with four channels
// setChannel(int slot, int8_t chID, int16_t fID, bool read, bool trig = false, int tF = 0, int tL = 0, int tS = 0, int tT = 0)
// module id must be in the range 0-7
// channel id must be in range 0-3
// frontend id must be in range 0-15 and identify the pair of channels connected to
// each fibre
{
modID = 0;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZNAC, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(1, IdZNASum, 2 * modID, false, false, -5, 6, 4, 12);
module.setChannel(2, IdZNA1, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZNA2, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 1;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZNAC, 2 * modID, false, true, -5, 6, 4, 12);
module.setChannel(1, IdZNASum, 2 * modID, true, false, -5, 6, 4, 12);
module.setChannel(2, IdZNA3, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZNA4, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 2;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZNCC, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(1, IdZNCSum, 2 * modID, false, false, -5, 6, 4, 12);
module.setChannel(2, IdZNC1, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZNC2, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 3;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZNCC, 2 * modID, false, true, -5, 6, 4, 12);
module.setChannel(1, IdZNCSum, 2 * modID, true, false, -5, 6, 4, 12);
module.setChannel(2, IdZNC3, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZNC4, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 4;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZPAC, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(1, IdZEM1, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(2, IdZPA1, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZPA2, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 5;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZPAC, 2 * modID, false, true, -5, 6, 4, 12);
module.setChannel(1, IdZPASum, 2 * modID, true, false, -5, 6, 4, 12);
module.setChannel(2, IdZPA3, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZPA4, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 6;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZPCC, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(1, IdZEM2, 2 * modID, true, true, -5, 6, 4, 12);
module.setChannel(2, IdZPC1, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZPC2, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
//-------------------------------------------
{
modID = 7;
auto& module = conf.modules[modID];
module.id = modID;
module.setChannel(0, IdZPCC, 2 * modID, false, true, -5, 6, 4, 12);
module.setChannel(1, IdZPCSum, 2 * modID, true, false, -5, 6, 4, 12);
module.setChannel(2, IdZPC3, 2 * modID + 1, true, false, -5, 6, 4, 12);
module.setChannel(3, IdZPC4, 2 * modID + 1, true, false, -5, 6, 4, 12);
//
}
conf.check();
conf.print();
o2::ccdb::CcdbApi api;
map<string, string> metadata; // can be empty
api.init(ccdbHost.c_str()); // or http://localhost:8080 for a local installation
// store abitrary user object in strongly typed manner
api.storeAsTFileAny(&conf, CCDBPathConfigModule, metadata, tmin, tmax);
// return conf;
}