LCOV - code coverage report
Current view: top level - ANALYSIS/ANALYSISalice - AliESDTrackSelection.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 21 4.8 %
Date: 2016-06-14 17:26:59 Functions: 1 6 16.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-2015, 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             : #include <AliESDTrackSelection.h>
      16             : #include <TBits.h>
      17             : #include <TClonesArray.h>
      18             : #include <TObjArray.h>
      19             : #include <memory>
      20             : 
      21             : #include "AliESDEvent.h"
      22             : #include "AliESDtrack.h"
      23             : #include "AliESDtrackCuts.h"
      24             : #include "AliLog.h"
      25             : #include "AliVCuts.h"
      26             : 
      27             : /// \cond CLASSIMP
      28         170 : ClassImp(AliESDTrackSelection)
      29             : /// \endcond
      30             : 
      31             : /**
      32             :  * Default constructor
      33             :  */
      34             : AliESDTrackSelection::AliESDTrackSelection():
      35           0 :                 AliVTrackSelection()
      36           0 : {
      37           0 : }
      38             : 
      39             : /**
      40             :  * Constructor with cuts
      41             :  */
      42             : AliESDTrackSelection::AliESDTrackSelection(AliVCuts* cuts):
      43           0 :                 AliVTrackSelection()
      44           0 : {
      45           0 :   this->AddTrackCuts(cuts);
      46           0 : }
      47             : 
      48             : /**
      49             :  * Check whether track is accepted. Iterates over all cuts assigned to the track selection.
      50             :  *
      51             :  * \param trk: Track to check
      52             :  * \return: true if selected, false otherwise
      53             :  */
      54             : bool AliESDTrackSelection::IsTrackAccepted(AliVTrack* const trk) {
      55           0 :   if (!fListOfCuts) return kTRUE;
      56           0 :   AliESDtrack *esdt = dynamic_cast<AliESDtrack *>(trk);
      57           0 :   if(!esdt){
      58           0 :     AliError("Failed getting ESD track");
      59           0 :     return kFALSE;
      60             :   }
      61           0 :   fTrackBitmap.ResetAllBits();
      62             :   Int_t cutcounter = 0;
      63           0 :   for (TIter cutIter = TIter(fListOfCuts).Begin(); cutIter != TIter::End(); ++cutIter){
      64           0 :     if((static_cast<AliVCuts *>(*cutIter))->IsSelected(esdt)) fTrackBitmap.SetBitNumber(cutcounter);
      65           0 :     cutcounter++;
      66             :   }
      67             :   // In case of ANY at least one bit has to be set, while in case of ALL all bits have to be set
      68           0 :   if (fSelectionModeAny){
      69           0 :     return fTrackBitmap.CountBits() > 0 || cutcounter == 0;
      70             :   } else {
      71           0 :     return fTrackBitmap.CountBits() == cutcounter;
      72             :   }
      73           0 : }

Generated by: LCOV version 1.11