13#include <TDataObject.h>
20 RegisterInputCollection(
"InputCollection",
"name of the origin branch",
22 RegisterOutputCollection(
"OutputCollection",
"output collection name",
40 if (std::holds_alternative<TString>(result)) {
41 SetStateError(std::get<TString>(result));
45 fInData = std::get<TClonesArray **>(result);
48 const auto *cl = (*fInData)->GetClass();
50 SetStateError(Form(
"Failed to get TClass at branch: %s",
67 for (
int iData = 0; iData < (*fInData)->GetEntriesFast(); iData++) {
68 const auto *inData =
static_cast<TDataObject *
>((*fInData)->At(iData));
71 inData->Copy(*outData);
ClassImp(art::crib::TBranchCopyProcessor)
ROOT macro for class implementation.
Utility functions for handling input and parameter objects in TEventCollection.
Processor for copying data from one TClonesArray to another.
TBranchCopyProcessor()
Constructor.
~TBranchCopyProcessor() override
Destructor.
TString fInputColName
Name of the input collection.
TClonesArray ** fInData
! Pointer to the input data
TClonesArray * fOutData
! Pointer to the output data.
TString fOutputColName
Name of the output collection.
void Process() override
Processes the data by copying from input to output collection.
void Init(TEventCollection *col) override
Initializes the processor with the given event collection.
std::enable_if_t< std::is_base_of_v< TObject, T >, std::variant< T **, TString > > GetInputObject(TEventCollection *col, const TString &name, const TString &expectedTypeName, const TString &elementTypeName="TObject")
Retrieve an object from TEventCollection with type validation.