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

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