// ----------------------------------------------------------------------------
// $Id: LCDPyj2McPart.cxx,v 1.1 2001/05/15 17:41:24 masako Exp $
// ----------------------------------------------------------------------------
//
// $Log: LCDPyj2McPart.cxx,v $
// Revision 1.1  2001/05/15 17:41:24  masako
// mv LCDPyj2McPart.C to LCDPyj2McPart.cxx .
//
//
#include "LCDPyj2McPart.h"
#include "LCDMcPart.h"
#include "TLorentzVector.h"
#include "TVector3.h"

/////////////////////////////////////////////////////////////////////////
//                                                                       
// LCDPyj2McPart
//                                                                    
// The class LCDPyj2McPart is the class to generate events with pandora
// and convert the generated particles to LCDMcParts.
//
///////////////////////////////////////////////////////////////////////////

ClassImp(LCDPyj2McPart)
///________________________________________________________________________
 LCDPyj2McPart::LCDPyj2McPart() {
  // Default constructor 
  Init();
}

 LCDPyj2McPart::LCDPyj2McPart(TPythia6* py) {
  // Default constructor 
  Init();
  SetPythia6(py);
}

 LCDPyj2McPart::~LCDPyj2McPart() {
  if (f_ownpyj) {
    delete m_pyjdat;
  }
}

 void LCDPyj2McPart::Init() {
  f_ownpyj=kFALSE;
  m_pyjdat=0;
}

 void LCDPyj2McPart::SetPythia6(TPythia6* py) {
  if (m_pyjdat) {
    if (f_ownpyj) {
      delete m_pyjdat;
    } else {
      printf("Wrong setting in LCDPyjMcPart::SetPythia6.n");
      printf("There is a m_pyjdat from somewhere.n");
      printf("Ignore given TPythia6.n");
      return;
    }
  }
  m_pyjdat=py; f_ownpyj=kFALSE;
}

 Int_t LCDPyj2McPart::MakeMcPart(TClonesArray* mclist) {
  if (m_pyjdat == 0) {
    f_ownpyj=kTRUE;
    m_pyjdat=new TPythia6();
  }
  Int_t    statpy;
  Int_t    stathep;
  Int_t    idpy  ;
  Double_t chrgpy;
  LCDMcPart* part;
  LCDMcPart* prnt;
  Int_t    iprnt;
  Int_t nmcpy=m_pyjdat->GetN();
  for (Int_t imcpy=1 ; imcpy <= nmcpy ; imcpy++) {
    statpy = m_pyjdat->GetK(imcpy,1);
    stathep=0;
    if (statpy >  0 && statpy <=  10){ stathep = 1; } 
    if (statpy > 10 && statpy <=  20){ stathep = 2; } 
    if (statpy > 20 && statpy <=  30){ stathep = 3; } 
    if (statpy > 30 && statpy <= 100){ stathep = statpy; } 
    idpy   = m_pyjdat->GetK(imcpy,2);
    chrgpy = partchg(idpy);
    part   = new((*mclist)[imcpy-1]) LCDMcPart();
    part->SetStatus(stathep);
    part->SetParticleID(idpy);
    part->SetCharge(chrgpy);
    part->SetPosition(TVector3(m_pyjdat->GetV(imcpy,1)/10.0,
			       m_pyjdat->GetV(imcpy,2)/10.0,
			       m_pyjdat->GetV(imcpy,3)/10.0));
    part->Set4Momentum(TLorentzVector(m_pyjdat->GetP(imcpy,1),
				      m_pyjdat->GetP(imcpy,2),
				      m_pyjdat->GetP(imcpy,3),
				      m_pyjdat->GetP(imcpy,4)));
    // Fill parent and daughter information
    iprnt=m_pyjdat->GetK(imcpy,3)-1;
    part->SetParentIdx(iprnt);
    if (iprnt>=0) {
      prnt = (LCDMcPart*)(mclist->At(iprnt));
      prnt->SetTermPosition(*part->GetPositionPtr());
    }
  }

  return 1;
}


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.