Heavy ion Analysis Libriares
Loading...
Searching...
No Matches
FemtoWeightGeneratorSupressed.cxx
1/*
2 * FemtoWeightSupressed.cxx
3 *
4 * Created on: 22 lis 2018
5 * Author: Daniel Wielanek
6 * E-mail: daniel.wielanek@gmail.com
7 * Warsaw University of Technology, Faculty of Physics
8 */
9
10#include "FemtoWeightGeneratorSupressed.h"
11
12#include "Package.h"
13#include "Parameter.h"
14
15#include <RtypesCore.h>
16#include <TRandom.h>
17
18namespace Hal {
19 FemtoWeightGeneratorSupressed& FemtoWeightGeneratorSupressed::operator=(const FemtoWeightGeneratorSupressed& other) {
20 if (this != &other) {
22 if (fWeightGenerator) delete fWeightGenerator;
23 fWeightGenerator = (FemtoWeightGenerator*) other.fWeightGenerator->Clone();
24 }
25 return *this;
26 }
27
29 if (gRandom->Rndm() > fSupressionFactor) { return fWeightGenerator->GenerateWeight(pair); }
30 return 1;
31 }
32
33 FemtoWeightGeneratorSupressed::FemtoWeightGeneratorSupressed(const FemtoWeightGenerator& weight) :
34 FemtoWeightGenerator(), fSupressionFactor(0) {
35 fWeightGenerator = weight.MakeCopy();
36 }
37
39 if (factor >= 0 && factor <= 1) fSupressionFactor = factor;
40 }
41
42 Bool_t FemtoWeightGeneratorSupressed::Init(Int_t task_id, FemtoPair* pair) {
43 if (fWeightGenerator == nullptr) return kFALSE;
44 return fWeightGenerator->Init(task_id, pair);
45 }
46
47 FemtoWeightGeneratorSupressed::~FemtoWeightGeneratorSupressed() {
48 if (fWeightGenerator) delete fWeightGenerator;
49 }
50
51 Package* FemtoWeightGeneratorSupressed::Report() const {
52 Package* report = new Package(this);
53 report->AddObject(fWeightGenerator->Report());
54 report->AddObject(new ParameterDouble("SupressionFactor", fSupressionFactor));
55 return report;
56 }
57
58 FemtoWeightGeneratorSupressed::FemtoWeightGeneratorSupressed(const FemtoWeightGeneratorSupressed& other) :
59 FemtoWeightGenerator(other), fWeightGenerator(nullptr) {
60 if (other.fWeightGenerator) { fWeightGenerator = other.fWeightGenerator->MakeCopy(); }
61 fSupressionFactor = other.fSupressionFactor;
62 }
63} // namespace Hal
virtual Bool_t Init(Int_t task_id, FemtoPair *pair)
virtual Double_t GenerateWeight(FemtoPair *pair)
virtual FemtoWeightGenerator & operator=(const FemtoWeightGenerator &aModel)
virtual Bool_t Init(Int_t task_id, FemtoPair *pair)
virtual Double_t GenerateWeight(FemtoPair *pair)
virtual FemtoWeightGenerator * MakeCopy() const
virtual FemtoWeightGenerator * Clone(const char *="") const