source: branches/start/MagicSoft/Simulation/Detector/include-MC/MCCphoton.hxx@ 14065

Last change on this file since 14065 was 295, checked in by harald, 25 years ago
In this directory you can find a implementation to write and read the output of the reflector program. This classes are needed in the reflector and the camera program. The work in the past was done by Jose Carlos Gonzales. In the future all can work on this using CVS.
File size: 3.5 KB
Line 
1/////////////////////////////////////////////////////////////////
2//
3// MCCphoton
4//
5// Created: Tue Apr 28 16:43:30 1998
6// Author: Jose Carlos Gonzales
7// Purpose: Base class for Particles/Cherenkov photons
8// Notes:
9//
10/////////////////////////////////////////////////////////////////
11
12// @T \newpage
13
14// @section Source code of {\tt MCCphoton.hxx}
15
16/* @text
17This section shows the include file {\tt MCCphoton.hxx}
18@endtext */
19
20#ifndef MCCphoton_Class
21#define MCCphoton_Class
22
23// @subsection Include files
24
25// @code
26#ifdef __ROOT__
27#include "TROOT.h"
28#include "TObject.h"
29#else // not __ROOT__
30#include "Rtypes.h"
31#endif
32
33#include <iostream.h>
34#include <iomanip.h>
35#include <fstream.h>
36#include <stdlib.h>
37#include <string.h>
38#include <math.h>
39
40#include "jcmacros.h"
41
42// const char variables to use in MCCphoton::isA() function
43
44const char FLAG_START_OF_RUN[] = "START-RUN-START-RUN-START-RUN-START-RUN-";
45const char FLAG_START_OF_EVENT[] = "START-EVENT-START-EVENT-START-EVENT-STAR";
46const char FLAG_END_OF_EVENT[] = "END-EVENT-END-EVENT-END-EVENT-END-EVENT-";
47const char FLAG_END_OF_RUN[] = "END-RUN-END-RUN-END-RUN-END-RUN-END-RUN-";
48const char FLAG_END_OF_FILE[] = "END-FILE-END-FILE-END-FILE-END-FILE-END-";
49const char FLAG_END_OF_STDIN[] = "END-STDIN-END-STDIN-END-STDIN-END-STDIN-";
50
51#define SIZE_OF_FLAGS 40
52
53// @endcode
54
55// @subsection Class {\em MCCphoton}: Definition
56
57// @code
58
59class MCCphoton {
60
61public:
62 Float_t w; // wavelength [nm/-] +
63 // 1000*(id_generator)
64 Float_t x, y; // position in the camera [cm]
65 Float_t u, v; // director cosines
66 Float_t t; // time since first interaction [ns]
67 // till the camera
68 Float_t h; // height [cm]
69 Float_t phi; // incident angle in the camera [rad]
70
71public:
72 MCCphoton() {} // default constructor
73
74 // overloaded constructor
75 MCCphoton( ifstream &is ) { MCCphoton::read( is ); }
76
77 virtual ~MCCphoton() {} // default destructor
78
79 // reads photon from binary input stream
80 Int_t read ( ifstream &is ) {
81 int n;
82 is.read ( (char *)this, mysize() );
83 return is.gcount();
84 }
85
86 // writes photon to binary output stream
87 Int_t write ( ofstream &os ) {
88 os.write ( (char *)this, mysize() );
89 return 0;
90 }
91
92 // get information about the photon
93 inline Float_t get_wl( void ) { return ( w - 1000.*((int)floor(w/1000.))); }
94 inline Int_t get_particle( void ) {
95 return ( (int)floor(w/1000.) );
96 }
97
98 inline Float_t get_x( void ) { return ( x ); }
99 inline Float_t get_y( void ) { return ( y ); }
100 inline Float_t get_u( void ) { return ( u ); }
101 inline Float_t get_v( void ) { return ( v ); }
102 inline Float_t get_h( void ) { return ( h ); }
103 inline Float_t get_t( void ) { return ( t ); }
104 inline Float_t get_phi( void ) { return ( phi ); }
105
106 inline Float_t get_r( void ) { return ( sqrt( x*x + y*y ) ); }
107 inline Float_t get_w( void ) { return ( sqrt( 1.0 - u*u - v*v ) ); }
108
109 inline void fill(Float_t thew,
110 Float_t thex, Float_t they,
111 Float_t theu, Float_t thev,
112 Float_t theh, Float_t thet,
113 Float_t thephi) {
114 w = thew;
115 x = thex;
116 y = they;
117 u = theu;
118 v = thev;
119 h = theh;
120 t = thet;
121 phi = thephi;
122 }
123
124 int isA( const char * flag ) {
125 return ( (strncmp((char *)this, flag, 8)==0) ? TRUE : FALSE );
126 }
127
128 inline int mysize(void) { return ( sizeof(*this) ); }
129
130};
131
132// @endcode
133
134#endif // not defined MCCphoton_Class
135
Note: See TracBrowser for help on using the repository browser.