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 {
15  converter[0] = new G4RToEConvForGamma();
16  converter[1] = new G4RToEConvForElectron();
17  converter[2] = new G4RToEConvForPositron();
18  converter[3] = new G4RToEConvForProton();
19 }
20 
22 {}
23 
24 void
25 CMSGDMLWriteStructure::AddExtension(xercesc::DOMElement* volumeElement,
26  const G4LogicalVolume* const glv)
27 {
28  xercesc::DOMElement* auxiliaryElement = 0;
29  std::stringstream ss;
30  const char* cutnames[4] = {"pcutg","pcutem","pcutep","pcutp"};
31 
32  auxiliaryElement = NewElement("auxiliary");
33  auxiliaryElement->setAttributeNode(NewAttribute("auxtype","G4Region"));
34  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue",glv->GetRegion()->GetName()));
35  volumeElement->appendChild(auxiliaryElement);
36 
37  auxiliaryElement = NewElement("auxiliary");
38  auxiliaryElement->setAttributeNode(NewAttribute("auxtype","pcutunit"));
39  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue","GeV"));
40  volumeElement->appendChild(auxiliaryElement);
41 
42  // G4cout << "I have been called " << glv->GetName() << " in region "
43  // << glv->GetRegion()->GetName() << G4endl;
44  G4ProductionCuts *cuts = glv->GetRegion()->GetProductionCuts();
45 
46  for(G4int ic=0; ic<4; ++ic) {
47  G4cout << ic << ". " << cutnames[ic] << " converter: " << converter[ic]
48  << " cuts: " << cuts << " glv: " << glv << G4endl;
49  ss.clear(); ss.str("");
50  ss << converter[ic]->Convert(cuts->GetProductionCut(ic),glv->GetMaterial())/CLHEP::GeV;
51  // G4cout << cutnames[ic] << " = " << ss.str() << G4endl;
52  auxiliaryElement = NewElement("auxiliary");
53  auxiliaryElement->setAttributeNode(NewAttribute("auxtype",cutnames[ic]));
54  auxiliaryElement->setAttributeNode(NewAttribute("auxvalue",ss.str()));
55  volumeElement->appendChild(auxiliaryElement);
56  }
57 }
const double GeV
Definition: MathUtil.h:16
virtual void AddExtension(xercesc::DOMElement *volumeElement, const G4LogicalVolume *const glv)