]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGJE/EMCALJetTasks/AliJetEmbeddingTask.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGJE / EMCALJetTasks / AliJetEmbeddingTask.cxx
1 // $Id$
2 //
3 // Jet embedding task.
4 //
5 // Author: S.Aiola, C.Loizides
6
7 #include <TRandom3.h>
8
9 #include "AliJetEmbeddingTask.h"
10
11 ClassImp(AliJetEmbeddingTask)
12
13 //________________________________________________________________________
14 AliJetEmbeddingTask::AliJetEmbeddingTask() : 
15   AliJetModelBaseTask("AliJetEmbeddingTask"),
16   fMassless(kFALSE),
17   fNeutralFraction(0)
18 {
19   // Default constructor.
20   SetSuffix("Embedded");
21 }
22
23 //________________________________________________________________________
24 AliJetEmbeddingTask::AliJetEmbeddingTask(const char *name) : 
25   AliJetModelBaseTask(name),
26   fMassless(kFALSE),
27   fNeutralFraction(0)
28 {
29   // Standard constructor.
30   SetSuffix("Embedded");
31 }
32
33 //________________________________________________________________________
34 AliJetEmbeddingTask::~AliJetEmbeddingTask()
35 {
36   // Destructor
37 }
38
39 //________________________________________________________________________
40 void AliJetEmbeddingTask::Run() 
41 {
42   // Embed particles.
43   
44   if (fNClusters > 0 && fOutClusters) {
45     if (fCopyArray) 
46       CopyClusters();
47     for (Int_t i = 0; i < fNClusters; ++i) {
48       AddCluster();
49     }
50   }
51  
52   if (fNTracks > 0 && fOutTracks) {
53     if (fCopyArray) 
54       CopyTracks();
55     for (Int_t i = 0; i < fNTracks; ++i) {
56       Double_t mass = 0.1396;
57       if(fMassless) mass = 0.;
58       Short_t charge = 1;
59       if(fNeutralFraction>0.) {
60         Double_t rnd = gRandom->Rndm();
61         if(rnd<fNeutralFraction) charge = 0;
62       }
63       AddTrack(-1,-999,-1,0,0,0,0,kFALSE,0,charge,mass);
64     }
65   }
66 }