]>
Commit | Line | Data |
---|---|---|
70d53162 | 1 | // $Id$ |
43d99a73 | 2 | // |
3 | // Class to make emcal particles in AOD/ESD events. | |
4 | // | |
5 | // Author: S.Aiola | |
6 | ||
7 | #include <TClonesArray.h> | |
8 | ||
9 | #include "AliLog.h" | |
10 | #include "AliVTrack.h" | |
11 | #include "AliVCluster.h" | |
12 | #include "AliEmcalParticle.h" | |
13 | ||
14 | #include "AliEmcalParticleMaker.h" | |
15 | ||
16 | ClassImp(AliEmcalParticleMaker) | |
17 | ||
18 | //________________________________________________________________________ | |
19 | AliEmcalParticleMaker::AliEmcalParticleMaker() : | |
9239b066 | 20 | AliAnalysisTaskEmcal("AliEmcalParticleMaker",kFALSE), |
43d99a73 | 21 | fTracksOutName("EmcalTracks"), |
22 | fCaloOutName("EmcalClusters"), | |
23 | fTracksOut(0), | |
24 | fCaloClustersOut(0) | |
25 | { | |
26 | // Constructor. | |
27 | } | |
28 | ||
29 | //________________________________________________________________________ | |
30 | AliEmcalParticleMaker::AliEmcalParticleMaker(const char *name) : | |
9239b066 | 31 | AliAnalysisTaskEmcal(name,kFALSE), |
43d99a73 | 32 | fTracksOutName("EmcalTracks"), |
33 | fCaloOutName("EmcalClusters"), | |
34 | fTracksOut(0), | |
35 | fCaloClustersOut(0) | |
36 | { | |
37 | // Constructor. | |
43d99a73 | 38 | } |
39 | ||
40 | //________________________________________________________________________ | |
41 | AliEmcalParticleMaker::~AliEmcalParticleMaker() | |
42 | { | |
43 | // Destructor. | |
44 | } | |
45 | ||
46 | //________________________________________________________________________ | |
bb98e333 | 47 | void AliEmcalParticleMaker::ExecOnce() |
43d99a73 | 48 | { |
bb98e333 | 49 | // Init the analysis. |
43d99a73 | 50 | |
9239b066 | 51 | AliAnalysisTaskEmcal::ExecOnce(); |
43d99a73 | 52 | |
bb98e333 | 53 | if (!fInitialized) |
54 | return; | |
55 | ||
56 | if (!fTracksOutName.IsNull()) { | |
57 | fTracksOut = new TClonesArray("AliEmcalParticle"); | |
58 | fTracksOut->SetName(fTracksOutName); | |
63467901 | 59 | AddObjectToEvent(fTracksOut); |
bb98e333 | 60 | } |
61 | ||
62 | if (!fCaloOutName.IsNull()) { | |
63 | fCaloClustersOut = new TClonesArray("AliEmcalParticle"); | |
64 | fCaloClustersOut->SetName(fCaloOutName); | |
63467901 | 65 | AddObjectToEvent(fCaloClustersOut); |
bb98e333 | 66 | } |
43d99a73 | 67 | } |
68 | ||
69 | //________________________________________________________________________ | |
70 | Bool_t AliEmcalParticleMaker::Run() | |
71 | { | |
bb98e333 | 72 | // Create the emcal particles |
43d99a73 | 73 | |
bb98e333 | 74 | if (fTracks && fTracksOut) { |
75 | // clear container (normally a null operation as the event should clean it already) | |
76 | fTracksOut->Delete(); | |
2bddb6ae | 77 | const Int_t Ntracks = fTracks->GetEntries(); |
78 | for (Int_t iTracks = 0; iTracks < Ntracks; ++iTracks) { | |
6421eeb0 | 79 | AliVTrack *track = static_cast<AliVTrack*>(fTracks->At(iTracks)); |
a335cf1d | 80 | AliEmcalParticle *ep = new ((*fTracksOut)[iTracks]) AliEmcalParticle(track, iTracks); |
81 | if (0&&fCaloClusters) | |
82 | ep->SetMatchedPtr(fCaloClusters); | |
2bddb6ae | 83 | } |
43d99a73 | 84 | } |
85 | ||
bb98e333 | 86 | if (fCaloClusters && fCaloClustersOut) { |
87 | // clear container (normally a null operation as the event should clean it already) | |
88 | fCaloClustersOut->Delete(); | |
2bddb6ae | 89 | const Int_t Nclusters = fCaloClusters->GetEntries(); |
e5f9954b | 90 | for (Int_t iClusters = 0, iN=0; iClusters < Nclusters; ++iClusters) { |
6421eeb0 | 91 | AliVCluster *cluster = static_cast<AliVCluster*>(fCaloClusters->At(iClusters)); |
63467901 | 92 | /* Commented because for simplicity prefer to keep indices aligned with clusters (CL) |
93 | if (!cluster->IsEMCAL()) continue; | |
d4e5ba27 | 94 | */ |
a335cf1d | 95 | AliEmcalParticle *ep = new ((*fCaloClustersOut)[iN++]) AliEmcalParticle(cluster, iClusters, fVertex[0], fVertex[1], fVertex[2]); |
96 | if (0&&fTracks) | |
97 | ep->SetMatchedPtr(fTracks); | |
2bddb6ae | 98 | } |
43d99a73 | 99 | } |
43d99a73 | 100 | return kTRUE; |
101 | } |