CMS 3D CMS Logo

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