├── AmpTools ├── UpRootMinuit │ ├── Documentation │ │ └── brun_conversion_notes.rtf │ ├── Makefile │ ├── URFcn.h │ └── URLinkDef.h ├── MainPage.h ├── IUAmpToolsMPI │ ├── Makefile │ ├── AmpToolsInterfaceMPI.h │ ├── MainPage.h │ ├── MPITag.h │ ├── NormIntInterfaceMPI.h │ └── LikelihoodManagerMPI.h ├── MinuitInterface │ ├── Makefile │ ├── MIObserver.h │ ├── MISubject.cc │ ├── MISubject.h │ ├── AsymmetricError.cc │ ├── ConversionFunction.h │ ├── GaussianBound.cc │ ├── GaussianBound.h │ ├── AsymmetricError.h │ ├── Parameter.h │ ├── MIFunctionContribution.cc │ ├── MIFunctionContribution.h │ ├── ParameterList.h │ └── Parameter.cc ├── IUAmpTools │ ├── Makefile │ ├── MainPage.h │ ├── UserNeg2LnLikContrib.h │ ├── report.h │ ├── DataReader.cc │ ├── Histogram1D.h │ ├── Neg2LnLikContribManager.cc │ ├── Histogram2D.h │ ├── Kinematics.cc │ ├── Histogram.cc │ └── Neg2LnLikContrib.cc ├── GPUManager │ ├── Makefile │ ├── GPUKernel.h │ └── GPUFactPermKernel.cu ├── ROOT │ ├── README │ └── loadAmpTools.C ├── Makefile └── GPUUtils │ └── clebsch.cuh ├── AmpTools_User_Guide.pdf ├── Tutorials ├── Dalitz │ ├── doc │ │ ├── doc.pdf │ │ ├── figure1.pdf │ │ └── figure2.pdf │ ├── DalitzLib │ │ ├── DalitzPlot │ │ │ ├── DalitzPlotGenerator.h │ │ │ ├── Makefile │ │ │ └── DalitzPlotGenerator.cc │ │ ├── DalitzDataIO │ │ │ ├── Makefile │ │ │ ├── DalitzDataWriter.h │ │ │ ├── DalitzDataReader.h │ │ │ ├── DalitzDataWriter.cc │ │ │ └── DalitzDataReader.cc │ │ ├── DalitzAmp │ │ │ ├── Constraint.h │ │ │ ├── Makefile │ │ │ ├── BreitWigner_kernel.cu │ │ │ ├── Constraint.cc │ │ │ ├── BreitWigner.h │ │ │ └── BreitWigner.cc │ │ └── Makefile │ ├── run │ │ ├── plotData.C │ │ ├── plotResult.C │ │ ├── dalitz1.cfg │ │ ├── dalitz2.cfg │ │ ├── GPU.dalitz1.cfg │ │ ├── dalitz3.cfg │ │ └── dalitz_constraint.cfg │ ├── Makefile │ ├── DalitzExe │ │ ├── parseConfigFile.cc │ │ ├── printAmplitudes.cc │ │ ├── fitAmplitudes.cc │ │ ├── toyAcceptance.cc │ │ ├── fitAmplitudesMPI.cc │ │ ├── ampPlotter.cc │ │ ├── generateBackground.cc │ │ └── generatePhaseSpace.cc │ ├── copyDalitz.py │ └── copyDalitz3.py └── README ├── UnitTests ├── models │ ├── AmpToolsInterface.txt │ ├── configurationInfo.txt │ └── fitResults.txt ├── includeTest.cfg ├── Makefile └── README ├── AmpPlotter ├── AmpPlotter │ ├── Makefile │ ├── Plot.h │ ├── BkgndComponent.h │ ├── AccMCComponent.h │ ├── DataComponent.h │ ├── GenMCComponent.h │ ├── ComponentGroup.h │ ├── AccMCComponent.cc │ ├── BkgndComponent.cc │ ├── DataComponent.cc │ ├── GenMCComponent.cc │ ├── ComponentGroup.cc │ └── PlotComponent.cc ├── Makefile └── README ├── .gitignore ├── README ├── Makefile ├── .github └── workflows │ └── write_models.yaml └── Makefile.settings /AmpTools/UpRootMinuit/Documentation/brun_conversion_notes.rtf: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /AmpTools_User_Guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mashephe/AmpTools/HEAD/AmpTools_User_Guide.pdf -------------------------------------------------------------------------------- /Tutorials/Dalitz/doc/doc.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mashephe/AmpTools/HEAD/Tutorials/Dalitz/doc/doc.pdf -------------------------------------------------------------------------------- /UnitTests/models/AmpToolsInterface.txt: -------------------------------------------------------------------------------- 1 | 124397 2 | -84.9406 3 | -473.64 4 | -1314.64 5 | 806.42 6 | 806.42 7 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/doc/figure1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mashephe/AmpTools/HEAD/Tutorials/Dalitz/doc/figure1.pdf -------------------------------------------------------------------------------- /Tutorials/Dalitz/doc/figure2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mashephe/AmpTools/HEAD/Tutorials/Dalitz/doc/figure2.pdf -------------------------------------------------------------------------------- /UnitTests/models/configurationInfo.txt: -------------------------------------------------------------------------------- 1 | fitTest 2 | fitTest.fit 3 | 0 4 | 4 5 | 8 6 | 5 7 | 1 8 | 0 9 | 8 10 | 6 11 | -------------------------------------------------------------------------------- /UnitTests/includeTest.cfg: -------------------------------------------------------------------------------- 1 | reaction base p1 p2 p3 2 | sum base s1 3 | amplitude base::s1::R12 BreitWigner [M12] [G12] 1 2 4 | amplitude base::s1::R13 BreitWigner [M13] [G13] 1 3 5 | initialize base::s1::R12 cartesian 1.0 0.0 6 | initialize base::s1::R13 cartesian 1.0 0.0 real -------------------------------------------------------------------------------- /AmpTools/MainPage.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * \mainpage AmpTools Class Reference 4 | * 5 | * This site contains an evolving doxygen-generated reference for the 6 | * AmpTools package. As additional doxygen documentation is added, 7 | * this site will be continually updated. 8 | * 9 | */ 10 | 11 | -------------------------------------------------------------------------------- /UnitTests/models/fitResults.txt: -------------------------------------------------------------------------------- 1 | 20590.7 2 | 287.663 3 | 0.107421 4 | 0.0433126 5 | 13.8506 6 | 1.49359 7 | 13.8506 8 | 1.49359 9 | 15.7933 10 | -18.7804 11 | -84.9406 12 | 22 13 | 13.8506 14 | 1.49359 15 | 34.6073 16 | 0 17 | 13.8506 18 | 1.49359 19 | 34.6073 20 | 0 21 | 15.793 22 | -18.7806 23 | 26.0313 24 | 0 25 | 15.7933 26 | -18.7804 27 | 26.0311 28 | 0 29 | 1.00144 30 | 0.204859 31 | 1.5103 32 | 0.170219 33 | 3.42465 34 | 5.28702 35 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%.o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%.o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%.o: %.cc .%.d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*.d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%.d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(SRCFILES:.cc=.dep) 24 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzPlot/DalitzPlotGenerator.h: -------------------------------------------------------------------------------- 1 | #if !(defined DALITZPLOTGENERATOR) 2 | #define DALITZPLOTGENERATOR 3 | 4 | #include "IUAmpTools/PlotGenerator.h" 5 | 6 | class FitResults; 7 | class Kinematics; 8 | 9 | class DalitzPlotGenerator : public PlotGenerator 10 | { 11 | 12 | public: 13 | 14 | DalitzPlotGenerator( const FitResults& results ); 15 | 16 | enum { 17 | khm12 = 0, khm13, khm23, kdltz, 18 | kNumHists 19 | }; 20 | 21 | private: 22 | 23 | void projectEvent( Kinematics* kin ); 24 | 25 | }; 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /AmpTools/UpRootMinuit/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a *.pcm *.so *.d 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzPlot/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzDataIO/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | 3 | .PHONY: default clean 4 | .PRECIOUS: .%$(SUFFIX).o 5 | 6 | default: $(LIB) 7 | 8 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) 9 | $(vecho) "--> Archiving $@" 10 | $(Q)ar -rsc $@ $^ 11 | 12 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 13 | $(vecho) "-> Compiling $<" 14 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 15 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 16 | 17 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) 18 | $(DEPFILES): 19 | 20 | clean: 21 | $(Q)-rm -f .*.o .*.d *.a 22 | 23 | -include $(DEPFILES) 24 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/plotData.C: -------------------------------------------------------------------------------- 1 | { 2 | 3 | _file0->cd(); 4 | 5 | TCanvas* c1 = new TCanvas("c1","c1",800,800); 6 | c1->Divide(2,2); 7 | 8 | TH2F* hs12s23 = (TH2F*) gDirectory->FindObjectAny("hs12s23"); 9 | TH1F* hm12 = (TH1F*) gDirectory->FindObjectAny("hm12"); 10 | TH1F* hm23 = (TH1F*) gDirectory->FindObjectAny("hm23"); 11 | TH1F* hm13 = (TH1F*) gDirectory->FindObjectAny("hm13"); 12 | 13 | c1->cd(1); 14 | hs12s23->Draw("colz"); 15 | 16 | c1->cd(2); 17 | hm12->Draw(""); 18 | 19 | c1->cd(3); 20 | hm23->Draw(""); 21 | 22 | c1->cd(4); 23 | hm13->Draw(""); 24 | 25 | c1->cd(); 26 | 27 | } 28 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/Makefile: -------------------------------------------------------------------------------- 1 | 2 | PROJECT := Dalitz 3 | PROJECT_HOME := $(shell pwd) 4 | 5 | INSTALL_BIN := $(PROJECT_HOME)/bin 6 | INSTALL_LIB := $(PROJECT_HOME)/lib 7 | 8 | export 9 | 10 | .PHONY: default clean library force 11 | 12 | default: library exe 13 | 14 | library: compiler_flags 15 | @echo "=== Building $(PROJECT) libraries ===" 16 | @$(MAKE) -C $(PROJECT)Lib 17 | 18 | exe: library 19 | @echo "=== Building $(PROJECT) executables ===" 20 | @$(MAKE) -C $(PROJECT)Exe 21 | 22 | clean: 23 | @$(MAKE) -C $(PROJECT)Lib clean 24 | @$(MAKE) -C $(PROJECT)Exe clean 25 | 26 | compiler_flags: force 27 | @echo '$(CXX_FLAGS)' | cmp -s - $@ || echo '$(CXX_FLAGS)' > $@ 28 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/AmpToolsInterfaceMPI.h: -------------------------------------------------------------------------------- 1 | #if !defined(AMPTOOLSINTERFACEMPI) 2 | #define AMPTOOLSINTERFACEMPI 3 | 4 | #include "IUAmpTools/AmpToolsInterface.h" 5 | 6 | using namespace std; 7 | 8 | class AmpToolsInterfaceMPI : public AmpToolsInterface{ 9 | 10 | public: 11 | 12 | AmpToolsInterfaceMPI(ConfigurationInfo* cfgInfo); 13 | ~AmpToolsInterfaceMPI(){} 14 | 15 | void finalizeFit( const string& tag = "" ); 16 | 17 | // exit MPI should be called on the leader process before 18 | // MPI_Finalize() or variables go out of scope 19 | void exitMPI(); 20 | 21 | private: 22 | 23 | int m_rank; 24 | int m_numProc; 25 | 26 | static const char* kModule; 27 | }; 28 | 29 | 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/MainPage.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *\defgroup IUAmpTools 4 | * 5 | * The IUAmpTools collection of classes provides an interface to formulate 6 | * an amplitude analysis. It includes classes that perform several types of 7 | * functions: 8 | * 9 | * - defining amplitudes: how one computes an amplitude for four vectors 10 | * - defining intensities: how one arranges coherent and incoherent sums 11 | * of amplitudes along with permutations of particles to describe an observable 12 | * distribution of events 13 | * - defining the likelihood that is maximized by the fitter 14 | * - managing the parameters in the fit 15 | * - data I/O: a mechanism for passing event data into the framework, and 16 | * also generating histograms from data 17 | * 18 | */ 19 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/MainPage.h: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | *\defgroup IUAmpToolsMPI 4 | * 5 | * The IUAmpToolsMPI directory contains classes for parallel-processing 6 | * implementations of IUAmpTools using the Message Passing Interface (MPI). 7 | * These classes allow fits to executed in parallel on multiple CPUs. The 8 | * classes enable a parallel computation of both the likelihood and associated 9 | * normalization integrals. In general the classes inherit from their 10 | * counterparts in IUAmpTools. The design goal was to only implement 11 | * MPI transactions in these classes -- this avoids replication of key 12 | * functions of the IUAmpTools framework. Where possible the constructors 13 | * to these clases were kept the same as IUAmpTools. This should facilitate 14 | * an easy switch between single process and MPI implementations. 15 | */ 16 | -------------------------------------------------------------------------------- /AmpTools/UpRootMinuit/URFcn.h: -------------------------------------------------------------------------------- 1 | /* 2 | * URFcn.h 3 | * UpRootMinuit 4 | * 5 | * Base class allowing user to specify the minuit-style function object to be 6 | * invoked in a minimization procedure. Replaces the pointer-to-function 7 | * object in Root's original implementation to allow greater user flexibility 8 | * 9 | * Created by Lawrence Gibbons on Tue Oct 21 2003. 10 | * Copyright (c) 2003 __MyCompanyName__. All rights reserved. 11 | * 12 | */ 13 | 14 | #ifndef UPROOT_URFcn 15 | #define UPROOT_URFcn 16 | 17 | #include 18 | 19 | #include "UpRootMinuit/URtypes.h" 20 | 21 | class URFcn 22 | { 23 | 24 | public: 25 | URFcn() {} 26 | virtual ~URFcn() {} 27 | 28 | virtual void operator()( Int_urt &npar, Double_urt *grad, Double_urt &fval, const std::vector& par, Int_urt flag) = 0; 29 | }; 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /AmpTools/GPUManager/Makefile: -------------------------------------------------------------------------------- 1 | SRCFILES := $(wildcard *.cc) 2 | CUDAFILES := $(wildcard *.cu) 3 | 4 | .PHONY: default clean 5 | .PRECIOUS: .%$(SUFFIX).o 6 | 7 | default: $(LIB) 8 | 9 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) $(CUDAFILES:%.cu=.%$(SUFFIX).o) 10 | $(vecho) "--> Archiving $@" 11 | $(Q)ar -rsc $@ $^ 12 | 13 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 14 | $(vecho) "-> Compiling $<" 15 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 16 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 17 | 18 | .%$(SUFFIX).o: %.cu .%$(SUFFIX).d 19 | $(vecho) "-> Compiling $<" 20 | $(Q)$(NVCC) $(NVCC_FLAGS) -M -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 21 | $(Q)$(NVCC) $(NVCC_FLAGS) -c -o $@ $< $(INC_DIR) 22 | 23 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) $(CUDAFILES:%.cu=.%$(SUFFIX).d) 24 | $(DEPFILES): 25 | 26 | clean: 27 | $(Q)-rm -f .*.o .*.d *.a 28 | 29 | -include $(DEPFILES) 30 | -------------------------------------------------------------------------------- /AmpTools/ROOT/README: -------------------------------------------------------------------------------- 1 | 2 | There are some AmpTools classes that can be useful to use in the context of a ROOT session. 3 | 4 | FitResults and NormIntInterface: 5 | 6 | These provide an interface to the results of a fit and can be helpful when trying to extract 7 | particular numerical results, e.g., coherent sums of amplitudes and uncertainties. 8 | 9 | ConfigurationInfo: 10 | 11 | This can be useful when one wants to write complex looping structures to generate a 12 | config file that can then be used for a fit. 13 | 14 | In order to use these classes modify your .rootrc file in your home directory and 15 | edit the MacroPath variable to include the path to this directory and the top level 16 | AmpTools source directory. 17 | 18 | Unix.*.Root.MacroPath: .:$(AMPTOOLS):$(AMPTOOLS)/ROOT: 19 | 20 | Inside of ROOT then execute: 21 | 22 | .x loadAmpTools.C 23 | 24 | This will make the classes above available for use on the ROOT command line. 25 | 26 | -------------------------------------------------------------------------------- /AmpTools/UpRootMinuit/URLinkDef.h: -------------------------------------------------------------------------------- 1 | /* @(#)root/minuit:$Name: $:$Id: URLinkDef.h,v 1.1.1.1 2006/11/15 18:01:50 mashephe Exp $ */ 2 | 3 | /************************************************************************* 4 | * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. * 5 | * All rights reserved. * 6 | * * 7 | * For the licensing terms see $ROOTSYS/LICENSE. * 8 | * For the list of contributors see $ROOTSYS/README/CREDITS. * 9 | *************************************************************************/ 10 | 11 | #ifdef __CINT__ 12 | 13 | #pragma link off all globals; 14 | #pragma link off all classes; 15 | #pragma link off all functions; 16 | 17 | #pragma link C++ global gMinuit; 18 | 19 | #pragma link C++ class TMinuit; 20 | #pragma link C++ class TFitter; 21 | 22 | #endif 23 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzDataIO/DalitzDataWriter.h: -------------------------------------------------------------------------------- 1 | #if !defined(DALITZDATAWRITER) 2 | #define DALITZDATAWRITER 3 | 4 | #include "IUAmpTools/Kinematics.h" 5 | 6 | #include "TTree.h" 7 | #include "TFile.h" 8 | 9 | class DalitzDataWriter{ 10 | 11 | public: 12 | 13 | DalitzDataWriter( const string& outFile ); 14 | ~DalitzDataWriter(); 15 | 16 | void writeEvent( const Kinematics& kin ); 17 | 18 | int eventCounter() const { return m_eventCounter; } 19 | 20 | private: 21 | 22 | TFile* m_outFile; 23 | TTree* m_outTree; 24 | int m_eventCounter; 25 | 26 | double m_EnP1; 27 | double m_PxP1; 28 | double m_PyP1; 29 | double m_PzP1; 30 | 31 | double m_EnP2; 32 | double m_PxP2; 33 | double m_PyP2; 34 | double m_PzP2; 35 | 36 | double m_EnP3; 37 | double m_PxP3; 38 | double m_PyP3; 39 | double m_PzP3; 40 | 41 | double m_weight; 42 | 43 | double m_s12; 44 | double m_s23; 45 | 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | doc/html 2 | *.a 3 | *.d 4 | *.dep 5 | *.o 6 | *.so 7 | *.pcm 8 | *.DS_Store 9 | *.SYMDEF* 10 | *.goutputstream* 11 | *compiler_flags* 12 | Tutorials/Dalitz/DalitzExe/ampPlotter 13 | Tutorials/Dalitz/DalitzExe/fitAmplitudes 14 | Tutorials/Dalitz/DalitzExe/fitAmplitudesMPI 15 | Tutorials/Dalitz/DalitzExe/generateBackground 16 | Tutorials/Dalitz/DalitzExe/generatePhaseSpace 17 | Tutorials/Dalitz/DalitzExe/generatePhysics 18 | Tutorials/Dalitz/DalitzExe/parseConfigFile 19 | Tutorials/Dalitz/DalitzExe/plotData 20 | Tutorials/Dalitz/DalitzExe/plotResults 21 | Tutorials/Dalitz/DalitzExe/printAmplitudes 22 | Tutorials/Dalitz/DalitzExe/toyAcceptance 23 | Tutorials/Dalitz/run/*.fit 24 | Tutorials/Dalitz/run/*.ni 25 | Tutorials/Dalitz/run/*.root 26 | Tutorials/Dalitz/run/test.cfg 27 | Tutorials/Dalitz/lib/* 28 | Tutorials/Dalitz/bin/* 29 | Tutorials/Dalitz/doc/*.aux 30 | Tutorials/Dalitz/doc/*.log 31 | Tutorials/Dalitz/doc/*.toc 32 | Tutorials/Dalitz/doc/*.synctex.gz 33 | 34 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/Constraint.h: -------------------------------------------------------------------------------- 1 | #if !defined(CONSTRAINT) 2 | #define CONSTRAINT 3 | 4 | #include "IUAmpTools/Neg2LnLikContrib.h" 5 | #include "IUAmpTools/UserNeg2LnLikContrib.h" 6 | #include "IUAmpTools/AmpParameter.h" 7 | #include "GPUManager/GPUCustomTypes.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include "TH1F.h" 16 | #include "TF1.h" 17 | 18 | using std::complex; 19 | using namespace std; 20 | 21 | class Constraint : public UserNeg2LnLikContrib< Constraint >{ 22 | 23 | public: 24 | 25 | Constraint() : UserNeg2LnLikContrib< Constraint >() { } 26 | 27 | Constraint( const vector< string >& args ); 28 | 29 | ~Constraint(){} 30 | 31 | string name() const { return "Constraint"; } 32 | 33 | double calcLHContribution( double x ) const; 34 | 35 | double neg2LnLikelihood(); 36 | 37 | static double drawThis(double *x, double *par); 38 | 39 | private: 40 | 41 | AmpParameter a, m0, g, bkg; 42 | TH1F *hData; 43 | TF1 *func; 44 | 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzPlot/DalitzPlotGenerator.cc: -------------------------------------------------------------------------------- 1 | 2 | #include "DalitzPlot/DalitzPlotGenerator.h" 3 | #include "IUAmpTools/Histogram1D.h" 4 | #include "IUAmpTools/Kinematics.h" 5 | #include "TLorentzVector.h" 6 | 7 | DalitzPlotGenerator::DalitzPlotGenerator( const FitResults& results ) : 8 | PlotGenerator( results ) 9 | { 10 | bookHistogram( khm12, new Histogram1D( 60, 0.0, 3.0, "hm12", "Mass( 1 2 )" ) ); 11 | bookHistogram( khm13, new Histogram1D( 60, 0.0, 3.0, "hm13", "Mass( 1 3 )" ) ); 12 | bookHistogram( khm23, new Histogram1D( 60, 0.0, 3.0, "hm23", "Mass( 2 3 )" ) ); 13 | bookHistogram( kdltz, new Histogram2D( 60, 0.0, 9.0, 60, 0.0, 9.0, "dltz", "Dalitz Plot" ) ); 14 | } 15 | 16 | void 17 | DalitzPlotGenerator::projectEvent( Kinematics* kin ){ 18 | 19 | TLorentzVector P1 = kin->particle(0); 20 | TLorentzVector P2 = kin->particle(1); 21 | TLorentzVector P3 = kin->particle(2); 22 | 23 | fillHistogram( khm12, (P1+P2).M() ); 24 | fillHistogram( khm13, (P1+P3).M() ); 25 | fillHistogram( khm23, (P2+P3).M() ); 26 | fillHistogram( kdltz, (P1+P2).M2(), (P2+P3).M2() ); 27 | } -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/Makefile: -------------------------------------------------------------------------------- 1 | 2 | SRCFILES := $(wildcard *.cc) 3 | 4 | ifdef GPU 5 | CUDAFILES := $(wildcard *cu) 6 | endif 7 | 8 | # Adam, did you put this here? 9 | FORTRAMPS := $(wildcard *.f) 10 | $(F77) := gfortran 11 | 12 | .PHONY: default clean 13 | .PRECIOUS: .%$(SUFFIX).o 14 | 15 | default: $(LIB) 16 | 17 | %.a: $(SRCFILES:%.cc=.%$(SUFFIX).o) $(FORTRAMPS:%.f=.%$(SUFFIX).o) $(CUDAFILES:%.cu=.%$(SUFFIX).o) 18 | $(vecho) "--> Archiving $@" 19 | $(Q)ar -rsc $@ $^ 20 | 21 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 22 | $(vecho) "-> Compiling $<" 23 | $(Q)$(CXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 24 | $(Q)$(CXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 25 | 26 | .%$(SUFFIX).o: %.cu .%$(SUFFIX).d 27 | $(vecho) "-> Compiling $<" 28 | $(Q)$(NVCC) $(NVCC_FLAGS) -M -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 29 | $(Q)$(NVCC) $(NVCC_FLAGS) -c -o $@ $< $(INC_DIR) 30 | 31 | .%$(SUFFIX).o: %.f 32 | $(vecho) "-> Compiling $<" 33 | $(Q)$(F77) -c -O3 -o $@ $< 34 | 35 | DEPFILES := $(SRCFILES:%.cc=.%$(SUFFIX).d) $(CUDAFILES:%.cu=.%$(SUFFIX).d) 36 | $(DEPFILES): 37 | 38 | clean: 39 | $(Q)-rm -f .*.o .*.d *.a 40 | 41 | -include $(DEPFILES) 42 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzDataIO/DalitzDataReader.h: -------------------------------------------------------------------------------- 1 | #if !defined(DALITZDATAREADER) 2 | #define DALITZDATAREADER 3 | 4 | #include 5 | #include "TString.h" 6 | #include "TFile.h" 7 | #include "TTree.h" 8 | #include "IUAmpTools/DataReader.h" 9 | #include "IUAmpTools/UserDataReader.h" 10 | 11 | using namespace std; 12 | 13 | class DalitzDataReader : public UserDataReader< DalitzDataReader >{ 14 | 15 | public: 16 | 17 | DalitzDataReader() : UserDataReader< DalitzDataReader >() { } 18 | 19 | DalitzDataReader( const vector< string >& args ); 20 | 21 | string name() const { return "DalitzDataReader"; } 22 | 23 | virtual Kinematics* getEvent(); 24 | 25 | virtual void resetSource(); 26 | 27 | virtual unsigned int numEvents() const; 28 | 29 | int eventCounter() const { return m_eventCounter; } 30 | 31 | 32 | private: 33 | 34 | TFile* m_inFile; 35 | TTree* m_inTree; 36 | int m_eventCounter; 37 | 38 | double m_EnP1; 39 | double m_PxP1; 40 | double m_PyP1; 41 | double m_PzP1; 42 | 43 | double m_EnP2; 44 | double m_PxP2; 45 | double m_PyP2; 46 | double m_PzP2; 47 | 48 | double m_EnP3; 49 | double m_PxP3; 50 | double m_PyP3; 51 | double m_PzP3; 52 | 53 | double m_weight; 54 | 55 | static const char* kModule; 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /AmpTools/ROOT/loadAmpTools.C: -------------------------------------------------------------------------------- 1 | 2 | { 3 | cout << "--------------------------------------------------" << endl; 4 | cout << "------ Loading AmpTools Modules ------" << endl; 5 | cout << "--------------------------------------------------" << endl; 6 | 7 | gROOT->ProcessLine( ".include ${AMPTOOLS}" ); 8 | 9 | cout << "Loading IUAmpTools/report.cc.." << endl; 10 | gROOT->LoadMacro( "IUAmpTools/report.cc+" ); 11 | 12 | cout << "Loading IUAmpTools/Kinematics.cc.." << endl; 13 | gROOT->LoadMacro( "IUAmpTools/Kinematics.cc+" ); 14 | 15 | cout << "Loading IUAmpTools/ConfigurationInfo.cc.." << endl; 16 | gROOT->LoadMacro( "IUAmpTools/ConfigurationInfo.cc+" ); 17 | 18 | cout << "Loading IUAmpTools/ConfigFileParser.cc.." << endl; 19 | gROOT->LoadMacro( "IUAmpTools/ConfigFileParser.cc+" ); 20 | 21 | cout << "Loading IUAmpTools/NormIntInterface.cc.." << endl; 22 | gROOT->LoadMacro( "IUAmpTools/NormIntInterface.cc+" ); 23 | 24 | cout << "Loading IUAmpTools/FitResults.cc.." << endl; 25 | gROOT->LoadMacro( "IUAmpTools/FitResults.cc+" ); 26 | 27 | cout << "--------------------------------------------------" << endl; 28 | cout << "------ Finished Loading AmpTools Modules ------" << endl; 29 | cout << "--------------------------------------------------" << endl; 30 | } 31 | -------------------------------------------------------------------------------- /AmpPlotter/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifndef AMPTOOLS_HOME 3 | $(error Please set AMPTOOLS_HOME to point to the root of the AmpTools source tree.) 4 | endif 5 | 6 | include $(AMPTOOLS_HOME)/Makefile.settings 7 | 8 | ########################################################### 9 | # Most things below here probably don't need to be changed 10 | # 11 | # (expert option for profile and tracing) 12 | # to build code instrumented for Score-P use SCOREP=1 13 | 14 | ifdef SCOREP 15 | CXX := scorep-g++ --user 16 | CXX_FLAGS += -DSCOREP_USER_ENABLE 17 | endif 18 | 19 | INC_DIR := -I.. -I$(shell root-config --incdir) -I$(AMPTOOLS) 20 | SRCDIRS := AmpPlotter 21 | 22 | # check verbose output 23 | ifdef VERBOSE 24 | Q := 25 | vecho = @true 26 | else 27 | Q := @ 28 | vecho = @echo 29 | endif 30 | 31 | CXX_FLAGS += $(shell root-config --cflags) 32 | 33 | DEFAULT := libAmpPlotter.a 34 | 35 | export 36 | 37 | .PHONY: default clean force 38 | .PRECIOUS: %.o 39 | 40 | default: lib $(DEFAULT) 41 | 42 | lib: 43 | $(Q)mkdir lib 44 | 45 | lib%.a: compiler_flags 46 | $(Q)$(MAKE) -C $* LIB=$@ 47 | $(Q)cp $*/$@ lib/ 48 | 49 | 50 | clean: $(addprefix clean_, $(SRCDIRS)) 51 | $(Q)-rm -f lib/*.a 52 | 53 | clean_%: 54 | $(Q)-cd $* && $(MAKE) clean 55 | 56 | compiler_flags: force 57 | @echo '$(CXX_FLAGS)' | cmp -s - $@ || echo '$(CXX_FLAGS)' > $@ 58 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/parseConfigFile.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "IUAmpTools/ConfigFileParser.h" 4 | #include "TString.h" 5 | #include "TH1F.h" 6 | #include "TFile.h" 7 | 8 | #include "IUAmpTools/report.h" 9 | static const char* kModule = "parseConfigFile"; 10 | 11 | using namespace std; 12 | 13 | int main(int argc, char** argv){ 14 | 15 | 16 | // ************************ 17 | // usage 18 | // ************************ 19 | 20 | if (argc <= 1){ 21 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 22 | report( NOTICE, kModule ) << "\tparseConfigFile " << endl << endl; 23 | return 0; 24 | } 25 | 26 | report( INFO, kModule ) << endl << " *** Parse the Config File *** " << endl << endl; 27 | 28 | // ************************ 29 | // parse the command line parameters 30 | // ************************ 31 | 32 | string configfile(argv[1]); 33 | 34 | report( INFO, kModule ) << "config file name = " << configfile << endl << endl; 35 | 36 | 37 | // ************************ 38 | // parse the config file 39 | // ************************ 40 | 41 | ConfigFileParser::setVerboseParsing(true); 42 | 43 | // method 1 44 | //ConfigFileParser parser(configfile); 45 | 46 | // method 2 47 | ConfigFileParser parser; 48 | ifstream infile(configfile.c_str()); 49 | infile >> parser; 50 | infile.close(); 51 | 52 | parser.getConfigurationInfo()->display(); 53 | 54 | parser.getConfigurationInfo()->write("testWrite.cfg"); 55 | 56 | } 57 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/BreitWigner_kernel.cu: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | 4 | #include "GPUManager/GPUCustomTypes.h" 5 | #include "GPUManager/CUDA-Complex.cuh" 6 | 7 | 8 | __global__ void 9 | BreitWigner_kernel( GPU_AMP_PROTO, GDouble mass0, GDouble width0, 10 | int daught1, int daught2 ){ 11 | 12 | int iEvent = GPU_THIS_EVENT; 13 | 14 | /**** 15 | * Equivalently one could switch needsUserVarsOnly to false 16 | * and uncomment the following lines to get the same 17 | * result. The role of user-data is to optimize this function 18 | * call in the instance it is repeated multiple times throughout 19 | * a fit. 20 | 21 | GDouble p1[4] = GPU_P4(daught1-1); 22 | GDouble p2[4] = GPU_P4(daught2-1); 23 | 24 | GDouble m = G_SQRT(SQ(p1[0]+p2[0]) - SQ(p1[1]+p2[1]) 25 | - SQ(p1[2]+p2[2]) 26 | - SQ(p1[3]+p2[3])); 27 | 28 | WCUComplex bwBot = { SQ( m ) - SQ( mass0 ), mass0 * width0 }; 29 | */ 30 | 31 | 32 | // here we need to be careful to index the user-defined 33 | // data with the proper integer corresponding to the 34 | // enumeration in the C++ header file 35 | 36 | GDouble m2 = GPU_UVARS(0); 37 | WCUComplex bwBot = { m2 - SQ( mass0 ), mass0 * width0 }; 38 | 39 | pcDevAmp[iEvent] = ( 1.0 / bwBot ); 40 | 41 | } 42 | 43 | 44 | void 45 | BreitWigner_exec( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO, 46 | GDouble mass, GDouble width, 47 | int daught1, int daught2 ) 48 | { 49 | 50 | BreitWigner_kernel<<< dimGrid, dimBlock >>> 51 | ( GPU_AMP_ARGS, mass, width, daught1, daught2 ); 52 | 53 | } 54 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 2 | 3 | ^ 4 | / \ 5 | /---\ 6 | / \ 7 | / \ MP 8 | ------- 9 | | 10 | | 11 | | OOLS 12 | 13 | 14 | AmpTools is library to facilitate performing unbinned maximum likelihood 15 | fits of experimental data to a coherent sum of amplitudes. For 16 | additional documentation refer to the AmpTools_User_Guide.pdf file 17 | distributed with this code. 18 | 19 | If you use AmpTools for data analysis that results in a publication, 20 | please cite the source using the DOI specific to the version you used which 21 | can be located by following the general DOI: 22 | 23 | doi.org/10.5281/zenodo.5039377 24 | 25 | The entire source tree, including the Tutorial, should build from this 26 | top level directory by invoking make. Prior to building, be sure 27 | that root-config is in your path and check/adjust the Makefile.settings 28 | as needed. 29 | 30 | Three modules are included with the distribution and individual README files, 31 | are contained within each module. These README files should be 32 | referenced for details about various releases. 33 | 34 | AmpTools: This is the main AmpTools library. Once compiled it includes 35 | no executable code, but provides functionality and an interface that the 36 | user can utilize to perform analyses. 37 | 38 | Tutorials: This contains a couple of examples of how to utilize the AmpTools 39 | library. We try to keep these up to date as AmpTools develops. It is 40 | recommended that user explore the Dalitz tutorial. 41 | 42 | AmpPlotter: This is an optional package that provides a GUI interface 43 | for viewing the projections of a fit. It enables visualization of the 44 | contributions of various amplitudes to the fit. 45 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/Constraint.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include "DalitzAmp/Constraint.h" 9 | 10 | Constraint::Constraint( const vector< string >& args ) : 11 | UserNeg2LnLikContrib< Constraint >(args) 12 | { 13 | assert(args.size()==4); 14 | a = AmpParameter(args[0]); 15 | m0 = AmpParameter(args[1]); 16 | g = AmpParameter(args[2]); 17 | bkg = AmpParameter(args[3]); 18 | registerParameter(a); 19 | registerParameter(m0); 20 | registerParameter(g); 21 | registerParameter(bkg); 22 | 23 | /** in principle, the idea is to read in some external (binned) data here 24 | * here, we don't have any and thus just generate some toy data 25 | */ 26 | func = new TF1("func",Constraint::drawThis,0,2,4); 27 | func->SetParameters(1,1.0,0.2,0.5); 28 | hData = new TH1F("hData","",100,0,2); 29 | for(int ev=0;ev<5000;ev++) 30 | hData->Fill(func->GetRandom()); 31 | 32 | hData->SaveAs("external_data.root"); 33 | } 34 | 35 | double 36 | Constraint::calcLHContribution( double x ) const { 37 | double s = pow(x,2); 38 | complex amp = complex(a,0.0) / complex(s-m0*m0,m0*g); 39 | return norm(amp) + bkg; 40 | } 41 | 42 | double Constraint::drawThis(double *x, double *par){ 43 | double s = pow(x[0],2); 44 | complex amp = complex(par[0],0.0) / complex(s-par[1]*par[1],par[1]*par[2]); 45 | return norm(amp) + par[3]; 46 | } 47 | 48 | double 49 | Constraint::neg2LnLikelihood(){ 50 | double chi2=0; 51 | for(int i=1;i<=hData->GetNbinsX();i++){ 52 | double _x = hData->GetBinCenter(i); 53 | double _y = hData->GetBinContent(i); 54 | double _ey = hData->GetBinError(i); 55 | if(_ey) 56 | chi2 += pow(calcLHContribution(_x)-_y,2)/pow(_ey,2); 57 | } 58 | return chi2; 59 | } 60 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/plotResult.C: -------------------------------------------------------------------------------- 1 | 2 | TCanvas* c1; 3 | void plotProjections(int canvas, TString projection); 4 | 5 | 6 | void plotResult(){ 7 | 8 | 9 | c1 = new TCanvas("c1","c1",800,800); 10 | c1->Divide(2,2); 11 | 12 | 13 | _file1->cd(); 14 | 15 | plotProjections(2,"12"); 16 | plotProjections(3,"23"); 17 | plotProjections(4,"13"); 18 | 19 | 20 | _file0->cd(); 21 | 22 | TH2F* hs12s23 = (TH2F*) gDirectory->FindObjectAny("hs12s23"); 23 | 24 | c1->cd(1); 25 | hs12s23->Draw("colz"); 26 | 27 | TLegend* tl = new TLegend(0.6,0.77,0.85,0.85); 28 | tl->AddEntry(hs12s23,"DATA",""); 29 | tl->Draw("same"); 30 | 31 | 32 | c1->cd(); 33 | 34 | } 35 | 36 | 37 | 38 | void plotProjections(int canvas, TString projection){ 39 | 40 | c1->cd(canvas); 41 | 42 | TH1F* hmdat = (TH1F*) gDirectory->FindObjectAny("hm"+projection+"dat"); 43 | TH1F* hmacc = (TH1F*) gDirectory->FindObjectAny("hm"+projection+"acc"); 44 | TH1F* hmacc1 = (TH1F*) gDirectory->FindObjectAny("hm"+projection+"acc1"); 45 | TH1F* hmacc2 = (TH1F*) gDirectory->FindObjectAny("hm"+projection+"acc2"); 46 | 47 | hmdat->SetTitleOffset(2.0,"Y"); 48 | hmdat->SetTitleOffset(1.6,"X"); 49 | hmdat->SetMarkerStyle(20); 50 | hmdat->SetMarkerSize(0.5); 51 | hmdat->SetLineColor(kBlack); 52 | 53 | hmacc->SetLineColor(kBlack); 54 | hmacc->SetLineWidth(2.0); 55 | 56 | hmacc1->SetLineColor(kRed); 57 | hmacc1->SetLineWidth(2.0); 58 | 59 | hmacc2->SetLineColor(kBlue); 60 | hmacc2->SetLineWidth(2.0); 61 | 62 | hmdat->Draw(); 63 | hmacc->Draw("hist,same"); 64 | hmacc1->Draw("hist,same"); 65 | hmacc2->Draw("hist,same"); 66 | hmdat->Draw("same"); 67 | 68 | TLegend* tl = new TLegend(0.6,0.65,0.85,0.85); 69 | if (projection == "23") tl = new TLegend(0.2,0.65,0.45,0.85); 70 | tl->AddEntry(hm12dat,"DATA","p"); 71 | tl->AddEntry(hm12acc,"FIT","l"); 72 | tl->AddEntry(hm12acc1,"AMP1","l"); 73 | tl->AddEntry(hm12acc2,"AMP2","l"); 74 | tl->Draw("same"); 75 | 76 | } 77 | 78 | 79 | -------------------------------------------------------------------------------- /AmpPlotter/README: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // 3 | // See individual source files for license information. 4 | // 5 | // This software written by Matthew Shepherd at Indiana University 6 | // 7 | //****************************************************************************** 8 | 9 | This library contains a GUI for plotting both data and fit-weighted MC for 10 | a single fit. The user can turn off and on different reactions, coherent sums, 11 | and amplitudes to see how the various fit components contribute to the 12 | projection of a variable. This directory contains only the library that 13 | supports the GUI application. 14 | 15 | The user needs to write a specialized PlotGenerator 16 | class and also a short executable that invokes the GUI. Examples of both 17 | of these can be found in the following locations in this repository: 18 | 19 | The class to make the user-defined kinematic projections: 20 | 21 | Tutorials/Dalitz/DalitzLib/DalitzPlot/DalitzPlotGenerator.h 22 | 23 | The user-specialized application for running the GUI: 24 | 25 | Tutorials/Dalitz/DalitzExe/ampPlotter.cc 26 | 27 | 28 | RELEASE NOTES: 29 | 30 | v0.12.0 (28-Jun-2021): 31 | 32 | This release provides a GUI checkbox that lets the user toggle off 33 | and on the weighting of the MC by the fit model. 34 | 35 | v0.11.0 (19-Jan-2021): 36 | 37 | Fix bug that resulted in improper initialization of check boxes for various 38 | reactions in the case a multiple reaction fit is used. 39 | 40 | In this version the GUI takes advantage of the ability for the PlotGenerator 41 | class to be created without the generated MC to conserve memory. If this 42 | use case is detected, the Generated MC button will be grayed out. 43 | 44 | If a background file is not specified the background button will be disabled 45 | and grayed out. 46 | 47 | v0.6 (28-Jun-13): 48 | 49 | No changes to AmpPlotter with this release. 50 | 51 | v0.5 (16-Nov-12): 52 | 53 | First release that includes AmpPlotter. 54 | 55 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | # try to catch common previous uses that will bungle things up... 3 | 4 | ifdef MPI 5 | $(error Use the mpi target 'make mpi' rather than setting MPI=1.) 6 | endif 7 | 8 | ifdef GPU 9 | $(error Use the gpu target 'make gpu' rather than setting GPU=1.) 10 | endif 11 | 12 | AMPTOOLS_HOME := $(shell pwd) 13 | AMPTOOLS := $(AMPTOOLS_HOME)/AmpTools 14 | AMPPLOTTER := $(AMPTOOLS_HOME)/AmpPlotter 15 | 16 | export 17 | 18 | .PHONY: default all mpi gpu mpigpu gpumpi clean 19 | 20 | default: 21 | @echo "=== Building AmpTools ===" 22 | @$(MAKE) -C AmpTools 23 | @echo "=== Building AmpPlotter ===" 24 | @$(MAKE) -C AmpPlotter 25 | @echo "=== Building Dalitz tutorial ===" 26 | @$(MAKE) -C Tutorials/Dalitz 27 | @echo "=== Building UnitTests ===" 28 | @$(MAKE) -C UnitTests 29 | 30 | mpi: default 31 | @echo "=== Building AmpTools with MPI ===" 32 | @$(MAKE) -C AmpTools MPI=1 33 | @echo "=== Building Dalitz tutorial with MPI ===" 34 | @$(MAKE) -C Tutorials/Dalitz MPI=1 35 | @echo "=== Building UnitTests with MPI ===" 36 | @$(MAKE) -C UnitTests MPI=1 37 | 38 | gpu: 39 | @echo "=== Building AmpTools with GPU acceleration ===" 40 | @$(MAKE) -C AmpTools GPU=1 41 | @echo "=== Building AmpPlotter ===" 42 | @$(MAKE) -C AmpPlotter 43 | @echo "=== Building Dalitz tutorial with GPU acceleration ===" 44 | @$(MAKE) -C Tutorials/Dalitz GPU=1 45 | @echo "=== Building UnitTests with GPU acceleration ===" 46 | @$(MAKE) -C UnitTests GPU=1 47 | 48 | mpigpu: gpu 49 | @echo "=== Building AmpTools with MPI and GPU acceleration ===" 50 | @$(MAKE) -C AmpTools GPU=1 MPI=1 51 | @echo "=== Building AmpPlotter ===" 52 | @$(MAKE) -C AmpPlotter 53 | @echo "=== Building Dalitz tutorial with MPI and GPU acceleration ===" 54 | @$(MAKE) -C Tutorials/Dalitz MPI=1 GPU=1 55 | @echo "=== Building UnitTests with MPI and GPU acceleration ===" 56 | @$(MAKE) -C UnitTests MPI=1 GPU=1 57 | 58 | gpumpi: mpigpu 59 | 60 | clean: 61 | @$(MAKE) -C AmpTools clean 62 | @$(MAKE) -C AmpPlotter clean 63 | @$(MAKE) -C Tutorials/Dalitz clean 64 | @$(MAKE) -C UnitTests clean 65 | 66 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/UserNeg2LnLikContrib.h: -------------------------------------------------------------------------------- 1 | #if !(defined USERNEG2LNLIKCONTRIB) 2 | #define USERNEG2LNLIKCONTRIB 3 | 4 | 5 | #include 6 | #include 7 | #include "IUAmpTools/Neg2LnLikContrib.h" 8 | 9 | using namespace std; 10 | 11 | template< class T > 12 | class UserNeg2LnLikContrib : public Neg2LnLikContrib 13 | { 14 | 15 | public: 16 | 17 | /** 18 | * This is the default constructor. It should be called in the default 19 | * constructor of the user's derived class. 20 | */ 21 | UserNeg2LnLikContrib() : Neg2LnLikContrib() { } 22 | 23 | 24 | /** 25 | * This constructor takes a list of arguments and stores them. There should 26 | * be a corresponding constructor in the user's derived class that calls 27 | * this constructor. 28 | */ 29 | UserNeg2LnLikContrib( const vector< string >& args ) : Neg2LnLikContrib( args ) { } 30 | 31 | 32 | /** 33 | * This is the destructor. 34 | */ 35 | ~UserNeg2LnLikContrib() { 36 | 37 | for( typename map< string, T* >::iterator amp = m_ampInstances.begin(); 38 | amp != m_ampInstances.end(); ++amp ){ 39 | 40 | delete amp->second; 41 | } 42 | } 43 | 44 | Neg2LnLikContrib* newNeg2LnLikContrib( const vector< string >& args ) const{ 45 | 46 | // we need the identifier of the new amplitude first: 47 | T* newAmp = new T( args ); 48 | 49 | string ident = newAmp->identifier(); 50 | 51 | if( m_ampInstances.find( ident ) == m_ampInstances.end() ){ 52 | 53 | m_ampInstances[ident] = newAmp; 54 | } 55 | else{ 56 | 57 | // already have a functional instance, so delete this one 58 | delete newAmp; 59 | } 60 | 61 | return m_ampInstances[ident]; 62 | } 63 | 64 | 65 | /** 66 | * This method can create a clone of an amplitude (of the derived type). 67 | */ 68 | Neg2LnLikContrib* clone() const { 69 | 70 | return ( isDefault() ? new T() : new T( arguments() ) ); 71 | } 72 | 73 | private: 74 | 75 | mutable map< string, T* > m_ampInstances; 76 | 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/printAmplitudes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "TString.h" 4 | #include "TH1F.h" 5 | #include "TFile.h" 6 | #include "IUAmpTools/AmplitudeManager.h" 7 | #include "IUAmpTools/ConfigFileParser.h" 8 | #include "IUAmpTools/ConfigurationInfo.h" 9 | #include "IUAmpTools/AmpToolsInterface.h" 10 | #include "DalitzDataIO/DalitzDataReader.h" 11 | #include "DalitzAmp/BreitWigner.h" 12 | 13 | using namespace std; 14 | 15 | #include "IUAmpTools/report.h" 16 | static const char* kModule = "printAmplitudes"; 17 | 18 | int main(int argc, char** argv){ 19 | 20 | 21 | // ************************ 22 | // usage 23 | // ************************ 24 | 25 | if (argc <= 1){ 26 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 27 | report( NOTICE, kModule ) << "\tprintAmplitudes " << endl << endl; 28 | return 0; 29 | } 30 | 31 | report( INFO, kModule ) << endl << " *** Printing Amplitudes *** " << endl << endl; 32 | 33 | // ************************ 34 | // parse the command line parameters 35 | // ************************ 36 | 37 | string cfgname(argv[1]); 38 | 39 | report( INFO, kModule ) << "Config file name = " << cfgname << endl << endl; 40 | 41 | 42 | // ************************ 43 | // parse the config file 44 | // ************************ 45 | 46 | ConfigFileParser parser(cfgname); 47 | ConfigurationInfo* cfgInfo = parser.getConfigurationInfo(); 48 | cfgInfo->display(); 49 | 50 | 51 | // ************************ 52 | // AmpToolsInterface 53 | // ************************ 54 | 55 | AmpToolsInterface::registerAmplitude(BreitWigner()); 56 | AmpToolsInterface::registerDataReader(DalitzDataReader()); 57 | 58 | AmpToolsInterface ATI(cfgInfo, AmpToolsInterface::kPlotGeneration); 59 | 60 | DataReader* dataReader = ATI.genMCReader(cfgInfo->reactionList()[0]->reactionName()); 61 | for (int i = 0; i < 10; i++){ 62 | Kinematics* kin = dataReader->getEvent(); 63 | ATI.printEventDetails(cfgInfo->reactionList()[0]->reactionName(),kin); 64 | delete kin; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifndef PROJECT 3 | PROJECT := Dalitz 4 | endif 5 | 6 | ifndef PROJECT_HOME 7 | PROJECT_HOME := .. 8 | endif 9 | 10 | ifndef AMPTOOLS_HOME 11 | $(error Please set AMPTOOLS_HOME to point to the root of the AmpTools source tree. ) 12 | endif 13 | 14 | include $(AMPTOOLS_HOME)/Makefile.settings 15 | 16 | ############################################################ 17 | # Most things below here probably don't need to be changed 18 | # 19 | # (expert option for profile and tracing) 20 | # to build code instrumented for Score-P use SCOREP=1 21 | 22 | INC_DIR := -I$(PROJECT_HOME)/$(PROJECT)Lib -I$(shell root-config --incdir) -I$(AMPTOOLS) 23 | CXX_FLAGS += $(shell root-config --cflags) 24 | 25 | ifdef SCOREP 26 | CXX := scorep-g++ --user 27 | CXX_FLAGS += -DSCOREP_USER_ENABLE 28 | INC_DIR += -I$(SCOREP_INC) 29 | endif 30 | 31 | ifndef INSTALL_LIB 32 | INSTALL_LIB = $(PROJECT_HOME)/lib 33 | endif 34 | 35 | SRCDIRS := $(PROJECT)DataIO $(PROJECT)Amp $(PROJECT)Plot 36 | 37 | # check if GPU build is requested 38 | ifdef GPU 39 | INC_DIR += -I$(CUDA_INSTALL_PATH)/include 40 | CXX_FLAGS += -DGPU_ACCELERATION 41 | SUFFIX := _GPU 42 | endif 43 | 44 | # setup the targets 45 | DEFAULT := lib$(PROJECT)$(SUFFIX).a 46 | TARGET_LIBS := $(SRCDIRS:%=lib%$(SUFFIX).a) 47 | 48 | export 49 | 50 | .PHONY: test default clean lib 51 | 52 | default: lib $(DEFAULT) 53 | 54 | lib: 55 | $(Q)-mkdir $(INSTALL_LIB) >& /dev/null ||: 56 | 57 | $(DEFAULT): $(TARGET_LIBS) 58 | $(foreach lib, $(TARGET_LIBS), $(shell cd $(INSTALL_LIB); ar -x $(lib) ) ) 59 | $(Q)(cd $(INSTALL_LIB) && ar -rsc $@ .*$(SUFFIX).o && ranlib $@) 60 | $(Q)(cd $(INSTALL_LIB) && rm -f .*$(SUFFIX).o) 61 | $(Q)(cd $(INSTALL_LIB) && rm -f $(TARGET_LIBS)) 62 | $(Q)-rm -f $(INSTALL_LIB)/__* 63 | $(vecho) "=== Build of $@ is complete. ===" 64 | 65 | # descend into the directory obtained by stripping lib and 66 | # $(SUFFIX).a and execute make with LIB set to the target 67 | lib%$(SUFFIX).a: 68 | $(Q)$(MAKE) -C $* LIB=$@ 69 | $(Q)cp $*/$@ $(INSTALL_LIB)/ 70 | 71 | clean: 72 | $(Q)-cd $(PROJECT)DataIO && $(MAKE) clean 73 | $(Q)-cd $(PROJECT)Amp && $(MAKE) clean 74 | $(Q)-cd $(PROJECT)Plot && $(MAKE) clean 75 | -------------------------------------------------------------------------------- /Tutorials/README: -------------------------------------------------------------------------------- 1 | 2 | This directory contains a collection of Tutorials that utilize AmpTools and supporting 3 | libraries. Each directory contains the types of classes that a user might write to 4 | do a physics analysis using AmpTools. Check the doc subdirectory of each tutorial 5 | for more information. 6 | 7 | Dalitz 8 | ------ 9 | 10 | Author: Ryan Mitchell (remitche@indiana.edu) 11 | 12 | A simple example of a Dalitz plot analysis. It illustrates generating MC and a toy 13 | data set for fitting. This example can also be compiled to use MPI and GPU acceleration. 14 | 15 | 16 | RELEASE NOTES: 17 | 18 | v0.13.0 (11-Feb-2022): 19 | 20 | Revised directory structure to relflect changes overall to the AmpTools build 21 | system. Now DalitzLib and DalitzExe are distinct subdirectories. The former 22 | is compiled into a single library while the latter contains executables. 23 | DalitzExe can be moved out the tree and the makefile can be altered to 24 | link additional libraries if needed. Most (all?) code is functionally 25 | equivalent to previous versions. 26 | 27 | v0.12 (28-Jun-21): 28 | 29 | A new structure for MPI-based fitting is reflected in the fitAmplitudes 30 | executable. This allows multiple subsequent fits to be run in a single 31 | executable, e.g., when fitting with randomized fit parameters. 32 | 33 | v0.11 (19-Jan-21): 34 | 35 | Removed gammaKK tutorial because it has not been maintained 36 | and checked for functionality. 37 | 38 | Include copyDalitz.py script to copy the Dalitz tutorial to create 39 | a template that can be edited for a new analysis. 40 | 41 | v0.10 (10-Jun-19): 42 | 43 | Add ability to precalculate user variables to BreitWigner amplitude inside 44 | of the Dalitz tutorial. 45 | 46 | v0.8 (17-Jun-15): 47 | 48 | Fix a bug that appears on some platforms in newer versions of ROOT where the 49 | user gets "missing dictionary" warnings and occassionally a segmentation 50 | fault. 51 | 52 | Modify all tutorials to remove dependence on CLHEP. 53 | 54 | v0.6 (28-Jun-13): 55 | 56 | Modify to make compatible with v0.6 of AmpTools. This mainly involves more complete 57 | utilization of the new FitResults class. 58 | 59 | v0.5 (16-Nov-12): 60 | 61 | First release that includes Tutorials. 62 | 63 | -------------------------------------------------------------------------------- /AmpTools/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ifndef AMPTOOLS_HOME 3 | $(error Please set AMPTOOLS_HOME to point to the root of the AmpTools source tree. ) 4 | endif 5 | 6 | include $(AMPTOOLS_HOME)/Makefile.settings 7 | 8 | ############################################################ 9 | # Most things below here probably don't need to be changed 10 | # 11 | # (expert option for profile and tracing) 12 | # to build code instrumented for Score-P use SCOREP=1 13 | 14 | ifdef SCOREP 15 | CXX := scorep-g++ --user 16 | 17 | CXX_FLAGS += -DSCOREP_USER_ENABLE 18 | endif 19 | 20 | INC_DIR := -I.. -I$(shell root-config --incdir) 21 | ifdef SCOREP 22 | INC_DIR += -I$(SCOREP_INC) 23 | endif 24 | 25 | 26 | CXX_FLAGS += $(shell root-config --cflags) 27 | 28 | SRCDIRS := UpRootMinuit MinuitInterface IUAmpTools 29 | ALLDIRS := $(SRCDIRS) IUAmpToolsMPI GPUManager 30 | 31 | # check if GPU build is requested 32 | ifdef GPU 33 | SRCDIRS += GPUManager 34 | INC_DIR += -I$(CUDA_INSTALL_PATH)/include 35 | CXX_FLAGS += -DGPU_ACCELERATION 36 | SUFFIX := _GPU 37 | endif 38 | 39 | # check if MPI build is requested 40 | ifdef MPI 41 | CXX := $(MPICXX) 42 | ifdef SCOREP 43 | CXX := scorep --mpp=mpi --user mpicxx 44 | endif 45 | SRCDIRS += IUAmpToolsMPI 46 | CXX_FLAGS += -DUSE_MPI 47 | SUFFIX := $(SUFFIX)_MPI 48 | endif 49 | 50 | # setup the targets 51 | DEFAULT := libAmpTools$(SUFFIX).a 52 | TARGET_LIBS := $(SRCDIRS:%=lib%$(SUFFIX).a) 53 | 54 | export 55 | 56 | .PHONY: default clean force 57 | 58 | default: lib $(DEFAULT) 59 | 60 | lib: 61 | $(Q)mkdir lib 62 | 63 | $(DEFAULT): compiler_flags $(TARGET_LIBS) 64 | $(foreach lib, $(TARGET_LIBS), $(shell cd lib; ar -x $(lib) ) ) 65 | $(Q)(cd lib && ar -rsc $@ .*$(SUFFIX).o && ranlib $@) 66 | $(Q)(cd lib && rm -f .*$(SUFFIX).o) 67 | $(Q)(cd lib && rm -f $(TARGET_LIBS)) 68 | $(Q)-rm -f lib/__* 69 | $(vecho) "=== Build of $@ is complete. ===" 70 | 71 | # descend into the directory obtained by stripping lib and 72 | # $(SUFFIX).a and execute make with LIB set to the target 73 | lib%$(SUFFIX).a: 74 | $(Q)$(MAKE) -C $* LIB=$@ 75 | $(Q)cp $*/$@ lib/ 76 | 77 | # cleaning 78 | clean: $(addprefix clean_, $(ALLDIRS)) 79 | $(Q)-rm -f lib/* 80 | 81 | clean_%: 82 | $(Q)-cd $* && $(MAKE) clean 83 | 84 | compiler_flags: force 85 | @echo '$(CXX_FLAGS)' | cmp -s - $@ || echo '$(CXX_FLAGS)' > $@ 86 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/MIObserver.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_MIOBSERVER_H) 2 | #define MINUITINTERFACE_MIOBSERVER_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | class MISubject; 40 | 41 | class MIObserver { 42 | 43 | public: 44 | 45 | MIObserver() {} 46 | virtual ~MIObserver() {} 47 | 48 | virtual void update( const MISubject* ) = 0; 49 | 50 | protected: 51 | 52 | private: 53 | 54 | // --------- member data ---------- 55 | 56 | }; 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/copyDalitz.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | 5 | if len(sys.argv) != 2: 6 | print "Usage:" 7 | print " copyDalitz.py " 8 | print " e.g. copyDalitz.py $HOME/PWA/Psi3Body" 9 | print " creates a new example package called Psi3Body" 10 | print " in the existing directory $HOME/PWA/" 11 | exit() 12 | 13 | outputInfo = sys.argv[1]; 14 | for i in range(5): 15 | outputInfo = outputInfo.replace("//","/") 16 | outputDirBase = outputInfo.rpartition("/")[0]; 17 | outputNameBase = outputInfo.rpartition("/")[2]; 18 | print "----------------------------" 19 | print "-- creating a new package --" 20 | print "----------------------------" 21 | print " directory: ", outputDirBase; 22 | print " new name: ", outputNameBase; 23 | print "" 24 | yn = str(raw_input("continue? (y/n) ")).upper() 25 | if yn != "Y": 26 | exit() 27 | print "" 28 | 29 | for root, dirs, files in os.walk("."): 30 | if root == ".": 31 | root = "" 32 | if root[:2] == "./": 33 | root = root.replace("./","",1) 34 | inputDirBase = root 35 | root = root.replace("Dalitz",outputNameBase); 36 | root = root.replace("DALITZ",outputNameBase.upper()); 37 | root = root.replace("dalitz",outputNameBase.lower()); 38 | outputDirectory = outputDirBase+"/"+outputNameBase+"/"+root 39 | if root == "": 40 | outputDirectory = outputDirBase+"/"+outputNameBase 41 | if (root == "doc" or root == "lib"): 42 | continue 43 | print "make new directory: ", outputDirectory 44 | os.mkdir(outputDirectory) 45 | for name in files: 46 | if name[-3:] == ".py": 47 | continue 48 | inputName = inputDirBase+"/"+name 49 | if inputDirBase == "": 50 | inputName = name 51 | name = name.replace("Dalitz",outputNameBase); 52 | name = name.replace("DALITZ",outputNameBase.upper()); 53 | name = name.replace("dalitz",outputNameBase.lower()); 54 | outputName = outputDirectory+"/"+name 55 | print "make new file: ", outputName 56 | inputFile = open(inputName,"r") 57 | outputFile = open(outputName,"w") 58 | for line in inputFile: 59 | line = line.replace("Dalitz",outputNameBase); 60 | line = line.replace("DALITZ",outputNameBase.upper()); 61 | line = line.replace("dalitz",outputNameBase.lower()); 62 | outputFile.write(line) 63 | inputFile.close() 64 | outputFile.close() 65 | 66 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzDataIO/DalitzDataWriter.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | 5 | #include "DalitzDataIO/DalitzDataWriter.h" 6 | 7 | #include "TLorentzVector.h" 8 | #include "TFile.h" 9 | #include "TTree.h" 10 | #include "TH1.h" 11 | #include "TSystem.h" 12 | 13 | DalitzDataWriter::DalitzDataWriter( const string& outFile ){ 14 | 15 | TH1::AddDirectory( kFALSE ); 16 | gSystem->Load( "libTree" ); 17 | 18 | m_outFile = new TFile( outFile.c_str(), "recreate" ); 19 | m_outTree = new TTree( "nt", "nt" ); 20 | 21 | m_outTree->Branch( "EnP1", &m_EnP1, "EnP1/D" ); 22 | m_outTree->Branch( "PxP1", &m_PxP1, "PxP1/D" ); 23 | m_outTree->Branch( "PyP1", &m_PyP1, "PyP1/D" ); 24 | m_outTree->Branch( "PzP1", &m_PzP1, "PzP1/D" ); 25 | 26 | m_outTree->Branch( "EnP2", &m_EnP2, "EnP2/D" ); 27 | m_outTree->Branch( "PxP2", &m_PxP2, "PxP2/D" ); 28 | m_outTree->Branch( "PyP2", &m_PyP2, "PyP2/D" ); 29 | m_outTree->Branch( "PzP2", &m_PzP2, "PzP2/D" ); 30 | 31 | m_outTree->Branch( "EnP3", &m_EnP3, "EnP3/D" ); 32 | m_outTree->Branch( "PxP3", &m_PxP3, "PxP3/D" ); 33 | m_outTree->Branch( "PyP3", &m_PyP3, "PyP3/D" ); 34 | m_outTree->Branch( "PzP3", &m_PzP3, "PzP3/D" ); 35 | 36 | m_outTree->Branch( "s12", &m_s12, "s12/D" ); 37 | m_outTree->Branch( "s23", &m_s23, "s23/D" ); 38 | 39 | m_outTree->Branch( "weight", &m_weight, "weight/D" ); 40 | 41 | m_eventCounter = 0; 42 | 43 | } 44 | 45 | 46 | DalitzDataWriter::~DalitzDataWriter(){ 47 | 48 | m_outFile->cd(); 49 | m_outTree->Write(); 50 | m_outFile->Close(); 51 | 52 | } 53 | 54 | 55 | void 56 | DalitzDataWriter::writeEvent( const Kinematics& kin ){ 57 | 58 | vector< TLorentzVector > particleList = kin.particleList(); 59 | 60 | m_EnP1 = particleList[0].E(); 61 | m_PxP1 = particleList[0].Px(); 62 | m_PyP1 = particleList[0].Py(); 63 | m_PzP1 = particleList[0].Pz(); 64 | 65 | m_EnP2 = particleList[1].E(); 66 | m_PxP2 = particleList[1].Px(); 67 | m_PyP2 = particleList[1].Py(); 68 | m_PzP2 = particleList[1].Pz(); 69 | 70 | m_EnP3 = particleList[2].E(); 71 | m_PxP3 = particleList[2].Px(); 72 | m_PyP3 = particleList[2].Py(); 73 | m_PzP3 = particleList[2].Pz(); 74 | 75 | m_s12 = (particleList[0]+particleList[1]).M2(); 76 | m_s23 = (particleList[1]+particleList[2]).M2(); 77 | 78 | m_weight = kin.weight(); 79 | 80 | m_outTree->Fill(); 81 | 82 | m_eventCounter++; 83 | 84 | } 85 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/copyDalitz3.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | import sys 3 | import os 4 | 5 | if len(sys.argv) != 2: 6 | print("Usage:") 7 | print(" copyDalitz.py ") 8 | print(" e.g. copyDalitz.py $HOME/PWA/Psi3Body") 9 | print(" creates a new example package called Psi3Body") 10 | print(" in the existing directory $HOME/PWA/") 11 | exit() 12 | 13 | outputInfo = sys.argv[1]; 14 | for i in range(5): 15 | outputInfo = outputInfo.replace("//","/") 16 | outputDirBase = outputInfo.rpartition("/")[0]; 17 | outputNameBase = outputInfo.rpartition("/")[2]; 18 | print("----------------------------") 19 | print("-- creating a new package --") 20 | print("----------------------------") 21 | print(" directory: ", outputDirBase); 22 | print(" new name: ", outputNameBase); 23 | print("") 24 | yn = str(input("continue? (y/n) ")).upper() 25 | if yn != "Y": 26 | exit() 27 | print("") 28 | 29 | for root, dirs, files in os.walk("."): 30 | if root == ".": 31 | root = "" 32 | if root[:2] == "./": 33 | root = root.replace("./","",1) 34 | inputDirBase = root 35 | root = root.replace("Dalitz",outputNameBase); 36 | root = root.replace("DALITZ",outputNameBase.upper()); 37 | root = root.replace("dalitz",outputNameBase.lower()); 38 | outputDirectory = outputDirBase+"/"+outputNameBase+"/"+root 39 | if root == "": 40 | outputDirectory = outputDirBase+"/"+outputNameBase 41 | if (root == "doc" or root == "lib"): 42 | continue 43 | print("make new directory: ", outputDirectory) 44 | os.mkdir(outputDirectory) 45 | for name in files: 46 | if name[-3:] == ".py": 47 | continue 48 | inputName = inputDirBase+"/"+name 49 | if inputDirBase == "": 50 | inputName = name 51 | name = name.replace("Dalitz",outputNameBase); 52 | name = name.replace("DALITZ",outputNameBase.upper()); 53 | name = name.replace("dalitz",outputNameBase.lower()); 54 | outputName = outputDirectory+"/"+name 55 | print("make new file: ", outputName) 56 | inputFile = open(inputName,"r",encoding = "ISO-8859-1") 57 | outputFile = open(outputName,"w") 58 | for line in inputFile: 59 | line = line.replace("Dalitz",outputNameBase); 60 | line = line.replace("DALITZ",outputNameBase.upper()); 61 | line = line.replace("dalitz",outputNameBase.lower()); 62 | outputFile.write(line) 63 | inputFile.close() 64 | outputFile.close() 65 | 66 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/BreitWigner.h: -------------------------------------------------------------------------------- 1 | #if !defined(BREITWIGNER) 2 | #define BREITWIGNER 3 | 4 | #include "IUAmpTools/Amplitude.h" 5 | #include "IUAmpTools/UserAmplitude.h" 6 | #include "IUAmpTools/AmpParameter.h" 7 | #include "GPUManager/GPUCustomTypes.h" 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #ifdef GPU_ACCELERATION 15 | 16 | void BreitWigner_exec( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO, 17 | GDouble mass, GDouble width, 18 | int daughter1, int daughter2 ); 19 | 20 | #endif // GPU_ACCELERATION 21 | 22 | using std::complex; 23 | using namespace std; 24 | 25 | class Kinematics; 26 | 27 | class BreitWigner : public UserAmplitude< BreitWigner >{ 28 | 29 | public: 30 | 31 | BreitWigner() : UserAmplitude< BreitWigner >() { } 32 | 33 | BreitWigner( const vector< string >& args ); 34 | 35 | ~BreitWigner(){} 36 | 37 | string name() const { return "BreitWigner"; } 38 | 39 | complex< GDouble > calcAmplitude( GDouble** pKin, GDouble* userVars ) const; 40 | 41 | // ********************** 42 | // The following lines are optional and can be used to precalcualte 43 | // user-defined data that the amplitudes depend on. 44 | 45 | // Use this for indexing a user-defined data array and notifying 46 | // the framework of the number of user-defined variables. 47 | enum UserVars { kMass2 = 0, kNumUserVars }; 48 | unsigned int numUserVars() const { return kNumUserVars; } 49 | 50 | // This function needs to be defined -- see comments and discussion 51 | // in the .cc file. 52 | void calcUserVars( GDouble** pKin, GDouble* userVars ) const; 53 | 54 | // This is an optional addition if the calcAmplitude routine 55 | // can run with only the user-defined data and not the original 56 | // four-vectors. It is used to optimize memory usage in GPU 57 | // based fits. 58 | //bool needsUserVarsOnly() const { return true; } 59 | bool needsUserVarsOnly() const { return false; } 60 | // ** end of optional lines ** 61 | 62 | #ifdef GPU_ACCELERATION 63 | 64 | void launchGPUKernel( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO ) const; 65 | 66 | bool isGPUEnabled() const { return true; } 67 | 68 | #endif // GPU_ACCELERATION 69 | 70 | private: 71 | 72 | AmpParameter m_mass; 73 | AmpParameter m_width; 74 | int m_daughter1; 75 | int m_daughter2; 76 | 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/fitAmplitudes.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "IUAmpTools/ConfigFileParser.h" 9 | #include "IUAmpTools/ConfigurationInfo.h" 10 | #include "IUAmpTools/AmpToolsInterface.h" 11 | #include "DalitzDataIO/DalitzDataReader.h" 12 | #include "DalitzAmp/BreitWigner.h" 13 | #include "DalitzAmp/Constraint.h" 14 | 15 | #include "IUAmpTools/report.h" 16 | static const char* kModule = "fitAmplitudes"; 17 | 18 | 19 | using std::complex; 20 | using namespace std; 21 | 22 | int main( int argc, char* argv[] ){ 23 | 24 | if (argc <= 1){ 25 | report( INFO, kModule ) << "Usage:" << endl << endl; 26 | report( INFO, kModule ) << "\tfitAmplitudes " << endl << endl; 27 | return 0; 28 | } 29 | 30 | // ************************ 31 | // usage 32 | // ************************ 33 | 34 | report( INFO, kModule ) << " *** Performing the Fit *** " << endl; 35 | 36 | 37 | // ************************ 38 | // parse the command line parameters 39 | // ************************ 40 | 41 | string cfgname(argv[1]); 42 | 43 | report( INFO, kModule ) << "Config file name: " << cfgname << endl << endl; 44 | 45 | 46 | // ************************ 47 | // parse the config file 48 | // ************************ 49 | 50 | ConfigFileParser parser(cfgname); 51 | ConfigurationInfo* cfgInfo = parser.getConfigurationInfo(); 52 | cfgInfo->display(); 53 | 54 | 55 | // ************************ 56 | // AmpToolsInterface 57 | // ************************ 58 | 59 | AmpToolsInterface::registerAmplitude(BreitWigner()); 60 | AmpToolsInterface::registerNeg2LnLikContrib(Constraint()); 61 | AmpToolsInterface::registerDataReader(DalitzDataReader()); 62 | 63 | AmpToolsInterface ATI(cfgInfo); 64 | 65 | double neg2LL = ATI.likelihood(); 66 | report( INFO, kModule ) << "-2 ln(L) BEFORE MINIMIZATION: " << neg2LL << endl; 67 | 68 | MinuitMinimizationManager* fitManager = ATI.minuitMinimizationManager(); 69 | fitManager->setStrategy(1); 70 | 71 | fitManager->migradMinimization(); 72 | 73 | if( fitManager->status() != 0 && fitManager->eMatrixStatus() != 3 ){ 74 | report( WARNING, kModule ) << "Fit failed." << endl; 75 | } 76 | 77 | report( INFO, kModule ) << "-2 ln(L) AFTER MINIMIZATION: " << ATI.likelihood() << endl; 78 | 79 | ATI.finalizeFit(); 80 | 81 | return 0; 82 | 83 | } 84 | 85 | 86 | -------------------------------------------------------------------------------- /AmpTools/GPUUtils/clebsch.cuh: -------------------------------------------------------------------------------- 1 | 2 | static __device__ GDouble dfact( GDouble __x ); 3 | static __device__ GDouble clebsch( GDouble __j1, GDouble __m1, GDouble __j2, 4 | GDouble __m2, GDouble __J, GDouble __M ); 5 | 6 | static __device__ 7 | GDouble dfact( GDouble __x ){ 8 | 9 | if((__x < 0.00001) && (__x >= 0.0)) return 1.; 10 | if(__x < 0) return 0.; 11 | 12 | /* 13 | return __x*dfact(__x - 1.); 14 | */ 15 | 16 | // recursive calls not supported on GPU yet 17 | GDouble result = 1; 18 | 19 | while( __x >= 1.00001 ){ 20 | 21 | result *= __x; 22 | __x -= 1; 23 | } 24 | 25 | return result; 26 | } 27 | 28 | /** 29 | * Calcultates Clebsch-Gordon coeficents on the GPU. 30 | * 31 | * Returns 32 | * 33 | * \f$\left(j_1,m_1;j_2,m_2|J,M\right) \f$ 34 | * 35 | * Note: This function was copied from one written by Mike Williams which 36 | * is derived from a function written by Denis Weygand. 37 | */ 38 | 39 | static __device__ 40 | GDouble clebsch( GDouble __j1, GDouble __m1, GDouble __j2, 41 | GDouble __m2, GDouble __J, GDouble __M ){ 42 | 43 | // convert to pure integers (each 2*spin) 44 | int j1 = (int)(2.*__j1); 45 | int m1 = (int)(2.*__m1); 46 | int j2 = (int)(2.*__j2); 47 | int m2 = (int)(2.*__m2); 48 | int J = (int)(2.*__J); 49 | int M = (int)(2.*__M); 50 | 51 | if((__m1 + __m2) != __M) return 0.; 52 | 53 | GDouble n0,n1,n2,n3,n4,n5,d0,d1,d2,d3,d4,A,exp; 54 | int nu = 0; 55 | 56 | GDouble sum = 0; 57 | while(((d3=(j1-j2-M)/2+nu) < 0)||((n2=(j1-m1)/2+nu) < 0 )) { nu++;} 58 | while (((d1=(J-j1+j2)/2-nu) >= 0) && ((d2=(J+M)/2-nu) >= 0) 59 | &&((n1=(j2+J+m1)/2-nu) >= 0 )){ 60 | d3=((j1-j2-M)/2+nu); 61 | n2=((j1-m1)/2+nu); 62 | d0=dfact((GDouble) nu); 63 | exp=nu+(j2+m2)/2; 64 | n0 = (GDouble) G_POW(-1.,exp); 65 | sum += ((n0*dfact(n1)*dfact(n2))/(d0*dfact(d1)*dfact(d2)*dfact(d3))); 66 | nu++; 67 | } 68 | 69 | if (sum == 0) return 0; 70 | 71 | n0 = J+1; 72 | n1 = dfact((GDouble) (J+j1-j2)/2); 73 | n2 = dfact((GDouble) (J-j1+j2)/2); 74 | n3 = dfact((GDouble) (j1+j2-J)/2); 75 | n4 = dfact((GDouble) (J+M)/2); 76 | n5 = dfact((J-M)/2); 77 | 78 | d0 = dfact((GDouble) (j1+j2+J)/2+1); 79 | d1 = dfact((GDouble) (j1-m1)/2); 80 | d2 = dfact((GDouble) (j1+m1)/2); 81 | d3 = dfact((GDouble) (j2-m2)/2); 82 | d4 = dfact((GDouble) (j2+m2)/2); 83 | 84 | A = ((GDouble) (n0*n1*n2*n3*n4*n5))/((GDouble) (d0*d1*d2*d3*d4)); 85 | 86 | return G_SQRT( A )*sum; 87 | } -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/report.h: -------------------------------------------------------------------------------- 1 | #if !defined( REPORT ) 2 | #define REPORT 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include 41 | 42 | using namespace std; 43 | 44 | enum ReportLevel { DEBUG = 0, INFO, NOTICE, WARNING, ERROR }; 45 | 46 | ostream& report( ReportLevel level ); 47 | ostream& report( ReportLevel level, const char* module ); 48 | ostream& report( ReportLevel level, const string& module ); 49 | 50 | void initReport(); 51 | void printLine(); 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/MISubject.cc: -------------------------------------------------------------------------------- 1 | 2 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 3 | // package (Minuit itself was authored by Fred James, of CERN) 4 | // 5 | // 6 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 7 | // 8 | // This software written by Lawrence Gibbons, Cornell University. 9 | // 10 | // Redistribution and use in source and binary forms, with or without 11 | // modification, are permitted provided that the following conditions 12 | // are met: 13 | // 1. Redistributions of source code must retain the above copyright 14 | // notice and author attribution, this list of conditions and the 15 | // following disclaimer. 16 | // 2. Redistributions in binary form must reproduce the above copyright 17 | // notice and author attribution, this list of conditions and the 18 | // following disclaimer in the documentation and/or other materials 19 | // provided with the distribution. 20 | // 3. Neither the name of the University nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software 22 | // without specific prior written permission. 23 | // 24 | // Creation of derivative forms of this software for commercial 25 | // utilization may be subject to restriction; written permission may be 26 | // obtained from Cornell University. 27 | // 28 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 29 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 30 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 31 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 32 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 33 | // held liable for any liability with respect to any claim by the user or any 34 | // other party arising from use of the program. 35 | // 36 | 37 | #include "MinuitInterface/MISubject.h" 38 | #include "MinuitInterface/MIObserver.h" 39 | 40 | MISubject::MISubject() : 41 | m_observerList() 42 | {} 43 | 44 | MISubject::~MISubject() 45 | {} 46 | 47 | void 48 | MISubject::attach( MIObserver* anMIObserver ) { 49 | 50 | m_observerList.push_back( anMIObserver ); 51 | } 52 | 53 | void 54 | MISubject::detach( MIObserver* anMIObserver ) { 55 | 56 | m_observerList.remove( anMIObserver ); 57 | } 58 | 59 | void 60 | MISubject::notify() { 61 | 62 | ObserverList::iterator iter = m_observerList.begin(); 63 | for ( ; iter != m_observerList.end(); ++iter ) { 64 | (*iter)->update( this ); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /.github/workflows/write_models.yaml: -------------------------------------------------------------------------------- 1 | name: Write Models 2 | run-name: Writing Models 3 | on: [workflow_dispatch] 4 | permissions: 5 | contents: write 6 | jobs: 7 | Write-Models: 8 | runs-on: self-hosted 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v4 12 | - name: Building AmpTools 13 | run: | 14 | mkdir Tutorials/Dalitz/lib 15 | mkdir Tutorials/Dalitz/bin 16 | make 17 | export AMPTOOLS_HOME=$(pwd) 18 | echo "AMPTOOLS_HOME=$AMPTOOLS_HOME" >> $GITHUB_ENV 19 | echo "AMPTOOLS=$AMPTOOLS_HOME/AmpTools" >> $GITHUB_ENV 20 | echo "AMPPLOTTER=$AMPTOOLS_HOME/AmpPlotter" >> $GITHUB_ENV 21 | echo "DALITZ=$AMPTOOLS_HOME/Tutorials/Dalitz" >> $GITHUB_ENV 22 | echo "UNIT_TESTS=$AMPTOOLS_HOME/UnitTests" >> $GITHUB_ENV 23 | - name: Generating files 24 | run: | 25 | cd $UNIT_TESTS 26 | $DALITZ/bin/generatePhaseSpace phasespace.gen.root 100000 12345 27 | $DALITZ/bin/toyAcceptance phasespace.gen.root phasespace.acc.root 12345 28 | $DALITZ/bin/generatePhysics parserTest.cfg physics.gen.root 100000 12345 29 | $DALITZ/bin/toyAcceptance physics.gen.root physics.acc.root 12345 30 | $DALITZ/bin/fitAmplitudes parserTest.cfg 31 | - name: Writing Models 32 | run: | 33 | cd $UNIT_TESTS 34 | if [ ! -d "models" ]; then 35 | mkdir -p "models" 36 | fi 37 | ./writeModels 38 | - name: Commit Changes 39 | id: commit_changes 40 | run: | 41 | git config --local user.email "action@github.com" 42 | git config --local user.name "github-actions" 43 | cd $UNIT_TESTS 44 | git add models/ 45 | if git diff --cached --quiet; then 46 | echo "No changes to commit." 47 | echo "push_required=false" >> $GITHUB_OUTPUT 48 | else 49 | git commit -m "Updated models" 50 | echo "push_required=true" >> $GITHUB_OUTPUT 51 | fi 52 | - name: Push changes 53 | if: steps.commit_changes.outputs.push_required == 'true' 54 | uses: ad-m/github-push-action@master 55 | with: 56 | github_token: ${{ secrets.GITHUB_TOKEN }} 57 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/MISubject.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_MISUBJECT_H) 2 | #define MINUITINTERFACE_MISUBJECT_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | #include 40 | 41 | class MIObserver; 42 | 43 | class MISubject 44 | { 45 | 46 | public: 47 | 48 | typedef std::list ObserverList; 49 | 50 | virtual ~MISubject(); 51 | 52 | void attach( MIObserver* ); 53 | void detach( MIObserver* ); 54 | 55 | void notify(); 56 | ObserverList& observerList() {return m_observerList;} 57 | protected: 58 | MISubject(); 59 | 60 | private: 61 | MISubject( const MISubject& ); // stop default 62 | 63 | 64 | // --------- member data ---------- 65 | ObserverList m_observerList; 66 | 67 | }; 68 | #endif 69 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/AsymmetricError.cc: -------------------------------------------------------------------------------- 1 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 2 | // package (Minuit itself was authored by Fred James, of CERN) 3 | // 4 | // 5 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 6 | // 7 | // This software written by Lawrence Gibbons, Cornell University. 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from Cornell University. 26 | // 27 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 28 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 29 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 30 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 31 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 32 | // held liable for any liability with respect to any claim by the user or any 33 | // other party arising from use of the program. 34 | // 35 | 36 | #include "MinuitInterface/AsymmetricError.h" 37 | 38 | AsymmetricError::AsymmetricError( const AsymmetricError& rhs ) { 39 | 40 | if ( this != &rhs ) { 41 | first = rhs.first; 42 | second = rhs.second; 43 | } 44 | } 45 | 46 | AsymmetricError& 47 | AsymmetricError::operator=( const AsymmetricError& rhs ) { 48 | if ( this != &rhs ) { 49 | first = rhs.first; 50 | second = rhs.second; 51 | } 52 | 53 | return *this; 54 | } 55 | 56 | AsymmetricError& 57 | AsymmetricError::operator=( const std::pair& rhs ) { 58 | if ( this != &rhs ) { 59 | first = rhs.first; 60 | second = rhs.second; 61 | } 62 | 63 | return *this; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/Plot.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined PLOT) 37 | #define PLOT 38 | 39 | #include 40 | 41 | class Plot 42 | { 43 | 44 | public: 45 | 46 | Plot( std::string title, std::string dir, std::string tag ) : 47 | m_title( title ), 48 | m_directory( dir ), 49 | m_tag( tag ) {} 50 | 51 | std::string tag() const { return m_tag; } 52 | std::string directory() const { return m_directory; } 53 | std::string title() const { return m_title; } 54 | 55 | private: 56 | 57 | std::string m_title; 58 | std::string m_directory; 59 | std::string m_tag; 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/DataReader.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | 38 | #include 39 | #include 40 | 41 | #include "IUAmpTools/DataReader.h" 42 | 43 | using namespace std; 44 | 45 | string 46 | DataReader::identifier() const { 47 | 48 | string id = name(); 49 | 50 | // make the identifer unique from a likely name in the case of no args 51 | id += "%%"; 52 | 53 | for( vector< string >::const_iterator arg = m_args.begin(); 54 | arg != m_args.end(); ++arg ){ 55 | 56 | id += *arg; 57 | id += " "; 58 | } 59 | 60 | return id; 61 | } 62 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/BkgndComponent.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined BKGNDCOMPONENT) 37 | #define BKGNDCOMPONENT 38 | 39 | #include 40 | 41 | #include "TFile.h" 42 | 43 | #include "AmpPlotter/PlotComponent.h" 44 | #include "IUAmpTools/PlotGenerator.h" 45 | 46 | class BkgndComponent : public PlotComponent 47 | { 48 | 49 | public: 50 | 51 | BkgndComponent( const string& title, 52 | const string& reaction, 53 | PlotGenerator& pltGen ); 54 | 55 | TH1* deliverPlot( unsigned int plotIndex, 56 | double scale = 1.0 ); 57 | 58 | private: 59 | 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/AccMCComponent.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined ACCMCCOMPONENT) 37 | #define ACCMCCOMPONENT 38 | 39 | #include 40 | 41 | #include "TFile.h" 42 | 43 | #include "AmpPlotter/PlotComponent.h" 44 | #include "IUAmpTools/PlotGenerator.h" 45 | 46 | class AccMCComponent : public PlotComponent 47 | { 48 | 49 | public: 50 | 51 | AccMCComponent( const string& title, 52 | const string& reaction, 53 | PlotGenerator& pltGen ); 54 | 55 | TH1* deliverPlot( unsigned int plotIndex, 56 | double scale = 1.0 ); 57 | 58 | private: 59 | 60 | }; 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/DataComponent.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined DATACOMPONENT) 37 | #define DATACOMPONENT 38 | 39 | #include 40 | 41 | #include "TFile.h" 42 | 43 | #include "AmpPlotter/PlotComponent.h" 44 | #include "IUAmpTools/PlotGenerator.h" 45 | 46 | class DataComponent : public PlotComponent 47 | { 48 | 49 | public: 50 | 51 | DataComponent( const string& title, 52 | const string& reaction, 53 | PlotGenerator& pltGen ); 54 | 55 | TH1* deliverPlot( unsigned int plotIndex, 56 | double scale = 1.0 ); 57 | 58 | private: 59 | 60 | 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/ConversionFunction.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_CONVERSIONFUNCTION_H) 2 | #define MINUITINTERFACE_CONVERSIONFUNCTION_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | template class ConversionFunction 40 | { 41 | 42 | public: 43 | 44 | ConversionFunction(); 45 | virtual ~ConversionFunction(); 46 | 47 | virtual double operator()( const T& parentParameters ) = 0; 48 | virtual double error( const T& parentParameters ) = 0; 49 | 50 | protected: 51 | 52 | private: 53 | ConversionFunction( const ConversionFunction& rhs ); // stop default 54 | ConversionFunction& operator=( const ConversionFunction& rhs ); // stop default 55 | }; 56 | 57 | template 58 | ConversionFunction::ConversionFunction() {} 59 | 60 | template 61 | ConversionFunction::~ConversionFunction() {} 62 | #endif 63 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/GenMCComponent.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined GENMCCOMPONENT) 37 | #define GENMCCOMPONENT 38 | 39 | #include 40 | 41 | #include "TFile.h" 42 | 43 | #include "AmpPlotter/PlotComponent.h" 44 | #include "IUAmpTools/PlotGenerator.h" 45 | 46 | using namespace std; 47 | 48 | class GenMCComponent : public PlotComponent 49 | { 50 | 51 | public: 52 | 53 | GenMCComponent( const string& title, 54 | const string& reaction, 55 | PlotGenerator& pltGen ); 56 | 57 | TH1* deliverPlot( unsigned int plotIndex, 58 | double scale = 1.0 ); 59 | 60 | private: 61 | 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/GaussianBound.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | #include "MinuitInterface/GaussianBound.h" 38 | #include "MinuitInterface/MIFunctionContribution.h" 39 | 40 | 41 | GaussianBound::GaussianBound( MinuitMinimizationManager* manager, Parameter* par, 42 | double centralValue, double error ) : 43 | 44 | MIFunctionContribution( manager ), 45 | m_par( par ), 46 | m_centralValue( centralValue ), 47 | m_error( error ) {} 48 | 49 | double 50 | GaussianBound::operator()() { 51 | 52 | return ( ( m_par->value() - m_centralValue ) * ( m_par->value() - m_centralValue ) ) / 53 | ( m_error * m_error ); 54 | 55 | } 56 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/GaussianBound.h: -------------------------------------------------------------------------------- 1 | #ifndef GAUSSIANBOUND 2 | #define GAUSSIANBOUND 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include "MinuitInterface/GaussianBound.h" 41 | #include "MinuitInterface/MIFunctionContribution.h" 42 | #include "MinuitInterface/Parameter.h" 43 | 44 | class GaussianBound : MIFunctionContribution 45 | { 46 | 47 | public: 48 | 49 | GaussianBound( MinuitMinimizationManager* manager, Parameter* par, 50 | double centralValue, double error ); 51 | 52 | double operator()(); 53 | 54 | private: 55 | 56 | GaussianBound(); 57 | 58 | Parameter* m_par; 59 | double m_centralValue; 60 | double m_error; 61 | 62 | }; 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/toyAcceptance.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "TLorentzVector.h" 5 | #include "IUAmpTools/Kinematics.h" 6 | #include "DalitzDataIO/DalitzDataReader.h" 7 | #include "DalitzDataIO/DalitzDataWriter.h" 8 | 9 | using namespace std; 10 | 11 | #include "IUAmpTools/report.h" 12 | static const char* kModule = "toyAcceptance"; 13 | 14 | int main(int argc, char** argv){ 15 | 16 | 17 | // ************************ 18 | // usage 19 | // ************************ 20 | 21 | if (argc <= 2){ 22 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 23 | report( NOTICE, kModule ) << "\ttoyAcceptance " << endl << endl; 24 | report( NOTICE, kModule ) << "\ttoyAcceptance " << endl << endl; 25 | return 0; 26 | } 27 | if (argc == 4) { 28 | int seed = stoi(argv[3]); 29 | srand48(seed); 30 | } 31 | 32 | report( INFO, kModule ) << endl << " *** Simulating Detector Effects *** " << endl << endl; 33 | 34 | // ************************ 35 | // parse the command line parameters 36 | // ************************ 37 | 38 | string infilename(argv[1]); 39 | string outfilename(argv[2]); 40 | 41 | report( INFO, kModule ) << "Input file name = " << infilename << endl; 42 | report( INFO, kModule ) << "Output file name = " << outfilename << endl; 43 | 44 | 45 | // ************************ 46 | // create a DataReader 47 | // ************************ 48 | 49 | report( DEBUG, kModule ) << "Creating a Data Reader..." << endl; 50 | vector args; 51 | args.push_back(infilename); 52 | DalitzDataReader dataReader(args); 53 | report( DEBUG, kModule ) << "... Finished creating a Data Reader" << endl << endl; 54 | 55 | 56 | // ************************ 57 | // create a DataWriter 58 | // ************************ 59 | 60 | report( DEBUG, kModule ) << "Creating a Data Writer..." << endl; 61 | DalitzDataWriter dataWriter(outfilename); 62 | report( DEBUG, kModule ) << "... Finished creating a Data Writer" << endl << endl; 63 | 64 | 65 | // ************************ 66 | // simulate acceptance 67 | // ************************ 68 | 69 | Kinematics* kin; 70 | 71 | while( (kin = dataReader.getEvent()) ){ 72 | 73 | vector pList = kin->particleList(); 74 | 75 | double m12 = (pList[0]+pList[1]).M(); 76 | 77 | double efficiency = 0.1 + (0.9/3.0)*m12; 78 | 79 | double rndm = drand48(); 80 | 81 | if (rndm < efficiency) dataWriter.writeEvent(*kin); 82 | 83 | if (dataReader.eventCounter() % 1000 == 0) 84 | report( INFO, kModule ) << "Event counter = " << dataReader.eventCounter() << endl; 85 | 86 | delete kin; 87 | 88 | } 89 | 90 | 91 | } 92 | 93 | 94 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/dalitz1.cfg: -------------------------------------------------------------------------------- 1 | ##################################### 2 | #### THIS IS A CONFIG FILE #### 3 | ##################################### 4 | ## 5 | ## Blank lines or lines beginning with a "#" are ignored. 6 | ## 7 | ## Double colons (::) are treated like a space. 8 | ## This is sometimes useful for grouping (for example, 9 | ## grouping strings like "reaction::sum::amplitudeName") 10 | ## 11 | ## All non-comment lines must begin with one of the following keywords. 12 | ## 13 | ## (note: means necessary 14 | ## (word) means optional) 15 | ## 16 | ## include 17 | ## define (defn1) (defn2) (defn3) ... 18 | ## loop (value3) ... 19 | ## fit 20 | ## keyword 21 | ## reaction (particle3) ... 22 | ## data (arg1) (arg2) (arg3) ... 23 | ## genmc (arg1) (arg2) (arg3) ... 24 | ## accmc (arg1) (arg2) (arg3) ... 25 | ## (optional: bkgnd (arg1) (arg2) (arg3) ... ) 26 | ## normintfile ("input") 27 | ## sum (sum2) (sum3) ... 28 | ## amplitude (arg1) (arg2) ([par]) ... 29 | ## initialize <"events"/"polar"/"cartesian"> 30 | ## ("fixed"/"real") 31 | ## scale 32 | ## constrain ... 33 | ## parameter ("fixed"/"bounded"/"gaussian") 34 | ## (lower/central) (upper/error) 35 | ## neg2LnLikContrib (arg1) (arg2) ... 36 | ## FUTURE - NOT YET SUPPORTED: 37 | ## pdf (arg1) (arg2) ([par]) ... 38 | ## pdfinitialize ("fixed") 39 | ## pdfscale 40 | ## pdfconstrain ... 41 | ## gpudevice 42 | ## DEPRECATED: 43 | ## datafile (file2) (file3) ... 44 | ## genmcfile (file2) (file3) ... 45 | ## accmcfile (file2) (file3) ... 46 | ## 47 | ##################################### 48 | 49 | fit dalitz1 50 | 51 | reaction dalitz p1 p2 p3 52 | 53 | genmc dalitz DalitzDataReader phasespace.gen.root 54 | accmc dalitz DalitzDataReader phasespace.acc.root 55 | data dalitz DalitzDataReader physics.acc.root 56 | normintfile dalitz dalitz1.ni 57 | 58 | sum dalitz s1 59 | 60 | amplitude dalitz::s1::R12 BreitWigner 1.000 0.200 1 2 61 | amplitude dalitz::s1::R13 BreitWigner 1.500 0.150 1 3 62 | 63 | initialize dalitz::s1::R12 cartesian 1.0 0.0 64 | initialize dalitz::s1::R13 cartesian 1.0 0.0 real 65 | 66 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/dalitz2.cfg: -------------------------------------------------------------------------------- 1 | ##################################### 2 | #### THIS IS A CONFIG FILE #### 3 | ##################################### 4 | ## 5 | ## Blank lines or lines beginning with a "#" are ignored. 6 | ## 7 | ## Double colons (::) are treated like a space. 8 | ## This is sometimes useful for grouping (for example, 9 | ## grouping strings like "reaction::sum::amplitudeName") 10 | ## 11 | ## All non-comment lines must begin with one of the following keywords. 12 | ## 13 | ## (note: means necessary 14 | ## (word) means optional) 15 | ## 16 | ## include 17 | ## define (defn1) (defn2) (defn3) ... 18 | ## loop (value3) ... 19 | ## fit 20 | ## keyword 21 | ## reaction (particle3) ... 22 | ## data (arg1) (arg2) (arg3) ... 23 | ## genmc (arg1) (arg2) (arg3) ... 24 | ## accmc (arg1) (arg2) (arg3) ... 25 | ## (optional: bkgnd (arg1) (arg2) (arg3) ... ) 26 | ## normintfile ("input") 27 | ## sum (sum2) (sum3) ... 28 | ## amplitude (arg1) (arg2) ([par]) ... 29 | ## initialize <"events"/"polar"/"cartesian"> 30 | ## ("fixed"/"real") 31 | ## scale 32 | ## constrain ... 33 | ## parameter ("fixed"/"bounded"/"gaussian") 34 | ## (lower/central) (upper/error) 35 | ## neg2LnLikContrib (arg1) (arg2) ... 36 | ## FUTURE - NOT YET SUPPORTED: 37 | ## pdf (arg1) (arg2) ([par]) ... 38 | ## pdfinitialize ("fixed") 39 | ## pdfscale 40 | ## pdfconstrain ... 41 | ## gpudevice 42 | ## DEPRECATED: 43 | ## datafile (file2) (file3) ... 44 | ## genmcfile (file2) (file3) ... 45 | ## accmcfile (file2) (file3) ... 46 | ## 47 | ##################################### 48 | 49 | 50 | fit dalitz2 51 | 52 | reaction dalitz p1 p2 p3 53 | 54 | genmc dalitz DalitzDataReader phasespace.gen.root 55 | accmc dalitz DalitzDataReader phasespace.acc.root 56 | data dalitz DalitzDataReader physics.gen.root 57 | normintfile dalitz dalitz2.ni 58 | 59 | sum dalitz s1 60 | 61 | amplitude dalitz::s1::R12 BreitWigner 1.000 0.200 1 2 62 | amplitude dalitz::s1::R13 BreitWigner 1.500 0.150 1 3 63 | 64 | initialize dalitz::s1::R12 cartesian 1.0 0.0 65 | initialize dalitz::s1::R13 cartesian 1.0 0.0 real 66 | 67 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/MPITag.h: -------------------------------------------------------------------------------- 1 | #if !defined(MPITAG) 2 | #define MPITAG 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | /** 41 | * All MPI messages may have an integer tag associated with them. The purpose 42 | * of this class is to organize these tags and make them more human readable. 43 | * Having tags for the various data types avoids the pitfall of sending one 44 | * type of data but reading it into another data type. 45 | * 46 | * \ingroup IUAmpToolsMPI 47 | */ 48 | 49 | 50 | class MPITag { 51 | 52 | public: 53 | 54 | /** 55 | * A simple enum for keeping tracking of the tags. 56 | */ 57 | 58 | enum { kIntSend = 1, 59 | kLongIntSend, 60 | kDoubleSend, 61 | kCharSend, 62 | kDataSend, 63 | kAcknowledge, 64 | kMaxTags }; 65 | 66 | }; 67 | 68 | #endif 69 | -------------------------------------------------------------------------------- /Makefile.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | ######### DEFAULT COMPILER SETTINGS 4 | 5 | CXX := gcc 6 | CXX_FLAGS := -O3 7 | 8 | # If the source tree is a git repository, this will use the git 9 | # functions to embed the AmpTools version into the splash screen. 10 | NO_GIT := $(shell git status >& /dev/null; echo $$?) 11 | ifeq ($(NO_GIT),0) 12 | GIT_VERSION := "$(shell git describe --abbrev=4 --dirty --always --tags)" 13 | else 14 | GIT_VERSION := "unknown" 15 | endif 16 | CXX_FLAGS += -DATVERSION=\"$(GIT_VERSION)\" 17 | ######### END DEFAULT COMPILER SETTINGS 18 | 19 | ######### USER BUILD SETTINGS 20 | # These can be used to control preprocessor definitons to control 21 | # the compilation of the code. 22 | 23 | # Default behavior is to build with double precision stoarge for 24 | # event-level data like amplitudes and kinematics -- speed and 25 | # memory use can be optimized by make FP32=1 but at a risk of 26 | # numerical issues in the minimization algorithm. 27 | 28 | ifdef FP32 29 | CXX_DEFINES := -DAMPTOOLS_GDOUBLE_FP32 30 | else 31 | CXX_DEFINES := -DAMPTOOLS_GDOUBLE_FP64 32 | endif 33 | 34 | # This option is here to so that likelihood values for the current 35 | # version can be compared with those from version 0.13.1 and prior. 36 | # At some point this build option will be deprecated. 37 | 38 | ifdef LEGACY_LN_LIK 39 | CXX_DEFINES += -DUSE_LEGACY_LN_LIK_SCALING 40 | endif 41 | 42 | CXX_FLAGS += $(CXX_DEFINES) 43 | ######### END USER BUILD SETTINGS 44 | 45 | ######### MPI COMPILER SETTINGS 46 | # to use MPI, an MPI compiler should be in the user path -- this will be used 47 | # to compile MPI executables. In the project libraries (amplitudes, etc.) 48 | # there should be no MPI specific code. 49 | 50 | ifdef MPI 51 | MPICXX := mpicxx 52 | endif 53 | 54 | ######### END MPI SETTINGS 55 | 56 | 57 | ######### GPU / CUDA COMPILER SETTINGS 58 | # to use CUDA the environment variable CUDA_INSTALL_PATH must be defined 59 | # and the proper architecture specified for the GPU. In addition 60 | # the nvcc compiler (likely in $CUDA_INSTALL_PATH/bin) needs to be in 61 | # the user's path 62 | 63 | NVCC := nvcc 64 | NVCC_FLAGS := -m64 $(CXX_DEFINES) 65 | 66 | ifndef GPU_ARCH 67 | GPU_ARCH := sm_70 68 | endif 69 | 70 | NVCC_FLAGS += -arch=$(GPU_ARCH) 71 | 72 | ifdef GPU # otherwise these variables will be empty to avoid problems 73 | 74 | ifndef CUDA_INSTALL_PATH 75 | $(error GPU build requested but CUDA_INSTALL_PATH is not defined.) 76 | endif 77 | 78 | # the path to cuda specific libraries can vary with architecture 79 | CUDA_LIBS := -L$(CUDA_INSTALL_PATH)/lib64 80 | CUDA_LINK := -lcudart 81 | 82 | CXX_FLAGS += -DGPU_ARCH=\"$(GPU_ARCH)\" 83 | 84 | endif 85 | 86 | ######### END GPU / CUDA SETTINGS 87 | 88 | 89 | ######### GENERAL CHECKS 90 | 91 | # check for verbose output 92 | ifdef VERBOSE 93 | Q := 94 | vecho = @true 95 | else 96 | Q := @ 97 | vecho = @echo 98 | endif 99 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Histogram1D.h: -------------------------------------------------------------------------------- 1 | #if !defined(HISTOGRAM1D) 2 | #define HISTOGRAM1D 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include 41 | 42 | #include "TH1F.h" 43 | #include "IUAmpTools/Histogram.h" 44 | 45 | using namespace std; 46 | 47 | class Histogram1D : public Histogram 48 | { 49 | 50 | public: 51 | 52 | Histogram1D(); 53 | ~Histogram1D(){}; 54 | Histogram1D( HistStruct& hist ); 55 | Histogram1D( int nBins, double xLow, double xHigh, 56 | string name = "hist1d", string title = "1D Histogram" ); 57 | 58 | virtual void fill( vector< double > value, double weight = 1.0 ); 59 | 60 | virtual TH1* toRoot() const; 61 | virtual HistStruct toStruct() const; 62 | virtual Histogram* Clone() const; 63 | 64 | private: 65 | 66 | static const char* kModule; 67 | }; 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/AsymmetricError.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_ASYMMETRICERROR_H) 2 | #define MINUITINTERFACE_ASYMMETRICERROR_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | #include 40 | 41 | class AsymmetricError : public std::pair 42 | { 43 | public: 44 | 45 | // ---------- Constructors and destructor ---------------- 46 | AsymmetricError() : std::pair() {} 47 | AsymmetricError( double lower, double upper) : std::pair(lower,upper) {} 48 | AsymmetricError( const AsymmetricError& rhs ); 49 | 50 | AsymmetricError& operator=( const AsymmetricError& rhs ); 51 | AsymmetricError& operator=( const std::pair& rhs ); 52 | 53 | virtual ~AsymmetricError() {} 54 | 55 | // ---------- member functions ---------- 56 | void setLower( double lowerError ) { first = lowerError; } 57 | void setUpper( double upperError ) { second = upperError; } 58 | 59 | // ---------- member functions ---------- 60 | double lower() const { return first; } 61 | double upper() const { return second; } 62 | }; 63 | #endif 64 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/Parameter.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_PARAMETER_H) 2 | #define MINUITINTERFACE_PARAMETER_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | #include 40 | 41 | #include "MinuitInterface/MISubject.h" 42 | 43 | class Parameter : public MISubject 44 | { 45 | 46 | public: 47 | 48 | Parameter( const std::string& name, double initialValue = 0, double initialError = 0 ); 49 | virtual ~Parameter(); 50 | 51 | const std::string& name() const; 52 | 53 | void setValue( double newValue, bool doNotify = true ); 54 | double value() const {return m_value;} 55 | const double* constValuePtr() const { return &m_value; } 56 | double* valuePtr() { return &m_value; } 57 | 58 | virtual void setError( double newError, bool doNotify = true ); 59 | virtual double error() const {return m_error;} 60 | 61 | void setValueError( double newValue, double newError ); 62 | 63 | private: 64 | 65 | // ------------ member data ------------ 66 | std::string m_name; 67 | double m_value; 68 | double m_error; 69 | 70 | static const char* kModule; 71 | }; 72 | #endif 73 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/GPU.dalitz1.cfg: -------------------------------------------------------------------------------- 1 | ##################################### 2 | #### THIS IS A CONFIG FILE #### 3 | ##################################### 4 | ## 5 | ## Blank lines or lines beginning with a "#" are ignored. 6 | ## 7 | ## Double colons (::) are treated like a space. 8 | ## This is sometimes useful for grouping (for example, 9 | ## grouping strings like "reaction::sum::amplitudeName") 10 | ## 11 | ## All non-comment lines must begin with one of the following keywords. 12 | ## 13 | ## (note: means necessary 14 | ## (word) means optional) 15 | ## 16 | ## include 17 | ## define (defn1) (defn2) (defn3) ... 18 | ## loop (value3) ... 19 | ## fit 20 | ## keyword 21 | ## reaction (particle3) ... 22 | ## data (arg1) (arg2) (arg3) ... 23 | ## genmc (arg1) (arg2) (arg3) ... 24 | ## accmc (arg1) (arg2) (arg3) ... 25 | ## (optional: bkgnd (arg1) (arg2) (arg3) ... ) 26 | ## normintfile ("input") 27 | ## sum (sum2) (sum3) ... 28 | ## amplitude (arg1) (arg2) ([par]) ... 29 | ## initialize <"events"/"polar"/"cartesian"> 30 | ## ("fixed"/"real") 31 | ## scale 32 | ## constrain ... 33 | ## permute ... 34 | ## parameter ("fixed"/"bounded"/"gaussian") 35 | ## (lower/central) (upper/error) 36 | ## neg2LnLikContrib (arg1) (arg2) ... 37 | ## FUTURE - NOT YET SUPPORTED: 38 | ## pdf (arg1) (arg2) ([par]) ... 39 | ## pdfinitialize ("fixed") 40 | ## pdfscale 41 | ## pdfconstrain ... 42 | ## gpudevice 43 | ## DEPRECATED: 44 | ## datafile (file2) (file3) ... 45 | ## genmcfile (file2) (file3) ... 46 | ## accmcfile (file2) (file3) ... 47 | ## 48 | ##################################### 49 | 50 | 51 | fit GPU.dalitz1 52 | 53 | reaction dalitz p1 p2 p3 54 | 55 | genmc dalitz DalitzDataReader GPU.phasespace.gen.root 56 | accmc dalitz DalitzDataReader GPU.phasespace.acc.root 57 | data dalitz DalitzDataReader GPU.physics.acc.root 58 | normintfile dalitz GPU.dalitz1.ni 59 | 60 | sum dalitz s1 61 | 62 | amplitude dalitz::s1::R12 BreitWigner 1.000 0.200 1 2 63 | amplitude dalitz::s1::R13 BreitWigner 1.500 0.150 1 3 64 | 65 | initialize dalitz::s1::R12 cartesian 1.0 0.0 66 | initialize dalitz::s1::R13 cartesian 1.0 0.0 real 67 | 68 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzDataIO/DalitzDataReader.cc: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "TH1.h" 7 | #include "TFile.h" 8 | #include "TTree.h" 9 | #include "TLorentzVector.h" 10 | #include "IUAmpTools/Kinematics.h" 11 | #include "DalitzDataIO/DalitzDataReader.h" 12 | #include "TSystem.h" 13 | 14 | #include "IUAmpTools/report.h" 15 | const char* DalitzDataReader::kModule = "DalitzDataReader"; 16 | 17 | using namespace std; 18 | 19 | DalitzDataReader::DalitzDataReader( const vector< string >& args ) : 20 | UserDataReader< DalitzDataReader >(args), 21 | m_eventCounter( 0 ){ 22 | 23 | assert(args.size() == 1); 24 | string inFileName(args[0]); 25 | string inTreeName("nt"); 26 | 27 | TH1::AddDirectory( kFALSE ); 28 | 29 | gSystem->Load( "libTree" ); 30 | 31 | ifstream fileexists( inFileName.c_str() ); 32 | if (fileexists){ 33 | m_inFile = new TFile( inFileName.c_str() ); 34 | m_inTree = static_cast( m_inFile->Get( inTreeName.c_str() ) ); 35 | } 36 | else{ 37 | report( WARNING, kModule ) << "Cannot find file: " << inFileName << endl; 38 | m_inFile = NULL; 39 | m_inTree = NULL; 40 | } 41 | 42 | if (m_inTree){ 43 | 44 | m_inTree->SetBranchAddress( "EnP1", &m_EnP1 ); 45 | m_inTree->SetBranchAddress( "PxP1", &m_PxP1 ); 46 | m_inTree->SetBranchAddress( "PyP1", &m_PyP1 ); 47 | m_inTree->SetBranchAddress( "PzP1", &m_PzP1 ); 48 | 49 | m_inTree->SetBranchAddress( "EnP2", &m_EnP2 ); 50 | m_inTree->SetBranchAddress( "PxP2", &m_PxP2 ); 51 | m_inTree->SetBranchAddress( "PyP2", &m_PyP2 ); 52 | m_inTree->SetBranchAddress( "PzP2", &m_PzP2 ); 53 | 54 | m_inTree->SetBranchAddress( "EnP3", &m_EnP3 ); 55 | m_inTree->SetBranchAddress( "PxP3", &m_PxP3 ); 56 | m_inTree->SetBranchAddress( "PyP3", &m_PyP3 ); 57 | m_inTree->SetBranchAddress( "PzP3", &m_PzP3 ); 58 | 59 | m_inTree->SetBranchAddress( "weight", &m_weight ); 60 | } 61 | 62 | } 63 | 64 | 65 | void 66 | DalitzDataReader::resetSource(){ 67 | 68 | m_eventCounter = 0; 69 | 70 | } 71 | 72 | 73 | Kinematics* 74 | DalitzDataReader::getEvent(){ 75 | 76 | if( m_eventCounter < numEvents() ){ 77 | 78 | m_inTree->GetEntry( m_eventCounter++ ); 79 | 80 | vector< TLorentzVector > particleList; 81 | particleList.push_back( TLorentzVector( m_PxP1, m_PyP1, m_PzP1, m_EnP1 ) ); 82 | particleList.push_back( TLorentzVector( m_PxP2, m_PyP2, m_PzP2, m_EnP2 ) ); 83 | particleList.push_back( TLorentzVector( m_PxP3, m_PyP3, m_PzP3, m_EnP3 ) ); 84 | 85 | return new Kinematics( particleList, m_weight ); 86 | 87 | } 88 | 89 | else{ 90 | return NULL; 91 | } 92 | 93 | } 94 | 95 | 96 | unsigned int 97 | DalitzDataReader::numEvents() const{ 98 | if (!m_inTree) return 0; 99 | return static_cast< unsigned int >( m_inTree->GetEntries() ); 100 | } 101 | 102 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Neg2LnLikContribManager.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "IUAmpTools/Neg2LnLikContribManager.h" 7 | #include "IUAmpTools/report.h" 8 | 9 | const char* Neg2LnLikContribManager::kModule = "Neg2LnLikContribManager"; 10 | 11 | using namespace std; 12 | 13 | Neg2LnLikContribManager::Neg2LnLikContribManager(){ 14 | report( DEBUG, kModule ) << "## Neg2LnLikContrib Manager INITIALIZATION ##" << endl; 15 | } 16 | 17 | Neg2LnLikContribManager::~Neg2LnLikContribManager() { 18 | 19 | } 20 | 21 | void 22 | Neg2LnLikContribManager::registerNeg2LnLikContrib( const Neg2LnLikContrib& lhcontribution ){ 23 | m_registeredNeg2LnLikContribs[lhcontribution.name()] = lhcontribution.clone(); 24 | } 25 | 26 | void Neg2LnLikContribManager::addNeg2LnLikContrib(const string& lhcontName, 27 | const vector< string >& args){ 28 | 29 | 30 | map< string, Neg2LnLikContrib* >::iterator defaultNeg2LnLikContrib = 31 | m_registeredNeg2LnLikContribs.find( lhcontName ); 32 | 33 | 34 | if( defaultNeg2LnLikContrib == m_registeredNeg2LnLikContribs.end() ){ 35 | 36 | report( ERROR, kModule ) << "Neg2LnLikContrib with name " << lhcontName 37 | << " has not been registered." << endl; 38 | assert( false ); 39 | } 40 | 41 | Neg2LnLikContrib* newNeg2LnLikContrib = defaultNeg2LnLikContrib->second->newNeg2LnLikContrib( args ); 42 | m_mapNameToNeg2LnLikContribs[lhcontName] = newNeg2LnLikContrib; 43 | 44 | } 45 | 46 | void 47 | Neg2LnLikContribManager::setParPtr( const string& name, const string& parName, 48 | const double* ampParPtr ){ 49 | 50 | m_mapNameToNeg2LnLikContribs[name]->setParPtr( parName, ampParPtr ); 51 | } 52 | 53 | void 54 | Neg2LnLikContribManager::setParValue( const string& name, const string& parName, 55 | double val ){ 56 | 57 | m_mapNameToNeg2LnLikContribs[name]->setParValue( parName, val ); 58 | } 59 | 60 | void Neg2LnLikContribManager::setupFromConfigurationInfo( const ConfigurationInfo* configInfo ){ 61 | 62 | 63 | vector lhcontInfoVector = configInfo->neg2LnLikContribList(); 64 | for (unsigned int i = 0; i < lhcontInfoVector.size(); i++){ 65 | string lhcontName = lhcontInfoVector[i]->fullName(); 66 | vector lhcontParameters = lhcontInfoVector[i]->args(); 67 | lhcontParameters.erase(lhcontParameters.begin()); 68 | addNeg2LnLikContrib(lhcontName,lhcontParameters); 69 | 70 | vector< ParameterInfo* > pars = lhcontInfoVector[i]->parameters(); 71 | for( vector< ParameterInfo* >::iterator parItr = pars.begin(); parItr != pars.end(); ++parItr ){ 72 | setParValue( lhcontName, (**parItr).parName(), (**parItr).value() ); 73 | } 74 | 75 | // finally initialize the Neg2LnLikContribs 76 | const_cast(m_mapNameToNeg2LnLikContribs[lhcontName])->init(); 77 | } 78 | } 79 | 80 | 81 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/dalitz3.cfg: -------------------------------------------------------------------------------- 1 | ##################################### 2 | #### THIS IS A CONFIG FILE #### 3 | ##################################### 4 | ## 5 | ## Blank lines or lines beginning with a "#" are ignored. 6 | ## 7 | ## Double colons (::) are treated like a space. 8 | ## This is sometimes useful for grouping (for example, 9 | ## grouping strings like "reaction::sum::amplitudeName") 10 | ## 11 | ## All non-comment lines must begin with one of the following keywords. 12 | ## 13 | ## (note: means necessary 14 | ## (word) means optional) 15 | ## 16 | ## include 17 | ## define (defn1) (defn2) (defn3) ... 18 | ## loop (value3) ... 19 | ## fit 20 | ## keyword 21 | ## reaction (particle3) ... 22 | ## data (arg1) (arg2) (arg3) ... 23 | ## genmc (arg1) (arg2) (arg3) ... 24 | ## accmc (arg1) (arg2) (arg3) ... 25 | ## (optional: bkgnd (arg1) (arg2) (arg3) ... ) 26 | ## normintfile ("input") 27 | ## sum (sum2) (sum3) ... 28 | ## amplitude (arg1) (arg2) ([par]) ... 29 | ## initialize <"events"/"polar"/"cartesian"> 30 | ## ("fixed"/"real") 31 | ## scale 32 | ## constrain ... 33 | ## parameter ("fixed"/"bounded"/"gaussian") 34 | ## (lower/central) (upper/error) 35 | ## neg2LnLikContrib (arg1) (arg2) ... 36 | ## FUTURE - NOT YET SUPPORTED: 37 | ## pdf (arg1) (arg2) ([par]) ... 38 | ## pdfinitialize ("fixed") 39 | ## pdfscale 40 | ## pdfconstrain ... 41 | ## gpudevice 42 | ## DEPRECATED: 43 | ## datafile (file2) (file3) ... 44 | ## genmcfile (file2) (file3) ... 45 | ## accmcfile (file2) (file3) ... 46 | ## 47 | ##################################### 48 | 49 | 50 | fit dalitz3 51 | 52 | reaction dalitz p1 p2 p3 53 | 54 | genmc dalitz DalitzDataReader phasespace.gen.root 55 | accmc dalitz DalitzDataReader phasespace.acc.root 56 | data dalitz DalitzDataReader physics.acc.root 57 | normintfile dalitz dalitz3.ni 58 | 59 | sum dalitz s1 60 | 61 | amplitude dalitz::s1::R12 BreitWigner [M12] [G12] 1 2 62 | amplitude dalitz::s1::R13 BreitWigner [M13] [G13] 1 3 63 | 64 | initialize dalitz::s1::R12 cartesian 1.0 0.0 65 | initialize dalitz::s1::R13 cartesian 1.0 0.0 real 66 | 67 | parameter M12 1.000 68 | parameter G12 0.200 69 | parameter M13 1.500 70 | parameter G13 0.150 71 | 72 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/fitAmplitudesMPI.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include "IUAmpTools/ConfigFileParser.h" 10 | #include "IUAmpTools/ConfigurationInfo.h" 11 | #include "IUAmpToolsMPI/AmpToolsInterfaceMPI.h" 12 | #include "IUAmpToolsMPI/DataReaderMPI.h" 13 | #include "DalitzDataIO/DalitzDataReader.h" 14 | #include "DalitzAmp/BreitWigner.h" 15 | #include "DalitzAmp/Constraint.h" 16 | 17 | #include "IUAmpTools/report.h" 18 | static const char* kModule = "fitAmplitudesMPI"; 19 | 20 | using std::complex; 21 | using namespace std; 22 | 23 | int main( int argc, char* argv[] ){ 24 | 25 | MPI_Init( &argc, &argv ); 26 | 27 | int rank; 28 | int size; 29 | MPI_Comm_rank( MPI_COMM_WORLD, &rank ); 30 | MPI_Comm_size( MPI_COMM_WORLD, &size ); 31 | 32 | 33 | // ************************ 34 | // usage 35 | // ************************ 36 | 37 | 38 | if (argc <= 1){ 39 | report( INFO, kModule ) << "Usage:" << endl << endl; 40 | report( INFO, kModule ) << "\tfitAmplitudesMPI " << endl << endl; 41 | MPI_Finalize(); 42 | return 0; 43 | } 44 | 45 | report( INFO, kModule ) << " *** Performing the Fit *** " << endl; 46 | 47 | 48 | // ************************ 49 | // parse the command line parameters 50 | // ************************ 51 | 52 | string cfgname(argv[1]); 53 | 54 | report( INFO, kModule ) << "Config file name: " << cfgname << endl << endl; 55 | 56 | 57 | // ************************ 58 | // parse the config file 59 | // ************************ 60 | 61 | ConfigFileParser parser(cfgname); 62 | ConfigurationInfo* cfgInfo = parser.getConfigurationInfo(); 63 | cfgInfo->display(); 64 | 65 | 66 | // ************************ 67 | // AmpToolsInterface 68 | // ************************ 69 | 70 | AmpToolsInterfaceMPI::registerAmplitude(BreitWigner()); 71 | AmpToolsInterfaceMPI::registerNeg2LnLikContrib(Constraint()); 72 | AmpToolsInterfaceMPI::registerDataReader(DataReaderMPI()); 73 | 74 | AmpToolsInterfaceMPI ATI(cfgInfo); 75 | 76 | if (rank == 0){ 77 | 78 | double neg2LL = ATI.likelihood(); 79 | report( INFO, kModule ) << "-2 ln(L) BEFORE MINIMIZATION: " << neg2LL << endl; 80 | 81 | MinuitMinimizationManager* fitManager = ATI.minuitMinimizationManager(); 82 | fitManager->setStrategy(1); 83 | 84 | fitManager->migradMinimization(); 85 | 86 | if( fitManager->status() != 0 && fitManager->eMatrixStatus() != 3 ){ 87 | report( WARNING, kModule ) << "Fit failed." << endl; 88 | } 89 | 90 | report( INFO, kModule ) << "-2 ln(L) AFTER MINIMIZATION: " << ATI.likelihood() << endl; 91 | 92 | ATI.finalizeFit(); 93 | } 94 | 95 | ATI.exitMPI(); 96 | MPI_Finalize(); 97 | 98 | return 0; 99 | 100 | } 101 | 102 | 103 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/ComponentGroup.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #if !(defined COMPONENTGROUP) 37 | #define COMPONENTGROUP 38 | 39 | #include 40 | 41 | #include "AmpPlotter/PlotComponent.h" 42 | 43 | using namespace std; 44 | 45 | class ComponentGroup 46 | { 47 | 48 | public: 49 | 50 | ComponentGroup( string title ) : m_title( title ), m_isEnabled( false ) {} 51 | virtual ~ComponentGroup(); 52 | 53 | void addComponent( PlotComponent* component ); 54 | void deleteComponent( PlotComponent* component ); 55 | 56 | void enable(); 57 | void disable(); 58 | 59 | bool isEnabled() const; 60 | string title() const; 61 | 62 | const list& componentList() const { 63 | 64 | return m_componentList; 65 | } 66 | 67 | private: 68 | 69 | ComponentGroup( const ComponentGroup& ); 70 | const ComponentGroup& operator=( const ComponentGroup& ); 71 | 72 | string m_title; 73 | list m_componentList; 74 | bool m_isEnabled; 75 | }; 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/AccMCComponent.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include 37 | #include 38 | 39 | #include "TH1.h" 40 | 41 | #include "AmpPlotter/AccMCComponent.h" 42 | #include "IUAmpTools/Histogram.h" 43 | 44 | using namespace std; 45 | 46 | AccMCComponent::AccMCComponent( const string& title, 47 | const string& reaction, 48 | PlotGenerator& pltGen ) : 49 | PlotComponent( title, reaction, pltGen ) 50 | { 51 | setDataOK(); 52 | } 53 | 54 | TH1* 55 | AccMCComponent::deliverPlot( unsigned int plotIndex, 56 | double scale ) { 57 | 58 | Histogram* hist = generator().projection( plotIndex, reaction(), 59 | PlotGenerator::kAccMC ); 60 | 61 | TH1* plot = hist->toRoot(); 62 | 63 | plot->SetFillStyle( fillStyle() ); 64 | plot->SetFillColor( fillColor() ); 65 | plot->Scale( scale ); 66 | plot->SetLineColor( fillColor() ); 67 | 68 | return plot; 69 | } 70 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/BkgndComponent.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include 37 | #include 38 | 39 | #include "TH1.h" 40 | 41 | #include "AmpPlotter/BkgndComponent.h" 42 | #include "IUAmpTools/Histogram.h" 43 | 44 | using namespace std; 45 | 46 | BkgndComponent::BkgndComponent( const string& title, 47 | const string& reaction, 48 | PlotGenerator& pltGen ) : 49 | PlotComponent( title, reaction, pltGen ) 50 | { 51 | setDataOK(); 52 | } 53 | 54 | TH1* 55 | BkgndComponent::deliverPlot( unsigned int plotIndex, 56 | double scale ) { 57 | 58 | Histogram* hist = generator().projection( plotIndex, reaction(), 59 | PlotGenerator::kBkgnd ); 60 | 61 | TH1* plot = hist->toRoot(); 62 | 63 | plot->SetFillStyle( fillStyle() ); 64 | plot->SetFillColor( fillColor() ); 65 | plot->Scale( scale ); 66 | plot->SetLineColor( fillColor() ); 67 | 68 | return plot; 69 | } 70 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/DataComponent.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include 37 | #include 38 | 39 | #include "TH1.h" 40 | 41 | #include "AmpPlotter/DataComponent.h" 42 | #include "IUAmpTools/Histogram.h" 43 | 44 | using namespace std; 45 | 46 | DataComponent::DataComponent( const string& title, 47 | const string& reaction, 48 | PlotGenerator& pltGen ) : 49 | PlotComponent( title, reaction, pltGen ) 50 | { 51 | setDataOK(); 52 | } 53 | 54 | TH1* 55 | DataComponent::deliverPlot( unsigned int plotIndex, 56 | double scale ) { 57 | 58 | Histogram* hist = generator().projection( plotIndex, reaction(), 59 | PlotGenerator::kData ); 60 | 61 | TH1* plot = hist->toRoot(); 62 | 63 | plot->SetMarkerStyle( markerStyle() ); 64 | plot->SetMarkerSize( markerSize() ); 65 | plot->SetFillStyle( fillStyle() ); 66 | plot->Scale( scale ); 67 | 68 | return plot; 69 | } 70 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/GenMCComponent.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include 37 | #include 38 | 39 | #include "TH1.h" 40 | 41 | #include "AmpPlotter/GenMCComponent.h" 42 | #include "IUAmpTools/Histogram.h" 43 | 44 | using namespace std; 45 | 46 | GenMCComponent::GenMCComponent( const string& title, 47 | const string& reaction, 48 | PlotGenerator& pltGen ) : 49 | PlotComponent( title, reaction, pltGen ) 50 | { 51 | setDataOK(); 52 | } 53 | 54 | TH1* 55 | GenMCComponent::deliverPlot( unsigned int plotIndex, 56 | double scale ) { 57 | 58 | Histogram* hist = generator().projection( plotIndex, reaction(), 59 | PlotGenerator::kGenMC ); 60 | 61 | TH1* plot = hist->toRoot(); 62 | 63 | plot->SetFillStyle( fillStyle() ); 64 | plot->SetFillColor( fillColor() ); 65 | plot->Scale( scale ); 66 | plot->SetLineColor( fillColor() ); 67 | 68 | return plot; 69 | } 70 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/ampPlotter.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "TClass.h" 5 | #include "TApplication.h" 6 | #include "TGClient.h" 7 | #include "TROOT.h" 8 | #include "TH1.h" 9 | #include "TStyle.h" 10 | #include "TClass.h" 11 | 12 | #include "IUAmpTools/AmpToolsInterface.h" 13 | #include "IUAmpTools/FitResults.h" 14 | 15 | #include "AmpPlotter/PlotterMainWindow.h" 16 | #include "AmpPlotter/PlotFactory.h" 17 | 18 | #include "DalitzPlot/DalitzPlotGenerator.h" 19 | #include "DalitzDataIO/DalitzDataReader.h" 20 | #include "DalitzAmp/BreitWigner.h" 21 | 22 | #include "IUAmpTools/report.h" 23 | static const char* kModule = "ampPlotter"; 24 | 25 | typedef DalitzPlotGenerator PlotGen; 26 | 27 | void atiSetup(){ 28 | 29 | // the PlotGenerator will create an AmpToolsInterface in order 30 | // to create plots - this setup must happen before the 31 | // AmpToolsInterface is created 32 | 33 | AmpToolsInterface::registerAmplitude( BreitWigner() ); 34 | AmpToolsInterface::registerDataReader( DalitzDataReader() ); 35 | } 36 | 37 | 38 | // THE USER SHOULD NOT HAVE TO CHANGE ANYTHING BELOW THIS LINE 39 | // ************************************************************* 40 | 41 | using namespace std; 42 | 43 | int main( int argc, char* argv[] ){ 44 | 45 | 46 | // ************************ 47 | // usage 48 | // ************************ 49 | 50 | if (argc <= 1){ 51 | 52 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 53 | report( NOTICE, kModule ) << "\tampPlotter " << endl << endl; 54 | return 0; 55 | } 56 | 57 | report( INFO, kModule ) << endl << " *** Viewing Results Using AmpPlotter ***" << endl << endl; 58 | 59 | // ************************ 60 | // parse the command line parameters 61 | // ************************ 62 | 63 | string resultsName(argv[1]); 64 | FitResults results( resultsName ); 65 | if( !results.valid() ){ 66 | 67 | report( ERROR, kModule ) << "Invalid fit results in file: " << resultsName << endl; 68 | exit( 1 ); 69 | } 70 | 71 | // ************************ 72 | // set up the plot generator 73 | // ************************ 74 | 75 | atiSetup(); 76 | PlotGen plotGen( results ); 77 | 78 | // ************************ 79 | // start the GUI 80 | // ************************ 81 | 82 | report( INFO, kModule ) << ">> Plot generator ready, starting GUI..." << endl; 83 | 84 | int dummy_argc = 0; 85 | char* dummy_argv[] = {}; 86 | TApplication app( "app", &dummy_argc, dummy_argv ); 87 | 88 | gStyle->SetFillColor(10); 89 | gStyle->SetCanvasColor(10); 90 | gStyle->SetPadColor(10); 91 | gStyle->SetFillStyle(1001); 92 | gStyle->SetPalette(1); 93 | gStyle->SetFrameFillColor(10); 94 | gStyle->SetFrameFillStyle(1001); 95 | 96 | PlotFactory factory( plotGen ); 97 | PlotterMainWindow mainFrame( gClient->GetRoot(), factory ); 98 | 99 | app.Run(); 100 | 101 | return 0; 102 | 103 | } 104 | 105 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/run/dalitz_constraint.cfg: -------------------------------------------------------------------------------- 1 | ##################################### 2 | #### THIS IS A CONFIG FILE #### 3 | ##################################### 4 | ## 5 | ## Blank lines or lines beginning with a "#" are ignored. 6 | ## 7 | ## Double colons (::) are treated like a space. 8 | ## This is sometimes useful for grouping (for example, 9 | ## grouping strings like "reaction::sum::amplitudeName") 10 | ## 11 | ## All non-comment lines must begin with one of the following keywords. 12 | ## 13 | ## (note: means necessary 14 | ## (word) means optional) 15 | ## 16 | ## include 17 | ## define (defn1) (defn2) (defn3) ... 18 | ## loop (value3) ... 19 | ## fit 20 | ## keyword 21 | ## reaction (particle3) ... 22 | ## data (arg1) (arg2) (arg3) ... 23 | ## genmc (arg1) (arg2) (arg3) ... 24 | ## accmc (arg1) (arg2) (arg3) ... 25 | ## (optional: bkgnd (arg1) (arg2) (arg3) ... ) 26 | ## normintfile ("input") 27 | ## sum (sum2) (sum3) ... 28 | ## amplitude (arg1) (arg2) ([par]) ... 29 | ## initialize <"events"/"polar"/"cartesian"> 30 | ## ("fixed"/"real") 31 | ## scale 32 | ## constrain ... 33 | ## parameter ("fixed"/"bounded"/"gaussian") 34 | ## (lower/central) (upper/error) 35 | ## neg2LnLikContrib (arg1) (arg2) ... 36 | ## FUTURE - NOT YET SUPPORTED: 37 | ## pdf (arg1) (arg2) ([par]) ... 38 | ## pdfinitialize ("fixed") 39 | ## pdfscale 40 | ## pdfconstrain ... 41 | ## gpudevice 42 | ## DEPRECATED: 43 | ## datafile (file2) (file3) ... 44 | ## genmcfile (file2) (file3) ... 45 | ## accmcfile (file2) (file3) ... 46 | ## 47 | ##################################### 48 | 49 | 50 | fit dalitz_constraint 51 | 52 | reaction dalitz p1 p2 p3 53 | 54 | genmc dalitz DalitzDataReader phasespace.gen.root 55 | accmc dalitz DalitzDataReader phasespace.acc.root 56 | data dalitz DalitzDataReader physics.acc.root 57 | normintfile dalitz dalitz_constraint.ni 58 | 59 | sum dalitz s1 60 | 61 | amplitude dalitz::s1::R12 BreitWigner [M12] [G12] 1 2 62 | amplitude dalitz::s1::R13 BreitWigner [M13] [G13] 1 3 63 | 64 | initialize dalitz::s1::R12 cartesian 1.0 0.0 65 | initialize dalitz::s1::R13 cartesian 1.0 0.0 real 66 | 67 | neg2LnLikContrib Constraint [A] [M12] [G12] [BKG] 68 | 69 | parameter A 5 70 | parameter BKG 2.5 71 | parameter M12 1.000 72 | parameter G12 0.200 73 | parameter M13 1.500 74 | parameter G13 0.150 75 | 76 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Histogram2D.h: -------------------------------------------------------------------------------- 1 | #if !defined(HISTOGRAM2D) 2 | #define HISTOGRAM2D 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include 41 | 42 | #include "TH1F.h" 43 | #include "TH2F.h" 44 | #include "IUAmpTools/Histogram.h" 45 | 46 | using namespace std; 47 | 48 | 49 | class Histogram2D : public Histogram 50 | { 51 | 52 | public: 53 | 54 | Histogram2D(); 55 | ~Histogram2D(){}; 56 | Histogram2D( int nBinsX, double xLow, double xHigh, 57 | int nBinsY, double yLow, double yHigh, 58 | string name = "hist2d", string title = "2D Histogram" ); 59 | Histogram2D( HistStruct& hist ); 60 | 61 | virtual void fill(vector < double > values,double weight = 1.0 ); 62 | virtual TH1* toRoot() const; 63 | virtual HistStruct toStruct() const; 64 | virtual Histogram* Clone() const; 65 | 66 | private: 67 | int m_nBinsY; 68 | double m_yLow; 69 | double m_yHigh; 70 | double m_binSizeY; 71 | 72 | static const char* kModule; 73 | }; 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/generateBackground.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "TString.h" 5 | #include "TH1F.h" 6 | #include "TFile.h" 7 | #include "TGenPhaseSpace.h" 8 | #include "TLorentzVector.h" 9 | #include "IUAmpTools/Kinematics.h" 10 | #include "DalitzDataIO/DalitzDataWriter.h" 11 | 12 | using namespace std; 13 | 14 | #include "IUAmpTools/report.h" 15 | static const char* kModule = "generateBackground"; 16 | 17 | int main(int argc, char** argv){ 18 | 19 | 20 | // ************************ 21 | // usage 22 | // ************************ 23 | 24 | if (argc <= 2){ 25 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 26 | report( NOTICE, kModule ) << "\tgenerateBackground " << endl << endl; 27 | return 0; 28 | } 29 | 30 | report( INFO, kModule ) << endl << " *** Generate Background *** " << endl << endl; 31 | 32 | // ************************ 33 | // parse the command line parameters 34 | // ************************ 35 | 36 | string filename(argv[1]); 37 | int nevents(atoi(argv[2])); 38 | 39 | cout << "Output file name = " << filename << endl; 40 | cout << "Number of events = " << nevents << endl << endl; 41 | 42 | 43 | // ************************ 44 | // set up a DalitzDataWriter object 45 | // ************************ 46 | 47 | report( DEBUG, kModule ) << "Creating a Data Writer..." << endl; 48 | 49 | DalitzDataWriter dataWriter(filename); 50 | 51 | report( DEBUG, kModule ) << "... Finished creating a Data Writer" << endl << endl; 52 | 53 | 54 | // ************************ 55 | // use ROOT to generate phase space 56 | // ************************ 57 | 58 | TGenPhaseSpace generator; 59 | TLorentzVector parent(0.0, 0.0, 0.0, 2.0); 60 | double daughterMasses[3] = {0.2, 0.2, 0.2}; 61 | generator.SetDecay(parent, 3, daughterMasses); 62 | double maxWeight = generator.GetWtMax(); 63 | 64 | 65 | // ************************ 66 | // use the DalitzDataWriter object to write events to a file 67 | // ************************ 68 | 69 | for (int i = 0; i < nevents; ++i){ 70 | 71 | 72 | // generate the decay 73 | 74 | double weight = generator.Generate(); 75 | if (weight < drand48() * maxWeight){ 76 | i--; continue; 77 | } 78 | 79 | 80 | // pack the decay products into a Kinematics object 81 | 82 | vector fourvectors; 83 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(0) ) ); 84 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(1) ) ); 85 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(2) ) ); 86 | Kinematics kin(fourvectors); 87 | 88 | 89 | // write to a file 90 | 91 | dataWriter.writeEvent(kin); 92 | 93 | if (dataWriter.eventCounter() % 1000 == 0) 94 | report( INFO, kModule ) << "Event counter = " << dataWriter.eventCounter() << endl; 95 | 96 | } 97 | 98 | 99 | } 100 | -------------------------------------------------------------------------------- /AmpTools/GPUManager/GPUKernel.h: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | #ifndef __GPU_KERNEL__H__ 38 | #define __GPU_KERNEL__H__ 39 | 40 | #include "GPUCustomTypes.h" 41 | 42 | extern "C" void GPU_ExecAmpKernel(dim3 dimGrid,dim3 dimBlock,GDouble* pfDevAmps, 43 | GDouble* pfDevVVStar, GDouble* pfDevWeights, 44 | int nAmps, int nEvents, double* pfDevRes); 45 | 46 | extern "C" void GPU_ExecFactPermKernel( dim3 dimGrid, dim3 dimBlock, 47 | GDouble* pfDevAmps, GDouble* pcDevCalcAmp, 48 | int nFact, int nPerm, int nEvents ); 49 | 50 | 51 | extern "C" void GPU_ExecNICalcKernel( dim3 dimGrid, dim3 dimBlock, unsigned int sharedSize, 52 | int nElements, double* pdDevNICalc, 53 | GDouble* pfDevAmps, GDouble* pfDevWeights, 54 | int nEvents, int nTrueEvents, unsigned int maxSize ); 55 | 56 | #endif //__GPU_KERNEL__H__ 57 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Kinematics.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | #include "IUAmpTools/Kinematics.h" 42 | #include "TLorentzVector.h" 43 | 44 | #include "IUAmpTools/report.h" 45 | 46 | const char* Kinematics::kModule = "Kinematics"; 47 | 48 | using namespace std; 49 | 50 | const vector< TLorentzVector >& 51 | Kinematics::particleList() const { 52 | 53 | return m_particleList; 54 | } 55 | 56 | const TLorentzVector& 57 | Kinematics::particle( unsigned int index ) const { 58 | 59 | if( index >= m_particleList.size() ){ 60 | 61 | report( ERROR, kModule ) << "ERROR: Request for particle index " << index << 62 | ", but only " << m_particleList.size() << " particles exist." << endl; 63 | 64 | assert( false ); 65 | } 66 | 67 | return m_particleList[index]; 68 | } 69 | 70 | void 71 | Kinematics::setParticleList( const vector< TLorentzVector >& particleList ){ 72 | 73 | assert( particleList.size() <= kMaxParticles ); 74 | 75 | m_particleList = particleList; 76 | } 77 | 78 | int Kinematics::m_globalEventID = 0; 79 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/NormIntInterfaceMPI.h: -------------------------------------------------------------------------------- 1 | #if !defined(NORMINTINTERFACEMPI) 2 | #define NORMINTINTERFACEMPI 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include "IUAmpTools/NormIntInterface.h" 41 | 42 | class NormIntInterfaceMPI : public NormIntInterface 43 | { 44 | 45 | public: 46 | 47 | enum IntType { kNormInt, kAmpInt }; 48 | 49 | NormIntInterfaceMPI( const string& normIntFile ); 50 | NormIntInterfaceMPI( DataReader* genMCData, DataReader* accMCData, 51 | const IntensityManager& intenManager ); 52 | 53 | ~NormIntInterfaceMPI(); 54 | 55 | // override these methods so that we can trigger a parallel recompuation 56 | // of normalization integrals in the case that a parameter has changed 57 | 58 | complex< double > normInt( string amp, string conjAmp, bool forceUseCache = false ) const; 59 | void forceCacheUpdate( bool normIntOnly = false ) const; 60 | 61 | private: 62 | 63 | void setupMPI(); 64 | void sumIntegrals( IntType type ) const; 65 | 66 | bool m_mpiSetup; 67 | 68 | int m_rank; 69 | int m_numProc; 70 | bool m_isLeader; 71 | }; 72 | 73 | #endif 74 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/MIFunctionContribution.cc: -------------------------------------------------------------------------------- 1 | 2 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 3 | // package (Minuit itself was authored by Fred James, of CERN) 4 | // 5 | // 6 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 7 | // 8 | // This software written by Lawrence Gibbons, Cornell University. 9 | // 10 | // Redistribution and use in source and binary forms, with or without 11 | // modification, are permitted provided that the following conditions 12 | // are met: 13 | // 1. Redistributions of source code must retain the above copyright 14 | // notice and author attribution, this list of conditions and the 15 | // following disclaimer. 16 | // 2. Redistributions in binary form must reproduce the above copyright 17 | // notice and author attribution, this list of conditions and the 18 | // following disclaimer in the documentation and/or other materials 19 | // provided with the distribution. 20 | // 3. Neither the name of the University nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software 22 | // without specific prior written permission. 23 | // 24 | // Creation of derivative forms of this software for commercial 25 | // utilization may be subject to restriction; written permission may be 26 | // obtained from Cornell University. 27 | // 28 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 29 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 30 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 31 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 32 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 33 | // held liable for any liability with respect to any claim by the user or any 34 | // other party arising from use of the program. 35 | // 36 | 37 | #include "MinuitInterface/MIFunctionContribution.h" 38 | #include "MinuitInterface/MinuitMinimizationManager.h" 39 | 40 | MIFunctionContribution::MIFunctionContribution( MinuitMinimizationManager* aManager ) : 41 | MIObserver(), 42 | m_manager( aManager ), 43 | m_functionEvaluated( false ), 44 | m_contribution( 0 ), 45 | m_contributing( true ) 46 | { 47 | if( m_manager != NULL ) m_manager->attach( this ); 48 | } 49 | 50 | MIFunctionContribution::~MIFunctionContribution() { 51 | 52 | if( m_manager != NULL ) m_manager->detach( this ); 53 | } 54 | 55 | void 56 | MIFunctionContribution::update( const MISubject* callingSubject ) { 57 | m_contribution = operator()(); 58 | m_functionEvaluated = true; 59 | } 60 | 61 | double 62 | MIFunctionContribution::contribution() { 63 | if ( ! m_functionEvaluated ) {update(m_manager);} 64 | return m_contribution; 65 | } 66 | 67 | // default unknown derviative -- can be overriden by user 68 | double 69 | MIFunctionContribution::derivative( const MinuitParameter& par ){ 70 | 71 | return kUnknownDerivative; 72 | } 73 | 74 | 75 | // this value is the same as fUndefi in the URMinuit class 76 | // when derivatives cannot be computed it should be returned 77 | const double MIFunctionContribution::kUnknownDerivative = -54321; 78 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/ComponentGroup.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include "AmpPlotter/ComponentGroup.h" 37 | 38 | ComponentGroup::~ComponentGroup(){ 39 | 40 | for( std::list::iterator comp = m_componentList.begin(); 41 | comp != m_componentList.end(); ++comp ){ 42 | 43 | // we don't want components with stale pointers 44 | (**comp).deleteGroup( this ); 45 | } 46 | } 47 | 48 | void 49 | ComponentGroup::addComponent( PlotComponent* component ){ 50 | 51 | m_componentList.push_back( component ); 52 | component->addGroup( this ); 53 | } 54 | 55 | void 56 | ComponentGroup::deleteComponent( PlotComponent* component ){ 57 | 58 | for( std::list::iterator comp = m_componentList.begin(); 59 | comp != m_componentList.end(); ++comp ){ 60 | 61 | if( *comp == component ){ 62 | 63 | m_componentList.erase( comp ); 64 | } 65 | } 66 | component->deleteGroup( this ); 67 | } 68 | 69 | void ComponentGroup::enable( void ) { m_isEnabled = true; } 70 | void ComponentGroup::disable( void ) { m_isEnabled = false; } 71 | 72 | bool ComponentGroup::isEnabled( void ) const { return m_isEnabled; } 73 | std::string ComponentGroup::title( void ) const { return m_title; } 74 | 75 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/MIFunctionContribution.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_MIFUNCTIONCONTRIBUTION_H) 2 | #define MINUITINTERFACE_MIFUNCTIONCONTRIBUTION_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | #include "MinuitInterface/MISubject.h" 40 | #include "MinuitInterface/MIObserver.h" 41 | 42 | class MinuitMinimizationManager; 43 | class MinuitParameter; 44 | 45 | class MIFunctionContribution : public MIObserver 46 | { 47 | public : 48 | 49 | // this flag is 50 | static const double kUnknownDerivative; 51 | 52 | MIFunctionContribution( MinuitMinimizationManager* ); 53 | virtual ~MIFunctionContribution(); 54 | 55 | virtual double operator()() = 0; 56 | 57 | // function contributors can override this method if they wish to provide 58 | // derivatives of the function with respect to fit parameters 59 | virtual double derivative( const MinuitParameter& par ); 60 | 61 | virtual void update( const MISubject* ); 62 | virtual double contribution(); 63 | 64 | // turn off or turn on whether this function contributes. Check status. 65 | void stopContributing(); 66 | void restartContributing(); 67 | bool contributing() const {return m_contributing;} 68 | 69 | private: 70 | 71 | MinuitMinimizationManager* m_manager; 72 | 73 | bool m_functionEvaluated; 74 | double m_contribution; 75 | bool m_contributing; 76 | 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/ParameterList.h: -------------------------------------------------------------------------------- 1 | #if !defined(MINUITINTERFACE_PARAMETERLIST_H) 2 | #define MINUITINTERFACE_PARAMETERLIST_H 3 | 4 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 5 | // package (Minuit itself was authored by Fred James, of CERN) 6 | // 7 | // 8 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 9 | // 10 | // This software written by Lawrence Gibbons, Cornell University. 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from Cornell University. 29 | // 30 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 31 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 32 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 33 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 34 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 35 | // held liable for any liability with respect to any claim by the user or any 36 | // other party arising from use of the program. 37 | // 38 | 39 | #include 40 | #include 41 | #include 42 | 43 | #include "MinuitInterface/Parameter.h" 44 | #include "MinuitInterface/MIPointerListIterator.h" 45 | #include "MinuitInterface/MIObserver.h" 46 | 47 | class ParameterList : public std::vector 48 | { 49 | public: 50 | ParameterList() : std::vector() {} 51 | ParameterList( int size ) : std::vector(size) {} 52 | ParameterList( int size, Parameter*& param ) : std::vector(size,param) {} 53 | ~ParameterList() {} 54 | 55 | typedef std::vector lType; 56 | 57 | typedef MIPointerListIterator< lType::iterator, Parameter, Parameter > iterator; 58 | typedef MIPointerListIterator< lType::const_iterator, const Parameter, Parameter > const_iterator; 59 | 60 | void addParameter( Parameter& aParameter ) { push_back(&aParameter); } 61 | void addParameter( Parameter* aParameter ) { push_back(aParameter); } 62 | 63 | void attach( MIObserver* observer) { 64 | for( iterator par = begin(); par != end(); ++par ) par->attach( observer ); 65 | } 66 | void detach( MIObserver* observer) { 67 | for( iterator par = begin(); par != end(); ++par ) par->detach( observer ); 68 | } 69 | }; 70 | #endif -------------------------------------------------------------------------------- /AmpTools/MinuitInterface/Parameter.cc: -------------------------------------------------------------------------------- 1 | 2 | // This file is a part of MinuitInterface - a front end for the Minuit minimization 3 | // package (Minuit itself was authored by Fred James, of CERN) 4 | // 5 | // 6 | // Copyright Cornell University 1993, 1996, All Rights Reserved. 7 | // 8 | // This software written by Lawrence Gibbons, Cornell University. 9 | // 10 | // Redistribution and use in source and binary forms, with or without 11 | // modification, are permitted provided that the following conditions 12 | // are met: 13 | // 1. Redistributions of source code must retain the above copyright 14 | // notice and author attribution, this list of conditions and the 15 | // following disclaimer. 16 | // 2. Redistributions in binary form must reproduce the above copyright 17 | // notice and author attribution, this list of conditions and the 18 | // following disclaimer in the documentation and/or other materials 19 | // provided with the distribution. 20 | // 3. Neither the name of the University nor the names of its contributors 21 | // may be used to endorse or promote products derived from this software 22 | // without specific prior written permission. 23 | // 24 | // Creation of derivative forms of this software for commercial 25 | // utilization may be subject to restriction; written permission may be 26 | // obtained from Cornell University. 27 | // 28 | // CORNELL MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED. By way 29 | // of example, but not limitation, CORNELL MAKES NO REPRESENTATIONS OR 30 | // WARRANTIES OF MERCANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT 31 | // THE USE OF THIS SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, 32 | // COPYRIGHTS, TRADEMARKS, OR OTHER RIGHTS. Cornell University shall not be 33 | // held liable for any liability with respect to any claim by the user or any 34 | // other party arising from use of the program. 35 | // 36 | 37 | #include 38 | 39 | #include "MinuitInterface/Parameter.h" 40 | #include "IUAmpTools/report.h" 41 | 42 | using namespace std; 43 | 44 | const char* Parameter::kModule = "Parameter"; 45 | 46 | Parameter::Parameter( const string& name, double initialValue, double initialError ) : 47 | m_name( name ), 48 | m_value( initialValue ), 49 | m_error( initialError ) 50 | {} 51 | 52 | Parameter::~Parameter() {} 53 | 54 | void 55 | Parameter::setValue( double newValue, bool doNotify ) { 56 | 57 | if( m_value != newValue ){ 58 | 59 | report( DEBUG, kModule ) << "Parameter " << m_name << 60 | " value changed; doNotify = " << doNotify << endl; 61 | 62 | // In practice the comparison above could probably "safely" be 63 | // done within some tolerance, but set to exact comparison for now. 64 | // This check avoids falsely notifying observers when the 65 | // parameter hasn't actually changed. 66 | 67 | m_value = newValue; 68 | if( doNotify ) notify(); 69 | } 70 | } 71 | 72 | void 73 | Parameter::setError( double newError, bool doNotify ) { 74 | m_error = newError; 75 | if( doNotify ) notify(); 76 | } 77 | 78 | void 79 | Parameter::setValueError( double newValue, double newError ) { 80 | m_value = newValue; 81 | m_error = newError; 82 | notify(); 83 | } 84 | 85 | const string& 86 | Parameter::name() const { 87 | return m_name; 88 | } 89 | 90 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzExe/generatePhaseSpace.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include "TString.h" 5 | #include "TH1F.h" 6 | #include "TFile.h" 7 | #include "TGenPhaseSpace.h" 8 | #include "TLorentzVector.h" 9 | #include "IUAmpTools/Kinematics.h" 10 | #include "DalitzDataIO/DalitzDataWriter.h" 11 | 12 | #include "IUAmpTools/report.h" 13 | static const char* kModule = "generatePhaseSpace"; 14 | 15 | using namespace std; 16 | 17 | int main(int argc, char** argv){ 18 | 19 | 20 | // ************************ 21 | // usage 22 | // ************************ 23 | 24 | 25 | if (argc <= 2){ 26 | report( NOTICE, kModule ) << "Usage:" << endl << endl; 27 | report( NOTICE, kModule ) << "\tgeneratePhaseSpace " << endl << endl; 28 | report( NOTICE, kModule ) << "\tgeneratePhaseSpace " << endl << endl; 29 | return 0; 30 | } 31 | if (argc == 4) { 32 | int seed = stoi(argv[3]); 33 | srand48(seed); 34 | } 35 | 36 | cout << endl << " *** Generate Phase Space *** " << endl << endl; 37 | 38 | 39 | // ************************ 40 | // parse the command line parameters 41 | // ************************ 42 | 43 | string filename(argv[1]); 44 | int nevents(atoi(argv[2])); 45 | 46 | report( INFO, kModule ) << "Output file name = " << filename << endl; 47 | report( INFO, kModule ) << "Number of events = " << nevents << endl << endl; 48 | 49 | 50 | // ************************ 51 | // set up a DalitzDataWriter object 52 | // ************************ 53 | 54 | report( DEBUG, kModule ) << "Creating a Data Writer..." << endl; 55 | 56 | DalitzDataWriter dataWriter(filename); 57 | 58 | report( DEBUG, kModule ) << "... Finished creating a Data Writer" << endl << endl; 59 | 60 | 61 | // ************************ 62 | // use ROOT to generate phase space 63 | // ************************ 64 | 65 | TGenPhaseSpace generator; 66 | TLorentzVector parent(0.0, 0.0, 0.0, 3.0); 67 | double daughterMasses[3] = {0.2, 0.2, 0.2}; 68 | generator.SetDecay(parent, 3, daughterMasses); 69 | double maxWeight = generator.GetWtMax(); 70 | 71 | 72 | // ************************ 73 | // use the DalitzDataWriter object to write events to a file 74 | // ************************ 75 | 76 | for (int i = 0; i < nevents; ++i){ 77 | 78 | 79 | // generate the decay 80 | 81 | double weight = generator.Generate(); 82 | if (weight < drand48() * maxWeight){ 83 | i--; continue; 84 | } 85 | 86 | 87 | // pack the decay products into a Kinematics object 88 | 89 | vector fourvectors; 90 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(0) ) ); 91 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(1) ) ); 92 | fourvectors.push_back( TLorentzVector( *generator.GetDecay(2) ) ); 93 | Kinematics kin(fourvectors); 94 | 95 | 96 | // write to a file 97 | 98 | dataWriter.writeEvent(kin); 99 | 100 | if (dataWriter.eventCounter() % 1000 == 0) 101 | report( INFO, kModule ) << "Event counter = " << dataWriter.eventCounter() << endl; 102 | 103 | } 104 | 105 | 106 | } 107 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Histogram.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | #include "IUAmpTools/Histogram.h" 42 | 43 | using namespace std; 44 | 45 | Histogram::Histogram( string name, string title ) : 46 | m_nBins( 0 ), 47 | m_xLow( 0 ), 48 | m_xHigh( 0 ), 49 | m_entries( 0 ), 50 | m_binContents( 0 ), 51 | m_name( name ), 52 | m_title( title ){} 53 | 54 | 55 | void 56 | Histogram::clear( void ){ 57 | 58 | m_binContents = vector< double >( m_nBins ); 59 | m_sumWeightSq = vector< double >( m_nBins ); 60 | m_entries = 0; 61 | } 62 | 63 | void 64 | Histogram::normalize( double integral ){ 65 | 66 | rescale( integral / m_entries ); 67 | } 68 | 69 | void 70 | Histogram::rescale( double scaleFactor ){ 71 | 72 | for( int i = 0; i < m_nBins; ++i ){ 73 | 74 | m_binContents[i] *= scaleFactor; 75 | m_sumWeightSq[i] *= scaleFactor*scaleFactor; 76 | } 77 | 78 | m_entries *= scaleFactor; 79 | } 80 | 81 | void 82 | Histogram::operator+=( HistStruct& hStruct ){ 83 | 84 | assert( m_nBins <= MAXBINS ); 85 | 86 | for( int i = 0; i < m_nBins; ++i ){ 87 | 88 | m_binContents[i] += hStruct.contents[i]; 89 | m_sumWeightSq[i] += hStruct.sumW2[i]; 90 | } 91 | 92 | m_entries += hStruct.entries; 93 | } 94 | -------------------------------------------------------------------------------- /AmpTools/IUAmpTools/Neg2LnLikContrib.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "IUAmpTools/Neg2LnLikContrib.h" 8 | 9 | MinuitMinimizationManager* Neg2LnLikContrib::m_minManager; 10 | 11 | double Neg2LnLikContrib::operator()(){ 12 | 13 | return neg2LnLikelihood(); 14 | } 15 | 16 | double Neg2LnLikContrib::neg2LnLikelihood(){ 17 | 18 | return 0.; 19 | } 20 | 21 | string 22 | Neg2LnLikContrib::identifier() const { 23 | 24 | string id = name(); 25 | 26 | // make the identifer unique from a likely name in the case of no args 27 | id += "%%"; 28 | 29 | for( vector< string >::const_iterator arg = m_args.begin(); 30 | arg != m_args.end(); ++arg ){ 31 | 32 | id += *arg; 33 | id += " "; 34 | } 35 | 36 | return id; 37 | } 38 | 39 | bool 40 | Neg2LnLikContrib::setParPtr( const string& name, const double* ptr ) const { 41 | 42 | bool foundPar = false; 43 | 44 | for( vector< AmpParameter* >::const_iterator parItr = m_registeredParams.begin(); 45 | parItr != m_registeredParams.end(); 46 | ++parItr ){ 47 | 48 | if( (**parItr).name().compare( name ) == 0 ){ 49 | 50 | foundPar = true; 51 | (**parItr).setExternalValue( ptr ); 52 | 53 | // pass in the name here to 54 | // use the const member function here so we only have one const-cast 55 | // that calls the non-const user function 56 | updatePar( (**parItr).name() ); 57 | } 58 | } 59 | 60 | return foundPar; 61 | } 62 | 63 | bool 64 | Neg2LnLikContrib::setParValue( const string& name, double val ) const { 65 | 66 | bool foundPar = false; 67 | 68 | for( vector< AmpParameter* >::const_iterator parItr = m_registeredParams.begin(); 69 | parItr != m_registeredParams.end(); 70 | ++parItr ){ 71 | 72 | if( (**parItr).name().compare( name ) == 0 ){ 73 | 74 | foundPar = true; 75 | (**parItr).setValue( val ); 76 | 77 | // pass in the name here to 78 | // use the const member function here so we only have one const-cast 79 | // that calls the non-const user function 80 | updatePar( (**parItr).name() ); 81 | } 82 | } 83 | 84 | return foundPar; 85 | } 86 | 87 | bool 88 | Neg2LnLikContrib::updatePar( const string& name ) const { 89 | 90 | bool foundPar = false; 91 | 92 | for( vector< AmpParameter* >::const_iterator parItr = m_registeredParams.begin(); 93 | parItr != m_registeredParams.end(); 94 | ++parItr ){ 95 | 96 | if( (**parItr).name().compare( name ) == 0 ){ 97 | 98 | // The const_cast is a little bit undesirable here. It can be removed 99 | // at the expensive of requiring the user to declare all member data in 100 | // the class that is updated on a parameter update "mutable." 101 | // Since we are trying to maximize user-friendliness, for now we will 102 | // remove this potential annoyance. 103 | 104 | const_cast< Neg2LnLikContrib* >(this)->updatePar( **parItr ); 105 | foundPar = true; 106 | } 107 | } 108 | 109 | return foundPar; 110 | } 111 | 112 | void 113 | Neg2LnLikContrib::registerParameter( AmpParameter& par ){ 114 | 115 | m_registeredParams.push_back( &par ); 116 | } 117 | -------------------------------------------------------------------------------- /AmpPlotter/AmpPlotter/PlotComponent.cc: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpPlotter, a GUI interface to AmpTools fits 3 | // 4 | // Copyright Trustees of Indiana University 2012, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd at Indiana University, Bloomington 7 | // 8 | // Redistribution and use in source and binary forms, with or without 9 | // modification, are permitted provided that the following conditions 10 | // are met: 11 | // 1. Redistributions of source code must retain the above copyright 12 | // notice and author attribution, this list of conditions and the 13 | // following disclaimer. 14 | // 2. Redistributions in binary form must reproduce the above copyright 15 | // notice and author attribution, this list of conditions and the 16 | // following disclaimer in the documentation and/or other materials 17 | // provided with the distribution. 18 | // 3. Neither the name of the University nor the names of its contributors 19 | // may be used to endorse or promote products derived from this software 20 | // without specific prior written permission. 21 | // 22 | // Creation of derivative forms of this software for commercial 23 | // utilization may be subject to restriction; written permission may be 24 | // obtained from the Trustees of Indiana University. 25 | // 26 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 27 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 28 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 29 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 30 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 31 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 32 | // held liable for any liability with respect to any claim by the user or 33 | // any other party arising from use of the program. 34 | //****************************************************************************** 35 | 36 | #include "AmpPlotter/PlotComponent.h" 37 | #include "AmpPlotter/ComponentGroup.h" 38 | 39 | PlotComponent::~PlotComponent(){ 40 | 41 | for( list::iterator group = m_groups.begin(); 42 | group != m_groups.end(); ++group ){ 43 | 44 | // we want to avoid groups having stale pointers 45 | (**group).deleteComponent( this ); 46 | } 47 | } 48 | 49 | bool 50 | PlotComponent::isAvailable( void ) const { 51 | 52 | return m_dataOK; 53 | } 54 | 55 | bool 56 | PlotComponent::isEnabled( void ) const { 57 | 58 | // for a component to be enabled, _all_ of the groups it is a member 59 | // of must also be enabled. 60 | 61 | bool enabled = true; 62 | 63 | for( list::const_iterator group = m_groups.begin(); 64 | group != m_groups.end(); ++group ){ 65 | 66 | if( ! (**group).isEnabled() ){ 67 | 68 | enabled = false; 69 | } 70 | } 71 | 72 | return enabled; 73 | } 74 | 75 | void 76 | PlotComponent::addGroup( ComponentGroup* group ) { 77 | 78 | m_groups.push_back( group ); 79 | } 80 | 81 | void 82 | PlotComponent::deleteGroup( ComponentGroup* group ) { 83 | 84 | for( list::iterator groupItr = m_groups.begin(); 85 | groupItr != m_groups.end(); ++groupItr ){ 86 | 87 | if( *groupItr == group ){ 88 | 89 | m_groups.erase( groupItr ); 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /UnitTests/Makefile: -------------------------------------------------------------------------------- 1 | 2 | ###### BUILDING PROJECT EXECUTABLES 3 | ###### most things below probably don't need adjustment 4 | 5 | ifndef AMPTOOLS_HOME 6 | $(error Please set AMPTOOLS_HOME to point to the root of the AmpTools source tree. ) 7 | endif 8 | 9 | include $(AMPTOOLS_HOME)/Makefile.settings 10 | 11 | # leave the binaries in this directory if the install directory hasn't been set 12 | ifndef INSTALL_BIN 13 | INSTALL_BIN = . 14 | endif 15 | 16 | INC_DIR := -I$(AMPTOOLS_HOME)/Tutorials/Dalitz/DalitzLib -I$(AMPPLOTTER) -I$(AMPTOOLS) -I$(shell root-config --incdir) 17 | CXX_FLAGS += $(shell root-config --cflags) 18 | 19 | # check if GPU build is requested 20 | ifdef GPU 21 | INC_DIR += -I$(CUDA_INSTALL_PATH)/include 22 | CXX_FLAGS += -DGPU_ACCELERATION 23 | SUFFIX := _GPU 24 | ATSUFFIX := _GPU 25 | endif 26 | 27 | # check if MPI build is requested 28 | # * unlike AmpTools Makefile, don't modify SUFFIX because the only thing 29 | # this affects is the executables which will be handled separately 30 | # * however, we do need the right suffix to link MPI enabled 31 | # AmpTools library 32 | ifdef MPI 33 | CXX_FLAGS += -DUSE_MPI 34 | ATSUFFIX := $(ATSUFFIX)_MPI 35 | endif 36 | 37 | # need some linking information available 38 | LIB_DIR := -L$(shell root-config --libdir) $(CUDA_LIBS) \ 39 | -L$(AMPTOOLS)/lib -L$(AMPPLOTTER)/lib -L$(AMPTOOLS_HOME)/Tutorials/Dalitz/lib 40 | 41 | LIBS := -lAmpPlotter -lAmpTools$(ATSUFFIX) -lDalitz$(SUFFIX)\ 42 | $(EXTRA_LIBS) $(shell root-config --glibs) $(CUDA_LINK) -lstdc++ 43 | 44 | # any source file falls into one of these two categories -- we'll 45 | # assume that anything that has MPI in the name is an MPI executable 46 | MPI_SRC := $(shell ls *.cc | grep -i mpi) 47 | NOMPI_SRC := $(shell ls *.cc | grep -vi mpi) 48 | 49 | TARGET_EXE := $(NOMPI_SRC:%.cc=%$(SUFFIX)) 50 | 51 | # optionally if MPI is called for, we will build the MPI executables 52 | ifdef MPI 53 | TARGET_EXE += $(MPI_SRC:%.cc=%$(SUFFIX)) 54 | endif 55 | 56 | .PHONY: default bin 57 | .PRECIOUS: .%$(SUFFIX).o .%$(SUFFIX)_mpi.o 58 | 59 | default: bin $(TARGET_EXE) 60 | 61 | bin: 62 | $(Q)-mkdir $(INSTALL_BIN) >& /dev/null ||: 63 | 64 | # for the non-MPI executables we want to strip out the -DUSEMPI flag 65 | # from the compiler arguments and also be sure we link against the 66 | # non-MPI version of AmpTools 67 | 68 | $(NOMPI_SRC:%.cc=%$(SUFFIX)): %$(SUFFIX) : .%$(SUFFIX).o 69 | $(vecho) "--> Linking $*$(SUFFIX)" 70 | $(Q)$(CXX) $(subst -DUSEMPI,,$(CXX_FLAGS)) -o $(INSTALL_BIN)/$*$(SUFFIX) $< \ 71 | $(INC_DIR) $(LIB_DIR) $(subst _MPI,,$(LIBS)) 72 | 73 | $(MPI_SRC:%.cc=%$(SUFFIX)): %$(SUFFIX) : .%$(SUFFIX)_mpi.o 74 | $(vecho) "--> Linking $*$(SUFFIX)" 75 | $(Q)$(MPICXX) $(CXX_FLAGS) -o $(INSTALL_BIN)/$*$(SUFFIX) $< \ 76 | $(INC_DIR) $(LIB_DIR) $(LIBS) 77 | 78 | .%$(SUFFIX).o: %.cc .%$(SUFFIX).d 79 | $(vecho) "-> Compiling $<" 80 | $(Q)$(CXX) $(subst -DUSEMPI,,$(CXX_FLAGS)) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 81 | $(Q)$(CXX) $(subst -DUSEMPI,,$(CXX_FLAGS)) -c -o $@ $< $(INC_DIR) 82 | 83 | .%$(SUFFIX)_mpi.o: %.cc .%$(SUFFIX).d 84 | $(vecho) "-> Compiling $<" 85 | $(Q)$(MPICXX) $(CXX_FLAGS) -M -MP -MT $@ -o .$*$(SUFFIX).d $< $(INC_DIR) 86 | $(Q)$(MPICXX) $(CXX_FLAGS) -c -o $@ $< $(INC_DIR) 87 | 88 | DEPFILES := $(NOMPI_SRC:%.cc=.%$(SUFFIX).d) 89 | ifdef MPI 90 | DEPFILES += $(MPI_SRC:%.cc=.%$(SUFFIX).d) 91 | endif 92 | $(DEPFILES): 93 | 94 | clean: 95 | $(Q)rm -f .*.o .*.d $(TARGET_EXE) 96 | 97 | -include $(DEPFILES) 98 | -------------------------------------------------------------------------------- /UnitTests/README: -------------------------------------------------------------------------------- 1 | Whenever anybody pushes to any branch, the action found in .github/actions/unit_tests.yaml will be run in a container hosted on gpu1. The action builds AmpTools from the latest version of the branch modified by the push that triggered the action. The following AmpTools classes are tested: 2 | 3 | 4 | ConfigFileParser (All constructors): 5 | Tested Features: 6 | * include 7 | * define 8 | * parameter 9 | * Multiple reactions 10 | * Multiple amplitudes in same sum 11 | * Constraining amplitudes in different reactions 12 | * Scale 13 | * permute 14 | * Implicit permute (using identical particle names) 15 | * loop 16 | Checks: 17 | * Number of lines in parsed file exactly matches model 18 | * Parsed file exactly matches model 19 | 20 | 21 | ConfigurationInfo (from ConfigFileParser.getConfigurationInfo()) 22 | Tested Features: 23 | * fitName() 24 | * fitOutputFileName() 25 | * userKeywords() 26 | * reactionList() 27 | * amplitudeList() 28 | * coherentSumList() 29 | * neg2LnLikContribList() 30 | * pdfList() 31 | * termList() 32 | * parameterList() 33 | Checks: 34 | * Fit name matches model fit name 35 | * Fit output file name matches model fit output file name 36 | * Keywords vector size matches model vector size 37 | * Reaction vector size matches model vector size 38 | * Amplitude vector size matches model vector size 39 | * Coherent sum vector size matches model vector size 40 | * Neg2LnLikContrib vector size matches model vector size 41 | * PDF vector size matches model vector size 42 | * Term vector size matches model vector size 43 | * Parameter vector size matches model vector size 44 | 45 | 46 | AmpToolsInterface/AmpToolsInterfaceMPI (from ConfigurationInfo*) 47 | Tested Features: 48 | * AmpToolsInterface::registerAmplitude 49 | * AmpToolsInterface::registerNeg2LnLikContrib 50 | * AmpToolsInterface::registerDataReader 51 | * likelihood() 52 | * minuitMinimizationManager() 53 | Checks (All floating point checks have a precision of 0.1): 54 | * Likelihood before fit matches model 55 | * Likelihood after fit matches model 56 | * Likelihood of base reaction after fit matches model 57 | * Likelihood of constrained reaction after fit matches model 58 | * Likelihood of symmetrized (implicit) reaction after fit matches model 59 | * Likelihood of symmetrized (explicit) reaction after fit matches model 60 | 61 | 62 | fitResults (from .fit file and from AmpToolsInterface.fitResults()) 63 | Tested Features: 64 | * intensity() 65 | * phaseDiff() 66 | * productionParameter() 67 | * bestMinimum() 68 | * parNameList() 69 | * parValueList() 70 | Checks (all have a precision of 0.01 unless noted otherwise): 71 | * Intensity matches model (precision of 1) 72 | * Intensity error matches model (precision of 10) 73 | * Phase difference matches model 74 | * Phase difference error matches model (precision of 1) 75 | * Real part of base reaction production parameter matches model 76 | * Imaginary part of base reaction production parameter matches model 77 | * Real part of constrained reaction production parameter matches model 78 | * Imaginary part of constrained reaction production parameter matches model 79 | * Real part of symmetrized reaction production parameter matches model 80 | * Imaginary part of symmetrized reaction production parameter matches model 81 | * Best minimum matches model 82 | * Number of parameter names matches model (exact match- integer values) 83 | * All fit parameters match model 84 | -------------------------------------------------------------------------------- /AmpTools/GPUManager/GPUFactPermKernel.cu: -------------------------------------------------------------------------------- 1 | //****************************************************************************** 2 | // This file is part of AmpTools, a package for performing Amplitude Analysis 3 | // 4 | // Copyright Trustees of Indiana University 2010, all rights reserved 5 | // 6 | // This software written by Matthew Shepherd, Ryan Mitchell, and 7 | // Hrayr Matevosyan at Indiana University, Bloomington 8 | // 9 | // Redistribution and use in source and binary forms, with or without 10 | // modification, are permitted provided that the following conditions 11 | // are met: 12 | // 1. Redistributions of source code must retain the above copyright 13 | // notice and author attribution, this list of conditions and the 14 | // following disclaimer. 15 | // 2. Redistributions in binary form must reproduce the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer in the documentation and/or other materials 18 | // provided with the distribution. 19 | // 3. Neither the name of the University nor the names of its contributors 20 | // may be used to endorse or promote products derived from this software 21 | // without specific prior written permission. 22 | // 23 | // Creation of derivative forms of this software for commercial 24 | // utilization may be subject to restriction; written permission may be 25 | // obtained from the Trustees of Indiana University. 26 | // 27 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 28 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 29 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 30 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 31 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 32 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 33 | // held liable for any liability with respect to any claim by the user or 34 | // any other party arising from use of the program. 35 | //****************************************************************************** 36 | 37 | #include "GPUCustomTypes.h" 38 | 39 | __global__ void 40 | fact_perm_kernel( GDouble* pfDevAmps, GDouble* pcDevCalcAmp, int nFact, 41 | int nPerm, int nEvents ) 42 | { 43 | 44 | int i = threadIdx.x + GPU_BLOCK_SIZE_X * threadIdx.y + 45 | ( blockIdx.x + blockIdx.y * gridDim.x ) * GPU_BLOCK_SIZE_SQ; 46 | 47 | for( int iPerm = 0; iPerm < nPerm; ++iPerm ){ 48 | 49 | int offsetP = 2*nEvents*iPerm + 2*i; 50 | 51 | double ampRe = pcDevCalcAmp[offsetP]; 52 | double ampIm = pcDevCalcAmp[offsetP+1]; 53 | 54 | for( int iFactor = 1; iFactor < nFact; ++iFactor ){ 55 | 56 | int offsetF = 2*nEvents*nPerm*iFactor + offsetP; 57 | 58 | double re = ampRe; 59 | double im = ampIm; 60 | 61 | ampRe = re * pcDevCalcAmp[offsetF] - im * pcDevCalcAmp[offsetF+1]; 62 | ampIm = re * pcDevCalcAmp[offsetF+1] + im * pcDevCalcAmp[offsetF]; 63 | } 64 | 65 | pfDevAmps[2*i] += ampRe; 66 | pfDevAmps[2*i+1] += ampIm; 67 | } 68 | 69 | pfDevAmps[2*i] /= G_SQRT( nPerm*1.0 ); 70 | pfDevAmps[2*i+1] /= G_SQRT( nPerm*1.0 ); 71 | } 72 | 73 | extern "C" void GPU_ExecFactPermKernel( dim3 dimGrid, dim3 dimBlock, 74 | GDouble* pfDevAmps, GDouble* pcDevCalcAmp, int nFact, int nPerm, int nEvents ) 75 | { 76 | fact_perm_kernel<<< dimGrid, dimBlock >>>( pfDevAmps, pcDevCalcAmp, 77 | nFact, nPerm, nEvents ); 78 | } 79 | -------------------------------------------------------------------------------- /AmpTools/IUAmpToolsMPI/LikelihoodManagerMPI.h: -------------------------------------------------------------------------------- 1 | #if !defined(LIKELIHOODMANAGERMPI) 2 | #define LIKELIHOODMANAGERMPI 3 | 4 | //****************************************************************************** 5 | // This file is part of AmpTools, a package for performing Amplitude Analysis 6 | // 7 | // Copyright Trustees of Indiana University 2010, all rights reserved 8 | // 9 | // This software written by Matthew Shepherd, Ryan Mitchell, and 10 | // Hrayr Matevosyan at Indiana University, Bloomington 11 | // 12 | // Redistribution and use in source and binary forms, with or without 13 | // modification, are permitted provided that the following conditions 14 | // are met: 15 | // 1. Redistributions of source code must retain the above copyright 16 | // notice and author attribution, this list of conditions and the 17 | // following disclaimer. 18 | // 2. Redistributions in binary form must reproduce the above copyright 19 | // notice and author attribution, this list of conditions and the 20 | // following disclaimer in the documentation and/or other materials 21 | // provided with the distribution. 22 | // 3. Neither the name of the University nor the names of its contributors 23 | // may be used to endorse or promote products derived from this software 24 | // without specific prior written permission. 25 | // 26 | // Creation of derivative forms of this software for commercial 27 | // utilization may be subject to restriction; written permission may be 28 | // obtained from the Trustees of Indiana University. 29 | // 30 | // INDIANA UNIVERSITY AND THE AUTHORS MAKE NO REPRESENTATIONS OR WARRANTIES, 31 | // EXPRESS OR IMPLIED. By way of example, but not limitation, INDIANA 32 | // UNIVERSITY MAKES NO REPRESENTATIONS OR WARRANTIES OF MERCANTABILITY OR 33 | // FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THIS SOFTWARE OR 34 | // DOCUMENTATION WILL NOT INFRINGE ANY PATENTS, COPYRIGHTS, TRADEMARKS, 35 | // OR OTHER RIGHTS. Neither Indiana University nor the authors shall be 36 | // held liable for any liability with respect to any claim by the user or 37 | // any other party arising from use of the program. 38 | //****************************************************************************** 39 | 40 | #include 41 | 42 | class LikelihoodCalculatorMPI; 43 | 44 | using namespace std; 45 | 46 | /* 47 | There is one instance of this class per MPI job and it manages what could 48 | be multiple LikelihoodCalculators (one for each reaction) within a single 49 | MPI job. All LikelihoodCalculators that are created within the job 50 | register with this class. The behavior of the instance varies depending on 51 | whether the MPI job is the leader or follower job. 52 | */ 53 | 54 | class LikelihoodManagerMPI 55 | { 56 | 57 | public: 58 | 59 | enum FitCommand { kComputeLikelihood, 60 | kComputeIntegrals, 61 | kUpdateParameters, 62 | kUpdateAmpParameter, 63 | kFinalizeFit, 64 | kExit }; 65 | 66 | LikelihoodManagerMPI(){}; 67 | 68 | static void registerCalculator( int id, LikelihoodCalculatorMPI* calc ); 69 | 70 | static void deliverLikelihood(); 71 | 72 | static void broadcastToFirst( FitCommand command ); 73 | 74 | static FitCommand lastCommand() { return m_lastCommand; } 75 | 76 | private: 77 | 78 | static void setupMPI(); 79 | 80 | static bool m_mpiSetup; 81 | static bool m_isLeader; 82 | static int m_numProc; 83 | 84 | static map< int, LikelihoodCalculatorMPI* > m_calcMap; 85 | static FitCommand m_lastCommand; 86 | 87 | static const char* kModule; 88 | }; 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /Tutorials/Dalitz/DalitzLib/DalitzAmp/BreitWigner.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #include "TLorentzVector.h" 8 | #include "IUAmpTools/Kinematics.h" 9 | #include "DalitzAmp/BreitWigner.h" 10 | 11 | BreitWigner::BreitWigner( const vector< string >& args ) : 12 | UserAmplitude< BreitWigner >(args) 13 | { 14 | 15 | assert( args.size() == 4 ); 16 | 17 | m_mass = AmpParameter(args[0]); 18 | m_width = AmpParameter(args[1]); 19 | m_daughter1 = atoi(args[2].c_str()); 20 | m_daughter2 = atoi(args[3].c_str()); 21 | 22 | // need to register any free parameters so the framework knows about them 23 | registerParameter( m_mass ); 24 | registerParameter( m_width ); 25 | 26 | } 27 | 28 | 29 | void 30 | BreitWigner::calcUserVars( GDouble** pKin, GDouble* userVars ) const { 31 | 32 | // This method can be used to calculate more CPU-intensive quantities 33 | // that the amplitudes themselves depend on. IMPORTANT: it is called 34 | // ONCE per fit so do NOT calculate quantities that depend on 35 | // free parameters in the fit. 36 | // 37 | // These quantities are always calculated on the CPU and, in the 38 | // case of GPU accelerated fits, they will be propagated to the GPU 39 | // for use in the amplitude kernel. It is recommended to index 40 | // them with an enum. Unfortunately there is no straightforward 41 | // way to propagate this indexing to the GPU, so the GPU kernel 42 | // will need to fetch the quantities using integers. 43 | 44 | 45 | TLorentzVector P1(pKin[m_daughter1-1][1], pKin[m_daughter1-1][2], 46 | pKin[m_daughter1-1][3], pKin[m_daughter1-1][0]); 47 | 48 | TLorentzVector P2(pKin[m_daughter2-1][1], pKin[m_daughter2-1][2], 49 | pKin[m_daughter2-1][3], pKin[m_daughter2-1][0]); 50 | 51 | userVars[kMass2] = (P1+P2).M2(); 52 | } 53 | 54 | 55 | complex< GDouble > 56 | BreitWigner::calcAmplitude( GDouble** pKin, GDouble* userVars ) const { 57 | 58 | /**** 59 | * There are two possibilities here: 60 | * (1) fetch mass squared from the userVars array, in which case 61 | * the needUserVarsOnly flag can be set to true; or 62 | * (2) calculate mass squared from scratch and set the needUserVarsOnly 63 | * flag to false. 64 | * 65 | * The role of user data is to optimize this function 66 | * call in the instance it is repeated multiple times throughout 67 | * a fit, which only happens if there are free parameters 68 | * in this amplitude calculation (as there are in this one). 69 | */ 70 | 71 | // (1) fetch the cached copy of mass squared 72 | 73 | //GDouble mass2 = userVars[kMass2]; 74 | 75 | // or (2) calculate mass squared from scratch 76 | 77 | TLorentzVector P1(pKin[m_daughter1-1][1], pKin[m_daughter1-1][2], 78 | pKin[m_daughter1-1][3], pKin[m_daughter1-1][0]); 79 | 80 | TLorentzVector P2(pKin[m_daughter2-1][1], pKin[m_daughter2-1][2], 81 | pKin[m_daughter2-1][3], pKin[m_daughter2-1][0]); 82 | 83 | GDouble mass2 = (P1+P2).M2(); 84 | 85 | 86 | return complex(1.0,0.0) / 87 | complex( mass2 - m_mass*m_mass, m_mass*m_width); 88 | 89 | } 90 | 91 | 92 | 93 | #ifdef GPU_ACCELERATION 94 | void 95 | BreitWigner::launchGPUKernel( dim3 dimGrid, dim3 dimBlock, GPU_AMP_PROTO ) const { 96 | 97 | BreitWigner_exec( dimGrid, dimBlock, GPU_AMP_ARGS, 98 | m_mass, m_width, m_daughter1, m_daughter2 ); 99 | 100 | } 101 | #endif //GPU_ACCELERATION 102 | --------------------------------------------------------------------------------