source: trunk/MagicSoft/Simulation/Detector/include-CORSIKA/CORParticle.hxx@ 20115

Last change on this file since 20115 was 5112, checked in by moralejo, 20 years ago
Commited changes to adapt header files to current c++ syntaxis.
File size: 3.2 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#include "TROOT.h"
27#include "TObject.h"
28
29#include <iostream>
30#include <iomanip>
31#include <fstream>
32#include <stdlib.h>
33#include <math.h>
34// @endcode
35
36using namespace std;
37
38// @subsection Class {\em CORParticle}: Definition
39
40// @code
41class CORParticle {
42
43public:
44 Float_t w; // wavelength/type of particle [nm/-]
45 Float_t x, y; // position [cm]
46 Float_t u, v; // director cosines
47 Float_t t; // time since first interaction [ns]
48 Float_t h; // height [cm]
49
50public:
51 CORParticle() {} // default constructor
52
53 // overloaded constructor
54 CORParticle( ifstream &is ) { CORParticle::read( is ); }
55
56 // overloaded constructor
57 CORParticle(Float_t thew, Float_t thex, Float_t they,
58 Float_t theu, Float_t thev, Float_t thet, Float_t theh)
59 {
60 w = thew;
61 x = thex;
62 y = they;
63 u = theu;
64 v = thev;
65 t = thet;
66 h = theh;
67 }
68
69 virtual ~CORParticle() {} // default destructor
70
71 // reads photon from binary input stream
72 Int_t read ( ifstream &is ) {
73 is.read ( (char *)(&this->w), 7 * sizeof( Float_t ) ); //
74 return is.gcount();
75 }
76
77 // writes photon to binary output stream
78 Int_t write ( ofstream &os ) {
79 os.write ( (char *)(&this->w), 7 * sizeof( Float_t ) );
80 return 0;
81 }
82
83 // fill information
84 inline void fill(Float_t thew, Float_t thex, Float_t they,
85 Float_t theu, Float_t thev, Float_t thet, Float_t theh)
86 {
87 w = thew;
88 x = thex;
89 y = they;
90 u = theu;
91 v = thev;
92 t = thet;
93 h = theh;
94 }
95
96
97 // print content of one particle
98 inline void print()
99 {
100 cout << " PartId: " << get_particle()
101 << " Pos: " << x << "/" << y
102 << " lam: " << w - 1000.*((int)floor(w/1000.))
103 << " hei: " << h
104 << " tim: " << t
105 << " dir: " << u << "/" << v
106 << endl ;
107 }
108
109 // get information about the photon
110 inline Float_t get_wl( void ) {
111 return ( (w>1.0) ?
112 w - 1000.*((int)floor(w/1000.)) :
113 0.0 );
114 }
115 inline Float_t get_id( void ) { return ( w ); }
116 inline Int_t get_particle( void ) {
117 return ( (int)floor(w/1000.) );
118 }
119 inline Float_t get_x( void ) { return ( x ); }
120 inline Float_t get_y( void ) { return ( y ); }
121 inline Float_t get_u( void ) { return ( u ); }
122 inline Float_t get_v( void ) { return ( v ); }
123 inline Float_t get_h( void ) { return ( h ); }
124 inline Float_t get_t( void ) { return ( t ); }
125
126 inline Float_t get_r( void ) { return ( sqrt( x*x + y*y ) ); }
127 inline Float_t get_w( void ) { return ( sqrt( 1.0 - u*u - v*v ) ); }
128};
129
130// @endcode
131
132#endif // not defined CORParticle_Class
133
Note: See TracBrowser for help on using the repository browser.