Linear Collider Forum



Home » Software Tools » org.lcsim » Two naive questions for using Driver
Two naive questions for using Driver [message #1154] Thu, 27 September 2007 13:14 Go to previous message
zhaohw
Messages: 17
Registered: March 2007
Location: SLAC
Hello,

I have two naive questions for using org.lcsim Driver class:

1. How to output some printout into a txt file ?
For example, I want to write out the values of a variable,
say, the energies of particles, into a ASCII file,
myfile.txt, How to do in a Driver ? Can you give me a
code template ?

2. How to use a Driver in a Driver ?
As I know, If you want to use driver A and B in Driver C,
the usual way is:

public class C extends Driver
{
public C(){
add(new A()); // just construct A
add(new B()); // just construct B
}
}

My question is: Supposing Driver A has a method
A.setSomethingOnA(), how do I use this method in
Driver C ?
Are the following code OK for this purpose ?

public class C extends Driver
{
public C(){
add(new A()); // just construct A
A.setSomethingOnA(); //maybe very bad code
add(new B()); // just construct B
}
}

Or,

public class C extends Driver
{
public C(){
Driver A = new Driver();
A.setSomethingOnA();
add(A());
add(new B()); // just construct B
}
}

Thanks,
Haiwen

[Updated on: Thu, 27 September 2007 13:39] by Moderator

 
Read Message
Read Message
Previous Topic:How to use hep.lcd classes in lcsim ?
Next Topic:Reconstructing Events
Goto Forum:
  


Current Time: Sun Apr 22 19:03:38 Pacific Daylight Time 2018
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.1.
Copyright ©2001-2010 FUDforum Bulletin Board Software