MINT2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DalitzHistoSet Class Reference

#include <DalitzHistoSet.h>

Inheritance diagram for DalitzHistoSet:
MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram >

Public Member Functions

 DalitzHistoSet ()
 
 DalitzHistoSet (const DalitzHistoSet &other)
 
virtual ~DalitzHistoSet ()
 
void add (const DalitzHistogram &histo, double weight=1)
 
void add (const DalitzHistoSet &hL, double weight=1)
 
void multiply (const DalitzHistogram &hL)
 
void multiply (const DalitzHistoSet &hL)
 
void divide (const DalitzHistogram &hL)
 
void divide (const DalitzHistoSet &hL)
 
void addEvent (const IDalitzEvent &evt, double weight=1)
 
void scale (double sf)
 
void setNormFactor (double sf=1)
 
void clearAllHistos ()
 
const std::string & name () const
 
const std::string & dirName () const
 
std::string fullDirListFname (const std::string &asSubdirOf=".") const
 
bool saveAsDir (const std::string &asSubdirOf=".") const
 
bool retrieveFromDir (const std::string &asSubDirOf=".")
 
bool save (const std::string &filename="DalitzHistos.root") const
 
bool draw (const std::string &baseName="", const std::string &drawOpt="", const std::string &format="eps") const
 
