Skip to content

Commit f66d273

Browse files
lietavashahor02
authored andcommitted
clang format
1 parent e1bfb31 commit f66d273

5 files changed

Lines changed: 107 additions & 107 deletions

File tree

DataFormats/Detectors/CTP/include/DataFormatsCTP/Scalers.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ namespace ctp
2727
/// raw scalers produced by CTP and send to O2 either via
2828
/// - ZeroMQ published at CTP control machine
2929
/// - CTPreadout to FLP
30-
struct CTPScalerRaw {
30+
struct CTPScalerRaw {
3131
CTPScalerRaw() = default;
3232
uint32_t classIndex;
3333
uint32_t lmBefore;
@@ -40,7 +40,7 @@ struct CTPScalerRaw {
4040
ClassDefNV(CTPScalerRaw, 1);
4141
};
4242
/// Scalers produced from raw scalers corrected for overflow
43-
struct CTPScalerO2 {
43+
struct CTPScalerO2 {
4444
CTPScalerO2() = default;
4545
void createCTPScalerO2FromRaw(CTPScalerRaw& raw, std::vector<uint32_t>& overfow);
4646
uint32_t classIndex;
@@ -53,8 +53,7 @@ struct CTPScalerO2 {
5353
void printStream(std::ostream& stream) const;
5454
ClassDefNV(CTPScalerO2, 1);
5555
};
56-
struct CTPScalerRecordRaw
57-
{
56+
struct CTPScalerRecordRaw {
5857
CTPScalerRecordRaw() = default;
5958
o2::InteractionRecord intRecord;
6059
uint32_t seconds;
@@ -63,8 +62,7 @@ struct CTPScalerRecordRaw
6362
void printStream(std::ostream& stream) const;
6463
ClassDefNV(CTPScalerRecordRaw, 1);
6564
};
66-
struct CTPScalerRecordO2
67-
{
65+
struct CTPScalerRecordO2 {
6866
CTPScalerRecordO2() = default;
6967
o2::InteractionRecord intRecord;
7068
uint32_t seconds;
@@ -82,14 +80,15 @@ class CTPRunScalers
8280
std::vector<uint32_t> getClassIndexes();
8381
int readScalers(const std::string& rawscalers);
8482
int convertRawToO2();
83+
8584
private:
86-
typedef std::map<uint32_t, std::array<uint32_t,6>> overflows_t;
85+
typedef std::map<uint32_t, std::array<uint32_t, 6>> overflows_t;
8786
int mVersion;
8887
uint32_t mRunNumber;
8988
std::bitset<CTP_NCLASSES> mClassMask;
9089
std::vector<CTPScalerRecordRaw> mScalerRecordRaw;
9190
std::vector<CTPScalerRecordO2> mScalerRecordO2;
92-
int processScalerLine(std::string& line,int& level, int& nclasses);
91+
int processScalerLine(std::string& line, int& level, int& nclasses);
9392
int copyRawToO2Scalers();
9493
ClassDefNV(CTPRunScalers, 1);
9594
};

DataFormats/Detectors/CTP/src/Scalers.cxx

Lines changed: 92 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ void CTPScalerRaw::printStream(std::ostream& stream) const
2929
void CTPScalerO2::createCTPScalerO2FromRaw(CTPScalerRaw& raw, std::vector<uint32_t>& overflow)
3030
{
3131
classIndex = raw.classIndex;
32-
lmBefore = raw.lmBefore + 0xffffffff*overflow[0];
33-
lmAfter = raw.lmAfter + 0xffffffff*overflow[1];
34-
l0Before = raw.l0Before + 0xffffffff*overflow[2];
35-
l0After = raw.l0After + 0xffffffff*overflow[3];
36-
l1Before = raw.l1Before + 0xffffffff*overflow[4];
37-
l1After = raw.l1After + 0xffffffff*overflow[5];
32+
lmBefore = raw.lmBefore + 0xffffffff * overflow[0];
33+
lmAfter = raw.lmAfter + 0xffffffff * overflow[1];
34+
l0Before = raw.l0Before + 0xffffffff * overflow[2];
35+
l0After = raw.l0After + 0xffffffff * overflow[3];
36+
l1Before = raw.l1Before + 0xffffffff * overflow[4];
37+
l1After = raw.l1After + 0xffffffff * overflow[5];
3838
}
3939
void CTPScalerO2::printStream(std::ostream& stream) const
4040
{
@@ -46,43 +46,43 @@ void CTPScalerRecordRaw::printStream(std::ostream& stream) const
4646
{
4747
stream << "Orbit:" << intRecord.orbit << " BC:" << intRecord.bc;
4848
stream << " Seconds:" << seconds << " Microseconds:" << microSeconds << std::endl;
49-
for(auto const& cnts: scalers) {
50-
cnts.printStream(stream);
49+
for (auto const& cnts : scalers) {
50+
cnts.printStream(stream);
5151
}
5252
}
5353
void CTPScalerRecordO2::printStream(std::ostream& stream) const
5454
{
5555
stream << "Orbit:" << intRecord.orbit << " BC:" << intRecord.bc;
5656
stream << " Seconds:" << seconds << " Microseconds:" << microSeconds << std::endl;
57-
for(auto const& cnts: scalers) {
58-
cnts.printStream(stream);
57+
for (auto const& cnts : scalers) {
58+
cnts.printStream(stream);
5959
}
6060
}
6161
void CTPRunScalers::printStream(std::ostream& stream) const
6262
{
6363
stream << "CTP Scalers (version:" << mVersion << ") Run:" << mRunNumber << std::endl;
6464
printClasses(stream);
65-
for(auto const& rec: mScalerRecordRaw) {
66-
rec.printStream(stream);
65+
for (auto const& rec : mScalerRecordRaw) {
66+
rec.printStream(stream);
6767
}
6868
}
6969
void CTPRunScalers::printClasses(std::ostream& stream) const
7070
{
7171
stream << "CTP classes:";
72-
for(int i=0;i<mClassMask.size(); i++) {
73-
if(mClassMask[i]) {
74-
stream << " " << i;
75-
}
72+
for (int i = 0; i < mClassMask.size(); i++) {
73+
if (mClassMask[i]) {
74+
stream << " " << i;
75+
}
7676
}
7777
stream << std::endl;
7878
}
7979
std::vector<uint32_t> CTPRunScalers::getClassIndexes()
8080
{
8181
std::vector<uint32_t> indexes;
82-
for(uint32_t i = 0; i < CTP_NCLASSES; i++) {
83-
if(mClassMask[i]) {
84-
indexes.push_back(i);
85-
}
82+
for (uint32_t i = 0; i < CTP_NCLASSES; i++) {
83+
if (mClassMask[i]) {
84+
indexes.push_back(i);
85+
}
8686
}
8787
return indexes;
8888
}
@@ -93,16 +93,16 @@ int CTPRunScalers::readScalers(const std::string& rawscalers)
9393
int ret = 0;
9494
int level = 0;
9595
std::string line;
96-
int nclasses=0;
96+
int nclasses = 0;
9797
while (std::getline(iss, line)) {
9898
o2::utils::Str::trim(line);
9999
if ((ret = processScalerLine(line, level, nclasses)) != 0) {
100100
return ret;
101101
}
102102
}
103-
if(nclasses != 0) {
104-
LOG(ERROR) << "Wrong number of classes in final record";
105-
return 6;
103+
if (nclasses != 0) {
104+
LOG(ERROR) << "Wrong number of classes in final record";
105+
return 6;
106106
}
107107
return 0;
108108
}
@@ -121,76 +121,76 @@ int CTPRunScalers::processScalerLine(std::string& line, int& level, int& nclasse
121121
}
122122
std::cout << line << " level in::" << level << std::endl;
123123
// Version
124-
if(level == 0) {
125-
if(ntokens != 1) {
126-
LOG(ERROR) << "Expected version in the first line";
127-
return 1;
128-
} else {
129-
mVersion = std::stoi(tokens[0]);
130-
level = 1;
131-
return 0;
132-
}
124+
if (level == 0) {
125+
if (ntokens != 1) {
126+
LOG(ERROR) << "Expected version in the first line";
127+
return 1;
128+
} else {
129+
mVersion = std::stoi(tokens[0]);
130+
level = 1;
131+
return 0;
132+
}
133133
}
134134
// Run Number N Classes [class indexes]
135-
if(level == 1) {
136-
if(ntokens < 3) {
137-
LOG(ERROR) << "Wrong syntax of second line in CTP scalers";
138-
return 2;
139-
} else {
140-
mRunNumber = std::stol(tokens[0]);
141-
int numofclasses = std::stoi(tokens[1]);
142-
if((numofclasses+2) != ntokens) {
143-
LOG(ERROR) << "Wrong syntax of second line in CTP scalers";
144-
return 3;
145-
}
146-
mClassMask.reset();
147-
for(int i=0; i < numofclasses; i++) {
148-
int index = std::stoi(tokens[i+2]);
149-
mClassMask[index] = 1;
150-
}
151-
level = 2;
152-
nclasses = 0;
153-
return 0;
135+
if (level == 1) {
136+
if (ntokens < 3) {
137+
LOG(ERROR) << "Wrong syntax of second line in CTP scalers";
138+
return 2;
139+
} else {
140+
mRunNumber = std::stol(tokens[0]);
141+
int numofclasses = std::stoi(tokens[1]);
142+
if ((numofclasses + 2) != ntokens) {
143+
LOG(ERROR) << "Wrong syntax of second line in CTP scalers";
144+
return 3;
145+
}
146+
mClassMask.reset();
147+
for (int i = 0; i < numofclasses; i++) {
148+
int index = std::stoi(tokens[i + 2]);
149+
mClassMask[index] = 1;
154150
}
151+
level = 2;
152+
nclasses = 0;
153+
return 0;
154+
}
155155
}
156156
// Time stamp: orbit bcid linuxtime
157-
if(level == 2) {
158-
if(ntokens != 4) {
159-
LOG(ERROR) << "Wrong syntax of time stamp line in CTP scalers";
160-
return 4;
161-
} else {
162-
CTPScalerRecordRaw rec;
163-
rec.intRecord.orbit = std::stol(tokens[0]);
164-
rec.intRecord.bc = std::stol(tokens[1]);
165-
rec.seconds = std::stol(tokens[2]);
166-
rec.microSeconds = std::stol(tokens[3]);
167-
mScalerRecordRaw.push_back(rec);
168-
level = 3;
169-
return 0;
170-
}
157+
if (level == 2) {
158+
if (ntokens != 4) {
159+
LOG(ERROR) << "Wrong syntax of time stamp line in CTP scalers";
160+
return 4;
161+
} else {
162+
CTPScalerRecordRaw rec;
163+
rec.intRecord.orbit = std::stol(tokens[0]);
164+
rec.intRecord.bc = std::stol(tokens[1]);
165+
rec.seconds = std::stol(tokens[2]);
166+
rec.microSeconds = std::stol(tokens[3]);
167+
mScalerRecordRaw.push_back(rec);
168+
level = 3;
169+
return 0;
170+
}
171171
}
172-
if(level == 3) {
173-
if(ntokens != 6) {
174-
LOG(ERROR) << "Wrong syntax of counters line in CTP scalers";
175-
return 5;
176-
} else {
177-
std::cout << "nclasses:" << nclasses << std::endl;
178-
CTPScalerRaw scaler;
179-
scaler.classIndex = getClassIndexes()[level - 3];
180-
scaler.lmBefore = std::stol(tokens[0]);
181-
scaler.lmAfter = std::stol(tokens[1]);
182-
scaler.l0Before = std::stol(tokens[2]);
183-
scaler.l0After = std::stol(tokens[3]);
184-
scaler.l1Before = std::stol(tokens[4]);
185-
scaler.l1After = std::stol(tokens[5]);
186-
(mScalerRecordRaw.back()).scalers.push_back(scaler);
187-
nclasses++;
188-
if(nclasses >= mClassMask.count()) {
189-
level = 2;
190-
nclasses = 0;
191-
}
192-
return 0;
172+
if (level == 3) {
173+
if (ntokens != 6) {
174+
LOG(ERROR) << "Wrong syntax of counters line in CTP scalers";
175+
return 5;
176+
} else {
177+
std::cout << "nclasses:" << nclasses << std::endl;
178+
CTPScalerRaw scaler;
179+
scaler.classIndex = getClassIndexes()[level - 3];
180+
scaler.lmBefore = std::stol(tokens[0]);
181+
scaler.lmAfter = std::stol(tokens[1]);
182+
scaler.l0Before = std::stol(tokens[2]);
183+
scaler.l0After = std::stol(tokens[3]);
184+
scaler.l1Before = std::stol(tokens[4]);
185+
scaler.l1After = std::stol(tokens[5]);
186+
(mScalerRecordRaw.back()).scalers.push_back(scaler);
187+
nclasses++;
188+
if (nclasses >= mClassMask.count()) {
189+
level = 2;
190+
nclasses = 0;
193191
}
192+
return 0;
193+
}
194194
}
195195
return 0;
196196
}
@@ -200,16 +200,16 @@ int CTPRunScalers::convertRawToO2()
200200
{
201201
//struct classScalersOverflows {uint32_t overflows[6];};
202202
overflows_t overflows;
203-
for(uint32_t i = 0; i < mClassMask.size(); i++) {
204-
if(mClassMask[i]) {
205-
overflows[i] = {0,0,0,0,0,0};
206-
}
203+
for (uint32_t i = 0; i < mClassMask.size(); i++) {
204+
if (mClassMask[i]) {
205+
overflows[i] = {0, 0, 0, 0, 0, 0};
206+
}
207207
}
208208
CTPScalerRecordO2 o2rec;
209209
o2rec.intRecord = mScalerRecordRaw[0].intRecord;
210210
o2rec.seconds = mScalerRecordRaw[0].seconds;
211211
o2rec.microSeconds = mScalerRecordRaw[0].microSeconds;
212-
for(int i = 1; i < mScalerRecordRaw.size(); i++) {
212+
for (int i = 1; i < mScalerRecordRaw.size(); i++) {
213213
//CTPScalerRecordRaw& prev = mScalerRecordRaw[i-1];
214214
//CTPScalerRecordRaw& curr = mScalerRecordRaw[i];
215215
}

Detectors/CTP/macro/TestCTPScalers.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ using namespace o2::ctp;
2626
void TestCTPScalers(long tmin = 0, long tmax = -1, std::string ccdbHost = "http://ccdb-test.cern.ch:8080")
2727
{
2828
/// Demo scalers
29-
std::string scalersstr = "0\n"; // version
29+
std::string scalersstr = "0\n"; // version
3030
scalersstr += "333 5 0 2 8 32 63\n"; // runnumber nclasses [classes list]]
3131
scalersstr += "4 3563 4 5\n"; // orbit bc secs usecs
3232
scalersstr += "1 2 1 2 1 1\n"; // class 0
3333
scalersstr += "100 0 0 0 0 100\n"; // class 2
3434
scalersstr += "0 0 0 0 0 0\n"; // class 8
3535
scalersstr += "3 3 3 3 3 3\n"; // class 32
36-
scalersstr += "34 34 34 34 34 34\n"; // class 63
36+
scalersstr += "34 34 34 34 34 34\n"; // class 63
3737
scalersstr += "1000 3563 5 5\n"; // orbit bc secs usecs
3838
scalersstr += "1 2 1 2 1 1\n"; // class 0
3939
scalersstr += "100 0 0 0 0 100\n"; // class 2
4040
scalersstr += "0 0 0 0 0 0\n"; // class 8
4141
scalersstr += "3 3 3 3 3 3\n"; // class 32
42-
scalersstr += "34 34 34 34 34 34\n"; // class 63
42+
scalersstr += "34 34 34 34 34 34\n"; // class 63
4343
//
4444
CTPRunScalers ctpscalers;
4545
int ret = ctpscalers.readScalers(scalersstr);
46-
if(ret == 0) {
46+
if (ret == 0) {
4747
ctpscalers.printStream(std::cout);
4848
}
4949
}

Detectors/CTP/simulation/include/CTPSimulation/Digits2Raw.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class Digits2Raw
3737
void init();
3838
void setVerbosity(int v) { mVerbosity = v; }
3939
void setFilePerLink(bool v) { mOutputPerLink = v; }
40-
void setZeroSuppressedIntRec(bool value){ mZeroSuppressedIntRec = value; }
41-
void setZeroSuppressedClassRec(bool value){ mZeroSuppressedClassRec = value; }
40+
void setZeroSuppressedIntRec(bool value) { mZeroSuppressedIntRec = value; }
41+
void setZeroSuppressedClassRec(bool value) { mZeroSuppressedClassRec = value; }
4242
void setOutDir(std::string& outdir) { mOutDir = outdir; }
4343
bool getFilePerLink() const { return mOutputPerLink; }
4444
o2::raw::RawFileWriter& getWriter() { return mWriter; }

Detectors/CTP/simulation/src/Digits2Raw.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ void Digits2Raw::processDigits(const std::string& fileDigitsName)
102102
buffer = digits2HBTPayload(hbfIRnonZS, NIntRecPayload);
103103
}
104104
std::cout << "buffer:" << buffer.size() << ":";
105-
for(auto const& c : buffer) std::cout << c ;
105+
for (auto const& c : buffer)
106+
std::cout << c;
106107
std::cout << std::endl;
107108
mWriter.addData(CRULinkIDIntRec, mCruID, CRULinkIDIntRec, mEndPointID, intRec, buffer);
108109
// add data for Trigger Class Record

0 commit comments

Comments
 (0)