LCOV - code coverage report
Current view: top level - STEER/ESD - AliESDHLTDecision.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 17 99 17.2 %
Date: 2016-06-14 17:26:59 Functions: 8 16 50.0 %

          Line data    Source code
       1             : // $Id$
       2             : //**************************************************************************
       3             : //* This file is property of and copyright by the ALICE HLT Project        *
       4             : //* ALICE Experiment at CERN, All rights reserved.                         *
       5             : //*                                                                        *
       6             : //* Primary Authors: Matthias.Richter@ift.uib.no                           *
       7             : //*                  for The ALICE HLT Project.                            *
       8             : //*                                                                        *
       9             : //* Permission to use, copy, modify and distribute this software and its   *
      10             : //* documentation strictly for non-commercial purposes is hereby granted   *
      11             : //* without fee, provided that the above copyright notice appears in all   *
      12             : //* copies and that both the copyright notice and this permission notice   *
      13             : //* appear in the supporting documentation. The authors make no claims     *
      14             : //* about the suitability of this software for any purpose. It is          *
      15             : //* provided "as is" without express or implied warranty.                  *
      16             : //**************************************************************************
      17             : 
      18             : /// @file   AliESDHLTDecision.cxx
      19             : /// @author matthias.richter@ift.uib.no
      20             : /// @date   23 Nov 2009
      21             : /// @brief  Container for HLT decision within the ESD
      22             : ///
      23             : /// A container for the HLT trigger decision stored in the ESD.
      24             : /// The HLT trigger decision is evaluated by the HLTGlobalTrigger component
      25             : /// according to different trigger inputs and the HLT trigger menu.
      26             :  
      27             : #include "AliESDHLTDecision.h"
      28             : #include <iostream>
      29             : 
      30             : using std::endl;
      31             : using std::cout;
      32         172 : ClassImp(AliESDHLTDecision)
      33             : 
      34             : AliESDHLTDecision::AliESDHLTDecision()
      35          30 :   : TNamed(fgkName, "")
      36          60 :   , fInputObjectInfo(TNamed::Class())
      37          30 :   , fTriggerItems()
      38          30 :   , fCounters()
      39         150 : {
      40             :   /// constructor
      41          60 : }
      42             : 
      43             : const char* AliESDHLTDecision::fgkName="HLTGlobalTrigger";
      44             : 
      45             : AliESDHLTDecision::AliESDHLTDecision(bool result, const char* description)
      46           8 :   : TNamed(fgkName, description)
      47          16 :   , fInputObjectInfo(TNamed::Class())
      48           8 :   , fTriggerItems()
      49           8 :   , fCounters()
      50          24 : {
      51             :   /// constructor
      52           8 :   SetBit(kTriggerResult, result);
      53          16 : }
      54             : 
      55             : AliESDHLTDecision::AliESDHLTDecision(const AliESDHLTDecision& src)
      56           0 :   : TNamed(src)
      57           0 :   , fInputObjectInfo(src.fInputObjectInfo)
      58           0 :   , fTriggerItems(src.fTriggerItems)
      59           0 :   , fCounters(src.fCounters)
      60           0 : {
      61             :   /// copy constructor, performs a deep copy
      62           0 : }
      63             : 
      64             : AliESDHLTDecision& AliESDHLTDecision::operator=(const AliESDHLTDecision& src)
      65             : {
      66             :   /// assignment operator
      67           0 :   TNamed::operator=(src);
      68             : 
      69           0 :   fInputObjectInfo=src.fInputObjectInfo;
      70           0 :   fTriggerItems=src.fTriggerItems;
      71           0 :   fCounters=src.fCounters;
      72             : 
      73           0 :   return *this;
      74             : }
      75             : 
      76             : AliESDHLTDecision::~AliESDHLTDecision()
      77         152 : {
      78             :   /// destructor
      79          28 :   fInputObjectInfo.Delete();
      80          76 : }
      81             : 
      82             : const char* AliESDHLTDecision::GetDescription() const
      83             : {
      84             :   /// get the description of the global trigger decision
      85           0 :   return GetTitle();
      86             : }
      87             : 
      88             : Bool_t    AliESDHLTDecision::IsTriggerFired(const char* name) const
      89             : {
      90             :   /// check whether the HLT global trigger has fired, or
      91             :   /// for a specific HLT trigger class if specified
      92             : 
      93             :   // TODO: the complete functionality must be implemented
      94             :   // The HLT global trigger evaluates the trigger decision
      95             :   // according to the trigger input and the trigger menu. It
      96             :   // supports priority groups, allowing items to take precedence
      97             :   // over others. The simplest scheme is an 'OR' of all items.
      98             :   // This is implemented here, and the full and correct handling
      99             :   // needs to be implemented.
     100           0 :   Option_t* option=this->GetOption();
     101           0 :   if (option==NULL || *option!='1') return kFALSE;
     102             : 
     103           0 :   if (name) {
     104           0 :     TString description=GetDescription();
     105           0 :     Int_t index=description.Index(name);
     106           0 :     if (index<0) return kFALSE;
     107           0 :     index+=strlen(name);
     108           0 :     if (index>=description.Length()) return kFALSE;
     109           0 :     if (description[index]!=0 && description[index]!=' ') return kFALSE;
     110           0 :   }
     111           0 :   return kTRUE;
     112           0 : }
     113             : 
     114             : void AliESDHLTDecision::Print(Option_t* option ) const
     115             : {
     116             :   /// Inherited from TObject. Print Information.
     117           0 :   TString opt(option);
     118           0 :   if (opt.Contains("compact"))
     119             :   {
     120           0 :     cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl;
     121           0 :     cout << "    Description = \"" << GetDescription() << "\"" << endl;
     122             :   }
     123           0 :   else if (opt.Contains("short"))
     124             :   {
     125           0 :     cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl;
     126           0 :     cout << "    Description = \"" << GetDescription() << "\"" << endl;
     127           0 :     cout << "#################### Input trigger decisions ####################" << endl;
     128           0 :     TIter next(&fInputObjectInfo);
     129             :     TObject* object=NULL;
     130             :     int count=0;
     131           0 :     while ((object=next())) {
     132           0 :       if (object->TestBit(kTriggerDecision)) {
     133           0 :         count++;
     134           0 :         cout << "Trigger " << object->GetName() << ": result = " << object->TestBit(kTriggerResult) << endl;
     135           0 :         cout << "    Description = \"" << object->GetTitle() << "\"" << endl;
     136             :       }
     137             :     }
     138           0 :     if (count==0) {
     139           0 :       cout << "(none)" << endl;
     140             :     }
     141           0 :   }
     142           0 :   else if (opt.Contains("counters"))
     143             :   {
     144           0 :     cout << "Counter\tValue" << endl;
     145           0 :     for (Int_t i = 0; i < fCounters.GetSize(); i++)
     146             :     {
     147           0 :       cout << i << "\t" << fCounters[i] << endl;
     148             :     }
     149           0 :     if (fCounters.GetSize() == 0)
     150             :     {
     151           0 :       cout << "(none)" << endl;
     152             :     }
     153             :   }
     154             :   else
     155             :   {
     156             :     TObject* object=NULL;
     157           0 :     cout << "Global Trigger " << GetName() << ": result = " << TestBit(kTriggerResult) << endl;
     158           0 :     cout << "    Description = \"" << GetDescription() << "\"" << endl;
     159           0 :     cout << "#################### Input trigger decisions ####################" << endl;
     160           0 :     TIter next(&fInputObjectInfo);
     161             :     int count=0;
     162           0 :     while ((object=next())) {
     163           0 :       if (object->TestBit(kTriggerDecision)) {
     164           0 :         count++;
     165           0 :         cout << "Trigger " << object->GetName() << ": result = " << object->TestBit(kTriggerResult) << endl;
     166           0 :         cout << "    Description = \"" << object->GetTitle() << "\"" << endl;
     167             :       }
     168             :     }
     169           0 :     if (count==0) {
     170           0 :       cout << "(none)" << endl;
     171             :     }
     172           0 :     cout << "###################### Other input objects ######################" << endl;
     173             :     count=0;
     174           0 :     next.Reset();
     175           0 :     while ((object=next())) {
     176           0 :       if (!object->TestBit(kTriggerDecision)) {
     177           0 :         cout << "------------------------ Input object " << count << " ------------------------" << endl;
     178           0 :         object->Print(option);
     179           0 :         count++;
     180           0 :       }
     181             :     }
     182           0 :     if (count==0) {
     183           0 :       cout << "(none)" << endl;
     184             :     }
     185           0 :     cout << "#################### Event class counters ####################" << endl;
     186           0 :     cout << "Counter\tValue" << endl;
     187           0 :     for (Int_t i = 0; i < fCounters.GetSize(); i++)
     188             :     {
     189           0 :       cout << i << "\t" << fCounters[i] << endl;
     190             :     }
     191           0 :     if (fCounters.GetSize() == 0)
     192             :     {
     193           0 :       cout << "(none)" << endl;
     194             :     }
     195           0 :   }
     196           0 : }
     197             : 
     198             : void AliESDHLTDecision::Copy(TObject &object) const
     199             : {
     200             :   /// Inherited from TObject. Copy this to the specified object.
     201           0 :   if (object.IsA() != IsA()) return;
     202             : 
     203           0 :   AliESDHLTDecision& target=dynamic_cast<AliESDHLTDecision&>(object);
     204           0 :   target=*this;
     205           0 : }
     206             : 
     207             : TObject *AliESDHLTDecision::Clone(const char */*newname*/) const
     208             : {
     209             :   /// Inherited from TObject. Create a new clone.
     210           0 :   return new AliESDHLTDecision(*this);
     211           0 : }

Generated by: LCOV version 1.11