Skip to content

Commit 92a6291

Browse files
authored
Merge 10aa18a into sapling-pr-archive-ktf
2 parents 5601a60 + 10aa18a commit 92a6291

File tree

286 files changed

+5760
-5155
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+5760
-5155
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ class CTPConfiguration
162162
int getInputIndex(const std::string& name) const;
163163
std::string getClassNameFromIndex(int index) { return mCTPClasses[index].name; };
164164
std::string getClassNameFromHWIndex(int index);
165+
const CTPClass* getCTPClassFromHWIndex(const int index) const;
165166
bool isMaskInInputs(const uint64_t& mask) const;
166167
bool isBCMaskInConfig(const std::string maskname) const;
167168
const BCMask* isBCMaskInConfigP(const std::string bcmask) const;

DataFormats/Detectors/CTP/src/Configuration.cxx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,6 +790,17 @@ std::string CTPConfiguration::getClassNameFromHWIndex(int index)
790790
std::string ret = "not found";
791791
return ret;
792792
}
793+
const CTPClass* CTPConfiguration::getCTPClassFromHWIndex(int index) const
794+
{
795+
const CTPClass* clsfound = nullptr;
796+
for (auto const& cls : mCTPClasses) {
797+
if (index == cls.getIndex()) {
798+
clsfound = &cls;
799+
break;
800+
}
801+
}
802+
return clsfound;
803+
}
793804
bool CTPConfiguration::isMaskInInputs(const uint64_t& mask) const
794805
{
795806
for (auto const& inp : mInputs) {

DataFormats/Detectors/MUON/MCH/include/DataFormatsMCH/DsChannelId.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,13 @@ class DsChannelId
6161

6262
ClassDefNV(DsChannelId, 1); // class for MCH readout channel
6363
};
64+
65+
inline bool operator==(const DsChannelId& a, const DsChannelId& b) { return a.value() == b.value(); }
66+
inline bool operator!=(const DsChannelId& a, const DsChannelId& b) { return !(a == b); }
67+
inline bool operator<(const DsChannelId& a, const DsChannelId& b) { return a.value() < b.value(); }
68+
inline bool operator>(const DsChannelId& a, const DsChannelId& b) { return b < a; }
69+
inline bool operator<=(const DsChannelId& a, const DsChannelId& b) { return !(a > b); }
70+
inline bool operator>=(const DsChannelId& a, const DsChannelId& b) { return !(a < b); }
71+
6472
} // namespace o2::mch
6573
#endif

Detectors/CTP/reconstruction/include/CTPReconstruction/RawDataDecoder.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class RawDataDecoder
4545
void setMAXErrors(int m) { mErrorMax = m; }
4646
int setLumiInp(int lumiinp, std::string inp);
4747
void setCTPConfig(CTPConfiguration cfg) { mCTPConfig = std::move(cfg); };
48+
void setCheckConsistency(bool check) { mCheckConsistency = check; }
4849
uint32_t getIRRejected() const { return mIRRejected; }
4950
uint32_t getTCRRejected() const { return mTCRRejected; }
5051
std::vector<uint32_t>& getTFOrbits() { return mTFOrbits; }
@@ -54,12 +55,14 @@ class RawDataDecoder
5455
int init();
5556
static int shiftNew(const o2::InteractionRecord& irin, uint32_t TFOrbit, std::bitset<48>& inpmask, int64_t shift, int level, std::map<o2::InteractionRecord, CTPDigit>& digmap);
5657
static int shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digitsMap, o2::pmr::vector<CTPDigit>& digits, uint32_t TFOrbit, uint64_t trgclassmask = 0xffffffffffffffff);
58+
int checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask = 0xffffffffffffffff);
5759

5860
private:
5961
static constexpr uint32_t TF_TRIGGERTYPE_MASK = 0x800;
6062
static constexpr uint32_t HB_TRIGGERTYPE_MASK = 0x2;
6163
// true: full inps decoding includine latency shifts here; false: latency shifts in CTF decoder
6264
bool mDecodeInps = false;
65+
bool mCheckConsistency = false;
6366
// for digits
6467
bool mDoDigits = true;
6568
std::vector<CTPDigit> mOutputDigits;

Detectors/CTP/reconstruction/src/RawDataDecoder.cxx

Lines changed: 54 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,13 @@ int RawDataDecoder::addCTPDigit(uint32_t linkCRU, uint32_t orbit, gbtword80_t& d
7979
if (mErrorIR < mErrorMax) {
8080
LOG(error) << "Two CTP IRs with the same timestamp:" << ir.bc << " " << ir.orbit << " pld:" << pld << " dig:" << digits[ir];
8181
}
82-
ret = 2;
82+
ret = 4;
8383
mErrorIR++;
8484
mStickyError = true;
8585
}
8686
} else {
8787
LOG(error) << "Two digits with the same timestamp:" << ir.bc << " " << ir.orbit;
88-
ret = 2;
88+
ret = 8;
8989
}
9090
} else if (linkCRU == o2::ctp::GBTLinkIDClassRec) {
9191
int32_t BCShiftCorrection = -o2::ctp::TriggerOffsetsParam::Instance().customOffset[o2::detectors::DetID::CTP];
@@ -113,11 +113,11 @@ int RawDataDecoder::addCTPDigit(uint32_t linkCRU, uint32_t orbit, gbtword80_t& d
113113
mStickyError = true;
114114
}
115115
mErrorTCR++;
116-
ret = 3;
116+
ret = 16;
117117
}
118118
} else {
119119
LOG(error) << "Two digits with the same timestamp:" << ir.bc << " " << ir.orbit;
120-
ret = 3;
120+
ret = 32;
121121
}
122122
} else {
123123
LOG(error) << "Unxpected CTP CRU link:" << linkCRU;
@@ -298,7 +298,10 @@ int RawDataDecoder::decodeRaw(o2::framework::InputRecord& inputs, std::vector<o2
298298
trgclassmask = mCTPConfig.getTriggerClassMask();
299299
}
300300
// std::cout << "trgclassmask:" << std::hex << trgclassmask << std::dec << std::endl;
301-
shiftInputs(digitsMap, digits, mTFOrbit, trgclassmask);
301+
ret = shiftInputs(digitsMap, digits, mTFOrbit, trgclassmask);
302+
if (mCheckConsistency) {
303+
ret = checkReadoutConsistentncy(digits, trgclassmask);
304+
}
302305
}
303306
if (mDoDigits && !mDecodeInps) {
304307
for (auto const& dig : digitsMap) {
@@ -615,13 +618,58 @@ int RawDataDecoder::shiftInputs(std::map<o2::InteractionRecord, CTPDigit>& digit
615618
}
616619
digits.push_back(dig.second);
617620
}
621+
int ret = 0;
618622
if (nTwoI) { // Trigger class wo Input
619623
LOG(error) << "LM:" << nLM << " L0:" << nL0 << " L1:" << nL1 << " TwI:" << nTwI << " Trigger classes wo input:" << nTwoI;
624+
ret = 64;
620625
}
621626
if (nTwoIlost) {
622627
LOG(warn) << " Trigger classes wo input from diff latency 1:" << nTwoIlost;
623628
}
624-
return 0;
629+
return ret;
630+
}
631+
//
632+
int RawDataDecoder::checkReadoutConsistentncy(o2::pmr::vector<CTPDigit>& digits, uint64_t trgclassmask)
633+
{
634+
int ret = 0;
635+
int lost = 0;
636+
for (auto const& digit : digits) {
637+
// if class mask => inps
638+
for (int i = 0; i < digit.CTPClassMask.size(); i++) {
639+
if (digit.CTPClassMask[i]) {
640+
const CTPClass* cls = mCTPConfig.getCTPClassFromHWIndex(i);
641+
uint64_t clsinpmask = cls->descriptor->getInputsMask();
642+
uint64_t diginpmask = digit.CTPInputMask.to_ullong();
643+
if (!((clsinpmask & diginpmask) == clsinpmask)) {
644+
LOG(error) << "CTP class:" << cls->name << " inpmask:" << clsinpmask << " not compatible with inputs mask:" << diginpmask;
645+
ret = 128;
646+
}
647+
}
648+
}
649+
// if inps => class mask
650+
for (auto const& cls : mCTPConfig.getCTPClasses()) {
651+
uint64_t clsinpmask = cls.descriptor->getInputsMask();
652+
uint64_t diginpmask = digit.CTPInputMask.to_ullong();
653+
uint64_t digclsmask = digit.CTPClassMask.to_ullong();
654+
if ((clsinpmask & diginpmask) == clsinpmask) {
655+
if ((cls.classMask & digclsmask) == 0) {
656+
int32_t BCShiftCorrection = -o2::ctp::TriggerOffsetsParam::Instance().customOffset[o2::detectors::DetID::CTP];
657+
int32_t offset = BCShiftCorrection + o2::ctp::TriggerOffsetsParam::Instance().LM_L0 + o2::ctp::TriggerOffsetsParam::Instance().L0_L1_classes - 1;
658+
offset = o2::constants::lhc::LHCMaxBunches - offset;
659+
if (digit.intRecord.bc < offset) {
660+
LOG(error) << "CTP class:" << cls.name << " inpmask:" << clsinpmask << " cls mask:" << cls.classMask << " not found in digit:" << digit;
661+
ret = 256;
662+
} else {
663+
lost++;
664+
}
665+
}
666+
}
667+
}
668+
}
669+
if (lost) {
670+
LOG(info) << "LOST classes because of shift:" << lost;
671+
}
672+
return ret;
625673
}
626674
//
627675
int RawDataDecoder::setLumiInp(int lumiinp, std::string inp)

