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 
20 void TkSimHitPrinter::startNewSimHit(std::string s, std::string d, int i,int j,int eve){
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 }
37 void TkSimHitPrinter::printMomentumOfTrack(float m, std::string s, int sign)const {
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)
void printMomentumOfTrack(float, std::string, int sign) const
T y() const
Definition: PV3DBase.h:62
void printHitData(float, float) const
void printGlobalMomentum(float, float, float) const
double double double z
static std::ofstream * theFile
T z() const
Definition: PV3DBase.h:63
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
x
Definition: VDTMath.h:216
int getPropagationSign(Local3DPoint, Local3DPoint)
T x() const
Definition: PV3DBase.h:61