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

added missing introduced directory PwaApps

parent 05508de8
No related branches found
No related tags found
No related merge requests found
//************************************************************************//
// //
// Copyright 2013 Bertram Kopf (bertram@ep1.rub.de) //
// Julian Pychy (julian@ep1.rub.de) //
// - Ruhr-Universität Bochum //
// //
// This file is part of Pawian. //
// //
// Pawian is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Pawian is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Pawian. If not, see <http://www.gnu.org/licenses/>. //
// //
//************************************************************************//
#include "Examples/pbarp/Dummy.hh"
Dummy::Dummy()
{
}
Dummy::~Dummy(){
}
//************************************************************************//
// //
// Copyright 2013 Bertram Kopf (bertram@ep1.rub.de) //
// Julian Pychy (julian@ep1.rub.de) //
// - Ruhr-Universität Bochum //
// //
// This file is part of Pawian. //
// //
// Pawian is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Pawian is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Pawian. If not, see <http://www.gnu.org/licenses/>. //
// //
//************************************************************************//
#pragma once
class Dummy {
public:
Dummy();
virtual ~Dummy();
protected:
private:
};
alias install : install-bin install-lib ;
explicit install ;
install install-bin : coupledCannelApp
: <location>$(TOP)/bin
<install-dependencies>on
<install-type>EXE
;
install install-lib : PwaApps
: <location>$(TOP)/lib
<install-dependencies>on
<install-type>LIB
;
project :
;
lib PwaApps :
[ glob *.cc : *App.cc ]
$(TOP)/qft++//qft++
$(TOP)/ErrLogger//ErrLogger
$(TOP)/ConfigParser//ConfigParser
$(TOP)/FitParams//FitParams
$(TOP)/PwaUtils//PwaUtils
$(TOP)/AppUtils//AppUtils
$(TOP)/pbarpUtils//pbarpUtils
$(TOP)/epemUtils//epemUtils
$(TOP)/Particle//Particle
$(TOP)/Event//Event
:
:
: ;
exe coupledCannelApp : coupledCannelApp.cc PwaApps : ;
//************************************************************************//
// //
// Copyright 2013 Bertram Kopf (bertram@ep1.rub.de) //
// Julian Pychy (julian@ep1.rub.de) //
// - Ruhr-Universit??t Bochum //
// //
// This file is part of Pawian. //
// //
// Pawian is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// Pawian is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with Pawian. If not, see <http://www.gnu.org/licenses/>. //
// //
//************************************************************************//
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <map>
#include <tuple>
#include <iterator>
#include <memory>
#include "TROOT.h"
#include "Particle/ParticleTable.hh"
#include "Particle/Particle.hh"
#include "Particle/PdtParser.hh"
#include "PwaUtils/AbsLh.hh"
#include "FitParams/FitParColBase.hh"
#include "FitParams/StreamFitParColBase.hh"
#include "FitParams/PwaCovMatrix.hh"
#include "AppUtils/AppBase.hh"
#include "PwaUtils/GlobalEnv.hh"
#include "PwaUtils/EvtDataBaseList.hh"
#include "PwaUtils/NetworkClient.hh"
#include "PwaUtils/WelcomeScreen.hh"
#include "pbarpUtils/pbarpStatesLS.hh"
#include "ConfigParser/pbarpParser.hh"
#include "pbarpUtils/PbarpChannelEnv.hh"
#include "pbarpUtils/pbarpReaction.hh"
#include "pbarpUtils/pbarpBaseLh.hh"
#include "pbarpUtils/pbarpHeliLh.hh"
#include "pbarpUtils/pbarpCanoLh.hh"
#include "pbarpUtils/pbarpTensorLh.hh"
#include "pbarpUtils/pbarpHist.hh"
#include "pbarpUtils/spinDensityHist.hh"
#include "ConfigParser/globalParser.hh"
#include "ConfigParser/epemParser.hh"
#include "epemUtils/EpemChannelEnv.hh"
#include "Utils/PawianCollectionUtils.hh"
#include "Utils/ErrLogUtils.hh"
#include "Event/EventReaderDefault.hh"
#include "Event/Event.hh"
#include "Event/EventList.hh"
#include "FitParams/ParamFactory.hh"
#include "FitParams/AbsPawianParameters.hh"
#include "ErrLogger/ErrLogger.hh"
int main(int __argc,char *__argv[]){
Info << welcomeScreen << endmsg;
Info << "Compiled " << __DATE__ << " " << __TIME__ << endmsg;
// Parse the command line
globalParser* globalAppParams=new globalParser(__argc, __argv);
// Set the desired error logging mode
setErrLogMode(globalAppParams->getErrLogMode());
// Setup the global environment and add the primary pbarp channel
GlobalEnv::instance()->setup(globalAppParams);
// Create environments for coupled channels
// Currently secondary channels need to be of the same type(pbarp, epem,..) as the primary one
std::vector<std::string> pbarpCfgs = globalAppParams->pbarpCfgs();
for(auto it=pbarpCfgs.begin(); it!=pbarpCfgs.end();++it){
char* argv[] = {__argv[0], (char*)"-c", (char*)(*it).c_str()};
pbarpParser* ccParser = new pbarpParser(3, argv);
GlobalEnv::instance()->AddEnv(std::shared_ptr<PbarpChannelEnv>(new PbarpChannelEnv(ccParser)), AbsChannelEnv::CHANNEL_PBARP);
}
std::vector<std::string> epemCfgs = globalAppParams->epemCfgs();
for(auto it=epemCfgs.begin(); it!=epemCfgs.end();++it){
char* argv[] = {__argv[0], (char*)"-c", (char*)(*it).c_str()};
epemParser* ccParser = new epemParser(3, argv);
GlobalEnv::instance()->AddEnv(std::shared_ptr<EpemChannelEnv>(new EpemChannelEnv(ccParser)), AbsChannelEnv::CHANNEL_EPEM);
}
// Get mode
std::string mode=globalAppParams->mode();
AppBase theAppBase;
theAppBase.createLhObjects();
// Create likelihood objects
ChannelEnvList channelEnvs=GlobalEnv::instance()->ChannelEnvs();
if (mode=="dumpDefaultParams"){
theAppBase.dumpDefaultParams();
return 1;
}
// Read start param file
std::string paramStreamerPath=globalAppParams->fitParamFile();
std::string outputFileNameSuffix= GlobalEnv::instance()->outputFileNameSuffix();
StreamFitParmsBase theParamStreamer(paramStreamerPath);
fitParCol theStartparams=theParamStreamer.getFitParamVal();
fitParCol theErrorparams=theParamStreamer.getFitParamErr();
// Set minuit parameters
std::shared_ptr<AbsPawianParameters> upar=ParamFactory::instance()->getParametersPointer("Minuit2");
GlobalEnv::instance()->fitParColBase()->setAbsPawianParams(upar, theStartparams, theErrorparams);
std::cout << "\n\n**************** Fit parameter **************************" << std::endl;
for (int i=0; i<int(upar->Params().size()); ++i){
std::cout << upar->Name(i) << "\t" << upar->Value(i) << "\t" << upar->Error(i) << std::endl;
}
// Fix params for all channels
std::vector<std::string> fixedParams;
for(auto it=channelEnvs.begin();it!=channelEnvs.end();++it){
std::vector<std::string> fixedChannelParams = (*it).first->parser()->fixedParams();
fixedParams.insert(fixedParams.end(), fixedChannelParams.begin(), fixedChannelParams.end());
}
theAppBase.fixParams(upar,fixedParams);
// Disable output buffering
setvbuf(stdout, NULL, _IONBF, 0);
if(mode == "client"){
std::ostringstream portStringStream;
portStringStream << globalAppParams->serverPort();
NetworkClient theClient(globalAppParams->serverAddress(), portStringStream.str());
if(!theClient.Login())
return 0;
ChannelID channelID = theClient.channelID();
bool cacheAmps = GlobalEnv::instance()->Channel(channelID)->parser()->cacheAmps();
Info << "caching amplitudes enabled / disabled:\t" << cacheAmps << endmsg;
if (cacheAmps) GlobalEnv::instance()->Channel(channelID)->Lh()->cacheAmplitudes();
const std::string datFile=GlobalEnv::instance()->Channel(channelID)->parser()->dataFile();
const std::string mcFile=GlobalEnv::instance()->Channel(channelID)->parser()->mcFile();
Info << "data file: " << datFile ; // << endmsg;
Info << "mc file: " << mcFile ; // << endmsg;
std::vector<std::string> dataFileNames;
dataFileNames.push_back(datFile);
std::vector<std::string> mcFileNames;
mcFileNames.push_back(mcFile);
EventList eventsDataClient;
theAppBase.readEvents(eventsDataClient, dataFileNames, channelID, GlobalEnv::instance()->Channel(channelID)->useEvtWeight(), theClient.GetEventLimits()[0], theClient.GetEventLimits()[1]);
EventList mcDataClient;
theAppBase.readEvents(mcDataClient, mcFileNames, channelID, false, theClient.GetEventLimits()[2], theClient.GetEventLimits()[3]);
std::shared_ptr<EvtDataBaseList> eventListPtr(new EvtDataBaseList(channelID));
eventListPtr->read(eventsDataClient, mcDataClient);
GlobalEnv::instance()->Channel(channelID)->Lh()->setDataVec(eventListPtr->getDataVecs());
GlobalEnv::instance()->Channel(channelID)->Lh()->setMcVec(eventListPtr->getMcVecs());
theAppBase.calcAndSendClientLh(theClient, theStartparams, channelID);
return 1;
}
if(mode == "server" || mode == "evoserver"){
theAppBase.fitServerMode(upar);
return 1;
}
return 1;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment