Go to the documentation of this file.00001 #ifndef SimG4CorePrintGeomInfo_PrintMaterialBudgetInfo_H
00002 #define SimG4CorePrintGeomInfo_PrintMaterialBudgetInfo_H
00003
00004 #include "SimG4Core/Watcher/interface/SimWatcher.h"
00005 #include "SimG4Core/Notification/interface/Observer.h"
00006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00007
00008 #include "G4NavigationHistory.hh"
00009
00010 #include <iostream>
00011 #include <fstream>
00012 #include <vector>
00013 #include <string>
00014
00015 class BeginOfJob;
00016 class BeginOfRun;
00017 class G4LogicalVolume;
00018 class G4VPhysicalVolume;
00019 class G4VSolid;
00020
00021 typedef std::map< G4VPhysicalVolume*, G4VPhysicalVolume*, std::less<G4VPhysicalVolume*> > mpvpv;
00022 typedef std::multimap< G4LogicalVolume*, G4VPhysicalVolume*, std::less<G4LogicalVolume*> > mmlvpv;
00023
00024 class PrintMaterialBudgetInfo : public SimWatcher,
00025 public Observer<const BeginOfJob*>,
00026 public Observer<const BeginOfRun*> {
00027
00028 public:
00029 PrintMaterialBudgetInfo(edm::ParameterSet const & p);
00030 ~PrintMaterialBudgetInfo();
00031 private:
00032 void update(const BeginOfJob* job) {};
00033 void update(const BeginOfRun* run);
00034 void dumpHeader(std::ostream& out = std::cout);
00035 void dumpLaTeXHeader(std::ostream& out = std::cout);
00036 void dumpHierarchyLeaf(G4VPhysicalVolume* pv, G4LogicalVolume* lv, unsigned int leafDepth,
00037 std::ostream& weightOut = std::cout, std::ostream& texOut = std::cout);
00038 void printInfo(G4VPhysicalVolume* pv, G4LogicalVolume* lv, unsigned int leafDepth,
00039 std::ostream& weightOut = std::cout, std::ostream& texOut = std::cout);
00040 void dumpElementMassFraction(std::ostream& elementOut = std::cout);
00041 void dumpLaTeXFooter(std::ostream& out = std::cout);
00042
00043 private:
00044 std::string name;
00045 int nchar;
00046 mpvpv thePVTree;
00047 G4VPhysicalVolume* theTopPV;
00048 G4NavigationHistory fHistory;
00049 bool volumeFound;
00050 unsigned int levelFound;
00051 std::ofstream weightOutputFile;
00052 std::ofstream elementOutputFile;
00053 std::ofstream texOutputFile;
00054 std::vector<std::string> elementNames;
00055 std::vector<double> elementTotalWeight;
00056 std::vector<double> elementWeightFraction;
00057
00058 std::string stringLaTeXUnderscore(std::string stringname);
00059 std::string stringLaTeXSuperscript(std::string stringname);
00060 };
00061
00062 #endif