Skip to content
Snippets Groups Projects
Commit c05bb731 authored by Michael Duehrssen-Debling's avatar Michael Duehrssen-Debling
Browse files

CaloSamplingFractionAnalysis add sampling fraction histograms LAr EM endcap...

CaloSamplingFractionAnalysis add sampling fraction histograms LAr EM endcap and script for Tile Sampling Fractions
parent 6247d4c4
No related branches found
No related tags found
No related merge requests found
...@@ -2,12 +2,14 @@ ...@@ -2,12 +2,14 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/ */
void LarEMSamplingFraction_barrel()
{ {
TFile* file = TFile::Open("LArEM_SF.root"); TFile* file = TFile::Open("LArEM_SF_barrel.root");
new TCanvas("Etot","Etot"); TTree* mytree=(TTree*)file->Get("mytree");
new TCanvas("Etot_barrel","Etot_barrel");
mytree->Draw("Sum$(energy_active_total+energy_inactive_total)"); mytree->Draw("Sum$(energy_active_total+energy_inactive_total)");
new TCanvas("ELAr_hit","ELAr_hit"); new TCanvas("ELAr_hit_barrel","ELAr_hit_barrel");
mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])"); mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])");
//new TCanvas("SF","SF"); //new TCanvas("SF","SF");
...@@ -16,28 +18,101 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration ...@@ -16,28 +18,101 @@ Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
//new TCanvas("LAr_barrel","LAr_barrel"); //new TCanvas("LAr_barrel","LAr_barrel");
//mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]):mc_eta>>LAr_barrel(56,0,1.4,50,7000,12000)","","colz"); //mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]):mc_eta>>LAr_barrel(56,0,1.4,50,7000,12000)","","colz");
new TCanvas("SF_LAr_barrel_calibhit","SF_LAr_barrel_calibhit"); TCanvas* c;
mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,70,0.18,0.25)","","colz"); c=new TCanvas("SF_LAr_barrel_calibhit","SF_LAr_barrel_calibhit");
mytree->Draw("(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel_calibhit(56,0,1.4,140,0.18,0.25)","","colz");
TH2* SF_LAr_barrel_calibhit=(TH2*)gDirectory->Get("SF_LAr_barrel_calibhit"); TH2* SF_LAr_barrel_calibhit=(TH2*)gDirectory->Get("SF_LAr_barrel_calibhit");
//ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
TProfile* SF_prof_calibhit=SF_LAr_barrel_calibhit->ProfileX(); TProfile* SF_prof_calibhit=SF_LAr_barrel_calibhit->ProfileX();
SF_prof_calibhit->SetLineColor(2); SF_prof_calibhit->SetLineColor(2);
SF_prof_calibhit->Draw("same"); SF_prof_calibhit->Draw("same");
//TFitResultPtr* fitres= //TFitResultPtr* fitres=
SF_prof_calibhit->Fit("pol0","","",0.1,0.75); //SF_prof_calibhit->Fit("pol0","","",0.1,0.75);
SF_prof_calibhit->Fit("pol0","+","",0.85,1.35); //SF_prof_calibhit->Fit("pol0","+","",0.85,1.35);
c->SetGridx();
c->SetGridy();
new TCanvas("SF_LAr_barrel","SF_LAr_barrel"); c=new TCanvas("SF_LAr_barrel","SF_LAr_barrel");
mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,70,0.16,0.23)","","colz"); mytree->Draw("(energy_hit[0]+energy_hit[1]+energy_hit[2]+energy_hit[3])/(energy_active_total[0]+energy_active_total[1]+energy_active_total[2]+energy_active_total[3]+energy_inactive_total[0]+energy_inactive_total[1]+energy_inactive_total[2]+energy_inactive_total[3]):mc_eta>>SF_LAr_barrel(56,0,1.4,140,0.16,0.23)","","colz",1000);
TH2* SF_LAr_barrel=(TH2*)gDirectory->Get("SF_LAr_barrel"); TH2* SF_LAr_barrel=(TH2*)gDirectory->Get("SF_LAr_barrel");
SF_LAr_barrel->SetStats(0);
SF_LAr_barrel->SetTitle("Sampling fraction LAr EM barrel");
SF_LAr_barrel->GetXaxis()->SetTitle("|#eta|");
SF_LAr_barrel->GetYaxis()->SetTitle("E_{G4hit}/E_{total}");
//ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "") //ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
TProfile* SF_prof=SF_LAr_barrel->ProfileX(); TProfile* SF_prof=SF_LAr_barrel->ProfileX();
SF_prof->SetLineColor(2); SF_prof->SetLineColor(2);
SF_prof->Draw("same"); SF_prof->Draw("same");
//TFitResultPtr* fitres= SF_prof->Fit("pol0","Q","",0.1,0.75);
SF_prof->Fit("pol0","","",0.1,0.75); SF_prof->Fit("pol0","Q+","",0.85,1.35);
SF_prof->Fit("pol0","+","",0.85,1.35); TList* res=SF_prof->GetListOfFunctions();
TPaveText *pt = new TPaveText(.05,.2,.75,.23,"");
pt->SetFillStyle(1001);
pt->SetFillColor(10);
pt->SetBorderSize(1);
pt->AddText("Sampling fractions LAr EM barrel");
for(int i=0;i<res->GetSize();++i) if(res->At(i)->InheritsFrom(TF1::Class())) {
TF1* func=(TF1*)res->At(i);
TString text=Form("%4.2f < #eta < %4.2f = %7.5f +- %7.5f",func->GetXmin(),func->GetXmax(),func->GetParameter(0),func->GetParError(0));
//cout<<"i="<<i<<" "<<res->At(i)->ClassName()<<" : "<<res->At(i)->GetName()<<endl;
cout<<"Sampling fraction : "<<text<<endl;
pt->AddText(text);
}
//mytree->Print(); pt->Draw();
c->SetGridx();
c->SetGridy();
}
void LarEMSamplingFraction_endcap()
{
TFile* file = TFile::Open("LArEM_SF_endcap.root");
TTree* mytree=(TTree*)file->Get("mytree");
new TCanvas("Etot_endcap","Etot_endcap");
mytree->Draw("Sum$(energy_active_total+energy_inactive_total)");
new TCanvas("ELAr_hit_endcap","ELAr_hit_endcap");
mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])");
TCanvas* c;
c=new TCanvas("SF_LAr_endcap_calibhit","SF_LAr_endcap_calibhit");
mytree->Draw("(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap_calibhit(86,1.35,3.5,400,0.00,0.40)","","colz");
TH2* SF_LAr_endcap_calibhit=(TH2*)gDirectory->Get("SF_LAr_endcap_calibhit");
//ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
TProfile* SF_prof_calibhit=SF_LAr_endcap_calibhit->ProfileX();
SF_prof_calibhit->SetLineColor(2);
SF_prof_calibhit->Draw("same");
//TFitResultPtr* fitres=
//SF_prof_calibhit->Fit("pol0","","",0.1,0.75);
//SF_prof_calibhit->Fit("pol0","+","",0.85,1.35);
c->SetGridx();
c->SetGridy();
c=new TCanvas("SF_LAr_endcap","SF_LAr_endcap");
mytree->Draw("(energy_hit[4]+energy_hit[5]+energy_hit[6]+energy_hit[7])/(energy_active_total[4]+energy_active_total[5]+energy_active_total[6]+energy_active_total[7]+energy_inactive_total[4]+energy_inactive_total[5]+energy_inactive_total[6]+energy_inactive_total[7]):mc_eta>>SF_LAr_endcap(86,1.35,3.5,800,0.00,0.40)","","colz");
TH2* SF_LAr_endcap=(TH2*)gDirectory->Get("SF_LAr_endcap");
SF_LAr_endcap->SetStats(0);
SF_LAr_endcap->SetTitle("Sampling fraction LAr EM endcap");
SF_LAr_endcap->GetXaxis()->SetTitle("|#eta|");
SF_LAr_endcap->GetYaxis()->SetTitle("E_{G4hit}/E_{total}");
SF_LAr_endcap->GetYaxis()->SetRangeUser(0,0.15);
//ProfileX(const char* name = "_pfx", Int_t firstybin = 1, Int_t lastybin = -1, Option_t* option = "")
TProfile* SF_prof=SF_LAr_endcap->ProfileX();
SF_prof->SetLineColor(2);
SF_prof->Draw("same");
//TFitResultPtr* fitres=
//SF_prof->Fit("pol0","","",0.1,0.75);
//SF_prof->Fit("pol0","+","",0.85,1.35);
c->SetGridx();
c->SetGridy();
}
void LarEMSamplingFraction_analysis()
{
LarEMSamplingFraction_barrel();
LarEMSamplingFraction_endcap();
} }
#!/bin/zsh
nevt=${1:-10000}
if [ $# -gt 0 ]
then shift
fi
args="${(j. .)${@}:- -00 -05 +05 -10 +10 -15 +15 -20 +20 -25 +25 -30 +30 -35 +35 -40 +40 -45 +45 -50 +50 -55 +55 -60 +60 -90 +90}"
Zbeam=20.
if [ ! -f tile_sf.C ]
then get_files tile_sf.C
sed "s|-15.,15.|-${Zbeam},${Zbeam}|g" tile_sf.C > t.C
mv -f t.C tile_sf.C
fi
for v in `echo $args`
do if [[ "$v" -lt 1 ]] && [[ "$v" -gt -1 ]] && [ "${v/./}" != "${v}" ]
then p="Eta=$v"
elif [[ "$v" -lt 90 ]] && [[ "$v" -gt -90 ]]
then p="Z=0; Theta=$v"
elif [[ "$v" -eq 90 ]] || [[ "$v" -eq -90 ]]
then p="Z=2550; Theta=$v"
elif [[ "$v" -gt 2280 ]] && [[ "$v" -lt 4250 ]]
then p="Theta=90; Z=${v/+/}"
elif [[ "$v" -lt -2280 ]] && [[ "$v" -gt -4250 ]]
then p="Theta=-90; Z=${v/-/}"
else echo "Ignoring invalid value $v"
continue
fi
echo "========== Running athena for $p: $nevt events =========="
athena.py -c "EvtMax=$nevt; PID=11; E=100000; Zbeam=[-$Zbeam,$Zbeam]; FileSuffix='$v'; $p;" TileSimEx/jobOptions_TileTB_Sim.py
athena.py -c "doHitNtuple=True; doD3PD=True; doTileNtuple=False; FileSuffix='$v';" TileSimEx/jobOptions_TileTB_Dig.py
root -b -q "tile_sf.C(\"$v\");" > sf$v.log
done
grep SF sf*.log
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