FairShip
Loading...
Searching...
No Matches
EvtCalcGenerator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2// SPDX-FileCopyrightText: Copyright CERN for the benefit of the SHiP
3// Collaboration
4
5#ifndef SHIPGEN_EVTCALCGENERATOR_H_
6#define SHIPGEN_EVTCALCGENERATOR_H_
7
8#include <memory>
9
10#include "Generator.h"
11#include "TFile.h"
12#include "TTree.h"
13
14class FairPrimaryGenerator;
15
17 public:
20
22 ~EvtCalcGenerator() override;
23
26 Bool_t ReadEvent(FairPrimaryGenerator*) override;
27 Bool_t Init(const char*, int) override;
28 Bool_t Init(const char*) override;
29
30 Int_t GetNevents() { return fNevents; }
31 void SetPositions(Double_t zTa, Double_t zDV) {
32 ztarget = zTa; // units cm (midpoint)
33 zDecayVolume = zDV; // units cm (midpoint)
34 }
35
36 // Wrapper function declarations
37 Double_t GetNdaughters(const std::unique_ptr<TTree>&) const;
38 Double_t GetMotherPx(const std::unique_ptr<TTree>&) const;
39 Double_t GetMotherPy(const std::unique_ptr<TTree>&) const;
40 Double_t GetMotherPz(const std::unique_ptr<TTree>&) const;
41 Double_t GetMotherE(const std::unique_ptr<TTree>&) const;
42 Double_t GetVx(const std::unique_ptr<TTree>&) const;
43 Double_t GetVy(const std::unique_ptr<TTree>&) const;
44 Double_t GetVz(const std::unique_ptr<TTree>&) const;
45 Double_t GetDecayProb(const std::unique_ptr<TTree>&) const;
46 Double_t GetDauPx(const std::unique_ptr<TTree>&, int) const;
47 Double_t GetDauPy(const std::unique_ptr<TTree>&, int) const;
48 Double_t GetDauPz(const std::unique_ptr<TTree>&, int) const;
49 Double_t GetDauE(const std::unique_ptr<TTree>&, int) const;
50 Double_t GetDauPDG(const std::unique_ptr<TTree>&, int) const;
51
52 private:
53 protected:
54 // Generalized branch access
55 Double_t GetBranchValue(const std::unique_ptr<TTree>&, unsigned) const;
56
57 // Generalized daughter variable access
58 Double_t GetDaughterValue(const std::unique_ptr<TTree>& tree, int, int) const;
59
61 std::unique_ptr<TFile> fInputFile;
62 std::unique_ptr<TTree> fTree;
63 std::vector<double> branchVars;
64
65 enum class BranchIndices {
66 MotherPx = 0,
67 MotherPy = 1,
68 MotherPz = 2,
69 MotherE = 3,
70 DecayProb = 6,
71 Vx = 7,
72 Vy = 8,
73 Vz = 9
74 };
75
77 int fn;
79 int Ndau;
80};
81
82#endif // SHIPGEN_EVTCALCGENERATOR_H_
std::unique_ptr< TFile > fInputFile
Bool_t Init(const char *, int) override
Double_t GetDauPDG(const std::unique_ptr< TTree > &, int) const
Double_t GetNdaughters(const std::unique_ptr< TTree > &) const
Double_t GetDauE(const std::unique_ptr< TTree > &, int) const
Double_t GetMotherE(const std::unique_ptr< TTree > &) const
Double_t GetBranchValue(const std::unique_ptr< TTree > &, unsigned) const
Double_t GetDauPx(const std::unique_ptr< TTree > &, int) const
std::unique_ptr< TTree > fTree
Double_t GetDecayProb(const std::unique_ptr< TTree > &) const
Bool_t ReadEvent(FairPrimaryGenerator *) override
std::vector< double > branchVars
Double_t GetDauPz(const std::unique_ptr< TTree > &, int) const
Double_t GetMotherPy(const std::unique_ptr< TTree > &) const
Double_t GetMotherPz(const std::unique_ptr< TTree > &) const
Double_t GetMotherPx(const std::unique_ptr< TTree > &) const
void SetPositions(Double_t zTa, Double_t zDV)
Double_t GetVz(const std::unique_ptr< TTree > &) const
Double_t GetDauPy(const std::unique_ptr< TTree > &, int) const
Double_t GetVx(const std::unique_ptr< TTree > &) const
Double_t GetVy(const std::unique_ptr< TTree > &) const
~EvtCalcGenerator() override
Double_t GetDaughterValue(const std::unique_ptr< TTree > &tree, int, int) const
virtual Bool_t Init(const char *, int)=0