Commit 92eadd9a authored by Pierre-Alain Loizeau's avatar Pierre-Alain Loizeau
Browse files

In AlgoBuildRawEvent, add STS support in detector/station nb cut

parent de62c0f0
......@@ -102,6 +102,7 @@ case $_TriggSet in
_TofMin=1
_T0Min=0
_StsMin=0
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -115,6 +116,7 @@ case $_TriggSet in
_TofMinDet=1
_T0Min=1
_StsMin=0
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -128,6 +130,7 @@ case $_TriggSet in
_TofMinDet=4
_T0Min=0
_StsMin=0
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -141,6 +144,7 @@ case $_TriggSet in
_TofMinDet=4
_T0Min=1
_StsMin=0
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -154,6 +158,7 @@ case $_TriggSet in
_TofMinDet=4
_T0Min=1
_StsMin=2
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -167,6 +172,7 @@ case $_TriggSet in
_TofMinDet=8 # PAL 07/04/2022: Not sure here if it should be 4 or 8 (2 tracks in same det. stack excluded?)
_T0Min=1
_StsMin=8
_StsMinDet=0
_MuchMin=0
_Trd1dMin=0
_Trd2dMin=0
......@@ -180,6 +186,7 @@ case $_TriggSet in
_TofMinDet=4
_T0Min=1
_StsMin=4
_StsMinDet=0
_MuchMin=2
_Trd1dMin=2
_Trd2dMin=0
......@@ -360,6 +367,7 @@ while (( _iBranch < _nbbranch )); do
EVTBUILDER+=" --SetTrigMinNb kTof,$_TofMin"
EVTBUILDER+=" --SetTrigMinNb kRich,0"
EVTBUILDER+=" --SetTrigMinDetNb kTof,$_TofMinDet"
EVTBUILDER+=" --SetTrigMinDetNb kSts,$_StsMinDet"
EVTBUILDER+=" --TsNameIn unpts$_iBranch"
EVTBUILDER+=" --EvtNameOut events"
EVTBUILDER+=" --channel-config name=unpts$_iBranch,type=pull,method=connect,transport=zeromq,rcvBufSize=2,address=tcp://127.0.0.1:$_iPort,rateLogging=$_ratelog"
......
......@@ -617,9 +617,49 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
if (0 < det.fuTriggerMinDetectors) {
switch (det.detId) {
case ECbmModuleId::kSts: {
LOG(fatal) << "CbmAlgoBuildRawEvents::CheckDataAvailable => Fired detectors check not implemented yet for "
<< det.sName;
return kFALSE;
/// check for requested number of different stations
/// loop over sts digis and check for
std::set<uint32_t> setStations; // Use set instead of vector as search by value later
std::map<uint32_t, int> mModules;
for (int idigi = 0; idigi < iNbDigis; ++idigi) {
uint idx = event->GetIndex(det.dataType, idigi);
const CbmStsDigi* pDigi = GetDigi<CbmStsDigi>(idx);
if (nullptr == pDigi) continue;
int iAddr = pDigi->GetAddress();
/// Module full address
int iModuleAddr = CbmStsAddress::GetMotherAddress(iAddr, EStsElementLevel::kStsModule);
/// Station index: station = unit in the mCBM addresses ?!?
int iStationAddr = CbmStsAddress::GetElementId(iAddr, EStsElementLevel::kStsUnit);
//int iStationAddr = CbmStsAddress::GetElementId(iAddr, EStsElementLevel::kStsUnit) / 2;
std::map<uint32_t, int>::iterator itModule = mModules.find(iModuleAddr);
if (itModule == mModules.end()) {
// LOG(info) << Form("Found new module 0x%08x, side %u", iModuleAddr,
// static_cast<uint32_t>(pDigi->GetChannel() / 1024));
mModules[iModuleAddr] = static_cast<int32_t>(pDigi->GetChannel() / 1024); // extend map
}
else {
// LOG(info) << Form("Check side %u of module 0x%08x: %d ?",
// static_cast<int32_t>(pDigi->GetChannel() / 1024),
// iModuleAddr, itModule->second);
if (static_cast<int32_t>(pDigi->GetChannel() / 1024) == (1 - itModule->second)) {
/// Found other side => non-zero cluster chance, insert into stations set
auto itStation = setStations.find(iStationAddr);
if (itStation == setStations.end()) {
// LOG(info) << Form("Add station 0x%08x ", iStationAddr);
setStations.insert(iStationAddr);
}
}
}
}
// LOG(info) << "Found " << setStations.size() << " Sts detectors, " << " in " << iNbDigis << " Sts digis";
if (setStations.size() < det.fuTriggerMinDetectors) {
LOG(debug2) << "Event does not have enough detectors fired: " << setStations.size() << " vs "
<< det.fuTriggerMinDetectors << " for " << det.sName;
return kFALSE;
}
break;
}
case ECbmModuleId::kMuch: {
......@@ -640,7 +680,7 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
/// loop over tof digis and count different RPCs
std::set<uint32_t> setDets; // Use set instead of vector as search by value later
std::map<uint32_t, int> mStrips;
std::map<uint32_t, int>::iterator it;
//std::map<uint32_t, int>::iterator it;
for (int idigi = 0; idigi < iNbDigis; ++idigi) {
uint idx = event->GetIndex(det.dataType, idigi);
......@@ -659,7 +699,7 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
else {
//LOG(info) << Form("Check side %u of strip 0x%08x: %d ?", pDigi->GetSide(), iStripAddr, itStrip->second);
if ((int) pDigi->GetSide() == (1 - itStrip->second)) {
/// Found other end => full strip, insert into counter vector
/// Found other end => full strip, insert into counter set
auto itDet = setDets.find(iDetAddr);
if (itDet == setDets.end()) {
//LOG(info) << Form("Add counter 0x%08x ", iDetAddr);
......@@ -668,7 +708,7 @@ Bool_t CbmAlgoBuildRawEvents::CheckTriggerConditions(CbmEvent* event, RawEventBu
}
}
}
//LOG(info) << "Found " << vdets.size() << " Tof detectors, " << " in " << iNbDigis << " Tof digis";
//LOG(info) << "Found " << setDets.size() << " Tof detectors, " << " in " << iNbDigis << " Tof digis";
if (setDets.size() < det.fuTriggerMinDetectors) {
LOG(debug2) << "Event does not have enough detectors fired: " << setDets.size() << " vs "
<< det.fuTriggerMinDetectors << " for " << det.sName;
......
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