source: branches/start/MagicSoft/Simulation/Detector/include-CORSIKA/CORParticle.hxx@ 18123

Last change on this file since 18123 was 294, checked in by harald, 25 years ago
This is a part of the development of Jose Carlos Gonzales. This directory contains some classes to read in the CORSIKA output of the mmcs program. This directory is needed by the reflector program. Now all is under CVS control and one has to take CVS for further developments.
File size: 2.9 KB
Line 
1/////////////////////////////////////////////////////////////////
2//
3// CORParticle
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 CORParticle.hxx}
15
16/* @text
17This section shows the include file {\tt CORParticle.hxx}
18@endtext */
19
20#ifndef CORParticle_Class
21#define CORParticle_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 <math.h>
38// @endcode
39
40// @subsection Class {\em CORParticle}: Definition
41
42// @code
43class CORParticle {
44
45public:
46 Float_t w; // wavelength/type of particle [nm/-]
47 Float_t x, y; // position [cm]
48 Float_t u, v; // director cosines
49 Float_t t; // time since first interaction [ns]
50 Float_t h; // height [cm]
51
52public:
53 CORParticle() {} // default constructor
54
55 // overloaded constructor
56 CORParticle( ifstream &is ) { CORParticle::read( is ); }
57
58 // overloaded constructor
59 CORParticle(Float_t thew, Float_t thex, Float_t they,
60 Float_t theu, Float_t thev, Float_t thet, Float_t theh)
61 {
62 w = thew;
63 x = thex;
64 y = they;
65 u = theu;
66 v = thev;
67 t = thet;
68 h = theh;
69 }
70
71 virtual ~CORParticle() {} // default destructor
72
73 // reads photon from binary input stream
74 Int_t read ( ifstream &is ) {
75 int n;
76 is.read ( (char *)this, 7 * sizeof( Float_t ) ); //
77 return is.gcount();
78 }
79
80 // writes photon to binary output stream
81 Int_t write ( ofstream &os ) {
82 os.write ( (char *)this, 7 * sizeof( Float_t ) );
83 return 0;
84 }
85
86 // fill information
87 inline void fill(Float_t thew, Float_t thex, Float_t they,
88 Float_t theu, Float_t thev, Float_t thet, Float_t theh)
89 {
90 w = thew;
91 x = thex;
92 y = they;
93 u = theu;
94 v = thev;
95 t = thet;
96 h = theh;
97 }
98
99 // get information about the photon
100 inline Float_t get_wl( void ) {
101 return ( (w>1.0) ?
102 w - 1000.*((int)floor(w/1000.)) :
103 0.0 );
104 }
105 inline Float_t get_id( void ) { return ( w ); }
106 inline Int_t get_particle( void ) {
107 return ( (int)floor(w/1000.) );
108 }
109 inline Float_t get_x( void ) { return ( x ); }
110 inline Float_t get_y( void ) { return ( y ); }
111 inline Float_t get_u( void ) { return ( u ); }
112 inline Float_t get_v( void ) { return ( v ); }
113 inline Float_t get_h( void ) { return ( h ); }
114 inline Float_t get_t( void ) { return ( t ); }
115
116 inline Float_t get_r( void ) { return ( sqrt( x*x + y*y ) ); }
117 inline Float_t get_w( void ) { return ( sqrt( 1.0 - u*u - v*v ) ); }
118};
119
120// @endcode
121
122#endif // not defined CORParticle_Class
123
Note: See TracBrowser for help on using the repository browser.