#include <DalitzHistogram.h>
|
| DalitzHistogram () |
|
| DalitzHistogram (const DalitzCoordSet &c, const DalitzEventPattern &p, int bins=200, double units=GeV *GeV) |
|
| DalitzHistogram (const DalitzHistogram &other) |
|
virtual | ~DalitzHistogram () |
|
const std::string & | name () const |
|
void | smartTitle (const DalitzCoordSet &c_in, const DalitzEventPattern &pat_in) |
|
const std::string | smartTitle () const |
|
const std::string | hname () const |
|
const std::string & | htitle () const |
|
const std::string & | dirName () const |
|
const DalitzEventPattern & | pattern () const |
|
void | init (const DalitzCoordSet &c, const DalitzEventPattern &p, int bins=100, double units=GeV *GeV) |
|
bool | saveAsDir (const std::string &asSubdirOf=".") const |
|
bool | retrieveFromDir (const std::string &asSubdirOf=".", const char *theName=0) |
|
void | add (const DalitzHistogram &addMeToYou, double weight=1) |
|
void | multiply (const DalitzHistogram &multiplyWith) |
|
void | divide (const DalitzHistogram ÷By) |
|
void | setNormFactor (double f=1) |
|
void | addEvent (const IDalitzEvent &evt, double weight=1) |
|
MINT::const_counted_ptr< TH1 > | histo () const |
|
MINT::counted_ptr< TH1 > | histo () |
|
const DalitzCoordSet & | coord () const |
|
DalitzCoordSet & | coord () |
|
void | scale (double sf) |
|
void | setTitle (const std::string &title) |
|
void | clearHisto () |
|
bool | draw (const std::string &baseName="", const std::string &drawOpt="", const std::string &format="eps") const |
|
bool | drawWithFit (const DalitzHistogram &fit, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const |
|
bool | drawWithFit (TCanvas &can, const DalitzHistogram &fit, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const |
|
bool | drawEachAmp (TCanvas &can, const std::string &baseName="", const std::string &drawOpt="SAME", const std::string &format="eps") const |
|
MINT::counted_ptr< TH1 > | getHisto () |
|
double | integral () const |
|
DalitzHistogram & | operator= (const DalitzHistogram &other) |
|
|
void | makeName () |
|
bool | makeDirectory (const std::string &asSubdirOf=".") const |
|
std::string | valueFileName (const std::string &asSubdirOf=".", const char *theName=0) const |
|
std::string | histoFileName (const std::string &asSubdirOf=".", const char *theName=0) const |
|
bool | saveValues (const std::string &inDir=".") const |
|
bool | retrieveValues (const std::string &fromDirectory, const char *theName=0) |
|
bool | saveHisto (const std::string &inDir=".") const |
|
bool | retrieveHisto (const std::string &fromDir, const char *theName=0) |
|
Definition at line 24 of file DalitzHistogram.h.
◆ DalitzHistogram() [1/3]
DalitzHistogram::DalitzHistogram |
( |
| ) |
|
Definition at line 34 of file DalitzHistogram.cpp.
MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
◆ DalitzHistogram() [2/3]
Definition at line 40 of file DalitzHistogram.cpp.
MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
void init(const DalitzCoordSet &c, const DalitzEventPattern &p, int bins=100, double units=GeV *GeV)
◆ DalitzHistogram() [3/3]
Definition at line 93 of file DalitzHistogram.cpp.
107 cout <<
"Error in DalitzHistogram copy constructor" 114 cout <<
"DalitzHistogram copy ctor" << endl;
115 cout <<
"pat before: " << other.
_pat 116 <<
", and after " <<
_pat << endl;
MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
◆ ~DalitzHistogram()
DalitzHistogram::~DalitzHistogram |
( |
| ) |
|
|
virtual |
◆ add()
void DalitzHistogram::add |
( |
const DalitzHistogram & |
addMeToYou, |
|
|
double |
weight = 1 |
|
) |
| |
Definition at line 247 of file DalitzHistogram.cpp.
250 if(0 == addMeToYou.
histo()){
251 cout <<
"WARNING in DalitzHistogram::add(const DalitzHistogram&): " 252 <<
" Trying to add a DalitzHistogram w/o histogram to me" 253 <<
" I'll treat it as a zero (i.e. I'll do nothing)." 259 cout <<
"WARNING in DalitzHistogram::add(const DalitzHistogram&): " 260 <<
" Trying to add a DalitzHistogram to me although I have" 261 <<
" no histogram myself - treating myself as zero." 264 (*this) = addMeToYou;
271 if(
_c != addMeToYou.
_c){
272 cout <<
"WARNING in DalitzHistogram::add(const DalitzHistogram&): " 273 <<
" adding histograms for different co-ordinates!" 274 <<
"\n\t" <<
_c <<
" != " << addMeToYou.
_c 275 <<
"\n\t I'll go ahead with it, but it might not be what you want." 278 _h->Add((addMeToYou.
histo().get()), weight);
MINT::counted_ptr< TH1 > _h
MINT::const_counted_ptr< TH1 > histo() const
const std::string hname() const
const std::string & htitle() const
◆ addEvent()
void DalitzHistogram::addEvent |
( |
const IDalitzEvent & |
evt, |
|
|
double |
weight = 1 |
|
) |
| |
Definition at line 361 of file DalitzHistogram.cpp.
363 cout <<
"Error in DalitzHistogram::addEvent: trying to fill empty histogram" MINT::counted_ptr< TH1 > _h
virtual double sij(const MINT::PolymorphVector< int > &indices) const =0
std::map< Key, Val >::iterator begin()
◆ clearHisto()
void DalitzHistogram::clearHisto |
( |
| ) |
|
◆ coord() [1/2]
◆ coord() [2/2]
◆ dirName()
const std::string & DalitzHistogram::dirName |
( |
| ) |
const |
◆ divide()
Definition at line 321 of file DalitzHistogram.cpp.
324 if(0 == divideBy.
histo()){
325 cout <<
"WARNING in DalitzHistogram::divide(const DalitzHistogram&): " 326 <<
" Trying to divide a DalitzHistogram w/o histogram to me" 327 <<
" I guess I should crash, but I'll do nothing." 334 cout <<
"WARNING in DalitzHistogram::divide(const DalitzHistogram&): " 335 <<
" Trying to divide a DalitzHistogram to me although I have" 336 <<
" no histogram myself - treating myself as zero." 341 cout <<
"Error in DalitzHistogram::divide: _h = " <<
_h << endl;
351 if(
_c != divideBy.
_c){
352 cout <<
"WARNING in DalitzHistogram::divide(const DalitzHistogram&): " 353 <<
" divideing histograms for different co-ordinates!" 354 <<
"\n\t" <<
_c <<
" != " << divideBy.
_c 355 <<
"\n\t I'll go ahead with it, but it might not be what you want." 358 _h->Divide((divideBy.
histo().get()));
MINT::counted_ptr< TH1 > _h
MINT::const_counted_ptr< TH1 > histo() const
const std::string hname() const
const std::string & htitle() const
◆ draw()
bool DalitzHistogram::draw |
( |
const std::string & |
baseName = "" , |
|
|
const std::string & |
drawOpt = "" , |
|
|
const std::string & |
format = "eps" |
|
) |
| const |
Definition at line 383 of file DalitzHistogram.cpp.
387 if(0 ==
_h)
return false;
390 _h->Draw(drawOpt.c_str());
391 can.Print(fname.c_str());
std::string nameFileSave() const
MINT::counted_ptr< TH1 > _h
◆ drawEachAmp()
bool DalitzHistogram::drawEachAmp |
( |
TCanvas & |
can, |
|
|
const std::string & |
baseName = "" , |
|
|
const std::string & |
drawOpt = "SAME" , |
|
|
const std::string & |
format = "eps" |
|
) |
| const |
Definition at line 763 of file DalitzHistogram.cpp.
768 if(0 ==
_h)
return false;
770 _h->Draw(drawOpt.c_str());
std::string nameFileSave() const
MINT::counted_ptr< TH1 > _h
◆ drawWithFit() [1/2]
bool DalitzHistogram::drawWithFit |
( |
const DalitzHistogram & |
fit, |
|
|
const std::string & |
baseName = "" , |
|
|
const std::string & |
format = "eps" , |
|
|
const std::string & |
fitDrawOpt = "HIST C SAME" |
|
) |
| const |
Definition at line 673 of file DalitzHistogram.cpp.
678 if(0 ==
_h)
return false;
684 cout <<
"Error in DalitzHistogram::drawWithFit, failed to clone histo h_c" 688 h_c->SetDirectory(0);
691 cout <<
"Error in DalitzHistogram::drawWithFit, failed to clone histo fit_c" 695 fit_c->SetDirectory(0);
696 fit_c->Scale(h_c->Integral()/fit_c->Integral());
698 double maxiThis = h_c->GetMaximum();
699 double maxiThat = fit_c->GetMaximum();
701 if(maxiThat > maxiThis) h_c->SetMaximum(maxiThat*1.05);
706 fit_c->SetLineWidth(3);
707 fit_c->SetLineColor(2);
708 fit_c->SetMarkerColor(2);
710 fit_c->Draw(fitDrawOpt.c_str());
711 can.Print(fname.c_str());
std::string nameFileSave() const
MINT::counted_ptr< TH1 > _h
MINT::const_counted_ptr< TH1 > histo() const
◆ drawWithFit() [2/2]
bool DalitzHistogram::drawWithFit |
( |
TCanvas & |
can, |
|
|
const DalitzHistogram & |
fit, |
|
|
const std::string & |
baseName = "" , |
|
|
const std::string & |
format = "eps" , |
|
|
const std::string & |
fitDrawOpt = "HIST C SAME" |
|
) |
| const |
Definition at line 715 of file DalitzHistogram.cpp.
721 if(0 ==
_h)
return false;
726 cout <<
"Error in DalitzHistogram::drawWithFit 2" 727 <<
", failed to clone histo h_c" 731 h_c->SetDirectory(0);
735 cout <<
"Error in DalitzHistogram::drawWithFit 2" 736 <<
", failed to clone histo fit_c" 740 fit_c->SetDirectory(0);
741 fit_c->Scale(h_c->Integral()/fit_c->Integral());
743 double maxiThis = h_c->GetMaximum();
744 double maxiThat = fit_c->GetMaximum();
746 if(maxiThat > maxiThis) h_c->SetMaximum(maxiThat*1.05);
751 fit_c->SetLineWidth(3);
752 fit_c->SetLineColor(2);
753 fit_c->SetMarkerColor(2);
755 fit_c->Draw(fitDrawOpt.c_str());
756 can.Print(fname.c_str());
std::string nameFileSave() const
MINT::counted_ptr< TH1 > _h
MINT::const_counted_ptr< TH1 > histo() const
◆ getHisto()
◆ histo() [1/2]
◆ histo() [2/2]
◆ histoFileName()
std::string DalitzHistogram::histoFileName |
( |
const std::string & |
asSubdirOf = "." , |
|
|
const char * |
theName = 0 |
|
) |
| const |
|
private |
Definition at line 503 of file DalitzHistogram.cpp.
511 return asSubdirOf +
"/" + dir +
"/histo.root";
const std::string & dirName() const
◆ hname()
const std::string DalitzHistogram::hname |
( |
| ) |
const |
Definition at line 480 of file DalitzHistogram.cpp.
482 for(std::string::const_iterator it =
name().begin();
483 it !=
name().end(); it++){
484 if(
'(' == *it ||
')'== *it)
s +=
"_";
485 else if(
',' == *it)
s +=
"_";
const std::string & name() const
◆ htitle()
const std::string & DalitzHistogram::htitle |
( |
| ) |
const |
◆ init()
Definition at line 175 of file DalitzHistogram.cpp.
192 for(std::map<DalitzCoordKey, DalitzCoordinate>::iterator it =
_c.
begin();
193 it !=
_c.
end(); it++){
202 it->second.setMin(mi);
203 it->second.setMax(ma);
211 cout <<
"Error in DalitzHistogram::init: local_h = " << local_h << endl;
214 local_h->SetDirectory(0);
215 local_h->SetNameTitle(
hname().c_str(),
"");
217 local_h->SetLineWidth(2);
219 std::string unitsName;
224 else if(
_units ==
eV*
eV) unitsName =
"eV^{2}";
229 std::string XLabel = (string)
smartTitle().c_str()+
" [" + (string)unitsName +
"]";
230 local_h->GetXaxis()->SetTitle(XLabel.c_str());
231 local_h->GetXaxis()->SetTitleSize();
233 double bw = (ma - mi)/((
double)
_nbins);
235 sprintf(
s,
"%f", bw);
237 std::string YLabel =
"Yield / " + st +
" " + unitsName;
239 local_h->GetYaxis()->SetTitle(YLabel.c_str());
double sijMax(const MINT::PolymorphVector< int > &indices) const
const std::string smartTitle() const
MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
const std::string & name() const
std::map< Key, Val >::iterator end()
const std::string hname() const
std::vector< int > getVectorOfInts() const
double sijMin(const MINT::PolymorphVector< int > &indices) const
std::map< Key, Val >::iterator begin()
std::string anythingToString(const T &anything)
◆ integral()
double DalitzHistogram::integral |
( |
| ) |
const |
Definition at line 776 of file DalitzHistogram.cpp.
777 if(0 ==
_h)
return 0;
778 return _h->Integral();
MINT::counted_ptr< TH1 > _h
◆ makeDirectory()
bool DalitzHistogram::makeDirectory |
( |
const std::string & |
asSubdirOf = "." | ) |
const |
|
private |
Definition at line 427 of file DalitzHistogram.cpp.
451 mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO
456 int zeroForSuccess = 0;
457 zeroForSuccess |= mkdir( (asSubdirOf ).c_str(), mode );
458 zeroForSuccess |= mkdir( (asSubdirOf +
"/" +
dirName() ).c_str(), mode );
459 return (0 == zeroForSuccess);
const std::string & dirName() const
◆ makeName()
void DalitzHistogram::makeName |
( |
| ) |
|
|
private |
◆ multiply()
Definition at line 281 of file DalitzHistogram.cpp.
284 if(0 == multiplyWith.
histo()){
285 cout <<
"WARNING in DalitzHistogram::multiply(const DalitzHistogram&): " 286 <<
" Trying to mulitply a DalitzHistogram w/o histogram to me" 287 <<
" I'll treat it as a zero (i.e. I'll clear myself of entries)." 294 cout <<
"WARNING in DalitzHistogram::multiply(const DalitzHistogram&): " 295 <<
" Trying to multiply a DalitzHistogram to me although I have" 296 <<
" no histogram myself - treating myself as zero." 301 cout <<
"Error DalitzHistogram::multiply: _h = " <<
_h << endl;
302 throw "should not happen";
305 _c = multiplyWith.
_c;
311 if(
_c != multiplyWith.
_c){
312 cout <<
"WARNING in DalitzHistogram::multiply(const DalitzHistogram&): " 313 <<
" multiplying histograms for different co-ordinates!" 314 <<
"\n\t" <<
_c <<
" != " << multiplyWith.
_c 315 <<
"\n\t I'll go ahead with it, but it might not be what you want." 318 _h->Multiply((multiplyWith.
histo().get()));
MINT::counted_ptr< TH1 > _h
MINT::const_counted_ptr< TH1 > histo() const
const std::string hname() const
const std::string & htitle() const
◆ name()
const std::string& DalitzHistogram::name |
( |
| ) |
const |
|
inline |
◆ operator=()
Definition at line 123 of file DalitzHistogram.cpp.
124 if(0 != other.
histo()){
127 cout <<
"Error in DalitzHistogram = operator" MINT::counted_ptr< TH1 > _h
std::vector< int > _patForTree
MINT::const_counted_ptr< TH1 > histo() const
◆ pattern()
◆ retrieveFromDir()
bool DalitzHistogram::retrieveFromDir |
( |
const std::string & |
asSubdirOf = "." , |
|
|
const char * |
theName = 0 |
|
) |
| |
Definition at line 468 of file DalitzHistogram.cpp.
471 if(0 != theName)
_name = theName;
bool retrieveHisto(const std::string &fromDir, const char *theName=0)
bool retrieveValues(const std::string &fromDirectory, const char *theName=0)
◆ retrieveHisto()
bool DalitzHistogram::retrieveHisto |
( |
const std::string & |
fromDir, |
|
|
const char * |
theName = 0 |
|
) |
| |
|
private |
Definition at line 640 of file DalitzHistogram.cpp.
645 TFile* f = TFile::Open(fn.c_str(),
"READ");
647 cout <<
"ERROR in DalitzHistogram::retrieveHisto: cannot open file " 651 TH1* th = (TH1*) f->Get(
hname().c_str());
653 cout <<
"ERROR in DalitzHistogram::retrieveHisto" 654 <<
"\n\t can't find histogram " <<
hname()
655 <<
"\n\t in file " << fn << endl;
656 throw "errorRetrievingHisto";
660 cth->SetDirectory(0);
664 cout <<
"DalitzHistogram::retrieveHisto" 665 <<
"\n\t retrieved histogram " <<
hname()
666 <<
"\n\t in file " << fn << endl;
667 cout <<
"\t the ptr " <<
_h.
get() << endl;
668 cout <<
"\t the name " <<
_h->GetTitle() << endl;
std::string histoFileName(const std::string &asSubdirOf=".", const char *theName=0) const
MINT::counted_ptr< TH1 > _h
const std::string hname() const
◆ retrieveValues()
bool DalitzHistogram::retrieveValues |
( |
const std::string & |
fromDirectory, |
|
|
const char * |
theName = 0 |
|
) |
| |
|
private |
Definition at line 553 of file DalitzHistogram.cpp.
557 if(dbThis)cout <<
"trying fname = " << fname << endl;
std::string valueFileName(const std::string &asSubdirOf=".", const char *theName=0) const
bool reloadFile(const std::string &id)
◆ saveAsDir()
bool DalitzHistogram::saveAsDir |
( |
const std::string & |
asSubdirOf = "." | ) |
const |
Definition at line 462 of file DalitzHistogram.cpp.
bool saveHisto(const std::string &inDir=".") const
bool saveValues(const std::string &inDir=".") const
bool makeDirectory(const std::string &asSubdirOf=".") const
◆ saveHisto()
bool DalitzHistogram::saveHisto |
( |
const std::string & |
inDir = "." | ) |
const |
|
private |
Definition at line 592 of file DalitzHistogram.cpp.
595 cout <<
"DalitzHistogram::saveHisto( " << inDir <<
" ) got called" 601 if(0 ==
_h)
return false;
607 cout <<
"DalitzHistogram::saveHisto: tryring to save " << fn
610 TFile* f = TFile::Open(fn.c_str(),
"RECREATE");
612 cout <<
"DalitzHistogram::saveHisto(const std::string& inDir)" 613 <<
" failed to open file " << fn << endl;
617 cout <<
"file isOpen " << f->IsOpen() << endl;
618 cout <<
"file isWritable " << f->IsWritable() << endl;
620 if(! f->IsWritable()){
621 cout <<
"File " << fn <<
" not writeable" << endl;
626 cout <<
"cd'ed to file" << endl;
627 cout <<
"number of entries in _h " <<
_h->GetEntries() << endl;
628 cout <<
"now about to write " << endl;
631 if(dbThis) cout <<
"done writing. now closing" << endl;
634 if(dbThis) cout <<
"closed it. Now returning true" << endl;
std::string histoFileName(const std::string &asSubdirOf=".", const char *theName=0) const
MINT::counted_ptr< TH1 > _h
◆ saveValues()
bool DalitzHistogram::saveValues |
( |
const std::string & |
inDir = "." | ) |
const |
|
private |
Definition at line 514 of file DalitzHistogram.cpp.
517 , NamedParameterBase::QUIET);
519 ,NamedParameterBase::QUIET);
521 , NamedParameterBase::QUIET);
523 , NamedParameterBase::QUIET);
525 , NamedParameterBase::QUIET);
529 n_c = (std::vector<int>)
_c.
begin()->first;
536 ofstream os(fname.c_str());
538 cout <<
"ERROR in DalitzHistogram::saveValues of \n\t" <<
name()
539 <<
"\n\t unable to create file: " 540 <<
"\n\t" << fname << endl;
std::string valueFileName(const std::string &asSubdirOf=".", const char *theName=0) const
const std::string & name() const
std::vector< int > getVectorOfInts() const
std::map< Key, Val >::iterator begin()
◆ scale()
void DalitzHistogram::scale |
( |
double |
sf | ) |
|
◆ setNormFactor()
void DalitzHistogram::setNormFactor |
( |
double |
f = 1 | ) |
|
|
inline |
◆ setTitle()
void DalitzHistogram::setTitle |
( |
const std::string & |
title | ) |
|
◆ smartTitle() [1/2]
Definition at line 149 of file DalitzHistogram.cpp.
153 TString c_out = c_in.
name();
154 for (
unsigned int i = 1; i< pat_in.
size(); i++)
157 c_out.ReplaceAll(sij,pat_in[i].
name());
159 c_out.ReplaceAll(
"sij",
"m^{2}");
160 c_out.ReplaceAll(
"K+",
"K^{+}");
161 c_out.ReplaceAll(
"pi+",
"#pi^{+}");
162 c_out.ReplaceAll(
"pi-",
"#pi^{-}");
163 c_out.ReplaceAll(
"Jpsi0",
"J/#psi");
164 c_out.ReplaceAll(
"psi0",
"#psi");
165 c_out.ReplaceAll(
"gamma0",
"#gamma");
167 c_out.ReplaceAll(
",",
" ");
const std::string & name() const
std::string convertInt(int number)
unsigned int size() const
◆ smartTitle() [2/2]
const std::string DalitzHistogram::smartTitle |
( |
| ) |
const |
◆ valueFileName()
std::string DalitzHistogram::valueFileName |
( |
const std::string & |
asSubdirOf = "." , |
|
|
const char * |
theName = 0 |
|
) |
| const |
|
private |
Definition at line 493 of file DalitzHistogram.cpp.
501 return asSubdirOf +
"/" + dir +
"/value.txt";
const std::string & dirName() const
◆ _c
◆ _h
◆ _name
std::string DalitzHistogram::_name |
|
private |
◆ _nbins
int DalitzHistogram::_nbins |
|
private |
◆ _pat
◆ _patForTree
std::vector<int> DalitzHistogram::_patForTree |
|
private |
◆ _smartTitle
std::string DalitzHistogram::_smartTitle |
|
private |
◆ _tree
TTree* DalitzHistogram::_tree |
|
mutableprivate |
◆ _units
double DalitzHistogram::_units |
|
private |
The documentation for this class was generated from the following files: