/************************************************************************** * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * * * * Author: The ALICE Off-line Project. * * Contributors are mentioned in the code where appropriate. * * * * Permission to use, copy, modify and distribute this software and its * * documentation strictly for non-commercial purposes is hereby granted * * without fee, provided that the above copyright notice appears in all * * copies and that both the copyright notice and this permission notice * * appear in the supporting documentation. The authors make no claims * * about the suitability of this software for any purpose. It is * * provided "as is" without express or implied warranty. * **************************************************************************/ /* $Id: $ */ #include #include "AliLog.h" #include "TStarLight.h" #include "starlight.h" #include "upcevent.h" #include "AliGenStarLight.h" AliGenStarLight::AliGenStarLight() : AliGenMC() , fTrials(0) , fHeader(NULL) , fSLgenerator(NULL) { } //---------------------------------------------------------------------- AliGenStarLight::AliGenStarLight(Int_t npart) : AliGenMC(npart) , fTrials(0) , fHeader(NULL) , fSLgenerator(NULL) { fSLgenerator = new TStarLight("TStarLight", "StarLight UPC Event Generator", ""); // no config file name } //---------------------------------------------------------------------- AliGenStarLight::~AliGenStarLight() { delete fSLgenerator; fSLgenerator = NULL; if (NULL != fHeader) delete fHeader; fHeader = NULL; } void AliGenStarLight::ImportConfigurationFromFile(const char* filename) { if (NULL == fSLgenerator) { AliFatal("AliGenStarLight class not constructed properly. "); return; } fSLgenerator->ImportConfigurationFromFile(filename); } void AliGenStarLight::SetParameter(const char* line) { if (NULL == fSLgenerator) { AliFatal("AliGenStarLight class not constructed properly. "); return; } fSLgenerator->SetParameter(line); } //---------------------------------------------------------------------- void AliGenStarLight::Init() { if (NULL == fSLgenerator) { AliFatal("AliGenStarLight class not constructed properly. "); return; } fSLgenerator->InitStarLight(); } //---------------------------------------------------------------------- void AliGenStarLight::Generate() { Float_t origin0[4] = {0,0,0,0}; if (fVertexSmear == kPerEvent) { Vertex(); // get vertex for (Int_t i=0; i<3; ++i) origin0[i] = fVertex[i]; origin0[3] = fTime; } Int_t nt(0); // number of tracks const Int_t itp(1); // transport all partiles. const Double_t weight(1.0); Bool_t genOK(kFALSE); fTrials = 0; do { // simulate one event passing all requirements fTrials++; fSLgenerator->GenerateEvent(); fSLgenerator->BoostEvent(); fSLgenerator->ImportParticles(&fParticles, "ALL"); for (size_t i(0), n(fParticles.GetEntries()); i!=n; ++i) { const TParticle *part(dynamic_cast(fParticles.At(i))); const Int_t iparent(-1); //iparent = part->getParent(); //ifDaugh = part->getFirstDaughter(); //ilDaugh = part->getLastDaughter(); const Double_t pol[3] = {0,0,0}; PushTrack(itp, iparent, part->GetPdgCode(), part->Px(), part->Py(), part->Pz(), part->Energy(), origin0[0], origin0[1], origin0[2], origin0[3], pol[0], pol[1], pol[2], kPNoProcess, nt, weight, part->GetStatusCode()); KeepTrack(nt); //cout<<"AliGenStarLight::Generate: fTrials="<SetInputParameters(fSLgenerator->GetInputParameters()); fHeader->SetTrials(fTrials); fHeader->SetEventWeight(1.0); fHeader->SetInteractionTime(orn[3]); fHeader->SetNProduced(np); const TArrayF vertexPosition(3, orn); fHeader->SetPrimaryVertex(vertexPosition); AddHeader(fHeader); } //----------------------------------------------------------------------