Skip to content

Commit b967709

Browse files
committed
clang
1 parent 3912667 commit b967709

File tree

6 files changed

+67
-67
lines changed

6 files changed

+67
-67
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,18 @@ class CTPRateFetcher
3333
void setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, bool initScalers);
3434
void updateScalers(ctp::CTPRunScalers& scalers);
3535
int getRates(std::array<double, 3>& rates, o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName); // rates at start,stop and middle of the run
36-
double getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr = 0); // total lumi for a run
36+
double getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr = 0); // total lumi for a run
3737
double getLumiNoPuCorr(const std::string& classname, int type = 1);
3838
double getLumiWPuCorr(const std::string& classname, int type = 1);
39-
void setOrbit(bool orb) { mOrbit = orb; } // use orbit instead of time
39+
void setOrbit(bool orb) { mOrbit = orb; } // use orbit instead of time
4040
void setOutsideLimits(bool qc) { mOutsideLimits = qc; } // return first/last rate of time outside of run
4141

4242
private:
4343
double fetchCTPratesInputs(uint64_t timeStamp, int input);
4444
double fetchCTPratesClasses(uint64_t timeStamp, const std::string& className, int inputType = 1);
4545
double fetchCTPratesInputsNoPuCorr(uint64_t timeStamp, int input);
4646
double fetchCTPratesClassesNoPuCorr(uint64_t timeStamp, const std::string& className, int inputType = 1);
47-
double getLumi(const std::string& classname,int type = 1, int puCorr = 0);
47+
double getLumi(const std::string& classname, int type = 1, int puCorr = 0);
4848
double pileUpCorrection(double rate);
4949
int mRunNumber = -1;
5050
bool mOutsideLimits = 0;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class CTPRunScalers
145145
}
146146
/// retrieves integral - same interface as getRate, no pileup correction
147147
uint64_t getLumiNoPuCorr(int classindex, int type) const;
148-
/// retrieves vector of counters - same interface as getRate, needed for
148+
/// retrieves vector of counters - same interface as getRate, needed for
149149
std::vector<std::pair<double_t, double_t>> getRatesForIndex(int classindex, int type) const;
150150
/// retrieves time boundaries of this scaler object from O2 scalers
151151
std::pair<unsigned long, unsigned long> getTimeLimit() const

