8#include "TInterpreter.h" 
   56   TVector3(TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Cos(TMath::DegToRad() * (0.0)),
 
   57            TMath::Sin(TMath::DegToRad() * (0.0)) * TMath::Sin(TMath::DegToRad() * (0.0)),
 
   58            TMath::Cos(TMath::DegToRad() * (0.0))),
 
   60   TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
 
   61            TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
 
   62            TMath::Cos(TMath::DegToRad() * (45.0))),
 
   63   TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
 
   64            TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
 
   65            TMath::Cos(TMath::DegToRad() * (45.0))),
 
   66   TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
 
   67            TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
 
   68            TMath::Cos(TMath::DegToRad() * (45.0))),
 
   69   TVector3(TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
 
   70            TMath::Sin(TMath::DegToRad() * (45.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
 
   71            TMath::Cos(TMath::DegToRad() * (45.0))),
 
   73   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (22.5)),
 
   74            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (22.5)),
 
   75            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   76   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
 
   77            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
 
   78            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   79   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (112.5)),
 
   80            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (112.5)),
 
   81            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   82   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
 
   83            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
 
   84            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   85   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (202.5)),
 
   86            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (202.5)),
 
   87            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   88   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
 
   89            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
 
   90            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   91   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (292.5)),
 
   92            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (292.5)),
 
   93            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   94   TVector3(TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
 
   95            TMath::Sin(TMath::DegToRad() * (90.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
 
   96            TMath::Cos(TMath::DegToRad() * (90.0))),
 
   98   TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (67.5)),
 
   99            TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (67.5)),
 
  100            TMath::Cos(TMath::DegToRad() * (135.0))),
 
  101   TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (157.5)),
 
  102            TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (157.5)),
 
  103            TMath::Cos(TMath::DegToRad() * (135.0))),
 
  104   TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (247.5)),
 
  105            TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (247.5)),
 
  106            TMath::Cos(TMath::DegToRad() * (135.0))),
 
  107   TVector3(TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Cos(TMath::DegToRad() * (337.5)),
 
  108            TMath::Sin(TMath::DegToRad() * (135.0)) * TMath::Sin(TMath::DegToRad() * (337.5)),
 
  109            TMath::Cos(TMath::DegToRad() * (135.0)))};
 
  195   std::ostringstream str;
 
  196   str << 
"Griffin Contains: " << std::endl;
 
  199   for(
const auto& hit : 
Hits()) {
 
  205      str << std::setw(6) << 
fAddbackHits.size() << 
" addback hits" << std::endl;
 
  207      str << std::setw(6) << 
" " 
  208          << 
" Addback not set" << std::endl;
 
  211   str << std::setw(6) << 
" " 
  213   str << std::setw(6) << 
fCycleStart << 
" cycle start" << std::endl;
 
 
  255   } 
catch(
const std::out_of_range& oor) {
 
  256      std::cerr << ClassName() << 
" Hits are out of range: " << oor.what() << std::endl;
 
 
  272   auto& hitVector = 
Hits();
 
  273   if(hitVector.empty()) {
 
 
  293   std::cerr << 
"Addback hits are out of range" << std::endl;
 
 
  303   if(frag == 
nullptr || chan == 
nullptr) {
 
  307   if(mnemonic == 
nullptr) {
 
  308      std::cerr << 
"Trying to add fragment to TGriffin w/o mnemonic in TChannel!" << std::endl;
 
  313      std::cerr << __PRETTY_FUNCTION__ << 
": not a GRIFFIN detector: " << 
static_cast<std::underlying_type_t<TMnemonic::EMnemonic>
>(mnemonic->
SubSystem()) << std::endl;   
 
  321      Hits().push_back(hit);
 
  326      std::cout << 
"output sensor " << 
static_cast<std::underlying_type_t<TMnemonic::EMnemonic>
>(mnemonic->
OutputSensor()) << 
", skipping it" << std::endl;
 
 
  349   case 0: shift.SetXYZ(-cp, cp, 
id); 
break;
 
  350   case 1: shift.SetXYZ(cp, cp, 
id); 
break;
 
  351   case 2: shift.SetXYZ(cp, -cp, 
id); 
break;
 
  352   case 3: shift.SetXYZ(-cp, -cp, 
id); 
break;
 
  353   default: shift.SetXYZ(0, 0, 1); 
break;
 
  355   shift.RotateY(temp_pos.Theta());
 
  356   shift.RotateZ(temp_pos.Phi());
 
  358   temp_pos.SetMag(dist);
 
  360   return (temp_pos + shift);
 
 
  406                                     Bool_t time_constraint)
 
  408   if((hit_to_correct == 
nullptr) || (other_hit == 
nullptr)) {
 
  409      std::cerr << 
"One of the hits is invalid in TGriffin::CTCorrectedEnergy" << std::endl;
 
  413   if(time_constraint) {
 
  424   static std::array<bool, 256> been_warned  = {
false};
 
  425   double                       fixed_energy = hit_to_correct->
GetEnergy();
 
  430   } 
catch(
const std::out_of_range& oor) {
 
  432      if(!been_warned[
id]) {
 
  433         been_warned[id] = 
true;
 
  434         std::cerr << 
DRED << 
"Missing CT correction for Det: " << hit_to_correct->
GetDetector()
 
 
  447   auto& hitVector = 
Hits();
 
  448   if(hitVector.size() < 2) {
 
  452   for(
auto& hit : hitVector) {
 
  456   for(
auto& one : hitVector) {
 
  457      for(
auto& two : hitVector) {
 
 
  492   } 
catch(
const std::out_of_range& oor) {
 
  493      std::cerr << ClassName() << 
" Suppressed hits are out of range: " << oor.what() << std::endl;
 
 
  508   auto& hitVector = 
Hits();
 
  509   if(hitVector.empty()) {
 
 
  545   } 
catch(
const std::out_of_range& oor) {
 
  546      std::cerr << ClassName() << 
" Suppressed addback hits are out of range: " << oor.what() << std::endl;
 
 
  562   auto& hitVector = 
Hits();
 
  563   if(hitVector.empty()) {
 
 
  597   } 
catch(
const std::out_of_range& oor) {
 
  598      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)