LCOV - code coverage report
Current view: top level - STEER/ESD - AliTriggerInput.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 36 90 40.0 %
Date: 2016-06-14 17:26:59 Functions: 6 12 50.0 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-1999, 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             : //
      20             : //  Class to define a Trigger Input from an specific detector                                                                                           //
      21             : //
      22             : //
      23             : //                        name         description     id mask
      24             : //    Ej:
      25             : //      AliTriggerInput( "V0_MB_L0", "VO minimum bias", 0x01 );
      26             : //      AliTriggerInput( "V0_SC_L0", "VO semi central", 0x02 );
      27             : //      AliTriggerInput( "V0_C_L0",  "VO central",      0x04 );
      28             : //
      29             : //    The name must be globaly unique. Spaces are not allowed.
      30             : //    As convention should start with detector name then an id
      31             : //    and the trigger level (L0, L1, L2) separated by "_"
      32             : //    for valid detector names see AliTriggerCluster::fgkDetectorName
      33             : //
      34             : //    A maximun of 60 inputs trigger are allow.
      35             : //    So, the id mask should set only bit from the position 1 to 60.
      36             : //
      37             : ///////////////////////////////////////////////////////////////////////////////
      38             : 
      39             : #include <Riostream.h>
      40             : #include <TMath.h>
      41             : 
      42             : #include "AliLog.h"
      43             : #include "AliTriggerInput.h"
      44             : 
      45             : using std::endl;
      46             : using std::cout;
      47         172 : ClassImp( AliTriggerInput )
      48             : 
      49             : Bool_t AliTriggerInput::fgkIsTriggerDetector[AliDAQ::kNDetectors] = {1,0,0,1,1,1,0,1,0,0,0,1,0,1,1,1,1,1,1,1,0,1,0,0,0};
      50             : const char* AliTriggerInput::fgkCTPDetectorName[AliDAQ::kNDetectors] = {
      51             :   "SPD",
      52             :   "SDD",
      53             :   "SSD",
      54             :   "TPC",
      55             :   "TRD",
      56             :   "TOF",
      57             :   "HMPID",
      58             :   "PHOS",
      59             :   "CPV",
      60             :   "PMD",
      61             :   "MUON_TRK",
      62             :   "MUON_TRG",
      63             :   "FMD",
      64             :   "T0",
      65             :   "V0",
      66             :   "ZDC",
      67             :   "ACORDE",
      68             :   "CTP",
      69             :   "EMCal",
      70             :   "DAQ_TEST",
      71             :   "EMPTY",
      72             :   "AD",
      73             :   "MFT",
      74             :   "FIT",
      75             :   "HLT"
      76             : };
      77             : //_____________________________________________________________________________
      78             :   AliTriggerInput::AliTriggerInput():
      79         172 :     TNamed(),
      80         172 :     fMask( 0 ),
      81         172 :     fValue( 0 ),
      82         172 :     fSignature( -1),
      83         172 :     fLevel(0),
      84         172 :     fDetectorId(-1),
      85         172 :     fIsActive(kFALSE),
      86         172 :     fIndexCTP(0),
      87         172 :     fIndexSwitch(0)
      88        1032 : {}
      89             : //____________________________________________________________________________
      90             :  AliTriggerInput::AliTriggerInput( AliTriggerInput & inp ): 
      91           0 :    TNamed( inp ),
      92           0 :    fMask( inp.fMask ),
      93           0 :    fValue( inp.fValue ),
      94           0 :    fSignature( inp.fSignature ),
      95           0 :    fLevel( inp.fLevel),
      96           0 :    fDetectorId( inp.fDetectorId),
      97           0 :    fIsActive(kFALSE),
      98           0 :    fIndexCTP(inp.fIndexCTP),
      99           0 :    fIndexSwitch(inp.fIndexSwitch)
     100           0 :    {}
     101             : //_____________________________________________________________________________
     102             :   AliTriggerInput::AliTriggerInput( TString name, TString det, UChar_t level, Int_t signature, Char_t number ):
     103         346 :     TNamed( name.Data(), det.Data() ),
     104         714 :     fMask((number > 0) ? 1 << (number-1) : 0 ),
     105         346 :     fValue(0),
     106         346 :     fSignature(signature),
     107         346 :     fLevel(level),
     108         346 :     fDetectorId(-1),
     109         346 :     fIsActive(kFALSE),
     110         346 :     fIndexCTP(number),
     111         346 :     fIndexSwitch(0)
     112        1730 : {
     113             :    //  Standard constructor
     114             :    //
     115             :    //    The name must be globaly unique. Spaces are not allowed.
     116             :    //    For valid detector names see AliDAQ::fgkDetectorName
     117             : 
     118             :    // Check for valid detector name
     119             :    Int_t iDet = 0;
     120        7068 :    for( iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) {
     121        3534 :      if( !fgkIsTriggerDetector[iDet] ) continue;
     122        3892 :       if( det.CompareTo( fgkCTPDetectorName[iDet] ) == 0 ) {
     123         356 :         fTitle = AliDAQ::DetectorName(iDet);
     124         178 :         fDetectorId = iDet;
     125         178 :         break;
     126             :       }
     127        5304 :       if( det.CompareTo( AliDAQ::DetectorName(iDet) ) == 0 ) {
     128         168 :         fDetectorId = iDet;
     129         168 :         break;
     130             :       }
     131             :    }
     132         346 :    if( iDet == AliDAQ::kNDetectors ) {
     133           0 :       AliError( Form( "%s is not a valid trigger input, it must contain a valid trigger detector name instead of (%s)", name.Data(), det.Data() ) );
     134             :    }
     135         692 : }
     136             : //_____________________________________________________________________________
     137             :   AliTriggerInput::AliTriggerInput( TString name, TString det, UChar_t level, Int_t signature, UInt_t indexCTP, UInt_t indexSwitch ):
     138           0 :     TNamed( name.Data(), det.Data() ),
     139           0 :     fMask((indexCTP > 0) ? 1 << (indexCTP-1) : 0 ),
     140           0 :     fValue(0),
     141           0 :     fSignature(signature),
     142           0 :     fLevel(level),
     143           0 :     fDetectorId(-1),
     144           0 :     fIsActive(kFALSE),
     145           0 :     fIndexCTP(indexCTP),
     146           0 :     fIndexSwitch(indexSwitch)
     147           0 : {
     148             :    //  Standard constructor
     149             :    //
     150             :    //    The name must be globaly unique. Spaces are not allowed.
     151             :    //    For valid detector names see AliDAQ::fgkDetectorName
     152             : 
     153             :    // Check for valid detector name
     154             :    Int_t iDet = 0;
     155           0 :    for( iDet = 0; iDet < AliDAQ::kNDetectors; iDet++ ) {
     156           0 :      if( !fgkIsTriggerDetector[iDet] ) continue;
     157           0 :       if( det.CompareTo( fgkCTPDetectorName[iDet] ) == 0 ) {
     158           0 :         fTitle = AliDAQ::DetectorName(iDet);
     159           0 :         fDetectorId = iDet;
     160           0 :         break;
     161             :       }
     162           0 :       if( det.CompareTo( AliDAQ::DetectorName(iDet) ) == 0 ) {
     163           0 :         fDetectorId = iDet;
     164           0 :         break;
     165             :       }
     166             :    }
     167           0 :    if( iDet == AliDAQ::kNDetectors ) {
     168           0 :       AliError( Form( "%s is not a valid trigger input, it must contain a valid trigger detector name instead of (%s)", name.Data(), det.Data() ) );
     169             :    }
     170           0 : }
     171             : //_____________________________________________________________________________
     172             : void AliTriggerInput::Print( const Option_t* ) const
     173             : {
     174             :    // Print
     175           0 :    cout << "Trigger Input:" << endl; 
     176           0 :    cout << "  Name:        " << GetName() << endl;
     177           0 :    cout << "  Detector:    " << GetTitle() << "(Id=" << (Int_t)fDetectorId << ")" << endl;
     178           0 :    cout << "  Level:       " << (Int_t)fLevel << endl;
     179           0 :    cout << "  Signature:   " << fSignature << endl;
     180           0 :    cout << "  CTP index:      " << fIndexCTP << endl;
     181           0 :    cout << "  Switch index:      " << fIndexSwitch << endl;
     182           0 :    if (IsActive())
     183           0 :      cout << "   Input is active      " << endl;
     184             :    else
     185           0 :      cout << "   Input is not active  " << endl;
     186           0 :    if (Status())
     187           0 :      cout << "   Input is fired      " << endl;
     188             :    else
     189           0 :      cout << "   Input is not fired  " << endl;
     190           0 : }
     191             : 
     192             : //_____________________________________________________________________________
     193             : TString AliTriggerInput::GetModule() const
     194             : {
     195             :   // Get the detector module name (in AliRoot simulation sense)
     196        1452 :   TString name = "";
     197        1452 :   if (fDetectorId >= 0 && fDetectorId < AliDAQ::kNDetectors)
     198        1452 :     name = AliDAQ::OfflineModuleName((Int_t)fDetectorId);
     199             :   else
     200           0 :     AliError(Form("Invalid detector Id (%d)",(Int_t)fDetectorId));
     201             : 
     202             :   return name;
     203        1452 : }
     204             : UInt_t AliTriggerInput::GetIndexCTP() const
     205             : {
     206           0 :  if(fIndexCTP==0){
     207           0 :    for(UInt_t i=0;i<24;i++){
     208           0 :      if((1<<i) & fMask) return (i+1);
     209             :    }
     210           0 :   return 0;
     211             :  }
     212           0 :  return fIndexCTP;
     213           0 : }

Generated by: LCOV version 1.11