1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 #include "AliAnalysisTaskDiJets.h"
19 #include "AliAODEvent.h"
20 #include "AliAODJet.h"
21 #include "AliAODDiJet.h"
22 #include <TClonesArray.h>
23 #include <TLorentzVector.h>
26 ClassImp(AliAnalysisTaskDiJets)
28 ////////////////////////////////////////////////////////////////////////
30 AliAnalysisTaskDiJets::AliAnalysisTaskDiJets():
35 // Default constructor
38 AliAnalysisTaskDiJets::AliAnalysisTaskDiJets(const char* name):
39 AliAnalysisTaskSE(name),
43 // Default constructor
46 void AliAnalysisTaskDiJets::UserCreateOutputObjects()
48 // Create the output container
50 if (fDebug > 1) printf("AnalysisTaskDiJets::CreateOutPutData() \n");
51 fDiJets = new TClonesArray("AliAODDiJet", 0);
52 fDiJets->SetName("Dijets");
53 AddAODBranch("TClonesArray", &fDiJets);
56 void AliAnalysisTaskDiJets::Init()
59 if (fDebug > 1) printf("AnalysisTaskDiJets::Init() \n");
62 void AliAnalysisTaskDiJets::UserExec(Option_t */*option*/)
64 // Execute analysis for current event
67 AliAODEvent* aod = dynamic_cast<AliAODEvent*> (InputEvent());
68 TClonesArray* jets = aod->GetJets();
69 fDiJetsIn = (TClonesArray*) (aod->GetList()->FindObject("Dijets"));
72 printf("Found %d dijets in old list \n", fDiJetsIn->GetEntries());
76 if (fDiJetsIn->GetEntries() > 0) {
77 testJ = (AliAODDiJet*) (fDiJetsIn->At(0));
86 Int_t nj = jets->GetEntriesFast();
87 printf("There are %5d jets in the event \n", nj);
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);
103 void AliAnalysisTaskDiJets::Terminate(Option_t */*option*/)
105 // Terminate analysis
107 if (fDebug > 1) printf("AnalysisDiJets: Terminate() \n");