7 #include <FairLogger.h>
8 #include <FairRootManager.h>
10 #include <TClonesArray.h>
21 constexpr
auto cRED =
"\033[1;31m";
24 constexpr
auto cGREEN =
"\033[1;32m";
30 : fInputBranchName(
"AtRawEvent"), fOutputBranchName(
"AtEventH"), fSimulatedPointBranchName(
"AtTpcPoint"),
31 fEventArray(TClonesArray(
"AtEvent", 1)), fPSA(std::move(psa))
37 fIsPersistence = value;
42 fInputBranchName = branchName;
47 fOutputBranchName = branchName;
51 fSimulatedPointBranchName = branchName;
55 FairRootManager *ioMan = FairRootManager::Instance();
56 if (ioMan ==
nullptr) {
57 LOG(ERROR) <<
"Cannot find RootManager!";
61 fRawEventArray =
dynamic_cast<TClonesArray *
>(ioMan->GetObject(fInputBranchName));
62 if (fRawEventArray ==
nullptr) {
63 LOG(ERROR) <<
"Cannot find AtRawEvent array in branch " << fInputBranchName <<
"!";
70 fMCPointArray =
dynamic_cast<TClonesArray *
>(ioMan->GetObject(fSimulatedPointBranchName));
71 if (fMCPointArray !=
nullptr) {
72 LOG(INFO) <<
" Simulated points found (simulation analysis) in branch " << fSimulatedPointBranchName;
73 fPSA->SetSimulatedEvent(fMCPointArray);
75 LOG(INFO) <<
" Simulated points not found (experimental data analysis) looking at branch "
76 << fSimulatedPointBranchName;
79 ioMan->Register(fOutputBranchName,
"AtTPC", &fEventArray, fIsPersistence);
86 if (fRawEventArray->GetEntriesFast() == 0) {
87 LOG(debug) <<
"Skipping PSA because raw event array is empty";
91 auto *rawEvent =
dynamic_cast<AtRawEvent *
>(fRawEventArray->At(0));
92 auto *
event =
dynamic_cast<AtEvent *
>(fEventArray.ConstructedAt(0,
"C"));
95 if (!rawEvent->IsGood()) {
96 LOG(debug) <<
"Event " << rawEvent->
GetEventID() <<
" is not good, skipping PSA";
100 LOG(debug) <<
"Staring PSA on event Number: " << rawEvent->GetEventID() <<
" with " << rawEvent->GetNumPads()
103 fPSA->Analyze(rawEvent, event);
105 LOG(debug) <<
"Finished running PSA";