LCOV - code coverage report
Current view: top level - STEER/AOD - AliAODJet.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 21 134 15.7 %
Date: 2016-06-14 17:26:59 Functions: 6 18 33.3 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-2007, 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             : //     AOD class for jets
      20             : //     Author: Andreas Morsch, CERN
      21             : //-------------------------------------------------------------------------
      22             : 
      23             : #include <TLorentzVector.h>
      24             : #include "AliAODJet.h"
      25             : 
      26         170 : ClassImp(AliAODJet)
      27             : 
      28             : 
      29             : //______________________________________________________________________________
      30             : AliAODJet::AliAODJet() :
      31           2 :     AliVParticle(),
      32           2 :     fNeutralFraction(0),
      33           2 :     fPtLeadingConstituent(-1.),
      34           2 :     fTrigger(0),
      35           2 :     fMomentum(0),
      36           2 :     fVectorAreaCharged(0),
      37           6 :     fRefTracks(new TRefArray())
      38          10 : {
      39             :   // constructor
      40           2 :     fBackgEnergy[0]   = 0.;     
      41           2 :     fBackgEnergy[1]   = 0.;
      42           2 :     fEffectiveArea[0] = 0.;   
      43           2 :     fEffectiveArea[1] = 0.;   
      44           2 :     fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;
      45           2 :     fPtSubtracted[0] =   fPtSubtracted[1] = 0;
      46           4 : }
      47             : 
      48             : AliAODJet::AliAODJet(Double_t px, Double_t py, Double_t pz, Double_t e):
      49           0 :     AliVParticle(),
      50           0 :     fNeutralFraction(0),
      51           0 :     fPtLeadingConstituent(-1.),
      52           0 :     fTrigger(0),
      53           0 :     fMomentum(0),
      54           0 :     fVectorAreaCharged(0),
      55           0 :     fRefTracks(new TRefArray())
      56             : 
      57             : 
      58           0 : {
      59             :   // constructor
      60           0 :     fBackgEnergy[0]   = 0.;     
      61           0 :     fBackgEnergy[1]   = 0.;
      62           0 :     fEffectiveArea[0] = 0.;   
      63           0 :     fEffectiveArea[1] = 0.;
      64           0 :     fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;   
      65           0 :     fPtSubtracted[0] =   fPtSubtracted[1] = 0;
      66           0 :     fMomentum = new TLorentzVector(px, py, pz, e);
      67           0 : }
      68             : 
      69             : AliAODJet::AliAODJet(TLorentzVector & p):
      70           0 :     AliVParticle(),
      71           0 :     fNeutralFraction(0),
      72           0 :     fPtLeadingConstituent(-1.),
      73           0 :     fTrigger(0),
      74           0 :     fMomentum(0),
      75           0 :     fVectorAreaCharged(0),
      76           0 :     fRefTracks(new TRefArray())
      77             : 
      78           0 : {
      79             :   // constructor
      80           0 :     fBackgEnergy[0]   = 0.;     
      81           0 :     fBackgEnergy[1]   = 0.;
      82           0 :     fEffectiveArea[0] = 0.;   
      83           0 :     fEffectiveArea[1] = 0.;
      84           0 :     fEffectiveAreaError[0] = fEffectiveAreaError[1] = 0;    
      85           0 :     fPtSubtracted[0] =   fPtSubtracted[1] = 0;
      86           0 :     fMomentum = new TLorentzVector(p);
      87           0 : }
      88             : 
      89             : 
      90             : //______________________________________________________________________________
      91             : AliAODJet::~AliAODJet() 
      92          12 : {
      93             :   // destructor
      94           2 :     delete fMomentum;
      95           2 :     delete fVectorAreaCharged;
      96           4 :     delete fRefTracks;
      97           6 : }
      98             : 
      99             : //______________________________________________________________________________
     100             : AliAODJet::AliAODJet(const AliAODJet& jet) :
     101           0 :     AliVParticle(jet),
     102           0 :     fNeutralFraction(jet.fNeutralFraction),
     103           0 :     fPtLeadingConstituent(jet.fPtLeadingConstituent),
     104           0 :     fTrigger(jet.fTrigger),
     105           0 :     fMomentum(0),
     106           0 :     fVectorAreaCharged(0),
     107           0 :     fRefTracks(0)
     108             : 
     109           0 : {
     110             :   // Copy constructor
     111           0 :     fBackgEnergy[0]   = jet.fBackgEnergy[0];
     112           0 :     fBackgEnergy[1]   = jet.fBackgEnergy[1];
     113           0 :     fEffectiveArea[0] = jet.fEffectiveArea[0];
     114           0 :     fEffectiveArea[1] = jet.fEffectiveArea[1];
     115           0 :     fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
     116           0 :     fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
     117           0 :     fPtSubtracted[0] =   jet.fPtSubtracted[0];
     118           0 :     fPtSubtracted[1] =   jet.fPtSubtracted[1];
     119           0 :     if(jet.fMomentum)fMomentum  = new TLorentzVector(*jet.fMomentum);
     120           0 :     if(jet.fVectorAreaCharged)fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged);
     121           0 :     fRefTracks = new TRefArray(*jet.fRefTracks);
     122           0 : }
     123             : 
     124             : //______________________________________________________________________________
     125             : AliAODJet& AliAODJet::operator=(const AliAODJet& jet)
     126             : {
     127             :   // Assignment operator
     128           0 :   if(this!=&jet) {
     129             : 
     130           0 :     fBackgEnergy[0]   = jet.fBackgEnergy[0];
     131           0 :     fBackgEnergy[1]   = jet.fBackgEnergy[1];
     132           0 :     fEffectiveArea[0] = jet.fEffectiveArea[0];
     133           0 :     fEffectiveArea[1] = jet.fEffectiveArea[1];
     134           0 :     fEffectiveAreaError[0] = jet.fEffectiveAreaError[0];
     135           0 :     fEffectiveAreaError[1] = jet.fEffectiveAreaError[1];
     136           0 :     fPtSubtracted[0] =   jet.fPtSubtracted[0];
     137           0 :     fPtSubtracted[1] =   jet.fPtSubtracted[1];
     138           0 :     fNeutralFraction = jet.fNeutralFraction;
     139           0 :     fPtLeadingConstituent = jet.fPtLeadingConstituent;
     140           0 :     fTrigger = jet.fTrigger;
     141             :     
     142             :     
     143           0 :     if(jet.fMomentum){
     144           0 :       if(fMomentum)*fMomentum  = *jet.fMomentum;
     145           0 :       else fMomentum  = new TLorentzVector(*jet.fMomentum);
     146             :     }
     147             : 
     148           0 :     if(jet.fVectorAreaCharged){
     149           0 :         if(fVectorAreaCharged)*fVectorAreaCharged = *jet.fVectorAreaCharged;
     150           0 :         else fVectorAreaCharged = new TLorentzVector(*jet.fVectorAreaCharged);
     151             :       }
     152           0 :     delete fRefTracks;
     153           0 :     fRefTracks = new TRefArray(*jet.fRefTracks);    
     154             : 
     155             : 
     156           0 :   }
     157             : 
     158           0 :   return *this;
     159           0 : }
     160             : 
     161             : void AliAODJet::Print(Option_t* option) const
     162             : {
     163             : 
     164           0 :  if (!option) {
     165             :   // Print information of all data members
     166           0 :   printf("Jet 4-vector:\n");
     167           0 :   printf("     E  = %13.3f\n", E() );
     168           0 :   printf("     Px = %13.3f\n", Px());
     169           0 :   printf("     Py = %13.3f\n", Py());
     170           0 :   printf("     Pz = %13.3f\n", Pz());
     171           0 :   printf("Background Energy:\n");
     172           0 :   printf("Charged:  %13.3f\n", ChargedBgEnergy());
     173           0 :   printf("Neutral:  %13.3f\n", NeutralBgEnergy());
     174           0 :   printf("Total:    %13.3f\n", TotalBgEnergy());
     175           0 :   printf("Effective Area: \n");
     176           0 :   printf("Charged:  %13.3f\n", EffectiveAreaCharged());
     177           0 :   printf("Neutral:  %13.3f\n", EffectiveAreaNeutral());
     178           0 :   printf("Leading constituent: %f\n",GetPtLeading());
     179           0 :  }
     180             :  else {
     181           0 :   printf("Jet %s, Eta: %13.3f, Phi: %13.3f, Pt: %13.3f\n",option,Eta(),Phi(),Pt());
     182             :  }
     183             : 
     184           0 : }
     185             : 
     186             : void  AliAODJet::SetPxPyPzE(Double_t px, Double_t py, Double_t pz, Double_t e){
     187             :   // 
     188             :   // Set the four Momentum from outside
     189             :   // MomentumVector()->SetPxPyPzE() cannot be used since pointer can be 0x0
     190             :   //
     191             : 
     192           0 :   if(!fMomentum){
     193           0 :     fMomentum = new TLorentzVector(px,py,pz,e);
     194           0 :   }
     195             :   else{
     196           0 :     fMomentum->SetPxPyPzE(px,py,pz,e);
     197             :   }
     198           0 : }
     199             : 
     200             : void  AliAODJet::SetPtEtaPhiM(Double_t pt, Double_t eta, Double_t phi, Double_t m){
     201             :   // 
     202             :   // Set the four Momentum from outside with pt eta phi and M
     203             :   // MomentumVector()->SetPtPhiEtaM() cannot be used since pointer can be 0x0
     204             :   //
     205             : 
     206           0 :   if(!fMomentum){
     207           0 :     fMomentum = new TLorentzVector();
     208           0 :   }
     209           0 :   fMomentum->SetPtEtaPhiM(pt,eta,phi,m);
     210           0 : }
     211             : 
     212             : 
     213             : 
     214             : Double_t AliAODJet::DeltaR(const AliVParticle* part) const {
     215             : 
     216             :   // Helper function to calculate the distance between two jets
     217             :   // or a jet and particle
     218             : 
     219           0 :   Double_t dPhi = Phi() - part->Phi(); 
     220           0 :   if(dPhi>TMath::Pi())dPhi = dPhi - 2.*TMath::Pi();
     221           0 :   if(dPhi<(-1.*TMath::Pi()))dPhi = dPhi + 2.*TMath::Pi();
     222           0 :   Double_t dEta = Eta() - part->Eta(); 
     223           0 :   Double_t dR = TMath::Sqrt(dPhi*dPhi+dEta*dEta);
     224           0 :   return dR;
     225             : }
     226             : 
     227             : 
     228             : void  AliAODJet::AddTrack(TObject *tr) {
     229             :     // Add a track to the list of referenced tracks
     230           0 :     if (fRefTracks->GetEntries() == 0) {
     231           0 :       fRefTracks->Delete();
     232           0 :       new(fRefTracks) TRefArray(TProcessID::GetProcessWithUID(tr));
     233             :     }
     234             :     
     235           0 :     fRefTracks->Add(tr);
     236           0 : }
     237             : 

Generated by: LCOV version 1.11