CMS 3D CMS Logo

CMSMonopolePhysics.cc
Go to the documentation of this file.
4 
5 #include "G4ParticleDefinition.hh"
6 #include "G4ProcessManager.hh"
7 
8 #include "G4StepLimiter.hh"
9 #include "G4mplIonisation.hh"
10 #include "G4mplIonisationWithDeltaModel.hh"
11 #include "G4hMultipleScattering.hh"
12 #include "G4hIonisation.hh"
13 #include "G4hhIonisation.hh"
14 
15 #include "CLHEP/Units/GlobalSystemOfUnits.h"
16 
18  const edm::ParameterSet & p) :
19  G4VPhysicsConstructor("Monopole Physics")
20 {
21  verbose = p.getUntrackedParameter<int>("Verbosity",0);
22  magCharge = p.getUntrackedParameter<int>("MonopoleCharge",1);
23  deltaRay = p.getUntrackedParameter<bool>("MonopoleDeltaRay",true);
24  multiSc = p.getUntrackedParameter<bool>("MonopoleMultiScatter",false);
25  transport = p.getUntrackedParameter<bool>("MonopoleTransport",true);
26  double mass = p.getUntrackedParameter<double>("MonopoleMass",200);
27  if (pdt && mass > 0.0) {
28  int ii=0;
29  for (HepPDT::ParticleDataTable::const_iterator p=pdt->begin();
30  p != pdt->end(); ++p,++ii) {
31  HepPDT::ParticleData particle = (p->second);
32  std::string particleName = (particle.name()).substr(0,8);
33  if (strcmp(particleName.c_str(),"Monopole") == 0) {
34  names.push_back(particle.name());
35  masses.push_back(mass*CLHEP::GeV);
36  elCharges.push_back((int)(particle.charge()));
37  pdgEncodings.push_back(particle.pid());
38  monopoles.push_back(nullptr);
39  if (verbose > 0) G4cout << "CMSMonopolePhysics: Monopole[" << ii
40  << "] " << particleName << " Mass "
41  << particle.mass() << " GeV, Magnetic Charge "
42  << magCharge << ", Electric Charge "
43  << particle.charge() << G4endl;
44  } else if(strcmp(particleName.c_str(),"AntiMono") == 0) {
45  names.push_back(particle.name());
46  masses.push_back(mass*CLHEP::GeV);
47  elCharges.push_back((int)(particle.charge()));
48  pdgEncodings.push_back(particle.pid());
49  monopoles.push_back(nullptr);
50  if (verbose > 0) G4cout << "CMSMonopolePhysics: Monopole[" << ii
51  << "] " << particleName << " Mass "
52  << particle.mass() << " GeV, Magnetic Charge "
53  << magCharge << ", Electric Charge "
54  << particle.charge() << G4endl;
55  }
56  }
57  }
58  if (verbose > 0) G4cout << "CMSMonopolePhysics has " << names.size()
59  << " monopole candidates and delta Ray option "
60  << deltaRay << G4endl;
61 }
62 
64 
66 
67  for (unsigned int ii=0; ii<names.size(); ++ii) {
68  // monopoles are created once in the master thread
69  if (!monopoles[ii]) {
70  G4int mc = (pdgEncodings[ii] >= 0 ) ? magCharge : -magCharge;
71  Monopole* mpl = new Monopole(names[ii], pdgEncodings[ii], masses[ii],
72  mc, elCharges[ii]);
73  monopoles[ii] = mpl;
74  if (verbose > 0) G4cout << "Create Monopole " << names[ii]
75  << " of mass " << masses[ii]/CLHEP::GeV
76  << " GeV, magnetic charge " << mc
77  << ", electric charge " << elCharges[ii]
78  << " and PDG encoding " << pdgEncodings[ii]
79  << " at " << monopoles[ii] << G4endl;
80  }
81  }
82 }
83 
85  // Add standard EM Processes
86  if (verbose > 0) {
87  G4cout << "### CMSMonopolePhysics ConstructProcess()" << G4endl;
88  }
89  G4PhysicsListHelper* ph = G4PhysicsListHelper::GetPhysicsListHelper();
90 
91  for (unsigned int ii=0; ii<monopoles.size(); ++ii) {
92  if (monopoles[ii]) {
93  Monopole* mpl = monopoles[ii];
94  G4ProcessManager *pmanager = mpl->GetProcessManager();
95  if(!pmanager) {
96  std::ostringstream o;
97  o << "Monopole without a Process Manager";
98  throw edm::Exception( edm::errors::Configuration, o.str().c_str());
99  return;
100  }
101 
102  G4double magn = mpl->MagneticCharge();
103  G4double mass = mpl->GetPDGMass();
104  if (verbose > 1) {
105  G4cout << "### CMSMonopolePhysics instantiates for "
106  << mpl->GetParticleName()
107  << " at " << mpl << " Mass " << mass/CLHEP::GeV
108  << " GeV Mag " << magn << " Process manager " << pmanager
109  << G4endl;
110  }
111 
112  if (magn != 0.0) {
113  G4int idxt(0);
114  pmanager->RemoveProcess(idxt);
115  pmanager->AddProcess(new MonopoleTransportation(mpl,verbose),-1,0,0);
116  }
117 
118  if (mpl->GetPDGCharge() != 0.0) {
119  if (multiSc) {
120  G4hMultipleScattering* hmsc = new G4hMultipleScattering();
121  ph->RegisterProcess(hmsc, mpl);
122  }
123  G4hIonisation* hioni = new G4hIonisation();
124  ph->RegisterProcess(hioni, mpl);
125  }
126  if(magn != 0.0) {
127  G4mplIonisation* mplioni = new G4mplIonisation(magn);
128  ph->RegisterProcess(mplioni, mpl);
129  }
130  pmanager->AddDiscreteProcess(new G4StepLimiter());
131  if (verbose > 1) { pmanager->DumpInfo(); }
132  }
133  }
134 }
T getUntrackedParameter(std::string const &, T const &) const
~CMSMonopolePhysics() override
const double GeV
Definition: MathUtil.h:16
std::vector< int > pdgEncodings
HepPDT::ParticleDataTable ParticleDataTable
std::vector< Monopole * > monopoles
std::vector< int > elCharges
HepPDT::ParticleData ParticleData
std::vector< std::string > names
ii
Definition: cuy.py:590
void ConstructProcess() override
void ConstructParticle() override
CMSMonopolePhysics(const HepPDT::ParticleDataTable *table_, const edm::ParameterSet &p)
G4double MagneticCharge() const
Definition: Monopole.h:19
std::vector< double > masses