23 #include "TPolyMarker.h" 42 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
48 std::vector<art::Ptr<recob::Track>> tracklist;
56 if (!fmcal.isValid())
continue;
62 if (!fmpid.isValid())
continue;
66 for (
size_t trkIter = 0; trkIter < tracklist.size(); ++trkIter) {
67 if (anaOpt->
fTrackID >= 0 and tracklist[trkIter]->ID() != anaOpt->
fTrackID)
continue;
70 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
71 std::vector<const anab::ParticleID*> pids = fmpid.at(trkIter);
72 if (!calos.size())
continue;
73 if (calos.size() != pids.size())
continue;
78 for (
size_t icalo = 0; icalo < calos.size(); ++icalo) {
79 if (calos[icalo]->
dEdx().size() > nmaxhits) {
80 nmaxhits = calos[icalo]->dEdx().size();
81 bestplane = calos[icalo]->PlaneID().Plane;
85 for (
size_t icalo = 0; icalo < calos.size(); ++icalo) {
87 calos[icalo]->dEdx().size())
88 bestplane = calos[icalo]->
PlaneID().Plane;
92 for (
size_t icalo = 0; icalo < calos.size(); ++icalo) {
93 if (calos[icalo]->
PlaneID().Plane == bestplane) { calopl = icalo; }
105 for (
size_t h = 0; h < calos[calopl]->dEdx().size(); ++h) {
106 double xvalue = calos[calopl]->ResidualRange().at(h);
107 double yvalue = calos[calopl]->dEdx().at(h);
108 pm.SetPoint(h, xvalue, yvalue);
110 double error = yvalue * (0.04231 + 0.0001783 * (yvalue * yvalue));
111 TLine& l = view->
AddLine(xvalue, yvalue - error, xvalue, yvalue + error);
122 "Track #%d: K.E. = %.1f MeV , Range = %.1f cm",
123 int(tracklist[trkIter].key()),
124 calos[calopl]->KineticEnergy(),
125 calos[calopl]->Range());
143 double offset = (ntracks - 1) * 10.0;
144 TLatex& track_tex = view->
AddLatex(13.0, (46.0) - offset, trackinfo);
145 TLatex& pida_tex = view->
AddLatex(13.0, (46.0 - 2.5) - offset, pida);
146 TLatex& proton_tex = view->
AddLatex(13.0, (46.0 - 5.0) - offset, proton);
148 TLatex& pion_tex = view->
AddLatex(13.0, (46.0 - 7.5) - offset, pion);
156 track_tex.SetTextSize(0.05);
157 proton_tex.SetTextSize(0.05);
159 pion_tex.SetTextSize(0.05);
161 pida_tex.SetTextSize(0.05);
179 sprintf(proton,
"proton");
180 sprintf(kaon,
"kaon");
181 sprintf(pion,
"pion");
182 sprintf(muon,
"muon");
183 TLatex& proton_tex = view->
AddLatex(2.0, 180.0, proton);
184 TLatex& kaon_tex = view->
AddLatex(2.0, 165.0, kaon);
185 TLatex& pion_tex = view->
AddLatex(2.0, 150.0, pion);
186 TLatex& muon_tex = view->
AddLatex(2.0, 135.0, muon);
187 proton_tex.SetTextColor(kBlack);
188 kaon_tex.SetTextColor(kGray + 2);
189 pion_tex.SetTextColor(kGray + 1);
190 muon_tex.SetTextColor(kGray);
191 proton_tex.SetTextSize(0.075);
192 kaon_tex.SetTextSize(0.075);
193 pion_tex.SetTextSize(0.075);
194 muon_tex.SetTextSize(0.075);
197 for (
size_t imod = 0; imod < recoOpt->
fTrackLabels.size(); ++imod) {
202 std::vector<art::Ptr<recob::Track>> tracklist;
210 if (!fmcal.isValid())
continue;
217 if (!fmpid.isValid())
continue;
220 for (
size_t trkIter = 0; trkIter < tracklist.size(); ++trkIter) {
221 if (anaOpt->
fTrackID >= 0 and tracklist[trkIter]->ID() != anaOpt->
fTrackID)
continue;
224 std::vector<const anab::Calorimetry*> calos = fmcal.at(trkIter);
225 if (!calos.size())
continue;
226 size_t bestplane = 0;
228 for (
size_t icalo = 0; icalo < calos.size(); ++icalo) {
229 if (calos[icalo]->
dEdx().size() > nmaxhits) {
230 nmaxhits = calos[icalo]->dEdx().size();
235 for (
size_t i = 0; i < geom->
Nplanes(); ++i) {
240 double xvalue = calos[bestplane]->Range();
241 double yvalue = calos[bestplane]->KineticEnergy();
244 double error = yvalue * (0.6064 / std::sqrt(yvalue));
245 TLine& l = view->
AddLine(xvalue, yvalue - error, xvalue, yvalue + error);
260 for (
size_t imod = 0; imod < recoOpt->
fShowerLabels.size(); ++imod) {
266 std::vector<art::Ptr<anab::Calorimetry>> calolist;
275 for (
size_t shwIter = 0; shwIter < calolist.size(); ++shwIter) {
280 for (
size_t h = 0; h < (*calolist.at(shwIter)).
dEdx().size(); ++h) {
282 (*calolist.at(shwIter)).ResidualRange().at(h),
283 (*calolist.at(shwIter)).
dEdx().at(h));
292 sprintf(mip,
"1 MIP");
293 sprintf(mip2,
"2 MIP");
297 TLine& Line1Mip = view->
AddLine(0, MIP, 100, MIP);
298 TLine& Line2Mip = view->
AddLine(0, 2 * MIP, 100, 2 * MIP);
300 TLatex& mip_tex = view->
AddLatex(40.0, (23.0 - 20.0) - offset, mip);
301 TLatex& mip2_tex = view->
AddLatex(40.0, (23.0 - 18.0) - offset, mip2);
303 mip_tex.SetTextColor(kGray + 3);
304 mip2_tex.SetTextColor(kGray + 2);
305 mip_tex.SetTextSize(0.02);
306 mip2_tex.SetTextSize(0.02);
308 Line1Mip.SetLineStyle(kDashed);
309 Line1Mip.SetLineColor(kGray + 3);
310 Line2Mip.SetLineStyle(kDashed);
311 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
TLine & AddLine(double x1, double y1, double x2, double y2)
A collection of drawable 2-D objects.
IDparameter< geo::PlaneID > PlaneID
Member type of validated geo::PlaneID parameter.
decltype(auto) constexpr size(T &&obj)
ADL-aware version of std::size.
std::vector< std::string > fCalorimetryLabels
module labels that produced calorimetry
TPolyMarker & AddPolyMarker(int n, int c, int st, double sz)
Provides recob::Track data product.
TLatex & AddLatex(double x, double y, const char *text)
float dEdx(detinfo::DetectorClocksData const &clockData, detinfo::DetectorPropertiesData const &detProp, const TCSlice &slc, TP3D &tp3d)
static const int kColor[kNCOLS]
std::size_t color(std::string const &procname)
Place to keep constants for event display.
bool getByLabel(std::string const &label, std::string const &instance, Handle< PROD > &result) const
unsigned int Nplanes(TPCID const &tpcid=tpc_zero) const
Returns the total number of planes in the specified TPC.
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)
TMarker & AddMarker(double x, double y, int c, int st, double sz)
art framework interface to geometry description