DataFormats/Detectors/CTP/src/CTPRateFetcher.cxx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ int CTPRateFetcher::getRates(std::array<double, 3>& rates, o2::ccdb::BasicCCDBMa
7979
}
8080
double CTPRateFetcher::getLumiNoPuCorr(const std::string& classname, int type)
8181
{
82-
if(classname == "zncinp") {
83-
return mScalers.getLumiNoPuCorr(26,7);
82+
if (classname == "zncinp") {
83+
return mScalers.getLumiNoPuCorr(26, 7);
8484
}
8585
std::vector<ctp::CTPClass>& ctpcls = mConfig.getCTPClasses();
8686
std::vector<int> clslist = mConfig.getTriggerClassList();
@@ -99,9 +99,9 @@ double CTPRateFetcher::getLumiNoPuCorr(const std::string& classname, int type)
9999
}
100100
double CTPRateFetcher::getLumiWPuCorr(const std::string& classname, int type)
101101
{
102-
std::vector<std::pair<double,double>> scals;
103-
if(classname == "zncinp") {
104-
scals = mScalers.getRatesForIndex(26,7);
102+
std::vector<std::pair<double, double>> scals;
103+
if (classname == "zncinp") {
104+
scals = mScalers.getRatesForIndex(26, 7);
105105
} else {
106106
std::vector<ctp::CTPClass>& ctpcls = mConfig.getCTPClasses();
107107
std::vector<int> clslist = mConfig.getTriggerClassList();
@@ -116,18 +116,18 @@ double CTPRateFetcher::getLumiWPuCorr(const std::string& classname, int type)
116116
LOG(warn) << "Trigger class " << classname << " not found in CTPConfiguration";
117117
return -1;
118118
}
119-
scals = mScalers.getRatesForIndex(classIndex,type);
119+
scals = mScalers.getRatesForIndex(classIndex, type);
120120
}
121121
double lumi = 0;
122-
for(auto const& ss: scals){
123-
//std::cout << ss.first << " " << ss.second << " " << pileUpCorrection(ss.first/ss.second) << std::endl;
124-
lumi += pileUpCorrection(ss.first/ss.second)*ss.second;
122+
for (auto const& ss : scals) {
123+
// std::cout << ss.first << " " << ss.second << " " << pileUpCorrection(ss.first/ss.second) << std::endl;
124+
lumi += pileUpCorrection(ss.first / ss.second) * ss.second;
125125
}
126126
return lumi;
127127
}
128-
double CTPRateFetcher::getLumi(const std::string& classname,int type, int puCorr)
128+
double CTPRateFetcher::getLumi(const std::string& classname, int type, int puCorr)
129129
{
130-
if(puCorr){
130+
if (puCorr) {
131131
return getLumiWPuCorr(classname, type);
132132
} else {
133133
return getLumiNoPuCorr(classname, type);
@@ -136,15 +136,15 @@ double CTPRateFetcher::getLumi(const std::string& classname,int type, int puCorr
136136

137137
double CTPRateFetcher::getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr)
138138
{
139-
//setupRun(runNumber, ccdb, timeStamp, 1);
139+
// setupRun(runNumber, ccdb, timeStamp, 1);
140140
if (sourceName.find("ZNC") != std::string::npos) {
141141
if (runNumber < 544448) {
142142
return getLumi("zncinp", 1, puCorr) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
143143
} else {
144144
return getLumi("C1ZNC-B-NOPF-CRU", 6, puCorr) / (sourceName.find("hadronic") != std::string::npos ? 28. : 1.);
145145
}
146146
} else if (sourceName == "T0CE") {
147-
return getLumi("CMTVXTCE-B-NOPF", 1 , puCorr);
147+
return getLumi("CMTVXTCE-B-NOPF", 1, puCorr);
148148
} else if (sourceName == "T0SC") {
149149
return getLumi("CMTVXTSC-B-NOPF", 1, puCorr);
150150
} else if (sourceName == "T0VTX") {
@@ -154,7 +154,7 @@ double CTPRateFetcher::getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber,
154154
double ret = getLumi("CMTVX-B-NOPF", 1, puCorr);
155155
if (ret == -1.) {
156156
LOG(info) << "Trying different class";
157-
ret = getLumi("CMTVX-NONE", 1,puCorr);
157+
ret = getLumi("CMTVX-NONE", 1, puCorr);
158158
if (ret < 0) {
159159
LOG(fatal) << "None of the classes used for lumi found";
160160
}

DataFormats/Detectors/CTP/src/Scalers.cxx

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -665,66 +665,66 @@ uint64_t CTPRunScalers::getLumiNoPuCorr(int classindex, int type) const
665665
const auto s1 = mScalerRecordO2[mScalerRecordO2.size() - 1].scalers[classindex];
666666
switch (type) {
667667
case 1:
668-
return (s1.lmBefore - s0.lmBefore);
668+
return (s1.lmBefore - s0.lmBefore);
669669
case 2:
670-
return (s1.lmAfter - s0.lmAfter);
670+
return (s1.lmAfter - s0.lmAfter);
671671
case 3:
672-
return (s1.l0Before - s0.l0Before);
672+
return (s1.l0Before - s0.l0Before);
673673
case 4:
674-
return (s1.l0After - s0.l0After);
674+
return (s1.l0After - s0.l0After);
675675
case 5:
676-
return (s1.l1Before - s0.l1Before);
676+
return (s1.l1Before - s0.l1Before);
677677
case 6:
678-
return (s1.l1After - s0.l1After);
678+
return (s1.l1After - s0.l1After);
679679
default:
680-
LOG(error) << "Wrong type:" << type;
681-
return -1; // wrong type
680+
LOG(error) << "Wrong type:" << type;
681+
return -1; // wrong type
682682
}
683683
} else if (type == 7) {
684684
auto s0 = mScalerRecordO2[0].scalersInps[classindex]; // type CTPScalerO2*
685685
auto s1 = mScalerRecordO2[mScalerRecordO2.size() - 1].scalersInps[classindex];
686686
return (s1 - s0);
687687
} else {
688-
LOG(error) << "Wrong type:" << type;
689-
return -1; // wrong type
688+
LOG(error) << "Wrong type:" << type;
689+
return -1; // wrong type
690690
}
691691
};
692692
//
693-
std::vector<std::pair<double_t,double_t>> CTPRunScalers::getRatesForIndex(int classindex, int type) const
693+
std::vector<std::pair<double_t, double_t>> CTPRunScalers::getRatesForIndex(int classindex, int type) const
694694
{
695-
std::vector<std::pair<double_t,double_t>> scals;
696-
for(int i = 0; i < mScalerRecordO2.size() - 1; i++) {
697-
double_t diff = 0;
698-
//double_t timeDiff = mScalerRecordO2[i + 1].epochTime - mScalerRecordO2[i].epochTime;
699-
double_t timeDiff = (mScalerRecordO2[i + 1].intRecord.orbit - mScalerRecordO2[i].intRecord.orbit) * o2::constants::lhc::LHCOrbitMUS/1.e6;
700-
if (type < 7) {
701-
const auto s0 = mScalerRecordO2[i].scalers[classindex];
702-
const auto s1 = mScalerRecordO2[i+1].scalers[classindex];
703-
if(type == 1) {
704-
diff = s1.lmBefore - s0.lmBefore;
705-
} else if(type == 2) {
706-
diff = s1.lmAfter - s0.lmAfter;
707-
} else if(type == 3){
708-
diff = s1.l0Before - s0.l0Before;
709-
} else if(type == 4) {
710-
diff = s1.l0After - s0.l0After;
711-
} else if(type == 5) {
712-
diff = s1.l1Before - s0.l1Before;
713-
} else if(type == 6) {
714-
diff = s1.l1After - s0.l1After;
695+
std::vector<std::pair<double_t, double_t>> scals;
696+
for (int i = 0; i < mScalerRecordO2.size() - 1; i++) {
697+
double_t diff = 0;
698+
// double_t timeDiff = mScalerRecordO2[i + 1].epochTime - mScalerRecordO2[i].epochTime;
699+
double_t timeDiff = (mScalerRecordO2[i + 1].intRecord.orbit - mScalerRecordO2[i].intRecord.orbit) * o2::constants::lhc::LHCOrbitMUS / 1.e6;
700+
if (type < 7) {
701+
const auto s0 = mScalerRecordO2[i].scalers[classindex];
702+
const auto s1 = mScalerRecordO2[i + 1].scalers[classindex];
703+
if (type == 1) {
704+
diff = s1.lmBefore - s0.lmBefore;
705+
} else if (type == 2) {
706+
diff = s1.lmAfter - s0.lmAfter;
707+
} else if (type == 3) {
708+
diff = s1.l0Before - s0.l0Before;
709+
} else if (type == 4) {
710+
diff = s1.l0After - s0.l0After;
711+
} else if (type == 5) {
712+
diff = s1.l1Before - s0.l1Before;
713+
} else if (type == 6) {
714+
diff = s1.l1After - s0.l1After;
715+
} else {
716+
LOG(error) << "Wrong type:" << type;
717+
return scals; // wrong type
718+
}
719+
} else if (type == 7) {
720+
auto s0 = mScalerRecordO2[i].scalersInps[classindex]; // type CTPScalerO2*
721+
auto s1 = mScalerRecordO2[i + 1].scalersInps[classindex];
722+
diff = s1 - s0;
715723
} else {
716724
LOG(error) << "Wrong type:" << type;
717725
return scals; // wrong type
718726
}
719-
} else if (type == 7) {
720-
auto s0 = mScalerRecordO2[i].scalersInps[classindex]; // type CTPScalerO2*
721-
auto s1 = mScalerRecordO2[i + 1].scalersInps[classindex];
722-
diff = s1 - s0;
723-
} else {
724-
LOG(error) << "Wrong type:" << type;
725-
return scals; // wrong type
726-
}
727-
scals.emplace_back(std::pair<double_t,double_t>{diff,timeDiff});
727+
scals.emplace_back(std::pair<double_t, double_t>{diff, timeDiff});
728728
}
729729
return scals;
730730
};

Detectors/CTP/macro/GetRates.C

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
#endif
1818
using namespace o2::ctp;
1919

20-
void GetRates(int run=559617)
20+
void GetRates(int run = 559617)
2121
{
2222
uint64_t inputmaskCum = 0, classmackCum = 0;
2323
int ntrigSel = 0;
24-
24+
2525
auto& cmb = o2::ccdb::BasicCCDBManager::instance();
2626
auto ctpcfg = cmb.getSpecificForRun<o2::ctp::CTPConfiguration>("CTP/Config/Config", run);
2727
if (!ctpcfg) {
@@ -38,7 +38,7 @@ void GetRates(int run=559617)
3838
uint64_t inputmask = 0;
3939
if (trgclass.descriptor != nullptr) {
4040
inputmask = trgclass.descriptor->getInputsMask();
41-
//LOGP(info, "inputmask: {:#x}", inputmask);
41+
// LOGP(info, "inputmask: {:#x}", inputmask);
4242
}
4343
trgclass.printStream(std::cout);
4444
// std::cout << indexInList << ": " << trgclass.name << ", input mask 0x" << std::hex << inputmask << ", class mask 0x" << trgclass.classMask << std::dec << std::endl;

Detectors/CTP/macro/TestGetRates.C

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ using namespace o2::ctp;
1919
void TestGetRates(int runN = 0)
2020
{
2121
std::vector<int> runs;
22-
std::vector<std::string> codes = {"T0VTX", "T0VTX","ZNChadronic","ZNChadronic","T0VTX"};
23-
if(runN == 0) {
24-
runs = {529066,539218,544013,544518,557251};
22+
std::vector<std::string> codes = {"T0VTX", "T0VTX", "ZNChadronic", "ZNChadronic", "T0VTX"};
23+
if (runN == 0) {
24+
runs = {529066, 539218, 544013, 544518, 557251};
2525
} else {
2626
runs.push_back(runN);
2727
}
2828
auto& ccdb = o2::ccdb::BasicCCDBManager::instance();
2929
int i = 0;
30-
for(auto const& runNumber: runs) {
30+
for (auto const& runNumber : runs) {
3131
// Opening run
3232
std::pair<int64_t, int64_t> pp = ccdb.getRunDuration(runNumber);
3333
long ts = pp.first + 60;
34-
//std::cout << "Run duration:" << pp.first << " " << pp.second << std::endl;
35-
std::cout << "===> RUN:" << runNumber << " duration:" << (pp.second - pp.first)/1000. << std::endl;
34+
// std::cout << "Run duration:" << pp.first << " " << pp.second << std::endl;
35+
std::cout << "===> RUN:" << runNumber << " duration:" << (pp.second - pp.first) / 1000. << std::endl;
3636

3737
CTPRateFetcher fetcher;
3838
fetcher.setupRun(runNumber, &ccdb, ts, 1);

0 commit comments

Comments
 (0)