20 #include "TGeoManager.h" 81 fdEdx = tfs->
make<TH2D>(
"dEdx",
";Distance to track end (cm);PECorr / cm",
82 50, 0, 500, 100, 0, 200);
83 fdEdx_true = tfs->
make<TH2D>(
"dEdx_true",
";Distance to track end (cm);True MeV / cm",
84 50, 0, 500, 100, 0, 5);
97 run.
getByLabel(
"muondedx",
"dEdxTrue", dEtrue);
106 TH1*
ret =
new TH1F(
"",
"", h->GetNbinsX(),
107 h->GetXaxis()->GetXmin(), h->GetXaxis()->GetXmax());
108 for(
int x = 0;
x < h->GetNbinsX()+2; ++
x){
109 double maxVal = -1e10;
111 for(
int y = 1;
y < h->GetNbinsY()+1; ++
y){
112 const double val = h->GetBinContent(
x,
y);
115 maxy = h->GetYaxis()->GetBinCenter(
y);
118 TH1*
proj = h->ProjectionY(
"",
x,
x);
119 proj->Fit(
"gaus",
"0Q",
"", maxy-0.2, maxy+0.2);
120 TF1*
func = proj->GetFunction(
"gaus");
122 ret->SetBinContent(
x, func->GetParameter(1));
123 ret->SetBinError(
x, func->GetParError(1));
138 const double avgDensity = 1e3*block->Weight()/block->Capacity();
143 const double scintDensity =
144 geom->
ROOTGeoManager()->GetMaterial(
"Scintillator")->GetDensity();
149 TProfile* prof =
fdEdx->ProfileX();
157 TF1* f_ana = el_ana.
GetTF1();
158 prof->Fit(f_ana,
"",
"", 50, 500);
159 TF1* f_tab = el_tab.
GetTF1();
160 prof->Fit(f_tab,
"",
"", 50, 500);
165 const double pePerMeV = f_ana->GetParameter(0);
167 std::cout <<
"1 MeV = " << pePerMeV <<
" PE -> 1 PE = " << 1/pePerMeV <<
" MeV" <<
std::endl;
169 const double MeVPerCmPerMIP = bb_ana->
MIP()*scintDensity;
173 const double pePerMIPPerCm = pePerMeV*MeVPerCmPerMIP;
175 std::cout <<
"1 MIP = " << pePerMIPPerCm*Lz <<
" PE -> 1 PE = " << 1/pePerMIPPerCm/Lz <<
" MIP [MIPScale]" <<
std::endl;
179 tfs->
file().cd(
"bb");
181 f_ana->GetHistogram()->Write(
"fit_ana");
183 f_tab->GetHistogram()->Write(
"fit_tab");
188 bb_tab->
GetdEdxGraph(scintDensity)->Write(
"dEdx_curve");
189 bb_ana->
GetdEdxGraph(scintDensity)->Write(
"dEdx_curve_ana");
190 bb_ana->
GetMPVGraph(scintDensity, Lz)->Write(
"mpv_curve_ana");
191 bb_ana->
GetMPVGraph(scintDensity, Lz*2)->Write(
"mpv_curve_ana2");
192 bb_ana->
GetMPVGraph(scintDensity, Lz/2)->Write(
"mpv_curve_ana3");
void endRun(const art::Run &run) override
virtual double MIP() const =0
const CellGeo * Cell(int icell) const
TGeoManager * ROOTGeoManager() const
const PlaneGeo * Plane(unsigned int i) const
TGraph * GetEnergyLossGraph() const
DEFINE_ART_MODULE(TestTMapFile)
void analyze(const art::Event &evt) override
TH1 * ProfileMPV(TH2 *h) const
block
print "ROW IS " print row
TGraph * GetMPVGraph(double localDensity, double dist) const
TGraph * GetdEdxGraph(double localDensity) const
double func(double x, double y)
EDAnalyzer(Table< Config > const &config)
void beginRun(const art::Run &run) override
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
Integrate energy losses to calculate deposit near a track end.
Encapsulate the geometry of one entire detector (near, far, ndos)
BetheBlochFit(const fhicl::ParameterSet &pset)