Detectors/CTP/workflow/src/RawDecoderSpec.cxx

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,9 +201,9 @@ o2::framework::DataProcessorSpec o2::ctp::reco_workflow::getRawDecoderSpec(bool
201201
}
202202

203203
std::vector<o2::framework::OutputSpec> outputs;
204+
inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("CTP/Config/Config", 1));
205+
inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("CTP/Config/TriggerOffsets"));
204206
if (digits) {
205-
inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("CTP/Config/Config", 1));
206-
inputs.emplace_back("trigoffset", "CTP", "Trig_Offset", 0, o2::framework::Lifetime::Condition, o2::framework::ccdbParamSpec("CTP/Config/TriggerOffsets"));
207207
outputs.emplace_back("CTP", "DIGITS", 0, o2::framework::Lifetime::Timeframe);
208208
}
209209
if (lumi) {
@@ -230,12 +230,10 @@ void RawDecoderSpec::updateTimeDependentParams(framework::ProcessingContext& pc)
230230
pc.inputs().get<o2::ctp::TriggerOffsetsParam*>("trigoffset");
231231
const auto& trigOffsParam = o2::ctp::TriggerOffsetsParam::Instance();
232232
LOG(info) << "updateing TroggerOffsetsParam: inputs L0_L1:" << trigOffsParam.L0_L1 << " classes L0_L1:" << trigOffsParam.L0_L1_classes;
233-
if (mDecodeinputs) {
234-
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
235-
if (ctpcfg != nullptr) {
236-
mDecoder.setCTPConfig(*ctpcfg);
237-
LOG(info) << "ctpconfig for run done:" << mDecoder.getCTPConfig().getRunNumber();
238-
}
233+
const auto ctpcfg = pc.inputs().get<o2::ctp::CTPConfiguration*>("ctpconfig");
234+
if (ctpcfg != nullptr) {
235+
mDecoder.setCTPConfig(*ctpcfg);
236+
LOG(info) << "ctpconfig for run done:" << mDecoder.getCTPConfig().getRunNumber();
239237
}
240238
}
241239
}

