21#ifndef BMNPARTICLEEQUALIZER2D_H
22#define BMNPARTICLEEQUALIZER2D_H
26#include "FairGenerator.h"
27#include "FairPrimaryGenerator.h"
51 vector<Int_t> pdg_codes,
54 Int_t intervals = 20);
94 vector<unique_ptr<TH1D>>
96 vector<unique_ptr<TH1D>>
98 vector<unique_ptr<TH1D>>
182 TString histo_file =
"$VMCWORKDIR/macro/recotools/particle_hists.root");
193 TString histo_file =
"$VMCWORKDIR/macro/recotools/particle_hists.root");
198 TString output_histo_file =
"$VMCWORKDIR/macro/recotools/particle_hists.root");
#define ClassDef(name, id)
BmnParticleEqualizer2D(TString hist_file_name, vector< Int_t > pdg_codes, Double_t min_p=0.0, Double_t max_p=4.0, Int_t intervals=20)
Constructor with given PDG codes for particles to be equalized.
Double_t fTargetPerInterval
static Int_t GetGlobalTrackPDG(BmnGlobalTrack *global_track, BmnTrackMatch *global_match, TClonesArray *mc_tracks, Double_t &tof_mass)
static void SetSampleTrackCut(Int_t track_cut)
Set the cut applied to the tracks of the sample while producing the sample histograms (and while draw...
static Bool_t CheckMomentumGrid(TFile *hist_file)
Bool_t BuildStatisticsCutHistograms()
Bool_t SetSampleStatisticsCutRebin(Int_t factor)
Set how much the two dimensional sample histograms are rebinned for the filtering of the event partic...
Bool_t isActive
Interval step.
Int_t fSampleStatisticsCutRebin
Lower limit of the efficiency used for the correction.
static int FitEtaHistogram(unique_ptr< TH1D > &hEta, int pdg_key, Double_t eta_min, Double_t eta_max)
static int ProduceEfficiencyMap(TString input_list_file, TString histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
static int FitYHistogram(unique_ptr< TH1D > &hY, int pdg_key, Double_t &y0_output, Double_t &sigma_putput)
static Int_t GetPDGCodeByMass(Double_t mass, Double_t tolerance=1.e-6, const vector< int > &vecParticlePDG={})
static int FitPHistogram(unique_ptr< TH1D > &hP, int pdg_key, Double_t p_min, Double_t p_max)
static int ProduceSampleHistograms(TString input_list_file, TString output_histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
static int ShowSampleHistograms(TString input_histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
static Double_t fPMin
Min value of momentum.
static Bool_t GetConditionalRandomY(const TH2D *hist, Double_t x, Double_t &y)
Double_t fMinEfficiency
Whether the added particle number is corrected by the efficiency.
void SetTargetPerInterval(Double_t target)
Set the target number of the particles of every type to be reached in every momentum interval of an e...
static Double_t fPMax
Max value of momentum.
static void FitSampleHistograms(TString input_histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
additional functions to check results of fitting and particle equalizing
Bool_t SetEfficiencyCorrection(Bool_t is_used, Double_t min_efficiency=0.05)
Switch on the correction of the number of the added particles by the reconstruction efficiency (off b...
virtual ~BmnParticleEqualizer2D()
Destructor.
void SetSampleStatisticsCut(Bool_t is_used)
Switch the filtering of the event particles by the sample statistics on or off (on by default).
static Int_t fIntervalCount
Interval count for momentum to equalize particles at all the intervals.
static int ShowResultDistributions(TString input_list_file)
Bool_t fUseEfficiencyCorrection
Target particle number per interval, 0 = maximum of the event (see the setter).
map< Int_t, unique_ptr< stParticleInfo > > fParticleInfos
Bool_t fIsEfficiencyMapRead
Rebin factor of the histograms used to filter the particles of an event.
vector< int > fMaxParticles
static int ProduceAcceptanceMap(TString input_list_file, TString histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
BmnParticleEqualizer2D(TString hist_file_name)
Constructor with input histograms.
static Int_t fSampleTrackCut
Cut applied to the tracks of the sample (see SetSampleTrackCut).
Bool_t Init()
Initializer.
static vector< Int_t > fParticles
static int FitPtHistogram(unique_ptr< TH1D > &hPt, int pdg_key, Double_t pdg_mass, Double_t pt_min, Double_t pt_max, Double_t &t_output)
Bool_t fUseSampleStatisticsCut
Whether the efficiency map has been found in the sample histogram file.
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
Creates an event with equal number of particles at all momentum intervals.
Bool_t ReadSampleHistograms(TString input_histo_file="$VMCWORKDIR/macro/recotools/particle_hists.root")
unique_ptr< TH2D > fEtaPhiHist
PDG -> (Eta, Phi) histogram (TH2D) of the whole momentum range, used as a fallback for the same reaso...
vector< unique_ptr< TH2D > > fEtaPhiCutHistVector
The same rebinned copies of 'fEtaPhiHistVector' (divided by momentum intervals -> vector).
Double_t fT
Temperature in the P distribution.
vector< unique_ptr< TH1D > > fPHistVector
P histograms for the particle type (divided by momentum intervals -> vector).
vector< Double_t > fParticleDebt
Part of the target number of the particles that has not been added yet, kept between the events so th...
stParticleInfo(int pdg_key, Double_t min_p, Double_t max_p, Int_t interval_count)
Double_t fY0
Mean rapidity.
unique_ptr< TH1D > fYHist
PDG -> Y (rapidity) histogram (TH1D) for the particle type.
unique_ptr< TH2D > fPEtaHist
PDG -> (P, Eta) histogram (TH2D) of the whole momentum range, used to sample Eta for a given P when t...
unique_ptr< TH1D > fPhiHist
PDG -> Phi (azimuth angle) histogram (TH1D) for the particle type.
vector< unique_ptr< TH2D > > fPEtaHistVector
(P, Eta) histograms for the particle type (divided by momentum intervals -> vector).
unique_ptr< TH1D > fThetaHist
PDG -> Theta (polar angle) histogram (TH1D) for the particle type.
unique_ptr< TH1D > fPtHist
PDG -> Pt histogram (TH1D) for the particle type.
unique_ptr< TH1D > fPHist
PDG -> P histogram (TH1D) for the particle type.
vector< unique_ptr< TH1D > > fPhiHistVector
Phi histograms for the particle type (divided by momentum intervals -> vector).
unique_ptr< TH1D > fEtaHist
PDG -> Eta (pseudorapidity) histogram (TH1D) for the particle type.
vector< Int_t > fParticleNumber
PDG -> Particle Count (divided by momentum intervals -> vector).
EPSampling
Way the kinematics of a new particle is sampled in a momentum interval.
@ kIntervalHist
P and Eta together from the (P, Eta) histogram of the interval itself.
@ kFitFunction
P from the fitted function of the full P histogram (too little sample statistics).
vector< EPSampling > fPSampling
Momentum sampling way for the particle type (divided by momentum intervals -> vector).
vector< unique_ptr< TH2D > > fPEtaCutHistVector
Rebinned copies of 'fPEtaHistVector' used to check whether the sample has statistics for a particle o...
vector< unique_ptr< TH2D > > fEtaPhiHistVector
(Eta, Phi) histograms for the particle type (divided by momentum intervals -> vector)
Double_t fSigma
Sigma in the rapidity distribution.
vector< unique_ptr< TH1D > > fEtaHistVector
Eta histograms for the particle type (divided by momentum intervals -> vector).
vector< Double_t > fEfficiency
Relative reconstruction efficiency of the particle type, 1 for all the intervals if the efficiency ma...