CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions
MaterialForOnline Class Reference
Inheritance diagram for MaterialForOnline:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &) override
 
virtual void endJob () override
 
 MaterialForOnline (const edm::ParameterSet &)
 
 ~MaterialForOnline ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

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.

60 {
61  //now do what ever initialization is needed
62 
63 }
MaterialForOnline::~MaterialForOnline ( )

Definition at line 66 of file MaterialForOnline.cc.

67 {
68 
69  // do anything here that needs to be done at desctruction time
70  // (e.g. close files, deallocate resources etc.)
71 
72 }

Member Function Documentation

void MaterialForOnline::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 81 of file MaterialForOnline.cc.

References gather_cfg::cout.

82 {
83  std::cout << "analyze does nothing" << std::endl;
84 
85 }
tuple cout
Definition: gather_cfg.py:121
void MaterialForOnline::beginRun ( const edm::Run ,
const edm::EventSetup iSetup 
)
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 90 of file MaterialForOnline.cc.

References DDMaterial::a(), DDBase< DDName, DDI::Material * >::begin(), DDMaterial::constituent(), gather_cfg::cout, DDMaterial::density(), DDBase< DDName, DDI::Material * >::end(), f, g, edm::EventSetup::get(), i, DDName::name(), DDBase< N, C >::name(), DDMaterial::noOfConstituents(), AlCaHLTBitMon_QueryRunRegistry::string, and DDMaterial::z().

91 {
92  std::string materialFileName("MATERIALS.dat");
93  std::string elementaryMaterialFileName("ELEMENTARYMATERIALS.dat");
94  std::string compositeMaterialFileName("COMPOSITEMATERIALS.dat");
95  std::string materialFractionFileName("MATERIALFRACTIONS.dat");
96 
97  std::ofstream materialOS(materialFileName.c_str());
98  std::ofstream elementaryMaterialOS(elementaryMaterialFileName.c_str());
99  std::ofstream compositeMaterialOS(compositeMaterialFileName.c_str());
100  std::ofstream materialFractionOS(materialFractionFileName.c_str());
101 
102 
103  std::cout << "MaterialForOnline Analyzer..." << std::endl;
105 
106  iSetup.get<IdealGeometryRecord>().get( "", pDD );
107 
108  // const DDCompactView & cpv = *pDD;
109  //DDCompactView::graph_type gra = cpv.graph();
110  DDMaterial::iterator<DDMaterial> mit(DDMaterial::begin()),
111  med(DDMaterial::end());
112  // PMaterial* pm;
113  for (; mit != med; ++mit) {
114  if (! mit->isDefined().second) continue;
115  const DDMaterial& material = *mit;
116  materialOS<<material.name()<<","<<material.density()/g*cm3
117  << std::endl;
118 
119  if(material.noOfConstituents()==0){//0 for elementary materials
120  elementaryMaterialOS<<material.name()<<","<<material.z()
121  <<","<<material.a()/g*mole
122  << std::endl;
123  }
124  else{//compound materials.
125  compositeMaterialOS<<material.name()
126  << std::endl;
127  for (int i=0; i<material.noOfConstituents(); ++i) {
129  materialFractionOS<<material.name()<<","<<f.first.name()
130  <<","<< f.second
131  << std::endl;
132  }
133 
134  }
135 
136  }
137  elementaryMaterialOS.close();
138  compositeMaterialOS.close();
139  materialFractionOS.close();
140  materialOS.close();
141 }
double a() const
returns the atomic mass
Definition: DDMaterial.cc:97
int i
Definition: DBlmapReader.cc:9
const N & name() const
Definition: DDBase.h:78
DDMaterial is used to define and access material information.
Definition: DDMaterial.h:41
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
double z() const
retruns the atomic number
Definition: DDMaterial.cc:103
FractionV::value_type constituent(int i) const
returns the i-th compound material and its fraction-mass
Definition: DDMaterial.cc:89
double f[11][100]
Container::value_type value_type
double density() const
returns the density
Definition: DDMaterial.cc:109
const T & get() const
Definition: EventSetup.h:55
int noOfConstituents() const
returns the number of compound materials or 0 for elementary materials
Definition: DDMaterial.cc:83
tuple cout
Definition: gather_cfg.py:121
const std::string & name() const
Returns the name.
Definition: DDName.cc:87
void MaterialForOnline::endJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 145 of file MaterialForOnline.cc.

145  {
146 }