Commit 547207a9 authored by Warren's avatar Warren
Browse files

Skips events that crash due to reaction not occuring

parent 25216db4
Pipeline #104059 passed with stages
in 15 minutes and 26 seconds
......@@ -25,22 +25,10 @@ Gas_Scorer::~Gas_Scorer(){}
G4bool Gas_Scorer::ProcessHits(G4Step* aStep, G4TouchableHistory*){
G4double* Infos = new G4double[12];
//G4double w_value = 26.31*eV;
m_Position = aStep->GetPreStepPoint()->GetPosition();
Infos[0] = aStep->GetTrack()->GetTrackID();
/*
Infos[1] = -1.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "Ne18") Infos[1] = 0.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "Na21") Infos[1] = 1.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "proton") Infos[1] = 2.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "alpha") Infos[1] = 3.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "Li8") Infos[1] = 4.;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "B11") Infos[1] = 5;
if (aStep->GetTrack()->GetDefinition()->GetParticleName() == "neutron") Infos[1] = 6;
*/
Infos[1] = aStep->GetTrack()->GetParticleDefinition()->GetAtomicNumber();;
Infos[2] = aStep->GetPreStepPoint()->GetGlobalTime();
......@@ -59,49 +47,22 @@ G4bool Gas_Scorer::ProcessHits(G4Step* aStep, G4TouchableHistory*){
m_DetectorNumber = aStep->GetPreStepPoint()->GetTouchableHandle()->GetCopyNumber(m_Level);
m_Index = m_DetectorNumber * 1e3 + m_SegmentNumber * 1e6;
//Infos[12] = 0.;
//Infos[13] = 0.;
//Infos[14] = 0.;
//cout << "\n" << "PAD " << Infos[5] << " first_step = " << first_step << endl;
//double TOA_min, TOA_max;
//if(PAD==1000) PAD = Infos[5];
//if(PAD!=Infos[5]) TOA_PAD.clear(); // if new pad clear the TOA vec
if(isnan(Infos[9])) {
aStep->GetTrack()->SetTrackStatus(fStopAndKill);
return 0;
}
#ifdef USE_Garfield
G4ThreeVector delta_Position = aStep->GetDeltaPosition();
// bool last_step;
//if(aStep->GetTrack()->GetTrackStatus()!=fAlive) last_step = 1; else last_step = 0;
//vector<double> TOA_vec = GARFDRIFT(Infos[4]/eV, Infos[2], m_Position/cm, delta_Position/cm, Infos[7]/cm, Infos[5], Infos[1], m_ScorerLength/cm, m_SegmentLength/cm, last_step); //Ionization Energy Deposit, Global Time, x, y, z,R, ParticleID //Garfield works in cm, both G4 and Garfield work in ns.
GARFDRIFT(Infos[4]/eV, Infos[2], m_Position/cm, delta_Position/cm, Infos[7]/cm, Infos[5], Infos[1], m_ScorerLength/cm, m_SegmentLength/cm);
#endif
/*
for(int t=0; t<TOA_vec.size(); t++) TOA_PAD.push_back(TOA_vec[t]);
sort(TOA_PAD.begin(), TOA_PAD.end());
reverse(TOA_PAD.begin(), TOA_PAD.end());
if(TOA_PAD.size() > 42) TOA_max = TOA_PAD[42], TOA_min = *min_element(TOA_PAD.begin(), TOA_PAD.end()); //threshold of 42 (420 e- ~10 mV threshold)
else TOA_min = 1.e06, TOA_max = 0.;
cout << "\n" << "PAD: " << Infos[5] << " vec size: " << TOA_PAD.size() << " TOA_min: " << TOA_min << " TOA_max " << TOA_max << endl;
#else
TOA_min =1.e06;
TOA_max = 0.;
#endif
*/
map<G4int, G4double**>::iterator it;
it= EvtMap->GetMap()->find(m_Index);
if(it!=EvtMap->GetMap()->end()){
G4double* dummy = *(it->second);
/*
if(TOA_min < 1.e06) Infos[12] = TOA_max - TOA_min;
if(Infos[12] < dummy[12]) Infos[12] = dummy[12]; //Ensures that max risetime is maintained
PAD = Infos[5];
*/
if(Infos[1]==dummy[1]) Infos[4]+=dummy[4]; //accumulate ionisation energy deposit to get total accross pad
delete dummy;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment