LCOV - code coverage report
Current view: top level - EMCAL/EMCALTriggerBase - AliEMCALTriggerQA.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 69 4.3 %
Date: 2016-06-14 17:26:59 Functions: 4 15 26.7 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * Copyright(c) 1998-2016, 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             :  * @file AliEMCALTriggerQA.cxx
      17             :  * @date Apr. 4, 2016
      18             :  * @author Salvatore Aiola <salvatore.aiola@cern.ch>, Yale University
      19             :  */
      20             : 
      21             : #include "AliEMCALTriggerPatchInfo.h"
      22             : #include "AliEMCALTriggerConstants.h"
      23             : #include "AliEMCALGeometry.h"
      24             : 
      25             : #include "AliEMCALTriggerQA.h"
      26             : 
      27             : using namespace EMCALTrigger;
      28             : 
      29             : /// \cond CLASSIMP
      30          22 : ClassImp(AliEMCALTriggerQA)
      31             : /// \endcond
      32             : 
      33             : const Int_t AliEMCALTriggerQA::fgkMaxPatchAmp[6] = {2000, 2000, 2000, 6000, 6000, 5000};
      34         121 : const TString AliEMCALTriggerQA::fgkPatchTypes[3] = {"Online", "Recalc", "Offline"};
      35             : 
      36             : /**
      37             :  * Default constructor for ROOT I/O
      38             :  */
      39             : AliEMCALTriggerQA::AliEMCALTriggerQA():
      40           0 :   TNamed(),
      41           0 :   fFastorL0Th(400),
      42          99 :   fFastorL1Th(400),
      43           0 :   fADCperBin(16),
      44           0 :   fDebugLevel(0),
      45           0 :   fTimeStampBinWidth(0),
      46           0 :   fGeom(0),
      47           0 :   fEventTimeStamp(0),
      48           0 :   fEventTimeStampBin(0)
      49           0 : {
      50           0 :   memset(fEnabledTriggerPatches, 0, sizeof(fEnabledTriggerPatches));
      51           0 : }
      52             : 
      53             : /**
      54             :  * Named constructor
      55             :  * \param name Name of the object
      56             :  */
      57             : AliEMCALTriggerQA::AliEMCALTriggerQA(const char* name):
      58           0 :   TNamed(name,name),
      59           0 :   fFastorL0Th(400),
      60           0 :   fFastorL1Th(400),
      61           0 :   fADCperBin(16),
      62           0 :   fDebugLevel(0),
      63           0 :   fTimeStampBinWidth(0),
      64           0 :   fGeom(0),
      65           0 :   fEventTimeStamp(0),
      66           0 :   fEventTimeStampBin(0)
      67           0 : {
      68           0 :   memset(fEnabledTriggerPatches, 0, sizeof(fEnabledTriggerPatches));
      69           0 : }
      70             : 
      71             : /**
      72             : * Copy Constructor
      73             : * \param ref Constant reference to copy from
      74             : */
      75             : AliEMCALTriggerQA::AliEMCALTriggerQA(const AliEMCALTriggerQA& ref) :
      76           0 :   TNamed(ref),
      77           0 :   fFastorL0Th(ref.fFastorL0Th),
      78           0 :   fFastorL1Th(ref.fFastorL1Th),
      79           0 :   fADCperBin(ref.fADCperBin),
      80           0 :   fDebugLevel(ref.fDebugLevel),
      81           0 :   fTimeStampBinWidth(0),
      82           0 :   fGeom(0),
      83           0 :   fEventTimeStamp(0),
      84           0 :   fEventTimeStampBin(0)
      85           0 : {
      86           0 :   memcpy(fEnabledTriggerPatches, ref.fEnabledTriggerPatches, sizeof(fEnabledTriggerPatches));
      87           0 : }
      88             : 
      89             : /**
      90             :  * Destructor
      91             :  */
      92             : AliEMCALTriggerQA::~AliEMCALTriggerQA()
      93           0 : {
      94           0 : }
      95             : 
      96             : /**
      97             :  * Set the patch types to be plotted
      98             :  * \param patchtype Patch type (online, recalc,offline) of which the status is being changed
      99             :  * \param triggertype Trigger type of which the status is being changed
     100             :  * \param e    Either enable or disable
     101             :  */
     102             : void AliEMCALTriggerQA::EnablePatchType(PatchTypes_t patchtype, EMCalTriggerType_t triggertype, Bool_t e)
     103             : {
     104           0 :   if (e) {
     105           0 :     fEnabledTriggerPatches[patchtype] |= BIT(triggertype);
     106           0 :   }
     107             :   else {
     108           0 :     fEnabledTriggerPatches[patchtype] &= ~(BIT(triggertype));
     109             :   }
     110           0 : }
     111             : 
     112             : /**
     113             :  * Check whether a patch type is enabled
     114             :  * \param patchtype Patch type (online, recalc,offline) of which the status is being changed
     115             :  * \param triggertype Trigger type of which the status is being changed
     116             :  */
     117             : Bool_t AliEMCALTriggerQA::IsPatchTypeEnabled(Int_t patchtype, Int_t triggertype) const
     118             : {
     119           0 :   if (patchtype < 0 || patchtype > 2) return kFALSE;
     120           0 :   if (triggertype < 0 || triggertype > 31) return kFALSE;
     121           0 :   if ((fEnabledTriggerPatches[patchtype] & BIT(triggertype)) != 0) {
     122           0 :     return kTRUE;
     123             :   }
     124             :   else {
     125           0 :     return kFALSE;
     126             :   }
     127           0 : }
     128             : 
     129             : /**
     130             :  * Return the amplitude of the patch (online, recalc, offline)
     131             :  * \param patch Pointer to a AliEMCALTriggerPatchInfo object
     132             :  * \param itype Amplitude type (online, recalc, offline)
     133             :  * \return amplitude
     134             :  */
     135             : Int_t AliEMCALTriggerQA::GetAmplitude(const AliEMCALTriggerPatchInfo* patch, Int_t itype)
     136             : {
     137           0 :   if (!patch) return 0;
     138           0 :   if (itype == 0 || itype == 1) {
     139           0 :     return patch->GetADCAmp();
     140             :   }
     141           0 :   else if (itype == 2) {
     142           0 :     return patch->GetADCOfflineAmp();
     143             :   }
     144             :   else {
     145           0 :     return 0;
     146             :   }
     147           0 : }
     148             : 
     149             : /**
     150             :  * This function should be called every event to set the new time stamp.
     151             :  * It sets the time stamp in the internal field, computes the time stamp bin
     152             :  * based on fTimeStampBinWidth.
     153             :  * \param timeStamp Time stamp of the event
     154             :  */
     155             : void AliEMCALTriggerQA::EventTimeStamp(UInt_t timeStamp)
     156             : {
     157           0 :   fEventTimeStamp = timeStamp;
     158             : 
     159           0 :   if (fTimeStampBinWidth == 0) return;
     160             : 
     161           0 :   UInt_t timeStampBins = fEventTimeStamp / fTimeStampBinWidth;
     162           0 :   fEventTimeStampBin = timeStampBins*fTimeStampBinWidth;
     163           0 : }
     164             : 
     165             : /// Actions to be executed only once for the first event
     166             : void AliEMCALTriggerQA::ExecOnce()
     167             : {
     168           0 :   if (!fGeom) {
     169           0 :     fGeom = AliEMCALGeometry::GetInstance();
     170           0 :     if (!fGeom) {
     171           0 :       AliError("Could not get geometry!");
     172           0 :     }
     173             :   }
     174           0 : }

Generated by: LCOV version 1.11