CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/Validation/Geometry/src/MaterialBudgetTxt.cc

Go to the documentation of this file.
00001 #include "Validation/Geometry/interface/MaterialBudgetTxt.h"
00002 #include "Validation/Geometry/interface/MaterialBudgetData.h"
00003 #include "G4EventManager.hh"
00004 #include "G4Event.hh"
00005 
00006 
00007 MaterialBudgetTxt::MaterialBudgetTxt( MaterialBudgetData* data, const std::string& fileName ): MaterialBudgetFormat( data )
00008 {
00009   const char * fnamechar = fileName.c_str();
00010   theFile = new std::ofstream(fnamechar, std::ios::out);
00011   std::cout <<"Dumping  Material Budget to " << fileName << std::endl;
00012   if (theFile->fail()){
00013     std::cerr <<" Error opening file" << fileName << std::endl;
00014   }
00015 }
00016 
00017 
00018 MaterialBudgetTxt::~MaterialBudgetTxt()
00019 {
00020   theFile->close();
00021 }
00022 
00023 
00024 void MaterialBudgetTxt::fillStartTrack()
00025 {
00026    std::cout << " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
00027   (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << theData->getEta() << " " << theData->getPhi() << std::endl;
00028   // + 1 was GEANT3 notation    (*theFile)<< " Track "<< G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() + 1<< " " << theData->getEta() << " " << theData->getPhi() << std::endl;
00029 
00030 }
00031 
00032 
00033 void MaterialBudgetTxt::fillPerStep()
00034 {
00035   (*theFile) << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo()  << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
00036   //    std::cout << "step "<< theData->getTrkLen() << " " << theData->getPVname() << " " << theData->getPVcopyNo()  << " " << theData->getTotalMB() << " " << theData->getRadLen() << std::endl;
00037 
00038 }
00039 
00040 
00041 void MaterialBudgetTxt::fillEndTrack()
00042 {
00043   (*theFile) << G4EventManager::GetEventManager()->GetConstCurrentEvent()->GetEventID() << " " << "finalTrkMB " << theData->getTotalMB() << std::endl;
00044 }
00045