]> git.uio.no Git - u/mrichter/AliRoot.git/blob - JETAN/AliJetFinder.cxx
fix for pid in pr task: sjena
[u/mrichter/AliRoot.git] / JETAN / AliJetFinder.cxx
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 //---------------------------------------------------------------------
19 // Jet finder base class
20 // manages the search for jets 
21 // Authors: jgcn@mda.cinvestav.mx
22 //          andreas.morsch@cern.ch
23 //          magali.estienne@subatech.in2p3.fr
24 //          alexandre.shabetai@cern.ch
25 //---------------------------------------------------------------------
26
27 #include <TFile.h>
28
29 #include "AliJetFinder.h"
30 #include "AliUA1JetHeaderV1.h"
31 #include "AliAODJetEventBackground.h"
32 #include "AliAODJet.h"
33 #include "AliAODEvent.h"
34
35 ClassImp(AliJetFinder)
36
37 ///////////////////////////////////////////////////////////////////////
38
39 AliJetFinder::AliJetFinder():
40   fHeader(0x0),
41   fAODjets(0x0),
42   fNAODjets(0),
43   fAODEvBkg(0),
44   fDebug(0),
45   fCalTrkEvent(0x0)
46 {
47   // Constructor
48 }
49
50 //-----------------------------------------------------------------------
51 AliJetFinder::~AliJetFinder()
52 {
53   // Destructor
54 }
55
56 //-----------------------------------------------------------------------
57 void AliJetFinder::WriteHeader()
58 {
59   // Write the Headers
60   TFile* f = new TFile("jets_local.root", "recreate");
61   WriteHeaderToFile();
62   f->Close();
63
64 }
65
66 //-----------------------------------------------------------------------
67 void AliJetFinder::WriteHeaderToFile()
68 {
69   // write reader header
70   AliJetHeader *rh = GetJetHeader();
71   rh->Write();
72
73 }
74
75 //-----------------------------------------------------------------------
76 Bool_t AliJetFinder::ProcessEvent()
77 {
78   // Process one event
79
80   // Find jets
81   FindJets();
82
83   Reset();
84   return kTRUE;
85
86 }
87
88 //-----------------------------------------------------------------------
89 void AliJetFinder::AddJet(AliAODJet p)
90 {
91   // Add new jet to the list
92   if (fAODjets) { new ((*fAODjets)[fNAODjets++]) AliAODJet(p);}
93   else { Warning("AliJetFinder::AddJet(AliAODJet p)","fAODjets is null!");}
94
95 }
96
97 //-----------------------------------------------------------------------
98 void AliJetFinder::ConnectAOD(const AliAODEvent* aod)
99 {
100   // Connect to the AOD
101   fAODjets = aod->GetJets();
102   fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(AliAODJetEventBackground::StdBranchName()));
103
104 }
105
106 //-----------------------------------------------------------------------
107 void AliJetFinder::ConnectAODNonStd(AliAODEvent* aod,const char *bname)
108 {
109   // Connect non standard AOD jet and jet background branches 
110   fAODjets = dynamic_cast<TClonesArray*>(aod->FindListObject(bname));
111   fAODEvBkg = (AliAODJetEventBackground*)(aod->FindListObject(Form("%s_%s",AliAODJetEventBackground::StdBranchName(),bname)));
112   // how is this is reset? Cleared? -> by the UserExec!!
113
114 }
115