2 #include "G4Poisson.hh" 3 #include "Randomize.hh" 6 #include <CCDB/Calibration.h> 7 #include <CCDB/Model/Assignment.h> 8 #include <CCDB/CalibrationGenerator.h> 20 if(runno == -1)
return pcc;
26 pcc.
date =
"2015-11-29";
27 if(getenv (
"CCDB_CONNECTION") != NULL)
28 pcc.
connection = (string) getenv(
"CCDB_CONNECTION");
30 pcc.
connection =
"mysql://clas12reader@clasdb.jlab.org/clas12";
47 vector<vector<double> > data;
48 auto_ptr<Calibration> calib(CalibrationGenerator::CreateCalibration(pcc.
connection));
50 sprintf(pcc.
database,
"/calibration/ec/attenuation:%d",pcc.
runNo);
51 data.clear(); calib->GetCalib(data,pcc.
database);
53 for(
unsigned row = 0; row < data.size(); row++)
55 isec = data[row][0]; ilay = data[row][1]; istr = data[row][2];
56 pcc.
attlen[isec-1][ilay-1][0].push_back(data[row][3]);
57 pcc.
attlen[isec-1][ilay-1][1].push_back(data[row][4]);
58 pcc.
attlen[isec-1][ilay-1][2].push_back(data[row][5]);
67 if(pcc.
runNo != runno)
69 cout <<
" > Initializing " << HCname <<
" digitization for run number " << runno << endl;
70 pcc = initializePCConstants(runno);
76 map<string, double> dgtz;
77 vector<identifier> identity = aHit->
GetId();
80 int sector = identity[0].id;
81 int module = identity[1].id;
82 int view = identity[2].id;
83 int strip = identity[3].id;
86 HCname =
"PCAL Hit Process";
99 vector<G4double> Edep = aHit->
GetEdep();
100 vector<G4ThreeVector> Lpos = aHit->
GetLPos();
104 double A = pcc.
attlen[sector-1][view-1][0][strip-1];
105 double B = pcc.
attlen[sector-1][view-1][1][strip-1]*10.;
106 double C = pcc.
attlen[sector-1][view-1][2][strip-1];
110 for(
unsigned int s=0; s<tInfos.
nsteps; s++)
114 double xlocal = Lpos[s].x();
115 if(view==1) latt=pDx2+xlocal;
116 if(view==2) latt=pDx2+xlocal;
117 if(view==3) latt=pDx2+xlocal;
118 att = A*exp(-latt/B)+C;
119 Etota = Etota + Edep[s]*att;
120 Ttota = Ttota + latt/pcc.
veff;
124 Etota = Etota + Edep[s];
134 double PC_npe = G4Poisson(Etota*pcc.
pmtPEYld);
136 double sigma = pcc.
pmtFactor/sqrt(PC_npe);
149 dgtz[
"sector"] = sector;
150 dgtz[
"module"] = module;
152 dgtz[
"strip"] = strip;
169 id[
id.size()-1].id_sharing = 1;
177 map< string, vector <int> > MH;
map< string, vector< int > > multiDgt(MHit *, int)
map< string, double > integrateDgt(MHit *, int)
vector< identifier > GetId()
vector< double > attlen[6][9][3]
vector< G4ThreeVector > GetLPos()
vector< double > dimensions
vector of dimensions. Size, units depends on solid type
void initWithRunNumber(int runno)
vector< double > GetEdep()
vector< identifier > processID(vector< identifier >, G4Step *, detector)