FairRoot/PandaRoot
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
PndSorterTask Class Referenceabstract

#include <PndSorterTask.h>

Inheritance diagram for PndSorterTask:

Public Member Functions

 PndSorterTask ()
 
 PndSorterTask (const char *name)
 
 PndSorterTask (Int_t numberOfCells, Double_t widthOfCells, TString inputBranch, TString outputBranch, TString folderName)
 
virtual ~PndSorterTask ()
 
virtual InitStatus Init ()
 
virtual InitStatus ReInit ()
 
virtual void Exec (Option_t *opt)
 
virtual void FinishEvent ()
 
virtual void FinishTask ()
 
virtual void SetParContainers ()
 
void SetPersistance (Bool_t p=kTRUE)
 
Bool_t GetPersistance ()
 
virtual void AddNewDataToTClonesArray (FairTimeStamp *data)=0
 
virtual PndRingSorterInitSorter (Int_t numberOfCells, Double_t widthOfCells)=0
 

Protected Member Functions

 ClassDef (PndSorterTask, 2)
 

Protected Attributes

PndRingSorterfSorter
 
Bool_t fPersistance
 
Bool_t fDigiPixelMCInfo
 
Int_t fNumberOfCells
 
Double_t fWidthOfCells
 
TString fInputBranch
 
TClonesArray * fInputArray
 
TString fOutputBranch
 
TString fFolder
 
TClonesArray * fOutputArray
 
Int_t fEntryNr
 

Detailed Description

Definition at line 18 of file PndSorterTask.h.

Constructor & Destructor Documentation

PndSorterTask::PndSorterTask ( )
inline

Default constructor

Definition at line 23 of file PndSorterTask.h.

References SetPersistance(), and SetVerbose().

23  :FairTask("SorterTask"), fNumberOfCells(1000), fWidthOfCells(10),fEntryNr(0)
24  {
25  SetVerbose(3);
27  }
Double_t fWidthOfCells
Definition: PndSorterTask.h:75
void SetPersistance(Bool_t p=kTRUE)
Definition: PndSorterTask.h:61
Int_t fNumberOfCells
Definition: PndSorterTask.h:74
drchit SetVerbose(iVerbose)
PndSorterTask::PndSorterTask ( const char *  name)
inline

Named constructor

Definition at line 30 of file PndSorterTask.h.

References SetPersistance(), and SetVerbose().

30  :
31  FairTask(name), fNumberOfCells(1000), fWidthOfCells(10), fEntryNr(0)
32  {
33  SetVerbose(3);
35  };
TString name
Double_t fWidthOfCells
Definition: PndSorterTask.h:75
void SetPersistance(Bool_t p=kTRUE)
Definition: PndSorterTask.h:61
Int_t fNumberOfCells
Definition: PndSorterTask.h:74
drchit SetVerbose(iVerbose)
PndSorterTask::PndSorterTask ( Int_t  numberOfCells,
Double_t  widthOfCells,
TString  inputBranch,
TString  outputBranch,
TString  folderName 
)
inline

Definition at line 37 of file PndSorterTask.h.

References SetPersistance(), and SetVerbose().

37  :
38  FairTask("Sorter"), fNumberOfCells(numberOfCells), fWidthOfCells(widthOfCells), fInputBranch(inputBranch), fOutputBranch(outputBranch), fFolder(folderName)
39  {
40  SetVerbose(3);
42  }
TString fFolder
Definition: PndSorterTask.h:84
TString fOutputBranch
Definition: PndSorterTask.h:83
Double_t fWidthOfCells
Definition: PndSorterTask.h:75
TString fInputBranch
Definition: PndSorterTask.h:79
void SetPersistance(Bool_t p=kTRUE)
Definition: PndSorterTask.h:61
Int_t fNumberOfCells
Definition: PndSorterTask.h:74
drchit SetVerbose(iVerbose)
virtual PndSorterTask::~PndSorterTask ( )
inlinevirtual

Destructor

Definition at line 45 of file PndSorterTask.h.

References fSorter.

45  {
46  if (fSorter!= 0) delete fSorter;
47  }
PndRingSorter * fSorter
Definition: PndSorterTask.h:69

Member Function Documentation

virtual void PndSorterTask::AddNewDataToTClonesArray ( FairTimeStamp *  data)
pure virtual

Referenced by Exec(), and FinishTask().

PndSorterTask::ClassDef ( PndSorterTask  ,
 
)
protected
void PndSorterTask::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 42 of file PndSorterTask.cxx.

References PndRingSorter::AddElement(), AddNewDataToTClonesArray(), PndRingSorter::DeleteOutputData(), fEntryNr, fInputArray, fInputBranch, fOutputArray, fOutputBranch, fSorter, fVerbose, PndRingSorter::GetOutputData(), i, and PndRingSorter::Print().

43 {
44 
45 
46 
47  fInputArray = FairRootManager::Instance()->GetTClonesArray(fInputBranch);
48  std::cout << "-I- PndSorterTask: Size PixelArray: " << fInputArray->GetEntriesFast() << std::endl;
49  for (int i = 0; i < fInputArray->GetEntriesFast(); i++){
50  FairTimeStamp* myData = (FairTimeStamp*)fInputArray->At(i);
51  myData->SetEntryNr(FairLink(0, fEntryNr, fInputBranch, i));
52 // if (fVerbose > 2){
53  std::cout << "Sorter filled with: ";
54  myData->Print();
55  std::cout<< std::endl;
56 // }
57  fSorter->AddElement(myData, myData->GetTimeStamp());
58  }
59  if (fVerbose > 2)fSorter->Print();
60 
61  std::vector<FairTimeStamp*> sortedData = fSorter->GetOutputData();
62 
63 
64  fOutputArray = FairRootManager::Instance()->GetEmptyTClonesArray(fOutputBranch);
65  for (int i = 0; i < sortedData.size(); i++) {
66  AddNewDataToTClonesArray(sortedData[i]);
67  }
69  fEntryNr++;
70 }
virtual void AddElement(FairTimeStamp *digi, double timestamp)
int fVerbose
Definition: poormantracks.C:24
virtual std::vector< FairTimeStamp * > GetOutputData()
Definition: PndRingSorter.h:38
Int_t i
Definition: run_full.C:25
virtual void Print(std::ostream &out=std::cout)
Definition: PndRingSorter.h:45
TClonesArray * fInputArray
Definition: PndSorterTask.h:80
TString fOutputBranch
Definition: PndSorterTask.h:83
PndRingSorter * fSorter
Definition: PndSorterTask.h:69
TString fInputBranch
Definition: PndSorterTask.h:79
virtual void DeleteOutputData()
Definition: PndRingSorter.h:42
TClonesArray * fOutputArray
Definition: PndSorterTask.h:85
virtual void AddNewDataToTClonesArray(FairTimeStamp *data)=0
void PndSorterTask::FinishEvent ( )
virtual

Definition at line 74 of file PndSorterTask.cxx.

References fOutputArray.

74  {
75  fOutputArray->Delete();
76 }
TClonesArray * fOutputArray
Definition: PndSorterTask.h:85
void PndSorterTask::FinishTask ( )
virtual

Definition at line 78 of file PndSorterTask.cxx.

References PndRingSorter::AddElement(), AddNewDataToTClonesArray(), PndRingSorter::DeleteOutputData(), fInputArray, fInputBranch, fOutputArray, fOutputBranch, fSorter, fVerbose, PndRingSorter::GetOutputData(), i, PndRingSorter::Print(), and PndRingSorter::WriteOutAll().

79 {
80  fInputArray = FairRootManager::Instance()->GetTClonesArray(fInputBranch);
81  if (fVerbose > 2) std::cout << "-I- PndSorterTaskT::FinishTask Size InputArray: " << fInputArray->GetEntriesFast() << std::endl;
82  for (int i = 0; i < fInputArray->GetEntriesFast(); i++) {
83  FairTimeStamp* myDigi = (FairTimeStamp*) fInputArray->At(i);
84  fSorter->AddElement(myDigi, ((FairTimeStamp*)myDigi)->GetTimeStamp());
85  }
86  fSorter->Print();
88  std::vector<FairTimeStamp*> sortedData = fSorter->GetOutputData();
89 
90  FairRootManager* ioman = FairRootManager::Instance();
91  fOutputArray = ioman->GetEmptyTClonesArray(fOutputBranch);
92  for (int i = 0; i < sortedData.size(); i++) {
93  std::cout << i << " FinishTask : ";
94  sortedData[i]->Print();
95  std::cout << std::endl;
96  AddNewDataToTClonesArray(sortedData[i]);
97  }
99  fSorter->Print();
100  ioman->SetLastFill();
101 }
virtual void AddElement(FairTimeStamp *digi, double timestamp)
int fVerbose
Definition: poormantracks.C:24
virtual std::vector< FairTimeStamp * > GetOutputData()
Definition: PndRingSorter.h:38
Int_t i
Definition: run_full.C:25
virtual void Print(std::ostream &out=std::cout)
Definition: PndRingSorter.h:45
TClonesArray * fInputArray
Definition: PndSorterTask.h:80
virtual void WriteOutAll()
Definition: PndRingSorter.h:34
TString fOutputBranch
Definition: PndSorterTask.h:83
PndRingSorter * fSorter
Definition: PndSorterTask.h:69
TString fInputBranch
Definition: PndSorterTask.h:79
virtual void DeleteOutputData()
Definition: PndRingSorter.h:42
TClonesArray * fOutputArray
Definition: PndSorterTask.h:85
virtual void AddNewDataToTClonesArray(FairTimeStamp *data)=0
Bool_t PndSorterTask::GetPersistance ( )
inline

Definition at line 62 of file PndSorterTask.h.

References fPersistance.

62 {return fPersistance;};
Bool_t fPersistance
Definition: PndSorterTask.h:71
InitStatus PndSorterTask::Init ( )
virtual

Virtual method Init

Definition at line 17 of file PndSorterTask.cxx.

References fFolder, fInputArray, fInputBranch, fNumberOfCells, fOutputArray, fOutputBranch, fPersistance, fSorter, fVerbose, fWidthOfCells, and InitSorter().

18 {
19 
20  FairRootManager* ioman = FairRootManager::Instance();
21  if ( ! ioman )
22  {
23  std::cout << "-E- PndSorterTaskT::Init: "
24  << "RootManager not instantiated!" << std::endl;
25  return kFATAL;
26  }
27 
29 
30  // Create and register output array
31  fInputArray = FairRootManager::Instance()->GetTClonesArray(fInputBranch);
32 
33  if(fVerbose>1) Info("Init","Registering this branch: %s/%s","PndMvd",fOutputBranch.Data());
34  fOutputArray = ioman->Register(fOutputBranch, fInputArray->GetClass()->GetName(), fFolder, fPersistance);
35 
36 
37  return kSUCCESS;
38 }
int fVerbose
Definition: poormantracks.C:24
virtual PndRingSorter * InitSorter(Int_t numberOfCells, Double_t widthOfCells)=0
TString fFolder
Definition: PndSorterTask.h:84
TClonesArray * fInputArray
Definition: PndSorterTask.h:80
Bool_t fPersistance
Definition: PndSorterTask.h:71
TString fOutputBranch
Definition: PndSorterTask.h:83
Double_t fWidthOfCells
Definition: PndSorterTask.h:75
PndRingSorter * fSorter
Definition: PndSorterTask.h:69
TString fInputBranch
Definition: PndSorterTask.h:79
Int_t fNumberOfCells
Definition: PndSorterTask.h:74
TClonesArray * fOutputArray
Definition: PndSorterTask.h:85
virtual PndRingSorter* PndSorterTask::InitSorter ( Int_t  numberOfCells,
Double_t  widthOfCells 
)
pure virtual

Referenced by Init().

InitStatus PndSorterTask::ReInit ( )
virtual

Definition at line 11 of file PndSorterTask.cxx.

12 {
13  return kSUCCESS;
14 }
virtual void PndSorterTask::SetParContainers ( )
inlinevirtual

Definition at line 59 of file PndSorterTask.h.

59 {};
void PndSorterTask::SetPersistance ( Bool_t  p = kTRUE)
inline

Definition at line 61 of file PndSorterTask.h.

References fPersistance, and p.

Referenced by PndSorterTask().

61 {fPersistance=p;};
Double_t p
Definition: anasim.C:58
Bool_t fPersistance
Definition: PndSorterTask.h:71

Member Data Documentation

Bool_t PndSorterTask::fDigiPixelMCInfo
protected

Definition at line 72 of file PndSorterTask.h.

Int_t PndSorterTask::fEntryNr
protected

Definition at line 87 of file PndSorterTask.h.

Referenced by Exec().

TString PndSorterTask::fFolder
protected

Definition at line 84 of file PndSorterTask.h.

Referenced by Init().

TClonesArray* PndSorterTask::fInputArray
protected

Definition at line 80 of file PndSorterTask.h.

Referenced by Exec(), FinishTask(), and Init().

TString PndSorterTask::fInputBranch
protected

Input array of PndSdsPixelDigis

Definition at line 79 of file PndSorterTask.h.

Referenced by Exec(), FinishTask(), and Init().

Int_t PndSorterTask::fNumberOfCells
protected

Definition at line 74 of file PndSorterTask.h.

Referenced by Init().

TClonesArray* PndSorterTask::fOutputArray
protected

Definition at line 85 of file PndSorterTask.h.

Referenced by Exec(), FinishEvent(), FinishTask(), and Init().

TString PndSorterTask::fOutputBranch
protected

Output array of sorted PndSdsDigis

Definition at line 83 of file PndSorterTask.h.

Referenced by Exec(), FinishTask(), and Init().

Bool_t PndSorterTask::fPersistance
protected

Definition at line 71 of file PndSorterTask.h.

Referenced by GetPersistance(), Init(), and SetPersistance().

PndRingSorter* PndSorterTask::fSorter
protected

Definition at line 69 of file PndSorterTask.h.

Referenced by Exec(), FinishTask(), Init(), and ~PndSorterTask().

Double_t PndSorterTask::fWidthOfCells
protected

Definition at line 75 of file PndSorterTask.h.

Referenced by Init().


The documentation for this class was generated from the following files: