7 #include "TPolyMarker.h" 17 #include "nuevdb/EventDisplayBase/View2D.h" 22 #include "canvas/Persistency/Common/FindMany.h" 62 for(
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
69 std::vector<art::Ptr<recob::Track> > tracklist;
76 art::FindMany<anab::Calorimetry> fmcal(trackListHandle, evt, callabel);
77 if (!fmcal.isValid())
continue;
82 art::FindMany<anab::ParticleID> fmpid(trackListHandle, evt, pidlabel);
83 if (!fmpid.isValid())
continue;
87 for(
size_t trkIter = 0; trkIter<tracklist.size(); ++trkIter){
88 if (anaOpt->
fTrackID >=0 and tracklist[trkIter]->ID() != anaOpt->
fTrackID)
continue;
91 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
92 std::vector<const anab::ParticleID*> pids = fmpid.at(trkIter);
93 if (!calos.size())
continue;
94 if (calos.size()!=pids.size())
continue;
99 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
100 if (calos[icalo]->
dEdx().size() > nmaxhits){
101 nmaxhits = calos[icalo]->dEdx().size();
102 bestplane = calos[icalo]->PlaneID().Plane;
106 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
108 calos[icalo]->dEdx().size())
109 bestplane = calos[icalo]->
PlaneID().Plane;
113 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
114 if (calos[icalo]->
PlaneID().Plane==bestplane){
127 for(
size_t h = 0;
h<calos[calopl]->dEdx().size();++
h){
128 double xvalue = calos[calopl]->ResidualRange().at(
h);
129 double yvalue = calos[calopl]->dEdx().at(
h);
130 pm.SetPoint(
h,xvalue,yvalue);
132 double error = yvalue*(0.04231 + 0.0001783*(yvalue*yvalue));
133 TLine&
l = view->AddLine(xvalue,yvalue-error,xvalue,yvalue+error);
143 sprintf(trackinfo,
"Track #%d: K.E. = %.1f MeV , Range = %.1f cm",
144 int(tracklist[trkIter].
key()),
145 calos[calopl]->KineticEnergy(),
146 calos[calopl]->
Range());
164 double offset = (ntracks - 1)*10.0;
165 TLatex& track_tex = view->AddLatex(13.0, (46.0) - offset,trackinfo);
166 TLatex& pida_tex = view->AddLatex(13.0, (46.0-2.5) - offset,pida);
167 TLatex& proton_tex = view->AddLatex(13.0, (46.0-5.0) - offset,proton);
169 TLatex& pion_tex = view->AddLatex(13.0, (46.0-7.5) - offset,pion);
177 track_tex.SetTextSize(0.05);
178 proton_tex.SetTextSize(0.05);
180 pion_tex.SetTextSize(0.05);
182 pida_tex.SetTextSize(0.05);
201 sprintf(proton,
"proton");
202 sprintf(kaon,
"kaon");
203 sprintf(pion,
"pion");
204 sprintf(muon,
"muon");
205 TLatex& proton_tex = view->AddLatex(2.0, 180.0,proton);
206 TLatex& kaon_tex = view->AddLatex(2.0, 165.0,kaon);
207 TLatex& pion_tex = view->AddLatex(2.0, 150.0,pion);
208 TLatex& muon_tex = view->AddLatex(2.0, 135.0,muon);
209 proton_tex.SetTextColor(kBlack);
210 kaon_tex.SetTextColor(kGray+2);
211 pion_tex.SetTextColor(kGray+1);
212 muon_tex.SetTextColor(kGray);
213 proton_tex.SetTextSize(0.075);
214 kaon_tex.SetTextSize(0.075);
215 pion_tex.SetTextSize(0.075);
216 muon_tex.SetTextSize(0.075);
219 for(
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
224 std::vector<art::Ptr<recob::Track> > tracklist;
231 art::FindMany<anab::Calorimetry> fmcal(trackListHandle, evt, callabel);
232 if (!fmcal.isValid())
continue;
238 art::FindMany<anab::ParticleID> fmpid(trackListHandle, evt, pidlabel);
239 if (!fmpid.isValid())
continue;
242 for(
size_t trkIter = 0; trkIter<tracklist.size(); ++trkIter){
243 if (anaOpt->
fTrackID >=0 and tracklist[trkIter]->ID() != anaOpt->
fTrackID)
continue;
246 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
247 if (!calos.size())
continue;
248 size_t bestplane = 0;
250 for (
size_t icalo = 0; icalo < calos.size(); ++icalo){
251 if (calos[icalo]->
dEdx().size() > nmaxhits){
252 nmaxhits = calos[icalo]->dEdx().size();
257 for (
size_t i = 0; i<geom->
Nplanes(); ++i){
263 double xvalue = calos[bestplane]->Range();
264 double yvalue = calos[bestplane]->KineticEnergy();
265 view->AddMarker(xvalue,yvalue,
evd::kColor[color],8,0.8);
267 double error = yvalue*(0.6064/std::sqrt(yvalue));
268 TLine&
l = view->AddLine(xvalue,yvalue-error,xvalue,yvalue+error);
286 for(
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
292 std::vector<art::Ptr<anab::Calorimetry> > calolist;
302 for(
size_t shwIter = 0; shwIter<calolist.size(); ++shwIter){
305 TPolyMarker&
pm = view->AddPolyMarker((*calolist.at(shwIter)).
dEdx().size(),
color,8,0.8);
306 for(
size_t h = 0;
h<(*calolist.at(shwIter)).
dEdx().size();++
h){
307 pm.SetPoint(
h,(*calolist.at(shwIter)).ResidualRange().at(
h),(*calolist.at(shwIter)).
dEdx().at(
h));
319 sprintf(mip,
"1 MIP");
320 sprintf(mip2,
"2 MIP");
324 TLine & Line1Mip = view->AddLine(0, MIP, 100, MIP);
325 TLine & Line2Mip = view->AddLine(0, 2*MIP, 100, 2*MIP);
327 TLatex& mip_tex = view->AddLatex(40.0, (23.0-20.0) - offset,mip);
328 TLatex& mip2_tex = view->AddLatex(40.0, (23.0-18.0) - offset,mip2);
330 mip_tex.SetTextColor(kGray+3);
331 mip2_tex.SetTextColor(kGray+2);
332 mip_tex.SetTextSize(0.02);
333 mip2_tex.SetTextSize(0.02);
335 Line1Mip.SetLineStyle(kDashed);
336 Line1Mip.SetLineColor(kGray+3);
337 Line2Mip.SetLineStyle(kDashed);
338 Line2Mip.SetLineColor(kGray+2);
void DrawDeDx(const art::Event &evt, evdb::View2D *view)
Class to aid in the rendering of AnalysisBase objects.
std::vector< art::InputTag > fTrackLabels
module labels that produced tracks
std::vector< std::string > fParticleIDLabels
module labels that produced particleid
art framework interface to geometry description
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
double dEdx(float dqdx, float Efield)
unsigned int Nplanes(unsigned int tpc=0, unsigned int cstat=0) const
Returns the total number of wire planes in the specified TPC.
std::vector< std::string > fCalorimetryLabels
module labels that produced calorimetry
static const int kColor[kNCOLS]
Provides recob::Track data product.
std::size_t color(std::string const &procname)
Place to keep constants for event display.
detail::Node< FrameID, bool > PlaneID
std::vector< art::InputTag > fShowerLabels
module labels that produced showers
void fill_ptr_vector(std::vector< Ptr< T >> &ptrs, H const &h)
void CalorShower(const art::Event &evt, evdb::View2D *view)
recob::tracking::Plane Plane
void DrawKineticEnergy(const art::Event &evt, evdb::View2D *view)