AliPhysics  db95e02 (db95e02)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliJetModelMergeBranches.cxx
Go to the documentation of this file.
1 // $Id$
2 //
3 // Jet model task to merge to existing branches
4 // only implemented for track branches
5 //
6 // Author: M. Verweij
7 
9 
10 #include <TClonesArray.h>
11 #include <TFolder.h>
12 #include <TLorentzVector.h>
13 #include <TParticle.h>
14 #include <TParticlePDG.h>
15 #include <TRandom3.h>
16 #include <TProfile.h>
17 #include "AliAnalysisManager.h"
18 #include "AliEMCALDigit.h"
19 #include "AliEMCALGeometry.h"
20 #include "AliEMCALRecPoint.h"
21 #include "AliGenerator.h"
22 #include "AliHeader.h"
23 #include "AliLog.h"
24 #include "AliPicoTrack.h"
25 #include "AliRun.h"
26 #include "AliRunLoader.h"
27 #include "AliStack.h"
28 #include "AliStack.h"
29 #include "AliVCluster.h"
30 #include "AliVEvent.h"
31 
33 
34 //________________________________________________________________________
37  fTracksMergeName(),
38  fTracksMerge(0)
39 {
40  // Default constructor.
41  SetSuffix("Merged");
42  SetCopyArray(kTRUE);
43 }
44 
45 //________________________________________________________________________
47  AliJetModelBaseTask(name),
48  fTracksMergeName(),
49  fTracksMerge(0)
50 {
51  // Standard constructor.
52  SetSuffix("Merged");
53  SetCopyArray(kTRUE);
54 }
55 
56 //________________________________________________________________________
58 {
59  // Destructor
60 }
61 
62 //________________________________________________________________________
64 {
65  // Exec only once.
66 
68 
69  if (!fTracksMergeName.IsNull()) {
70  fTracksMerge = dynamic_cast<TClonesArray*>(InputEvent()->FindListObject(fTracksMergeName));
71  if (!fTracksMerge) {
72  AliWarning(Form("%s: Couldn't retrieve tracks with name %s!", GetName(), fTracksMergeName.Data()));
73  }
74  else if (!fTracksMerge->GetClass()->GetBaseClass("AliPicoTrack")) {
75  AliError(Form("%s: Collection %s does not contain AliPicoTrack objects!", GetName(), fTracksMergeName.Data()));
76  fTracksMerge = 0;
77  return kFALSE;
78  }
79  }
80 
81  return kTRUE;
82 }
83 
84 //________________________________________________________________________
86 {
87  // Merge two branches into a new one
88 
89  CopyTracks();
90  MergeTracks();
91 }
92 
93 //________________________________________________________________________
95 {
96  // Copy all the tracks in the new collection
97 
98  if (!fTracksMerge)
99  return;
100 
101  const Int_t nTracks = fTracksMerge->GetEntriesFast();
102  Int_t nCopiedTracks = fOutTracks->GetEntriesFast();
103  for (Int_t i = 0; i < nTracks; ++i) {
104  AliPicoTrack *picotrack = static_cast<AliPicoTrack*>(fTracksMerge->At(i));
105  if (!picotrack)
106  continue;
107  AliPicoTrack *track = new ((*fOutTracks)[nCopiedTracks]) AliPicoTrack(*picotrack);
108  track->SetBit(TObject::kBitMask,1);
109  nCopiedTracks++;
110  }
111 }
Base class for embedding into an event.
void SetCopyArray(Bool_t copy)
TClonesArray * fOutTracks
! output track collection
int Int_t
Definition: External.C:63
ClassImp(AliJetModelMergeBranches) AliJetModelMergeBranches
void SetSuffix(const char *s)
bool Bool_t
Definition: External.C:53
Bool_t ExecOnce()
generate a particle with random eta,phi, and correlated pt,mass values
virtual Bool_t ExecOnce()
generate a particle with random eta,phi, and correlated pt,mass values