test
CMS 3D CMS Logo

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