Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: enforce clang-format formatting #14

Merged
merged 7 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
BasedOnStyle: LLVM
Language: Cpp
Standard: c++17
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ repos:
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v16.0.6
hooks:
- id: clang-format
types_or:
- c++
- c
- cuda

- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
Expand Down
7 changes: 1 addition & 6 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"[c]": {
"editor.formatOnSave": false
},
"[cpp]": {
"editor.formatOnSave": false
},
"[git-commit]": {
"rewrap.wrappingColumn": 72
},
Expand All @@ -26,6 +20,7 @@
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.formatOnSave": true,
"git.autofetch": true,
"git.autoRepositoryDetection": false,
"git.rebaseWhenSync": true,
"github-actions.workflows.pinned.refresh.enabled": true,
Expand Down
65 changes: 35 additions & 30 deletions script/print_amplitudes.cc
Original file line number Diff line number Diff line change
@@ -1,55 +1,60 @@
#include <iostream>
#include <complex>
#include <fstream>
#include <iostream>
#include <map>
#include <sstream>
#include <complex>
#include <string>
#include <vector>
#include <utility>
#include <map>
#include <vector>

#include "TSystem.h"

#include "AMPTOOLS_AMPS/Zlm.h"

#include "MinuitInterface/MinuitMinimizationManager.h"
#include "IUAmpTools/AmpToolsInterface.h"
#include "IUAmpTools/FitResults.h"
#include "IUAmpTools/ConfigFileParser.h"
#include "IUAmpTools/ConfigurationInfo.h"
#include "IUAmpTools/FitResults.h"
#include "MinuitInterface/MinuitMinimizationManager.h"

int main( int argc, char* argv[] ){
int main(int argc, char *argv[]) {

string configfile;
string configfile;

for ( int i = 1; i < argc; i++ ){
string arg( argv[i] );
for (int i = 1; i < argc; i++) {
string arg(argv[i]);

if ( arg == "-c" ){ configfile = argv[++i]; }
}
if (arg == "-c") {
configfile = argv[++i];
}
}

if( configfile.size() == 0 ){
cout << "No config file specified" << endl;
exit(1);
}
if (configfile.size() == 0) {
cout << "No config file specified" << endl;
exit(1);
}

ConfigFileParser parser(configfile);
ConfigurationInfo* cfgInfo = parser.getConfigurationInfo();
cfgInfo->display();
ConfigFileParser parser(configfile);
ConfigurationInfo *cfgInfo = parser.getConfigurationInfo();
cfgInfo->display();

AmpToolsInterface::registerAmplitude( Zlm() );
AmpToolsInterface::registerAmplitude(Zlm());

AmpToolsInterface ati( cfgInfo );
vector< TLorentzVector > p4List;
AmpToolsInterface ati(cfgInfo);
vector<TLorentzVector> p4List;

// list lab frame p4s, in the order specified in the AmpTools config file
p4List.push_back( TLorentzVector(0, 0, 8.209470, 8.209470) ); //beam photon
p4List.push_back( TLorentzVector(-0.291810, -0.315238, 0.695296, 1.244320) ); //recoil proton
p4List.push_back( TLorentzVector(0.183147, 0.002392, 0.384435, 0.448137) ); //resonance daughter 1
p4List.push_back( TLorentzVector(0.151104, 0.333728, 1.914300, 1.953710) ); //resonance daughter 2
// list lab frame p4s, in the order specified in the AmpTools config file
p4List.push_back(TLorentzVector(0, 0, 8.209470, 8.209470)); // beam photon
p4List.push_back(TLorentzVector(-0.291810, -0.315238, 0.695296,
1.244320)); // recoil proton
p4List.push_back(TLorentzVector(0.183147, 0.002392, 0.384435,
0.448137)); // resonance daughter 1
p4List.push_back(TLorentzVector(0.151104, 0.333728, 1.914300,
1.953710)); // resonance daughter 2

Kinematics kin( p4List );
Kinematics kin(p4List);

ati.printEventDetails( cfgInfo->reactionList()[0]->reactionName(), &kin );
ati.printEventDetails(cfgInfo->reactionList()[0]->reactionName(), &kin);

return 0;
return 0;
}
Loading