source: trunk/MagicSoft/Simulation/Detector/include-MC/MCCphoton.hxx@ 4308

Last change on this file since 4308 was 3046, checked in by blanch, 21 years ago
*** empty log message ***
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#include "TROOT.h"
27#include "TObject.h"
28
29#include <iostream.h>
30#include <iomanip.h>
31#include <fstream.h>
32#include <stdlib.h>
33#include <string.h>
34#include <math.h>
35
36#include "jcmacros.h"
37
38// const char variables to use in MCCphoton::isA() function
39
40const char FLAG_START_OF_RUN[] = "\nSTART---RUN\n";
41const char FLAG_START_OF_HEADER[] = "RUNH";
42const char FLAG_START_OF_EVENT[] = "\nSTART-EVENT\n";
43const char FLAG_EVENT_HEADER[] = "EVTH";
44const char FLAG_END_OF_EVENT[] = "\nEND---EVENT\n";
45const char FLAG_END_OF_RUN[] = "\nEND-----RUN\n";
46const char FLAG_END_OF_FILE[] = "\nEND----FILE\n";
47const char FLAG_END_OF_STDIN[] = "\nEND---STDIN\n";
48
49#define SIZE_OF_FLAGS 13
50#define SIZE_OF_HEADER 8 /* floats */
51#define SIZE_OF_MCCPHOTON 8 /* floats */
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 is.read ( (char *)this, mysize() );
82 return is.gcount();
83 }
84
85 // writes photon to binary output stream
86 Int_t write ( ofstream &os ) {
87 os.write ( (char *)this, mysize() );
88 return 0;
89 }
90
91 // get information about the photon
92 inline Float_t get_wl( void ) { return ( w - 1000.*((int)floor(w/1000.))); }
93 inline Int_t get_particle( void ) {
94 return ( (int)floor(w/1000.) );
95 }
96
97 inline Float_t get_x( void ) { return ( x ); }
98 inline Float_t get_y( void ) { return ( y ); }
99 inline Float_t get_u( void ) { return ( u ); }
100 inline Float_t get_v( void ) { return ( v ); }
101 inline Float_t get_h( void ) { return ( h ); }
102 inline Float_t get_t( void ) { return ( t ); }
103 inline Float_t get_phi( void ) { return ( phi ); }
104
105 inline Float_t get_r( void ) { return ( sqrt( x*x + y*y ) ); }
106 inline Float_t get_w( void ) { return ( sqrt( 1.0 - u*u - v*v ) ); }
107
108 inline void fill(Float_t thew,
109 Float_t thex, Float_t they,
110 Float_t theu, Float_t thev,
111 Float_t theh, Float_t thet,
112 Float_t thephi) {
113 w = thew;
114 x = thex;
115 y = they;
116 u = theu;
117 v = thev;
118 h = theh;
119 t = thet;
120 phi = thephi;
121 }
122
123 int isA( const char * flag ) {
124 return ( (strncmp((char *)this, flag, 8)==0) ? TRUE : FALSE );
125 }
126
127 inline int mysize(void) { return ( SIZE_OF_MCCPHOTON*sizeof(float) ); }
128
129};
130
131// @endcode
132
133#endif // not defined MCCphoton_Class
134
Note: See TracBrowser for help on using the repository browser.