@@ -29,12 +29,12 @@ void CTPScalerRaw::printStream(std::ostream& stream) const
2929void 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}
3939void 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}
5353void 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}
6161void 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}
6969void 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}
7979std::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 }
0 commit comments