Skip to content
Snippets Groups Projects
Commit 10431536 authored by Bertram Kopf's avatar Bertram Kopf
Browse files

added hist-class for pbarp test tools

parent f6ebb22b
No related branches found
No related tags found
No related merge requests found
#include <getopt.h>
#include <fstream>
#include <algorithm>
#include "Examples/pbarp/pbarpHist.hh"
#include "Examples/pbarp/pbarpEnv.hh"
#include "qft++/relativistic-quantum-mechanics/Utils.hh"
#include "ErrLogger/ErrLogger.hh"
#include "Particle/Particle.hh"
#include "Utils/PawianCollectionUtils.hh"
#include "PwaUtils/KinUtils.hh"
#include "PwaUtils/AbsLhNew.hh"
#include "PwaUtils/EvtDataBaseListNew.hh"
#include "TFile.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TNtuple.h"
//#include "TMath.h"
pbarpHist::pbarpHist(boost::shared_ptr<AbsLhNew> theLh, fitParamsNew& theFitParams)
{
if(0==theLh){
Alert <<"AbsLh* is a 0 pointer !!!!" ; // << endmsg;
exit(1);
}
boost::shared_ptr<const EvtDataBaseListNew> theEvtList=theLh->getEventList();
const std::vector<EvtDataNew*> dataList=theEvtList->getDataVecs();
initRootStuff();
std::vector<EvtDataNew*>::const_iterator it=dataList.begin();
while(it!=dataList.end())
{
fillMassHists((*it), 1.);
++it;
}
}
pbarpHist::~pbarpHist(){
_theTFile->Write();
_theTFile->Close();
}
void pbarpHist::initRootStuff(){
std::string rootFileName="./pawianHists.root";
_theTFile=new TFile(rootFileName.c_str(),"recreate");
std::vector<std::vector<std::string> > histMassNameVec=pbarpEnv::instance()->histMassSystems();
std::vector<std::vector<std::string> >::iterator itVecStr;
for(itVecStr=histMassNameVec.begin(); itVecStr!=histMassNameVec.end(); ++itVecStr){
boost::shared_ptr<massHistData> tmpMassHistData(new massHistData(*itVecStr));
std::string histName="data"+tmpMassHistData->_name;
TH1F* currentMassHist=new TH1F(histName.c_str(), histName.c_str(), 100., 0., 2.);
_massHistMap[tmpMassHistData]=currentMassHist;
}
}
void pbarpHist::fillMassHists(EvtDataNew* theData, double weight){
std::map<boost::shared_ptr<massHistData>, TH1F*, pawian::Collection::SharedPtrLess >::iterator it;
for(it= _massHistMap.begin(); it!= _massHistMap.end(); ++it){
//get relevant 4 vecs
Vector4<double> combined4Vec(0.,0.,0.,0.);
std::vector<std::string> fspNames=it->first->_fspNames;
std::vector<std::string>::iterator itStr;
for(itStr=fspNames.begin(); itStr!=fspNames.end(); ++itStr){
Vector4<double> tmp4vec=theData->FourVecsString[*itStr];
combined4Vec+=tmp4vec;
}
it->second->Fill(combined4Vec.M(), weight);
}
}
#pragma once
#include <iostream>
#include <vector>
#include <complex>
#include <map>
#include <string>
#include <sstream>
#include <boost/shared_ptr.hpp>
#include "TROOT.h"
#include "PwaUtils/DataUtils.hh"
#include "Utils/PawianCollectionUtils.hh"
#include "PwaUtils/FitParamsBaseNew.hh"
//#include "TFile.h"
//#include "TH1F.h"
//#include "TH2F.h"
//class TFile;
//class TH2F;
//class TH1F;
class AbsLhNew;
class EvtDataNew;
struct massHistData {
massHistData(std::vector<std::string>& fspNames) :
_name("")
,_fspNames(fspNames)
{
std::vector<std::string>::iterator it;
for(it=fspNames.begin(); it!=fspNames.end(); ++it){
_name+=(*it);
}
}
std::string _name;
std::vector<std::string> _fspNames;
virtual bool operator==(const massHistData& compare) const {
bool result=false;
if ( _name==compare._name) result=true;
return result;
}
virtual bool operator<(const massHistData& compare) const {
bool result=false;
if(_name < compare._name) result=true;
return result;
}
};
class TFile;
//class TH2F;
class TH1F;
// class TNtuple;
class pbarpHist {
public:
pbarpHist(boost::shared_ptr<AbsLhNew>, fitParamsNew& theFitParams);
virtual ~pbarpHist();
protected:
private:
void fillMassHists(EvtDataNew* theData, double weight);
TFile* _theTFile;
std::map<boost::shared_ptr<massHistData>, TH1F*, pawian::Collection::SharedPtrLess > _massHistMap;
void initRootStuff();
};
......@@ -6,6 +6,8 @@
#include <iterator>
#include <boost/shared_ptr.hpp>
#include "TROOT.h"
#include "Examples/pbarp/pbarpParser.hh"
#include "Particle/ParticleTable.hh"
#include "Particle/Particle.hh"
......@@ -25,7 +27,7 @@
#include "Examples/pbarp/pbarpBaseLh.hh"
#include "Examples/pbarp/pbarpEvtReader.hh"
#include "Examples/pbarp/pbarpEventList.hh"
//#include "Examples/pbarp/pbarpHist.hh"
#include "Examples/pbarp/pbarpHist.hh"
#include "Event/Event.hh"
#include "Event/EventList.hh"
......@@ -42,6 +44,7 @@
#include <omp.h>
#endif
int main(int __argc,char *__argv[]){
clock_t start, end;
start= clock();
......@@ -178,7 +181,7 @@ int main(int __argc,char *__argv[]){
double theLh=theLhPtr->calcLogLh(theStartparams);
Info <<"theLh = "<< theLh << endmsg;
// pbarpHist theHist(theLhPtr, theStartparams);
pbarpHist theHist(theLhPtr, theStartparams);
}
......
......@@ -27,8 +27,6 @@ verbose = 1
mnParFix = J1P-1C-1L0S1pbarpPhi
mnParFix = J1P1C-1L1S0pbarpPhi
mnParFix = J1P-1C-1L1S0_phiToK+_K-Mag
mnParFix = J1P-1C-1L1S0_phiToK+_K-Phi
mnParFix = J1P-1C-1L1S1_J1P-1C-1Tophi_pion0Mag
mnParFix = J1P-1C-1L1S1_J1P-1C-1Tophi_pion0Phi
mnParFix = J1P1C-1L0S1_J1P1C-1Tophi_pion0Mag
......@@ -39,14 +37,18 @@ mnParFix = J3P-1C-1L3S1_J3P-1C-1Tophi_pion0Mag
mnParFix = J3P-1C-1L3S1_J3P-1C-1Tophi_pion0Phi
mnParFix = J3P1C-1L2S1_J3P1C-1Tophi_pion0Mag
mnParFix = J3P1C-1L2S1_J3P1C-1Tophi_pion0Phi
mnParFix = J4P-1C-1L3S1_J4P-1C-1Tophi_pion0Mag
mnParFix = J4P-1C-1L3S1_J4P-1C-1Tophi_pion0Phi
mnParFix = J5P-1C-1L5S1_J5P-1C-1Tophi_pion0Mag
mnParFix = J5P-1C-1L5S1_J5P-1C-1Tophi_pion0Phi
#mnParFix = J4P-1C-1L3S1_J4P-1C-1Tophi_pion0Mag
#mnParFix = J4P-1C-1L3S1_J4P-1C-1Tophi_pion0Phi
#mnParFix = J5P-1C-1L5S1_J5P-1C-1Tophi_pion0Mag
#mnParFix = J5P-1C-1L5S1_J5P-1C-1Tophi_pion0Phi
mnParFix = J1P-1C-1L1S0_phiToK+_K-Mag
mnParFix = J1P-1C-1L1S0_phiToK+_K-Phi
finalStateParticle = pion0
finalStateParticle = K+
finalStateParticle = K-
finalStateParticle = pion0
production = phi pion0
#production = K*+ K-
......@@ -61,6 +63,10 @@ decay = phi K+ K-
#replaceParamSuffix = K*+ToK+_pion K*ToK_pion
#replaceParamSuffix = K*-ToK-_pion K*ToK_pion
histMass = K+ K-
histMass = K- pion0
histMass = K+ pion0
pdgTableFile = /Examples/pbarp/bin/gcc-4.4.5/release/link-static/pdt.table
cacheAmps = true
lmax = 3
\ No newline at end of file
lmax = 3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment