Permalink
Browse files

Merge branch 'trigger'

  • Loading branch information...
2 parents 41fa0f6 + 7ba454f commit 100c35de623ff25ccca2c3d80860f4986d81a252 @jberger committed Sep 26, 2012
Showing with 25 additions and 2 deletions.
  1. +23 −2 lib/Physics/UEMColumn/Column.pm
  2. +2 −0 lib/Physics/UEMColumn/Photocathode.pm
@@ -44,15 +44,36 @@ Holder for an optional L<Physics::UEMColumn::Accelerator> object. Predicate: C<h
=cut
-has accelerator => ( isa => 'Physics::UEMColumn::Accelerator', is => 'ro', predicate => 'has_accelerator' );
+has accelerator => (
+ isa => 'Physics::UEMColumn::Accelerator',
+ is => 'ro',
+ predicate => 'has_accelerator',
+# trigger => \&_trigger_accelerator,
+);
+
+#method _trigger_accelerator ($acc, $old_acc?) {
+# my $elements = $self->elements;
+
+# if (eval{ $elements->[0]->isa('Physics::UEMColumn::Accelerator') }) {
+# shift @$elements;
+# }
+
+# unshift @$elements, $acc;
+
+#}
=item C<photocathode>
Holder for an optional L<Physics::UEMColumn::Photocathode> object. Predicate: C<has_photocathode>.
=cut
-has photocathode => ( isa => 'Physics::UEMColumn::Photocathode', is => 'ro', predicate => 'has_photocathode' );
+has photocathode => (
+ isa => 'Physics::UEMColumn::Photocathode',
+ is => 'ro',
+ predicate => 'has_photocathode',
+# trigger => sub { $_[1]->column( $_[0] ) },
+);
=item C<elements>
@@ -38,6 +38,8 @@ method generate_pulse ( Num $num ) {
die 'Photocathode requires access to column object' unless $self->has_column;
my $column = $self->column;
+ die 'Not enough information to create pulse' unless $column->can_make_pulse;
+
my $laser = $column->laser;
my $acc = $column->accelerator;

0 comments on commit 100c35d

Please sign in to comment.