Skip to content

Commit

Permalink
EM Cocktail: json files + Exodus (#15)
Browse files Browse the repository at this point in the history
* Adding GeneratorSpectator: generator for spectator protons (#9)

* Adding a test macro for GeneratorSpectators

* Set pmax in def. constructor to avoid infinite loop in generation + small fixes

* add GeneratorParamEMlib for LMee simulations (methods from AliGenEMlib) (#10)

* Use VMC standalone if found

* account for VMC standalone

* implemented .json file format for parametrization files

* added Exodus decayer

* bugfix Exodus, updated use of PythiaDecayerConfig in GeneratorParam

---------

Co-authored-by: Chiara <[email protected]>
Co-authored-by: ffionda <[email protected]>
Co-authored-by: Benedikt Volkel <[email protected]>
  • Loading branch information
4 people authored Mar 28, 2023
1 parent 16f18ba commit 4f84681
Show file tree
Hide file tree
Showing 10 changed files with 1,509 additions and 168 deletions.
9 changes: 8 additions & 1 deletion GeneratorCosmics/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ find_package(ROOT REQUIRED COMPONENTS EG)
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})

#---VMC
# set by VMC standalone, in ROOT case we don't use it
set(VMC_LIBRARIES)
if(NOT ROOT_vmc_FOUND)
find_package(VMC REQUIRED)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.)

