| 1 | package Physics::UEMColumn::Photocathode; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | Physics::UEMColumn::Photocathode - Class representing a photocathode for the Physics::UEMColumn simulation | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use strict; | ||
| 10 | use warnings; | ||
| 11 | |||
| 12 | use Physics::UEMColumn alias => ':standard'; | ||
| 13 | |||
| 14 | my $photocathode = Photocathode->new( | ||
| 15 | work_function => '4.25 eV', | ||
| 16 | ); | ||
| 17 | |||
| 18 | # note that $photocathode must have some access to an appropriate Column object | ||
| 19 | |||
| 20 | my $pulse = $photocathode->generate_pulse( 1e8 ); | ||
| 21 | |||
| 22 | =cut | ||
| 23 | |||
| 24 | use Moose; | ||
| 25 | use namespace::autoclean; | ||
| 26 | |||
| 27 | use Method::Signatures; | ||
| 28 | |||
| 29 | use MooseX::Types::NumUnit qw/num_of_unit/; | ||
| 30 | use Physics::UEMColumn::Pulse; | ||
| 31 | use Physics::UEMColumn::Auxiliary qw/:constants/; | ||
| 32 | |||
| 33 | my $type_energy = num_of_unit( 'J' ); | ||
| 34 | |||
| 35 | =head1 ATTRIBUTES | ||
| 36 | |||
| 37 | =over | ||
| 38 | |||
| 39 | =item C<work_function> | ||
| 40 | |||
| 41 | The "work function" of the material. Rquired. Unit: J | ||
| 42 | |||
| 43 | =cut | ||
| 44 | |||
| 45 | has 'work_function' => ( isa => $type_energy, is => 'ro', required => 1 ); | ||
| 46 | |||
| 47 | =item C<location> | ||
| 48 | |||
| 49 | The location of the Photocathode in the Column. This value will be used as the location of the generated Pulse object. The default is C<0>. | ||
| 50 | |||
| 51 | =cut | ||
| 52 | |||
| 53 | has 'location' => ( isa => num_of_unit('m'), is => 'ro', default => 0 ); | ||
| 54 | |||
| 55 | =item C<column> | ||
| 56 | |||
| 57 | Holder for a reference to the containing Column object. This should not be set manually, but will be done by adding the Photocathode object to the Column via its C<photocathode> attribute (either at creation or setter method). | ||
| 58 | |||
| 59 | =cut | ||
| 60 | |||
| 61 | has 'column' => ( isa => 'Physics::UEMColumn::Column', is => 'rw', predicate => 'has_column' ); | ||
| 62 | |||
| 63 | =item C<energy_fermi> | ||
| 64 | |||
| 65 | The Fermi energy of the material. This was required in a previous version of the code (before using the Dowell result), it is no longer required nor used. Unit: J | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | has 'energy_fermi' => ( isa => $type_energy, is => 'ro', predicate => 'has_energy_fermi' ); | ||
| 70 | |||
| 71 | =back | ||
| 72 | |||
| 73 | =head1 METHODS | ||
| 74 | |||
| 75 | =over | ||
| 76 | |||
| 77 | =item C<generate_pulse> | ||
| 78 | |||
| 79 | Takes a number which represents the number of electrons to be put in the pulse. This method uses the available information (some of it from the C<column> attribute) to generate a pulse in the manner of a flat metal photocathode. The behavior of this method is likely to change as the flat metal photocathode really ought to be a subclass of some more generic class. | ||
| 80 | |||
| 81 | =cut | ||
| 82 | |||
| 83 | method generate_pulse ( Num $num ) { | ||
| 84 | die 'Photocathode requires access to column object' unless $self->has_column; | ||
| 85 | my $column = $self->column; | ||
| 86 | |||
| 87 | die 'Not enough information to create pulse' unless $column->can_make_pulse; | ||
| 88 | |||
| 89 | my $laser = $column->laser; | ||
| 90 | my $acc = $column->accelerator; | ||
| 91 | |||
| 92 | my $tau = $laser->duration; | ||
| 93 | my $e_laser = $laser->energy; | ||
| 94 | my $work_function = $self->work_function; | ||
| 95 | my $e_fermi = $self->energy_fermi; | ||
| 96 | |||
| 97 | my $field = $acc->field; | ||
| 98 | |||
| 99 | my $delta_E = $e_laser - $work_function; | ||
| 100 | my $velfront = sqrt( 2 * $delta_E / me ); | ||
| 101 | |||
| 102 | my $eta_t = me / 3 * ( $e_laser - $work_function ); | ||
| 103 | my $sigma_z = (($velfront*$tau)**2) / 2 + ( qe / ( 4 * me ) * $field * ($tau**2))**2; | ||
| 104 | |||
| 105 | my $pulse = Physics::UEMColumn::Pulse->new( | ||
| 106 | velocity => 0, | ||
| 107 | location => $self->location(), | ||
| 108 | number => $num, | ||
| 109 | sigma_t => (($laser->width)**2) / 2, | ||
| 110 | sigma_z => $sigma_z, | ||
| 111 | eta_t => $eta_t, | ||
| 112 | eta_z => $eta_t / 4, | ||
| 113 | gamma_t => 0, | ||
| 114 | gamma_z => sqrt($sigma_z) * ( me * $velfront + qe / sqrt(2) * $field * $tau), | ||
| 115 | ); | ||
| 116 | |||
| 117 | return $pulse; | ||
| 118 | } | ||
| 119 | |||
| 120 | =back | ||
| 121 | |||
| 122 | =cut | ||
| 123 | |||
| 124 | __PACKAGE__->meta->make_immutable; | ||
| 125 | |||
| 126 | 1; | ||
| 127 | |||
| 128 | =head1 SOURCE REPOSITORY | ||
| 129 | |||
| 130 | L<http://github.com/jberger/Physics-UEMColumn> | ||
| 131 | |||
| 132 | =head1 AUTHOR | ||
| 133 | |||
| 134 | Joel Berger, E<lt>joel.a.berger@gmail.comE<gt> | ||
| 135 | |||
| 136 | =head1 COPYRIGHT AND LICENSE | ||
| 137 | |||
| 138 | Copyright (C) 2012-2013 by Joel Berger | ||
| 139 | |||
| 140 | This library is free software; you can redistribute it and/or modify | ||
| 141 | it under the same terms as Perl itself. | ||
| 142 |