13 #include "nuevdb/EventDisplayBase/View2D.h"
15 #include "art/Framework/Principal/Event.h"
16 #include "art/Framework/Principal/Handle.h"
17 #include "art/Framework/Services/Registry/ServiceHandle.h"
18 #include "canvas/Persistency/Common/FindMany.h"
19 #include "canvas/Persistency/Common/Ptr.h"
23 #include "TPolyMarker.h"
45 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
46 art::ServiceHandle<evd::AnalysisDrawingOptions const> anaOpt;
47 art::ServiceHandle<geo::Geometry const> geom;
49 for(
size_t imod = 0; imod < recoOpt->fTrackLabels.size(); ++imod) {
53 art::InputTag which = recoOpt->fTrackLabels[imod];
54 art::Handle<std::vector<recob::Track> > trackListHandle;
55 evt.getByLabel(which,trackListHandle);
56 std::vector<art::Ptr<recob::Track> > tracklist;
57 art::fill_ptr_vector(tracklist, trackListHandle);
60 for(
size_t cmod = 0; cmod < anaOpt->fCalorimetryLabels.size(); ++cmod) {
61 std::string
const callabel = anaOpt->fCalorimetryLabels[cmod];
63 art::FindMany<anab::Calorimetry> fmcal(trackListHandle, evt, callabel);
64 if (!fmcal.isValid())
continue;
66 for(
size_t pmod = 0; pmod < anaOpt->fParticleIDLabels.size(); ++pmod) {
67 std::string
const pidlabel = anaOpt->fParticleIDLabels[pmod];
69 art::FindMany<anab::ParticleID> fmpid(trackListHandle, evt, pidlabel);
70 if (!fmpid.isValid())
continue;
74 for(
size_t trkIter = 0; trkIter<tracklist.size(); ++trkIter){
75 if (anaOpt->fTrackID >=0
and tracklist[trkIter]->ID() != anaOpt->fTrackID)
continue;
78 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
79 std::vector<const anab::ParticleID*> pids = fmpid.at(trkIter);
80 if (!calos.size())
continue;
81 if (calos.size()!=pids.size())
continue;
86 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
87 if (calos[icalo]->
dEdx().size() > nmaxhits){
88 nmaxhits = calos[icalo]->dEdx().size();
89 bestplane = calos[icalo]->PlaneID().Plane;
92 if (anaOpt->fCaloPlane>=0
and anaOpt->fCaloPlane<
int(geom->Nplanes())){
93 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
94 if (
int(calos[icalo]->
PlaneID().
Plane)==anaOpt->fCaloPlane&&
95 calos[icalo]->dEdx().size())
96 bestplane = calos[icalo]->
PlaneID().Plane;
100 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
101 if (calos[icalo]->
PlaneID().Plane==bestplane){
113 TPolyMarker& pm = view->AddPolyMarker(calos[calopl]->
dEdx().
size(),
evd::kColor[color],8,0.8);
114 for(
size_t h = 0;
h<calos[calopl]->dEdx().size();++
h){
115 double xvalue = calos[calopl]->ResidualRange().at(
h);
116 double yvalue = calos[calopl]->dEdx().at(
h);
117 pm.SetPoint(
h,xvalue,yvalue);
119 double error = yvalue*(0.04231 + 0.0001783*(yvalue*yvalue));
120 TLine& l = view->AddLine(xvalue,yvalue-error,xvalue,yvalue+error);
130 sprintf(trackinfo,
"Track #%d: K.E. = %.1f MeV , Range = %.1f cm",
131 int(tracklist[trkIter].key()),
132 calos[calopl]->KineticEnergy(),
133 calos[calopl]->Range());
151 double offset = (ntracks - 1)*10.0;
152 TLatex& track_tex = view->AddLatex(13.0, (46.0) - offset,trackinfo);
153 TLatex& pida_tex = view->AddLatex(13.0, (46.0-2.5) - offset,pida);
154 TLatex& proton_tex = view->AddLatex(13.0, (46.0-5.0) - offset,proton);
156 TLatex& pion_tex = view->AddLatex(13.0, (46.0-7.5) - offset,pion);
164 track_tex.SetTextSize(0.05);
165 proton_tex.SetTextSize(0.05);
167 pion_tex.SetTextSize(0.05);
169 pida_tex.SetTextSize(0.05);
180 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
181 art::ServiceHandle<evd::AnalysisDrawingOptions const> anaOpt;
182 art::ServiceHandle<geo::Geometry const> geom;
188 sprintf(proton,
"proton");
189 sprintf(kaon,
"kaon");
190 sprintf(pion,
"pion");
191 sprintf(muon,
"muon");
192 TLatex& proton_tex = view->AddLatex(2.0, 180.0,proton);
193 TLatex& kaon_tex = view->AddLatex(2.0, 165.0,kaon);
194 TLatex& pion_tex = view->AddLatex(2.0, 150.0,pion);
195 TLatex& muon_tex = view->AddLatex(2.0, 135.0,muon);
196 proton_tex.SetTextColor(kBlack);
197 kaon_tex.SetTextColor(kGray+2);
198 pion_tex.SetTextColor(kGray+1);
199 muon_tex.SetTextColor(kGray);
200 proton_tex.SetTextSize(0.075);
201 kaon_tex.SetTextSize(0.075);
202 pion_tex.SetTextSize(0.075);
203 muon_tex.SetTextSize(0.075);
206 for(
size_t imod = 0; imod < recoOpt->fTrackLabels.size(); ++imod) {
208 art::InputTag which = recoOpt->fTrackLabels[imod];
209 art::Handle<std::vector<recob::Track> > trackListHandle;
210 evt.getByLabel(which,trackListHandle);
211 std::vector<art::Ptr<recob::Track> > tracklist;
212 art::fill_ptr_vector(tracklist, trackListHandle);
215 for(
size_t cmod = 0; cmod < anaOpt->fCalorimetryLabels.size(); ++cmod) {
216 std::string
const callabel = anaOpt->fCalorimetryLabels[cmod];
218 art::FindMany<anab::Calorimetry> fmcal(trackListHandle, evt, callabel);
219 if (!fmcal.isValid())
continue;
222 for(
size_t pmod = 0; pmod < anaOpt->fParticleIDLabels.size(); ++pmod) {
223 std::string
const pidlabel = anaOpt->fParticleIDLabels[pmod];
225 art::FindMany<anab::ParticleID> fmpid(trackListHandle, evt, pidlabel);
226 if (!fmpid.isValid())
continue;
229 for(
size_t trkIter = 0; trkIter<tracklist.size(); ++trkIter){
230 if (anaOpt->fTrackID >=0
and tracklist[trkIter]->ID() != anaOpt->fTrackID)
continue;
233 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
234 if (!calos.size())
continue;
235 size_t bestplane = 0;
237 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
238 if (calos[icalo]->
dEdx().size() > nmaxhits){
239 nmaxhits = calos[icalo]->dEdx().size();
243 if (anaOpt->fCaloPlane>=0
and anaOpt->fCaloPlane<
int(geom->Nplanes())){
244 for (
size_t i = 0; i<geom->Nplanes(); ++i){
250 double xvalue = calos[bestplane]->Range();
251 double yvalue = calos[bestplane]->KineticEnergy();
252 view->AddMarker(xvalue,yvalue,
evd::kColor[color],8,0.8);
254 double error = yvalue*(0.6064/std::sqrt(yvalue));
255 TLine& l = view->AddLine(xvalue,yvalue-error,xvalue,yvalue+error);
270 art::ServiceHandle<evd::RecoDrawingOptions const> recoOpt;
271 art::ServiceHandle<evd::AnalysisDrawingOptions const> anaOpt;
273 for(
size_t imod = 0; imod < recoOpt->fShowerLabels.size(); ++imod) {
276 art::InputTag which = recoOpt->fShowerLabels[imod];
277 art::Handle<std::vector<anab::Calorimetry> > caloListHandle;
278 evt.getByLabel(which,caloListHandle);
279 std::vector<art::Ptr<anab::Calorimetry> > calolist;
280 art::fill_ptr_vector(calolist, caloListHandle);
284 for(
size_t pmod = 0; pmod < anaOpt->fParticleIDLabels.size(); ++pmod) {
285 std::string
const pidlabel = anaOpt->fParticleIDLabels[pmod];
289 for(
size_t shwIter = 0; shwIter<calolist.size(); ++shwIter){
292 TPolyMarker& pm = view->AddPolyMarker((*calolist.at(shwIter)).
dEdx().size(),color,8,0.8);
293 for(
size_t h = 0;
h<(*calolist.at(shwIter)).
dEdx().size();++
h){
294 pm.SetPoint(
h,(*calolist.at(shwIter)).ResidualRange().at(
h),(*calolist.at(shwIter)).
dEdx().at(
h));
306 sprintf(mip,
"1 MIP");
307 sprintf(mip2,
"2 MIP");
311 TLine & Line1Mip = view->AddLine(0, MIP, 100, MIP);
312 TLine & Line2Mip = view->AddLine(0, 2*MIP, 100, 2*MIP);
314 TLatex& mip_tex = view->AddLatex(40.0, (23.0-20.0) - offset,mip);
315 TLatex& mip2_tex = view->AddLatex(40.0, (23.0-18.0) - offset,mip2);
317 mip_tex.SetTextColor(kGray+3);
318 mip2_tex.SetTextColor(kGray+2);
319 mip_tex.SetTextSize(0.02);
320 mip2_tex.SetTextSize(0.02);
322 Line1Mip.SetLineStyle(kDashed);
323 Line1Mip.SetLineColor(kGray+3);
324 Line2Mip.SetLineStyle(kDashed);
325 Line2Mip.SetLineColor(kGray+2);
void DrawDeDx(const art::Event &evt, evdb::View2D *view)
Class to aid in the rendering of AnalysisBase objects.
BEGIN_PROLOG TPC Trig offset(g4 rise time) ProjectToHeight
BEGIN_PROLOG true icarus_rawdigitfilter FilterTools FilterPlane1 Plane
std::size_t size(FixedBins< T, C > const &) noexcept
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
return match has_match and(match.match_pdg==11 or match.match_pdg==-11)
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
static const int kColor[kNCOLS]
Provides recob::Track data product.
Place to keep constants for event display.
process_name can override from command line with o or output muon
void CalorShower(const art::Event &evt, evdb::View2D *view)
void DrawKineticEnergy(const art::Event &evt, evdb::View2D *view)
art framework interface to geometry description