]> git.uio.no Git - u/mrichter/AliRoot.git/blame - JETAN/AliAnalysisTaskDiJets.cxx
DiJet analysis.
[u/mrichter/AliRoot.git] / JETAN / AliAnalysisTaskDiJets.cxx
CommitLineData
bd24e6dc 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#include "AliAnalysisTaskDiJets.h"
19#include "AliAODEvent.h"
20#include "AliAODJet.h"
21#include "AliAODDiJet.h"
22#include <TClonesArray.h>
23#include <TLorentzVector.h>
24
25
26ClassImp(AliAnalysisTaskDiJets)
27
28////////////////////////////////////////////////////////////////////////
29
30AliAnalysisTaskDiJets::AliAnalysisTaskDiJets():
31 AliAnalysisTaskSE(),
32 fDiJets(0),
33 fDiJetsIn(0)
34{
35 // Default constructor
36}
37
38AliAnalysisTaskDiJets::AliAnalysisTaskDiJets(const char* name):
39 AliAnalysisTaskSE(name),
40 fDiJets(0),
41 fDiJetsIn(0)
42{
43 // Default constructor
44}
45
46void AliAnalysisTaskDiJets::UserCreateOutputObjects()
47{
48// Create the output container
49//
50 if (fDebug > 1) printf("AnalysisTaskDiJets::CreateOutPutData() \n");
51 fDiJets = new TClonesArray("AliAODDiJet", 0);
52 fDiJets->SetName("Dijets");
53 AddAODBranch("TClonesArray", fDiJets);
54}
55
56void AliAnalysisTaskDiJets::Init()
57{
58 // Initialization
59 if (fDebug > 1) printf("AnalysisTaskDiJets::Init() \n");
60}
61
62void AliAnalysisTaskDiJets::UserExec(Option_t */*option*/)
63{
64// Execute analysis for current event
65//
66 fDiJets->Delete();
67 AliAODEvent* aod = dynamic_cast<AliAODEvent*> (InputEvent());
68 TClonesArray* jets = aod->GetJets();
69 fDiJetsIn = (TClonesArray*) (aod->GetList()->FindObject("Dijets"));
70
71 if (fDiJetsIn) {
72 printf("Found %d dijets in old list \n", fDiJetsIn->GetEntries());
73 AliAODJet* jj1, *jj2;
74 AliAODDiJet* testJ;
75
76 if (fDiJetsIn->GetEntries() > 0) {
77 testJ = (AliAODDiJet*) (fDiJetsIn->At(0));
78 jj1 = testJ->Jet(0);
79 jj1->Print("");
80 jj2 = testJ->Jet(1);
81 jj2->Print("");
82 }
83 }
84
85
86 Int_t nj = jets->GetEntriesFast();
87 printf("There are %5d jets in the event \n", nj);
88 if (nj > 1) {
89 AliAODJet* jet1 = (AliAODJet*) (jets->At(0));
90 TLorentzVector v1 = *(jet1->MomentumVector());
91 AliAODJet* jet2 = (AliAODJet*) (jets->At(1));
92 TLorentzVector v2 = *(jet2->MomentumVector());
93 TLorentzVector v = v1 + v2;
94 Int_t ndi = fDiJets->GetEntriesFast();
95 TClonesArray &lref = *fDiJets;
96 new(lref[ndi]) AliAODDiJet(v);;
97 AliAODDiJet* dijet = (AliAODDiJet*) (fDiJets->At(ndi));
98 dijet->SetJetRefs(jet1, jet2);
99 }
100
101}
102
103void AliAnalysisTaskDiJets::Terminate(Option_t */*option*/)
104{
105// Terminate analysis
106//
107 if (fDebug > 1) printf("AnalysisDiJets: Terminate() \n");
108}
109