//----------------------------------------------------------------------------
// $Id: GoDiag.C,v 1.4 2001/06/21 23:42:23 toshi Exp $
//----------------------------------------------------------------------------
// $Log: GoDiag.C,v $
// Revision 1.4  2001/06/21 23:42:23  toshi
// Add   gSystem->Load("libLCDStdHEPUtil") according to the change of LCDROOT 3.2.
//
// Revision 1.3  2001/05/11 21:52:25  toshi
// Remove .so suffix from gSystem->Load("...") in order to call macros from
// Windows system.
//
// Revision 1.2  2001/05/09 21:54:45  toshi
// Add cvs tag $Id: GoDiag.C,v 1.4 2001/06/21 23:42:23 toshi Exp $.
//
//
// Sample macro to run McDiag
//                               Aug 29 2000 M. Iwasaki
//
// This sample macro will make a file in stdHep format of identical 10 Gev pi+
//
// :: How to use ::
// 
// 1) type root
// 2)
//     root [0]  .x GoDiag.C
// 
// .. that's it.
//
// For example, if you like to generate 300 events, type like
//     root [0]  .x GoDiag.C(300)
//



Int_t GoDiag(Int_t nEvent = 1000)
{
  gROOT->Reset();

  // In order to refer to shareable libraries in this simple form,
  // include their paths in a .rootrc file.
  gSystem->Load("libLCDRootAppsUtil");
  gSystem->Load("libLCDStdHEPUtil");

  Char_t *fname = "piplus25.dat";   // Output file name
  LCDMCDiag mc(fname);

  // args are momentum, cos(theta), phi
  mc.Set_Momentum(10.0, 0.5, TMath::Pi()/2);

  // For particle type, use StdHep numbering scheme.  Currently (3/23/99)
  // supported types are
  //    11            electron
  //    13            muon
  //   111            pi-zero
  //   211            pi-plus
  //  2112            neutron
  //  2212            proton
  //   321            k-plus
  //   310            k0-short
  //   130            k0-long
 
  mc.Set_Type(211);
  
  mc.Set_Particles(1);
  
  mc.Set_Seed(0);

  for(Int_t i=0; i < nEvent; i++){
    mc.doit();
    mc.spew(fname);
  }

  mc.cleanup();

}
