CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SimHitPrinter.cc
Go to the documentation of this file.
2 
3 #include<iomanip>
4 #include<iostream>
5 
6 std::ofstream * SimHitPrinter::theFile(0);
7 
9  if (theFile) return;
10  const char* theName = filename.c_str();
11  theFile = new std::ofstream(theName, std::ios::out);
12 }
13 
15  // theFile->close();
16 }
17 
18 void SimHitPrinter::startNewSimHit(std::string s){
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 }
30 
32  (*theFile) << "Event "<<num<<std::endl;
33 }
34 
35 void SimHitPrinter::printId(int id) const{
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 }
42 
43 void SimHitPrinter::printTrack(int id) const{
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 }
50 
51 void SimHitPrinter::printPabs(float pabs) const{
52  std::cout << " Pabs: "<<pabs<<std::endl;
53  (*theFile) << " p "<<pabs;
54 }
55 
56 void SimHitPrinter::printEloss(float eloss) const{
57  std::cout << " Eloss: "<<eloss<<std::endl;
58  (*theFile) << " e "<<eloss;
59 }
60 
61 void SimHitPrinter::printLocal(LocalPoint localen,LocalPoint localex) const{
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 }
73 
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 }
static std::ofstream * theFile
Definition: SimHitPrinter.h:37
void printTrack(int) const
void printLocal(LocalPoint, LocalPoint) const
T y() const
Definition: PV3DBase.h:62
void startNewEvent(int)
T z() const
Definition: PV3DBase.h:63
void printPabs(float) const
SimHitPrinter(std::string)
Definition: SimHitPrinter.cc:8
void printGlobal(GlobalPoint) const
tuple out
Definition: dbtoconf.py:99
void startNewSimHit(std::string)
void printEloss(float) const
long long int num
Definition: procUtils.cc:71
void printId(int) const
tuple filename
Definition: lut2db_cfg.py:20
tuple cout
Definition: gather_cfg.py:121
T x() const
Definition: PV3DBase.h:61