29 #include "TGeoMatrix.h"
32 #include "TPaveStats.h"
45 Bool_t ok = Watcher::GetFromTrigger(trigger,
"data:tracked", fFrame);
60 #ifdef APPLY_CORRECTION_CrystalPositionLookUpTable
67 Double_t px, py, pz, dx, dy, dz;
71 Double_t hrx, hry, hrz;
72 Double_t phi = -28*3.141592654/180;
81 hrx = hit->
GetX()*cos(phi) - hit->
GetY()*sin(phi);
82 hry = hit->
GetX()*sin(phi) + hit->
GetY()*cos(phi);
84 Double_t xx = hit->
GetX() - px;
85 Double_t yy = hit->
GetY() - py;
86 Double_t zz = hit->
GetZ() + fZOffset - pz;
91 Double_t x = hrx - px;
92 Double_t y = hry - py;
93 Double_t z = hrz + fZOffset - pz;
94 Double_t dd = x*x + y*y + z*z;
95 Double_t ddd = xx*xx + yy*yy + zz*zz;
99 if( !(dd == 0.0)&&beta>0. ) {
100 Double_t cosTheta = (x*dx + y*dy + z*dz)/::sqrt(dd);
101 Double_t cosThetanr = (xx*dx + yy*dy + zz*dz)/::sqrt(ddd);
107 if( abs(e - 1345)<10. && 0==-1 ) {
108 cout <<
" e before =" << edop <<
"; beta =" << beta <<
endl;
109 cout <<
" rotation: " << e <<
" " << cosTheta <<
"; no rotation: " << enr <<
" " << cosThetanr <<
" " <<
endl;
112 cout <<
"check " << hit->
GetX() <<
" --> " << hrx <<
" " <<
endl;
113 cout <<
"check " << hit->
GetY() <<
" --> " << hry <<
" " <<
endl;
114 cout <<
"check " << hit->
GetZ() <<
" --> " << hrz <<
" " <<
endl;
115 cout <<
"check " << hit->
GetT() <<
endl;
130 Double_t px, py, pz, dx, dy, dz;
134 Double_t x = hit->
GetX() - px;
135 Double_t y = hit->
GetY() - py;
136 Double_t z = hit->
GetZ() + fZOffset - pz;
138 Double_t dd = x*x + y*y + z*z;
140 Double_t cosTheta = (x*dx + y*dy + z*dz)/::sqrt(dd);
154 Coinc2D::Coinc2D(
const char *name,
const char *title, TDirectory *sp_dir, TDirectory *tag_dir):
158 fTrackedEnergyDopler(0x0),
168 fTrackedEnergy = MakeTH1<TH1F>(
"TrackedEnergy",
"Tracked Energy",6000,0,6000);
170 fTrackedEnergyDopler = MakeTH1<TH1F>(
"TrackedEnergyDopler",
"Tracked Energy with Doppler correction",6000,0,6000);
171 TagOn(fTrackedEnergyDopler);
173 fFold = MakeTH1<TH1F>(
"Fold",
"Fold distributions",10,0,10);
176 fGxG = MakeTH2<TH2F>(
"GxG",
"Gamma Gamma matrix",2000,0,1000,2000,0,1000);
177 fGxG_DC = MakeTH2<TH2F>(
"GxG_DC",
"Gamma Gamma matrix with Doppler Correction",2000,0,1000,2000,0,1000);
179 fPos3D = MakeTH3<TH3F>(
"Pos3D",
"Positions of Tracked Gamma-rays ;x;y;z",200,-200,200,200,-200,200,200,-400,0);
195 if ( opt.Contains(
"") ) {
196 c->Divide(1,2,0.001,0.001);
199 TPad *pad =
new TPad(
"GxG_FOLD",
"Pad for Fold distribution",0.7,0.6,1,1);
219 printf(
"Coinc2D::::Exec is called \n");
223 GetCstDataPointer<GammaTrackedInterface>(
fFrame);
233 for (UShort_t i = 0u; i < fold; i++) {
241 Double_t e1 = gamma1->
GetE();
244 if ( vertex->GetBeta() > 0.001 )
247 for (UShort_t j = i+1u; j < fold; j++) {
252 Double_t e2 = gamma2->
GetE();
256 if ( vertex->GetBeta() > 0.001 ) {
405 fTrackedEnergyDopler(0x0),
415 fTrackedEnergy = MakeTH1<TH1F>(
"TrackedEnergy",
"Tracked Energy",8192,0,4096);
417 fTrackedEnergyDopler = MakeTH1<TH1F>(
"TrackedEnergyDC",
"Tracked Energy with Doppler correction",8192,0,4096);
418 TagOn(fTrackedEnergyDopler);
420 fGammaMult = MakeTH1<TH1F>(
"GammaMult",
"Gamma multiplicity",20,0,20);
423 fGxG = MakeTH2<TH2F>(
"GxG",
"Gamma Gamma matrix",4096,0,4096,4096,0,4096);
424 fGxG_DC = MakeTH2<TH2F>(
"GxG_DC",
"Gamma Gamma matrix with Doppler Correction",4096,0,4096,4096,0,4096);
426 fETheta = MakeTH2<TH2F>(
"ETheta",
"Energy vs Theta matrix",4096,0,4096,1800,0,180);
427 fEThetaDC = MakeTH2<TH2F>(
"ETheta_DC",
"Energy vs Theta matrix with Doppler Correction",4096,0,4096,1800,0,180);
429 fPos3D = MakeTH3<TH3F>(
"Pos3D",
"Positions of Tracked Gamma-rays ;x;y;z",200,-400,400,200,-400,400,200,-400,400);
459 GetCstDataPointer<GammaTrackedInterface>(
fFrame);
470 for (UShort_t i = 0u; i < fold; i++) {
477 double Theta =
GetTheta(gamma1,vertex);
482 Double_t e1 = gamma1->
GetE();
488 if ( vertex->GetBeta() > 0.001 )
491 for (UShort_t j = i+1u; j < fold; j++) {
496 Double_t e2 = gamma2->
GetE();
500 if ( vertex->GetBeta() > 0.001 ) {
512 Double_t px, py, pz, dx, dy, dz;
516 Double_t x = hit->
GetX() - px;
517 Double_t y = hit->
GetY() - py;
522 Double_t dd = x*x + y*y + z*z;
524 if( !(dd == 0.0) ) cosTheta = (x*dx + y*dy + z*dz)/::sqrt(dd);
526 return TMath::ACos(cosTheta)*TMath::RadToDeg();
533 TString Name =
"Tracked_Energy";
534 TString Title =
"tracked energy without and with doppler correction";
542 c->Divide(1,2,0.001,0.001);
544 double topmarg = 0.0657599;
545 double rightmarg = 0.00726832;
546 double leftmarg = 0.0490612;
547 double bottommarg = 0.114119;
549 for(
int i=0 ; i<2 ; i++)
553 gPad->SetRightMargin(rightmarg);
554 gPad->SetTopMargin(topmarg);
555 gPad->SetLeftMargin(leftmarg);
556 gPad->SetBottomMargin(bottommarg);
563 htemp->SetStats(
false);
564 htemp->GetXaxis()->SetTitle(
"Energy (keV)");
565 htemp->GetXaxis()->SetTitleSize(0.06);
566 htemp->GetXaxis()->SetLabelSize(0.06);
567 htemp->GetXaxis()->SetTitleOffset(0.91);
569 htemp->GetYaxis()->SetTitle(
"Counts");
570 htemp->GetYaxis()->SetTitleSize(0.06);
571 htemp->GetYaxis()->SetLabelSize(0.06);
572 htemp->GetYaxis()->SetTitleOffset(0.45);
577 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
580 st->SetX2NDC(1-rightmarg);
581 st->SetY2NDC(1-topmarg);
584 TPaveText *txt = (TPaveText*)gPad->FindObject(
"title");
587 double width = txt->GetY2NDC()-txt->GetY1NDC();
588 txt->SetY2NDC(1-topmarg);
589 txt->SetY1NDC(txt->GetY2NDC()-width);
594 TPad *pad =
new TPad(
"GammaMult",
"Gamma multiplicity",0.7,0.6,1-rightmarg-0.0025,1-topmarg-0.005);
595 pad->SetRightMargin(0.00486268);
596 pad->SetTopMargin(0.00912681);
597 pad->SetLeftMargin(0.0736404);
598 pad->SetBottomMargin(0.195208);
604 fGammaMult->GetXaxis()->SetTitle(
"Gamma multiplicity");
618 double topmarg = 0.00240964;
619 double rightmarg = 0.0169287;
620 double leftmarg = 0.0719468;
621 double bottommarg = 0.0843373;
625 gPad->SetRightMargin(rightmarg);
626 gPad->SetTopMargin(topmarg);
627 gPad->SetLeftMargin(leftmarg);
628 gPad->SetBottomMargin(bottommarg);
630 h[0]->SetBit(TH1::kNoTitle);
632 h[0]->SetStats(
false);
635 h[0]->GetXaxis()->SetTitle(
"Energy (keV)");
636 h[0]->GetXaxis()->SetTitleSize(0.04);
637 h[0]->GetXaxis()->SetLabelSize(0.04);
638 h[0]->GetXaxis()->SetTitleOffset(1.);
640 h[0]->GetYaxis()->SetTitle(
"Counts");
641 h[0]->GetYaxis()->SetTitleSize(0.04);
642 h[0]->GetYaxis()->SetLabelSize(0.04);
643 h[0]->GetYaxis()->SetTitleOffset(1.);
646 h[1]->SetStats(
false);
652 TLegend *leg =
new TLegend(0.756348,0.870486,1-rightmarg,1-topmarg,
"Tracked Energy",
"NDC");
653 leg->AddEntry(h[0],
"Without doppler correction",
"l");
654 leg->AddEntry(h[1],
"With doppler correction",
"l");
663 TString Name =
"Tracking_GammaGamma";
664 TString Title =
"Gamma Gamma matrix of the tracked gamma";
668 if(((TString)NoDC_DC_Both) ==
"Both")
670 c->Divide(1,2,0.001,0.001);
672 double topmarg = 0.0318624;
673 double rightmarg = 0.00726832;
674 double leftmarg = 0.0529148;
675 double bottommarg = 0.114119;
679 for(
int i=0 ; i<2 ; i++)
683 gPad->SetRightMargin(rightmarg);
684 gPad->SetTopMargin(topmarg);
685 gPad->SetLeftMargin(leftmarg);
686 gPad->SetBottomMargin(bottommarg);
694 htemp->SetBit(TH2::kNoTitle);
695 htemp->GetXaxis()->SetTitle(
"Energy #gamma_{1} (keV)");
696 htemp->GetXaxis()->SetTitleSize(0.06);
697 htemp->GetXaxis()->SetLabelSize(0.06);
698 htemp->GetXaxis()->SetTitleOffset(0.91);
700 htemp->GetYaxis()->SetTitle(
"Energy #gamma_{2} (keV)");
701 htemp->GetYaxis()->SetTitleSize(0.06);
702 htemp->GetYaxis()->SetLabelSize(0.06);
703 htemp->GetYaxis()->SetTitleOffset(0.45);
708 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
711 st->SetX2NDC(1-rightmarg);
712 st->SetY2NDC(1-topmarg);
715 TPaveText *txt = (TPaveText*)gPad->FindObject(
"title");
718 double width = txt->GetY2NDC()-txt->GetY1NDC();
719 txt->SetY2NDC(1-topmarg);
720 txt->SetY1NDC(txt->GetY2NDC()-width);
727 if(((TString)NoDC_DC_Both) ==
"NoDC") htemp =
fGxG;
728 else if(((TString)NoDC_DC_Both) ==
"DC") htemp =
fGxG_DC;
730 double topmarg = 0.0156627;
731 double rightmarg = 0.0169287;
732 double leftmarg = 0.0719468;
733 double bottommarg = 0.0843373;
735 gPad->SetRightMargin(rightmarg);
736 gPad->SetTopMargin(topmarg);
737 gPad->SetLeftMargin(leftmarg);
738 gPad->SetBottomMargin(bottommarg);
740 htemp->SetBit(TH2::kNoTitle);
741 htemp->GetXaxis()->SetTitle(
"Energy #gamma_{1} (keV)");
742 htemp->GetYaxis()->SetTitle(
"Energy #gamma_{2} (keV)");
749 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
752 st->SetX2NDC(1-rightmarg);
753 st->SetY2NDC(1-topmarg);
762 TString Name =
"ETheta";
763 TString Title =
"Energy Theta matrix of the tracked gamma";
769 if(((TString)NoDC_DC_Both) ==
"Both")
771 c->Divide(1,2,0.001,0.001);
773 double topmarg = 0.0318624;
774 double rightmarg = 0.00726832;
775 double leftmarg = 0.0529148;
776 double bottommarg = 0.114119;
778 for(
int i=0 ; i<2 ; i++)
782 gPad->SetRightMargin(rightmarg);
783 gPad->SetTopMargin(topmarg);
784 gPad->SetLeftMargin(leftmarg);
785 gPad->SetBottomMargin(bottommarg);
793 htemp->SetBit(TH2::kNoTitle);
794 htemp->GetXaxis()->SetTitle(
"Energy (keV)");
795 htemp->GetXaxis()->SetTitleSize(0.06);
796 htemp->GetXaxis()->SetLabelSize(0.06);
797 htemp->GetXaxis()->SetTitleOffset(0.91);
799 htemp->GetYaxis()->SetTitle(
"#theta (deg)");
800 htemp->GetYaxis()->SetTitleSize(0.06);
801 htemp->GetYaxis()->SetLabelSize(0.06);
802 htemp->GetYaxis()->SetTitleOffset(0.45);
807 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
810 st->SetX2NDC(1-rightmarg);
811 st->SetY2NDC(1-topmarg);
814 TPaveText *txt = (TPaveText*)gPad->FindObject(
"title");
817 double width = txt->GetY2NDC()-txt->GetY1NDC();
818 txt->SetY2NDC(1-topmarg);
819 txt->SetY1NDC(txt->GetY2NDC()-width);
826 if(((TString)NoDC_DC_Both) ==
"NoDC") htemp = h[0];
827 else if(((TString)NoDC_DC_Both) ==
"DC") htemp = h[1];
829 double topmarg = 0.0156627;
830 double rightmarg = 0.0169287;
831 double leftmarg = 0.0719468;
832 double bottommarg = 0.0843373;
834 gPad->SetRightMargin(rightmarg);
835 gPad->SetTopMargin(topmarg);
836 gPad->SetLeftMargin(leftmarg);
837 gPad->SetBottomMargin(bottommarg);
839 htemp->SetBit(TH2::kNoTitle);
840 htemp->GetXaxis()->SetTitle(
"Energy #gamma_{1} (keV)");
841 htemp->GetYaxis()->SetTitle(
"#theta (deg))");
848 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
851 st->SetX2NDC(1-rightmarg);
852 st->SetY2NDC(1-topmarg);
861 TH1 *CoreCommon = (TH1*)gROOT->FindObjectAny(
"CoreCommon");
862 TH1 *SumSpectra = (TH1*)gROOT->FindObjectAny(
"SumSpectra");
866 cout<<
"CoreCommon spectrum not found"<<
endl;
871 cout<<
"SumSpectra spectrum not found"<<
endl;
875 TH1 *trackedhist = 0x0;
877 else if(((TString)DC_NoDC) ==
"NoDC") trackedhist =
fTrackedEnergy;
880 cout<<
"Wrong option, DC_NoDC should be DC or NoDC"<<
endl;
884 TString Name =
"CommonSumTrackedDC";
885 TString Title =
"comparison of Core common, sum spectra and tracked spectrum dc";
889 TH1 *h[3] = {CoreCommon,SumSpectra,trackedhist};
893 c->Divide(1,3,0.001,0.001);
895 double topmarg = 0.0657599;
896 double rightmarg = 0.00142122;
897 double leftmarg = 0.0444335;
898 double bottommarg = 0.127278;
900 for(
int i=0 ; i<3 ; i++)
904 gPad->SetRightMargin(rightmarg);
905 gPad->SetTopMargin(topmarg);
906 gPad->SetLeftMargin(leftmarg);
907 gPad->SetBottomMargin(bottommarg);
914 htemp->SetStats(
false);
915 htemp->GetXaxis()->SetTitle(
"Energy (keV)");
916 htemp->GetXaxis()->SetTitleSize(0.07);
917 htemp->GetXaxis()->SetLabelSize(0.07);
918 htemp->GetXaxis()->SetTitleOffset(0.87);
920 htemp->GetYaxis()->SetTitle(
"Counts");
921 htemp->GetYaxis()->SetTitleSize(0.07);
922 htemp->GetYaxis()->SetLabelSize(0.07);
923 htemp->GetYaxis()->SetTitleOffset(0.35);
928 TPaveStats *st = (TPaveStats*)htemp->FindObject(
"stats");
931 st->SetX2NDC(1-rightmarg);
932 st->SetY2NDC(1-topmarg);
935 TPaveText *txt = (TPaveText*)gPad->FindObject(
"title");
938 double width = txt->GetY2NDC()-txt->GetY1NDC();
939 txt->SetY2NDC(1-topmarg);
940 txt->SetY1NDC(txt->GetY2NDC()-width);
946 double topmarg = 0.00240964;
947 double rightmarg = 0.0169287;
948 double leftmarg = 0.0719468;
949 double bottommarg = 0.0843373;
953 gPad->SetRightMargin(rightmarg);
954 gPad->SetTopMargin(topmarg);
955 gPad->SetLeftMargin(leftmarg);
956 gPad->SetBottomMargin(bottommarg);
958 h[0]->SetBit(TH1::kNoTitle);
960 h[0]->SetStats(
false);
963 h[0]->GetXaxis()->SetTitle(
"Energy (keV)");
964 h[0]->GetXaxis()->SetTitleSize(0.04);
965 h[0]->GetXaxis()->SetLabelSize(0.04);
966 h[0]->GetXaxis()->SetTitleOffset(1.);
968 h[0]->GetYaxis()->SetTitle(
"Counts");
969 h[0]->GetYaxis()->SetTitleSize(0.04);
970 h[0]->GetYaxis()->SetLabelSize(0.04);
971 h[0]->GetYaxis()->SetTitleOffset(1.);
974 h[1]->SetStats(
false);
978 h[2]->SetStats(
false);
984 TLegend *leg =
new TLegend(0.706167,0.870486,1-rightmarg,1-topmarg,
"Core common -vs- Sum spectra (Calorimeter) -vs- tracked energy",
"NDC");
985 leg->AddEntry(h[0],
"Core common",
"l");
986 leg->AddEntry(h[1],
"Sum spectra (Calorimeter)",
"l");
988 if(((TString)DC_NoDC) ==
"DC") leg->AddEntry(h[2],
"Tracked, doppler corrected",
"l");
989 else leg->AddEntry(h[2],
"Tracked, no doppler corrected",
"l");
999 TString Name =
"Tracked_3DHits";
1000 TString Title =
"3D view of the first hit of the tracked gamma";
virtual Bool_t IsValid() const
true if it is a valid pointer
virtual void GetDirection(Double_t &, Double_t &, Double_t &, Double_t=0.0) const =0
get the direction of the source (last argument is used in case the position depends on time) ...
virtual VertexInterface * GetVertex()
Get the vertex data interface.
virtual Double_t DoDopplerCorrection(const TrackedHit *hit, VertexInterface *vertex)
Do Doppler taking into account additionnal offset of the agat position (see SetAgataOffset) ...
printf("******************************************************************** \n")
virtual Double_t GetY() const
virtual void Exec(Option_t *option="")
watch the current frame
virtual ~TrackingWatcher()
******************************************************************************************/// ...
void ShowCommonSumTrackedDC(bool OnSamePad=false, const char *DC_NoDC="DC")
******************************************************************************************/// ...
virtual void GetPosition(Double_t &, Double_t &, Double_t &, Double_t=0.0) const =0
get the position of the source (last argument is used in case the position depends on time) ...
virtual Double_t GetE() const
virtual void DoCanvas(TCanvas *c, Option_t *)
To be overwritten by real implementation if a canvas is produced.
The tracking algorithm produces a stack of TrackedHits.
virtual void SetPosition(Double_t, Double_t, Double_t, Double_t=0.0)=0
Set the position of the source (last argument is used in case the position depends on time) ...
TH1F * fTrackedEnergyDopler
virtual Bool_t SetTrigger(ADF::DFTrigger *=0x0)
Set the trigger attached to this watcher.
virtual TrackedHit * GetGamma(UShort_t) const =0
To get the current number of gammas in the stack.
TCanvas * NewCanvas(TString cname, TString ctitle)
virtual Double_t GetBeta(Double_t=0.0) const =0
get recoil velocity
void Show3DHits()
******************************************************************************************/// ...
double GetTheta(const TrackedHit *hit, VertexInterface *vertex)
******************************************************************************************/// ...
void SetLastExecStatus(Short_t s=0)
reset last status. 0 means no error, 0 < means error, > 0 means ok with conditions ...
virtual Double_t GetT() const
virtual ~Coinc2D()
******************************************************************************************/// ...
void ShowTrackedSpectra(bool OnSamePad=false)
******************************************************************************************/// ...
virtual void DopplerCorrection(Hit *)=0
header file for AgataKeyFactory.cpp
void ShowETheta(const char *NoDC_DC_Both="DC")
******************************************************************************************/// ...
It is a hit associated to a list of Hits.
virtual void SetAgataOffset(Double_t offset=0.0)
set the agata offset in case it is not @ the optimal position
virtual Double_t GetX() const
void TagOn(TObject *)
Add this histogram to the list of tagged histograms.
virtual Double_t GetGamma(Double_t=0.0) const
TrackingWatcher(const char *name, const char *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
Base class for a trigger on a data flow.
TH1F * fTrackedEnergyDopler
ADF::LogMessage & endl(ADF::LogMessage &log)
void InitVertex(VertexInterface *vertex)
******************************************************************************************/// ...
virtual void SetDirection(Double_t, Double_t, Double_t, Double_t=0.0)=0
set the direction of the source (last argument is used in case the position depends on time) ...
virtual void GetXYZ(Double_t &x, Double_t &y, Double_t &z) const
virtual Double_t GetZ() const
virtual UShort_t GetNbGamma() const =0
To get the current number of gammas in the stack.
virtual void SetBeta(Double_t, Double_t=0.0)=0
set recoil velocity
void ShowGammaGamma(const char *NoDC_DC_Both="DC")
******************************************************************************************/// ...
Coinc2D(const char *name, const char *title, TDirectory *sp_dir=0x0, TDirectory *tag_dir=0x0)
*/
LogMessage & endl(LogMessage &)
Base Watcher working for any kind of Trackek Frame (Frame interface) and.
virtual void Exec(Option_t *option="")
watch the current frame
static VertexBuilder * theCurrentVertexBuilder()
to get the current VertexWatcher (for other watchers) i.e. the last one registered.