Skip to content
Snippets Groups Projects
Commit 5d858f20 authored by audrey.chatillon's avatar audrey.chatillon
Browse files

[Epic] adjust the energy loss per fix bin length

parent 61774eaa
No related branches found
No related tags found
No related merge requests found
Pipeline #385197 passed
...@@ -571,7 +571,6 @@ void Epic::ReadSensitive(const G4Event* ){ ...@@ -571,7 +571,6 @@ void Epic::ReadSensitive(const G4Event* ){
vector<double> de; vector<double> de;
vector<double> dt; vector<double> dt;
bool end_of_new_trackID = false ; bool end_of_new_trackID = false ;
//cout << "step_name.size() = " << step_name.size() << endl;
for(int j=0; j<step_name.size(); j++){ for(int j=0; j<step_name.size(); j++){
if(step_trackID.at(j) != previous_trackID){ if(step_trackID.at(j) != previous_trackID){
...@@ -587,8 +586,6 @@ void Epic::ReadSensitive(const G4Event* ){ ...@@ -587,8 +586,6 @@ void Epic::ReadSensitive(const G4Event* ){
if(end_of_new_trackID == true || j==step_name.size()-1) { if(end_of_new_trackID == true || j==step_name.size()-1) {
if(name_pertrackID!="e-" && name_pertrackID!="anti_nu_e"){ if(name_pertrackID!="e-" && name_pertrackID!="anti_nu_e"){
//cout << "================================================" << endl;
//cout << "TrackID " << trackID << " time_pertrackID = " << time_pertrackID << endl;
int num_bins = (int)(std::ceil( (m_Distance_AK-dz.at(dz.size()-1)) / (25.*um) )) ; int num_bins = (int)(std::ceil( (m_Distance_AK-dz.at(dz.size()-1)) / (25.*um) )) ;
vector<double> rebinned_dz; rebinned_dz.resize(num_bins); vector<double> rebinned_dz; rebinned_dz.resize(num_bins);
vector<double> rebinned_de; rebinned_de.assign(num_bins, 0.0); vector<double> rebinned_de; rebinned_de.assign(num_bins, 0.0);
...@@ -596,11 +593,7 @@ void Epic::ReadSensitive(const G4Event* ){ ...@@ -596,11 +593,7 @@ void Epic::ReadSensitive(const G4Event* ){
double bin_Limits[num_bins+1]; double bin_Limits[num_bins+1];
for(int bin=0; bin<=num_bins; bin++) bin_Limits[bin] = m_Distance_AK*mm - bin * (25.*um); for(int bin=0; bin<=num_bins; bin++) bin_Limits[bin] = m_Distance_AK*mm - bin * (25.*um);
// FIRST STEP
//cout << " step #0" << " de = " << de.at(0) << " dz = " << dz.at(0) << endl;
rebinned_de[0] = de.at(0); rebinned_de[0] = de.at(0);
// INERMEDIATE STEP
int bin_current = 0; int bin_current = 0;
for(int step=1; step<dz.size()-1; step++){ for(int step=1; step<dz.size()-1; step++){
double dzmax = 0.5*(dz.at(step-1) + dz.at(step)); double dzmax = 0.5*(dz.at(step-1) + dz.at(step));
...@@ -609,30 +602,25 @@ void Epic::ReadSensitive(const G4Event* ){ ...@@ -609,30 +602,25 @@ void Epic::ReadSensitive(const G4Event* ){
if(bin_Limits[bin] >= dzmax && dzmax > bin_Limits[bin+1] && bin_Limits[bin] > dzmin && dzmin >= bin_Limits[bin+1]){ if(bin_Limits[bin] >= dzmax && dzmax > bin_Limits[bin+1] && bin_Limits[bin] > dzmin && dzmin >= bin_Limits[bin+1]){
bin_current = bin; bin_current = bin;
rebinned_de[bin] += de.at(step); rebinned_de[bin] += de.at(step);
//cout << "full step is in the bin" << bin << endl;
break; break;
} }
else if(bin<num_bins-1 && bin_Limits[bin] >= dzmax && dzmax > bin_Limits[bin+1] && bin_Limits[bin+1] > dzmin && dzmin >= bin_Limits[bin+2]){ else if(bin<num_bins-1 && bin_Limits[bin] >= dzmax && dzmax > bin_Limits[bin+1] && bin_Limits[bin+1] > dzmin && dzmin >= bin_Limits[bin+2]){
bin_current = bin; bin_current = bin;
// to do calculate the weight double weight = (dzmax-bin_Limits[bin+1])/(dzmax-dzmin);
double weight = 0;
rebinned_de[bin] += weight * de.at(step); rebinned_de[bin] += weight * de.at(step);
rebinned_de[bin+1] += (1-weight) * de.at(step); rebinned_de[bin+1] += (1-weight) * de.at(step);
//cout << "step is share over two bin " << bin << " and bin " << bin+1 << endl;
break; break;
} }
} }
} }
// FIXME : LAST BIN rebinned_de[num_bins-1] += de.at(dz.at(dz.size()-1));
//for(int i = 0 ; i< num_bins; i++) cout << "rebinned_de[" << i << "] = " << rebinned_de.at(i) << endl;
m_Event->Set(trackID, m_Event->Set(trackID,
name_pertrackID, name_pertrackID,
m_mapping_A[Anode], // set anode number m_mapping_A[Anode], // set anode number
influence_pertrackID, // set Q1 FF or alpha only influence_pertrackID, // set Q1 FF or alpha only
time_pertrackID, // set Time time_pertrackID, // set Time
dz, rebinned_de, dt); dz, rebinned_de, dt);
// rebinned_dz, rebinned_de, rebinned_dt);
} }
trackID = step_trackID.at(j); trackID = step_trackID.at(j);
name_pertrackID = step_name.at(j); name_pertrackID = step_name.at(j);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment