LCOV - code coverage report
Current view: top level - HLT/BASE/util - AliHLTJets.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 41 2.4 %
Date: 2016-06-14 17:26:59 Functions: 1 15 6.7 %

          Line data    Source code
       1             : //-*- Mode: C++ -*-
       2             : // $Id: AliHLTJets.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   AliHLTJets.h
      20             :     @author Jochen Thaeder
      21             :     @date   
      22             :     @brief  Container holding produced Jets
      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             : #include "TLorentzVector.h"
      32             : 
      33             : #include "AliHLTJets.h"
      34             : 
      35             : using namespace std;
      36             : 
      37             : /** ROOT macro for the implementation of ROOT specific class methods */
      38           8 : ClassImp(AliHLTJets)
      39             : 
      40             : /*
      41             :  * ---------------------------------------------------------------------------------
      42             :  *                            Constructor / Destructor
      43             :  * ---------------------------------------------------------------------------------
      44             :  */
      45             : 
      46             : //##################################################################################
      47           0 : AliHLTJets::AliHLTJets() :
      48           0 :   fComment(""),
      49           0 :   fCurrentJetIndex(-1),
      50           0 :   fNAODJets(0),
      51           0 :   fAODJets(new TClonesArray( "AliAODJet", 50 )) {
      52             :   // see header file for class documentation
      53             :   // or
      54             :   // refer to README to build package
      55             :   // or
      56             :   // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
      57             :   
      58           0 : }
      59             : 
      60             : //##################################################################################
      61           0 : AliHLTJets::~AliHLTJets() {
      62             :   // see header file for class documentation
      63             : 
      64           0 :   if ( fAODJets ){
      65           0 :     fAODJets->Clear();
      66           0 :     delete fAODJets;
      67             :   }
      68           0 :   fAODJets = NULL;
      69           0 : }
      70             : 
      71             : /*
      72             :  * ---------------------------------------------------------------------------------
      73             :  *                                   Initialize / Reset
      74             :  * ---------------------------------------------------------------------------------
      75             :  */
      76             : 
      77             : //##################################################################################
      78             : void AliHLTJets::Reset() {
      79             :   // see header file for class documentation  
      80             : 
      81           0 :   fAODJets->Clear();
      82           0 :   fNAODJets = 0;
      83             : 
      84           0 :   return;
      85             : }
      86             : 
      87             : // #################################################################################
      88             : void AliHLTJets::ResetEvent() {
      89             :   // see header file for class documentation
      90             : 
      91           0 :   fCurrentJetIndex = -1; 
      92             :   
      93           0 :   return;
      94             : }
      95             : 
      96             : /*
      97             :  * ---------------------------------------------------------------------------------
      98             :  *                                     Getter
      99             :  * ---------------------------------------------------------------------------------
     100             :  */
     101             : 
     102             : //##################################################################################
     103             : AliAODJet* AliHLTJets::GetJet( Int_t iter ) const { 
     104             :   // see header file for class documentation
     105             :   
     106           0 :   if ( iter > fNAODJets )
     107           0 :     return NULL;
     108             :   else
     109           0 :     return reinterpret_cast<AliAODJet*>((*fAODJets)[iter]); 
     110           0 : }
     111             : 
     112             : //##################################################################################
     113             : AliAODJet* AliHLTJets::NextJet() { 
     114             :   // see header file for class documentation
     115             :   
     116           0 :   fCurrentJetIndex++;
     117           0 :   return GetJet( fCurrentJetIndex );
     118             : }
     119             : 
     120             : /*
     121             :  * ---------------------------------------------------------------------------------
     122             :  *                                     Setter
     123             :  * ---------------------------------------------------------------------------------
     124             :  */
     125             : 
     126             : //##################################################################################
     127             : void AliHLTJets::AddJet( Float_t eta, Float_t phi, Float_t pt, Float_t et ) {
     128             :   // see header file for class documentation
     129             :   
     130           0 :   if ( pt == 0. ) {
     131           0 :     HLTError("Jet Pt=0, eta=%f, phi=%f", eta, phi);
     132             :     return;
     133             :   }
     134             : 
     135             :   // -- create TLorentzVector
     136           0 :   TLorentzVector v;
     137           0 :   v.SetPtEtaPhiE( pt, eta, phi, et );
     138             : 
     139             :   // -- add AliAODJet
     140           0 :   new ((*fAODJets)[fNAODJets]) AliAODJet(v);
     141           0 :   fNAODJets++;
     142             : 
     143             :   return;
     144           0 : }
     145             : 
     146             : //##################################################################################
     147             : void AliHLTJets::AddJet( AliAODJet* jet ) {
     148             :   // see header file for class documentation
     149             : 
     150           0 :   if ( jet->Pt() == 0. ) {
     151           0 :     HLTError("Jet Pt=0, eta=%f, phi=%f", jet->Eta(), jet->Phi());
     152             :     return;
     153             :   }
     154             : 
     155             :   // -- create TLorentzVector
     156           0 :   TLorentzVector v;
     157           0 :   v.SetPtEtaPhiE( jet->Pt(), jet->Eta(), jet->Phi(), jet->E() );
     158             : 
     159             :   // -- add AliAODJet
     160           0 :   new ((*fAODJets)[fNAODJets]) AliAODJet(v);
     161           0 :   fNAODJets++;
     162             : 
     163             :   return;
     164           0 : }
     165             : 
     166             : /*
     167             :  * ---------------------------------------------------------------------------------
     168             :  *                                     Helper
     169             :  * ---------------------------------------------------------------------------------
     170             :  */
     171             : 
     172             : /** Sort Jets with decreasing Et */
     173             : void AliHLTJets::Sort() {
     174             :   // see header file for class documentation
     175             : 
     176           0 :   fAODJets->Sort();
     177           0 :   ResetEvent();
     178             : 
     179           0 :   return;
     180             : }

Generated by: LCOV version 1.11