CMS 3D CMS Logo

CMSGDMLWriteStructure.cc
Go to the documentation of this file.
2 
3 #include "G4LogicalVolume.hh"
4 #include "G4ProductionCuts.hh"
5 #include "G4GDMLParser.hh"
6 #include "G4VRangeToEnergyConverter.hh"
7 #include "G4RToEConvForGamma.hh"
8 #include "G4RToEConvForElectron.hh"
9 #include "G4RToEConvForPositron.hh"
10 #include "G4RToEConvForProton.hh"
11 #include "G4SystemOfUnits.hh"
12 
14  converter[0] = new G4RToEConvForGamma();
15  converter[1] = new G4RToEConvForElectron();
16  converter[2] = new G4RToEConvForPositron();
17  converter[3] = new G4RToEConvForProton();
18 }
19 
21 
22 void CMSGDMLWriteStructure::AddExtension(xercesc::DOMElement* volumeElement, const G4LogicalVolume* const glv) {
23  xercesc::DOMElement* auxiliaryElement = nullptr;
24  std::stringstream ss;
25  const char* cutnames[4] = {"pcutg", "pcutem", "pcutep", "pcutp"};
26 
27  auxiliaryElement = NewElement("auxiliary");
28  auxiliaryElement->setAttributeNode(NewAttribute("auxtype", "G4Region"));
29  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue", glv->GetRegion()->GetName()));
30  volumeElement->appendChild(auxiliaryElement);
31 
32  auxiliaryElement = NewElement("auxiliary");
33  auxiliaryElement->setAttributeNode(NewAttribute("auxtype", "pcutunit"));
34  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue", "GeV"));
35  volumeElement->appendChild(auxiliaryElement);
36 
37  // G4cout << "I have been called " << glv->GetName() << " in region "
38  // << glv->GetRegion()->GetName() << G4endl;
39  G4ProductionCuts* cuts = glv->GetRegion()->GetProductionCuts();
40 
41  for (G4int ic = 0; ic < 4; ++ic) {
42  G4cout << ic << ". " << cutnames[ic] << " converter: " << converter[ic] << " cuts: " << cuts << " glv: " << glv
43  << G4endl;
44  ss.clear();
45  ss.str("");
46  ss << converter[ic]->Convert(cuts->GetProductionCut(ic), glv->GetMaterial()) / CLHEP::GeV;
47  // G4cout << cutnames[ic] << " = " << ss.str() << G4endl;
48  auxiliaryElement = NewElement("auxiliary");
49  auxiliaryElement->setAttributeNode(NewAttribute("auxtype", cutnames[ic]));
50  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue", ss.str()));
51  volumeElement->appendChild(auxiliaryElement);
52  }
53 }
const double GeV
Definition: MathUtil.h:16
void AddExtension(xercesc::DOMElement *volumeElement, const G4LogicalVolume *const glv) override