PandaRoot
BSEmcSorterTask.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 /*
14  * BSEmcSorterTask.h
15  */
16 
17 #ifndef BSEMCSORTERTASK_HH
18 #define BSEMCSORTERTASK_HH
19 
20 #include <FairRingSorter.h>
21 #include <FairRingSorterTask.h>
22 #include <FairRootManager.h>
23 
24 #include "TClonesArray.h"
25 
26 #include "BSEmcRingSorter.h"
27 
36 template <class T>
37 class BSEmcSorterTask : public FairRingSorterTask {
38  public:
40  BSEmcSorterTask(Int_t t_numberOfCells, Double_t t_widthOfCells, const std::string &t_inputbranch, const std::string &t_outputbranch)
41  : FairRingSorterTask(t_numberOfCells, t_widthOfCells, TString{t_inputbranch}, TString{t_outputbranch}, "Emc")
42  {
43  fVerbose = 3;
44  };
45 
46  virtual ~BSEmcSorterTask(){};
47 
48  virtual void AddNewDataToTClonesArray(FairTimeStamp *t_data) /*override*/
49  {
50  FairRootManager *ioman = FairRootManager::Instance();
51  TClonesArray *myArray = ioman->GetTClonesArray(fOutputBranch);
52  if (fVerbose > 1) {
53  std::cout << "-I- BSEmcSorterTask::AddNewDataToTClonesArray Data: ";
54  std::cout << *(T *)(t_data) << std::endl;
55  }
56  new ((*myArray)[myArray->GetEntries()]) T(*(dynamic_cast<T *>(t_data)));
57  };
58  virtual FairRingSorter *InitSorter(Int_t t_numberOfCells, Double_t t_widthOfCells) const /*override*/ { return new BSEmcRingSorter<T>(t_numberOfCells, t_widthOfCells); };
59  void SetSourceBranch(const TString &t_branchname) { this->fInputBranch = t_branchname; }
60  void SetTargetBranch(const TString &t_branchname) { this->fOutputBranch = t_branchname; }
61 
63 };
64 
65 #endif /*BSEMCSORTERTASK_HH*/
virtual void AddNewDataToTClonesArray(FairTimeStamp *t_data)
templated version of a sorter task
templated version of a ring sorter
virtual FairRingSorter * InitSorter(Int_t t_numberOfCells, Double_t t_widthOfCells) const
BSEmcSorterTask(Int_t t_numberOfCells, Double_t t_widthOfCells, const std::string &t_inputbranch, const std::string &t_outputbranch)
void SetSourceBranch(const TString &t_branchname)
virtual ~BSEmcSorterTask()
ClassDef(BSEmcSorterTask, 1)
void SetTargetBranch(const TString &t_branchname)