//////////////////////////////////////////////////////////////////////////
//                                                                      //
// ATLFBigBang                                                          //
//                                                                      //
// helper class to browse generated particles.                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include <TBrowser.h>
#include <TMCParticle.h>
#include <TClonesArray.h>
#include "ATLFast.h"
#include "ATLFBigBang.h"
#include "ATLFMCMaker.h"
#include "ATLFBrowsable.h"

ClassImp(ATLFBigBang)



//_____________________________________________________________________________
 ATLFBigBang::ATLFBigBang() 
                : TNamed("Histograms","Generated particles browser")
{
   m_Browsables = 0;
}

//_____________________________________________________________________________
 ATLFBigBang::~ATLFBigBang() 
{
  if (m_Browsables) {
     m_Browsables->Delete();
     delete m_Browsables;
     m_Browsables = 0;
  }
}

//_____________________________________________________________________________
 void ATLFBigBang::Browse(TBrowser *b)
{

  ATLFMCMaker *mcarlo = gATLFast->MCMaker();
  TClonesArray *particles = mcarlo->Fruits();
  Int_t nparticles = particles->GetEntriesFast();
  TMCParticle *part;
  ATLFBrowsable *brow;
  char name[64];
  if (!m_Browsables) m_Browsables = new TObjArray(2*nparticles);
  if (m_Browsables->GetSize() < nparticles) m_Browsables->Expand(nparticles);
  for (Int_t i=0;i<nparticles;i++) {
     part = (TMCParticle*)particles->UncheckedAt(i);
     if (part->GetParent()) continue;
     brow = GetBrowsable(i);
     sprintf(name,"%s_%d",part->GetName(),i);
     brow->SetName(name);
     brow->SetRefObject(part);
     b->Add(brow,name);
  }
}

//_____________________________________________________________________________
 ATLFBrowsable *ATLFBigBang::GetBrowsable(Int_t i)
{
  ATLFBrowsable *brow = (ATLFBrowsable*)m_Browsables->At(i);
  if (!brow) {
     brow = new ATLFBrowsable();
     m_Browsables->AddAt(brow, i);
     brow->SetBigBang(this);
  } 
  return brow;
}


ROOT page - Class index - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.