Skip to content
Snippets Groups Projects
Commit a58a2229 authored by Maria Zurek's avatar Maria Zurek
Browse files

Avoid variable redefinition

parent 3c24d6b6
No related branches found
No related tags found
1 merge request!153Draft: Resolve "Add energy scan for Barrel Ecal"
...@@ -159,16 +159,16 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -159,16 +159,16 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
auto dpions = d1.Filter(isPion, {"mcparticles2"}); auto dpions = d1.Filter(isPion, {"mcparticles2"});
auto delectrons = d1.Filter(isElectron, {"mcparticles2"}); auto delectrons = d1.Filter(isElectron, {"mcparticles2"});
enum typeColumns {Ethr, Mom, MomSmeared, EClusterScFi, NClusterScFi, EoverPScFi, EoverPRecScFi, nColumnsToPlot}; enum typeColumns {ethr, mom, momSmeared, eClusterScFi, nClusterScFi, eoverPScFi, eoverPRecScFi, nColumnsToPlot};
infoHist1D infoHists[nColumnsToPlot]; infoHist1D infoHists[nColumnsToPlot];
infoHists[Ethr] = {"hEthr", "Ethr", "Thrown Energy; Thrown Energy [GeV]; Events", 500, 0.0, 11.0}; infoHists[ethr] = {"hEthr", "Ethr", "Thrown Energy; Thrown Energy [GeV]; Events", 500, 0.0, 11.0};
infoHists[Mom] = {"hMom", "Mom", "Thrown Momentum; Thrown Momentum [GeV/c]; Events", 500, 0.0, 11.0}; infoHists[mom] = {"hMom", "Mom", "Thrown Momentum; Thrown Momentum [GeV/c]; Events", 500, 0.0, 11.0};
infoHists[MomSmeared] = {"hMomSmeared", "MomSmeared", "Thrown Momentum Smeared; Thrown Momentum Smeared [GeV/c]; Events", 500, 0.0, 11.0}; infoHists[momSmeared] = {"hMomSmeared", "MomSmeared", "Thrown Momentum Smeared; Thrown Momentum Smeared [GeV/c]; Events", 500, 0.0, 11.0};
infoHists[EClusterScFi] = {"hEClusterScFi", "EClusterScFi", "Cluster Energy; Cluster Energy [GeV]; Events", 500, 0.0, 11.0}; infoHists[eClusterScFi] = {"hEClusterScFi", "EClusterScFi", "Cluster Energy; Cluster Energy [GeV]; Events", 500, 0.0, 11.0};
infoHists[NClusterScFi] = {"hNClusterScFi", "NClusterScFi", "Number of Clusters; # of Clusters; Events", 10, 0, 10}; infoHists[eClusterScFi] = {"hNClusterScFi", "NClusterScFi", "Number of Clusters; # of Clusters; Events", 10, 0, 10};
infoHists[EoverPScFi] = {"hEoverPScFi", "EoverPClusterScFi", "Cluster Energy/Momentum; Cluster Energy/Momentum; Events", 480, 0., 1.2}; infoHists[eoverPScFi] = {"hEoverPScFi", "EoverPClusterScFi", "Cluster Energy/Momentum; Cluster Energy/Momentum; Events", 480, 0., 1.2};
infoHists[EoverPRecScFi] = {"hEoverPScFi", "EoverPRecoScFi", "Reco Hits Energy/Momentum; Reco Hits Energy/Momentum; Events", 500, 0.0, 0.25}; infoHists[eoverPRecScFi] = {"hEoverPScFi", "EoverPRecoScFi", "Reco Hits Energy/Momentum; Reco Hits Energy/Momentum; Events", 500, 0.0, 0.25};
// Define and draw Histograms // Define and draw Histograms
for(int col=0; col<nColumnsToPlot; col++){ for(int col=0; col<nColumnsToPlot; col++){
...@@ -176,7 +176,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -176,7 +176,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
auto helectron = delectrons.Histo1D({fmt::format("{}_electron",infoHist.name).c_str(), infoHist.titles.c_str(), infoHist.nbins, infoHist.x0, infoHist.x1},infoHist.column.c_str()); auto helectron = delectrons.Histo1D({fmt::format("{}_electron",infoHist.name).c_str(), infoHist.titles.c_str(), infoHist.nbins, infoHist.x0, infoHist.x1},infoHist.column.c_str());
auto hpion = dpions.Histo1D({fmt::format("{}_pion",infoHist.name).c_str(), infoHist.titles.c_str(), infoHist.nbins, infoHist.x0, infoHist.x1},infoHist.column.c_str()); auto hpion = dpions.Histo1D({fmt::format("{}_pion",infoHist.name).c_str(), infoHist.titles.c_str(), infoHist.nbins, infoHist.x0, infoHist.x1},infoHist.column.c_str());
auto c = new TCanvas(fmt::format("c{}",infoHist.comlumn).c_str(), fmt::format("c{}",infoHist.comlumn).c_str(), 700, 500); auto c = new TCanvas(fmt::format("c{}",infoHist.column).c_str(), fmt::format("c{}",infoHist.column).c_str(), 700, 500);
helectron->GetYaxis()->SetTitleOffset(1.4); helectron->GetYaxis()->SetTitleOffset(1.4);
helectron->SetLineWidth(2); helectron->SetLineWidth(2);
helectron->SetLineColor(kBlue); helectron->SetLineColor(kBlue);
...@@ -187,7 +187,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -187,7 +187,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
} }
auto nlayers = 20; auto nlayers = 20;
enum typeLayerColumns {ErecScFi, ErecImg, nhitsScFi, nhitsImg, nLayerColumnsToPlot}; enum typeLayerColumns {erecScFi, erecImg, nhitsScFi, nhitsImg, nLayerColumnsToPlot};
std::string cname[nLayerColumnsToPlot] = {"ErecScFi_layer", "ErecImg_layer", "nhitsScFi_layer", "nhitsImg_layer"}; std::string cname[nLayerColumnsToPlot] = {"ErecScFi_layer", "ErecImg_layer", "nhitsScFi_layer", "nhitsImg_layer"};
TCanvas *clayer[nLayerColumnsToPlot]; TCanvas *clayer[nLayerColumnsToPlot];
for(int col=0; col<nLayerColumnsToPlot; col++){ for(int col=0; col<nLayerColumnsToPlot; col++){
...@@ -200,7 +200,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -200,7 +200,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
std::cout << "Layer to process: " << layer << std::endl; std::cout << "Layer to process: " << layer << std::endl;
// Energy reconstructed per layer // Energy reconstructed per layer
auto ERecInLayer = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { auto ERecInLayer = [=](const std::vector<eic::CalorimeterHitData>& evt) {
auto layer_edep = 0.0; auto layer_edep = 0.0;
for (const auto& i: evt) { for (const auto& i: evt) {
if (i.layer == layer) { if (i.layer == layer) {
...@@ -211,7 +211,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -211,7 +211,7 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
}; };
// Hits reconstructed per layer // Hits reconstructed per layer
auto nhitsInLayer = [=](const std::vector<dd4pod::CalorimeterHitData>& evt) { auto nhitsInLayer = [=](const std::vector<eic::CalorimeterHitData>& evt) {
auto nhits = 0; auto nhits = 0;
for (const auto& i: evt) { for (const auto& i: evt) {
if (i.layer == layer) { if (i.layer == layer) {
...@@ -243,8 +243,8 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -243,8 +243,8 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
infoHist1D infoLayerHists[nLayerColumnsToPlot]; infoHist1D infoLayerHists[nLayerColumnsToPlot];
infoLayerHists[ErecImg] = {fmt::format("hErecImg_layer_{}",layer), fmt::format("ErecImg_layer_{}",layer), fmt::format("Energy Deposit in layer {}; Energy Deposit [Gev]; Events",layer), 200, 0.0, 0.04}; infoLayerHists[erecImg] = {fmt::format("hErecImg_layer_{}",layer), fmt::format("ErecImg_layer_{}",layer), fmt::format("Energy Deposit in layer {}; Energy Deposit [Gev]; Events",layer), 200, 0.0, 0.04};
infoLayerHists[ErecScFi] = {fmt::format("hErecScFi_layer_{}",layer), fmt::format("ErecScFi_layer_{}",layer), fmt::format("Energy Deposit in layer {}; Energy Deposit [Gev]; Events",layer), 200, 0.0, 0.1}; infoLayerHists[erecScFi] = {fmt::format("hErecScFi_layer_{}",layer), fmt::format("ErecScFi_layer_{}",layer), fmt::format("Energy Deposit in layer {}; Energy Deposit [Gev]; Events",layer), 200, 0.0, 0.1};
infoLayerHists[nhitsImg] = {fmt::format("hnhitsImg_layer_{}_el",layer), fmt::format("nhitsImg_layer_{}",layer), fmt::format("Number of Reconstructed Hits in layer (); Number of hits; Events",layer), 500, 0, 500}; infoLayerHists[nhitsImg] = {fmt::format("hnhitsImg_layer_{}_el",layer), fmt::format("nhitsImg_layer_{}",layer), fmt::format("Number of Reconstructed Hits in layer (); Number of hits; Events",layer), 500, 0, 500};
infoLayerHists[nhitsScFi] = {fmt::format("hnhitsScFi_layer_{}_el",layer), fmt::format("nhitsScFi_layer_{}",layer), fmt::format("Number of Reconstructed Hits in layer (); Number of hits; Events",layer), 500, 0, 500}; infoLayerHists[nhitsScFi] = {fmt::format("hnhitsScFi_layer_{}_el",layer), fmt::format("nhitsScFi_layer_{}",layer), fmt::format("Number of Reconstructed Hits in layer (); Number of hits; Events",layer), 500, 0, 500};
...@@ -279,12 +279,13 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l ...@@ -279,12 +279,13 @@ std::tuple <double, double> extract_sampling_fraction_parameters(std::string E_l
// gr_no_edep.SetPoint(gr_no_edep.GetN(),layer,no_edep); // gr_no_edep.SetPoint(gr_no_edep.GetN(),layer,no_edep);
// gr_edep_mean.SetPoint(gr_edep_mean.GetN(),layer, mean_layer); // gr_edep_mean.SetPoint(gr_edep_mean.GetN(),layer, mean_layer);
// gr_edep_mean.SetPointError(gr_edep_mean.GetN()-1,0, rms_layer); // gr_edep_mean.SetPointError(gr_edep_mean.GetN()-1,0, rms_layer);
}
} }
for(int col=0; col<nLayerColumnsToPlot; col++) save_canvas(clayer[col], cname[col] , E_label, "electron_pion"); for(int col=0; col<nLayerColumnsToPlot; col++) save_canvas(clayer[col], cname[col] , E_label, "electron_pion");
// Event Counts // Event Counts
auto nevents_thrown = delectron.Count(); auto nevents_thrown = delectrons.Count();
std::cout << "Number of Thrown Electron Events: " << (*nevents_thrown) << "\n"; std::cout << "Number of Thrown Electron Events: " << (*nevents_thrown) << "\n";
return std::make_tuple(0., 0.); return std::make_tuple(0., 0.);
......
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