CMS 3D CMS Logo

CMSHadronPhysicsFTFP_BERT.cc
Go to the documentation of this file.
1 //
2 #include <iomanip>
3 
5 
6 #include "globals.hh"
7 #include "G4ios.hh"
8 #include "G4SystemOfUnits.hh"
9 #include "G4ParticleDefinition.hh"
10 #include "G4ParticleTable.hh"
11 #include "G4PionBuilder.hh"
12 #include "G4BertiniPionBuilder.hh"
13 #include "G4FTFPPionBuilder.hh"
14 
15 #include "G4KaonBuilder.hh"
16 #include "G4BertiniKaonBuilder.hh"
17 #include "G4FTFPKaonBuilder.hh"
18 
19 #include "G4ProtonBuilder.hh"
20 #include "G4BertiniProtonBuilder.hh"
21 #include "G4FTFPNeutronBuilder.hh"
22 #include "G4FTFPProtonBuilder.hh"
23 
24 #include "G4NeutronBuilder.hh"
25 #include "G4BertiniNeutronBuilder.hh"
26 #include "G4FTFPNeutronBuilder.hh"
27 
28 #include "G4HyperonFTFPBuilder.hh"
29 #include "G4AntiBarionBuilder.hh"
30 #include "G4FTFPAntiBarionBuilder.hh"
31 
32 #include "G4MesonConstructor.hh"
33 #include "G4BaryonConstructor.hh"
34 #include "G4ShortLivedConstructor.hh"
35 
36 #include "G4ComponentGGHadronNucleusXsc.hh"
37 #include "G4CrossSectionInelastic.hh"
38 #include "G4HadronCaptureProcess.hh"
39 #include "G4NeutronRadCapture.hh"
40 #include "G4NeutronInelasticXS.hh"
41 #include "G4NeutronCaptureXS.hh"
42 
43 #include "G4CrossSectionDataSetRegistry.hh"
44 
45 #include "G4PhysListUtil.hh"
46 #include "G4ProcessManager.hh"
47 #include "G4Threading.hh"
48 
50  : G4VPhysicsConstructor("hInelastic CMS FTFP_BERT"), QuasiElastic(false) {
51  minFTFP_pion = 4.0 * GeV;
52  maxBERT_pion = 5.0 * GeV;
53  minFTFP_kaon = 4.0 * GeV;
54  maxBERT_kaon = 5.0 * GeV;
55  minFTFP_proton = 4.0 * GeV;
56  maxBERT_proton = 5.0 * GeV;
57  minFTFP_neutron = 4.0 * GeV;
58  maxBERT_neutron = 5.0 * GeV;
59 }
60 
62  //Detele master-owned stuff
63  delete xs_k.Get();
64  std::for_each(xs_ds.Begin(), xs_ds.End(), [](G4VCrossSectionDataSet* el) { delete el; });
65 }
66 
68  G4MesonConstructor pMesonConstructor;
69  pMesonConstructor.ConstructParticle();
70 
71  G4BaryonConstructor pBaryonConstructor;
72  pBaryonConstructor.ConstructParticle();
73 
74  G4ShortLivedConstructor pShortLivedConstructor;
75  pShortLivedConstructor.ConstructParticle();
76 }
77 
79  delete xs_k.Get();
80  std::for_each(xs_ds.Begin(), xs_ds.End(), [](G4VCrossSectionDataSet* el) { delete el; });
81  xs_ds.Clear();
82  G4VPhysicsConstructor::TerminateWorker();
83 }
84 
86  G4cout << G4endl << " FTFP_BERT : new threshold between BERT and FTFP is over the interval " << G4endl
87  << " for pions : " << minFTFP_pion / GeV << " to " << maxBERT_pion / GeV << " GeV" << G4endl
88  << " for kaons : " << minFTFP_kaon / GeV << " to " << maxBERT_kaon / GeV << " GeV" << G4endl
89  << " for proton : " << minFTFP_proton / GeV << " to " << maxBERT_proton / GeV << " GeV" << G4endl
90  << " for neutron : " << minFTFP_neutron / GeV << " to " << maxBERT_neutron / GeV << " GeV" << G4endl << G4endl;
91 }
92 
94  Neutron();
95  Proton();
96  Pion();
97  Kaon();
98  Others();
99 }
100 
102  //General schema:
103  // 1) Create a builder
104  // 2) Call AddBuilder
105  // 3) Configure the builder, possibly with sub-builders
106  // 4) Call builder->Build()
107  auto neu = new G4NeutronBuilder;
108  AddBuilder(neu);
109  auto ftfpn = new G4FTFPNeutronBuilder(QuasiElastic);
110  AddBuilder(ftfpn);
111  neu->RegisterMe(ftfpn);
112  ftfpn->SetMinEnergy(minFTFP_neutron);
113  auto bertn = new G4BertiniNeutronBuilder;
114  AddBuilder(bertn);
115  neu->RegisterMe(bertn);
116  bertn->SetMinEnergy(0. * GeV);
117  bertn->SetMaxEnergy(maxBERT_neutron);
118  neu->Build();
119 }
120 
122  auto pro = new G4ProtonBuilder;
123  AddBuilder(pro);
124  auto ftfpp = new G4FTFPProtonBuilder(QuasiElastic);
125  AddBuilder(ftfpp);
126  pro->RegisterMe(ftfpp);
127  ftfpp->SetMinEnergy(minFTFP_proton);
128  auto bertp = new G4BertiniProtonBuilder;
129  AddBuilder(bertp);
130  pro->RegisterMe(bertp);
131  bertp->SetMaxEnergy(maxBERT_proton);
132  pro->Build();
133 }
134 
136  auto pi = new G4PionBuilder;
137  AddBuilder(pi);
138  auto ftfppi = new G4FTFPPionBuilder(QuasiElastic);
139  AddBuilder(ftfppi);
140  pi->RegisterMe(ftfppi);
141  ftfppi->SetMinEnergy(minFTFP_pion);
142  auto bertpi = new G4BertiniPionBuilder;
143  AddBuilder(bertpi);
144  pi->RegisterMe(bertpi);
145  bertpi->SetMaxEnergy(maxBERT_pion);
146  pi->Build();
147 }
148 
150  auto k = new G4KaonBuilder;
151  AddBuilder(k);
152  auto ftfpk = new G4FTFPKaonBuilder(QuasiElastic);
153  AddBuilder(ftfpk);
154  k->RegisterMe(ftfpk);
155  ftfpk->SetMinEnergy(minFTFP_kaon);
156  auto bertk = new G4BertiniKaonBuilder;
157  AddBuilder(bertk);
158  k->RegisterMe(bertk);
159  bertk->SetMaxEnergy(maxBERT_kaon);
160  k->Build();
161 }
162 
164  //===== Hyperons ====== //
165  auto hyp = new G4HyperonFTFPBuilder;
166  AddBuilder(hyp);
167  hyp->Build();
168 
170  auto abar = new G4AntiBarionBuilder;
171  AddBuilder(abar);
172  auto ftfpabar = new G4FTFPAntiBarionBuilder(QuasiElastic);
173  AddBuilder(ftfpabar);
174  abar->RegisterMe(ftfpabar);
175  abar->Build();
176 }
177 
179  if (G4Threading::IsMasterThread()) {
180  DumpBanner();
181  }
182  CreateModels();
184 }
185 
187  //Modify XS for kaons
188  auto xsk = new G4ComponentGGHadronNucleusXsc();
189  xs_k.Put(xsk);
190  G4VCrossSectionDataSet* kaonxs = new G4CrossSectionInelastic(xsk);
191  xs_ds.Push_back(kaonxs);
192  G4PhysListUtil::FindInelasticProcess(G4KaonMinus::KaonMinus())->AddDataSet(kaonxs);
193  G4PhysListUtil::FindInelasticProcess(G4KaonPlus::KaonPlus())->AddDataSet(kaonxs);
194  G4PhysListUtil::FindInelasticProcess(G4KaonZeroShort::KaonZeroShort())->AddDataSet(kaonxs);
195  G4PhysListUtil::FindInelasticProcess(G4KaonZeroLong::KaonZeroLong())->AddDataSet(kaonxs);
196 
197  //Modify Neutrons
198  auto xs_n_in = (G4NeutronInelasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(
199  G4NeutronInelasticXS::Default_Name());
200  xs_ds.Push_back(xs_n_in); //TODO: Is this needed? Who owns the pointer?
201  G4PhysListUtil::FindInelasticProcess(G4Neutron::Neutron())->AddDataSet(xs_n_in);
202  G4HadronicProcess* capture = nullptr;
203  G4ProcessManager* pmanager = G4Neutron::Neutron()->GetProcessManager();
204  G4ProcessVector* pv = pmanager->GetProcessList();
205  for (size_t i = 0; i < static_cast<size_t>(pv->size()); ++i) {
206  if (fCapture == ((*pv)[i])->GetProcessSubType()) {
207  capture = static_cast<G4HadronicProcess*>((*pv)[i]);
208  }
209  }
210  if (!capture) {
211  capture = new G4HadronCaptureProcess("nCapture");
212  pmanager->AddDiscreteProcess(capture);
213  }
214  auto xs_n_c = (G4NeutronCaptureXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(
215  G4NeutronCaptureXS::Default_Name());
216  xs_ds.Push_back(xs_n_c);
217  capture->AddDataSet(xs_n_c);
218  capture->RegisterMe(new G4NeutronRadCapture());
219 }
G4Cache< G4ComponentGGHadronNucleusXsc * > xs_k
const double GeV
Definition: MathUtil.h:16
def capture(fd, args)
Definition: ztee.py:94
G4VectorCache< G4VCrossSectionDataSet * > xs_ds
const Double_t pi
def pv(vc)
Definition: MetAnalyzer.py:7
int k[5][pyjets_maxn]