9#include "TInterpreter.h"
57 TVector3(TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
58 TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
59 TMath::Cos(TMath::DegToRad() * (0.0))),
61 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
62 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
63 TMath::Cos(TMath::DegToRad() * (45.0))),
64 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
65 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
66 TMath::Cos(TMath::DegToRad() * (45.0))),
67 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
68 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
69 TMath::Cos(TMath::DegToRad() * (45.0))),
70 TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
71 TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
72 TMath::Cos(TMath::DegToRad() * (45.0))),
74 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (22.5)),
75 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (22.5)),
76 TMath::Cos(TMath::DegToRad() * (90.0))),
77 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
78 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
79 TMath::Cos(TMath::DegToRad() * (90.0))),
80 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (112.5)),
81 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (112.5)),
82 TMath::Cos(TMath::DegToRad() * (90.0))),
83 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
84 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
85 TMath::Cos(TMath::DegToRad() * (90.0))),
86 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (202.5)),
87 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (202.5)),
88 TMath::Cos(TMath::DegToRad() * (90.0))),
89 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
90 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
91 TMath::Cos(TMath::DegToRad() * (90.0))),
92 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (292.5)),
93 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (292.5)),
94 TMath::Cos(TMath::DegToRad() * (90.0))),
95 TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
96 TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
97 TMath::Cos(TMath::DegToRad() * (90.0))),
99 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
100 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
101 TMath::Cos(TMath::DegToRad() * (135.0))),
102 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
103 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
104 TMath::Cos(TMath::DegToRad() * (135.0))),
105 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
106 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
107 TMath::Cos(TMath::DegToRad() * (135.0))),
108 TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
109 TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
110 TMath::Cos(TMath::DegToRad() * (135.0)))};
196 std::ostringstream str;
197 str <<
"Griffin Contains: " << std::endl;
200 for(
const auto& hit :
Hits()) {
206 str << std::setw(6) <<
fAddbackHits.size() <<
" addback hits" << std::endl;
208 str << std::setw(6) <<
" "
209 <<
" Addback not set" << std::endl;
212 str << std::setw(6) <<
" "
214 str << std::setw(6) <<
fCycleStart <<
" cycle start" << std::endl;
256 }
catch(
const std::out_of_range& oor) {
257 std::cerr << ClassName() <<
" Hits are out of range: " << oor.what() << std::endl;
273 auto& hitVector =
Hits();
274 if(hitVector.empty()) {
298 std::cerr <<
"Addback hits are out of range" << std::endl;
308 if(frag ==
nullptr || chan ==
nullptr) {
312 if(mnemonic ==
nullptr) {
313 std::cerr <<
"Trying to add fragment to TGriffin w/o mnemonic in TChannel!" << std::endl;
318 std::cerr << __PRETTY_FUNCTION__ <<
": not a GRIFFIN detector: " <<
static_cast<std::underlying_type<TMnemonic::EMnemonic>::type
>(mnemonic->
SubSystem()) << std::endl;
326 Hits().push_back(hit);
331 std::cout <<
"output sensor " <<
static_cast<std::underlying_type<TMnemonic::EMnemonic>::type
>(mnemonic->
OutputSensor()) <<
", skipping it" << std::endl;
354 case 0: shift.SetXYZ(-cp, cp,
id);
break;
355 case 1: shift.SetXYZ(cp, cp,
id);
break;
356 case 2: shift.SetXYZ(cp, -cp,
id);
break;
357 case 3: shift.SetXYZ(-cp, -cp,
id);
break;
358 default: shift.SetXYZ(0, 0, 1);
break;
360 shift.RotateY(temp_pos.Theta());
361 shift.RotateZ(temp_pos.Phi());
363 temp_pos.SetMag(dist);
365 return (temp_pos + shift);
411 Bool_t time_constraint)
413 if((hit_to_correct ==
nullptr) || (other_hit ==
nullptr)) {
414 std::cerr <<
"One of the hits is invalid in TGriffin::CTCorrectedEnergy" << std::endl;
418 if(time_constraint) {
429 static std::array<bool, 256> been_warned = {
false};
430 double fixed_energy = hit_to_correct->
GetEnergy();
435 }
catch(
const std::out_of_range& oor) {
437 if(!been_warned[
id]) {
438 been_warned[id] =
true;
439 std::cerr <<
DRED <<
"Missing CT correction for Det: " << hit_to_correct->
GetDetector()
452 auto& hitVector =
Hits();
453 if(hitVector.size() < 2) {
457 for(
auto& hit : hitVector) {
461 for(
auto& one : hitVector) {
462 for(
auto& two : hitVector) {
497 }
catch(
const std::out_of_range& oor) {
498 std::cerr << ClassName() <<
" Suppressed hits are out of range: " << oor.what() << std::endl;
513 auto& hitVector =
Hits();
514 if(hitVector.empty()) {
553 }
catch(
const std::out_of_range& oor) {
554 std::cerr << ClassName() <<
" Suppressed addback hits are out of range: " << oor.what() << std::endl;
570 auto& hitVector =
Hits();
571 if(hitVector.empty()) {
609 }
catch(
const std::out_of_range& oor) {
610 std::cerr << ClassName() <<
" Suppressed addback frags are out of range: " << oor.what() << std::endl;
bool DefaultGriffinAddback(const TDetectorHit *one, const TDetectorHit *two)
bool DefaultGriffinSuppression(const TDetectorHit *hit, const TDetectorHit *bgoHit)
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
std::vector< TDetectorHit * > & Hits()
static TAnalysisOptions * AnalysisOptions()
Double_t GetNoCTEnergy(Option_t *opt="") const
bool IsSuppressedAddbackSet() const
void ResetSuppressedAddback()
static const char * GetColorFromNumber(int number)
std::vector< TDetectorHit * > fSuppressedHits
! The set of suppressed crystal hits
void Clear(Option_t *opt="all") override
!
TGriffinHit * GetAddbackHit(const int &i)
Short_t GetAddbackMultiplicity()
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fAddbackCriterion
std::vector< TDetectorHit * > fSuppressedAddbackHits
! Used to create suppressed addback hits on the fly
void Print(Option_t *opt="") const override
!
int64_t fCycleStart
! The start of the cycle
static std::array< TVector3, 17 > fCloverPosition
! Position of each HPGe Clover
static TVector3 GetPosition(int DetNbr, int CryNbr=5, double dist=110.0)
!
void ClearStatus() const
!
UShort_t GetNSuppressedAddbackFrags(const size_t &idx)
std::vector< TDetectorHit * > fAddbackHits
! Used to create addback hits on the fly
UShort_t GetNAddbackFrags(const size_t &idx)
TGriffinHit * GetSuppressedAddbackHit(const int &i)
bool IsAddbackSet() const
TGriffin & operator=(const TGriffin &)
!
TTransientBits< UChar_t > fGriffinBits
void SetSuppressed(bool flag=true) const
static std::function< bool(const TDetectorHit *, const TDetectorHit *)> fSuppressionCriterion
Short_t GetSuppressedMultiplicity(const TBgo *bgo)
Short_t GetSuppressedAddbackMultiplicity(const TBgo *bgo)
@ kIsSuppressedAddbackSet
void SetBitNumber(EGriffinBits bit, Bool_t set) const
void SetSuppressedAddback(bool flag=true) const
void AddFragment(const std::shared_ptr< const TFragment > &, TChannel *) override
!
bool IsSuppressed() const
TGriffinHit * GetSuppressedHit(const int &i)
!
std::vector< UShort_t > fAddbackFrags
! Number of crystals involved in creating in the addback hit
void SetAddback(bool flag=true) const
TGriffinHit * GetGriffinHit(const int &i)
!
static Double_t CTCorrectedEnergy(const TGriffinHit *hit_to_correct, const TGriffinHit *other_hit, bool time_constraint=true)
static TVector3 GetDetectorPosition(int DetNbr)
!
Bool_t IsCrossTalkSet() const
Bool_t TestBitNumber(EGriffinBits bit) const
static bool fSetCoreWave
! Flag for Waveforms ON/OFF
std::vector< UShort_t > fSuppressedAddbackFrags
! Number of crystals involved in creating in the suppressed addback hit
void Copy(TObject &) const override
!
void SetCrossTalk(bool flag=true) const
virtual EMnemonic OutputSensor() const
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)