CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
TkSimHitPrinter.cc
Go to the documentation of this file.
2 
3 #include <iomanip>
4 #include <fstream>
5 
6 #include "G4Track.hh"
7 
8 std::ofstream * TkSimHitPrinter::theFile(0);
9 
11  if (theFile) return;
12  const char* theName = filename.c_str();
13  theFile = new std::ofstream(theName, std::ios::out);
14 }
15 
17  // theFile->close();
18 }
19 
21  (*theFile) <<"Event: "<<eve<<" "<<s<<" "<<d<<" "<<i<<" Track "<<j;
22 }
23 
25  (*theFile) << " Local: "<<p.x()<<" "<<p.y()<<" "<<p.z()
26  <<" ; "<<e.x()<<" "<<e.y()<<" "<<e.z();
27 }
28 
30  (*theFile) << " Global: "<<p.x()<<" "<<p.y()<<" "<<p.z()
31  <<" ; "<<e.x()<<" "<<e.y()<<" "<<e.z();
32 }
33 
34 void TkSimHitPrinter::printHitData(float energy, float tof) const {
35  (*theFile)<< " Energy: "<<energy<<" ToF: "<<tof;
36 }
38  (*theFile)<<" Momentum "<<m*sign<<" Particle "<<s;
39 }
40 void TkSimHitPrinter::printGlobalMomentum(float px, float py,float pz)const {
41  (*theFile)<<" Momentum "<<px<<" "<<py<<" "<<pz<<std::endl;
42 }
44  float dr;
45  dr = p.x()*(e-p).x()+ p.y()*(e-p).y()+p.z()*(e-p).z();
46  if (dr>0) return +1;
47  return -1;
48 }
int i
Definition: DBlmapReader.cc:9
TkSimHitPrinter(std::string)
double sign(double x)
void printMomentumOfTrack(float, std::string, int sign) const
T y() const
Definition: PV3DBase.h:63
void printHitData(float, float) const
void printGlobalMomentum(float, float, float) const
tuple d
Definition: ztail.py:151
static std::ofstream * theFile
T z() const
Definition: PV3DBase.h:64
void printGlobal(Local3DPoint, Local3DPoint) const
int j
Definition: DBlmapReader.cc:9
tuple out
Definition: dbtoconf.py:99
void startNewSimHit(std::string, std::string, int, int, int)
void printLocal(Local3DPoint, Local3DPoint) const
tuple filename
Definition: lut2db_cfg.py:20
int getPropagationSign(Local3DPoint, Local3DPoint)
T x() const
Definition: PV3DBase.h:62