forked from alisw/AliRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
172 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
/************************************************************************** | ||
* 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 <Riostream.h> | ||
#include "AliLog.h" | ||
#include "TDime.h" | ||
#include "AliRunLoader.h" | ||
#include "AliGenEventHeader.h" | ||
#include "AliGenDime.h" | ||
#include "AliGenMC.h" | ||
|
||
ClassImp(AliGenDime); | ||
|
||
AliGenDime::AliGenDime() | ||
: AliGenMC() | ||
, fDMgenerator(NULL) { | ||
} | ||
|
||
//---------------------------------------------------------------------- | ||
AliGenDime::AliGenDime(Int_t npart) | ||
: AliGenMC(npart) | ||
, fDMgenerator(new TDime()) | ||
{ | ||
// | ||
} | ||
|
||
//---------------------------------------------------------------------- | ||
AliGenDime::~AliGenDime() { | ||
if (NULL != fDMgenerator) delete fDMgenerator; | ||
fDMgenerator = NULL; | ||
} | ||
|
||
//---------------------------------------------------------------------- | ||
void AliGenDime::Init() { | ||
if (NULL == fDMgenerator) { | ||
AliFatal("AliGenDime class not constructed properly. "); | ||
return; | ||
} | ||
fDMgenerator->Initialize(); | ||
} | ||
|
||
//---------------------------------------------------------------------- | ||
void AliGenDime::Generate() { | ||
|
||
// Generate one event --> | ||
|
||
const Float_t polar[3] = {0,0,0}; | ||
Float_t vpos[4] = {0,0,0,0}; | ||
|
||
// Set collision vertex position | ||
if (fVertexSmear == kPerEvent) { | ||
Vertex(); | ||
for (Int_t i = 0; i < 3; ++i) { | ||
vpos[i] = fVertex[i]; | ||
} | ||
vpos[3] = fTime; | ||
} | ||
|
||
Int_t nt = 0; // number of tracks | ||
|
||
// Generate events, store into fParticles | ||
fDMgenerator->GenerateEvent(); | ||
fDMgenerator->ImportParticles(&fParticles, "All"); | ||
|
||
const Int_t iparent = -1; | ||
const Float_t weight = 1.0; | ||
|
||
fNprimaries = 0; | ||
|
||
// Loop over particles | ||
for (Int_t i = 0; i < fParticles.GetEntries(); ++i) { | ||
|
||
const TParticle* part = (TParticle*)fParticles.At(i); | ||
if (part == NULL) { | ||
AliFatal("part == NULL"); | ||
return; | ||
} | ||
|
||
if (part->GetStatusCode() == 1) { // Push final states only | ||
|
||
PushTrack(fTrackIt, iparent, part->GetPdgCode(), | ||
part->Px(), part->Py(), part->Pz(), part->Energy(), | ||
vpos[0], vpos[1], vpos[2], vpos[3], | ||
polar[0], polar[1], polar[2], | ||
kPPrimary, nt, weight, part->GetStatusCode()); | ||
|
||
AliInfo(Form("weight=%.0f nt=%d fTrackIt=%d statusCode=%d", | ||
weight, nt, fTrackIt, part->GetStatusCode())); | ||
part->Print(); | ||
KeepTrack(nt); | ||
++fNprimaries; | ||
} | ||
} | ||
// Clear particles for the next event | ||
fParticles.Clear(); | ||
|
||
// Make header | ||
AliGenEventHeader* header = new AliGenEventHeader("Dime"); | ||
const TArrayF vertexPosition(3, vpos); | ||
header->SetPrimaryVertex(vertexPosition); | ||
header->SetInteractionTime(vpos[3]); | ||
header->SetNProduced(nt); | ||
|
||
// Pass header | ||
AddHeader(header); | ||
SetHighWaterMark(nt); | ||
AliRunLoader::Instance()->CdGAFile(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#ifndef ALIGENDIME_H | ||
#define ALIGENDIME_H | ||
|
||
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | ||
* See cxx source for full Copyright notice */ | ||
|
||
/* $Id: $ */ | ||
|
||
// Interface to AliRoot of the DIME generator. | ||
// Author: [email protected] | ||
|
||
//- Root Includes | ||
#include <TString.h> | ||
#include <TParticle.h> | ||
#include "TDime.h" | ||
|
||
//- AliRoot Includes | ||
#include "AliGenMC.h" | ||
|
||
class AliGenDime : public AliGenMC { | ||
public: | ||
AliGenDime(); | ||
AliGenDime(Int_t npart); | ||
|
||
virtual ~AliGenDime(); | ||
|
||
virtual void Init(); | ||
virtual void Generate(); | ||
|
||
TDime *GetTDime() { | ||
return (TDime*) fDMgenerator; | ||
} | ||
Bool_t NoDaughters(const TParticle *p) const { | ||
return (p->GetFirstDaughter() < 0); | ||
} | ||
TDime* GetDimeGenerator() const { | ||
return fDMgenerator; | ||
} | ||
|
||
private: | ||
AliGenDime(const AliGenDime &p); | ||
AliGenDime& operator=(const AliGenDime &p); | ||
|
||
TDime* fDMgenerator; //! Pointer to Dime Generator | ||
|
||
ClassDef(AliGenDime, 1); // DIME parameterisation generator | ||
}; | ||
|
||
#endif | ||
|