Detectors/CTP/workflowScalers/src/ctp-ccdb-orbit.cxx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ int main(int argc, char** argv)
7676
std::cerr << e.what() << ", application will now exit" << std::endl;
7777
exit(2);
7878
}
79+
int ret = 0;
7980
std::string action = vm["action"].as<std::string>();
8081
std::vector<int64_t> vect;
8182
std::string ccdbPath;
@@ -120,10 +121,10 @@ int main(int argc, char** argv)
120121
int64_t runnum = vm["run-number"].as<int64_t>();
121122
metadata["runNumber"] = std::to_string(runnum);
122123
std::cout << "Storing:" << ccdbPath << " " << metadata["runNumber"] << " tmin:" << tmin << " tmax:" << tmax << " ts:" << tt << std::endl;
123-
api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax);
124+
ret = api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax);
124125
} else {
125126
std::cout << "Storing:" << ccdbPath << " tmin:" << tmin << " tmax:" << tmax << " ts:" << tt << std::endl;
126-
api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax);
127+
ret = api.storeAsTFileAny(&(vect), ccdbPath, metadata, tmin, tmax);
127128
}
128129
}
129130
//
@@ -132,7 +133,7 @@ int main(int argc, char** argv)
132133
TFile* f = TFile::Open(file.c_str(), "RECREATE");
133134
if (f == nullptr) {
134135
std::cout << "Error: File" << file << " could not be open for writing !!!" << std::endl;
135-
return 1;
136+
ret++;
136137
} else {
137138
std::cout << "File" << file << " being writen." << std::endl;
138139
f->WriteObject(&vect, "ccdb_object");
@@ -141,5 +142,5 @@ int main(int argc, char** argv)
141142
} else {
142143
std::cout << "No file created" << std::endl;
143144
}
144-
return 0;
145+
return ret;
145146
}

Detectors/ITSMFT/MFT/calibration/src/NoiseCalibratorSpec.cxx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ void NoiseCalibratorSpec::run(ProcessingContext& pc)
8383
} else {
8484
LOG(info) << "Sending an object to Production-CCDB and DCS-CCDB";
8585
sendOutputCcdbDcs(pc.outputs());
86+
LOG(info) << "Sending an object to Production-CCDBMerge";
87+
sendOutputCcdbMerge(pc.outputs());
8688
}
8789
pc.services().get<ControlService>().readyToQuit(mStopMeOnly ? QuitRequest::Me : QuitRequest::All);
8890
}
@@ -105,6 +107,8 @@ void NoiseCalibratorSpec::run(ProcessingContext& pc)
105107
} else {
106108
LOG(info) << "Sending an object to Production-CCDB and DCS-CCDB";
107109
sendOutputCcdbDcs(pc.outputs());
110+
LOG(info) << "Sending an object to Production-CCDBMerge";
111+
sendOutputCcdbMerge(pc.outputs());
108112
}
109113
pc.services().get<ControlService>().readyToQuit(mStopMeOnly ? QuitRequest::Me : QuitRequest::All);
110114
}

Detectors/MUON/MCH/Conditions/src/bad-channels-ccdb.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
// or submit itself to any jurisdiction.
1111

1212
#include <boost/program_options.hpp>
13+
#include <algorithm>
1314
#include <ctime>
1415
#include <fstream>
1516
#include <iterator>
@@ -209,9 +210,12 @@ void uploadBadChannels(const std::string ccdbUrl,
209210
const std::string badChannelType,
210211
uint64_t startTimestamp,
211212
uint64_t endTimestamp,
212-
const BadChannelsVector& bv,
213+
BadChannelsVector& bv,
213214
bool makeDefault)
214215
{
216+
std::sort(bv.begin(), bv.end());
217+
bv.erase(std::unique(bv.begin(), bv.end()), bv.end());
218+
215219
std::cout << std::endl;
216220
o2::ccdb::CcdbApi api;
217221
api.init(ccdbUrl);

Detectors/MUON/MCH/DigitFiltering/CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ o2_add_library(MCHDigitFiltering
1313
SOURCES
1414
src/DigitFilter.cxx
1515
src/DigitFilterParam.cxx
16+
src/DigitModifier.cxx
17+
src/DigitModifierParam.cxx
1618
src/DigitFilteringSpec.cxx
1719
PUBLIC_LINK_LIBRARIES
1820
O2::Framework
@@ -27,4 +29,4 @@ o2_add_executable(
2729
COMPONENT_NAME mch
2830
PUBLIC_LINK_LIBRARIES O2::MCHDigitFiltering)
2931

30-
o2_target_root_dictionary(MCHDigitFiltering HEADERS include/MCHDigitFiltering/DigitFilterParam.h)
32+
o2_target_root_dictionary(MCHDigitFiltering HEADERS include/MCHDigitFiltering/DigitFilterParam.h include/MCHDigitFiltering/DigitModifierParam.h)

0 commit comments

Comments
 (0)