]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/JET/AliHLTJETReader.cxx
* Added HLT classes for Jet reader and Jet reader header
[u/mrichter/AliRoot.git] / HLT / JET / AliHLTJETReader.cxx
1 //-*- Mode: C++ -*-
2 // $Id: AliHLTJETReaderHeader.cxx  $
3 /**************************************************************************
4  * This file is property of and copyright by the ALICE HLT Project        * 
5  * ALICE Experiment at CERN, All rights reserved.                         *
6  *                                                                        *
7  * Primary Authors: Jochen Thaeder <thaeder@kip.uni-heidelberg.de>        *
8  *                  for The ALICE HLT Project.                            *
9  *                                                                        *
10  * Permission to use, copy, modify and distribute this software and its   *
11  * documentation strictly for non-commercial purposes is hereby granted   *
12  * without fee, provided that the above copyright notice appears in all   *
13  * copies and that both the copyright notice and this permission notice   *
14  * appear in the supporting documentation. The authors make no claims     *
15  * about the suitability of this software for any purpose. It is          *
16  * provided "as is" without express or implied warranty.                  *
17  **************************************************************************/
18
19 /** @file   AliHLTJETReader.cxx
20     @author Jochen Thaeder
21     @date   
22     @brief   Reader for jet finder
23 */
24
25 // see header file for class documentation
26 // or
27 // refer to README to build package
28 // or
29 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt   
30
31 #if __GNUC__ >= 3
32 using namespace std;
33 #endif
34
35 #include "AliHLTJETReader.h"
36
37 #include "AliHLTJETTrackCuts.h"
38
39 #include "TLorentzVector.h"
40 #include "TParticle.h"
41 #include "TParticlePDG.h"
42
43 /** ROOT macro for the implementation of ROOT specific class methods */
44 ClassImp(AliHLTJETReader)
45
46 /*
47  * ---------------------------------------------------------------------------------
48  *                            Constructor / Destructor
49  * ---------------------------------------------------------------------------------
50  */
51   
52 // #################################################################################
53 AliHLTJETReader::AliHLTJETReader()
54   : 
55   AliJetReader(),
56   fESD(NULL), 
57   fMC(NULL),
58   fAOD(NULL) {
59   // see header file for class documentation
60   // or
61   // refer to README to build package
62   // or
63   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
64
65 }
66
67 // #################################################################################
68 AliHLTJETReader::~AliHLTJETReader() {
69   // see header file for class documentation
70
71 }
72
73 /*
74  * ---------------------------------------------------------------------------------
75  *                               Reader functionality
76  * ---------------------------------------------------------------------------------
77  */
78
79 // #################################################################################
80 Bool_t AliHLTJETReader::FillMomentumArray() {
81   // see header file for class documentation
82
83   Bool_t bResult = kFALSE;
84
85   if ( fESD )
86     bResult = FillMomentumArrayESD();
87   else if ( fMC )
88     bResult = FillMomentumArrayMC();
89   else if ( fAOD )
90     bResult = FillMomentumArrayAOD();
91   
92   return bResult;
93 }
94
95 // #################################################################################
96 Bool_t AliHLTJETReader::FillMomentumArrayMC() {
97   // see header file for class documentation
98
99   if ( ! fMC ) {
100     HLTError( "No MC Event!" );
101     return kFALSE;
102   }
103
104   Int_t nTracks = 0;
105
106   // -- Clear Array
107   ClearArray(); 
108
109   // -- Get cuts
110   AliHLTJETTrackCuts *trackCuts = reinterpret_cast<AliHLTJETTrackCuts*>(GetReaderHeader()->GetAnalysisCuts()) ;
111                                                 
112   //---------------------------------------------------------------------------
113   //  XXX fAliHeader = fMCEvent->Header();
114   //---------------------------------------------------------------------------
115
116   TLorentzVector p4;
117
118   TParticle* particle = NULL;
119   
120   // -- Loop over particles
121   // ------------------------
122   while ( (particle = fMC->NextParticle() ) ) {
123
124     // -- Apply cuts 
125     if ( ! trackCuts->IsSelected(particle) )
126       continue;
127
128     // -- Fill vector
129     p4 = TLorentzVector( particle->Px(), particle->Py(), particle->Pz(), particle->Energy() );
130         
131     // -- new TClonesArray entry
132     new ( (*fMomentumArray)[nTracks] ) TLorentzVector(p4);
133   
134     nTracks++;    
135     
136   } // while ( (particle = fMC->NextParticle() ) ) {
137
138   HLTInfo(" Number of selected tracks %d \n", nTracks);
139
140   return kTRUE;
141 }
142
143 // #################################################################################
144 Bool_t AliHLTJETReader::FillMomentumArrayESD() {
145   // see header file for class documentation
146
147   return kTRUE;
148 }
149
150 // #################################################################################
151 Bool_t AliHLTJETReader::FillMomentumArrayAOD() {
152   // see header file for class documentation
153
154   return kFALSE;
155 }
156
157 /*
158  * ---------------------------------------------------------------------------------
159  *                                     Setter
160  * ---------------------------------------------------------------------------------
161  */
162
163
164 // #################################################################################
165 void AliHLTJETReader::SetInputEvent(TObject* esd, TObject* aod, TObject* mc) {
166   // see header file for class documentation
167
168   if ( esd )
169     fESD = dynamic_cast<AliESDEvent*> (esd);
170   else if ( aod )
171     fAOD = dynamic_cast<AliAODEvent*> (aod);
172   else if ( mc )
173     fMC = dynamic_cast<AliHLTMCEvent*> (mc);
174   
175   return;
176 }