CMS 3D CMS Logo

MaterialBudgetTxt.cc
Go to the documentation of this file.
3 #include "G4EventManager.hh"
4 #include "G4Event.hh"
5 
6 
7 MaterialBudgetTxt::MaterialBudgetTxt( std::shared_ptr<MaterialBudgetData> data, const std::string& fileName )
8  : MaterialBudgetFormat( data )
9 {
10  const char * fnamechar = fileName.c_str();
11  theFile = new std::ofstream(fnamechar, std::ios::out);
12  edm::LogInfo("MaterialBudget") << "MaterialBudgetTxt: Dumping Material Budget to " << fileName;
13  if (theFile->fail()){
14  edm::LogError("MaterialBudget") <<"MaterialBudgetTxt: Error opening file" << fileName;
15  }
16 }
17 
18 
20 {
21 }
22 
23 
25 {
26 
27  (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
28  // + 1 was GEANT3 notation (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() + 1<< " " << theData->getEta() << " " << theData->getPhi() << std::endl;
29 }
30 
31 
33 {
34  (*theFile) << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
35  //- std::cout << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
36 
37 }
38 
39 
41 {
42  (*theFile) << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << "finalTrkMB " << theData->getTotalMB() << std::endl;
43 }
44 
46 {
47  theFile->close();
48 }
void fillEndTrack() override
void fillStartTrack() override
MaterialBudgetTxt(std::shared_ptr< MaterialBudgetData > data, const std::string &fileName)
~MaterialBudgetTxt() override
void endOfRun() override
void fillPerStep() override
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::ofstream * theFile
std::shared_ptr< MaterialBudgetData > theData