bool drawWithFit (const DalitzHistoSet &fit, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const
 
bool drawWithFitAndEachAmps (DalitzHistoSet &data, DalitzHistoSet &fit, std::vector< DalitzHistoSet > &amps, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const
 
bool drawWithFitAndEachAmpsAndInterference (DalitzHistoSet &data, DalitzHistoSet &fit, DalitzHistoSet &interference, std::vector< DalitzHistoSet > &amps, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const
 
bool drawWithFitNorm (const DalitzHistoSet &fit, const std::string &baseName="", const std::string &format="eps", const std::string &fitDrawOpt="HIST C SAME") const
 
void setTitle (const std::string &title)
 
void setFillColour (Color_t fcolor)
 
void setLineColour (Color_t fcolor)
 
double integral () const
 
DalitzHistoSetoperator *= (double sf)
 
DalitzHistoSet operator * (double sf) const
 
DalitzHistoSetoperator/= (double sf)
 
DalitzHistoSet operator/ (double sf) const
 
DalitzHistoSetoperator+= (const DalitzHistoSet &rhs)
 
DalitzHistoSet operator+ (const DalitzHistoSet &rhs) const
 
DalitzHistoSetoperator-= (const DalitzHistoSet &rhs)
 
DalitzHistoSet operator- (const DalitzHistoSet &rhs) const
 
DalitzHistoSetoperator *= (const DalitzHistoSet &rhs)
 
DalitzHistoSet operator * (const DalitzHistoSet &rhs) const
 
DalitzHistoSetoperator/= (const DalitzHistoSet &rhs)
 
DalitzHistoSet operator/ (const DalitzHistoSet &rhs) const
 
- Public Member Functions inherited from MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram >
 PolymorphMap ()
 
 PolymorphMap (const PolymorphMap &other)
 
 PolymorphMap (const typename std::map< DalitzCoordSet, DalitzHistogram > &other)
 
virtual ~PolymorphMap ()
 
std::map< DalitzCoordSet, DalitzHistogram > & theMap ()
 
const std::map< DalitzCoordSet, DalitzHistogram > & theMap () const
 
DalitzHistogramoperator[] (const DalitzCoordSet &k)
 
const DalitzHistogramoperator[] (const DalitzCoordSet &k) const
 
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin ()
 
std::map< DalitzCoordSet, DalitzHistogram >::const_iterator begin () const
 
std::map< DalitzCoordSet, DalitzHistogram >::iterator end ()
 
std::map< DalitzCoordSet, DalitzHistogram >::const_iterator end () const
 
std::map< DalitzCoordSet, DalitzHistogram >::iterator find (const DalitzCoordSet &c)
 
std::map< DalitzCoordSet, DalitzHistogram >::const_iterator find (const DalitzCoordSet &c) const
 
void insert (typename std::map< DalitzCoordSet, DalitzHistogram >::const_iterator first, typename std::map< DalitzCoordSet, DalitzHistogram >::const_iterator last)
 
unsigned int size () const
 
bool empty () const
 
PolymorphMap< DalitzCoordSet, DalitzHistogram > & operator= (const PolymorphMap &other)
 
void clear ()
 
void resize (unsigned int N)
 
void resize (unsigned int N, const DalitzHistogram &c)
 
 operator const typename std::map< DalitzCoordSet, DalitzHistogram > & () const
 
 operator typename std::map< DalitzCoordSet, DalitzHistogram > & ()
 
bool operator== (const MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram > &v2) const
 
bool operator!= (const MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram > &v2) const
 
bool operator< (const MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram > &v2) const
 
bool operator> (const MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram > &v2) const
 

Private Member Functions

void makeHistograms (const DalitzEventPattern &pat)
 
bool makeDirectory (const std::string &asSubdirOf) const
 
const std::string & makeName ()
 

Private Attributes

std::string _name
 
std::map< DalitzCoordSet, DalitzHistogram_theMap
 

Additional Inherited Members

- Protected Attributes inherited from MINT::PolymorphMap< DalitzCoordSet, DalitzHistogram >
std::map< DalitzCoordSet, DalitzHistogram_map
 

Detailed Description

Definition at line 20 of file DalitzHistoSet.h.

Constructor & Destructor Documentation

◆ DalitzHistoSet() [1/2]

DalitzHistoSet::DalitzHistoSet ( )

Definition at line 21 of file DalitzHistoSet.cpp.

22 {
23  //TH1::AddDirectory(kFALSE);
24  makeName();
25 }
const std::string & makeName()

◆ DalitzHistoSet() [2/2]

DalitzHistoSet::DalitzHistoSet ( const DalitzHistoSet other)

Definition at line 27 of file DalitzHistoSet.cpp.

28  : PolymorphMap( other )
29 {
30  //TH1::AddDirectory(kFALSE);
31  makeName();
32 }
const std::string & makeName()

◆ ~DalitzHistoSet()

DalitzHistoSet::~DalitzHistoSet ( )
virtual

Definition at line 34 of file DalitzHistoSet.cpp.

34  {
35 
36 }

Member Function Documentation

◆ add() [1/2]

void DalitzHistoSet::add ( const DalitzHistogram histo,
double  weight = 1 
)

Definition at line 52 of file DalitzHistoSet.cpp.

52  {
53  (*this)[histo.coord()].add(histo, weight);
54  return;
55 }
const DalitzCoordSet & coord() const

◆ add() [2/2]

void DalitzHistoSet::add ( const DalitzHistoSet hL,
double  weight = 1 
)

Definition at line 56 of file DalitzHistoSet.cpp.

56  {
57  for(std::map< DalitzCoordSet, DalitzHistogram>::const_iterator it = hL.begin();
58  it != hL.end();
59  it++){
60  this->add(it->second, weight);
61  }
62  return;
63 }
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26
void add(const DalitzHistogram &histo, double weight=1)

◆ addEvent()

void DalitzHistoSet::addEvent ( const IDalitzEvent evt,
double  weight = 1 
)

Definition at line 89 of file DalitzHistoSet.cpp.

89  {
90  int ndgtr(evt.eventPattern().numDaughters());
91  if(this->empty() && ndgtr > 2) makeHistograms(evt.eventPattern());
92 
93  for(map< DalitzCoordSet, DalitzHistogram>::iterator
94  it = this->begin();
95  it != this->end();
96  it++){
97  it->second.addEvent(evt, weight);
98  }
99  return;
100 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
void makeHistograms(const DalitzEventPattern &pat)
virtual const DalitzEventPattern & eventPattern() const =0
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ clearAllHistos()

void DalitzHistoSet::clearAllHistos ( )

Definition at line 158 of file DalitzHistoSet.cpp.

158  {
159  if(this->empty()) return;
160  for(map< DalitzCoordSet, DalitzHistogram>::iterator
161  it = this->begin();
162  it != this->end();
163  it++){
164  it->second.clearHisto();
165  }
166  return;
167 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ dirName()

const std::string & DalitzHistoSet::dirName ( ) const

Definition at line 178 of file DalitzHistoSet.cpp.

178  {
179  return _name;
180 }
std::string _name

◆ divide() [1/2]

void DalitzHistoSet::divide ( const DalitzHistogram hL)

Definition at line 76 of file DalitzHistoSet.cpp.

76  {
77  (*this)[histo.coord()].divide(histo);
78  return;
79 }

◆ divide() [2/2]

void DalitzHistoSet::divide ( const DalitzHistoSet hL)

Definition at line 80 of file DalitzHistoSet.cpp.

80  {
81  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator it = hL.begin();
82  it != hL.end();
83  it++){
84  this->divide(it->second);
85  }
86  return;
87 }
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
void divide(const DalitzHistogram &hL)
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26

◆ draw()

bool DalitzHistoSet::draw ( const std::string &  baseName = "",
const std::string &  drawOpt = "",
const std::string &  format = "eps" 
) const

Definition at line 310 of file DalitzHistoSet.cpp.

313  {
314  bool sc=true;
315  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator
316  it = this->begin();
317  it != this->end();
318  it++){
319  sc &= it->second.draw(baseName, drawOpt, format);
320  }
321  return sc;
322 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ drawWithFit()

bool DalitzHistoSet::drawWithFit ( const DalitzHistoSet fit,
const std::string &  baseName = "",
const std::string &  format = "eps",
const std::string &  fitDrawOpt = "HIST C SAME" 
) const

Definition at line 324 of file DalitzHistoSet.cpp.

328  {
329  bool sc=true;
330  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator
331  it = this->begin();
332  it != this->end();
333  it++){
334  map< DalitzCoordSet, DalitzHistogram >::const_iterator jt
335  = fit.find(it->first);
336  if(jt == fit.end()) continue;
337  sc &= it->second.drawWithFit(jt->second, baseName, format, fitDrawOpt);
338  }
339  return sc;
340 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26
std::map< Key, Val >::iterator find(const Key &c)
Definition: PolymorphMap.h:32

◆ drawWithFitAndEachAmps()

bool DalitzHistoSet::drawWithFitAndEachAmps ( DalitzHistoSet data,
DalitzHistoSet fit,
std::vector< DalitzHistoSet > &  amps,
const std::string &  baseName = "",
const std::string &  format = "eps",
const std::string &  fitDrawOpt = "HIST C SAME" 
) const

Definition at line 342 of file DalitzHistoSet.cpp.

349  {
350  bool sc=true;
351  std::vector<DalitzHistoSet>::iterator amps_it;
352 
353  for(map< DalitzCoordSet, DalitzHistogram>::iterator it = data.begin();it != data.end();it++){
354 
355  int counter = 0;
356  TCanvas can;
357 
358  map< DalitzCoordSet, DalitzHistogram >::iterator jt= fit.find(it->first);
359  if(jt == fit.end()) continue;
360  MINT::counted_ptr<TH1> dataHisto = (it->second).getHisto();
361  std::cout << it->first << endl;
362  MINT::counted_ptr<TH1> FitHisto = jt->second.getHisto();
363 
364  TLegend* leg = new TLegend(0.5 //xmin
365  ,0.5 //y-min
366  ,0.98 //x-max
367  ,0.935
368  ,""); //y-max //coordinates are fractions
369 
370  leg->SetTextSize(0.03);
371  if ((it->first).name() == "sij(2,3,4)" ||
372  (it->first).name() == "sij(1,3,4)" ||
373  (it->first).name() == "sij(1,2,4)" ||
374  (it->first).name() == "sij(1,2,3)" )
375  {
376  leg->SetX1(0.1);
377  leg->SetX2(0.4);
378  }
379 
380  TLegend* leg2 = new TLegend(0.,0.,1.,1.,"");
381  leg2->SetLineStyle(0);
382  leg2->SetLineColor(0);
383 
384  (*dataHisto).Scale(1./(*dataHisto).Integral());
385  (*dataHisto).SetMinimum(0.0001);
386  double max = (*dataHisto).GetMaximum();
387  if((*FitHisto).GetMaximum()>max)max= (*FitHisto).GetMaximum();
388  (*dataHisto).SetMaximum(max*1.1);
389  (*dataHisto).SetLineColor(kBlack);
390  (*dataHisto).SetMarkerStyle(20);
391  (*dataHisto).SetMarkerSize(0.6);
392  (*dataHisto).Draw("E");
393 
394  (*FitHisto).SetLineColor(kBlack);
395  (*FitHisto).Draw("HIST C SAME");
396  //leg->AddEntry(&(*FitHisto),"Fit","l"); // "l" means line
397  //leg->AddEntry(&(*dataHisto),"data","lep"); // "l" means line
398 
399  // suppress warning double NEntries = (*FitHisto).GetEntries();
400  (*FitHisto).GetEntries();
401  // suppress warning double NormFactor = (*FitHisto).GetNormFactor();
402  (*FitHisto).GetNormFactor();
403 
405 
406  for (amps_it = amps.begin(); amps_it < amps.end(); amps_it++)
407  {
408  map< DalitzCoordSet, DalitzHistogram >::iterator it2 = (*amps_it).find(it->first);
409 
410  counter++;
411  histo = it2->second.getHisto();
412 
413  if (counter == 9) counter++; //Remove white colour
414  (*histo).SetLineColor(1+counter);
415 
416  const char* title = (*histo).GetTitle();
417  leg->AddEntry(&(*histo),title,"l"); // "l" means line
418  leg2->AddEntry(&(*histo),title,"l"); // "l" means line
419 
420  (*histo).Draw("HIST C SAME");
421  // suppress warning double NormFactorAmp =
422  (*histo).GetNormFactor();
423  }
424 
425  std::string SaveName = it->first.name();
426  TString SaveFull = baseName+SaveName+".eps";
427  TString SaveFullLeg = baseName+SaveName+"_leg.eps";
428  TString SaveFullLog = baseName+SaveName+"_log.eps";
429  TString SaveLeg = baseName+"_leg.eps";
430 
431  SaveFull.ReplaceAll("(","");
432  SaveFull.ReplaceAll(")","");
433  SaveFull.ReplaceAll(",","_");
434  SaveFullLeg.ReplaceAll("(","");
435  SaveFullLeg.ReplaceAll(")","");
436  SaveFullLeg.ReplaceAll(",","_");
437  SaveFullLog.ReplaceAll("(","");
438  SaveFullLog.ReplaceAll(")","");
439  SaveFullLog.ReplaceAll(",","_");
440  SaveLeg.ReplaceAll("(","");
441  SaveLeg.ReplaceAll(")","");
442  SaveLeg.ReplaceAll(",","_");
443 
444  can.Print(SaveFull);
445 
446  gPad->SetLogy(1);
447  can.Print(SaveFullLog);
448  gPad->SetLogy(0);
449 
450  leg->SetFillColor(4000);
451  leg->SetShadowColor(4000);
452  leg->Draw();
453  can.Print(SaveFullLeg);
454 
455  TCanvas c;
456  c.cd();
457  leg2->SetFillColor(4000);
458  leg2->SetShadowColor(4000);
459  leg2->Draw();
460  c.Print(SaveLeg);
461 
462  }
463  return sc;
464 }
const std::string & name() const
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26
std::map< Key, Val >::iterator find(const Key &c)
Definition: PolymorphMap.h:32

◆ drawWithFitAndEachAmpsAndInterference()

bool DalitzHistoSet::drawWithFitAndEachAmpsAndInterference ( DalitzHistoSet data,
DalitzHistoSet fit,
DalitzHistoSet interference,
std::vector< DalitzHistoSet > &  amps,
const std::string &  baseName = "",
const std::string &  format = "eps",
const std::string &  fitDrawOpt = "HIST C SAME" 
) const

Definition at line 466 of file DalitzHistoSet.cpp.

473  {
474  bool sc=true;
475  std::vector<DalitzHistoSet>::iterator amps_it;
476 
477  for(map< DalitzCoordSet, DalitzHistogram>::iterator it = data.begin();it != data.end();it++){
478 
479  int counter = 0;
480  TCanvas can;
481 
482  map< DalitzCoordSet, DalitzHistogram >::iterator jt= fit.find(it->first);
483  if(jt == fit.end()) continue;
484  MINT::counted_ptr<TH1> dataHisto = (it->second).getHisto();
485  std::cout << it->first << endl;
486  MINT::counted_ptr<TH1> FitHisto = jt->second.getHisto();
487 
488  map< DalitzCoordSet, DalitzHistogram >::iterator jt_interference = interference.find(it->first);
489  if(jt_interference == interference.end()) continue;
490  MINT::counted_ptr<TH1> interferenceHisto = (jt_interference->second).getHisto();
491 
492 
493  TLegend* leg = new TLegend(0.5 //xmin
494  ,0.5 //y-min
495  ,0.98 //x-max
496  ,0.935
497  ,""); //y-max //coordinates are fractions
498 
499  leg->SetTextSize(0.01);
500  if ((it->first).name() == "sij(2,3,4)" ||
501  (it->first).name() == "sij(1,3,4)" ||
502  (it->first).name() == "sij(1,2,4)" ||
503  (it->first).name() == "sij(1,2,3)" )
504  {
505  leg->SetX1(0.1);
506  leg->SetX2(0.4);
507  }
508 
509  TLegend* leg2 = new TLegend(0.,0.,1.,1.,"");
510  leg2->SetLineStyle(0);
511  leg2->SetLineColor(0);
512 
513  (*dataHisto).Scale(1./(*dataHisto).Integral());
514  double max = (*dataHisto).GetMaximum();
515  if((*FitHisto).GetMaximum()>max)max= (*FitHisto).GetMaximum();
516  (*dataHisto).SetMaximum(max*1.1);
517  (*dataHisto).SetLineColor(kBlack);
518  (*dataHisto).SetMarkerStyle(20);
519  (*dataHisto).SetMarkerSize(0.6);
520  (*dataHisto).Draw("E");
521 
522  (*FitHisto).SetLineColor(kBlack);
523  (*FitHisto).Draw("HIST C SAME");
524  //leg->AddEntry(&(*FitHisto),"Fit","l"); // "l" means line
525  //leg->AddEntry(&(*dataHisto),"data","lep"); // "l" means line
526 
527  (*interferenceHisto).SetLineColor(kBlack);
528  (*interferenceHisto).SetLineStyle(kDashed);
529  (*interferenceHisto).Draw("HIST C SAME");
530  leg->AddEntry(&(*interferenceHisto),"Interference","l");
531  leg2->AddEntry(&(*interferenceHisto),"Interference","l");
532 
533  // suppress warning double NEntries = (*FitHisto).GetEntries();
534  (*FitHisto).GetEntries();
535  // suppress warning double NormFactor = (*FitHisto).GetNormFactor();
536  (*FitHisto).GetNormFactor();
537 
539 
540  for (amps_it = amps.begin(); amps_it < amps.end(); amps_it++)
541  {
542  map< DalitzCoordSet, DalitzHistogram >::iterator it2 = (*amps_it).find(it->first);
543 
544  counter++;
545  histo = it2->second.getHisto();
546 
547  if (counter == 9) counter++; //Remove white colour
548  (*histo).SetLineColor(1+counter);
549 
550  const char* title = (*histo).GetTitle();
551  leg->AddEntry(&(*histo),title,"l"); // "l" means line
552  leg2->AddEntry(&(*histo),title,"l"); // "l" means line
553 
554  (*histo).Draw("HIST C SAME");
555  // suppress warning double NormFactorAmp =
556  (*histo).GetNormFactor();
557  }
558 
559  std::string SaveName = it->first.name();
560  TString SaveFull = baseName+SaveName+".eps";
561  TString SaveFullLeg = baseName+SaveName+"_leg.eps";
562  TString SaveLeg = baseName+"_leg.eps";
563 
564  SaveFull.ReplaceAll("(","");
565  SaveFull.ReplaceAll(")","");
566  SaveFull.ReplaceAll(",","_");
567  SaveFullLeg.ReplaceAll("(","");
568  SaveFullLeg.ReplaceAll(")","");
569  SaveFullLeg.ReplaceAll(",","_");
570  SaveLeg.ReplaceAll("(","");
571  SaveLeg.ReplaceAll(")","");
572  SaveLeg.ReplaceAll(",","_");
573 
574  can.Print(SaveFull);
575 
576  leg->SetFillColor(4000);
577  leg->SetShadowColor(4000);
578  leg->Draw();
579  can.Print(SaveFullLeg);
580 
581  TCanvas c;
582  c.cd();
583  leg2->SetFillColor(4000);
584  leg2->SetShadowColor(4000);
585  leg2->Draw();
586  c.Print(SaveLeg);
587 
588  }
589  return sc;
590 }
const std::string & name() const
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26
std::map< Key, Val >::iterator find(const Key &c)
Definition: PolymorphMap.h:32

◆ drawWithFitNorm()

bool DalitzHistoSet::drawWithFitNorm ( const DalitzHistoSet fit,
const std::string &  baseName = "",
const std::string &  format = "eps",
const std::string &  fitDrawOpt = "HIST C SAME" 
) const

Definition at line 592 of file DalitzHistoSet.cpp.

596  {
597  DalitzHistoSet me(*this);
598  DalitzHistoSet you(fit);
599  if(0 != me.integral()) me /= me.integral();
600  if(0 != you.integral()) you /= you.integral();
601  return me.drawWithFit(you, baseName, format, fitDrawOpt);
602 }

◆ fullDirListFname()

std::string DalitzHistoSet::fullDirListFname ( const std::string &  asSubdirOf = ".") const

Definition at line 231 of file DalitzHistoSet.cpp.

232  {
233  return asSubdirOf + "/" + dirName() + "/" + "directoryList.txt";
234 }
const std::string & dirName() const

◆ integral()

double DalitzHistoSet::integral ( ) const

Definition at line 603 of file DalitzHistoSet.cpp.

603  {
604  if(this->empty()) return 0;
605  return this->begin()->second.integral(); // should all be the same.
606 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ makeDirectory()

bool DalitzHistoSet::makeDirectory ( const std::string &  asSubdirOf) const
private

Definition at line 196 of file DalitzHistoSet.cpp.

196  {
197  /*
198  A mode is created from or'd permission bit masks defined
199  in <sys/stat.h>:
200  #define S_IRWXU 0000700 RWX mask for owner
201  #define S_IRUSR 0000400 R for owner
202  #define S_IWUSR 0000200 W for owner
203  #define S_IXUSR 0000100 X for owner
204 
205  #define S_IRWXG 0000070 RWX mask for group
206  #define S_IRGRP 0000040 R for group
207  #define S_IWGRP 0000020 W for group
208  #define S_IXGRP 0000010 X for group
209 
210  #define S_IRWXO 0000007 RWX mask for other
211  #define S_IROTH 0000004 R for other
212  #define S_IWOTH 0000002 W for other
213  #define S_IXOTH 0000001 X for other
214 
215  #define S_ISUID 0004000 set user id on execution
216  #define S_ISGID 0002000 set group id on execution
217  #define S_ISVTX 0001000 save swapped text even after use
218  */
219 
220  mode_t mode = S_IRWXU | S_IRWXG | S_IRWXO
221  | S_ISUID | S_ISGID;
222  // see above for meaning. I want everybody to be allowed to read/write/exec.
223  // Not sure about the last two bits.
224 
225  int zeroForSuccess = 0;
226  zeroForSuccess |= mkdir( (asSubdirOf ).c_str(), mode );
227  zeroForSuccess |= mkdir( (asSubdirOf + "/" + dirName() ).c_str(), mode );
228  return (0 == zeroForSuccess);
229 }
const std::string & dirName() const

◆ makeHistograms()

void DalitzHistoSet::makeHistograms ( const DalitzEventPattern pat)
private

Definition at line 38 of file DalitzHistoSet.cpp.

38  {
39 
40  int nDaughters = pat.numDaughters();
41  AllPossibleSij sijList(nDaughters);
42 
43  for(namedVMap::const_iterator it = sijList.begin();
44  it != sijList.end(); it++){
45  DalitzHistogram h(it->second, pat);
46  (*this)[it->second] = h;
47  }
48 
49  return;
50 }

◆ makeName()

const std::string & DalitzHistoSet::makeName ( )
private

Definition at line 169 of file DalitzHistoSet.cpp.

169  {
170  _name = "DalitzHistoSet";
171  return _name;
172 }
std::string _name

◆ multiply() [1/2]

void DalitzHistoSet::multiply ( const DalitzHistogram hL)

Definition at line 64 of file DalitzHistoSet.cpp.

64  {
65  (*this)[histo.coord()].multiply(histo);
66  return;
67 }

◆ multiply() [2/2]

void DalitzHistoSet::multiply ( const DalitzHistoSet hL)

Definition at line 68 of file DalitzHistoSet.cpp.

68  {
69  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator it = hL.begin();
70  it != hL.end();
71  it++){
72  this->multiply(it->second);
73  }
74  return;
75 }
std::map< Key, Val >::iterator end()
Definition: PolymorphMap.h:29
void multiply(const DalitzHistogram &hL)
std::map< Key, Val >::iterator begin()
Definition: PolymorphMap.h:26

◆ name()

const std::string & DalitzHistoSet::name ( ) const

Definition at line 174 of file DalitzHistoSet.cpp.

174  {
175  return _name;
176 }
std::string _name

◆ operator *() [1/2]

DalitzHistoSet DalitzHistoSet::operator * ( double  sf) const

Definition at line 612 of file DalitzHistoSet.cpp.

612  {
613  DalitzHistoSet newSet(*this);
614  newSet *= sf;
615  return newSet;
616 }

◆ operator *() [2/2]

DalitzHistoSet DalitzHistoSet::operator * ( const DalitzHistoSet rhs) const

Definition at line 656 of file DalitzHistoSet.cpp.

656  {
657  DalitzHistoSet newSet(*this);
658  newSet *= rhs;
659  return newSet;
660 }

◆ operator *=() [1/2]

DalitzHistoSet & DalitzHistoSet::operator *= ( double  sf)

Definition at line 608 of file DalitzHistoSet.cpp.

608  {
609  this->scale(sf);
610  return *this;
611 }
void scale(double sf)

◆ operator *=() [2/2]

DalitzHistoSet & DalitzHistoSet::operator *= ( const DalitzHistoSet rhs)

Definition at line 652 of file DalitzHistoSet.cpp.

652  {
653  this->multiply(rhs);
654  return *this;
655 }
void multiply(const DalitzHistogram &hL)

◆ operator+()

DalitzHistoSet DalitzHistoSet::operator+ ( const DalitzHistoSet rhs) const

Definition at line 637 of file DalitzHistoSet.cpp.

637  {
638  DalitzHistoSet newSet(*this);
639  newSet += rhs;
640  return newSet;
641 }

◆ operator+=()

DalitzHistoSet & DalitzHistoSet::operator+= ( const DalitzHistoSet rhs)

Definition at line 633 of file DalitzHistoSet.cpp.

633  {
634  this->add(rhs);
635  return *this;
636 }
void add(const DalitzHistogram &histo, double weight=1)

◆ operator-()

DalitzHistoSet DalitzHistoSet::operator- ( const DalitzHistoSet rhs) const

Definition at line 646 of file DalitzHistoSet.cpp.

646  {
647  DalitzHistoSet newSet(*this);
648  newSet -= rhs;
649  return newSet;
650 }

◆ operator-=()

DalitzHistoSet & DalitzHistoSet::operator-= ( const DalitzHistoSet rhs)

Definition at line 642 of file DalitzHistoSet.cpp.

642  {
643  this->add(rhs, -1.0);
644  return *this;
645 }
void add(const DalitzHistogram &histo, double weight=1)

◆ operator/() [1/2]

DalitzHistoSet DalitzHistoSet::operator/ ( double  sf) const

Definition at line 627 of file DalitzHistoSet.cpp.

627  {
628  DalitzHistoSet newSet(*this);
629  newSet /= sf;
630  return newSet;
631 }

◆ operator/() [2/2]

DalitzHistoSet DalitzHistoSet::operator/ ( const DalitzHistoSet rhs) const

Definition at line 665 of file DalitzHistoSet.cpp.

665  {
666  DalitzHistoSet newSet(*this);
667  newSet /= rhs;
668  return newSet;
669 }

◆ operator/=() [1/2]

DalitzHistoSet & DalitzHistoSet::operator/= ( double  sf)

Definition at line 623 of file DalitzHistoSet.cpp.

623  {
624  this->scale(1./sf);
625  return *this;
626 }
void scale(double sf)

◆ operator/=() [2/2]

DalitzHistoSet & DalitzHistoSet::operator/= ( const DalitzHistoSet rhs)

Definition at line 661 of file DalitzHistoSet.cpp.

661  {
662  this->divide(rhs);
663  return *this;
664 }
void divide(const DalitzHistogram &hL)

◆ retrieveFromDir()

bool DalitzHistoSet::retrieveFromDir ( const std::string &  asSubDirOf = ".")

Definition at line 282 of file DalitzHistoSet.cpp.

282  {
283  bool dbThis=false;
284  bool sc=true;
285 
286  makeDirectory(asSubdirOf);
287  //path = asSubdirOf + "/" + dirName();
288  NamedParameter<std::string> dirNames("DirectoryList"
289  , fullDirListFname(asSubdirOf).c_str()
290  );
291  dirNames.reloadFile(fullDirListFname(asSubdirOf).c_str());
292  std::string path=asSubdirOf + "/" + dirName();
293  for(int i=0; i < dirNames.size(); i++){
294  DalitzHistogram hs;
295  hs.retrieveFromDir( path, dirNames.getVal(i).c_str() );
296  if(dbThis) cout << "hs.pattern()" << hs.pattern() << endl;
297  this->add(hs);
298  }
299  if(dbThis){
300  cout << "after adding:" << endl;
301  for(std::map< DalitzCoordSet, DalitzHistogram>::const_iterator it =
302  this->begin(); it != this->end(); it++){
303  cout << "\n" << it->second.pattern() << endl;
304  }
305 
306  }
307  return sc;
308 }
std::string fullDirListFname(const std::string &asSubdirOf=".") const
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
const DalitzEventPattern & pattern() const
bool retrieveFromDir(const std::string &asSubdirOf=".", const char *theName=0)
bool makeDirectory(const std::string &asSubdirOf) const
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26
const std::string & dirName() const
void add(const DalitzHistogram &histo, double weight=1)

◆ save()

bool DalitzHistoSet::save ( const std::string &  filename = "DalitzHistos.root") const

Definition at line 182 of file DalitzHistoSet.cpp.

182  {
183  TFile* f = TFile::Open(filename.c_str(), "RECREATE");
184  f->cd();
185  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator
186  it = this->begin();
187  it != this->end();
188  it++){
189  if(0 == it->second.histo()) continue;
190  it->second.histo()->Write();
191  }
192  f->Close();
193  return true;
194 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ saveAsDir()

bool DalitzHistoSet::saveAsDir ( const std::string &  asSubdirOf = ".") const

Definition at line 235 of file DalitzHistoSet.cpp.

235  {
236  bool dbThis=true;
237 
238  bool sc=true;
239 
240  if(dbThis) cout << "DalitzHistoSet::saveAsDir: called with "
241  << "asSubdirOf = " << asSubdirOf << endl;
242 
243  makeDirectory(asSubdirOf);
244  std::string dir = asSubdirOf + "/" + dirName();
245 
246  std::vector<std::string> directoryList;
247  for(map< DalitzCoordSet, DalitzHistogram>::const_iterator
248  it = this->begin();
249  it != this->end();
250  it++){
251  if(dbThis) cout << "DalitzHistoSet::saveAsDir: saving DalitzHistogram" << endl;
252  sc &= it->second.saveAsDir(dir);
253  directoryList.push_back(it->second.dirName());
254  }
255 
256  NamedParameter<std::string> dirNames("DirectoryList"
257  , NamedParameterBase::QUIET);
258  dirNames = directoryList;
259 
260  ofstream os( fullDirListFname(asSubdirOf).c_str() );
261  if(os.bad()){
262  cout << "ERROR in DalitzHistoSet::saveAsDir of \n\t" << name()
263  << "\n\t unable to create file: "
264  << "\n\t" << fullDirListFname() << endl;
265  return false;
266  }
267  os << name()
268  << '\n' << dirNames
269  << endl;
270  os.close();
271 
272  if(dbThis){
273  cout << "I've just written this: "
274  << name()
275  << '\n' << dirNames
276  << endl;
277  cout << "to this file: " << fullDirListFname(asSubdirOf) << endl;
278  }
279  return sc;
280 }
const std::string & name() const
std::string fullDirListFname(const std::string &asSubdirOf=".") const
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
bool makeDirectory(const std::string &asSubdirOf) const
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26
const std::string & dirName() const

◆ scale()

void DalitzHistoSet::scale ( double  sf)

Definition at line 102 of file DalitzHistoSet.cpp.

102  {
103  if(this->empty()) return;
104  for(map< DalitzCoordSet, DalitzHistogram>::iterator
105  it = this->begin();
106  it != this->end();
107  it++){
108  it->second.scale(sf);
109  }
110  return;
111 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ setFillColour()

void DalitzHistoSet::setFillColour ( Color_t  fcolor)

Definition at line 134 of file DalitzHistoSet.cpp.

134  {
135  if(this->empty()) return;
136  for(map< DalitzCoordSet, DalitzHistogram>::iterator
137  it = this->begin();
138  it != this->end();
139  it++){
140  it->second.histo()->SetFillColor(fcolor);
141  }
142  return;
143 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ setLineColour()

void DalitzHistoSet::setLineColour ( Color_t  fcolor)

Definition at line 144 of file DalitzHistoSet.cpp.

144  {
145  if(this->empty()) return;
146  for(map< DalitzCoordSet, DalitzHistogram>::iterator
147  it = this->begin();
148  it != this->end();
149  it++){
150  it->second.histo()->SetLineColor(fcolor);
151  it->second.histo()->SetLineWidth(2);
152  }
153  return;
154 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ setNormFactor()

void DalitzHistoSet::setNormFactor ( double  sf = 1)

Definition at line 113 of file DalitzHistoSet.cpp.

113  {
114  if(this->empty()) return;
115  for(map< DalitzCoordSet, DalitzHistogram>::iterator
116  it = this->begin();
117  it != this->end();
118  it++){
119  it->second.setNormFactor(sf);
120  }
121  return;
122 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

◆ setTitle()

void DalitzHistoSet::setTitle ( const std::string &  title)

Definition at line 124 of file DalitzHistoSet.cpp.

124  {
125  if(this->empty()) return;
126  for(map< DalitzCoordSet, DalitzHistogram>::iterator
127  it = this->begin();
128  it != this->end();
129  it++){
130  it->second.setTitle(title);
131  }
132  return;
133 }
std::map< DalitzCoordSet, DalitzHistogram >::iterator end()
Definition: PolymorphMap.h:29
std::map< DalitzCoordSet, DalitzHistogram >::iterator begin()
Definition: PolymorphMap.h:26

Member Data Documentation

◆ _name

std::string DalitzHistoSet::_name
private

Definition at line 22 of file DalitzHistoSet.h.

◆ _theMap

std::map< DalitzCoordSet, DalitzHistogram> DalitzHistoSet::_theMap
private

Definition at line 27 of file DalitzHistoSet.h.


The documentation for this class was generated from the following files: