FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndMCTruthMatch Class Reference

#include <PndMCTruthMatch.h>

Inheritance diagram for PndMCTruthMatch:

Public Member Functions

 PndMCTruthMatch ()
 
 PndMCTruthMatch (TString inBranchName)
 
virtual ~PndMCTruthMatch ()
 
virtual InitStatus Init ()
 
virtual void SetInBranchName (TString name)
 
virtual void Exec (Option_t *opt)
 

Private Member Functions

 ClassDef (PndMCTruthMatch, 1)
 

Private Attributes

TClonesArray * fMCTrack
 
TClonesArray * fInBranch
 
TString fInBranchName
 

Detailed Description

Prints the MCTrack info for all data objects in a branch

This class prints for all data objects of a given branch the matching MCTrack information as long as the data derives from FairMultiLinkedData_Interface

Author
Tobias Stockmanns
Date
Sep. 2015

Definition at line 25 of file PndMCTruthMatch.h.

Constructor & Destructor Documentation

PndMCTruthMatch::PndMCTruthMatch ( )

Definition at line 18 of file PndMCTruthMatch.cxx.

18  :
19  fInBranchName("")
20 {
21  // TODO Auto-generated constructor stub
22 }
PndMCTruthMatch::PndMCTruthMatch ( TString  inBranchName)

Definition at line 25 of file PndMCTruthMatch.cxx.

25  :
26  fInBranchName(inBranchName)
27 {
28 }
PndMCTruthMatch::~PndMCTruthMatch ( )
virtual

Definition at line 30 of file PndMCTruthMatch.cxx.

30  {
31  // TODO Auto-generated destructor stub
32 }

Member Function Documentation

PndMCTruthMatch::ClassDef ( PndMCTruthMatch  ,
 
)
private
void PndMCTruthMatch::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 77 of file PndMCTruthMatch.cxx.

References fInBranch, fInBranchName, and i.

78 {
79  std::cout << "------------ EventNr " << FairRootManager::Instance()->GetEntryNr() << " ------------" << std::endl;
80  std::cout << FairRootManager::Instance()->GetBranchId(fInBranchName) << " : " << fInBranchName << " Entries: " << fInBranch->GetEntriesFast() << std::endl;
81 
82  for (int i = 0; i < fInBranch->GetEntriesFast(); i++)
83  {
84  FairMultiLinkedData_Interface* myData = (FairMultiLinkedData_Interface*)fInBranch->At(i);
85  std::cout << i << " : " << *myData << std::endl;
86  std::vector<FairLink> myLinks = myData->GetSortedMCTracks();
87  for (unsigned int trackIndex = 0; trackIndex < myLinks.size(); trackIndex++)
88  {
89  PndMCTrack* myTrack = (PndMCTrack*)FairRootManager::Instance()->GetCloneOfLinkData(myLinks[trackIndex]);
90  std::cout << myLinks[trackIndex] << " : " << *myTrack;
91  delete (myTrack);
92  }
93  std::cout << std::endl;
94  }
95 }
Int_t i
Definition: run_full.C:25
TClonesArray * fInBranch
InitStatus PndMCTruthMatch::Init ( )
virtual

Virtual method Init

Definition at line 35 of file PndMCTruthMatch.cxx.

References fInBranch, fInBranchName, and fMCTrack.

36 {
37 
38  FairRootManager* ioman = FairRootManager::Instance();
39  if (!ioman) {
40  std::cout << "-E- PndMCTruthMatch::Init: "
41  << "RootManager not instantiated!" << std::endl;
42  return kFATAL;
43  }
44 
45  if (fInBranchName == ""){
46  // Use hits of all tracking subsystems if nothing is given
47  std::cout << "-E- PndMCTruthMatch::Init no InBranchName given" << std::endl;
48  }
49 
50  fInBranch = (TClonesArray*)ioman->GetObject(fInBranchName);
51 
52  fMCTrack = (TClonesArray*)ioman->GetObject("MCTrack");
53 
54  return kSUCCESS;
55 }
TClonesArray * fMCTrack
TClonesArray * fInBranch
virtual void PndMCTruthMatch::SetInBranchName ( TString  name)
inlinevirtual

Definition at line 34 of file PndMCTruthMatch.h.

References fInBranchName, and name.

34 { fInBranchName = name;}
TString name

Member Data Documentation

TClonesArray* PndMCTruthMatch::fInBranch
private

Definition at line 41 of file PndMCTruthMatch.h.

Referenced by Exec(), and Init().

TString PndMCTruthMatch::fInBranchName
private

Definition at line 43 of file PndMCTruthMatch.h.

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

TClonesArray* PndMCTruthMatch::fMCTrack
private

Definition at line 40 of file PndMCTruthMatch.h.

Referenced by Init().


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