1 #include "KVFilterGroupReconstructor.h"
2 #include "KVIDZAGrid.h"
3 #include "KVMultiDetArray.h"
4 #include "KVNucleusEvent.h"
6 std::unordered_map<std::string,bool> KVFilterGroupReconstructor::audit_id_extensions;
22 TString stop =
n.GetParameters()->GetTStringValue(
"STOPPING DETECTOR");
28 auto traj_string =
n.GetParameters()->GetTStringValue(
"TRAJECTORY");
30 if ((Rtraj->GetPathString() == traj_string) || (traj_in_grp && Rtraj->ContainsTrajectory(traj_in_grp))) {
33 part_correspond[current_nuc_recon].Add(&n);
42 if (!fSimEvent->GetMult()) {
43 Info(
"get_recon_traj_for_particle",
"%p : sim event is empty",
this);
65 if ((multihit = part_correspond[&nuc].GetEntries()) > 1) {
67 TIter next(&part_correspond[&nuc]);
74 q.Merge(*
N->GetParameters());
77 auto sim_part = (
KVNucleus*)part_correspond[&nuc].First();
79 part_correspond[&nuc].Clear();
80 sum_part.
Copy(*sim_part);
81 part_correspond[&nuc].Add(sim_part);
86 for (
auto& param : *sim_part->GetParameters()) {
88 if (param.IsString()) {
91 auto next = sparam.Next();
95 if (next != unique_value) {
96 KVError::Warning(
this,
"identify_particle",
"different values of %s for %d-particle pileup in %s:%s, %s, ...",
100 param.Set(unique_value);
105 auto sim_part = (
KVNucleus*)part_correspond[&nuc].First();
112 KVError::Warning(
this,
"identify_particle",
"sim_part=nullptr; multihit=%d", multihit);
117 KVError::Error(
this,
"identify_particle",
"no sim_part for recon_nuc!");
122 check_identification_threshold(sim_part, idt, IDR);
136 if (sim_part->GetParameters()->IsValue(
"DETECTED",
"PUNCH THROUGH"))
140 if(sim_part->GetParameters()->GetDoubleValue(
"RESIDUAL ENERGY")>0.02*sim_part->GetE())
145 IDR->
SetComment(
"punch through particle, identification not possible/good");
181 && can_extend_identification_beyond_audit(idt->
GetLabel())))
183 std::stringstream comments;
187 IDR->
Z = nuc->
GetZ();
218 "%s : %s Z=%d A=%d E=%f", comments.str().c_str(),
229 IDR->
Z = nuc->
GetZ();
230 IDR->
A = nuc->
GetA();
242 IDR->
SetComment(
"below threshold for identification");
255 void KVFilterGroupReconstructor::PerformSecondaryAnalysis()
259 int num_ident_0, num_ident;
260 int num_unident_0, num_unident;
267 if (num_unident > num_unident_0) {
270 if (num_ident > num_ident_0)
Calibrate();
273 while (num_ident > num_ident_0);
284 current_nuc_recon = part;
287 KVGroupReconstructor::ReconstructParticle(part, traj, node);
288 }
catch (
const std::exception&
e) {
289 KVError::Error(
this,
"ReconstructParticle",
"Caught exception: %s",
e.what());
298 energy_loss[Nd->GetName()] = Nd->GetDetector()->GetEnergyLoss();
299 ++number_uncalibrated[Nd->GetName()];
309 KVGroupReconstructor::IdentifyParticle(PART);
315 --number_unidentified[node->
GetName()];
332 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNormalCalibrationCode());
341 if (number_uncalibrated[det->GetName()] > 1 || (det != PART->
GetStoppingDetector() && number_unidentified[det->GetName()] > 0)) {
351 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNoCalibrationCode());
355 det->SetEResAfterDetector(Einc);
356 edet = det->GetCorrectedEnergy(PART, dE);
360 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetCalculatedCalibrationCode());
365 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNoCalibrationCode());
370 else if (det->GetNHits() > 1) {
374 dE = energy_loss[det->GetName()];
375 det->SetEResAfterDetector(Einc);
376 edet = det->GetCorrectedEnergy(PART, dE);
379 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetCalculatedCalibrationCode());
382 dE = det->GetEnergyLoss();
383 det->SetEResAfterDetector(Einc);
384 edet = det->GetCorrectedEnergy(PART, -1., (Einc > 0));
389 --number_uncalibrated[det->GetName()];
390 energy_loss[det->GetName()] -= dE;
391 det->SetEnergyLoss(energy_loss[det->GetName()]);
403 E_targ = GetTargetEnergyLossCorrection(PART);
char * Form(const char *fmt,...)
Class for iterating over nuclei in events accessed through base pointer/reference.
virtual const Char_t * GetType() const
const Char_t * GetLabel() const
Bool_t IsType(const Char_t *typ, bool case_insensitive=false) const
@ partial_isotopic_identification
@ A_never_measured_but_between_Amin_and_Amax
@ identification_not_possible_for_this_Z
@ A_less_than_measured_Amin
@ full_isotopic_identification
@ A_greater_than_measured_Amax
IDStatus CanIdentify(const TString &tel_name, int Z, int &A, double E) const
Double_t GetDeltaEFromERes(Int_t Z, Int_t A, Double_t Eres) override
Reconstruct particles in group of detectors after filtering simulated events.
void IdentifyParticle(KVReconstructedNucleus &PART) override
void ReconstructParticle(KVReconstructedNucleus *part, const KVGeoDNTrajectory *traj, const KVGeoDetectorNode *node) override
void CalibrateParticle(KVReconstructedNucleus *PART) override
Path taken by particles through multidetector geometry.
KVGeoDetectorNode * GetNextNode() const
KVString GetPathString() const
void IterateFrom(const KVGeoDetectorNode *node0=nullptr) const
Information on relative positions of detectors & particle trajectories.
KVDetector * GetDetector() const
const Char_t * GetName() const override
Name of node is same as name of associated detector.
KVGeoStrucElement * GetParentStructure(const Char_t *type, const Char_t *name="") const
KVGroup * GetGroup() const
void Calibrate()
Calculate and set energies of all Z-identified but uncalibrated particles in event.
Int_t GetNIdentifiedInGroup()
virtual void Reconstruct()
Int_t GetNUnidentifiedInGroup()
const TCollection * GetTrajectories() const
const KVGeoDNTrajectory * GetTrajectoryForReconstruction(const KVGeoDNTrajectory *t, const KVGeoDetectorNode *n) const
Base class for all detectors or associations of detectors in array which can identify charged particl...
KVDetector * GetDetector(UInt_t n) const
virtual Bool_t CheckTheoreticalIdentificationThreshold(KVNucleus *, Double_t=0.0)
virtual Bool_t CanIdentify(Int_t Z, Int_t)
virtual UShort_t GetIDCode()
virtual void SetIdentificationStatus(KVIdentificationResult *IDR, const KVNucleus *)
Full result of one attempted particle identification.
Bool_t IDattempted
=kTRUE if identification was attempted
Bool_t IDOK
general quality of identification, =kTRUE if acceptable identification made
void SetComment(const Char_t *c)
Bool_t Aident
= kTRUE if A of particle established
Int_t A
A of particle found (if Aident==kTRUE)
Int_t Z
Z of particle found (if Zident==kTRUE)
Int_t IDquality
specific quality code returned by identification procedure
Int_t IDcode
a general identification code for this type of identification
void SetIDType(const Char_t *t)
Bool_t Zident
=kTRUE if Z of particle established
Base class for describing the geometry of a detector array.
Handles lists of named parameters with different types, a list of KVNamedParameter objects.
void Concatenate(const KVNameValueList &nvl)
void Merge(const KVNameValueList &)
Description of properties and kinematics of atomic nuclei.
void Copy(TObject &) const override
Copy this KVNucleus into the KVNucleus object referenced by "obj".
Int_t GetZ() const
Return the number of proton / atomic number.
KVNameValueList * GetParameters() const
Double_t GetEnergy() const
void SetParameter(const Char_t *name, ValType value) const
void SetEnergy(Double_t e)
Path through detector array used to reconstruct detected particle.
Nuclei reconstructed from data measured by a detector array .
virtual Int_t GetECode() const
const KVReconNucTrajectory * GetReconstructionTrajectory() const
Bool_t IsIdentified() const
KVDetector * GetStoppingDetector() const
virtual void SetTargetEnergyLoss(Double_t e)
virtual void GetAnglesFromReconstructionTrajectory(Option_t *opt="random")
void Print(Option_t *option="") const override
virtual void SetECode(UChar_t s)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
TObject * FindObject(const char *name) const override
const char * GetName() const override
virtual void Info(const char *method, const char *msgfmt,...) const
const char * Data() const
void Error(UserClass p, const char *location, const char *va_(fmt),...)
void Warning(UserClass p, const char *location, const char *va_(fmt),...)