BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcBhaCalibData Class Reference

#include <EmcBhaCalibData.h>

Public Member Functions

 EmcBhaCalibData (int numxtals)
 
 EmcBhaCalibData (int numxtals, int MsgFlag)
 
 ~EmcBhaCalibData ()
 
double & matrixMEle (int row, int column)
 
EmcLSSMatrixgetMatrixM ()
 
double & vectorR (int ind)
 
double * getVectorR ()
 
int xtalInd (int ind)
 
int & nXtals ()
 
int & nXtalsHit ()
 
int & xtalHits (int ind)
 
int & xtalHitsDir (int ind)
 
bool reduce ()
 
void reset ()
 
void writeOut (ostream &OutM, ostream &outV)
 
void readIn (istream &InM, istream &InV)
 
void printVec (int number)
 

Detailed Description

This class holds the information that is needed to do the calibration of the EMC with Bhabha events. It stores the accumulated matrix, the accumulated vector, the number of hits percrystal and other stuff.

The data are filled in the method EmcMCBhaEvent::CollectBhabha().

This software was developed for the BesIII collaboration. If you use all or part of it, please give an appropriate acknowledgement.

Copyright (C) 2005 IHEP

See also
Author
(Chunxiu Liu) (originator/contributor etc.);

Definition at line 63 of file EmcBhaCalibData.h.

Constructor & Destructor Documentation

◆ EmcBhaCalibData() [1/2]

EmcBhaCalibData::EmcBhaCalibData ( int  numxtals)

Definition at line 48 of file EmcBhaCalibData.cxx.

49 : _nXtals(numxtals),
50 _nXtalsHit(0)
51{
52 // _matrixM = new EmcLSSMatrix(_nXtals,600);
53 _matrixM = new EmcLSSMatrix(_nXtals,_nXtals);
54 _vectorR = new double[_nXtals];
55 _xtalInd = new int[_nXtals];
56 _xtalHits = new int[_nXtals];
57 _xtalHitsMax = new int[_nXtals];
58 for (int i=0;i<_nXtals;i++) {
59 _vectorR[i] = 0.;
60 _xtalInd[i] = i;
61 _xtalHits[i] = 0;
62 _xtalHitsMax[i] = 0;
63 }
64 _MsgFlag =0;
65}

◆ EmcBhaCalibData() [2/2]

EmcBhaCalibData::EmcBhaCalibData ( int  numxtals,
int  MsgFlag 
)

Definition at line 70 of file EmcBhaCalibData.cxx.

71 : _nXtals(numxtals),
72 _nXtalsHit(0)
73{
74 // _matrixM = new EmcLSSMatrix(_nXtals,600);
75 _matrixM = new EmcLSSMatrix(_nXtals,_nXtals, MsgFlag);
76 _vectorR = new double[_nXtals];
77 _xtalInd = new int[_nXtals];
78 _xtalHits = new int[_nXtals];
79 _xtalHitsMax = new int[_nXtals];
80 for (int i=0;i<_nXtals;i++) {
81 _vectorR[i] = 0.;
82 _xtalInd[i] = i;
83 _xtalHits[i] = 0;
84 _xtalHitsMax[i] = 0;
85 }
86
87 _MsgFlag = MsgFlag;
88}

◆ ~EmcBhaCalibData()

EmcBhaCalibData::~EmcBhaCalibData ( )

Definition at line 93 of file EmcBhaCalibData.cxx.

93 {
94 if ( 0 != _matrixM) {
95 delete _matrixM;
96 _matrixM = 0;
97 }
98 if ( 0 != _vectorR) {
99 delete[] _vectorR;
100 _vectorR = 0;
101 }
102 if ( 0 != _xtalInd) {
103 delete[] _xtalInd;
104 _xtalInd = 0;
105 }
106 if ( 0 != _xtalHits) {
107 delete[] _xtalHits;
108 _xtalHits = 0;
109 }
110 if ( 0 != _xtalHitsMax) {
111 delete[] _xtalHitsMax;
112 _xtalHitsMax = 0;
113 }
114}

Member Function Documentation

◆ getMatrixM()

EmcLSSMatrix * EmcBhaCalibData::getMatrixM ( )
inline

Definition at line 81 of file EmcBhaCalibData.h.

81{ return _matrixM; }

◆ getVectorR()

double * EmcBhaCalibData::getVectorR ( )
inline

Definition at line 87 of file EmcBhaCalibData.h.

87{ return _vectorR; }

◆ matrixMEle()

double & EmcBhaCalibData::matrixMEle ( int  row,
int  column 
)
inline

Definition at line 77 of file EmcBhaCalibData.h.

77{ return ((*_matrixM)(row,column)); }

◆ nXtals()

int & EmcBhaCalibData::nXtals ( )
inline

Definition at line 93 of file EmcBhaCalibData.h.

93{ return _nXtals; }

Referenced by EmcBhaCalib::execute().

◆ nXtalsHit()

int & EmcBhaCalibData::nXtalsHit ( )
inline

Definition at line 95 of file EmcBhaCalibData.h.

95{ return _nXtalsHit; }

Referenced by EmcBhaCalib::execute().

◆ printVec()

void EmcBhaCalibData::printVec ( int  number)

Definition at line 265 of file EmcBhaCalibData.cxx.

265 {
266
267 if (_MsgFlag <= 3) {
268 std::cout << "EmcBhaCalibData:: INFO "<< "R ( " << number << " ): " << _vectorR[number]
269 << " hits: " << _xtalHits[number]
270 << " direct hits: " << _xtalHitsMax[number]
271 << endl;
272 }
273}

Referenced by EmcBhaCalib::execute().

