LCOV - code coverage report
Current view: top level - STEER/STEERBase - AliDetectorTagCuts.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 30 3.3 %
Date: 2016-06-14 17:26:59 Functions: 1 8 12.5 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Author: Panos Christakoglou.                                           *
       3             :  * Contributors are mentioned in the code where appropriate.              *
       4             :  *                                                                        *
       5             :  * Permission to use, copy, modify and distribute this software and its   *
       6             :  * documentation strictly for non-commercial purposes is hereby granted   *
       7             :  * without fee, provided that the above copyright notice appears in all   *
       8             :  * copies and that both the copyright notice and this permission notice   *
       9             :  * appear in the supporting documentation. The authors make no claims     *
      10             :  * about the suitability of this software for any purpose. It is          *
      11             :  * provided "as is" without express or implied warranty.                  *
      12             :  **************************************************************************/
      13             : 
      14             : /* $Id$ */
      15             : 
      16             : //-----------------------------------------------------------------
      17             : //                   AliDetectorTagCuts class
      18             : //   This is the class to deal with the Detector tag level cuts
      19             : //   Origin: Panos Christakoglou, UOA-CERN, Panos.Christakoglou@cern.ch
      20             : //-----------------------------------------------------------------
      21             : 
      22             : class AliLog;
      23             : 
      24             : #include "AliDetectorTag.h"
      25             : #include "AliDetectorTagCuts.h"
      26             : 
      27             : #include "TObjString.h"
      28             : #include "TString.h"
      29             : 
      30         176 : ClassImp(AliDetectorTagCuts)
      31             : 
      32             : //___________________________________________________________________________
      33             : AliDetectorTagCuts::AliDetectorTagCuts() :
      34           0 :   TObject(),
      35           0 :   fDetectorsReco(0),
      36           0 :   fDetectorsDAQ(0),
      37           0 :   fDetectorsFlag(kFALSE),
      38           0 :   fDetectorValidityMatch(),
      39           0 :   fDetectorValidityFlag()
      40           0 : {
      41             :   //Default constructor which calls the Reset method.
      42           0 :   for (int iter = 0; iter<AliDAQ::kHLTId; iter++) {
      43           0 :     fDetectorValidityMatch[iter] = 0;
      44           0 :     fDetectorValidityFlag[iter] = 0;
      45             :   }
      46           0 : }
      47             : 
      48             : //___________________________________________________________________________
      49           0 : AliDetectorTagCuts::~AliDetectorTagCuts() {  
      50             :   //Defaut destructor.
      51           0 : }
      52             : 
      53             : //___________________________________________________________________________
      54             : Bool_t AliDetectorTagCuts::IsAccepted(AliDetectorTag *detTag) const {
      55             :   //Returns true if the event is accepted otherwise false.
      56           0 :   if (fDetectorsFlag) {
      57           0 :     Bool_t daqsel = (detTag->GetIntDetectorMaskDAQ() & fDetectorsDAQ) > 0;
      58           0 :     Bool_t recsel = (detTag->GetIntDetectorMaskReco() & fDetectorsReco) > 0;
      59             :     Bool_t valsel = kTRUE;
      60           0 :     for (int iter=0;  iter<AliDAQ::kHLTId; iter++) {
      61           0 :       if (fDetectorValidityFlag[iter])
      62           0 :         if (!(fDetectorValidityMatch[iter] == detTag->GetDetectorValidityRange(iter)))
      63           0 :           valsel = kFALSE;
      64             :     }
      65           0 :     return (daqsel && recsel && valsel);
      66             :   }
      67           0 :   return true;
      68             : 
      69             : //   if(fDetectorsFlag){
      70             : //     TString detStr = fDetectors;
      71             : //     TObjArray *activeDetectors = detTag->GetDetectorMask();
      72             : //     for (Int_t iDet = 0; iDet < activeDetectors->GetEntries(); iDet++) {
      73             : //       TObjString *detectorString = (TObjString *)activeDetectors->At(iDet);
      74             : //       if (!IsSelected(detectorString->GetString(), detStr))return kFALSE;
      75             : //     }
      76             : //   }
      77             : //   return kTRUE;
      78           0 : }
      79             :   
      80             : void AliDetectorTagCuts::SetDetectorValidityValue(TString det, UShort_t val)
      81             : {
      82             :   // Set Validity requiement for detector
      83             : 
      84           0 :   Short_t detid = AliDAQ::DetectorID(det.Data());
      85           0 :   if (detid >= 0) {
      86           0 :     fDetectorValidityMatch[detid] = val;
      87           0 :     fDetectorsFlag = kTRUE;
      88           0 :   }
      89           0 : }
      90             : 
      91             : //___________________________________________________________________________
      92             : // Bool_t AliDetectorTagCuts::IsSelected(TString detName, TString& detectors) const {
      93             : //   //Returns true if the detector is included
      94             : //   if ((detectors.CompareTo("ALL") == 0) ||
      95             : //       detectors.BeginsWith("ALL ") ||
      96             : //       detectors.EndsWith(" ALL") ||
      97             : //       detectors.Contains(" ALL ")) {
      98             : //     detectors = "ALL";
      99             : //     return kTRUE;
     100             : //   }
     101             :   
     102             : //   // search for the given detector
     103             : //   Bool_t result = kFALSE;
     104             : //   if ((detectors.CompareTo(detName) == 0) ||
     105             : //       detectors.BeginsWith(detName+" ") ||
     106             : //       detectors.EndsWith(" "+detName) ||
     107             : //       detectors.Contains(" "+detName+" ")) {
     108             : //     detectors.ReplaceAll(detName, "");
     109             : //     result = kTRUE;
     110             : //   }
     111             : 
     112             : //   // clean up the detectors string
     113             : //   while (detectors.Contains("  ")) detectors.ReplaceAll("  ", " ");
     114             : //   while (detectors.BeginsWith(" ")) detectors.Remove(0, 1);
     115             : //   while (detectors.EndsWith(" ")) detectors.Remove(detectors.Length()-1, 1);
     116             :  
     117             : //   return result;
     118             : // }

Generated by: LCOV version 1.11