CMS 3D CMS Logo

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