◆ readIn()

void EmcBhaCalibData::readIn ( istream &  InM,
istream &  InV 
)

Definition at line 174 of file EmcBhaCalibData.cxx.

174 {
175
176 _matrixM->readIn( InM );
177
178 _matrixM->print_NonZeros();
179
180 //cout<<"num_filled_rows(48)="<<_matrixM->num_filled_rows(48)<<endl;
181 //cout<<"num_filled_cols(48)="<<_matrixM->num_filled_cols(48)<<endl;
182
183 //cout<<"matrix(47,47)"<<_matrixM->operator()(47,47)<<endl;
184
185 double vect_ele;
186 int nr_ele;
187 int xtal_ind;
188 int hits;
189 int hits_max;
190
191 InV >> nr_ele;
192
193 for (int i=0; i<nr_ele; i++) {
194
195 InV >> xtal_ind >> hits >> hits_max
196 >> vect_ele ;
197
198 if (_vectorR[xtal_ind] == 0. ) {
199 _nXtalsHit++;
200 }
201
202 _vectorR[xtal_ind] += vect_ele ;
203 _xtalInd[xtal_ind] = xtal_ind;
204 _xtalHits[xtal_ind] += hits;
205 _xtalHitsMax[xtal_ind] += hits_max;
206
207 }
208
209}
const double hits_max
void print_NonZeros()
void readIn(istream &In)

◆ reduce()

bool EmcBhaCalibData::reduce ( )

Definition at line 212 of file EmcBhaCalibData.cxx.

212 {
213
214 bool successful = true;
215
216 //delete all zero elements in matrix and vector R
217 //save only non zero elements (this format is needed by slap),
218 //keep the original xtal index in array xtalInd
219
220 //array to store the new row/column reference for later matrix reduction
221 int* xRef = new int[_nXtals];
222 memset(xRef, -1, (_nXtals*sizeof(int)));
223
224 _nXtalsHit = 0;
225 for ( int _arrayIndx = 0;
226 _arrayIndx < _nXtals; _arrayIndx++) {
227
228 if ( _vectorR[_arrayIndx] > 0. ) {
229
230 _vectorR[_nXtalsHit] = _vectorR[_arrayIndx];
231 _xtalInd[_nXtalsHit] = _xtalInd[_arrayIndx];
232 _xtalHits[_nXtalsHit] = _xtalHits[_arrayIndx];
233 _xtalHitsMax[_nXtalsHit] = _xtalHitsMax[_arrayIndx];
234 xRef[_arrayIndx] = _nXtalsHit;
235
236 _nXtalsHit++;
237 }
238 }
239
240 successful = _matrixM->reduce_Matrix( xRef );
241
242 delete [] xRef;
243
244 return successful;
245}
bool reduce_Matrix(int *xRef_list)

Referenced by EmcBhaCalib::execute().

◆ reset()

void EmcBhaCalibData::reset ( )

Definition at line 249 of file EmcBhaCalibData.cxx.

250{
251 _nXtalsHit = 0;
252 _matrixM->reset();
253
254 for (int i=0;i<_nXtals;i++) {
255 _vectorR[i]= 0.;
256 _xtalInd[i] = i;
257 _xtalHits[i] = 0;
258 _xtalHitsMax[i] = 0;
259 }
260
261}

◆ vectorR()

double & EmcBhaCalibData::vectorR ( int  ind)
inline

Definition at line 84 of file EmcBhaCalibData.h.

84{ return (_vectorR[ind]); }

◆ writeOut()

void EmcBhaCalibData::writeOut ( ostream &  OutM,
ostream &  outV 
)

Definition at line 130 of file EmcBhaCalibData.cxx.

130 {
131
132 //write only non zero elements to file
133 OutM.setf(ios::scientific,ios::floatfield);
134 OutV.setf(ios::scientific,ios::floatfield);
135 OutV.precision(12);
136 OutM.precision(12);
137
138 _matrixM->writeOut( OutM );
139
140 _nXtalsHit = 0;
141
142 double* vect_ele = _vectorR;
143 double* vect_end = _vectorR + _nXtals;
144 int* xtal_ind = _xtalInd;
145 int* hits_max = _xtalHitsMax;
146 int* hits = _xtalHits;
147
148 while ( vect_ele < vect_end ) {
149 if ( *vect_ele != 0. ){
150 _nXtalsHit++;
151 }
152 vect_ele++;
153 }
154
155 OutV << _nXtalsHit << " ";
156
157 vect_ele = _vectorR;
158
159 while ( vect_ele < vect_end ) {
160 if ( *vect_ele != 0. ) {
161 OutV << *xtal_ind << " " << *hits << " " << *hits_max << " "
162 << *vect_ele << " ";
163 }
164 xtal_ind++;
165 vect_ele++;
166 hits_max++;
167 hits++;
168 }
169
170}
void writeOut(ostream &Out)

Referenced by EmcSelBhaEvent::OutputMV().

◆ xtalHits()

int & EmcBhaCalibData::xtalHits ( int  ind)
inline

Definition at line 97 of file EmcBhaCalibData.h.

97{ return (_xtalHits[ind]); }

◆ xtalHitsDir()

int & EmcBhaCalibData::xtalHitsDir ( int  ind)
inline

Definition at line 99 of file EmcBhaCalibData.h.

99{ return (_xtalHitsMax[ind]); }

◆ xtalInd()

int EmcBhaCalibData::xtalInd ( int  ind)
inline

Definition at line 90 of file EmcBhaCalibData.h.

90{ return (_xtalInd[ind]); }

Referenced by EmcBhaCalib::execute().


The documentation for this class was generated from the following files: