CMS 3D CMS Logo

MaterialBudgetTxt.cc
Go to the documentation of this file.
3 #include "G4EventManager.hh"
4 #include "G4Event.hh"
5 
6 
8 {
9  const char * fnamechar = fileName.c_str();
10  theFile = new std::ofstream(fnamechar, std::ios::out);
11  std::cout <<"Dumping Material Budget to " << fileName << std::endl;
12  if (theFile->fail()){
13  std::cerr <<" Error opening file" << fileName << std::endl;
14  }
15 }
16 
17 
19 {
20  theFile->close();
21 }
22 
23 
25 {
26  std::cout << " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
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 
32 
34 {
35  (*theFile) << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
36  // std::cout << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
37 
38 }
39 
40 
42 {
43  (*theFile) << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << "finalTrkMB " << theData->getTotalMB() << std::endl;
44 }
45 
float getTotalMB() const
void fillEndTrack() override
void fillStartTrack() override
MaterialBudgetData * theData
std::string getPVname() const
~MaterialBudgetTxt() override
float getEta() const
void fillPerStep() override
float getPhi() const
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
float getRadLen() const
float getTrkLen() const
std::ofstream * theFile
MaterialBudgetTxt(MaterialBudgetData *data, const std::string &fileName)