Line data Source code
1 : /**
2 : * @file AliEMCALTriggerAlgorithm.cxx
3 : * @date Oct. 23, 2015
4 : * @author Markus Fasel <markus.fasel@cern.ch>, Lawrence Berkeley National Laboratory
5 : */
6 : /**************************************************************************
7 : * Copyright(c) 1998-2013, ALICE Experiment at CERN, All rights reserved. *
8 : * *
9 : * Author: The ALICE Off-line Project. *
10 : * Contributors are mentioned in the code where appropriate. *
11 : * *
12 : * Permission to use, copy, modify and distribute this software and its *
13 : * documentation strictly for non-commercial purposes is hereby granted *
14 : * without fee, provided that the above copyright notice appears in all *
15 : * copies and that both the copyright notice and this permission notice *
16 : * appear in the supporting documentation. The authors make no claims *
17 : * about the suitability of this software for any purpose. It is *
18 : * provided "as is" without express or implied warranty. *
19 : **************************************************************************/
20 : #include "AliEMCALTriggerDataGrid.h"
21 : #include "AliEMCALTriggerAlgorithm.h"
22 : #include <algorithm>
23 :
24 :
25 : /// \cond CLASSIMP
26 22 : templateClassImp(AliEMCALTriggerAlgorithm)
27 : /// \endcond
28 :
29 : template<typename T>
30 : AliEMCALTriggerAlgorithm<T>::AliEMCALTriggerAlgorithm():
31 0 : TObject(),
32 0 : fRowMin(0),
33 0 : fRowMax(0),
34 0 : fPatchSize(0),
35 0 : fSubregionSize(1),
36 0 : fBitMask(0),
37 0 : fThreshold(0),
38 0 : fOfflineThreshold(0)
39 0 : {
40 0 : }
41 :
42 : template<typename T>
43 : AliEMCALTriggerAlgorithm<T>::AliEMCALTriggerAlgorithm(Int_t rowmin, Int_t rowmax, UInt_t bitmask):
44 0 : TObject(),
45 0 : fRowMin(rowmin),
46 0 : fRowMax(rowmax),
47 0 : fPatchSize(0),
48 0 : fSubregionSize(1),
49 0 : fBitMask(bitmask),
50 0 : fThreshold(0),
51 0 : fOfflineThreshold(0)
52 0 : {
53 0 : }
54 :
55 : template<typename T>
56 0 : AliEMCALTriggerAlgorithm<T>::~AliEMCALTriggerAlgorithm() {
57 0 : }
58 :
59 : template<typename T>
60 : std::vector<AliEMCALTriggerRawPatch> AliEMCALTriggerAlgorithm<T>::FindPatches(const AliEMCALTriggerDataGrid<T> &adc, const AliEMCALTriggerDataGrid<T> &offlineAdc) const {
61 0 : std::vector<AliEMCALTriggerRawPatch> result;
62 : T sumadc(0);
63 : T sumofflineAdc(0);
64 :
65 0 : int rowStartMax = fRowMax - (fPatchSize-1);
66 0 : int colStartMax = adc.GetNumberOfCols() - fPatchSize;
67 :
68 0 : for(int irow = fRowMin; irow <= rowStartMax; irow += fSubregionSize){
69 0 : for(int icol = 0; icol <= colStartMax; icol += fSubregionSize){
70 : sumadc = 0;
71 : sumofflineAdc = 0;
72 0 : for(int jrow = irow; jrow < irow + fPatchSize; jrow++){
73 0 : for(int jcol = icol; jcol < icol + fPatchSize; jcol++){
74 : try{
75 0 : sumadc += adc(jcol, jrow);
76 0 : sumofflineAdc += offlineAdc(jcol, jrow);
77 0 : } catch (typename AliEMCALTriggerDataGrid<T>::OutOfBoundsException &e){
78 :
79 0 : }
80 : }
81 : }
82 0 : if(sumadc > fThreshold || sumofflineAdc > fOfflineThreshold){
83 0 : AliEMCALTriggerRawPatch recpatch(icol, irow, fPatchSize, sumadc, sumofflineAdc);
84 0 : recpatch.SetBitmask(fBitMask);
85 0 : result.push_back(recpatch);
86 0 : }
87 : }
88 : }
89 0 : std::sort(result.begin(), result.end());
90 : return result;
91 0 : }
92 :
93 : template class AliEMCALTriggerAlgorithm<int>;
94 : template class AliEMCALTriggerAlgorithm<double>;
95 : template class AliEMCALTriggerAlgorithm<float>;
|