CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
MaterialBudgetTxt Class Reference

#include <MaterialBudgetTxt.h>

Inheritance diagram for MaterialBudgetTxt:
MaterialBudgetFormat

Public Member Functions

void fillEndTrack () override
 
void fillPerStep () override
 
void fillStartTrack () override
 
 MaterialBudgetTxt (std::shared_ptr< MaterialBudgetData > data, const std::string &fileName)
 
 ~MaterialBudgetTxt () override
 
- Public Member Functions inherited from MaterialBudgetFormat
 MaterialBudgetFormat (std::shared_ptr< MaterialBudgetData > data)
 
virtual ~MaterialBudgetFormat ()
 

Private Attributes

std::ofstream * theFile
 

Additional Inherited Members

- Protected Attributes inherited from MaterialBudgetFormat
std::shared_ptr< MaterialBudgetDatatheData
 
std::string theFileName
 

Detailed Description

Definition at line 9 of file MaterialBudgetTxt.h.

Constructor & Destructor Documentation

MaterialBudgetTxt::MaterialBudgetTxt ( std::shared_ptr< MaterialBudgetData data,
const std::string &  fileName 
)

Definition at line 7 of file MaterialBudgetTxt.cc.

References MessageLogger_cfi::cerr, gather_cfg::cout, MillePedeFileConverter_cfg::out, and theFile.

9 {
10  const char * fnamechar = fileName.c_str();
11  theFile = new std::ofstream(fnamechar, std::ios::out);
12  std::cout <<"Dumping Material Budget to " << fileName << std::endl;
13  if (theFile->fail()){
14  std::cerr <<" Error opening file" << fileName << std::endl;
15  }
16 }
MaterialBudgetFormat(std::shared_ptr< MaterialBudgetData > data)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
std::ofstream * theFile
MaterialBudgetTxt::~MaterialBudgetTxt ( )
override

Definition at line 19 of file MaterialBudgetTxt.cc.

References theFile.

20 {
21  theFile->close();
22 }
std::ofstream * theFile

Member Function Documentation

void MaterialBudgetTxt::fillEndTrack ( )
overridevirtual

Implements MaterialBudgetFormat.

Definition at line 42 of file MaterialBudgetTxt.cc.

References MaterialBudgetFormat::theData.

43 {
44  (*theFile) << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << "finalTrkMB " << theData->getTotalMB() << std::endl;
45 }
std::shared_ptr< MaterialBudgetData > theData
void MaterialBudgetTxt::fillPerStep ( )
overridevirtual

Implements MaterialBudgetFormat.

Definition at line 34 of file MaterialBudgetTxt.cc.

References MaterialBudgetFormat::theData.

35 {
36  (*theFile) << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
37  //- std::cout << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo() << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
38 
39 }
std::shared_ptr< MaterialBudgetData > theData
void MaterialBudgetTxt::fillStartTrack ( )
overridevirtual

Implements MaterialBudgetFormat.

Definition at line 25 of file MaterialBudgetTxt.cc.

References gather_cfg::cout, and MaterialBudgetFormat::theData.

26 {
27  std::cout << " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
28  (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
29  // + 1 was GEANT3 notation (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() + 1<< " " << theData->getEta() << " " << theData->getPhi() << std::endl;
30 
31 }
std::shared_ptr< MaterialBudgetData > theData

Member Data Documentation

std::ofstream* MaterialBudgetTxt::theFile
private

Definition at line 20 of file MaterialBudgetTxt.h.

Referenced by MaterialBudgetTxt(), and ~MaterialBudgetTxt().