Commit b251de21 authored by Dominik Smith's avatar Dominik Smith
Browse files

Simplified CbmAlgoBuildRawEvents::CheckDataAvailable().

parent f872dd8b
......@@ -445,7 +445,7 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
if (0 == det.fuTriggerMinDigis && det.fiTriggerMaxDigis < 0) { return kTRUE; }
/// Check if detector present
if (!DetIsPresent(det.detId)) {
if (!CheckDataAvailable(det.detId)) {
LOG(warning) << "Event does not have digis storage for " << det.sName
<< " while the following trigger min/max are defined: " << det.fuTriggerMinDigis << " "
<< det.fiTriggerMaxDigis;
......@@ -474,112 +474,74 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
Bool_t CbmAlgoBuildRawEvents::CheckDataAvailable(RawEventBuilderDetector& det)
{
if (ECbmModuleId::kT0 == det.detId) {
if (!fT0DigiVec) {
LOG(info) << "No T0 digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kSts == det.detId) {
if (!fStsDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kMuch == det.detId) {
if (!fMuchDigis && !fMuchBeamTimeDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kTrd == det.detId) {
if (!fTrdDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kTof == det.detId) {
if (!fTofDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kRich == det.detId) {
if (!fRichDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
}
else if (ECbmModuleId::kPsd == det.detId) {
if (!fPsdDigis) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
if (!CheckDataAvailable(det.detId)) {
LOG(info) << "No " << det.sName << " digi input found.";
return kFALSE;
}
return kTRUE;
}
UInt_t CbmAlgoBuildRawEvents::GetNofDigis(ECbmModuleId detId)
bool CbmAlgoBuildRawEvents::CheckDataAvailable(ECbmModuleId detId)
{
switch (detId) {
case ECbmModuleId::kSts: {
return fStsDigis->size();
return fStsDigis != nullptr;
}
case ECbmModuleId::kMuch: {
if (fbUseMuchBeamtimeDigi) { return fMuchBeamTimeDigis->size(); }
if (fbUseMuchBeamtimeDigi) { return fMuchBeamTimeDigis != nullptr; }
else {
return fMuchDigis->size();
return fMuchDigis != nullptr;
}
}
case ECbmModuleId::kTrd: {
return fTrdDigis->size();
return fTrdDigis != nullptr;
}
case ECbmModuleId::kTof: {
return fTofDigis->size();
return fTofDigis != nullptr;
}
case ECbmModuleId::kRich: {
return fRichDigis->size();
return fRichDigis != nullptr;
}
case ECbmModuleId::kPsd: {
return fPsdDigis->size();
return fPsdDigis != nullptr;
}
case ECbmModuleId::kT0: {
return fT0DigiVec->size(); //what to do here? Not in digi manager.
return fT0DigiVec != nullptr;
}
default: {
LOG(fatal) << "CbmAlgoBuildRawEvents::GetNofDigis => "
<< "Trying to get digi number with unsupported detector.";
LOG(fatal) << "CbmAlgoBuildRawEvents::CheckDataAvailable => "
<< "Unsupported detector.";
return -1;
}
}
}
bool CbmAlgoBuildRawEvents::DetIsPresent(ECbmModuleId detId)
UInt_t CbmAlgoBuildRawEvents::GetNofDigis(ECbmModuleId detId)
{
switch (detId) {
case ECbmModuleId::kSts: {
return fStsDigis != nullptr;
return fStsDigis->size();
}
case ECbmModuleId::kMuch: {
if (fbUseMuchBeamtimeDigi) { return fMuchBeamTimeDigis != nullptr; }
if (fbUseMuchBeamtimeDigi) { return fMuchBeamTimeDigis->size(); }
else {
return fMuchDigis != nullptr;
return fMuchDigis->size();
}
}
case ECbmModuleId::kTrd: {
return fTrdDigis != nullptr;
return fTrdDigis->size();
}
case ECbmModuleId::kTof: {
return fTofDigis != nullptr;
return fTofDigis->size();
}
case ECbmModuleId::kRich: {
return fRichDigis != nullptr;
return fRichDigis->size();
}
case ECbmModuleId::kPsd: {
return fPsdDigis != nullptr;
return fPsdDigis->size();
}
case ECbmModuleId::kT0: {
return fT0DigiVec != nullptr; //what to do here? Not in digi manager.
return fT0DigiVec->size(); //what to do here? Not in digi manager.
}
default: {
LOG(fatal) << "CbmAlgoBuildRawEvents::GetNofDigis => "
......
......@@ -259,7 +259,7 @@ private:
const std::vector<CbmRichDigi>* fRichDigis = nullptr;
const std::vector<CbmPsdDigi>* fPsdDigis = nullptr;
bool DetIsPresent(ECbmModuleId detId);
bool CheckDataAvailable(ECbmModuleId detId);
UInt_t GetNofDigis(ECbmModuleId detId);
template<class Digi>
const Digi* GetDigi(UInt_t uDigi);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment