LCOV - code coverage report
Current view: top level - EVGEN - AliGenCorrHF.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 463 0.2 %
Date: 2016-06-14 17:26:59 Functions: 1 20 5.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
       3             :  *                                                                        *
       4             :  * Author: The ALICE Off-line Project.                                    *
       5             :  * Contributors are mentioned in the code where appropriate.              *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          *
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /* $Id$ */
      17             : 
      18             : // Class to generate correlated Heavy Flavor hadron pairs (one or several pairs
      19             : // per event) using paramtrized kinematics of quark pairs from some generator
      20             : // and quark fragmentation functions.
      21             : // Is a generalisation of AliGenParam class for correlated pairs of hadrons.
      22             : // In this version quark pairs and fragmentation functions are obtained from
      23             : // ~2.10^6 Pythia6.214 events generated with kCharmppMNRwmi & kBeautyppMNRwmi, 
      24             : // CTEQ5L PDF and Pt_hard = 2.76 GeV/c for p-p collisions at 2.76, 7, 8, 10 and 14 TeV,
      25             : // and with kCharmppMNR (Pt_hard = 2.10 GeV/c) & kBeautyppMNR (Pt_hard = 2.75 GeV/c), 
      26             : // CTEQ4L PDF for Pb-Pb at 2.76 and 3.94 TeV, for p-Pb & Pb-p at 5 and 8.8 TeV. 
      27             : // Decays are performed by Pythia.
      28             : // Author: S. Grigoryan, LPC Clermont-Fd & YerPhI, Smbat.Grigoryan@cern.ch
      29             : // July 07: added quarks in the stack (B. Vulpescu)
      30             : // April 09: added energy choice between 10 and 14 TeV (S. Grigoryan)
      31             : // Sept 09: added hadron pair composition probabilities via 2D histo (X.M. Zhang)
      32             : // Oct 09: added energy choice between 7, 10, 14 TeV (for p-p), 4 TeV (for Pb-Pb),
      33             : // 9 TeV (for p-Pb) and -9 TeV (for Pb-p) (S. Grigoryan)
      34             : // April 10: removed "static" from definition of some variables (B. Vulpescu)
      35             : // May 11: added Flag for transportation of background particles while using 
      36             : // SetForceDecay() function (L. Manceau)
      37             : // June 11: added modifications allowing the setting of cuts on HF-hadron children.
      38             : // Quarks, hadrons and decay particles are loaded in the stack outside the loop
      39             : // of HF-hadrons, when the cuts on their children are satisfied (L. Manceau)
      40             : // Oct 11: added Pb-Pb at 2.76 TeV (S. Grigoryan)
      41             : // June 12: added p-Pb & Pb-p at 5 TeV (S. Grigoryan)
      42             : // April 13: added p-p at 2.76 and 8 TeV (S. Grigoryan)
      43             : // March 16: added p-p at 5 and 13 TeV (S. Grigoryan)
      44             : // 
      45             : //-------------------------------------------------------------------------
      46             : // How it works (for the given flavor and p-p energy):
      47             : //
      48             : // 1) Reads QQbar kinematical grid (TTree) from the Input file and generates
      49             : // quark pairs according to the weights of the cells.
      50             : // It is a 5D grid in y1,y2,pt1,pt2 and deltaphi, with occupancy weights
      51             : // of the cells obtained from Pythia (see details in GetQuarkPair).
      52             : // 2) Reads "soft" and "hard" fragmentation functions (12 2D-histograms each,
      53             : // for 12 pt bins) from the Input file, applies to quarks and produces hadrons
      54             : // (only lower states, with proportions of species obtained from Pythia).
      55             : // Fragmentation functions are the same for all hadron species and depend
      56             : // on 2 variables - light cone energy-momentum fractions:
      57             : //     z1=(E_H + Pz_H)/(E_Q + Pz_Q),  z2=(E_H - Pz_H)/(E_Q - Pz_Q).
      58             : // "soft" & "hard" FFs correspond to "slower" & "faster" quark of a pair 
      59             : // (see details in GetHadronPair). Fragmentation does not depend on p-p energy.
      60             : // 3) Decays the hadrons and saves all the particles in the event stack in the
      61             : // following order: HF hadron from Q, then its decay products, then HF hadron
      62             : // from Qbar, then its decay productes, then next HF hadon pair (if any) 
      63             : // in the same way, etc... 
      64             : // 4) It is fast, e.g., generates the same number of events with a beauty pair 
      65             : //  ~15 times faster than AliGenPythia with kBeautyppMNRwmi (w/o tracking)
      66             : //
      67             : // An Input file for each quark flavor and p-p energy is in EVGEN/dataCorrHF/
      68             : // One can use also user-defined Input files.
      69             : //
      70             : // More details could be found in my presentation at DiMuonNet Workshop, Dec 2006: 
      71             : // http://www-dapnia.cea.fr/Sphn/Alice/DiMuonNet.
      72             : //
      73             : //-------------------------------------------------------------------------
      74             : // How to use it:
      75             : //
      76             : // add the following typical lines in Config.C
      77             : /*
      78             :     // An example for correlated charm or beauty hadron pair production at 14 TeV
      79             : 
      80             :     // AliGenCorrHF *gener = new AliGenCorrHF(1, 4, 14);  // for charm, 1 pair per event
      81             :     AliGenCorrHF *gener = new AliGenCorrHF(1, 5, 14);  // for beauty, 1 pair per event
      82             : 
      83             :     gener->SetMomentumRange(0,9999);
      84             :     gener->SetCutOnChild(0);          // 1/0 means cuts on children enable/disable
      85             :     gener->SetChildThetaRange(171.0,178.0);
      86             :     gener->SetOrigin(0,0,0);          //vertex position    
      87             :     gener->SetSigma(0,0,0);           //Sigma in (X,Y,Z) (cm) on IP position
      88             :     gener->SetForceDecay(kSemiMuonic);
      89             :     gener->SetSelectAll(kTRUE);      //Force the transport of all particles. 
      90             :                                      //Necessary while using a different 
      91             :                                      //option than kAll for SetForceDecay
      92             :     gener->SetTrackingFlag(1);       //1: Decay during transport, 
      93             :                                      //0: No Decay during transport
      94             :     gener->Init();
      95             : */
      96             : // One can include AliGenCorrHF in an AliGenCocktail generator.
      97             : //--------------------------------------------------------------------------
      98             : 
      99             : #include <Riostream.h>
     100             : #include <TCanvas.h>
     101             : #include <TClonesArray.h>
     102             : #include <TDatabasePDG.h>
     103             : #include <TFile.h>
     104             : #include <TH2F.h>
     105             : #include <TLorentzVector.h>
     106             : #include <TMath.h>
     107             : #include <TParticle.h>
     108             : #include <TParticlePDG.h>
     109             : #include <TROOT.h>
     110             : #include <TRandom.h>
     111             : #include <TTree.h>
     112             : #include <TVirtualMC.h>
     113             : #include <TVector3.h>
     114             : 
     115             : #include "AliGenCorrHF.h"
     116             : #include "AliLog.h"
     117             : #include "AliConst.h"
     118             : #include "AliDecayer.h"
     119             : #include "AliMC.h"
     120             : #include "AliRun.h"
     121             : #include "AliGenEventHeader.h"
     122             : 
     123           6 : ClassImp(AliGenCorrHF)
     124             : 
     125             :   //Begin_Html
     126             :   /*
     127             :     <img src="picts/AliGenCorrHF.gif">
     128             :   */
     129             :   //End_Html
     130             : 
     131             : Double_t AliGenCorrHF::fgdph[19] = {0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180};
     132             : Double_t AliGenCorrHF::fgy[31] = {-10,-7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2,- 1.5, -1, -0.5, 0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 10};
     133             : Double_t AliGenCorrHF::fgpt[51] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.6, 7.2, 7.8, 8.4, 9, 9.6, 10.3, 11.1, 12, 13, 14, 15, 16, 17, 18, 19, 20.1, 21.5, 23, 24.5, 26, 27.5, 29.1, 31, 33, 35, 37, 39.2, 42, 45, 48, 51, 55.2, 60, 65, 71, 81, 100};
     134             : Int_t AliGenCorrHF::fgnptbins = 12;
     135             : Double_t AliGenCorrHF::fgptbmin[12] = {0, 0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 9};
     136             : Double_t AliGenCorrHF::fgptbmax[12] = {0.5, 1, 1.5, 2, 2.5, 3, 4, 5, 6, 7, 9, 100};
     137             : 
     138             : //____________________________________________________________
     139           0 :     AliGenCorrHF::AliGenCorrHF():
     140           0 :         fFileName(0),
     141           0 :         fFile(0),
     142           0 :         fQuark(0),
     143           0 :         fEnergy(0),
     144           0 :         fBias(0.),
     145           0 :         fTrials(0),
     146           0 :         fSelectAll(kFALSE),
     147           0 :         fDecayer(0),
     148           0 :         fgIntegral(0)
     149           0 : {
     150             : // Default constructor
     151           0 : }
     152             : 
     153             : //____________________________________________________________
     154             : AliGenCorrHF::AliGenCorrHF(Int_t npart, Int_t idquark, Int_t energy):
     155           0 :     AliGenMC(npart),
     156           0 :     fFileName(0),
     157           0 :     fFile(0),
     158           0 :     fQuark(idquark),
     159           0 :     fEnergy(energy),
     160           0 :     fBias(0.),
     161           0 :     fTrials(0),
     162           0 :     fSelectAll(kFALSE),
     163           0 :     fDecayer(0),
     164           0 :     fgIntegral(0)
     165           0 : {
     166             : // Constructor using particle number, quark type, energy & default InputFile
     167             : //
     168           0 :     if (fQuark == 5) {
     169           0 :       if (fEnergy == 7)
     170           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP7PythiaMNRwmi.root";
     171           0 :       else if (fEnergy == 8)
     172           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP8PythiaMNRwmi.root";
     173           0 :       else if (fEnergy == 10)
     174           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP10PythiaMNRwmi.root";
     175           0 :       else if (fEnergy == 13)
     176           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP13PythiaMNRwmi.root";
     177           0 :       else if (fEnergy == 14)
     178           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP14PythiaMNRwmi.root";
     179           0 :       else if (fEnergy == 2)
     180           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP276PythiaMNRwmi.root";
     181           0 :       else if (fEnergy == 50)
     182           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPP5PythiaMNRwmi.root";
     183           0 :       else if (fEnergy == 3)
     184           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPbPb276PythiaMNR.root";
     185           0 :       else if (fEnergy == 4)
     186           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPbPb394PythiaMNR.root";
     187           0 :       else if (fEnergy == 5 || fEnergy == -5)
     188           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPPb5PythiaMNR.root";
     189           0 :       else if (fEnergy == 9 || fEnergy == -9)
     190           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPPb88PythiaMNR.root";
     191           0 :       else fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/BeautyPbPb394PythiaMNR.root";
     192             :     }
     193             :     else {
     194           0 :       fQuark = 4;
     195           0 :       if (fEnergy == 7)
     196           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP7PythiaMNRwmi.root";
     197           0 :       else if (fEnergy == 8)
     198           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP8PythiaMNRwmi.root";
     199           0 :       else if (fEnergy == 10)
     200           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP10PythiaMNRwmi.root";
     201           0 :       else if (fEnergy == 13)
     202           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP13PythiaMNRwmi.root";
     203           0 :       else if (fEnergy == 14)
     204           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP14PythiaMNRwmi.root";
     205           0 :       else if (fEnergy == 2)
     206           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP276PythiaMNRwmi.root";
     207           0 :       else if (fEnergy == 50)
     208           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPP5PythiaMNRwmi.root";
     209           0 :       else if (fEnergy == 3)
     210           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPbPb276PythiaMNR.root";
     211           0 :       else if (fEnergy == 4)
     212           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPbPb394PythiaMNR.root";
     213           0 :       else if (fEnergy == 5 || fEnergy == -5)
     214           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPPb5PythiaMNR.root";
     215           0 :       else if (fEnergy == 9 || fEnergy == -9)
     216           0 :            fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPPb88PythiaMNR.root";
     217           0 :       else fFileName = "$ALICE_ROOT/EVGEN/dataCorrHF/CharmPbPb394PythiaMNR.root";
     218             :     }
     219           0 :     fName = "Default";
     220           0 :     fTitle= "Generator for correlated pairs of HF hadrons";
     221             :       
     222           0 :     fChildSelect.Set(5);
     223           0 :     for (Int_t i=0; i<5; i++) fChildSelect[i]=0;
     224           0 :     SetForceDecay();
     225           0 :     SetCutOnChild();
     226           0 :     SetChildMomentumRange();
     227           0 :     SetChildPtRange();
     228           0 :     SetChildPhiRange();
     229           0 :     SetChildThetaRange(); 
     230           0 : }
     231             : 
     232             : //___________________________________________________________________
     233             : AliGenCorrHF::AliGenCorrHF(char* tname, Int_t npart, Int_t idquark, Int_t energy):
     234           0 :     AliGenMC(npart),
     235           0 :     fFileName(tname),
     236           0 :     fFile(0),
     237           0 :     fQuark(idquark),
     238           0 :     fEnergy(energy),
     239           0 :     fBias(0.),
     240           0 :     fTrials(0),
     241           0 :     fSelectAll(kFALSE),
     242           0 :     fDecayer(0),
     243           0 :     fgIntegral(0)
     244           0 : {
     245             : // Constructor using particle number, quark type, energy & user-defined InputFile
     246             : //
     247           0 :     if (fQuark != 5) fQuark = 4;
     248           0 :     fName = "UserDefined";
     249           0 :     fTitle= "Generator for correlated pairs of HF hadrons";
     250             :       
     251           0 :     fChildSelect.Set(5);
     252           0 :     for (Int_t i=0; i<5; i++) fChildSelect[i]=0;
     253           0 :     SetForceDecay();
     254           0 :     SetCutOnChild();
     255           0 :     SetChildMomentumRange();
     256           0 :     SetChildPtRange();
     257           0 :     SetChildPhiRange();
     258           0 :     SetChildThetaRange(); 
     259           0 : }
     260             : 
     261             : //____________________________________________________________
     262           0 : AliGenCorrHF::~AliGenCorrHF()
     263           0 : {
     264             : // Destructor
     265           0 :   delete fFile;
     266           0 : }
     267             : 
     268             : //____________________________________________________________
     269             : void AliGenCorrHF::Init()
     270             : {
     271             : // Initialisation
     272           0 :   AliInfo(Form("Number of HF-hadron pairs = %d",fNpart)); 
     273           0 :   AliInfo(Form(" QQbar kinematics and fragm. functions from:  %s",fFileName.Data() )); 
     274           0 :     fFile = TFile::Open(fFileName.Data());
     275           0 :     if(!fFile->IsOpen()){
     276           0 :       AliError(Form("Could not open file %s",fFileName.Data() ));
     277           0 :     }
     278             : 
     279           0 :     ComputeIntegral(fFile);
     280             :     
     281           0 :     fParentWeight = 1./fNpart;   // fNpart is number of HF-hadron pairs
     282             : 
     283             : // particle decay related initialization
     284             : 
     285           0 :     if (TVirtualMC::GetMC()) fDecayer = TVirtualMC::GetMC()->GetDecayer();
     286           0 :     fDecayer->SetForceDecay(fForceDecay);
     287           0 :     fDecayer->Init();
     288             : 
     289             : //
     290           0 :     AliGenMC::Init();
     291           0 : }
     292             : //____________________________________________________________
     293             : void AliGenCorrHF::Generate()
     294             : {
     295             : //
     296             : // Generate fNpart of correlated HF hadron pairs per event
     297             : // in the the desired theta and momentum windows (phi = 0 - 2pi).
     298             : //
     299             : 
     300             : //  Reinitialize decayer
     301             : 
     302           0 :   fDecayer->SetForceDecay(fForceDecay);
     303           0 :   fDecayer->Init();
     304             : 
     305           0 :   Float_t polar[2][3];        // Polarisation of the parent particle (for GEANT tracking)
     306           0 :   Float_t origin0[2][3];      // Origin of the generated parent particle (for GEANT tracking)
     307             :   Float_t pt, pl, ptot;       // Transverse, logitudinal and total momenta of the parent particle
     308             :   Float_t phi, theta;         // Phi and theta spherical angles of the parent particle momentum
     309           0 :   Float_t p[2][3];            // Momenta
     310           0 :   Int_t nt, i, j, ihad, ipa, ipa0, ipa1, ihadron[2], iquark[2];
     311           0 :   Float_t  wgtp[2], wgtch[2], random[6];
     312           0 :   Float_t pq[2][3], pc[3];    // Momenta of the two quarks
     313             :   Double_t tanhy2, qm = 0;
     314           0 :   Int_t np[2];
     315           0 :   Double_t dphi=0, ptq[2], yq[2], pth[2], plh[2], ph[2], phih[2], phiq[2];
     316           0 :   Int_t ncsel[2];
     317           0 :   Int_t** pSelected = new Int_t* [2];
     318           0 :   Int_t** trackIt = new Int_t* [2];
     319             : 
     320           0 :   for (i=0; i<2; i++) { 
     321           0 :     ptq[i]     =0; 
     322           0 :     yq[i]      =0; 
     323           0 :     pth[i]     =0; 
     324           0 :     plh[i]     =0;
     325           0 :     phih[i]    =0; 
     326           0 :     phiq[i]    =0;
     327           0 :     ihadron[i] =0; 
     328           0 :     iquark[i]  =0;
     329           0 :     for (j=0; j<3; j++) polar[i][j]=0;
     330             :   }
     331             : 
     332             :   // same quarks mass as in the fragmentation functions
     333           0 :   if (fQuark == 4) qm = 1.20;
     334             :   else             qm = 4.75;
     335             :   
     336           0 :   TClonesArray *particleshad1 = new TClonesArray("TParticle",1000);
     337           0 :   TClonesArray *particleshad2 = new TClonesArray("TParticle",1000);
     338             :   
     339           0 :   TList *particleslist = new TList();
     340           0 :   particleslist->Add(particleshad1);
     341           0 :   particleslist->Add(particleshad2);
     342             :   
     343           0 :   TDatabasePDG *pDataBase = TDatabasePDG::Instance();
     344             : 
     345             :   // Calculating vertex position per event
     346           0 :   if (fVertexSmear==kPerEvent) {
     347           0 :     Vertex();
     348           0 :     for (i=0;i<2;i++){
     349           0 :       for (j=0;j<3;j++) origin0[i][j]=fVertex[j];
     350             :     }
     351             :   }
     352             :   else {
     353           0 :     for (i=0;i<2;i++){
     354           0 :       for (j=0;j<3;j++) origin0[i][j]=fOrigin[j];
     355             :     }
     356             :   }
     357             :   
     358             :   ipa  = 0;
     359             :   ipa1 = 0;
     360             :   ipa0 = 0;
     361             :   
     362             :   // Generating fNpart HF-hadron pairs
     363           0 :   fNprimaries = 0;
     364             :  
     365           0 :   while (ipa<2*fNpart) {
     366             : 
     367           0 :     GetQuarkPair(fFile, fgIntegral, yq[0], yq[1], ptq[0], ptq[1], dphi);
     368             :     
     369           0 :     GetHadronPair(fFile, fQuark, yq[0], yq[1], ptq[0], ptq[1], ihadron[0], ihadron[1], plh[0], plh[1], pth[0], pth[1]);
     370             :     
     371             :     // Boost particles from c.m.s. to ALICE lab frame for p-Pb & Pb-p collisions
     372           0 :     if (fEnergy == 5 || fEnergy == -5 || fEnergy == 9 || fEnergy == -9) {
     373             :       Double_t dyBoost = 0.47;
     374           0 :       Double_t beta  = TMath::TanH(dyBoost);
     375           0 :       Double_t gamma = 1./TMath::Sqrt((1.-beta)*(1.+beta));
     376           0 :       Double_t gb    = gamma * beta;
     377           0 :       yq[0] += dyBoost;
     378           0 :       yq[1] += dyBoost;
     379           0 :       plh[0] = gb * TMath::Sqrt(plh[0]*plh[0] + pth[0]*pth[0]) + gamma * plh[0];
     380           0 :       plh[1] = gb * TMath::Sqrt(plh[1]*plh[1] + pth[1]*pth[1]) + gamma * plh[1];
     381           0 :       if (fEnergy == 5 || fEnergy == 9) {
     382           0 :         yq[0] *= -1;
     383           0 :         yq[1] *= -1;
     384           0 :         plh[0] *= -1;
     385           0 :         plh[1] *= -1;
     386           0 :       }
     387           0 :     }      
     388             :     
     389             :     // Cuts from AliGenerator
     390             :     
     391             :     // Cut on theta
     392           0 :     theta=TMath::ATan2(pth[0],plh[0]);
     393           0 :     if (theta<fThetaMin || theta>fThetaMax) continue;
     394           0 :     theta=TMath::ATan2(pth[1],plh[1]);
     395           0 :     if (theta<fThetaMin || theta>fThetaMax) continue;
     396             :     
     397             :     // Cut on momentum
     398           0 :     ph[0]=TMath::Sqrt(pth[0]*pth[0]+plh[0]*plh[0]);
     399           0 :     if (ph[0]<fPMin || ph[0]>fPMax) continue;
     400           0 :     ph[1]=TMath::Sqrt(pth[1]*pth[1]+plh[1]*plh[1]);
     401           0 :     if (ph[1]<fPMin || ph[1]>fPMax) continue;
     402             :     
     403             :     // Add the quarks in the stack
     404             :     
     405           0 :     phiq[0] = Rndm()*k2PI;
     406           0 :     if (Rndm() < 0.5) {
     407           0 :       phiq[1] = phiq[0] + dphi*kDegrad; 
     408           0 :     } else {
     409           0 :       phiq[1] = phiq[0] - dphi*kDegrad; 
     410             :     }    
     411           0 :     if (phiq[1] > k2PI) phiq[1] -= k2PI;
     412           0 :     if (phiq[1] < 0   ) phiq[1] += k2PI;
     413             :     
     414             :     // quarks pdg
     415           0 :     iquark[0] = +fQuark;
     416           0 :     iquark[1] = -fQuark;
     417             :     
     418             :     // px and py
     419           0 :     TVector2 qvect1 = TVector2();
     420           0 :     TVector2 qvect2 = TVector2();
     421           0 :     qvect1.SetMagPhi(ptq[0],phiq[0]);
     422           0 :     qvect2.SetMagPhi(ptq[1],phiq[1]);
     423           0 :     pq[0][0] = qvect1.Px();
     424           0 :     pq[0][1] = qvect1.Py();
     425           0 :     pq[1][0] = qvect2.Px();
     426           0 :     pq[1][1] = qvect2.Py();
     427             :     
     428             :     // pz
     429           0 :     tanhy2 = TMath::TanH(yq[0]);
     430           0 :     tanhy2 *= tanhy2;
     431           0 :     pq[0][2] = TMath::Sqrt((ptq[0]*ptq[0]+qm*qm)*tanhy2/(1-tanhy2));
     432           0 :     pq[0][2] = TMath::Sign((Double_t)pq[0][2],yq[0]);
     433           0 :     tanhy2 = TMath::TanH(yq[1]);
     434           0 :     tanhy2 *= tanhy2;
     435           0 :     pq[1][2] = TMath::Sqrt((ptq[1]*ptq[1]+qm*qm)*tanhy2/(1-tanhy2));
     436           0 :     pq[1][2] = TMath::Sign((Double_t)pq[1][2],yq[1]);
     437             :     
     438             :     // Here we assume that  |phi_H1 - phi_H2| = |phi_Q1 - phi_Q2| = dphi
     439             :     // which is a good approximation for heavy flavors in Pythia
     440             :     // ... moreover, same phi angles as for the quarks ...
     441             :     
     442           0 :     phih[0] = phiq[0];    
     443           0 :     phih[1] = phiq[1];    
     444             :     
     445             :     ipa1 = 0;
     446             : 
     447           0 :     for (ihad = 0; ihad < 2; ihad++) {
     448             :       while(1) {
     449             :         
     450             :         ipa0=ipa1;
     451             :         
     452             :         // particle type 
     453           0 :         fChildWeight=(fDecayer->GetPartialBranchingRatio(ihadron[ihad]))*fParentWeight;
     454           0 :         wgtp[ihad]=fParentWeight;
     455           0 :         wgtch[ihad]=fChildWeight;
     456           0 :         TParticlePDG *particle = pDataBase->GetParticle(ihadron[ihad]);
     457           0 :         Float_t am = particle->Mass();
     458           0 :         phi = phih[ihad];
     459           0 :         pt  = pth[ihad];
     460           0 :         pl  = plh[ihad];
     461           0 :         ptot=TMath::Sqrt(pt*pt+pl*pl);
     462             :         
     463           0 :         p[ihad][0]=pt*TMath::Cos(phi);
     464           0 :         p[ihad][1]=pt*TMath::Sin(phi);
     465           0 :         p[ihad][2]=pl;
     466             :         
     467           0 :         if(fVertexSmear==kPerTrack) {
     468           0 :           Rndm(random,6);
     469           0 :           for (j=0;j<3;j++) {
     470           0 :             origin0[ihad][j]=
     471           0 :               fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
     472           0 :               TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
     473             :           }
     474             :         }
     475             :         
     476             :         // Looking at fForceDecay : 
     477             :         // if fForceDecay != none Primary particle decays using 
     478             :         // AliPythia and children are tracked by GEANT
     479             :         //
     480             :         // if fForceDecay == none Primary particle is tracked by GEANT 
     481             :         // (In the latest, make sure that GEANT actually does all the decays you want)    
     482             : 
     483           0 :         if (fForceDecay != kNoDecay) {
     484             :           // Using lujet to decay particle
     485           0 :           Float_t energy=TMath::Sqrt(ptot*ptot+am*am);
     486           0 :           TLorentzVector pmom(p[ihad][0], p[ihad][1], p[ihad][2], energy);
     487           0 :           fDecayer->Decay(ihadron[ihad],&pmom);
     488             :           
     489             :           // select decay particles
     490             :          
     491           0 :           np[ihad]=fDecayer->ImportParticles((TClonesArray *)particleslist->At(ihad));
     492             : 
     493             :           //  Selecting  GeometryAcceptance for particles fPdgCodeParticleforAcceptanceCut;
     494             :           
     495           0 :           if (fGeometryAcceptance) 
     496           0 :             if (!CheckAcceptanceGeometry(np[ihad],(TClonesArray*)particleslist->At(ihad))) continue;
     497             :           
     498           0 :           trackIt[ihad]     = new Int_t [np[ihad]];
     499           0 :           pSelected[ihad]   = new Int_t [np[ihad]];
     500           0 :           Int_t* pFlag      = new Int_t [np[ihad]];
     501             :           
     502           0 :           for (i=0; i<np[ihad]; i++) {
     503           0 :             pFlag[i]     =  0;
     504           0 :             pSelected[ihad][i] =  0;
     505             :           }
     506             : 
     507           0 :           if (np[ihad] >1) {
     508             :             TParticle* iparticle = 0;
     509             :             Int_t ipF, ipL;
     510             :             
     511           0 :             for (i = 1; i<np[ihad] ; i++) {
     512           0 :               trackIt[ihad][i] = 1;
     513             :               iparticle = 
     514           0 :                 (TParticle *) ((TClonesArray *) particleslist->At(ihad))->At(i);
     515           0 :               Int_t kf = iparticle->GetPdgCode();
     516           0 :               Int_t ks = iparticle->GetStatusCode();
     517             :               // flagged particle
     518           0 :               if (pFlag[i] == 1) {
     519           0 :                 ipF = iparticle->GetFirstDaughter();
     520           0 :                 ipL = iparticle->GetLastDaughter();  
     521           0 :                 if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1;
     522           0 :                 continue;
     523             :               }
     524             :               
     525             :               // flag decay products of particles with long life-time (c tau > .3 mum)
     526           0 :               if (ks != 1) { 
     527           0 :                 Double_t lifeTime = fDecayer->GetLifetime(kf);
     528           0 :                 if (lifeTime > (Double_t) fMaxLifeTime) {
     529           0 :                   ipF = iparticle->GetFirstDaughter();
     530           0 :                   ipL = iparticle->GetLastDaughter();        
     531           0 :                   if (ipF > 0) for (j=ipF-1; j<ipL; j++) pFlag[j]=1;
     532             :                 } else {
     533           0 :                   trackIt[ihad][i]     = 0;
     534           0 :                   pSelected[ihad][i]   = 1;
     535             :                 }
     536           0 :               } // ks==1 ?
     537             :               //
     538             :               // children
     539           0 :               if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll || fSelectAll) && trackIt[ihad][i])
     540             :                 {      
     541           0 :                   if (fCutOnChild) {
     542           0 :                     pc[0]=iparticle->Px();
     543           0 :                     pc[1]=iparticle->Py();
     544           0 :                     pc[2]=iparticle->Pz();
     545             :                     //printf("px %f py %f pz %f\n",pc[0],pc[1],pc[2]);
     546           0 :                     Bool_t  childok = KinematicSelection(iparticle, 1);
     547           0 :                     if(childok) {
     548           0 :                       pSelected[ihad][i]  = 1;
     549           0 :                       ncsel[ihad]++;
     550             :                     } else {
     551           0 :                       ncsel[ihad]=-1;
     552           0 :                       break;
     553             :                     } // child kine cuts
     554           0 :                   } else {
     555           0 :                     pSelected[ihad][i]  = 1;
     556           0 :                     ncsel[ihad]++;
     557             :                   } // if child selection
     558             :                 } // select muon
     559           0 :             } // decay particle loop
     560           0 :           } // if decay products
     561             : 
     562           0 :           if ((fCutOnChild && ncsel[ihad] >0) || !fCutOnChild) ipa1++;
     563             : 
     564           0 :           if (pFlag) delete[] pFlag;
     565             : 
     566           0 :         } // kinematic selection
     567             :         else  // nodecay option, so parent will be tracked by GEANT (pions, kaons, eta, omegas, baryons)
     568             :           {
     569           0 :             gAlice->GetMCApp()->
     570           0 :               PushTrack(fTrackIt,-1,ihadron[ihad],p[ihad],origin0[ihad],polar[ihad],0,kPPrimary,nt,wgtp[ihad]);
     571           0 :             ipa1++; 
     572           0 :             fNprimaries++;
     573             :             
     574             :           }
     575           0 :         break;
     576             :       } // while(1) loop
     577           0 :       if (ipa1<ipa0+1){
     578             :         ipa1=0; 
     579           0 :         if (pSelected[ihad]) delete pSelected[ihad];
     580           0 :         if (trackIt[ihad])   delete trackIt[ihad];
     581           0 :         particleshad1->Clear();
     582           0 :         particleshad2->Clear();
     583             :         break;
     584             :       }//go out of loop and generate new pair if at least one hadron is rejected
     585             :     } // hadron pair loop
     586           0 :     if(ipa1==2){ 
     587             :  
     588           0 :       ipa=ipa+ipa1;
     589             :  
     590           0 :       if(fForceDecay != kNoDecay){
     591           0 :         for(ihad=0;ihad<2;ihad++){
     592             : 
     593             :           //load tracks in the stack if both hadrons of the pair accepted
     594           0 :           LoadTracks(iquark[ihad],pq[ihad],ihadron[ihad],p[ihad],np[ihad],
     595           0 :                      (TClonesArray *)particleslist->At(ihad),origin0[ihad],
     596           0 :                      polar[ihad],wgtp[ihad],wgtch[ihad],nt,ncsel[ihad],
     597           0 :                      pSelected[ihad],trackIt[ihad]);
     598             : 
     599           0 :           if (pSelected[ihad]) delete pSelected[ihad];
     600           0 :           if (trackIt[ihad])   delete trackIt[ihad];
     601             : 
     602             :         }
     603           0 :           particleshad1->Clear();
     604           0 :           particleshad2->Clear();
     605             :       }
     606             :     }
     607           0 :   }   // while (ipa<2*fNpart) loop
     608             :   
     609           0 :   SetHighWaterMark(nt);
     610             :   
     611           0 :   AliGenEventHeader* header = new AliGenEventHeader("CorrHF");
     612           0 :   header->SetPrimaryVertex(fVertex);
     613           0 :   header->SetNProduced(fNprimaries);
     614           0 :   AddHeader(header);
     615             :   
     616             :   
     617           0 :   delete particleshad1;
     618           0 :   delete particleshad2;
     619           0 :   delete particleslist;
     620             :  
     621           0 :   delete[] pSelected;
     622           0 :   delete[] trackIt;
     623           0 : }
     624             : //____________________________________________________________________________________
     625             : void AliGenCorrHF::IpCharm(TH2F *hProbHH, Int_t &pdg3, Int_t &pdg4)
     626             : {  
     627             : // Composition of a lower state charm hadron pair from a ccbar quark pair
     628           0 :    Int_t pdgH[] = {411, 421, 431, 4122, 4132, 4232, 4332};
     629             : 
     630           0 :    Double_t id3, id4;
     631           0 :    hProbHH->GetRandom2(id3, id4);
     632           0 :    pdg3 = pdgH[(Int_t)TMath::Floor(id3)];
     633           0 :    pdg4 = -1*pdgH[(Int_t)TMath::Floor(id4)];
     634             : 
     635             :    return;
     636           0 : }
     637             : 
     638             : void AliGenCorrHF::IpBeauty(TH2F *hProbHH, Int_t &pdg3, Int_t &pdg4)
     639             : {  
     640             : // Composition of a lower state beauty hadron pair from a bbbar quark pair
     641             :    // B-Bbar mixing will be done by Pythia at their decay point
     642           0 :    Int_t pdgH[] = {511, 521, 531, 5122, 5132, 5232, 5332};
     643             : 
     644           0 :    Double_t id3, id4;
     645           0 :    hProbHH->GetRandom2(id3, id4);
     646           0 :    pdg3 = pdgH[(Int_t)TMath::Floor(id3)];
     647           0 :    pdg4 = -1*pdgH[(Int_t)TMath::Floor(id4)];
     648             : 
     649           0 :    if ( (pdg3== 511) || (pdg3== 521) || (pdg3== 531) ) pdg3 *= -1;
     650           0 :    if ( (pdg4==-511) || (pdg4==-521) || (pdg4==-531) ) pdg4 *= -1;
     651             : 
     652             :    return;
     653           0 : }
     654             : 
     655             : //____________________________________________________________________________________
     656             : Double_t AliGenCorrHF::ComputeIntegral(TFile* fG)       // needed by GetQuarkPair
     657             : {
     658             :    // Read QQbar kinematical 5D grid's cell occupancy weights
     659           0 :    Int_t cell[6];           // cell[6]={wght,iy1,iy2,ipt1,ipt2,idph}
     660           0 :    TTree* tG = (TTree*) fG->Get("tGqq");
     661           0 :    tG->GetBranch("cell")->SetAddress(&cell);
     662           0 :    Int_t nbins = tG->GetEntries();
     663             : 
     664             :    //   delete previously computed integral (if any)
     665           0 :    if(fgIntegral) delete [] fgIntegral;
     666             : 
     667           0 :    fgIntegral = new Double_t[nbins+1];
     668           0 :    fgIntegral[0] = 0;
     669             :    Int_t bin;
     670           0 :    for(bin=0;bin<nbins;bin++) {
     671           0 :      tG->GetEvent(bin);
     672           0 :      fgIntegral[bin+1] = fgIntegral[bin] + cell[0];
     673             :    }
     674             :    //   Normalize integral to 1
     675           0 :    if (fgIntegral[nbins] == 0 ) {
     676           0 :       return 0;
     677             :    }
     678           0 :    for (bin=1;bin<=nbins;bin++)  fgIntegral[bin] /= fgIntegral[nbins];
     679             : 
     680           0 :    return fgIntegral[nbins];
     681           0 : }
     682             : 
     683             : 
     684             : //____________________________________________________________________________________
     685             : void AliGenCorrHF::GetQuarkPair(TFile* fG, Double_t* fInt, Double_t &y1, Double_t &y2, Double_t &pt1, Double_t &pt2, Double_t &dphi)              
     686             :                                  // modification of ROOT's TH3::GetRandom3 for 5D
     687             : {
     688             :    // Read QQbar kinematical 5D grid's cell coordinates
     689           0 :    Int_t cell[6];           // cell[6]={wght,iy1,iy2,ipt1,ipt2,idph}
     690           0 :    TTree* tG = (TTree*) fG->Get("tGqq");
     691           0 :    tG->GetBranch("cell")->SetAddress(&cell);
     692           0 :    Int_t nbins = tG->GetEntries();
     693           0 :    Double_t rand[6];
     694           0 :    gRandom->RndmArray(6,rand);
     695           0 :    Int_t ibin = TMath::BinarySearch(nbins,fInt,rand[0]);
     696           0 :    tG->GetEvent(ibin);
     697           0 :    y1   = fgy[cell[1]]  + (fgy[cell[1]+1]-fgy[cell[1]])*rand[1];
     698           0 :    y2   = fgy[cell[2]]  + (fgy[cell[2]+1]-fgy[cell[2]])*rand[2];
     699           0 :    pt1  = fgpt[cell[3]] + (fgpt[cell[3]+1]-fgpt[cell[3]])*rand[3];
     700           0 :    pt2  = fgpt[cell[4]] + (fgpt[cell[4]+1]-fgpt[cell[4]])*rand[4];
     701           0 :    dphi = fgdph[cell[5]]+ (fgdph[cell[5]+1]-fgdph[cell[5]])*rand[5];
     702           0 : }
     703             : 
     704             : //____________________________________________________________________________________
     705             : void AliGenCorrHF::GetHadronPair(TFile* fG, Int_t idq, Double_t y1, Double_t y2, Double_t pt1, Double_t pt2, Int_t &id3, Int_t &id4, Double_t &pz3, Double_t &pz4, Double_t &pt3, Double_t &pt4) 
     706             : {
     707             :     // Generate a hadron pair
     708             :     void (*fIpParaFunc)(TH2F *, Int_t &, Int_t &);//Pointer to hadron pair composition function
     709             :     fIpParaFunc = IpCharm;
     710             :     Double_t mq = 1.2;              // c & b quark masses (used in AliPythia)
     711           0 :     if (idq == 5) {
     712             :       fIpParaFunc = IpBeauty;
     713             :       mq = 4.75;
     714           0 :     }
     715           0 :     Double_t z11 = 0.;
     716           0 :     Double_t z12 = 0.;
     717           0 :     Double_t z21 = 0.;
     718           0 :     Double_t z22 = 0.;
     719           0 :     Double_t pz1, pz2, e1, e2, mh, ptemp, rand[2];
     720           0 :     char tag[100]; 
     721           0 :     TH2F *h2h[12], *h2s[12], *hProbHH; // hard & soft fragmentation and HH-probability functions
     722           0 :     for (Int_t ipt = 0; ipt<fgnptbins; ipt++) { 
     723           0 :       snprintf(tag,100, "h2h_pt%d",ipt); 
     724           0 :       h2h[ipt] = (TH2F*) fG->Get(tag); 
     725           0 :       snprintf(tag,100, "h2s_pt%d",ipt); 
     726           0 :       h2s[ipt] = (TH2F*) fG->Get(tag); 
     727             :     }
     728             : 
     729           0 :        if (y1*y2 < 0) {
     730           0 :          for (Int_t ipt = 0; ipt<fgnptbins; ipt++) { 
     731           0 :            if(pt1 >= fgptbmin[ipt] && pt1 < fgptbmax[ipt]) 
     732           0 :              h2h[ipt]->GetRandom2(z11, z21);
     733           0 :            if(pt2 >= fgptbmin[ipt] && pt2 < fgptbmax[ipt]) 
     734           0 :              h2h[ipt]->GetRandom2(z12, z22); 
     735             :          }
     736           0 :        }
     737             :        else {
     738           0 :          if (TMath::Abs(y1) > TMath::Abs(y2)) {
     739           0 :            for (Int_t ipt = 0; ipt<fgnptbins; ipt++) { 
     740           0 :              if(pt1 >= fgptbmin[ipt] && pt1 < fgptbmax[ipt]) 
     741           0 :                h2h[ipt]->GetRandom2(z11, z21);
     742           0 :              if(pt2 >= fgptbmin[ipt] && pt2 < fgptbmax[ipt]) 
     743           0 :                h2s[ipt]->GetRandom2(z12, z22); 
     744             :            }
     745           0 :          }
     746             :          else {
     747           0 :            for (Int_t ipt = 0; ipt<fgnptbins; ipt++) { 
     748           0 :              if(pt1 >= fgptbmin[ipt] && pt1 < fgptbmax[ipt]) 
     749           0 :                h2s[ipt]->GetRandom2(z11, z21);
     750           0 :              if(pt2 >= fgptbmin[ipt] && pt2 < fgptbmax[ipt]) 
     751           0 :                h2h[ipt]->GetRandom2(z12, z22); 
     752             :            }
     753             :          }
     754             :        }
     755           0 :       gRandom->RndmArray(2,rand);
     756           0 :       ptemp = TMath::Sqrt(pt1*pt1 + mq*mq);
     757           0 :       pz1   = ptemp*TMath::SinH(y1); 
     758           0 :       e1    = ptemp*TMath::CosH(y1); 
     759           0 :       ptemp = TMath::Sqrt(pt2*pt2 + mq*mq);
     760           0 :       pz2   = ptemp*TMath::SinH(y2); 
     761           0 :       e2    = ptemp*TMath::CosH(y2); 
     762             : 
     763           0 :       hProbHH = (TH2F*)fG->Get("hProbHH");
     764           0 :       fIpParaFunc(hProbHH, id3, id4);
     765           0 :       mh    = TDatabasePDG::Instance()->GetParticle(id3)->Mass();
     766           0 :       ptemp = z11*z21*(e1*e1-pz1*pz1) - mh*mh;
     767           0 :       if (idq==5) pt3   = pt1;                // an approximation at low pt, try better
     768           0 :       else        pt3   = rand[0];            // pt3=pt1 gives less D-hadrons at low pt 
     769           0 :       if (ptemp > 0) pt3 = TMath::Sqrt(ptemp);
     770           0 :       if (pz1 > 0)   pz3 = (z11*(e1 + pz1) - z21*(e1 - pz1)) / 2;
     771           0 :       else           pz3 = (z21*(e1 + pz1) - z11*(e1 - pz1)) / 2;
     772           0 :       e1 = TMath::Sqrt(pz3*pz3 + pt3*pt3 + mh*mh);
     773             : 
     774           0 :       mh    = TDatabasePDG::Instance()->GetParticle(id4)->Mass();
     775           0 :       ptemp = z12*z22*(e2*e2-pz2*pz2) - mh*mh;
     776           0 :       if (idq==5) pt4   = pt2;                // an approximation at low pt, try better
     777           0 :       else        pt4   = rand[1];
     778           0 :       if (ptemp > 0) pt4 = TMath::Sqrt(ptemp);
     779           0 :       if (pz2 > 0)   pz4 = (z12*(e2 + pz2) - z22*(e2 - pz2)) / 2;
     780           0 :       else           pz4 = (z22*(e2 + pz2) - z12*(e2 - pz2)) / 2;
     781           0 :       e2 = TMath::Sqrt(pz4*pz4 + pt4*pt4 + mh*mh);
     782             : 
     783             :       // small corr. instead of using Frag. Func. depending on yQ (in addition to ptQ)
     784             :       Float_t ycorr = 0.2, y3, y4;
     785           0 :       gRandom->RndmArray(2,rand);
     786           0 :       y3 = 0.5 * TMath::Log((e1 + pz3 + 1.e-13)/(e1 - pz3 + 1.e-13));
     787           0 :       y4 = 0.5 * TMath::Log((e2 + pz4 + 1.e-13)/(e2 - pz4 + 1.e-13));
     788           0 :       if(TMath::Abs(y3)<ycorr && TMath::Abs(y4)<ycorr && rand[0]>0.5) {
     789           0 :         ptemp = TMath::Sqrt((e1-pz3)*(e1+pz3));
     790           0 :         y3  = 4*(1 - 2*rand[1]);
     791           0 :         pz3 = ptemp*TMath::SinH(y3);
     792           0 :         pz4 = pz3;
     793           0 :       }
     794           0 : }
     795             : 
     796             :                 
     797             : //____________________________________________________________________________________
     798             : void AliGenCorrHF::LoadTracks(Int_t iquark, Float_t *pq, 
     799             :                               Int_t iPart, Float_t *p, 
     800             :                               Int_t np, TClonesArray *particles,
     801             :                               Float_t *origin0, Float_t *polar, 
     802             :                               Float_t wgtp, Float_t wgtch,
     803             :                               Int_t &nt, Int_t ncsel, Int_t *pSelected, 
     804             :                               Int_t *trackIt){
     805             :   Int_t i; 
     806             :   Int_t ntq=-1;
     807           0 :   Int_t* pParent = new Int_t[np];
     808           0 :   Float_t pc[3], och[3];
     809             :   Int_t iparent;
     810             : 
     811           0 :   for(i=0;i<np;i++) pParent[i]=-1;
     812             : 
     813           0 :   if ((fCutOnChild && ncsel >0) || !fCutOnChild){  
     814             :     // Parents
     815             :     // quark
     816           0 :     PushTrack(0, -1, iquark, pq, origin0, polar, 0, kPPrimary, nt, wgtp);
     817           0 :     KeepTrack(nt);
     818           0 :     ntq = nt;
     819             :     // hadron
     820           0 :     PushTrack(0, ntq, iPart, p, origin0, polar, 0, kPDecay, nt, wgtp);
     821           0 :     pParent[0] = nt;
     822           0 :     KeepTrack(nt); 
     823           0 :     fNprimaries++;
     824             : 
     825             :     // Decay Products  
     826           0 :     for (i = 1; i < np; i++) {
     827           0 :       if (pSelected[i]) {
     828             : 
     829           0 :         TParticle* iparticle = (TParticle *) particles->At(i);
     830           0 :         Int_t kf  = iparticle->GetPdgCode();
     831           0 :         Int_t jpa = iparticle->GetFirstMother()-1;
     832           0 :         Int_t ksc  = iparticle->GetStatusCode();
     833             :         // RS: note, the conversion mm->cm is done now in the decayer. The time is ignored here!
     834           0 :         och[0] = origin0[0]+iparticle->Vx();
     835           0 :         och[1] = origin0[1]+iparticle->Vy();
     836           0 :         och[2] = origin0[2]+iparticle->Vz();
     837           0 :         pc[0]  = iparticle->Px();
     838           0 :         pc[1]  = iparticle->Py();
     839           0 :         pc[2]  = iparticle->Pz();
     840             :         
     841           0 :         if (jpa > -1) {
     842           0 :           iparent = pParent[jpa];
     843           0 :         } else {
     844             :           iparent = -1;
     845             :         }
     846             :         
     847           0 :         PushTrack(fTrackIt*trackIt[i], iparent, kf,
     848           0 :                   pc, och, polar,
     849             :                   0, kPDecay, nt, wgtch,ksc);
     850           0 :         pParent[i] = nt;
     851           0 :         KeepTrack(nt); 
     852           0 :         fNprimaries++;
     853             : 
     854           0 :       } // Selected
     855             :     } // Particle loop
     856             :   }
     857           0 :   if (pParent) delete[] pParent;
     858             :  
     859             :   return;
     860           0 : }

Generated by: LCOV version 1.11