5 #include "G4FieldManager.hh" 23 cout <<
" > bmt pre-initizialization. " << endl;
38 double ZEdge1[bmtc.
NREGIONS] = { 30.56*degree, 270.56*degree, 150.56*degree};
39 double ZEdge2[bmtc.
NREGIONS] = {149.44*degree, 29.44*degree, 269.44*degree};
42 for (
int i = 0; i <bmtc.
NREGIONS ; ++i)
44 for (
int j = 0; j <bmtc.
NREGIONS ; ++j)
61 double CEdge1[bmtc.
NREGIONS] = { 30.52*degree, 270.52*degree, 150.52*degree};
62 double CEdge2[bmtc.
NREGIONS] = { 149.48*degree, 29.48*degree, 269.48*degree};
65 for (
int i = 0; i <bmtc.
NREGIONS ; ++i)
67 for (
int j = 0; j <bmtc.
NREGIONS ; ++j)
75 double CR4C_width[13]={0.345,0.28,0.225,0.175,0.17,0.21,0.26,0.31,0.37,0.44,0.515,0.605,0.7};
76 double CR4C_group[13]={32,32,32,32,624,32,32,32,32,32,32,32,896};
78 double CR5C_width[1]={0.253};
79 double CR5C_group[1]={1024};
81 double CR6C_width[14]={0.38,0.32,0.27,0.23,0.17,0.18,0.22,0.25,0.29,0.33,0.37,0.41,0.46,0.51};
82 double CR6C_group[14]={32,32,32,32,704,64,32,32,32,32,32,32,32,32};
88 for (
int i = 0; i <3 ; ++i)
94 for(
int j =0; j<13; j++)
100 for(
int j =0; j<1; j++)
103 bmtc.
CRCGROUP[1][j] = CR5C_group[j];
104 bmtc.
CRCWIDTH[1][j] = CR5C_width[j];
106 for(
int j =0; j<14; j++)
109 bmtc.
CRCGROUP[2][j] = CR6C_group[j];
110 bmtc.
CRCWIDTH[2][j] = CR6C_width[j];
118 map<string, double> dgtz;
119 vector<identifier> identity = aHit->
GetId();
125 int layer = identity[0].id;
126 int sector = identity[2].id;
127 int strip = identity[3].id;
133 cout <<
log_msg <<
" layer: " << layer <<
" sector: " << sector <<
" Strip: " << strip
134 <<
" x=" << tInfos.
x <<
" y=" << tInfos.
y <<
" z=" << tInfos.
z << endl;
138 dgtz[
"layer"] = layer;
139 dgtz[
"sector"] = sector;
140 dgtz[
"strip"] = strip;
141 dgtz[
"Edep"] = tInfos.
eTot;
149 G4ThreeVector xyz = aStep->GetPostStepPoint()->GetPosition();
155 const double point[4] = {xyz.x(), xyz.y(), xyz.z(), 10};
156 double fieldValue[3] = {0, 0, 0};
159 G4FieldManager *fmanager = aStep->GetPostStepPoint()->GetPhysicalVolume()->GetLogicalVolume()->GetFieldManager();
164 fmanager->GetDetectorField()->GetFieldValue(point, fieldValue);
166 cout <<
" > BMT: Field found with value " << fieldValue[2]/gauss <<
" gauss. Setting Lorentz angle accordingly." << endl;
173 cout <<
" > BMT: No field found. Lorentz angle set to zero." << endl;
177 vector<identifier> yid = id;
181 int layer = yid[0].id;
182 int sector = yid[2].id;
184 double depe = aStep->GetTotalEnergyDeposit();
186 vector<double> multi_hit = bmts.
FindStrip(layer, sector, xyz, depe, bmtc);
188 int n_multi_hits = multi_hit.size()/2;
192 yid[3].id = (int) multi_hit[0];
194 yid[0].id_sharing = multi_hit[1];
195 yid[1].id_sharing = multi_hit[1];
196 yid[2].id_sharing = multi_hit[1];
197 yid[3].id_sharing = multi_hit[1];
201 for(
int h=1; h<n_multi_hits; h++)
203 for(
int j=0; j<3; j++)
206 this_id.
name = yid[j].name;
207 this_id.
rule = yid[j].rule;
208 this_id.
id = yid[j].id;
209 this_id.
time = yid[j].time;
211 this_id.
TrackId = yid[j].TrackId;
213 yid.push_back(this_id);
217 this_id.
name = yid[3].name;
218 this_id.
rule = yid[3].rule;
219 this_id.
id = (int) multi_hit[2];
220 this_id.
time = yid[3].time;
222 this_id.
TrackId = yid[3].TrackId;
224 yid.push_back(this_id);
231 void BMT_HitProcess::initWithRunNumber(
int runno)
233 if(bmtc.
runNo != runno)
235 cout <<
" > Initializing " <<
HCname <<
" digitization for run number " << runno << endl;
236 bmtc = initializeBMTConstants(runno);
244 map< string, vector <int> > MH;
253 bmtConstants BMT_HitProcess::bmtc = initializeBMTConstants(-1);
double CRCRADIUS[NREGIONS]
double CRCSPACING[NREGIONS]
double CRCLENGTH[NREGIONS]
double CRCEDGE2[NREGIONS][NREGIONS]
map< string, vector< int > > multiDgt(MHit *, int)
vector< vector< int > > CRCGROUP
double CRCEDGE1[NREGIONS][NREGIONS]
double CRZWIDTH[NREGIONS]
vector< identifier > GetId()
int id
manually assing ID. 0 if "ncopy" (will be set at hit processing time)
string name
Name of the detector.
double CRZRADIUS[NREGIONS]
vector< identifier > processID(vector< identifier >, G4Step *, detector)
static const int NREGIONS
double CRZEDGE1[NREGIONS][NREGIONS]
vector< double > FindStrip(int layer, int sector, G4ThreeVector xyz, double Edep, bmtConstants bmtc)
double TimeWindow
Time Window. If abs(steptime - time) is smaller than TimeWindow, it's the same hit.
int TrackId
If Time Window is 0, it's a "flux" detector: if it's the same track, it's the same hit...
void changeFieldScale(double newFieldScale)
vector< vector< double > > CRCWIDTH
double CRCOFFSET[NREGIONS]
double id_sharing
A single step can generate multiple identifiers. This variable represent the percentage sharing of th...
double time
Time of the first step.
double CRZLENGTH[NREGIONS]
map< string, double > integrateDgt(MHit *, int)
string rule
"manual" or "ncopy"
double CRZSPACING[NREGIONS]
double CRZEDGE2[NREGIONS][NREGIONS]
double CRZOFFSET[NREGIONS]