DiJet analysis.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2008 20:57:44 +0000 (20:57 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 2 Apr 2008 20:57:44 +0000 (20:57 +0000)
This is a test version for two use cases:
- Update aod as friend.
- References between trees on different files created by two different processes.

JETAN/AliAnalysisTaskDiJets.cxx [new file with mode: 0644]
JETAN/AliAnalysisTaskDiJets.h [new file with mode: 0644]
JETAN/JETANLinkDef.h
JETAN/libJETAN.pkg

diff --git a/JETAN/AliAnalysisTaskDiJets.cxx b/JETAN/AliAnalysisTaskDiJets.cxx
new file mode 100644 (file)
index 0000000..daee1f4
--- /dev/null
@@ -0,0 +1,109 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+#include "AliAnalysisTaskDiJets.h"
+#include "AliAODEvent.h"
+#include "AliAODJet.h"
+#include "AliAODDiJet.h"
+#include <TClonesArray.h>
+#include <TLorentzVector.h>
+
+
+ClassImp(AliAnalysisTaskDiJets)
+
+////////////////////////////////////////////////////////////////////////
+
+AliAnalysisTaskDiJets::AliAnalysisTaskDiJets():
+    AliAnalysisTaskSE(),
+    fDiJets(0),
+    fDiJetsIn(0)
+{
+  // Default constructor
+}
+
+AliAnalysisTaskDiJets::AliAnalysisTaskDiJets(const char* name):
+    AliAnalysisTaskSE(name),
+    fDiJets(0),
+    fDiJetsIn(0)
+{
+  // Default constructor
+}
+
+void AliAnalysisTaskDiJets::UserCreateOutputObjects()
+{
+// Create the output container
+//
+    if (fDebug > 1) printf("AnalysisTaskDiJets::CreateOutPutData() \n");
+    fDiJets = new TClonesArray("AliAODDiJet", 0);
+    fDiJets->SetName("Dijets");
+    AddAODBranch("TClonesArray", fDiJets);
+}
+
+void AliAnalysisTaskDiJets::Init()
+{
+    // Initialization
+    if (fDebug > 1) printf("AnalysisTaskDiJets::Init() \n");
+}
+
+void AliAnalysisTaskDiJets::UserExec(Option_t */*option*/)
+{
+// Execute analysis for current event
+//
+    fDiJets->Delete();
+    AliAODEvent* aod   = dynamic_cast<AliAODEvent*> (InputEvent());
+    TClonesArray* jets = aod->GetJets();
+    fDiJetsIn = (TClonesArray*) (aod->GetList()->FindObject("Dijets"));
+   
+    if (fDiJetsIn) {
+       printf("Found %d dijets in old list \n", fDiJetsIn->GetEntries());
+       AliAODJet* jj1, *jj2;
+       AliAODDiJet* testJ;
+       
+       if (fDiJetsIn->GetEntries() > 0) {
+           testJ = (AliAODDiJet*) (fDiJetsIn->At(0));
+           jj1 = testJ->Jet(0);
+           jj1->Print("");
+           jj2 = testJ->Jet(1);
+           jj2->Print("");
+       }
+    }
+    
+    
+    Int_t nj = jets->GetEntriesFast();
+    printf("There are %5d jets in the event \n", nj);
+    if (nj > 1) {
+       AliAODJet* jet1 = (AliAODJet*) (jets->At(0));
+       TLorentzVector v1 = *(jet1->MomentumVector());
+       AliAODJet* jet2 = (AliAODJet*) (jets->At(1));   
+       TLorentzVector v2 = *(jet2->MomentumVector());
+       TLorentzVector v = v1 + v2;
+       Int_t ndi = fDiJets->GetEntriesFast();
+       TClonesArray &lref = *fDiJets;
+       new(lref[ndi]) AliAODDiJet(v);;
+       AliAODDiJet* dijet = (AliAODDiJet*) (fDiJets->At(ndi));
+       dijet->SetJetRefs(jet1, jet2);
+    }
+    
+}
+
+void AliAnalysisTaskDiJets::Terminate(Option_t */*option*/)
+{
+// Terminate analysis
+//
+    if (fDebug > 1) printf("AnalysisDiJets: Terminate() \n");
+}
+
diff --git a/JETAN/AliAnalysisTaskDiJets.h b/JETAN/AliAnalysisTaskDiJets.h
new file mode 100644 (file)
index 0000000..b04bc0c
--- /dev/null
@@ -0,0 +1,30 @@
+#ifndef ALIANALYSISTASKDIJETS_H
+#define ALIANALYSISTASKDIJETS_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+#include "AliAnalysisTaskSE.h"
+class AliAnalysisTaskDiJets : public AliAnalysisTaskSE
+{
+ public:
+    AliAnalysisTaskDiJets();
+    AliAnalysisTaskDiJets(const char* name);
+    virtual ~AliAnalysisTaskDiJets() {;}
+    // Implementation of interface methods
+    virtual void UserCreateOutputObjects();
+    virtual void Init();
+    virtual void LocalInit() {Init();}
+    virtual void UserExec(Option_t *option);
+    virtual void Terminate(Option_t *option);
+ private:
+  AliAnalysisTaskDiJets(const AliAnalysisTaskDiJets &det);
+  AliAnalysisTaskDiJets &operator=(const AliAnalysisTaskDiJets &det);
+    
+ private:
+  TClonesArray* fDiJets;    // Array of dijets
+  TClonesArray* fDiJetsIn;  // Array of dijets
+  ClassDef(AliAnalysisTaskDiJets, 1); // Analysis task for standard jet analysis
+};
+#endif
index 24953fb..cfca0a8 100644 (file)
@@ -40,6 +40,7 @@
 #pragma        link C++ class AliJetMCReader;
 #pragma        link C++ class AliJetMCReaderHeader;
 #pragma        link C++ class AliJetHistos+;
+#pragma        link C++ class AliAnalysisTaskDiJets+;
 #ifdef WITHFASTJET
 #pragma        link C++ class AliFastJetFinder+;
 #pragma        link C++ class AliFastJetHeader+;
index 8cc12c7..953d50a 100644 (file)
@@ -22,7 +22,8 @@ SRCS =        AliJet.cxx AliJetHeader.cxx \
        AliJetKineReaderHeader.cxx \
        AliJetMCReader.cxx \
        AliJetMCReaderHeader.cxx \
-       AliJetHistos.cxx
+       AliJetHistos.cxx \
+       AliAnalysisTaskDiJets.cxx
 
 ifneq ($(FASTJET),)
        SRCS+= AliFastJetFinder.cxx AliFastJetHeader.cxx