LCOV - code coverage report
Current view: top level - HLT/EMCAL - AliHLTEMCALTriggerMaker.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 10 10.0 %
Date: 2016-06-14 17:26:59 Functions: 1 17 5.9 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * This file is property of and copyright by the ALICE HLT Project        *
       3             :  * All rights reserved.                                                   *
       4             :  *                                                                        *
       5             :  * Primary Authors: Markus Fasel                                          *
       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             : #ifndef ALIHLTEMCALTRIGGERMAKER_H
      17             : #define ALIHLTEMCALTRIGGERMAKER_H
      18             : 
      19             : /**
      20             :  * @file   AliHLTEMCALTriggerMaker.h
      21             :  * @author Markus Fasel
      22             :  * @date   Oct. 30, 2015
      23             :  * @brief  Trigger maker kernel used by the EMCAL HLT trigger maker component
      24             :  */
      25             : 
      26             : #include <TObject.h>
      27             : #include "AliHLTLogging.h"
      28             : 
      29             : struct AliHLTCaloTriggerPatchDataStruct;
      30             : class AliHLTEMCALGeometry;
      31             : 
      32             : class AliEMCALTriggerBitConfig;
      33             : class AliEMCALTriggerRawPatch;
      34             : template<typename T> class AliEMCALTriggerDataGrid;
      35             : template<typename T> class AliEMCALTriggerPatchFinder;
      36             : 
      37             : /**
      38             :  * @class AliHLTEMCALTriggerMaker
      39             :  * @brief EMCAL Trigger Maker implementation runnin on the HLT
      40             :  *
      41             :  * This class implements the trigger maker for the EMCAL in the
      42             :  * HLT.
      43             :  */
      44             : class AliHLTEMCALTriggerMaker : public TObject, public AliHLTLogging {
      45             : public:
      46             :   enum ELevel0TriggerStatus_t { kNotLevel0, kLevel0Candidate, kLevel0Fired };
      47             : 
      48             :   enum ThresholdType_t{
      49             :           kHighThreshold = 0,
      50             :           kLowThreshold = 1,
      51             :           kNthresholds = 2
      52             :   };
      53             :   /**
      54             :    * Constructor
      55             :    */
      56             :   AliHLTEMCALTriggerMaker();
      57             : 
      58             :   /**
      59             :    * Destructor
      60             :    */
      61             :   virtual ~AliHLTEMCALTriggerMaker();
      62             : 
      63             :   /**
      64             :    * Initializes the trigger maker kernel. Sets the geometry ptr,
      65             :    * allocates space for the trigger channels and configures the
      66             :    * trigger patch finder.
      67             :    *
      68             :    * Based on the geometry versions the trigger channel data grid is
      69             :    * allocated and the trigger patch finders in EMCAL (and DCAL if available)
      70             :    * are configured.
      71             :    *
      72             :    * @param geo Pointer to the geometry used in the trigger maker.
      73             :    */
      74             :   void Initialise(const AliHLTEMCALGeometry *geo);
      75             : 
      76             :   /**
      77             :    * Rest ADC values
      78             :    */
      79             :   void ResetADC();
      80             : 
      81             :   /**
      82             :    * Add digit structure to the data grid
      83             :    * @param digit Input digit data
      84             :    */
      85             :   void AddDigit(const AliHLTCaloDigitDataStruct *digit);
      86             : 
      87             :   /**
      88             :    * Set the adc value for a given col / row combination
      89             :    * @param col Column
      90             :    * @param row Row
      91             :    * @param adc ADC value
      92             :    */
      93             :   void SetADC(Int_t col, Int_t row, Float_t adc);
      94             : 
      95             :   /**
      96             :    * Set the L0 amplitude for a given col / row combination
      97             :    * @param col Column
      98             :    * @param row Row
      99             :    * @param amp L0 Amplitude
     100             :    */
     101             :   void SetL0Amplitude(Int_t col, Int_t row, Float_t amp);
     102             : 
     103             :   /**
     104             :    * Set the L0 trigger time for a given col / row combination
     105             :    * @param col Column
     106             :    * @param row Row
     107             :    * @param amp L0 trigger time
     108             :    */
     109             :   void SetL0Time(Int_t col, Int_t row, UChar_t time);
     110             : 
     111             :     /**
     112             :    * Set the bit mask from the STU for a given col / row combination
     113             :    * @param col Column
     114             :    * @param row Row
     115             :    * @param bitMask Bit mask
     116             :    */
     117             :   void SetBitMask(Int_t col, Int_t row, Int_t bitMask);
     118             : 
     119             :   /**
     120             :    * Set the pointer to the writeout buffer
     121             :    * @param outputcont Pointer to the writeout buffer
     122             :    */
     123           0 :   void SetTriggerPatchDataPtr(AliHLTCaloTriggerPatchDataStruct *outputcont, AliHLTUInt32_t buffersize) { fTriggerPatchDataPtr = outputcont; fBufferSize = buffersize; }
     124             : 
     125             :   /**
     126             :    * Find EMCAL trigger patches.
     127             :    * The trigger patches are internally converted into HLT EMCAL trigger patches and
     128             :    * pushed to the writeout buffer.
     129             :    * @return Number of found patches (-1 in case of buffer overflow)
     130             :    */
     131             :   Int_t FindPatches();
     132             : 
     133             :   /**
     134             :    * Set the thresholds for jet trigger patches
     135             :    * @param onlineTh Online threshold to be applied
     136             :    * @param offlineTh Offline threshold to be applied
     137             :    */
     138           0 :   void SetJetThresholds(ThresholdType_t threshtype, Float_t onlineTh, Float_t offlineTh) { fJetThresholdOnline[threshtype] = onlineTh; fJetThresholdOffline[threshtype] = offlineTh; }
     139             :   
     140             :   /**
     141             :    * Set the thresholds for gamma trigger patches
     142             :    * @param onlineTh Online threshold to be applied
     143             :    * @param offlineTh Offline threshold to be applied
     144             :    */
     145           0 :   void SetGammaThresholds(ThresholdType_t threshtype, Float_t onlineTh, Float_t offlineTh) { fGammaThresholdOnline[threshtype] = onlineTh; fGammaThresholdOffline[threshtype] = offlineTh; }
     146             : 
     147             :   /**
     148             :    * Set the thresholds for bkg trigger patches
     149             :    * @param onlineTh Online threshold to be applied
     150             :    * @param offlineTh Offline threshold to be applied
     151             :    */
     152           0 :   void SetBkgThresholds(Float_t onlineTh, Float_t offlineTh) { fBkgThresholdOnline = onlineTh; fBkgThresholdOffline = offlineTh; }
     153             : 
     154             :   /**
     155             :    * Define whether we run the algorithm for background patches
     156             :    * @param doRun Switch for the background algorithm
     157             :    */
     158           0 :   void SetRunBkgAlgorithm(Bool_t doRun) { fRunBkgAlgorithm = doRun; }
     159             : 
     160             :   /**
     161             :    * Set the thresholds for level0 trigger patches
     162             :    * @param onlineTh Online Threshold to be applied
     163             :    * @param offlineTh Offline Threshold to be applied
     164             :    */
     165           0 :   void SetLevel0Thresholds(Float_t onlineTh, Float_t offlineTh) { fLevel0ThresholdOnline = onlineTh; fLevel0ThresholdOffline = offlineTh; }
     166             : 
     167             :   /**
     168             :    * Set the patch size/subregion for jet trigger patches
     169             :    * @param size Size of the patch in number of FastORs
     170             :    * @param subregion Subregion of the sliding window
     171             :    */
     172           0 :   void SetJetPatch(Int_t size, Int_t subregion)    { fJetPatchSize = size  ; fJetSubregionSize = subregion  ; }
     173             : 
     174             :   /**
     175             :    * Set the patch size/subregion for gamma trigger patches
     176             :    * @param size Size of the patch in number of FastORs
     177             :    * @param subregion Subregion of the sliding window
     178             :    */
     179           0 :   void SetGammaPatch(Int_t size, Int_t subregion)  { fGammaPatchSize = size; fGammaSubregionSize = subregion; }
     180             : 
     181             :   /**
     182             :    * Set the patch size/subregion for background trigger patches
     183             :    * @param size Size of the patch in number of FastORs
     184             :    * @param subregion Subregion of the sliding window
     185             :    */
     186           0 :   void SetBkgPatch(Int_t size, Int_t subregion)    { fBkgPatchSize = size  ; fBkgSubregionSize = subregion  ; }
     187             : 
     188             : protected:
     189             :   /**
     190             :    * Convert raw patches found by the trigger patch finders into HLT EMCAL trigger patches.
     191             :    * @param inputpatch EMCAL raw patch to be converted into an EMCAL HLT patch
     192             :    * @param output HLT trigger patch obtaied using the information in the EMCAL raw patch
     193             :    */
     194             :    void MakeHLTPatch(const AliEMCALTriggerRawPatch &inputpatch, AliHLTCaloTriggerPatchDataStruct &output, UInt_t offlinebits, UInt_t onlinebitmask, UInt_t level0bits) const;
     195             : 
     196             :   /**
     197             :    * Initialise trigger patch finders in the EMCAL or DCAL at Level1
     198             :    * @param isDCAL Switch distinguishing between DCAL (true) and EMCAL (false)
     199             :    */
     200             :   void InitializeLevel1PatchFinders(Bool_t isDCAL);
     201             : 
     202             :   /** Initialize L0 Patch finders in EMCAL and DCAL */
     203             :   void InitializeLevel0PatchFinders(Bool_t isDCAL);
     204             : 
     205             :   /**
     206             :    * Initialize the lookup tables used by the trigger maker
     207             :    */
     208             :   void InitializeLookupTables();
     209             : 
     210             :   /**
     211             :    * Check whether all fastors are in the same TRU. This
     212             :    * is a condition to accept the patch as valid Level0
     213             :    * patch.
     214             :    * @param patch Patch to check
     215             :    * @return True if all fastors are in the same TRU, false
     216             :    * otherwise
     217             :    */
     218             :   ELevel0TriggerStatus_t CheckForL0(Int_t col, Int_t row) const;
     219             : 
     220             :   /**
     221             :    * Check if the patch has overlap in channles with the PHOS
     222             :    * region.
     223             :    * @param Patch to check
     224             :    * @return True if the patch has overlap with PHOS
     225             :    */
     226             :   bool HasPHOSOverlap(const AliEMCALTriggerRawPatch & patch) const;
     227             : 
     228             : private:
     229             :   /** Pointer to the output buffer */
     230             :   AliHLTCaloTriggerPatchDataStruct              *fTriggerPatchDataPtr;
     231             :   /** Underlying EMCAL geometry*/
     232             :   const AliHLTEMCALGeometry                     *fkGeometryPtr;
     233             : 
     234             :   /** EMCAL trigger algorithms used to find trigger patches */
     235             :   AliEMCALTriggerPatchFinder<float>             *fPatchFinder;
     236             :   /** EMCAL Level0 patch finder (operating on different data */
     237             :   AliEMCALTriggerPatchFinder<float>                               *fL0PatchFinder;
     238             :   /** Grid with ADC values used for the trigger patch finding */
     239             :   AliEMCALTriggerDataGrid<float>                *fADCValues;
     240             :   /** Grid with ADC values used for the trigger patch finding */
     241             :   AliEMCALTriggerDataGrid<float>                *fADCOfflineValues;
     242             :   /** Grid with L0 Amplitude values used for L0 trigger patch finding */
     243             :   AliEMCALTriggerDataGrid<float>                          *fL0Amplitudes;
     244             :   /** Grid with trigger bit mask from STU */
     245             :   AliEMCALTriggerDataGrid<int>                  *fTriggerBitMasks;
     246             :   /** Grid with L0 trigger time values used to retrieve L0 decision */
     247             :   AliEMCALTriggerDataGrid<unsigned char>        *fLevel0TimeMap;
     248             :   /** Lookup table with TRU indices */
     249             :   AliEMCALTriggerDataGrid<int>                  *fTRUIndexMap;
     250             :   /** Trigger bit configurtion */
     251             :   AliEMCALTriggerBitConfig                      *fTriggerBitConfig;
     252             :   /** Jet patch size **/
     253             :   Int_t                                         fJetPatchSize;
     254             :   /** Jet subregion size **/
     255             :   Int_t                                         fJetSubregionSize;
     256             :   /** Gamma patch size **/
     257             :   Int_t                                         fGammaPatchSize;
     258             :   /** Gamme subregion size **/
     259             :   Int_t                                         fGammaSubregionSize;
     260             :   /** Background patch size **/
     261             :   Int_t                                         fBkgPatchSize;
     262             :   /** Background subregion size **/
     263             :   Int_t                                         fBkgSubregionSize;
     264             :   /** Minimum time bin for a valid L0 trigger decision **/
     265             :   Char_t                                        fL0MinTime;
     266             :   /** Maximum time bin for a valid L0 trigger decision **/
     267             :   Char_t                                        fL0MaxTime;
     268             : 
     269             :   /** Available space in buffer */
     270             :   AliHLTUInt32_t                                fBufferSize;
     271             :   /** online threshold for gamma patches */
     272             :   Float_t                                       fGammaThresholdOnline[2];
     273             :   /** offline threshold for gamma patches */
     274             :   Float_t                                       fGammaThresholdOffline[2];
     275             :   /** online threshold for jet patches */
     276             :   Float_t                                       fJetThresholdOnline[2];
     277             :   /** offline threshold for jet patches */
     278             :   Float_t                                       fJetThresholdOffline[2];
     279             :   /** online threshold for bkg patches */
     280             :   Float_t                                       fBkgThresholdOnline;
     281             :   /** offline threshold for bkg patches */
     282             :   Float_t                                       fBkgThresholdOffline;
     283             :   /** Switch for running the background trigger algorithm */
     284             :   Bool_t                                        fRunBkgAlgorithm;
     285             :   /** Threshold for accepting level0 online patches */
     286             :   Float_t                                       fLevel0ThresholdOnline;
     287             :   /** Threshold for accepting level0 offline patches */
     288             :   Float_t                                       fLevel0ThresholdOffline;
     289             : 
     290           6 :   ClassDef(AliHLTEMCALTriggerMaker, 3);
     291             : };
     292             : 
     293             : #endif

Generated by: LCOV version 1.11