CGEM BOSS 6.6.5.g
BESIII Offline Software System
Loading...
Searching...
No Matches
SamplingGar2.cxx
Go to the documentation of this file.
2
3#include "GaudiKernel/Bootstrap.h"
4#include "GaudiKernel/DataSvc.h"
5#include "GaudiKernel/IDataProviderSvc.h"
6#include "GaudiKernel/ISvcLocator.h"
7#include "GaudiKernel/SmartDataPtr.h"
8
9#include "CLHEP/Units/PhysicalConstants.h"
10
11#include "G4DigiManager.hh"
12#include "G4ios.hh"
13#include "Randomize.hh"
14
15#include "CLHEP/Units/PhysicalConstants.h"
16
17#include <cmath>
18#include <fstream>
19#include <iomanip>
20#include <iostream>
21
22#include "TMath.h"
23#include "TRandom.h"
24
25using namespace std;
26
27//
28//#define SAMPLINGGAR2_DEBUG
29
31 m_pMultiElectronMap = nullptr;
32 m_layer = -1;
33
34 m_GainMultiplier[0]=1.60;
35 m_GainMultiplier[1]=1.60;
36 m_GainMultiplier[2]=1.60;
37}
38
40}
41
42const static int _low = 0;
43const static int _up = 1000;
44const static int _nbins = 2000;
45const static double binsize = (double)(_up - _low) / _nbins;
46
47void SamplingGar2::init(ICgemGeomSvc *geomSvc, double magConfig) {
48 m_geomSvc = geomSvc;
49 m_magConfig = magConfig;
50
51 readSmearPar();
52
53 // initialize polya functions
54 char funname[10];
55 for(int l=0; l<3;l++){
56 for(int i=0; i<3; i++){
57 sprintf(funname, "funPolya%d%d", l, i);
58 m_funPolya[l][i] = new TF1(funname, "[0]*pow(1+[2],1+[2])*pow(x/[1],[2])*exp(-(1+[2])*x/[1])/TMath::Gamma(1+[2])", 1, 500);
59 m_funPolya[l][i]->SetParameter(0, m_gain_gem[i][0]);
60 m_funPolya[l][i]->SetParameter(1, m_gain_gem[i][1]*m_GainMultiplier[l]);
61 m_funPolya[l][i]->SetParameter(2, m_gain_gem[i][2]);
62 }
63 }
64
65 m_Ngaps_microSector=40;
66 m_gapShift_microSector[0][0]=0.;
67 m_gapShift_microSector[0][1]=0.;
68 m_gapShift_microSector[1][0]=0.;
69 m_gapShift_microSector[1][1]=0.;
70 m_gapShift_microSector[2][0]=0.;
71 m_gapShift_microSector[2][1]=0.;
72 m_microSector_width[0][0]=2*M_PI/m_Ngaps_microSector;
73 m_microSector_width[0][1]=2*M_PI/m_Ngaps_microSector;
74 m_microSector_width[1][0]=2*M_PI/m_Ngaps_microSector/2;
75 m_microSector_width[1][1]=2*M_PI/m_Ngaps_microSector/2;
76 m_microSector_width[2][0]=2*M_PI/m_Ngaps_microSector/2;
77 m_microSector_width[2][1]=2*M_PI/m_Ngaps_microSector/2;
78 m_gap_microSector=1.1;//in mm
79}
80
81void SamplingGar2::setIonElectrons(int layer, int nElectrons, std::vector<double> x, std::vector<double> y, std::vector<double> z, std::vector<double> t) {
82 clear();
83 m_layer = layer;
84 if (m_pMultiElectronMap == nullptr) {
85 cout << "Error: SamplingGar2::m_pMultiElectronMap is nullptr and has aborted running." << endl;
86 throw std::runtime_error("Error: SamplingGar2::m_pMultiElectronMap is nullptr and has aborted running.");
87 }
88 m_pMultiElectronMap->clear();
89 m_nIonE = nElectrons;
90 // cout << "nIonE = " << m_nIonE << endl;
91 for (int i = 0; i < nElectrons; i++) {
92 double r = sqrt(x[i] * x[i] + y[i] * y[i]);
93 double phi;
94 if (y[i] >= 0)
95 phi = acos(x[i] / r);
96 else
97 phi = CLHEP::twopi - acos(x[i] / r);
98 m_vecIonR.push_back(r);
99 m_vecIonPhi.push_back(phi);
100 m_vecIonZ.push_back(z[i]);
101 m_vecIonT.push_back(t[i]);
102
103 // cout << "check geom layer" << setw(15) << layer << setw(15) << m_geomSvc->getCgemLayer(layer)->getInnerROfGapD()
104 // << setw(15) << m_geomSvc->getCgemLayer(layer)->getOuterROfGapD()
105 // << setw(15) << m_geomSvc->getCgemLayer(layer)->getCgemFoil(0)->getInnerROfCgemFoil() << endl;
106
107 double radii_gem1 = m_geomSvc->getCgemLayer(layer)->getCgemFoil(0)->getInnerROfCgemFoil();
108 double driftD = radii_gem1 - r;
109 // cout << "driftD = " << setw(15) << driftD << setw(15) << radii_gem1 << setw(15) << r << endl;
110 samplingDrift(layer, driftD, i);
111 }
112 // cout << "nMultiGem1 = " << m_nEgem1 << endl;
113 for (int i = 0; i < m_nEgem1; i++) samplingTransfer(layer,1, i);
114 // cout << "nMultiGem2 = " << m_nEgem2 << endl;
115 for (int i = 0; i < m_nEgem2; i++) samplingTransfer(layer,2, i);
116 // cout << "nMultiGem3 = " << m_nEgem3 << endl;
117 //calMultiE(layer);
118
119 m_layer = -1;
120}
121
122void SamplingGar2::clear() {
123 m_nIonE = 0;
124 m_vecIonR.clear();
125 m_vecIonPhi.clear();
126 m_vecIonZ.clear();
127 m_vecIonT.clear();
128
129 m_nEgem1 = 0;
130 m_idIon.clear();
131 m_vecGem1dX.clear();
132 m_vecGem1dZ.clear();
133 m_vecGem1dT.clear();
134
135 m_nEgem2 = 0;
136 m_idGem1.clear();
137 m_vecGem2dX.clear();
138 m_vecGem2dZ.clear();
139 m_vecGem2dT.clear();
140
141 m_nEgem3 = 0;
142 m_idGem2.clear();
143 m_vecGem3dX.clear();
144 m_vecGem3dZ.clear();
145 m_vecGem3dT.clear();
146
147 m_nMulElec = 0;
148 m_eX.clear();
149 m_eY.clear();
150 m_eZ.clear();
151 m_eT.clear();
152}
153
154bool SamplingGar2::readSmearPar() {
155 string filePath = getenv("CGEMDIGITIZERSVCROOT");
156 string fileName;
157 if (m_magConfig < 0.05)
158 fileName = filePath + "/dat/par_SamplingGar_0T.txt";
159 else
160 fileName = filePath + "/dat/par_SamplingGar_1T.txt";
161 ifstream fin(fileName.c_str(), ios::in);
162 cout << "fileName: " << fileName << endl;
163
164 string strline;
165 string strpar;
166 if (!fin.is_open()) {
167 cout << "ERROR: can not open file " << fileName << endl;
168 return false;
169 }
170 while (fin >> strpar) {
171 if ('#' == strpar[0]) {
172 getline(fin, strline);
173 } else if ("Mean_X_function" == strpar) {
174 fin >> m_meanXpar[0] >> m_meanXpar[1];
175 } else if ("Sigma_X_function" == strpar) {
176 fin >> m_sigmaXpar[0] >> m_sigmaXpar[1] >> m_sigmaXpar[2] >> m_sigmaXpar[3];
177 } else if ("Mean_Z_function" == strpar) {
178 fin >> m_meanZpar;
179 } else if ("Sigma_Z_function" == strpar) {
180 fin >> m_sigmaZpar[0] >> m_sigmaZpar[1] >> m_sigmaZpar[2] >> m_sigmaZpar[3];
181 } else if ("Mean_T_function" == strpar) {
182 fin >> m_meanTpar[0] >> m_meanTpar[1];
183 } else if ("Sigma_T_function" == strpar) {
184 fin >> m_sigmaTpar[0] >> m_sigmaTpar[1] >> m_sigmaTpar[2] >> m_sigmaTpar[3];
185 } else if ("Transparency_Gem1" == strpar) {
186 fin >> m_transparency_gem1;
187 m_transparency_gem1=1-(1-m_transparency_gem1)*m_TransMultiplier;
188 } else if ("Gain_Gem1" == strpar) {
189 fin >> m_gain_gem[0][0] >> m_gain_gem[0][1] >> m_gain_gem[0][2];
190 //m_gain_gem[0][1]=m_gain_gem[0][1]*m_GainMultiplier;
191
192 } else if ("MeanX_Transf1" == strpar) {
193 fin >> m_meanX_transf[0];
194 } else if ("SigmaX_Transf1" == strpar) {
195 fin >> m_sigmaX_transf[0];
196 } else if ("MeanZ_Transf1" == strpar) {
197 fin >> m_meanZ_transf[0];
198 } else if ("SigmaZ_Transf1" == strpar) {
199 fin >> m_sigmaZ_transf[0];
200 } else if ("MeanT_Transf1" == strpar) {
201 fin >> m_meanT_transf[0];
202 } else if ("SigmaT_Transf1" == strpar) {
203 fin >> m_sigmaT_transf[0];
204 } else if ("Transparency_Gem2" == strpar) {
205 fin >> m_transparency_gem2;
206 //m_transparency_gem2=1-(1-m_transparency_gem2)*m_TransMultiplier;
207
208 } else if ("Gain_Gem2" == strpar) {
209 fin >> m_gain_gem[1][0] >> m_gain_gem[1][1] >> m_gain_gem[1][2];
210 // m_gain_gem[1][1]=m_gain_gem[1][1]*m_GainMultiplier;
211
212 } else if ("MeanX_Transf2" == strpar) {
213 fin >> m_meanX_transf[1];
214 } else if ("SigmaX_Transf2" == strpar) {
215 fin >> m_sigmaX_transf[1];
216 } else if ("MeanZ_Transf2" == strpar) {
217 fin >> m_meanZ_transf[1];
218 } else if ("SigmaZ_Transf2" == strpar) {
219 fin >> m_sigmaZ_transf[1];
220 } else if ("MeanT_Transf2" == strpar) {
221 fin >> m_meanT_transf[1];
222 } else if ("SigmaT_Transf2" == strpar) {
223 fin >> m_sigmaT_transf[1];
224 } else if ("Transparency_Gem3" == strpar) {
225 fin >> m_transparency_gem3;
226 m_transparency_gem3=1-(1-m_transparency_gem3)*m_TransMultiplier;
227
228 } else if ("Gain_Gem3" == strpar) {
229 fin >> m_gain_gem[2][0] >> m_gain_gem[2][1] >> m_gain_gem[2][2];
230 //m_gain_gem[2][1]=m_gain_gem[2][1]*m_GainMultiplier;
231
232 } else if ("MeanX_Induc" == strpar) {
233 fin >> m_meanX_induc;
234 } else if ("SigmaX_Induc" == strpar) {
235 fin >> m_sigmaX_induc;
236 } else if ("MeanZ_Induc" == strpar) {
237 fin >> m_meanZ_induc;
238 } else if ("SigmaZ_Induc" == strpar) {
239 fin >> m_sigmaZ_induc;
240 } else if ("MeanT_Induc" == strpar) {
241 fin >> m_meanT_induc;
242 } else if ("SigmaT_Induc" == strpar) {
243 fin >> m_sigmaT_induc;
244 }
245 }
246 fin.close();
247 return true;
248}
249
250bool SamplingGar2::samplingDrift(int layer, double driftD, int idIon) {
251 G4double frandom = G4UniformRand();
252 // cout << "frandom = " << frandom << ", trans = " << m_transparency_gem1 << endl;
253 if (frandom > m_transparency_gem1) return false;
254 int n = samplingGain(layer, 0);
255 double meanPhi = m_meanXpar[0] + m_meanXpar[1] * driftD;
256 double sigmaPhi = m_sigmaXpar[0] + m_sigmaXpar[1] * driftD + m_sigmaXpar[2] * driftD * driftD + m_sigmaXpar[3] * driftD * driftD * driftD;
257 double meanZ = 0.0;
258 double sigmaZ = m_sigmaZpar[0] + m_sigmaZpar[1] * driftD + m_sigmaZpar[2] * driftD * driftD + m_sigmaZpar[3] * driftD * driftD * driftD;
259 double meanT = m_meanTpar[0] + m_meanTpar[1] * driftD;
260 double sigmaT = m_sigmaTpar[0] + m_sigmaTpar[1] * driftD + m_sigmaTpar[2] * driftD * driftD + m_sigmaTpar[3] * driftD * driftD * driftD;
261 // cout << "debug in samplingDrift: " << setw(15) << driftD << setw(15) << meanPhi << setw(15) << sigmaPhi
262 // << setw(15) << sigmaZ << setw(15) << meanT << setw(15) << sigmaT << endl;
263 for (int i = 0; i < n; i++) {
264 double dphi = G4RandGauss::shoot(meanPhi, sigmaPhi*m_DiffuMultiplier);
265 double dz = G4RandGauss::shoot(meanZ, sigmaZ*m_DiffuMultiplier);
266 double dt = G4RandGauss::shoot(meanT, sigmaT);
267
268 m_idIon.push_back(idIon);
269 m_vecGem1dX.push_back(-1.0 * dphi);
270 m_vecGem1dZ.push_back(dz);
271 m_vecGem1dT.push_back(dt);
272 }
273 m_nEgem1 += n;
274 return true;
275}
276
277bool SamplingGar2::samplingTransfer(int layer, int region, int idLastStep) {
278 double transp;
279
280 if (1 == region)
281 transp = m_transparency_gem2;
282 else
283 transp = m_transparency_gem3;
284 G4double frandom = G4UniformRand();
285 if (frandom > transp) return false;
286 int n = samplingGain(layer,region);
287
288 double Xbase;
289 double Zbase;
290 double Tbase;
291 double rNew;
292 if (2 == region) {
293 //retrieve the X,Z,T accumulated in drift and first 2 GEMs.
294 double dXGem2 = m_vecGem2dX[idLastStep];
295 double dZGem2 = m_vecGem2dZ[idLastStep];
296 double dTGem2 = m_vecGem2dT[idLastStep];
297
298 int idGem1 = m_idGem1[idLastStep];
299 double dXGem1 = m_vecGem1dX[idGem1];
300 double dZGem1 = m_vecGem1dZ[idGem1];
301 double dTGem1 = m_vecGem1dT[idGem1];
302
303 int idIon = m_idIon[idGem1];
304 double rini = m_vecIonR[idIon]; // not used
305 double phiini = m_vecIonPhi[idIon];
306 double zini = m_vecIonZ[idIon];
307 double tini = m_vecIonT[idIon];
308
309 rNew = m_geomSvc->getCgemLayer(m_layer)->getInnerROfGapI();
310
311 Xbase = dXGem2 + dXGem1 + phiini * rNew;
312 Zbase = dZGem2 + dZGem1 + zini;
313 Tbase = dTGem2 + dTGem1 + tini;
314 }
315 //cout<<__LINE__<<"\tCgemDigitizerSvc::samplingGar2"<<endl;
316 for (int i = 0; i < n; i++) {
317 double dphi = G4RandGauss::shoot(m_meanX_transf[region - 1], m_sigmaX_transf[region - 1]*m_DiffuMultiplier);
318 double dz = G4RandGauss::shoot(m_meanZ_transf[region - 1], m_sigmaZ_transf[region - 1]*m_DiffuMultiplier);
319 double dt = G4RandGauss::shoot(m_meanT_transf[region - 1], m_sigmaT_transf[region - 1]);
320
321 if (1 == region) {
322 m_idGem1.push_back(idLastStep);
323 m_vecGem2dX.push_back(-1.0 * dphi);
324 m_vecGem2dZ.push_back(dz);
325 m_vecGem2dT.push_back(dt);
326 } else {
327 //
328 //m_idGem2.push_back(idLastStep);
329 //m_vecGem3dX.push_back(-1.0 * dphi);
330 //m_vecGem3dZ.push_back(dz);
331 //m_vecGem3dT.push_back(dt);
332 double xNew = Xbase + dphi;
333 double zNew = Zbase + dz;
334 double tNew = Tbase + dt;
335 double phiOut; // phi angle
336 if (xNew < 0) {
337 phiOut = xNew / rNew + CLHEP::twopi;
338 } else if (xNew > (rNew * CLHEP::twopi)) {
339 phiOut = xNew / rNew - CLHEP::twopi;
340 } else {
341 phiOut = xNew / rNew;
342 }
343
344 saveElectron(phiOut,zNew,tNew);
345 }
346 }
347 //cout<<__LINE__<<"\tCgemDigitizerSvc::samplingGar2"<<endl;
348 if (1 == region)
349 m_nEgem2 += n;
350 else
351 m_nEgem3 += n;
352 return true;
353}
354
355int SamplingGar2::samplingGain(int layer, int region) {
356 double xRand = m_funPolya[layer][region]->GetRandom(1, 500);
357 int gain = (int)xRand;
358 return gain;
359}
360
361// never called now.
362bool SamplingGar2::calMultiE(int layer) {
363 for (int i = 0; i < m_nEgem3; i++) {
364 //double dphiInduc = -1.0 * G4RandGauss::shoot(m_meanX_induc, m_sigmaX_induc);
365 //double dzInduc = G4RandGauss::shoot(m_meanZ_induc, m_sigmaZ_induc);
366 //double dtInduc = G4RandGauss::shoot(m_meanT_induc, m_sigmaT_induc);
367//
368 double dphiGem3 = m_vecGem3dX[i];
369 double dzGem3 = m_vecGem3dZ[i];
370 double dtGem3 = m_vecGem3dT[i];
371
372 int idGem2 = m_idGem2[i];
373 double dphiGem2 = m_vecGem2dX[idGem2];
374 double dzGem2 = m_vecGem2dZ[idGem2];
375 double dtGem2 = m_vecGem2dT[idGem2];
376
377 int idGem1 = m_idGem1[idGem2];
378 double dphiGem1 = m_vecGem1dX[idGem1];
379 double dzGem1 = m_vecGem1dZ[idGem1];
380 double dtGem1 = m_vecGem1dT[idGem1];
381
382 int idIon = m_idIon[idGem1];
383 double rini = m_vecIonR[idIon];
384 double phiini = m_vecIonPhi[idIon];
385 double zini = m_vecIonZ[idIon];
386 double tini = m_vecIonT[idIon];
387
388 double rNew = m_geomSvc->getCgemLayer(layer)->getInnerROfGapI();
389 double dphiTot = dphiGem1 + dphiGem2 + dphiGem3;
390 double xNew = rNew * phiini + dphiTot;
391 double phiOut; // phi angle
392 if (xNew < 0) {
393 phiOut = xNew / rNew + CLHEP::twopi;
394 } else if (xNew > (rNew * CLHEP::twopi)) {
395 phiOut = xNew / rNew - CLHEP::twopi;
396 } else {
397 phiOut = xNew / rNew;
398 }
399
400 m_eX.push_back(rNew * cos(phiOut));
401 m_eY.push_back(rNew * sin(phiOut));
402 m_eZ.push_back(zini + dzGem1 + dzGem2 + dzGem3);
403 m_eT.push_back(tini + dtGem1 + dtGem2 + dtGem3);
404 m_nMulElec++;
405
406 // double rNew = m_geomSvc->getCgemLayer(layer)->getInnerROfAnode();
407 // double dphiTot = dphiGem1 + dphiGem2 + dphiGem3 + dphiInduc;
408 // double xNew = rNew * phiini + dphiTot;
409 // double phiOut; // phi angle
410 // if(xNew < 0){
411 // phiOut = xNew/rNew + CLHEP::twopi;
412 // } else if(xNew > (rNew * CLHEP::twopi)){
413 // phiOut = xNew/rNew - CLHEP::twopi;
414 // } else{
415 // phiOut = xNew / rNew;
416 // }
417
418 // m_eX.push_back(rNew * cos(phiOut));
419 // m_eY.push_back(rNew * sin(phiOut));
420 // m_eZ.push_back(zini + dzGem1 + dzGem2 + dzGem3 + dzInduc);
421 // m_eT.push_back(tini + dtGem1 + dtGem2 + dtGem3 + dtInduc);
422 // m_nMulElec++;
423 }
424 return true;
425}
426
427IndexGar SamplingGar2::pos2Index(double X, double Y, double Z) {
428 IndexGar index;
429 int &xID = index.stripX = -1;
430 int &vID = index.stripV = -1;
431 char &grid_x = index.gridX = -1;
432 char &grid_v = index.gridV = -1;
433 char &sheet = index.sheet = -1;
434
435 double phi_electron = atan2(Y, X);
436 double z_electron = Z;
437 CgemGeoLayer *CgemLayer;
438 CgemGeoReadoutPlane *CgemReadoutPlane;
439 CgemLayer = m_geomSvc->getCgemLayer(m_layer);
440 int NSheet = CgemLayer->getNumberOfSheet();
441 G4ThreeVector pos(X, Y, Z);
442 //bool seenOnce=false;
443 for (int j = 0; j < NSheet; j++) {
444 CgemReadoutPlane = m_geomSvc->getReadoutPlane(m_layer, j);
445 if (CgemReadoutPlane->OnThePlane(phi_electron, z_electron)) {
446
447 double distX = CgemReadoutPlane->getDist2ClosestXStripCenter(phi_electron, xID);
448 double distV = CgemReadoutPlane->getDist2ClosestVStripCenter(pos, vID);
449
450 //std::cout << "-------------" << std::endl;
451 //std::cout << "xID, distX = " << xID << "," << distX << std::endl;
452 //std::cout << "vID, distV = " << vID << "," << distV << std::endl;
453 //
454 //--- Calculation of grid index-------------
455 //
456 double L_XPitch = CgemReadoutPlane->getXPitch();
457 double L_VPitch = CgemReadoutPlane->getVPitch();
458 grid_v = floor(distX / L_XPitch * 5. + 2.5);
459 grid_x = floor(distV / L_VPitch * 5. + 2.5);
460 sheet = j;
461 //if (seenOnce == true){cout<<"wooop! this electron is on 2 planes!"<<endl;}
462 //seenOnce=true;
463 }
464 }
465
466 return index;
467}
468
469bool SamplingGar2::inMicroSectorGap(double phi, int layer)
470{
471 double dphi=phi+M_PI;
472 while(dphi<0) dphi+=2*M_PI;
473 while(dphi>2*M_PI) dphi-=2*M_PI;
474
475 int i_sheet=0;
476 if(layer>0) {
477 //nGaps*=2;
478 if(dphi>M_PI) i_sheet=1;
479 }
480 double width=m_microSector_width[layer][i_sheet];
481 int iSector=floor((phi-m_gapShift_microSector[layer][i_sheet])/width);
482 CgemGeoLayer* CgemLayer = m_geomSvc->getCgemLayer(layer);
483 double R = CgemLayer->getInnerROfGapI();
484 double dist = ((iSector+1)*width-(phi-m_gapShift_microSector[layer][i_sheet]))*R;
485 bool in=false;
486 if(dist<m_gap_microSector) in=true;
487 return in;
488}
489
490void SamplingGar2::saveElectron(double phi, double z, double t){
491
492 double rNew = m_geomSvc->getCgemLayer(m_layer)->getInnerROfGapI();
493
494 if (inMicroSectorGap(phi, m_layer)) {
495 //cout<<"skip electron of layer "<<layer<<" at phi = "<<phi_electron<<endl;
496 return; // skip electrons in the micro-sector gaps
497 }
498
499 if (m_debugging) {
500 m_eX.push_back(rNew * cos(phi));
501 m_eY.push_back(rNew * sin(phi));
502 m_eZ.push_back(z);
503 m_eT.push_back(t);
504 }
505 m_nMulElec++;
506 // cout<<__LINE__<<"\tCgemDigitizerSvc::samplingGar2"<<endl;
507
508 IndexGar index = pos2Index(rNew * cos(phi), rNew * sin(phi), z);
509
510 //if (m_nMulElec% 100 ==0){cout<<"rNew"<<rNew<<"xNew"<<xNew<<endl;}
511
512 // cout<<__LINE__<<"\tCgemDigitizerSvc::samplingGar2"<<endl;
513 vector<int> &hist = (*m_pMultiElectronMap)[index];
514 int binOffset = (int(t) / binsize);
515
516 hist.resize(_nbins + 1); // last bin mean overflow. since InductionGar1 integrated Q does't cut out-of-boundary..
517 // last bin mean overflow. since InductionGar1 integrated Q does't cut out-of-boundary..
518
519 if (binOffset < 0 || binOffset >= _nbins) {
520 binOffset = _nbins; //overflow bin
521 }
522
523 if (!m_debugging) {
524 hist[binOffset]++;
525 } else {
526 if (index.sheet != -1) { // [almost always]
527 try {
528 hist.at(binOffset)++; //Avoid overflow and electron not on sheet.
529 } catch (const std::out_of_range &e) {
530 cerr << "CgemDigitizerSvc::SamplingGar2::samplingTransfer(): Warning: found " << e.what() << ". note that we've done boundry check.\n";
531 cerr << "at index" << (int)index.sheet << " " << index.stripX << " " << index.stripV << " " << (int)index.gridX << " " << int(index.gridV) << '\n';
532 cerr << " binOffset " << binOffset << "; size=" << hist.size() << "; _nbins=" << _nbins << endl;
533 }
534 }
535 }
536}
TGraphErrors * dt
Definition: AbsCor.cxx:72
double sin(const BesAngle a)
Definition: BesAngle.h:210
double cos(const BesAngle a)
Definition: BesAngle.h:213
const Int_t n
Double_t x[10]
#define M_PI
Definition: TConstant.h:4
double getInnerROfCgemFoil() const
Definition: CgemGeoFoil.h:33
CgemGeoFoil * getCgemFoil(int i) const
Definition: CgemGeoLayer.h:115
double getInnerROfGapI() const
Definition: CgemGeoLayer.h:110
int getNumberOfSheet() const
Definition: CgemGeoLayer.h:215
double getDist2ClosestXStripCenter(double phi, int &id)
bool OnThePlane(double phi, double z) const
double getDist2ClosestVStripCenter(G4ThreeVector pos, int &id)
virtual CgemGeoReadoutPlane * getReadoutPlane(int iLayer, int iSheet) const =0
virtual CgemGeoLayer * getCgemLayer(int i) const =0
void setIonElectrons(int layer, int nElectrons, std::vector< double > x, std::vector< double > y, std::vector< double > z, std::vector< double > t)
void init(ICgemGeomSvc *geomSvc, double magConfig)
std::ifstream ifstream
Definition: bpkt_streams.h:44
complex_t R(double Q2, double M2, double G, double Mp2, double Mm2)
Definition: TUtil.h:27
char gridX
Definition: IndexGar.h:9
char sheet
Definition: IndexGar.h:10
int stripV
Definition: IndexGar.h:8
int stripX
Definition: IndexGar.h:7
char gridV
Definition: IndexGar.h:9
int t()
Definition: t.c:1