9#include "TInterpreter.h"
39 TVector3(TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
40 TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
41 TMath::Cos(TMath::DegToRad() * (0.0))),
43 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (90.0)),
44 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (90.0)),
45 TMath::Cos(TMath::DegToRad() * (90.0))),
46 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (45.0)),
47 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (45.0)),
48 TMath::Cos(TMath::DegToRad() * (90.0))),
49 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
50 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
51 TMath::Cos(TMath::DegToRad() * (90.0))),
52 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (315.0)),
53 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (315.0)),
54 TMath::Cos(TMath::DegToRad() * (90.0))),
55 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (270.0)),
56 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (270.0)),
57 TMath::Cos(TMath::DegToRad() * (90.0))),
58 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (225.0)),
59 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (225.0)),
60 TMath::Cos(TMath::DegToRad() * (90.0))),
61 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (180.0)),
62 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (180.0)),
63 TMath::Cos(TMath::DegToRad() * (90.0))),
64 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (135.0)),
65 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (135.0)),
66 TMath::Cos(TMath::DegToRad() * (90.0))),
68 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (90.0)),
69 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (90.0)),
70 TMath::Cos(TMath::DegToRad() * (45.0))),
71 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
72 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
73 TMath::Cos(TMath::DegToRad() * (45.0))),
74 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (270.0)),
75 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (270.0)),
76 TMath::Cos(TMath::DegToRad() * (45.0))),
77 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (180.0)),
78 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (180.0)),
79 TMath::Cos(TMath::DegToRad() * (45.0))),
81 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (90.0)),
82 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (90.0)),
83 TMath::Cos(TMath::DegToRad() * (135.0))),
84 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
85 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
86 TMath::Cos(TMath::DegToRad() * (135.0))),
87 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (270.0)),
88 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (270.0)),
89 TMath::Cos(TMath::DegToRad() * (135.0))),
90 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (180.0)),
91 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (180.0)),
92 TMath::Cos(TMath::DegToRad() * (135.0)))
99 {gStrongCT[0], 0.0, gWeakCT[0], gWeakCT[0]},
100 {gWeakCT[0], gWeakCT[0], 0.0, gStrongCT[0]},
101 {gWeakCT[0], gWeakCT[0], gStrongCT[0], 0.0}},
102 {{0.0, gStrongCT[1], gWeakCT[1], gWeakCT[1]},
103 {gStrongCT[1], 0.0, gWeakCT[1], gWeakCT[1]},
104 {gWeakCT[1], gWeakCT[1], 0.0, gStrongCT[1]},
105 {gWeakCT[1], gWeakCT[1], gStrongCT[1], 0.0}}};
110#if MAJOR_ROOT_VERSION < 6
111 Class()->IgnoreTObjectStreamer(kTRUE);
119#if MAJOR_ROOT_VERSION < 6
120 Class()->IgnoreTObjectStreamer(kTRUE);
176 std::ostringstream str;
177 str <<
"Ifin Contains: " << std::endl;
181 str << std::setw(6) <<
fAddbackHits.size() <<
" addback hits" << std::endl;
183 str << std::setw(6) <<
" "
184 <<
" Addback not set" << std::endl;
187 str << std::setw(6) <<
" "
270 }
catch(
const std::out_of_range& oor) {
271 std::cerr << ClassName() <<
" Hits are out of range: " << oor.what() << std::endl;
286 }
catch(
const std::out_of_range& oor) {
287 std::cerr << ClassName() <<
"Suppressed hits are out of range: " << oor.what() << std::endl;
304 if(hit_vec.empty()) {
309 for(
auto& hit : sup_vec) {
314 if(sup_vec.empty()) {
319 return sup_vec.size();
333 if(hit_vec.empty()) {
339 for(
auto& hit : ab_vec) {
350 return ab_vec.size();
364 if(hit_vec.empty()) {
370 for(
auto& hit : ab_vec) {
381 return ab_vec.size();
391 }
catch(
const std::out_of_range& oor) {
392 std::cerr << ClassName() <<
" Addback hits are out of range: " << oor.what() << std::endl;
407 }
catch(
const std::out_of_range& oor) {
408 std::cerr << ClassName() <<
" Suppressed addback hits are out of range: " << oor.what() << std::endl;
421 if(frag ==
nullptr || chan ==
nullptr) {
428 Hits().push_back(std::move(geHit));
440 return TVector3(0, 0, 1);
451 Double_t cp = 17.678;
455 TVector3 CrystalPosition;
457 case 0: CrystalPosition.SetXYZ(-cp, cp,
id);
break;
458 case 1: CrystalPosition.SetXYZ(cp, cp,
id);
break;
459 case 2: CrystalPosition.SetXYZ(cp, -cp,
id);
break;
460 case 3: CrystalPosition.SetXYZ(-cp, -cp,
id);
break;
461 default: CrystalPosition.SetXYZ(0, 0, 1);
break;
464 CrystalPosition.RotateY(CloverPosition.Theta());
466 CrystalPosition.RotateZ(CloverPosition.Phi());
468 CloverPosition.SetMag(dist);
470 return (CloverPosition + CrystalPosition);
526 Bool_t time_constraint)
531 if((hit_to_correct ==
nullptr) || (other_hit ==
nullptr)) {
532 std::cerr <<
"One of the hits is invalid in TIfin::CTCorrectedEnergy" << std::endl;
536 if(time_constraint) {
547 static bool been_warned[256] = {
false};
548 double fixed_energy = hit_to_correct->
GetEnergy();
553 }
catch(
const std::out_of_range& oor) {
555 if(!been_warned[
id]) {
556 been_warned[id] =
true;
557 std::cerr <<
DRED <<
"Missing CT correction for Det: " << hit_to_correct->
GetDetector()
558 <<
" Crystals: " << hit_to_correct->
GetCrystal() <<
" " << other_hit->
GetCrystal() <<
" (id " <<
id <<
")" << std::endl;
569 if(hit_vec.size() < 2) {
573 for(
auto& i : hit_vec) {
578 for(
auto& one : hit_vec) {
579 for(
auto& two : hit_vec) {
580 if(one == two)
continue;
bool DefaultIfinSuppression(const TDetectorHit *hit, const TDetectorHit *bgoHit)
bool DefaultIfinAddback(const TDetectorHit *one, const TDetectorHit *two)
double SuppressionWindow() const
double AddbackWindow() const
double SuppressionEnergy() const
std::vector< double > GetCTCoeff() const
const TMnemonic * GetMnemonic() const
virtual double GetEnergy(Option_t *opt="") const
virtual Int_t GetCrystal() const
!
TChannel * GetChannel() const
!
virtual Int_t GetDetector() const
!
virtual Double_t GetTime(const ETimeFlag &correct_flag=ETimeFlag::kAll, Option_t *opt="") const
Returns a time value to the nearest nanosecond!
virtual Short_t GetMultiplicity() const
virtual const std::vector< TDetectorHit * > & GetHitVector() const
std::vector< TDetectorHit * > & Hits()
static TAnalysisOptions * AnalysisOptions()
Double_t GetNoCTEnergy(Option_t *opt="") const
std::vector< TDetectorHit * > fAddbackHits
! Used to create addback hits on the fly
std::vector< TDetectorHit * > & GetAddbackVector()
!
std::vector< UShort_t > fAddbackFrags
! Number of crystals involved in creating the addback hit
std::vector< UShort_t > & GetSuppressedAddbackFragVector()
std::vector< TDetectorHit * > & GetSuppressedAddbackVector()
@ kIsSuppressedAddbackSet
static const char * GetColorFromNumber(int number)
bool IsAddbackSet() const
UShort_t GetNAddbackFrags(const size_t &idx)
Int_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
std::vector< UShort_t > & GetAddbackFragVector()
!
Bool_t IsCrossTalkSet() const
TIfin & operator=(const TIfin &)
!
TIfinHit * GetSuppressedAddbackHit(const int &i)
std::vector< TDetectorHit * > fSuppressedAddbackHits
! Used to create suppressed addback hits on the fly
void SetBitNumber(EIfinBits bit, Bool_t set) const
TTransientBits< UChar_t > fIfinBits
static TVector3 gCloverPosition[17]
! Position of each HPGe Clover
bool IsSuppressed() const
void ClearStatus() const
!
std::vector< TDetectorHit * > fSuppressedHits
! Used to create suppressed hits on the fly
bool IsSuppressedAddbackSet() const
TIfinHit * GetAddbackHit(const int &i)
void ResetSuppressedAddback()
Int_t GetAddbackMultiplicity()
void SetSuppressedAddback(bool flag=true) const
std::vector< TDetectorHit * > & GetSuppressedVector()
Int_t GetSuppressedMultiplicity(const TBgo *bgo)
Bool_t TestBitNumber(EIfinBits bit) const
static Double_t CTCorrectedEnergy(const TIfinHit *const hit_to_correct, const TIfinHit *const other_hit, Bool_t time_constraint=true)
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
TIfinHit * GetSuppressedHit(const int &i)
static const Double_t gCrossTalkPar[2][4][4]
!
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=90.0)
!
std::vector< UShort_t > fSuppressedAddbackFrags
! Number of crystals involved in creating the suppressed addback hit
TIfinHit * GetIfinHit(const Int_t &i)
static const Double_t gStrongCT[2]
!
void SetAddback(bool flag=true) const
void Clear(Option_t *opt="all") override
!
static const Double_t gWeakCT[2]
!
void SetSuppressed(bool flag=true) const
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fAddbackCriterion
void SetCrossTalk(bool flag=true) const
void Copy(TObject &) const override
!
void Print(Option_t *opt="") const override
!
virtual EMnemonic SubSystem() const
void Clear(Option_t *opt="all") override
!
void Copy(TObject &) const override
!
void CreateAddback(const std::vector< T * > &hits, std::vector< T * > &addbacks, std::vector< UShort_t > &nofFragments)
void CreateSuppressed(const TBgo *bgo, const std::vector< T * > &hits, std::vector< T * > &suppressedHits)
void CreateSuppressedAddback(const TBgo *bgo, const std::vector< T * > &hits, std::vector< T * > &addbacks, std::vector< UShort_t > &nofFragments)
void SetBit(T bit, Bool_t flag)