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")
51  , QuasiElastic(false)
52 {
53  minFTFP_pion = 4.0 * GeV;
54  maxBERT_pion = 5.0 * GeV;
55  minFTFP_kaon = 4.0 * GeV;
56  maxBERT_kaon = 5.0 * GeV;
57  minFTFP_proton = 4.0 * GeV;
58  maxBERT_proton = 5.0 * GeV;
59  minFTFP_neutron = 4.0 * GeV;
60  maxBERT_neutron = 5.0 * GeV;
61 }
62 
64 {
65  //Detele master-owned stuff
66  delete xs_k.Get();
67  std::for_each( xs_ds.Begin(), xs_ds.End(),[](G4VCrossSectionDataSet* el){ delete el;});
68 }
69 
71 {
72  G4MesonConstructor pMesonConstructor;
73  pMesonConstructor.ConstructParticle();
74 
75  G4BaryonConstructor pBaryonConstructor;
76  pBaryonConstructor.ConstructParticle();
77 
78  G4ShortLivedConstructor pShortLivedConstructor;
79  pShortLivedConstructor.ConstructParticle();
80 }
81 
83 {
84  delete xs_k.Get();
85  std::for_each( xs_ds.Begin(), xs_ds.End(),[](G4VCrossSectionDataSet* el){ delete el;});
86  xs_ds.Clear();
87  G4VPhysicsConstructor::TerminateWorker();
88 }
89 
91 {
92  G4cout << G4endl
93  << " FTFP_BERT : new threshold between BERT and FTFP is over the interval " << G4endl
94  << " for pions : " << minFTFP_pion/GeV << " to " << maxBERT_pion/GeV << " GeV" << G4endl
95  << " for kaons : " << minFTFP_kaon/GeV << " to " << maxBERT_kaon/GeV << " GeV" << G4endl
96  << " for proton : " << minFTFP_proton/GeV << " to " << maxBERT_proton/GeV << " GeV" << G4endl
97  << " for neutron : " << minFTFP_neutron/GeV << " to " << maxBERT_neutron/GeV << " GeV" << G4endl
98  << G4endl;
99 }
100 
102 {
103  Neutron();
104  Proton();
105  Pion();
106  Kaon();
107  Others();
108 }
109 
111 {
112  //General schema:
113  // 1) Create a builder
114  // 2) Call AddBuilder
115  // 3) Configure the builder, possibly with sub-builders
116  // 4) Call builder->Build()
117  auto neu = new G4NeutronBuilder;
118  AddBuilder(neu);
119  auto ftfpn = new G4FTFPNeutronBuilder(QuasiElastic);
120  AddBuilder( ftfpn );
121  neu->RegisterMe(ftfpn);
122  ftfpn->SetMinEnergy(minFTFP_neutron);
123  auto bertn = new G4BertiniNeutronBuilder;
124  AddBuilder(bertn);
125  neu->RegisterMe(bertn);
126  bertn->SetMinEnergy(0.*GeV);
127  bertn->SetMaxEnergy(maxBERT_neutron);
128  neu->Build();
129 }
130 
132 {
133  auto pro = new G4ProtonBuilder;
134  AddBuilder(pro);
135  auto ftfpp = new G4FTFPProtonBuilder(QuasiElastic);
136  AddBuilder(ftfpp);
137  pro->RegisterMe(ftfpp);
138  ftfpp->SetMinEnergy(minFTFP_proton);
139  auto bertp = new G4BertiniProtonBuilder;
140  AddBuilder(bertp);
141  pro->RegisterMe(bertp);
142  bertp->SetMaxEnergy(maxBERT_proton);
143  pro->Build();
144 }
145 
147 {
148  auto pi = new G4PionBuilder;
149  AddBuilder(pi);
150  auto ftfppi = new G4FTFPPionBuilder(QuasiElastic);
151  AddBuilder(ftfppi);
152  pi->RegisterMe(ftfppi);
153  ftfppi->SetMinEnergy(minFTFP_pion);
154  auto bertpi = new G4BertiniPionBuilder;
155  AddBuilder(bertpi);
156  pi->RegisterMe(bertpi);
157  bertpi->SetMaxEnergy(maxBERT_pion);
158  pi->Build();
159 }
160 
162 {
163  auto k = new G4KaonBuilder;
164  AddBuilder(k);
165  auto ftfpk = new G4FTFPKaonBuilder(QuasiElastic);
166  AddBuilder(ftfpk);
167  k->RegisterMe(ftfpk);
168  ftfpk->SetMinEnergy(minFTFP_kaon);
169  auto bertk = new G4BertiniKaonBuilder;
170  AddBuilder(bertk);
171  k->RegisterMe(bertk);
172  bertk->SetMaxEnergy(maxBERT_kaon);
173  k->Build();
174 }
175 
177 {
178  //===== Hyperons ====== //
179  auto hyp = new G4HyperonFTFPBuilder;
180  AddBuilder( hyp );
181  hyp->Build();
182 
184  auto abar = new G4AntiBarionBuilder;
185  AddBuilder(abar);
186  auto ftfpabar = new G4FTFPAntiBarionBuilder(QuasiElastic);
187  AddBuilder(ftfpabar);
188  abar->RegisterMe(ftfpabar);
189  abar->Build();
190 }
191 
193 {
194  if(G4Threading::IsMasterThread()) {
195  DumpBanner();
196  }
197  CreateModels();
199 }
200 
202 {
203  //Modify XS for kaons
204  auto xsk = new G4ComponentGGHadronNucleusXsc();
205  xs_k.Put(xsk);
206  G4VCrossSectionDataSet * kaonxs = new G4CrossSectionInelastic(xsk);
207  xs_ds.Push_back(kaonxs);
208  G4PhysListUtil::FindInelasticProcess(G4KaonMinus::KaonMinus())->AddDataSet(kaonxs);
209  G4PhysListUtil::FindInelasticProcess(G4KaonPlus::KaonPlus())->AddDataSet(kaonxs);
210  G4PhysListUtil::FindInelasticProcess(G4KaonZeroShort::KaonZeroShort())->AddDataSet(kaonxs);
211  G4PhysListUtil::FindInelasticProcess(G4KaonZeroLong::KaonZeroLong())->AddDataSet(kaonxs);
212 
213  //Modify Neutrons
214  auto xs_n_in = (G4NeutronInelasticXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4NeutronInelasticXS::Default_Name());
215  xs_ds.Push_back(xs_n_in);//TODO: Is this needed? Who owns the pointer?
216  G4PhysListUtil::FindInelasticProcess(G4Neutron::Neutron())->AddDataSet( xs_n_in );
217  G4HadronicProcess* capture = nullptr;
218  G4ProcessManager* pmanager = G4Neutron::Neutron()->GetProcessManager();
219  G4ProcessVector* pv = pmanager->GetProcessList();
220  for ( size_t i=0; i < static_cast<size_t>(pv->size()); ++i ) {
221  if ( fCapture == ((*pv)[i])->GetProcessSubType() ) {
222  capture = static_cast<G4HadronicProcess*>((*pv)[i]);
223  }
224  }
225  if ( ! capture ) {
226  capture = new G4HadronCaptureProcess("nCapture");
227  pmanager->AddDiscreteProcess(capture);
228  }
229  auto xs_n_c = (G4NeutronCaptureXS*)G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet(G4NeutronCaptureXS::Default_Name());
230  xs_ds.Push_back(xs_n_c);
231  capture->AddDataSet( xs_n_c );
232  capture->RegisterMe( new G4NeutronRadCapture() );
233 }
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:6
int k[5][pyjets_maxn]