9 #include <FairLogger.h>
10 #include <FairRootManager.h>
13 #include <TClonesArray.h>
19 #include <unordered_map>
28 : FairTask(name), fOutputEventArray(new TClonesArray(
"AtRawEvent")), fFilter(filter)
34 FairRootManager *ioManager = FairRootManager::Instance();
36 if (ioManager ==
nullptr) {
37 LOG(ERROR) <<
"Cannot find RootManager!" << std::endl;
42 fInputEventArray =
dynamic_cast<TClonesArray *
>(ioManager->GetObject(fInputBranchName));
43 if (fInputEventArray ==
nullptr) {
44 LOG(fatal) <<
"AtFilterTask: Cannot find AtRawEvent array!";
49 ioManager->Register(fOutputBranchName,
"AtTPC", fOutputEventArray, fIsPersistent);
58 fOutputEventArray->Delete();
60 if (fInputEventArray->GetEntriesFast() == 0)
63 auto rawEvent =
dynamic_cast<AtRawEvent *
>(fInputEventArray->At(0));
67 if (!rawEvent->IsGood())
71 for (
auto &padIt : filteredEvent->fAuxPadMap) {
72 AtPad *pad = &(padIt.second);
77 for (
auto &[ref, pad] : filteredEvent->fFpnMap) {
78 LOG(debug) <<
"Filtering " << ref;
80 fFilter->
Filter(&pad, &padRef);
84 for (
auto &pad : filteredEvent->fPadList)
85 fFilter->
Filter(pad.get());
87 auto isGood = filteredEvent->IsGood() && fFilter->
IsGoodEvent();
88 filteredEvent->SetIsGood(isGood);