AliPhysics  1976924 (1976924)
AliEMCALTriggerPatchADCInfoAP.cxx
Go to the documentation of this file.
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  **************************************************************************/
16 
18 
20  TObject(),
21  fPatchSize(0),
22  fADCValues()
23 {
24 }
25 
27  TObject(),
28  fPatchSize(patchsize),
29  fADCValues()
30 {
31  fADCValues.Allocate(fPatchSize, fPatchSize);
32 }
33 
35  TObject(ref),
37  fADCValues()
38 {
39  if(fPatchSize){
40  fADCValues.Allocate(fPatchSize, fPatchSize);
41  for(UChar_t icol = 0; icol < fPatchSize; icol++){
42  for(UChar_t irow = 0; irow < fPatchSize; irow++){
43  fADCValues.SetADC(icol, irow, ref.fADCValues(icol, irow));
44  }
45  }
46  }
47 }
48 
50  TObject::operator=(ref);
51  if(&ref != this){
52  if(ref.fPatchSize){
53  if(!fADCValues.IsAllocated()) fADCValues.Allocate(ref.fPatchSize, ref.fPatchSize);
54  for(UChar_t icol = 0; icol < ref.fPatchSize; icol++){
55  for(UChar_t irow = 0; irow < ref.fPatchSize; irow++){
56  fADCValues.SetADC(icol, irow, ref.fADCValues(icol, irow));
57  }
58  }
59  }
60  fPatchSize = ref.fPatchSize;
61  }
62  return *this;
63 }
64 
66  fPatchSize = patchsize;
67  fADCValues.Allocate(fPatchSize, fPatchSize);
68 }
69 
70 void AliEMCALTriggerPatchADCInfoAP::SetADC(Int_t adc, UChar_t col, UChar_t row){
71  try{
72  fADCValues.SetADC(col, row, adc);
74  // Don't do anything if we are out-of-bounds
75  }
76 }
77 
78 Int_t AliEMCALTriggerPatchADCInfoAP::GetADC(UChar_t col, UChar_t row) const {
79  try{
80  return fADCValues(col, row);
82  return 0;
83  }
84 }
85 
87  Int_t adcsum(0);
88  for(unsigned int icol = 0; icol < fPatchSize; icol++){
89  for(unsigned int irow = 0; irow < fPatchSize; irow++){
90  try{
91  adcsum += fADCValues(icol, irow);
93  }
94  }
95  }
96  return adcsum;
97 }
98 
100  Int_t maxadc(0), tmpadc(0);
101  for(unsigned int icol = 0; icol < fPatchSize; icol++){
102  for(unsigned int irow = 0; irow < fPatchSize; irow++){
103  try{
104  tmpadc = fADCValues(icol, irow);
106  tmpadc = 0;
107  }
108  if(tmpadc > maxadc) maxadc = tmpadc;
109  }
110  }
111  return maxadc;
112 }
113 
115  Int_t ncontrib(0), tmpadc(0);
116  for(unsigned int icol = 0; icol < fPatchSize; icol++){
117  for(unsigned int irow = 0; irow < fPatchSize; irow++){
118  try{
119  tmpadc = fADCValues(icol, irow);
121  tmpadc = 0;
122  }
123  if(tmpadc) ncontrib++;
124  }
125  }
126  return ncontrib;
127 }
AliEMCALTriggerDataGrid< Int_t > fADCValues
underlying container with ADC data
AliEMCALTriggerPatchADCInfoAP & operator=(const AliEMCALTriggerPatchADCInfoAP &ref)
void SetADC(Int_t adc, UChar_t col, UChar_t row)
int Int_t
Definition: External.C:63
Int_t GetADC(UChar_t col, UChar_t row) const