set(HEADERS GeneratorCosmics.h)
Expand All @@ -20,7 +27,7 @@ ROOT_GENERATE_DICTIONARY(G__GeneratorCosmics ${HEADERS} LINKDEF GeneratorCosmics

#---Create a shared library with geneated dictionary
add_library(GeneratorCosmics SHARED GeneratorCosmics.cxx G__GeneratorCosmics.cxx)
target_link_libraries(GeneratorCosmics ${ROOT_LIBRARIES})
target_link_libraries(GeneratorCosmics ${ROOT_LIBRARIES} ${VMC_LIBRARIES})


set_target_properties(GeneratorCosmics
Expand Down
13 changes: 10 additions & 3 deletions GeneratorParam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@ find_package(ROOT REQUIRED COMPONENTS EG)
#---Define useful ROOT functions and macros (e.g. ROOT_GENERATE_DICTIONARY)
include(${ROOT_USE_FILE})

#---VMC
# set by VMC standalone, in ROOT case we don't use it
set(VMC_LIBRARIES)
if(NOT ROOT_vmc_FOUND)
find_package(VMC REQUIRED)
endif()

include_directories(${CMAKE_CURRENT_SOURCE_DIR}/.)

set(HEADERS GeneratorParam.h GeneratorParamLibBase.h GeneratorParamMUONlib.h GeneratorParamEMlib.h GeneratorParamEMlibV2.h PythiaDecayerConfig.h)
set(HEADERS GeneratorParam.h GeneratorParamLibBase.h GeneratorParamMUONlib.h GeneratorParamEMlib.h GeneratorParamEMlibV2.h PythiaDecayerConfig.h ExodusDecayer.h)

ROOT_GENERATE_DICTIONARY(G__GeneratorParam ${HEADERS} LINKDEF GeneratorParamLinkDef.h)

#---Create a shared library with geneated dictionary
add_library(GeneratorParam SHARED GeneratorParam.cxx GeneratorParamLibBase.cxx GeneratorParamMUONlib.cxx GeneratorParamEMlib.cxx GeneratorParamEMlibV2.cxx PythiaDecayerConfig.cxx G__GeneratorParam.cxx)
target_link_libraries(GeneratorParam ${ROOT_LIBRARIES})
add_library(GeneratorParam SHARED GeneratorParam.cxx GeneratorParamLibBase.cxx GeneratorParamMUONlib.cxx GeneratorParamEMlib.cxx GeneratorParamEMlibV2.cxx PythiaDecayerConfig.cxx ExodusDecayer.cxx G__GeneratorParam.cxx)
target_link_libraries(GeneratorParam ${ROOT_LIBRARIES} ${VMC_LIBRARIES})


set_target_properties(GeneratorParam
Expand Down
728 changes: 728 additions & 0 deletions GeneratorParam/ExodusDecayer.cxx

Large diffs are not rendered by default.

117 changes: 117 additions & 0 deletions GeneratorParam/ExodusDecayer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
#ifndef EXODUSDECAYER_H
#define EXODUSDECAYER_H

// Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

//---------------------------------------------------------------------------------------------------
//
// Generate electron-pair mass distributions for Dalitz decays according
// to the Kroll-Wada parametrization: N. Kroll, W. Wada: Phys. Rev 98(1955)1355
// and generate electron-pair mass distributions for resonances according
// to the Gounaris-Sakurai parametrization: G.J. Gounaris, J.J. Sakurai: Phys.Rev.Lett. 21(1968)244
//
// For the electromagnetic form factor the parameterization from
// Lepton-G is used: L.G. Landsberg et al.: Phys. Rep. 128(1985)301
//
// Ralf Averbeck ([email protected])
// Irem Erdemir ([email protected])
//
// adapted for O2: Daniel Samitz ([email protected])
//
//---------------------------------------------------------------------------------------------------

#include "TVirtualMCDecayer.h"
#include <TLorentzVector.h>
#include <TF1.h>
#include <TH1.h>
#include "TDatabasePDG.h"

//class TH1F;
//class TClonesArray;

class ExodusDecayer : public TVirtualMCDecayer
{
public:
ExodusDecayer();
virtual ~ExodusDecayer();
virtual void Init();
virtual void Decay(Int_t idpart,TLorentzVector* pparent);
virtual Int_t ImportParticles(TClonesArray *particles) {return -1;}
virtual void SetForceDecay(Int_t) {;}
virtual void ForceDecay() {;}
virtual Float_t GetPartialBranchingRatio(Int_t /*ipart*/) {return -1;}
virtual Float_t GetLifetime(Int_t /*kf*/) {return -1;}
virtual void ReadDecayTable() {;}

virtual TH1F* ElectronPairMassHistoPion() {return fEPMassPion;}
virtual TH1F* ElectronPairMassHistoEta() {return fEPMassEta;}
virtual TH1F* ElectronPairMassHistoEtaPrime() {return fEPMassEtaPrime;}
virtual TH1F* ElectronPairMassHistoEtaPrime_toOmega() {return fEPMassEtaPrime_toOmega;}
virtual TH1F* ElectronPairMassHistoRho() {return fEPMassRho;}
virtual TH1F* ElectronPairMassHistoOmega() {return fEPMassOmega;}
virtual TH1F* ElectronPairMassHistoOmegaDalitz() {return fEPMassOmegaDalitz;}
virtual TH1F* ElectronPairMassHistoPhi() {return fEPMassPhi;}
virtual TH1F* ElectronPairMassHistoPhiDalitz() {return fEPMassPhiDalitz;}
virtual TH1F* ElectronPairMassHistoPhiDalitz_toPi0() {return fEPMassPhiDalitz_toPi0;}
virtual TH1F* ElectronPairMassHistoJPsi() {return fEPMassJPsi;}

virtual const TLorentzVector* Products_pion() const {return fProducts_pion;}
virtual const TLorentzVector* Products_eta() const {return fProducts_eta;}
virtual const TLorentzVector* Products_etaprime() const {return fProducts_etaprime;}
virtual const TLorentzVector* Products_etaprime_toOmega() const {return fProducts_etaprime_toOmega;}
virtual const TLorentzVector* Products_rho() const {return fProducts_rho;}
virtual const TLorentzVector* Products_omega() const {return fProducts_omega;}
virtual const TLorentzVector* Products_omega_dalitz() const {return fProducts_omega_dalitz;}
virtual const TLorentzVector* Products_phi() const {return fProducts_phi;}
virtual const TLorentzVector* Products_phi_dalitz() const {return fProducts_phi_dalitz;}
virtual const TLorentzVector* Products_phi_dalitz_toPi0() const {return fProducts_phi_dalitz_toPi0;}
virtual const TLorentzVector* Products_jpsi() const {return fProducts_jpsi;}

protected:
// Histograms for electron pair mass
TH1F* fEPMassPion;
TH1F* fEPMassEta;
TH1F* fEPMassEtaPrime;
TH1F* fEPMassEtaPrime_toOmega;
TH1F* fEPMassRho;
TH1F* fEPMassOmega;
TH1F* fEPMassOmegaDalitz;
TH1F* fEPMassPhi;
TH1F* fEPMassPhiDalitz;
TH1F* fEPMassPhiDalitz_toPi0;
TH1F* fEPMassJPsi;

TF1* fPol;

// Decay products
TLorentzVector fProducts_pion[3];
TLorentzVector fProducts_eta[3];
TLorentzVector fProducts_etaprime[3];
TLorentzVector fProducts_etaprime_toOmega[3];
TLorentzVector fProducts_rho[2];
TLorentzVector fProducts_omega[2];
TLorentzVector fProducts_omega_dalitz[3];
TLorentzVector fProducts_phi[2];
TLorentzVector fProducts_phi_dalitz[3];
TLorentzVector fProducts_phi_dalitz_toPi0[3];
TLorentzVector fProducts_jpsi[2];


Bool_t fInit;

private:
Double_t GounarisSakurai(Float_t mass, Double_t vmass, Double_t vwidth, Double_t emass);
Double_t RhoShapeFromNA60(Float_t mass, Double_t vmass, Double_t vwidth, Double_t emass);
Double_t Lorentz(Float_t mass, Double_t vmass, Double_t vwidth);

ClassDef(ExodusDecayer, 1)
};
#endif
9 changes: 3 additions & 6 deletions GeneratorParam/GeneratorParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -182,21 +182,18 @@ void GeneratorParam::Init() {
//
//
// Initialize the decayer
fDecayer->SetForceDecay(fForceDecay);
fDecayer->Init();
// initialise selection of decay products
InitChildSelect();
fDecayerConfig->Init(fForceDecay);
}

void GeneratorParam::GenerateEvent() {
//
// Generate one event
//
fParticles->Clear();
// ??? fDecayer->SetForceDecay(fForceDecay);
fDecayer->Init();

//

Float_t polar[3] = {
0, 0, 0}; // Polarisation of the parent particle (for GEANT tracking)
Double_t origin0[3]; // Origin of the generated parent particle (for GEANT
Expand Down Expand Up @@ -243,7 +240,7 @@ void GeneratorParam::GenerateEvent() {
// custom pdg codes to destinguish direct photons
if ((pdg >= 220000) && (pdg <= 220001))
pdg = 22;
fChildWeight=(fDecayerConfig->GetPartialBranchingRatio(pdg))*fParentWeight;
fChildWeight=(fDecayer->GetPartialBranchingRatio(pdg))*fParentWeight;
TParticlePDG *particle = pDataBase->GetParticle(pdg);
Float_t am = particle->Mass();
gRandom->RndmArray(2, random);
Expand Down
2 changes: 0 additions & 2 deletions GeneratorParam/GeneratorParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ class GeneratorParam : public TGenerator {
// force decay type
virtual void SetDeltaPt(Float_t delta = 0.01) { fDeltaPt = delta; }
virtual void SetDecayer(TVirtualMCDecayer *decayer) { fDecayer = decayer; }
virtual void SetDecayerConfig(PythiaDecayerConfig *decayerconfig) {fDecayerConfig = decayerconfig; }
virtual void SetForceGammaConversion(Bool_t force = kTRUE) {
fForceConv = force;
}
Expand Down Expand Up @@ -160,7 +159,6 @@ class GeneratorParam : public TGenerator {
Bool_t fSelectAll = false; // Flag for transportation of Background while
// using SetForceDecay()
TVirtualMCDecayer *fDecayer = 0; // ! Pointer to virtual decyer
PythiaDecayerConfig *fDecayerConfig = 0; // Pointer to decayer config
Bool_t fForceConv = false; // force converson of gammas
Bool_t fKeepParent =
false; // Store parent even if it does not have childs within cuts
Expand Down
Loading

0 comments on commit 4f84681

Please sign in to comment.