CMS 3D CMS Logo

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