CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Private Attributes
SimHitPrinter Class Reference

#include <SimHitPrinter.h>

Public Member Functions

void printEloss (float) const
 
void printGlobal (GlobalPoint) const
 
void printId (int) const
 
void printLocal (LocalPoint, LocalPoint) const
 
void printPabs (float) const
 
void printTrack (int) const
 
 SimHitPrinter (std::string)
 
void startNewEvent (int)
 
void startNewSimHit (std::string)
 
 ~SimHitPrinter ()
 

Static Private Attributes

static std::ofstream * theFile
 

Detailed Description

class to print sim hits for validation and debugging

Author
Tommaso Boccali Tomma.nosp@m.so.B.nosp@m.occal.nosp@m.i@ce.nosp@m.rn.ch Arno Straesser Arno..nosp@m.Stra.nosp@m.essne.nosp@m.r@ce.nosp@m.rn.ch

Modification:

Definition at line 22 of file SimHitPrinter.h.

Constructor & Destructor Documentation

SimHitPrinter::SimHitPrinter ( std::string  filename)

Definition at line 8 of file SimHitPrinter.cc.

References dbtoconf::out, and theFile.

8  {
9  if (theFile) return;
10  const char* theName = filename.c_str();
11  theFile = new std::ofstream(theName, std::ios::out);
12 }
static std::ofstream * theFile
Definition: SimHitPrinter.h:37
tuple out
Definition: dbtoconf.py:99
tuple filename
Definition: lut2db_cfg.py:20
SimHitPrinter::~SimHitPrinter ( )

Definition at line 14 of file SimHitPrinter.cc.

14  {
15  // theFile->close();
16 }

Member Function Documentation

void SimHitPrinter::printEloss ( float  eloss) const

Definition at line 56 of file SimHitPrinter.cc.

References gather_cfg::cout.

56  {
57  std::cout << " Eloss: "<<eloss<<std::endl;
58  (*theFile) << " e "<<eloss;
59 }
tuple cout
Definition: gather_cfg.py:121
void SimHitPrinter::printGlobal ( GlobalPoint  global) const

Definition at line 74 of file SimHitPrinter.cc.

References gather_cfg::cout, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonSensitiveDetector::saveHit().

74  {
75  (*theFile).width(10);
76  (*theFile).setf(std::ios::right,std::ios::adjustfield);
77  (*theFile).setf(std::ios::floatfield);
78  (*theFile).precision(6);
79  std::cout << " Global(en): "<<global.x()<<" "<< global.y()<<" "
80  <<global.z()<<std::endl;
81  (*theFile) << " gl "<<global.x()<<" "<< global.y()<<" "
82  <<global.z()<<std::endl;
83 }
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
void SimHitPrinter::printId ( int  id) const

Definition at line 35 of file SimHitPrinter.cc.

References gather_cfg::cout.

Referenced by MuonSensitiveDetector::saveHit().

35  {
36  std::cout << " Id: "<<id<<std::endl;
37  (*theFile) << " id ";
38  (*theFile).width(10);
39  (*theFile).setf(std::ios::right,std::ios::adjustfield);
40  (*theFile) <<id;
41 }
tuple cout
Definition: gather_cfg.py:121
void SimHitPrinter::printLocal ( LocalPoint  localen,
LocalPoint  localex 
) const

Definition at line 61 of file SimHitPrinter.cc.

References gather_cfg::cout, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by MuonSensitiveDetector::saveHit().

61  {
62  (*theFile).width(10);
63  (*theFile).setf(std::ios::right,std::ios::adjustfield);
64  (*theFile).setf(std::ios::floatfield);
65  (*theFile).precision(6);
66  std::cout << " Local(en/ex): "<<localen.x()<<" "<< localen.y()<<" "
67  <<localen.z()<<" / "<<localex.x()<<" "<< localex.y()<<" "
68  <<localex.z()<<std::endl;
69  (*theFile) << " en/ex "<<localen.x()<<" "<< localen.y()<<" "
70  <<localen.z()<<" / "<<localex.x()<<" "<< localex.y()<<" "
71  <<localex.z();
72 }
T y() const
Definition: PV3DBase.h:63
T z() const
Definition: PV3DBase.h:64
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:62
void SimHitPrinter::printPabs ( float  pabs) const

Definition at line 51 of file SimHitPrinter.cc.

References gather_cfg::cout.

51  {
52  std::cout << " Pabs: "<<pabs<<std::endl;
53  (*theFile) << " p "<<pabs;
54 }
tuple cout
Definition: gather_cfg.py:121
void SimHitPrinter::printTrack ( int  id) const

Definition at line 43 of file SimHitPrinter.cc.

References gather_cfg::cout.

43  {
44  std::cout << " Track: "<<id<<std::endl;
45  (*theFile) << " trk ";
46  (*theFile).width(10);
47  (*theFile).setf(std::ios::right,std::ios::adjustfield);
48  (*theFile) << id;
49 }
tuple cout
Definition: gather_cfg.py:121
void SimHitPrinter::startNewEvent ( int  num)

Definition at line 31 of file SimHitPrinter.cc.

31  {
32  (*theFile) << "Event "<<num<<std::endl;
33 }
void SimHitPrinter::startNewSimHit ( std::string  s)

Definition at line 18 of file SimHitPrinter.cc.

References gather_cfg::cout, and alignCSCRings::s.

Referenced by MuonSensitiveDetector::saveHit().

18  {
19  std::cout.width(10);
20  std::cout.setf(std::ios::right,std::ios::adjustfield);
21  std::cout.setf(std::ios::scientific,std::ios::floatfield);
22  std::cout.precision(6);
23  std::cout << "SimHit in "<<s<<std::endl;
24  (*theFile).width(10);
25  (*theFile).setf(std::ios::right,std::ios::adjustfield);
26  (*theFile).setf(std::ios::scientific|std::ios::uppercase|std::ios::showpos,std::ios::floatfield);
27  (*theFile).precision(5);
28  (*theFile) << "SimHit in "<<s;
29 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::ofstream * SimHitPrinter::theFile
staticprivate

Definition at line 37 of file SimHitPrinter.h.

Referenced by SimHitPrinter().