79 fE = tfs->
make<TH1F>(
"e",
"True e^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
80 fMu = tfs->
make<TH1F>(
"mu",
"True #mu^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
81 fProt = tfs->
make<TH1F>(
"prot",
"True p;Energy estimate (GeV);Slices", 400, 0, 4);
82 fPi = tfs->
make<TH1F>(
"pi",
"True #pi^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
85 fEPre = tfs->
make<TH1F>(
"e_pre",
"True e^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
86 fMuPre = tfs->
make<TH1F>(
"mu_pre",
"True #mu^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
87 fProtPre = tfs->
make<TH1F>(
"prot_pre",
"True p;Energy estimate (GeV);Slices", 400, 0, 4);
88 fPiPre = tfs->
make<TH1F>(
"pi_pre",
"True #pi^{#pm};Energy estimate (GeV);Slices", 400, 0, 4);
91 fMu->SetLineColor(
kBlue);
92 fProt->SetLineColor(kBlack);
93 fPi->SetLineColor(kMagenta);
95 fEPre->SetLineColor(
kRed);
96 fMuPre->SetLineColor(
kBlue);
97 fProtPre->SetLineColor(kBlack);
98 fPiPre->SetLineColor(kMagenta);
100 fCell = tfs->
make<TH1F>(
"cell",
";Cell reco/true", 100, 0, 2);
102 TFile*
f =
new TFile(
"pcorr_curves.root");
103 fGE = (TGraph*)f->Get(
"e");
104 fGMu = (TGraph*)f->Get(
"mu");
105 fGProt = (TGraph*)f->Get(
"p");
106 fGPi = (TGraph*)f->Get(
"pi");
110 double corr(TGraph*
g,
double thresh)
112 for(
int i = 0;
i < g->GetN(); ++
i){
114 g->GetPoint(
i, x, y);
116 if(x > thresh)
return 100/
y;
125 const double hack = 4095/2170.;
133 for(
unsigned int sliceIdx = 0; sliceIdx < slices->size(); ++sliceIdx){
137 for(
unsigned int iCell = 0; iCell < slice->
NCell(); ++iCell){
138 const double reco = slice->
RecoHit( iCell).
GeV()*hack;
139 const std::vector<sim::FLSHit> flss = bt->
HitToFLSHit(slice->
Cell(iCell));
141 for(
auto f: flss) truth +=
f.GetEdep();
143 fCell->Fill(reco/truth);
146 const double est = slice->
TotalGeV();
150 if(parts.empty())
continue;
164 const double thresh = rhit.
GeV()*1000;
168 const double dead = (.85*.859+.15*1.49)/(.85*.859);
173 fE->Fill(est*
corr(
fGE, thresh)*dead*hack);
174 fEPre->Fill(est*hack);
back track the reconstruction to the simulation
unsigned int NCell(geo::View_t view) const
Number of cells in view view.
Vertical planes which measure X.
rb::RecoHit MakeRecoHit(rb::CellHit const &cellhit, double w)
double corr(TGraph *g, double thresh)
DEFINE_ART_MODULE(TestTMapFile)
virtual void reconfigure(const fhicl::ParameterSet &pset)
art::PtrVector< rb::CellHit > AllCells() const
Get all cells from both views.
Calibrated quantities relying on position in the orthogonal view. To generate a rb::CellHit from a rb...
void SetPlane(unsigned short plane)
virtual void beginJob() override
double MeanX(rb::AveragingScheme scheme=kDefaultScheme) const
void SetCell(unsigned short cell)
void SetADC(uint32_t i, int16_t iADC)
virtual ~TestParticleCorrections()
std::vector< sim::FLSHit > HitToFLSHit(const rb::CellHit &hit) const
All the FLSHits that contributed to this hit, sorted from most to least light.
rb::RecoHit RecoHit(const art::Ptr< rb::CellHit > &chit) const
Return calibrated hit based on assumed W coordinate.
EDAnalyzer(Table< Config > const &config)
TestParticleCorrections(const fhicl::ParameterSet &pset)
void SetMC(bool isMC=true)
unsigned int MinPlane(geo::View_t view=geo::kXorY) const
virtual void analyze(const art::Event &evt) override
art::Ptr< rb::CellHit > Cell(geo::View_t view, unsigned int viewIdx) const
Get the ith cell from view view.
A rawdata::RawDigit with channel information decoded.
T * make(ARGS...args) const
bool getByLabel(std::string const &label, std::string const &productInstanceName, Handle< PROD > &result) const
unsigned int MinCell(geo::View_t view) const
double TotalGeV(EEnergyCalcScheme escheme=kRecomputeEnergy) const
Simple sum of the estimated GeV of all the hits.
Make plots of threshold effect from PCHits files.
float GetPE(rb::CellHit const &)
bool IsNoise() const
Is the noise flag set?
Encapsulate the geometry of one entire detector (near, far, ndos)
std::vector< const sim::Particle * > HitsToParticle(const std::vector< const rb::CellHit * > &hits) const
Returns vector of sim::Particle objects contributing to the given collection of hits.