27 #ifndef Gw_CubicFilter
31 #ifndef Gw_CorrelatedSpace
39 #ifndef Gw_PeakCreator
72 const TString CSManager::fgkFilterFolderName = "Filter";
73 Int_t CSManager::fgNofInstance = 0;
76 CSManager::CSManager()
77 : TNamed("CSManager", "Default"),
79 fFilterBaseName("
Gate"),
84 fRegCS->SetOwner(
false);
91 : TNamed(name, title),
93 fFilterBaseName(
"Gate"),
110 TFolder* folder = (TFolder*)gROOT->FindObjectAny(nameFolder.Data());
112 folder = gROOT->GetRootFolder()->AddFolder(fgkFolderName.Data(),
"Folder");
115 if ((
CorrelatedSpace*)gROOT->FindObjectAny(Form(
"%s/%s", nameFolder.Data(), GetName())) ) {
116 SetName(Form(
"%s%d", GetName(),
fCInstance-1));
122 TFolder* folderFilter = (TFolder*)gROOT->FindObjectAny(nameFolder.Data());
123 if (folderFilter == 0x0) {
124 folder->AddFolder(Form(
"%s_%s",GetName(), fgkFilterFolderName.Data()),
"Folder");
126 folderFilter = (TFolder*)gROOT->FindObjectAny(nameFolder.Data());
127 folderFilter->SetOwner(
true);
135 for (Int_t i = 0; i < filter->
GetNofPeaks(); ++i) {
156 TString nameFolder = fgkFolderName;
157 nameFolder.Prepend(
"/");
165 TString nameFolder = fgkFolderName;
166 nameFolder.Prepend(
"/");
167 nameFolder.Append(
"/");
168 nameFolder.Append(Form(
"%s_%s",GetName(), fgkFilterFolderName.Data()));
175 TSeqCollection* listCanvas = gROOT->GetListOfCanvases();
177 TString name(GetName());
178 TCanvas* canvas = 0x0;
179 TIter next(listCanvas);
181 while ( (canvas = (TCanvas*)next()) ) {
182 if ( !name.CompareTo(canvas->GetName()) ) {
188 canvas =
new TCanvas(GetName(), GetTitle());
191 canvas->SetLeftMargin(0.12);
192 canvas->SetRightMargin(0.05);
196 Int_t entries =
fRegCS->GetEntries()*2;
197 canvas->Divide(1,entries);
208 return canvas->cd(2*idx+1);
215 return canvas->cd(2*idx+2);
222 Int_t entries =
fRegCS->GetEntries();
224 for (Int_t i = 0; i < entries; ++i) {
240 proj->SetYTitle(
"Number of Counts");
241 proj->SetXTitle(
"Energy");
242 proj->SetTitleOffset(1.2,
"X");
243 proj->SetTitleOffset(1.5,
"Y");
244 proj->SetLabelOffset(0.01);
247 proj->Add(projBkg, -ratio);
251 filter->
Draw(
"gate");
259 Int_t entries =
fRegCS->GetEntries();
261 for (Int_t i = 0; i < entries; ++i) {
265 proj->SetYTitle(
"Number of Counts");
266 proj->SetXTitle(
"Energy");
267 proj->SetTitleOffset(1.2,
"X");
268 proj->SetTitleOffset(1.5,
"Y");
269 proj->SetLabelOffset(0.01);
294 Int_t entries =
fRegCS->GetEntries();
296 for (Int_t i = 0; i < entries; ++i) {
299 if (option.Contains(
"reset")) {
303 TVirtualPad* cpad = 0x0;
304 cpad = hC->GetPad(2*i+1);
306 TIter next(cpad->GetListOfPrimitives());
307 while ( (obj = next()) ) {
308 if ( obj->InheritsFrom(
"TH1") )
310 if ( obj->InheritsFrom(
"Gw::BasePeak") ) {
344 if (iCS >=
fRegCS->GetEntries()) {
359 if (iCS >=
fRegCS->GetEntries()) {
374 if (iCS >=
fRegCS->GetEntries()) {
392 TFolder *folder = (TFolder*)gROOT->FindObjectAny(nameFolder.Data());
399 TString name = nameFolder;
401 name.Append(gateName);
405 if ( filter == 0x0 ) {
407 filter->SetName(gateName);
416 if (
fRegCS->GetEntries() <= 0) {
425 for (Int_t i = 0; i <
fRegCS->GetEntries(); ++i) {
void AddPeak(BasePeak *peak, Option_t *opt="update")
Add Peak.
TVirtualPad * GetProjPad(Int_t idx)
Get pad of projected spectrum for a given CS.
Int_t GetNofPeaks() const
Get number of peaks.
header file for PeakCreator.cpp
LogMessage & error(LogMessage &)
TH1D * GetHistoTot(Option_t *axis="x", Int_t iCS=0) const
Get projection total.
header file for all type of CSManager
void Register(CorrelatedSpace *cs)
Add correlated space.
Int_t fCInstance
filter base name
CubicFilter class for cubic gates.
BasePeak * GetPeak(Int_t idx) const
Get peak.
CSManager correlated spaces manager.
static PeakCreator * AddPeakCreator(TVirtualPad *pad=0x0)
add a peak creator to the given pad. Current pad if argument is 0x0
Float_t GetRatio(CSFilter *filter)
Get ratio for removing bgk spectrum from the gated one.
LogMessage fLog
flag for canvas division
void Project(Option_t *axis)
Project.
void EnableCanvasDiv()
Enable again canvas division.
void Draw(Option_t *opt)
Draw peaks.
virtual Color_t GetLineColorPeak()
Get line peak color.
Double_t GetSubPeakIntegral() const
Get integral of background under peak after calling area method.
LogMessage & dolog(LogMessage &)
void SetFolders()
log message
void MakeGates(Option_t *opt="peak")
Make gates.
CSFilter base class for filter.
static Bool_t IsvalideGateColor(Color_t co)
TString GetFilterFolderName()
TH1D * GetHisto(Int_t iCS) const
Get histogramm.
void DrawProj(Option_t *opt)
Draw projection.
Double_t GetBkgIntegral() const
Get integral of background after calling area method.
TH1D * GetHistoBkg(Int_t iCS) const
Get histogramm.
void Convert(CorrelatedSpace *src, CorrelatedSpace *dst)
Convert correlated space to another correlated space.
header file for a general 1D peak
TList * fRegCS
number of instances
virtual void Area(Option_t *opt="h")
to get the Area (+bkg) of this peak
Int_t CollectGate(Option_t *opt="reset")
Collect gates on spectra.
void DrawProjTot(Option_t *opt, Option_t *axis="x")
Draw total projection.
A graphical interface for placing schematic peak onto a 1D histogram with a given position...
virtual void SetProcessMethod(const char *)
To set the current method.
CSFilter * GetFilter(Option_t *gateName="Gate")
Get Filter.
Bool_t fIsCanvasDiv
number of CS manager instanced
const Char_t * GetFilterBaseName()
Get Filter Base Name.
TVirtualPad * GetProjTotPad(Int_t idx)
Get pad of total projection spectrum for a given CS.
TCanvas * GetCanvas()
Start view.