Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
MaterialForOnline (const edm::ParameterSet &) | |
~MaterialForOnline () |
Definition at line 35 of file MaterialForOnline.cc.
MaterialForOnline::MaterialForOnline | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
MaterialForOnline::~MaterialForOnline | ( | ) |
Definition at line 66 of file MaterialForOnline.cc.
00067 { 00068 00069 // do anything here that needs to be done at desctruction time 00070 // (e.g. close files, deallocate resources etc.) 00071 00072 }
void MaterialForOnline::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 81 of file MaterialForOnline.cc.
References GenMuonPlsPt100GeV_cfg::cout, and lat::endl().
void MaterialForOnline::beginJob | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 90 of file MaterialForOnline.cc.
References DDMaterial::a(), DDBase< DDName, DDI::Material * >::begin(), DDMaterial::constituent(), GenMuonPlsPt100GeV_cfg::cout, DDMaterial::density(), DDBase< DDName, DDI::Material * >::end(), lat::endl(), f, g, edm::EventSetup::get(), i, DDName::name(), DDBase< N, C >::name(), DDMaterial::noOfConstituents(), and DDMaterial::z().
00091 { 00092 std::string materialFileName("MATERIALS.dat"); 00093 std::string elementaryMaterialFileName("ELEMENTARYMATERIALS.dat"); 00094 std::string compositeMaterialFileName("COMPOSITEMATERIALS.dat"); 00095 std::string materialFractionFileName("MATERIALFRACTIONS.dat"); 00096 00097 std::ofstream materialOS(materialFileName.c_str()); 00098 std::ofstream elementaryMaterialOS(elementaryMaterialFileName.c_str()); 00099 std::ofstream compositeMaterialOS(compositeMaterialFileName.c_str()); 00100 std::ofstream materialFractionOS(materialFractionFileName.c_str()); 00101 00102 00103 std::cout << "MaterialForOnline Analyzer..." << std::endl; 00104 edm::ESHandle<DDCompactView> pDD; 00105 00106 iSetup.get<IdealGeometryRecord>().get( "", pDD ); 00107 00108 // const DDCompactView & cpv = *pDD; 00109 //DDCompactView::graph_type gra = cpv.graph(); 00110 DDMaterial::iterator<DDMaterial> mit(DDMaterial::begin()), 00111 med(DDMaterial::end()); 00112 // PMaterial* pm; 00113 for (; mit != med; ++mit) { 00114 if (! mit->isDefined().second) continue; 00115 const DDMaterial& material = *mit; 00116 materialOS<<material.name()<<","<<material.density()/g*cm3 00117 << std::endl; 00118 00119 if(material.noOfConstituents()==0){//0 for elementary materials 00120 elementaryMaterialOS<<material.name()<<","<<material.z() 00121 <<","<<material.a()/g*mole 00122 << std::endl; 00123 } 00124 else{//compound materials. 00125 compositeMaterialOS<<material.name() 00126 << std::endl; 00127 for (int i=0; i<material.noOfConstituents(); ++i) { 00128 DDMaterial::FractionV::value_type f = material.constituent(i); 00129 materialFractionOS<<material.name()<<","<<f.first.name() 00130 <<","<< f.second 00131 << std::endl; 00132 } 00133 00134 } 00135 00136 } 00137 elementaryMaterialOS.close(); 00138 compositeMaterialOS.close(); 00139 materialFractionOS.close(); 00140 materialOS.close(); 00141 }