LDMX Software
Public Member Functions | Public Attributes | Private Types | Private Member Functions | List of all members
dqm::PhotoNuclearDQM Class Reference

Public Member Functions

 PhotoNuclearDQM (const std::string &name, framework::Process &process)
 Constructor.
 
virtual ~PhotoNuclearDQM ()
 Destructor.
 
void configure (framework::config::Parameters &parameters) override
 Configure this analyzer using the user specified parameters.
 
void analyze (const framework::Event &event) override
 Process the event and create the histogram summaries.
 
void onProcessStart () override
 Method executed before processing of events begins.
 
constexpr bool isLightIon (const int pdgCode) const
 Check if the PDG code corresponds to a light ion.
 
- Public Member Functions inherited from framework::Analyzer
 Analyzer (const std::string &name, Process &process)
 Class constructor.
 
- Public Member Functions inherited from framework::EventProcessor
 EventProcessor (const std::string &name, Process &process)
 Class constructor.
 
virtual ~EventProcessor ()
 Class destructor.
 
virtual void onNewRun (const ldmx::RunHeader &runHeader)
 Callback for the EventProcessor to take any necessary action when the run being processed changes.
 
virtual void onFileOpen (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a new event input ROOT file is opened.
 
virtual void onFileClose (EventFile &eventFile)
 Callback for the EventProcessor to take any necessary action when a event input ROOT file is closed.
 
virtual void onProcessEnd ()
 Callback for the EventProcessor to take any necessary action when the processing of events finishes, such as calculating job-summary quantities.
 
template<class T >
const T & getCondition (const std::string &condition_name)
 Access a conditions object for the current event.
 
TDirectory * getHistoDirectory ()
 Access/create a directory in the histogram file for this event processor to create histograms and analysis tuples.
 
void setStorageHint (framework::StorageControl::Hint hint)
 Mark the current event as having the given storage control hint from this module.
 
void setStorageHint (framework::StorageControl::Hint hint, const std::string &purposeString)
 Mark the current event as having the given storage control hint from this module and the given purpose string.
 
int getLogFrequency () const
 Get the current logging frequency from the process.
 
int getRunNumber () const
 Get the run number from the process.
 
std::string getName () const
 Get the processor name.
 
void createHistograms (const std::vector< framework::config::Parameters > &histos)
 Internal function which is used to create histograms passed from the python configuration @parma histos vector of Parameters that configure histograms to create.
 

Public Attributes

bool verbose_
 
bool count_light_ions_
 

Private Types

enum class  CompactEventType {
  single_neutron = 0 , single_charged_kaon = 1 , single_neutral_kaon = 2 , two_neutrons = 3 ,
  soft = 4 , other = 5
}
 
enum class  EventType {
  nothing_hard = 0 , single_neutron = 1 , two_neutrons = 2 , three_or_more_neutrons = 3 ,
  single_charged_pion = 4 , two_charged_pions = 5 , single_neutral_pion = 6 , single_charged_pion_and_nucleon = 7 ,
  single_charged_pion_and_two_nucleons = 8 , two_charged_pions_and_nucleon = 9 , single_neutral_pion_and_nucleon = 10 , single_neutral_pion_and_two_nucleons = 11 ,
  single_neutral_pion_charged_pion_and_nucleon = 12 , single_proton = 13 , two_protons = 14 , proton_neutron = 15 ,
  klong = 16 , charged_kaon = 17 , kshort = 18 , exotics = 19 ,
  multibody = 20
}
 

Private Member Functions

EventType classifyEvent (const std::vector< const ldmx::SimParticle * > daughters, double threshold)
 Method used to classify events.
 
CompactEventType classifyCompactEvent (const ldmx::SimParticle *pnGamma, const std::vector< const ldmx::SimParticle * > daughters, double threshold)
 Method used to classify events in a compact manner.
 
void findRecoilProperties (const ldmx::SimParticle *recoil)
 Fill the recoil electron-histograms.
 
std::vector< const ldmx::SimParticle * > findDaughters (const std::map< int, ldmx::SimParticle > &particleMap, const ldmx::SimParticle *parent) const
 Find all daughter particles of a parent.
 
void findParticleKinematics (const std::vector< const ldmx::SimParticle * > &pnDaughters)
 Fill histograms related to kinematics of PN products.
 
void findSubleadingKinematics (const ldmx::SimParticle *pnGamma, const std::vector< const ldmx::SimParticle * > &pnDaughters, const EventType eventType)
 Fill histograms related to the kinematics and subleading particles for 1n, kaon, and 2n type events.
 

Additional Inherited Members

- Static Public Member Functions inherited from framework::EventProcessor
static void declare (const std::string &classname, int classtype, EventProcessorMaker *)
 Internal function which is part of the PluginFactory machinery.
 
- Static Public Attributes inherited from framework::Analyzer
static const int CLASSTYPE {2}
 Constant used to track EventProcessor types by the PluginFactory.
 
- Protected Member Functions inherited from framework::EventProcessor
void abortEvent ()
 Abort the event immediately.
 
- Protected Attributes inherited from framework::EventProcessor
HistogramHelper histograms_
 Interface class for making and filling histograms.
 
NtupleManagerntuple_ {NtupleManager::getInstance()}
 Manager for any ntuples.
 
logging::logger theLog_
 The logger for this EventProcessor.
 

Detailed Description

Definition at line 16 of file PhotoNuclearDQM.h.

Member Enumeration Documentation

◆ CompactEventType

enum class dqm::PhotoNuclearDQM::CompactEventType
strongprivate

Definition at line 18 of file PhotoNuclearDQM.h.

18 {
19 single_neutron = 0,
20 single_charged_kaon = 1,
21 single_neutral_kaon = 2,
22 two_neutrons = 3,
23 soft = 4,
24 other = 5,
25 };

◆ EventType

enum class dqm::PhotoNuclearDQM::EventType
strongprivate

Definition at line 26 of file PhotoNuclearDQM.h.

26 {
27 nothing_hard = 0,
28 single_neutron = 1,
29 two_neutrons = 2,
30 three_or_more_neutrons = 3,
31 single_charged_pion = 4,
32 two_charged_pions = 5,
33 single_neutral_pion = 6,
34 single_charged_pion_and_nucleon = 7,
35 single_charged_pion_and_two_nucleons = 8,
36 two_charged_pions_and_nucleon = 9,
37 single_neutral_pion_and_nucleon = 10,
38 single_neutral_pion_and_two_nucleons = 11,
39 single_neutral_pion_charged_pion_and_nucleon = 12,
40 single_proton = 13,
41 two_protons = 14,
42 proton_neutron = 15,
43 klong = 16,
44 charged_kaon = 17,
45 kshort = 18,
46 exotics = 19,
47 multibody = 20,
48 };

Constructor & Destructor Documentation

◆ PhotoNuclearDQM()

dqm::PhotoNuclearDQM::PhotoNuclearDQM ( const std::string &  name,
framework::Process process 
)

Constructor.

Definition at line 25 of file PhotoNuclearDQM.cxx.

27 : framework::Analyzer(name, process) {}
Base class for a module which does not produce a data product.

◆ ~PhotoNuclearDQM()

dqm::PhotoNuclearDQM::~PhotoNuclearDQM ( )
virtual

Destructor.

Definition at line 29 of file PhotoNuclearDQM.cxx.

29{}

Member Function Documentation

◆ analyze()

void dqm::PhotoNuclearDQM::analyze ( const framework::Event event)
overridevirtual

Process the event and create the histogram summaries.

Parameters
eventThe event to analyze.

Implements framework::Analyzer.

Definition at line 254 of file PhotoNuclearDQM.cxx.

254 {
255 // Get the particle map from the event. If the particle map is empty,
256 // don't process the event.
257 auto particleMap{event.getMap<int, ldmx::SimParticle>("SimParticles")};
258 if (particleMap.size() == 0) {
259 return;
260 }
261
262 // Get the recoil electron
263 auto [trackID, recoil] = Analysis::getRecoil(particleMap);
264 findRecoilProperties(recoil);
265
266 // Use the recoil electron to retrieve the gamma that underwent a
267 // photo-nuclear reaction.
268 auto pnGamma{Analysis::getPNGamma(particleMap, recoil, 2500.)};
269 if (pnGamma == nullptr) {
270 if (verbose_) {
271 std::cout << "[ PhotoNuclearDQM ]: PN Daughter is lost, skipping."
272 << std::endl;
273 }
274 return;
275 }
276 const auto pnDaughters{findDaughters(particleMap, pnGamma)};
277 findParticleKinematics(pnDaughters);
278
279 histograms_.fill("pn_particle_mult", pnGamma->getDaughters().size());
280 histograms_.fill("pn_gamma_energy", pnGamma->getEnergy());
281 histograms_.fill("pn_gamma_int_z", pnGamma->getEndPoint()[2]);
282 histograms_.fill("pn_gamma_vertex_x", pnGamma->getVertex()[0]);
283 histograms_.fill("pn_gamma_vertex_y", pnGamma->getVertex()[1]);
284 histograms_.fill("pn_gamma_vertex_z", pnGamma->getVertex()[2]);
285
286 // Classify the event
287 auto eventType{classifyEvent(pnDaughters, 200)};
288 auto eventType500MeV{classifyEvent(pnDaughters, 500)};
289 auto eventType2000MeV{classifyEvent(pnDaughters, 2000)};
290
291 auto eventTypeComp{classifyCompactEvent(pnGamma, pnDaughters, 200)};
292 auto eventTypeComp500MeV{classifyCompactEvent(pnGamma, pnDaughters, 500)};
293 auto eventTypeComp2000MeV{classifyCompactEvent(pnGamma, pnDaughters, 2000)};
294
295 histograms_.fill("event_type", static_cast<int>(eventType));
296 histograms_.fill("event_type_500mev", static_cast<int>(eventType500MeV));
297 histograms_.fill("event_type_2000mev", static_cast<int>(eventType2000MeV));
298
299 histograms_.fill("event_type_compact", static_cast<int>(eventTypeComp));
300 histograms_.fill("event_type_compact_500mev",
301 static_cast<int>(eventTypeComp500MeV));
302 histograms_.fill("event_type_compact_2000mev",
303 static_cast<int>(eventTypeComp2000MeV));
304
305 switch (eventType) {
306 case EventType::single_neutron:
307 if (pnDaughters.size() > 1) {
308 auto secondHardestPdgID{abs(pnDaughters[1]->getPdgID())};
309 auto nEventType{-10};
310 if (secondHardestPdgID == 2112) {
311 nEventType = 0; // n + n
312 } else if (secondHardestPdgID == 2212) {
313 nEventType = 1; // p + n
314 } else if (secondHardestPdgID == 211) {
315 nEventType = 2; // Pi+/- + n
316 } else if (secondHardestPdgID == 111) {
317 nEventType = 3; // Pi0 + n
318 } else {
319 nEventType = 4; // other
320 }
321 histograms_.fill("1n_event_type", nEventType);
322 }
323 [[fallthrough]]; // Remaining code is important for 1n as well
324 case EventType::two_neutrons:
325 case EventType::charged_kaon:
326 case EventType::klong:
327 case EventType::kshort:
328 findSubleadingKinematics(pnGamma, pnDaughters, eventType);
329 break;
330 default: // Nothing to do
331 break;
332 }
333}
const ldmx::SimParticle * getPNGamma(const std::map< int, ldmx::SimParticle > &particleMap, const ldmx::SimParticle *recoil, const float &energyThreshold)
Get a pointer to the sim particle associated with the photon that underwent a photo-nuclear reaction.
std::tuple< int, const ldmx::SimParticle * > getRecoil(const std::map< int, ldmx::SimParticle > &particleMap)
Find and return the sim particle associated with the recoil electron.
void findSubleadingKinematics(const ldmx::SimParticle *pnGamma, const std::vector< const ldmx::SimParticle * > &pnDaughters, const EventType eventType)
Fill histograms related to the kinematics and subleading particles for 1n, kaon, and 2n type events.
std::vector< const ldmx::SimParticle * > findDaughters(const std::map< int, ldmx::SimParticle > &particleMap, const ldmx::SimParticle *parent) const
Find all daughter particles of a parent.
EventType classifyEvent(const std::vector< const ldmx::SimParticle * > daughters, double threshold)
Method used to classify events.
CompactEventType classifyCompactEvent(const ldmx::SimParticle *pnGamma, const std::vector< const ldmx::SimParticle * > daughters, double threshold)
Method used to classify events in a compact manner.
void findRecoilProperties(const ldmx::SimParticle *recoil)
Fill the recoil electron-histograms.
void findParticleKinematics(const std::vector< const ldmx::SimParticle * > &pnDaughters)
Fill histograms related to kinematics of PN products.
HistogramHelper histograms_
Interface class for making and filling histograms.
void fill(const std::string &name, const double &val)
Fill a 1D histogram.
Definition Histograms.h:166
Class representing a simulated particle.
Definition SimParticle.h:23

References classifyCompactEvent(), classifyEvent(), framework::HistogramHelper::fill(), findDaughters(), findParticleKinematics(), findRecoilProperties(), findSubleadingKinematics(), and framework::EventProcessor::histograms_.

◆ classifyCompactEvent()

PhotoNuclearDQM::CompactEventType dqm::PhotoNuclearDQM::classifyCompactEvent ( const ldmx::SimParticle pnGamma,
const std::vector< const ldmx::SimParticle * >  daughters,
double  threshold 
)
private

Method used to classify events in a compact manner.

Definition at line 441 of file PhotoNuclearDQM.cxx.

443 {
444 short n{0}, n_t{0}, k0l{0}, kp{0}, k0s{0}, soft{0};
445
446 // Loop through all of the PN daughters and extract kinematic
447 // information.
448 for (const auto &daughter : daughters) {
449 // Calculate the kinetic energy
450 auto ke{daughter->getEnergy() - daughter->getMass()};
451
452 // Get the PDG ID
453 auto pdgID{abs(daughter->getPdgID())};
454
455 if (ke < 500) {
456 soft++;
457 continue;
458 }
459
460 if (ke >= 0.8 * pnGamma->getEnergy()) {
461 if (pdgID == 2112) {
462 n++;
463 } else if (pdgID == 130) {
464 k0l++;
465 } else if (pdgID == 321) {
466 kp++;
467 } else if (pdgID == 310) {
468 k0s++;
469 }
470 continue;
471 }
472
473 if ((pdgID == 2112) && ke > threshold) {
474 n_t++;
475 }
476 }
477
478 int neutral_kaons{k0l + k0s};
479
480 if (n != 0) {
481 return PhotoNuclearDQM::CompactEventType::single_neutron;
482 }
483 if (kp != 0) {
484 return PhotoNuclearDQM::CompactEventType::single_charged_kaon;
485 }
486 if (neutral_kaons != 0) {
487 return PhotoNuclearDQM::CompactEventType::single_neutral_kaon;
488 }
489 if (n_t == 2) {
490 return PhotoNuclearDQM::CompactEventType::two_neutrons;
491 }
492 if (soft == daughters.size()) {
493 return PhotoNuclearDQM::CompactEventType::soft;
494 }
495
496 return PhotoNuclearDQM::CompactEventType::other;
497}
double getEnergy() const
Get the energy of this particle [MeV].
Definition SimParticle.h:72

References ldmx::SimParticle::getEnergy().

Referenced by analyze().

◆ classifyEvent()

PhotoNuclearDQM::EventType dqm::PhotoNuclearDQM::classifyEvent ( const std::vector< const ldmx::SimParticle * >  daughters,
double  threshold 
)
private

Method used to classify events.

Note: Assumes that daughters is sorted by kinetic energy.

Definition at line 335 of file PhotoNuclearDQM.cxx.

336 {
337 short n{0}, p{0}, pi{0}, pi0{0}, exotic{0}, k0l{0}, kp{0}, k0s{0};
338
339 // Loop through all of the PN daughters and extract kinematic
340 // information.
341 for (const auto &daughter : daughters) {
342 // Calculate the kinetic energy
343 auto ke{daughter->getEnergy() - daughter->getMass()};
344
345 // Assuming the daughters are sorted by kinetic energy, if the kinetic
346 // energy is below threshold, we don't need to look at any further
347 // particles.
348 if (ke <= threshold) {
349 break;
350 }
351
352 // Get the PDG ID
353 auto pdgID{abs(daughter->getPdgID())};
354
355 if (pdgID == 2112) {
356 n++;
357 } else if (pdgID == 2212) {
358 p++;
359 } else if (pdgID == 211) {
360 pi++;
361 } else if (pdgID == 111) {
362 pi0++;
363 } else if (pdgID == 130) {
364 k0l++;
365 } else if (pdgID == 321) {
366 kp++;
367 } else if (pdgID == 310) {
368 k0s++;
369 } else {
370 exotic++;
371 }
372 }
373
374 int kaons = k0l + kp + k0s;
375 int nucleons = n + p;
376 int pions = pi + pi0;
377 int count = nucleons + pions + exotic + kaons;
378
379 if (count == 0) {
380 return EventType::nothing_hard;
381 }
382 if (count == 1) {
383 if (n == 1) {
384 return EventType::single_neutron;
385 } else if (p == 1) {
386 return EventType::single_proton;
387 } else if (pi0 == 1) {
388 return EventType::single_neutral_pion;
389 } else if (pi == 1) {
390 return EventType::single_charged_pion;
391 }
392 }
393 if (count == 2) {
394 if (n == 2) {
395 return EventType::two_neutrons;
396 } else if (n == 1 && p == 1) {
397 return EventType::proton_neutron;
398 } else if (p == 2) {
399 return EventType::two_protons;
400 } else if (pi == 2) {
401 return EventType::two_charged_pions;
402 } else if (pi == 1 && nucleons == 1) {
403 return EventType::single_charged_pion_and_nucleon;
404 } else if (pi0 == 1 && nucleons == 1) {
405 return EventType::single_neutral_pion_and_nucleon;
406 }
407 }
408
409 if (count == 3) {
410 if (pi == 1 && nucleons == 2) {
411 return EventType::single_charged_pion_and_two_nucleons;
412 } else if (pi == 2 && nucleons == 1) {
413 return EventType::two_charged_pions_and_nucleon;
414 } // else
415 else if (pi0 == 1 && nucleons == 2) {
416 return EventType::single_neutral_pion_and_two_nucleons;
417 } else if (pi0 == 1 && nucleons == 1 && pi == 1) {
418 return EventType::single_neutral_pion_charged_pion_and_nucleon;
419 }
420 }
421 if (count >= 3 && count == n) {
422 return EventType::three_or_more_neutrons;
423 }
424
425 if (kaons == 1) {
426 if (k0l == 1) {
427 return EventType::klong;
428 } else if (kp == 1) {
429 return EventType::charged_kaon;
430 } else if (k0s == 1) {
431 return EventType::kshort;
432 }
433 }
434 if (exotic == count && count != 0) {
435 return EventType::exotics;
436 }
437
438 return EventType::multibody;
439}

Referenced by analyze().

◆ configure()

void dqm::PhotoNuclearDQM::configure ( framework::config::Parameters parameters)
overridevirtual

Configure this analyzer using the user specified parameters.

Parameters
parametersSet of parameters used to configure this analyzer.

Reimplemented from framework::EventProcessor.

Definition at line 249 of file PhotoNuclearDQM.cxx.

249 {
250 verbose_ = parameters.getParameter<bool>("verbose");
251 count_light_ions_ = parameters.getParameter<bool>("count_light_ions", true);
252}
T getParameter(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:89

References framework::config::Parameters::getParameter().

◆ findDaughters()

std::vector< const ldmx::SimParticle * > dqm::PhotoNuclearDQM::findDaughters ( const std::map< int, ldmx::SimParticle > &  particleMap,
const ldmx::SimParticle parent 
) const
private

Find all daughter particles of a parent.

Particles are included if they>

  • Are in the particle map,
  • Are not photons or nuclear fragment, and
  • Are not a light ion (Z < 4) if the count_light_ions_ parameter is set to false

The products are sorted by kinetic energy, in descending order.

Definition at line 30 of file PhotoNuclearDQM.cxx.

32 {
33 std::vector<const ldmx::SimParticle *> pnDaughters;
34 for (const auto &daughterTrackID : parent->getDaughters()) {
35 // skip daughters that weren't saved
36 if (particleMap.count(daughterTrackID) == 0) {
37 continue;
38 }
39
40 auto daughter{&(particleMap.at(daughterTrackID))};
41
42 // Get the PDG ID
43 auto pdgID{daughter->getPdgID()};
44
45 // Ignore photons and nuclei
46 if (pdgID == 22 ||
47 (pdgID > 10000 && (!count_light_ions_ || !isLightIon(pdgID)))) {
48 continue;
49 }
50 pnDaughters.push_back(daughter);
51 }
52
53 std::sort(pnDaughters.begin(), pnDaughters.end(),
54 [](const auto &lhs, const auto &rhs) {
55 double lhs_ke = lhs->getEnergy() - lhs->getMass();
56 double rhs_ke = rhs->getEnergy() - rhs->getMass();
57 return lhs_ke > rhs_ke;
58 });
59
60 return pnDaughters;
61}
constexpr bool isLightIon(const int pdgCode) const
Check if the PDG code corresponds to a light ion.

References ldmx::SimParticle::getDaughters(), and isLightIon().

Referenced by analyze().

◆ findParticleKinematics()

void dqm::PhotoNuclearDQM::findParticleKinematics ( const std::vector< const ldmx::SimParticle * > &  pnDaughters)
private

Fill histograms related to kinematics of PN products.

Definition at line 69 of file PhotoNuclearDQM.cxx.

70 {
71 double hardest_ke{-1}, hardest_theta{-1};
72 double hardest_proton_ke{-1}, hardest_proton_theta{-1};
73 double hardest_neutron_ke{-1}, hardest_neutron_theta{-1};
74 double hardest_pion_ke{-1}, hardest_pion_theta{-1};
75 double total_ke{0};
76 double total_neutron_ke{0};
77 int neutron_multiplicity{0};
78 // Loop through all of the PN daughters and extract kinematic
79 // information.
80 for (const auto *daughter : pnDaughters) {
81 // skip daughters that weren't saved
82
83 // Get the PDG ID
84 auto pdgID{daughter->getPdgID()};
85
86 // Calculate the kinetic energy
87 double ke{daughter->getEnergy() - daughter->getMass()};
88 total_ke += ke;
89
90 std::vector<double> vec{daughter->getMomentum()};
91 TVector3 pvec(vec[0], vec[1], vec[2]);
92
93 // Calculate the polar angle
94 auto theta{pvec.Theta() * (180 / 3.14159)};
95
96 if (hardest_ke < ke) {
97 hardest_ke = ke;
98 hardest_theta = theta;
99 }
100
101 if (pdgID == 2112) {
102 total_neutron_ke += ke;
103 neutron_multiplicity++;
104 if (hardest_neutron_ke < ke) {
105 hardest_neutron_ke = ke;
106 hardest_neutron_theta = theta;
107 }
108 }
109
110 if ((pdgID == 2212) && (hardest_proton_ke < ke)) {
111 hardest_proton_ke = ke;
112 hardest_proton_theta = theta;
113 }
114
115 if (((std::abs(pdgID) == 211) || (pdgID == 111)) &&
116 (hardest_pion_ke < ke)) {
117 hardest_pion_ke = ke;
118 hardest_pion_theta = theta;
119 }
120 }
121 histograms_.fill("hardest_ke", hardest_ke);
122 histograms_.fill("hardest_theta", hardest_theta);
123 histograms_.fill("h_ke_h_theta", hardest_ke, hardest_theta);
124 histograms_.fill("hardest_p_ke", hardest_proton_ke);
125 histograms_.fill("hardest_p_theta", hardest_proton_theta);
126 histograms_.fill("hardest_n_ke", hardest_neutron_ke);
127 histograms_.fill("hardest_n_theta", hardest_neutron_theta);
128 histograms_.fill("hardest_pi_ke", hardest_pion_ke);
129 histograms_.fill("hardest_pi_theta", hardest_pion_theta);
130
131 histograms_.fill("pn_neutron_mult", neutron_multiplicity);
132 histograms_.fill("pn_total_ke", total_ke);
133 histograms_.fill("pn_total_neutron_ke", total_neutron_ke);
134}

References framework::HistogramHelper::fill(), and framework::EventProcessor::histograms_.

Referenced by analyze().

◆ findRecoilProperties()

void dqm::PhotoNuclearDQM::findRecoilProperties ( const ldmx::SimParticle recoil)
private

Fill the recoil electron-histograms.

Definition at line 62 of file PhotoNuclearDQM.cxx.

62 {
63 histograms_.fill("recoil_vertex_x", recoil->getVertex()[0]);
64 histograms_.fill("recoil_vertex_y", recoil->getVertex()[1]);
65 histograms_.fill("recoil_vertex_z", recoil->getVertex()[2]);
66 histograms_.fill("recoil_vertex_x:recoil_vertex_y", recoil->getVertex()[0],
67 recoil->getVertex()[1]);
68}
std::vector< double > getVertex() const
Get a vector containing the vertex of this particle in mm.

References framework::HistogramHelper::fill(), ldmx::SimParticle::getVertex(), and framework::EventProcessor::histograms_.

Referenced by analyze().

◆ findSubleadingKinematics()

void dqm::PhotoNuclearDQM::findSubleadingKinematics ( const ldmx::SimParticle pnGamma,
const std::vector< const ldmx::SimParticle * > &  pnDaughters,
const EventType  eventType 
)
private

Fill histograms related to the kinematics and subleading particles for 1n, kaon, and 2n type events.

Note: This assumes that the daughter particles are sorted by energy.

Definition at line 136 of file PhotoNuclearDQM.cxx.

139 {
140 // Note: Assumes sorted by energy
141
142 double subleading_ke{-9999};
143 double nEnergy{-9999}, energyDiff{-9999}, energyFrac{-9999};
144
145 nEnergy = pnDaughters[0]->getEnergy() - pnDaughters[0]->getMass();
146 subleading_ke = -9999;
147 if (pnDaughters.size() > 1) {
148 subleading_ke = pnDaughters[1]->getEnergy() - pnDaughters[1]->getMass();
149 }
150 energyDiff = pnGamma->getEnergy() - nEnergy;
151 energyFrac = nEnergy / pnGamma->getEnergy();
152
153 if (eventType == EventType::single_neutron) {
154 histograms_.fill("1n_ke:2nd_h_ke", nEnergy, subleading_ke);
155 histograms_.fill("1n_neutron_energy", nEnergy);
156 histograms_.fill("1n_energy_diff", energyDiff);
157 histograms_.fill("1n_energy_frac", energyFrac);
158 } else if (eventType == EventType::two_neutrons) {
159 histograms_.fill("2n_n2_energy", subleading_ke);
160 auto energyFrac2n = (nEnergy + subleading_ke) / pnGamma->getEnergy();
161 histograms_.fill("2n_energy_frac", energyFrac2n);
162 histograms_.fill("2n_energy_other", pnGamma->getEnergy() - energyFrac2n);
163
164 } else if (eventType == EventType::charged_kaon) {
165 histograms_.fill("1kp_ke:2nd_h_ke", nEnergy, subleading_ke);
166 histograms_.fill("1kp_energy", nEnergy);
167 histograms_.fill("1kp_energy_diff", energyDiff);
168 histograms_.fill("1kp_energy_frac", energyFrac);
169 } else if (eventType == EventType::klong || eventType == EventType::kshort) {
170 histograms_.fill("1k0_ke:2nd_h_ke", nEnergy, subleading_ke);
171 histograms_.fill("1k0_energy", nEnergy);
172 histograms_.fill("1k0_energy_diff", energyDiff);
173 histograms_.fill("1k0_energy_frac", energyFrac);
174 }
175}

References framework::HistogramHelper::fill(), ldmx::SimParticle::getEnergy(), and framework::EventProcessor::histograms_.

Referenced by analyze().

◆ isLightIon()

constexpr bool dqm::PhotoNuclearDQM::isLightIon ( const int  pdgCode) const
inlineconstexpr

Check if the PDG code corresponds to a light ion.

Nuclear PDG codes are given by ±10LZZZAAAI So to find the atomic number, we first divide by 10 (to lose the I-component) and then take the modulo with 1000.

TODO: Repeated code from SimCore, could probably live elsewhere.

Definition at line 137 of file PhotoNuclearDQM.h.

137 {
138 if (pdgCode > 1000000000) {
139 // Check if the atomic number is less than or equal to 4
140 return ((pdgCode / 10) % 1000) <= 4;
141 }
142 return false;
143 }

Referenced by findDaughters().

◆ onProcessStart()

void dqm::PhotoNuclearDQM::onProcessStart ( )
overridevirtual

Method executed before processing of events begins.

Reimplemented from framework::EventProcessor.

Definition at line 176 of file PhotoNuclearDQM.cxx.

176 {
177 std::vector<std::string> labels = {"",
178 "Nothing hard", // 0
179 "1 n", // 1
180 "2 n", // 2
181 "#geq 3 n", // 3
182 "1 #pi", // 4
183 "2 #pi", // 5
184 "1 #pi_{0}", // 6
185 "1 #pi A", // 7
186 "1 #pi 2 A", // 8
187 "2 #pi A", // 9
188 "1 #pi_{0} A", // 10
189 "1 #pi_{0} 2 A", // 11
190 "#pi_{0} #pi A", // 12
191 "1 p", // 13
192 "2 p", // 14
193 "pn", // 15
194 "K^{0}_{L} X", // 16
195 "K X", // 17
196 "K^{0}_{S} X", // 18
197 "exotics", // 19
198 "multi-body", // 20
199 ""};
200
201 std::vector<TH1 *> hists = {
202 histograms_.get("event_type"),
203 histograms_.get("event_type_500mev"),
204 histograms_.get("event_type_2000mev"),
205
206 };
207
208 for (int ilabel{1}; ilabel < labels.size(); ++ilabel) {
209 for (auto &hist : hists) {
210 hist->GetXaxis()->SetBinLabel(ilabel, labels[ilabel - 1].c_str());
211 }
212 }
213
214 labels = {"",
215 "1 n", // 0
216 "K#pm X", // 1
217 "1 K^{0}", // 2
218 "2 n", // 3
219 "Soft", // 4
220 "Other", // 5
221 ""};
222
223 hists = {
224 histograms_.get("event_type_compact"),
225 histograms_.get("event_type_compact_500mev"),
226 histograms_.get("event_type_compact_2000mev"),
227 };
228
229 for (int ilabel{1}; ilabel < labels.size(); ++ilabel) {
230 for (auto &hist : hists) {
231 hist->GetXaxis()->SetBinLabel(ilabel, labels[ilabel - 1].c_str());
232 }
233 }
234
235 std::vector<std::string> n_labels = {"",
236 "nn", // 0
237 "pn", // 1
238 "#pi^{+}n", // 2
239 "#pi^{0}n", // 3
240 "other", // 4
241 ""};
242
243 TH1 *hist = histograms_.get("1n_event_type");
244 for (int ilabel{1}; ilabel < n_labels.size(); ++ilabel) {
245 hist->GetXaxis()->SetBinLabel(ilabel, n_labels[ilabel - 1].c_str());
246 }
247}
TH1 * get(const std::string &name)
Get a pointer to a histogram by name.
Definition Histograms.h:194

References framework::HistogramHelper::get(), and framework::EventProcessor::histograms_.

Member Data Documentation

◆ count_light_ions_

bool dqm::PhotoNuclearDQM::count_light_ions_

Definition at line 146 of file PhotoNuclearDQM.h.

◆ verbose_

bool dqm::PhotoNuclearDQM::verbose_

Definition at line 145 of file PhotoNuclearDQM.h.


The documentation for this class was generated from the following files: