//----------------------------------------------------------- // File and Version Information: // $Id$ // // Description: // Ultra-trivial copying of EventIdentiefiers from the // TPC DAQ stream // // // Environment: // Software developed for a real detector // // Author List: // Felix Boehmer (original author) // Physik Department E18, TUM // //---------------------------------------------------------- #include "TpcEventIdCopyTask.h" #include "TClonesArray.h" #include "TpcEventIdentifier.h" #include TpcEventIdCopyTask::TpcEventIdCopyTask() : fEvtIdInBranch("TpcEventIdentifier"), fEvtIdOutBranch("TpcEventIdentifier"), fPersistence(kTRUE) //doesn't make much sense otherwise .. {;} TpcEventIdCopyTask::~TpcEventIdCopyTask() {;} InitStatus TpcEventIdCopyTask::Init() { //connect to the framework: FairRootManager* ioman = FairRootManager::Instance(); if(ioman==0) { Fatal("TpcEventIdCopyTask::Init()","RootManager not instantiated!"); return kFATAL; } //get input stuff fEvtIn = (TClonesArray*) ioman->GetObject(fEvtIdInBranch); //register output arrays fEvtOut = new TClonesArray("TpcEventIdentifier"); ioman->Register(fEvtIdOutBranch, "Tpc", fEvtOut, fPersistence); } void TpcEventIdCopyTask::Exec(Option_t* opt) { fEvtOut->Delete(); unsigned int nIds = fEvtIn->GetEntriesFast(); if(nIds!=1) { std::string str("Less or more than one EvtID in Input tree ("); std::stringstream ss; ss<GetEntriesFast(); TpcEventIdentifier* err = new ((*fEvtOut)[nEntr]) TpcEventIdentifier(0,0); return; } TpcEventIdentifier* current = (TpcEventIdentifier*)fEvtIn->At(0); new ((*fEvtOut)[fEvtOut->GetEntriesFast()]) TpcEventIdentifier(*current); } ClassImp(TpcEventIdCopyTask)