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);
164 && can_extend_identification_beyond_audit(idt->
GetLabel())))
166 std::stringstream comments;
170 IDR->
Z = nuc->
GetZ();
201 "%s : %s Z=%d A=%d E=%f", comments.str().c_str(),
212 IDR->
Z = nuc->
GetZ();
213 IDR->
A = nuc->
GetA();
225 IDR->
SetComment(
"below threshold for identification");
238 void KVFilterGroupReconstructor::PerformSecondaryAnalysis()
242 int num_ident_0, num_ident;
243 int num_unident_0, num_unident;
250 if (num_unident > num_unident_0) {
253 if (num_ident > num_ident_0)
Calibrate();
256 while (num_ident > num_ident_0);
267 current_nuc_recon = part;
270 KVGroupReconstructor::ReconstructParticle(part, traj, node);
271 }
catch (
const std::exception&
e) {
272 KVError::Error(
this,
"ReconstructParticle",
"Caught exception: %s",
e.what());
281 energy_loss[Nd->GetName()] = Nd->GetDetector()->GetEnergyLoss();
282 ++number_uncalibrated[Nd->GetName()];
292 KVGroupReconstructor::IdentifyParticle(PART);
298 --number_unidentified[node->
GetName()];
315 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNormalCalibrationCode());
324 if (number_uncalibrated[det->GetName()] > 1 || (det != PART->
GetStoppingDetector() && number_unidentified[det->GetName()] > 0)) {
334 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNoCalibrationCode());
338 det->SetEResAfterDetector(Einc);
339 edet = det->GetCorrectedEnergy(PART, dE);
343 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetCalculatedCalibrationCode());
348 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetNoCalibrationCode());
353 else if (det->GetNHits() > 1) {
357 dE = energy_loss[det->GetName()];
358 det->SetEResAfterDetector(Einc);
359 edet = det->GetCorrectedEnergy(PART, dE);
362 PART->
SetECode(
GetGroup()->GetParentStructure<KVMultiDetArray>()->GetCalculatedCalibrationCode());
365 dE = det->GetEnergyLoss();
366 det->SetEResAfterDetector(Einc);
367 edet = det->GetCorrectedEnergy(PART, -1., (Einc > 0));
372 --number_uncalibrated[det->GetName()];
373 energy_loss[det->GetName()] -= dE;
374 det->SetEnergyLoss(energy_loss[det->GetName()]);
386 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
@ 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...
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),...)