CMS 3D CMS Logo

MaterialForOnline Class Reference

Inheritance diagram for MaterialForOnline:

edm::EDAnalyzer

List of all members.

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 ()


Detailed Description

Definition at line 35 of file MaterialForOnline.cc.


Constructor & Destructor Documentation

MaterialForOnline::MaterialForOnline ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 59 of file MaterialForOnline.cc.

00060 {
00061    //now do what ever initialization is needed
00062 
00063 }

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 }


Member Function Documentation

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().

00082 {
00083   std::cout << "analyze does nothing" << std::endl;
00084 
00085 }

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 }

void MaterialForOnline::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 145 of file MaterialForOnline.cc.

00145                           {
00146 }


The documentation for this class was generated from the following file:
Generated on Tue Jun 9 18:28:04 2009 for CMSSW by  doxygen 1.5.4