blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
247
content_id
stringlengths
40
40
detected_licenses
listlengths
0
57
license_type
stringclasses
2 values
repo_name
stringlengths
4
111
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
58
visit_date
timestamp[ns]date
2015-07-25 18:16:41
2023-09-06 10:45:08
revision_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
committer_date
timestamp[ns]date
1970-01-14 14:03:36
2023-09-06 06:22:19
github_id
int64
3.89k
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
25 values
gha_event_created_at
timestamp[ns]date
2012-06-07 00:51:45
2023-09-14 21:58:52
gha_created_at
timestamp[ns]date
2008-03-27 23:40:48
2023-08-24 19:49:39
gha_language
stringclasses
159 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
10.5M
extension
stringclasses
111 values
filename
stringlengths
1
195
text
stringlengths
7
10.5M
74b6324595a6e72224c5fde1842e6b2328fa6018
d7efe64923c327d873999b0b0d1012d3ecac89da
/Pipes/neighGraphPipe.cpp
ed5db85c664b2b76c7313aa96912e956b0f8abc3
[ "MIT" ]
permissive
wilseypa/lhf
cc67c7388d924d7f18fed76f98f8f9e1a84c019c
aa5b6ae27b2516e9be7b977ff52343f19a6be4e6
refs/heads/master
2023-08-18T11:50:18.423764
2023-08-16T13:43:49
2023-08-16T13:43:49
127,002,935
4
15
MIT
2023-08-16T13:43:51
2018-03-27T14:54:01
C++
UTF-8
C++
false
false
2,668
cpp
neighGraphPipe.cpp
/* * neighGraphPipe hpp + cpp extend the basePipe class for building the * neighborhood graph from data input in the complex structure configured * */ #include <string> #include <iostream> #include <fstream> #include <iterator> #include <vector> #include <chrono> #include <functional> #include "neighGraphPipe.hpp" // basePipe constructor template<typename nodeType> neighGraphPipe<nodeType>::neighGraphPipe(){ this->pipeType = "neighGraph"; return; } // runPipe -> Run the configured functions of this pipeline segment template<typename nodeType> void neighGraphPipe<nodeType>::runPipe(pipePacket<nodeType> &inData){ //Iterate through each vector, inserting into simplex storage for(unsigned i = 0; i < inData.workData.size(); i++){ if(!inData.workData[i].empty()){ //insert data into the complex (SimplexArrayList, SimplexTree) inData.complex->insert(); } } return; } // configPipe -> configure the function settings of this pipeline segment template<typename nodeType> bool neighGraphPipe<nodeType>::configPipe(std::map<std::string, std::string> &configMap){ std::string strDebug; auto pipe = configMap.find("debug"); if(pipe != configMap.end()){ this->debug = std::atoi(configMap["debug"].c_str()); strDebug = configMap["debug"]; } pipe = configMap.find("outputFile"); if(pipe != configMap.end()) this->outputFile = configMap["outputFile"].c_str(); this->ut = utils(strDebug, this->outputFile); pipe = configMap.find("epsilon"); if(pipe != configMap.end()) this->epsilon = std::atof(configMap["epsilon"].c_str()); else return false; pipe = configMap.find("dimensions"); if(pipe != configMap.end()){ this->dim = std::atoi(configMap["dimensions"].c_str()); } else return false; this->configured = true; this->ut.writeDebug("neighGraphPipe","Configured with parameters { dim: " + std::to_string(dim) + " , eps: " + configMap["epsilon"] + " , debug: " + strDebug + ", outputFile: " + this->outputFile + " }"); return true; } // outputData -> used for tracking each stage of the pipeline's data output without runtime template<typename nodeType> void neighGraphPipe<nodeType>::outputData(pipePacket<nodeType> &inData){ std::ofstream file ("output/" + this->pipeType + "_output.csv"); auto edges = inData.complex->getAllEdges(); for (auto edge : edges){ for (auto a : edge){ for(auto d : a->simplex){ file << d << ","; } file << a->weight << "\n"; } } file << std::endl; file.close(); return; } //Explicit Template Class Instantiation template class neighGraphPipe<simplexNode>; template class neighGraphPipe<alphaNode>; template class neighGraphPipe<witnessNode>;
cb0ff107aff95f279a5bb990ccb68e2741f4ce82
eb2f8b3271e8ef9c9b092fcaeff3ff8307f7af86
/Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0259/game/game.cpp
e049e36d29180fe594927e9179a78c3bbfb6e640
[]
no_license
Orion545/OI-Record
0071ecde8f766c6db1f67b9c2adf07d98fd4634f
fa7d3a36c4a184fde889123d0a66d896232ef14c
refs/heads/master
2022-01-13T19:39:22.590840
2019-05-26T07:50:17
2019-05-26T07:50:17
188,645,194
4
2
null
null
null
null
UTF-8
C++
false
false
720
cpp
game.cpp
#include <iostream> #include <cstdio> #include <cstring> #include <cstdlib> #include <ctime> using namespace std; int main() { freopen("game.in","r",stdin); freopen("game.out","w",stdout); int n,m; srand(time(NULL)); scanf("%d%d",&n,&m); if (n==1&&m==1) cout<<2<<endl; else if (n==1&&m==2) cout<<4<<endl; else if (n==1&&m==3) cout<<8<<endl; else if (n==2&&m==1) cout<<4<<endl; else if (n==2&&m==2) cout<<12<<endl; else if (n==2&&m==3) cout<<36<<endl; else if (n==3&&m==1) cout<<8<<endl; else if (n==3&&m==2) cout<<24<<endl; else if (n==3&&m==3) cout<<112<<endl; else if (n==5&&m==5) cout<<7136<<endl; else cout<<(long long)((n+m)*rand()%1000000009*rand()%1000000009*rand()%1000000009)<<endl; return 0; }
0f8ba7ece91ae458ec0aa940f844d2eb915fef42
0770dc9fe901f39511deaabb55d5df6df94c0a4d
/GameClient/Inc/State/PlayScene.h
55addab405a0197830ca8de2569aca620122fa91
[ "MIT" ]
permissive
victor-timoshin/Co-opShooter
9513f0381b7ab9b37e12ea8beb160b59158239a9
6f78c5d8d6bbbf42ebe84db1e0c31bbbd79180b5
refs/heads/master
2021-03-12T20:11:17.392362
2016-01-09T20:44:42
2016-01-09T20:44:42
37,907,006
0
0
null
null
null
null
UTF-8
C++
false
false
1,274
h
PlayScene.h
#ifndef PLAYSCENE_H #define PLAYSCENE_H #include "../Player.h" #include "../GameObject.h" #include "../GameWorld.h" #include "../StdAfx.h" class PlayScene : public Scene::ISceneStateBase { public: static PlayScene* GetInstancePtr(void); virtual void Enter(Core::Render::IRenderSystemBase* renderSystem, Scene::ISceneGraphBase* scene); virtual void Exit(void); virtual void Pause(void) {} virtual void Resume(void) {} virtual void FrameStarted(OIS::IInputBase* event, float timeStep); virtual void FrameEnded(void) {} Core::Render::IRenderSystemBase* GetRenderSystem(void); Scene::ISceneGraphBase* GetSceneGraph(void); GameWorld* GetGameWorld(void) { return _world; } GUI::IFontBase* GetTooltipHeader(void) { return _tooltipHeader; } GUI::IFontBase* GetTooltipDescription(void) { return _tooltipDescription; } protected: void InputMouseMove(OIS::IMouse* mouse); void SetRotation(float x, float y); private: static PlayScene _playScene; Core::Render::IRenderSystemBase* _renderSystem; Scene::ISceneGraphBase* _sceneGraph; Math::Vector3F _cameraPosition; GameWorld* _world; GameObject* _character; Player* _player; GUI::IFontBase* _font; GUI::IFontBase* _tooltipHeader; GUI::IFontBase* _tooltipDescription; }; #endif // PLAYSCENE_H
8d5236e7db569c6177e7552fa12ede4977a570ff
00bf95e973d20ebd4620b17638257a3839afe2bc
/linked-list/linkedlist.h
d6ad380b51409002d236e094000414d311f38dd0
[]
no_license
Ryan0621/data-structure
a88f1919c49ecb0d0e7b992e4af01b5b5e331df5
2a125eb71cd58fd5a21deed3401ffedf78dd796e
refs/heads/master
2020-11-27T15:15:47.113525
2019-12-22T23:15:34
2019-12-22T23:15:34
229,507,118
0
0
null
null
null
null
UTF-8
C++
false
false
4,536
h
linkedlist.h
#ifndef _LINKED_LIST #define _LINKED_LIST #include "BagInterface.h" #include "Node.h" #include <vector> using namespace std; template < class ItemType> class LinkedList : public BagInterface<ItemType> { private : Node<ItemType>* headPtr; int itemCount; Node<ItemType>* getPointerTo( const ItemType& target) const ; public : LinkedList(); LinkedList( const LinkedList<ItemType>* aBag); virtual ~LinkedList(); int getCurrentSize() const ; bool isEmpty() const ; bool add( const ItemType& newEntry); bool remove( const ItemType& anEntry); void clear(); bool contains( const ItemType& anEntry) const ; int getFrequencyOf( const ItemType& anEntry) const; vector<ItemType> toVector() const ; }; #endif template < class ItemType> LinkedList<ItemType>::LinkedList() { headPtr = nullptr; itemCount = 0; } template < class ItemType> bool LinkedList<ItemType>::add( const ItemType& newEntry) { Node<ItemType>* newNode = new Node<ItemType>(newEntry, headPtr); headPtr = newNode; itemCount++; return true; } template < class ItemType> LinkedList<ItemType>::~LinkedList() { clear(); } template < class ItemType> vector<ItemType> LinkedList<ItemType>::toVector() const { Node<ItemType>* currentPtr = headPtr; vector<ItemType> v; while (currentPtr!=nullptr) { v.push_back(currentPtr->getItem()); currentPtr = currentPtr->getNext(); } return v; } template < class ItemType> bool LinkedList<ItemType>::isEmpty() const { return (itemCount == 0); } template < class ItemType> int LinkedList<ItemType>::getCurrentSize() const { return itemCount; } template < class ItemType> int LinkedList<ItemType>::getFrequencyOf( const ItemType& anEntry) const { int frequency = 0; Node<ItemType>* curPtr = headPtr; while (curPtr != nullptr) { if (anEntry == curPtr->getItem()) { frequency++; } curPtr = curPtr->getNext(); } return frequency; } template < class ItemType> bool LinkedList<ItemType>::contains( const ItemType& anEntry) const { Node<ItemType>* curPtr = headPtr; while (curPtr != nullptr) { if(anEntry == curPtr->getItem()) { return true; } curPtr = curPtr->getNext(); } return false; } template < class ItemType> Node<ItemType>* LinkedList<ItemType>::getPointerTo( const ItemType& target) const { Node<ItemType>* curPtr = headPtr; while (curPtr != nullptr) { if(target == curPtr->getItem()) { return curPtr; } curPtr = curPtr->getNext(); } return nullptr; } template < class ItemType> bool LinkedList<ItemType>::remove( const ItemType& anEntry) { Node<ItemType>* curPtr = getPointerTo(anEntry); curPtr->setItem(headPtr->getItem()); Node<ItemType>* nodeToDeletePtr = headPtr; headPtr = headPtr->getNext(); delete nodeToDeletePtr; itemCount--; return true; } template < class ItemType> void LinkedList<ItemType>::clear() { Node<ItemType>* nodeToDeletePtr = headPtr; Node<ItemType>* nextPtr; while (nodeToDeletePtr != nullptr) { nextPtr = nodeToDeletePtr->getNext(); delete nodeToDeletePtr; itemCount--; nodeToDeletePtr = nextPtr; } } template < class ItemType> LinkedList<ItemType>::LinkedList( const LinkedList<ItemType>* aBag) { cout << "call" << endl; itemCount = aBag->itemCount; Node<ItemType>* origChainPtr = aBag->headPtr; if (origChainPtr == nullptr ) headPtr = nullptr ; // Original bag is empty; so is copy else { // Copy first node headPtr = new Node<ItemType>(); headPtr->setItem(origChainPtr ->getItem()); // Copy remaining nodes Node<ItemType>* newChainPtr = headPtr; // Last-node pointer while (origChainPtr->getNext() != nullptr ) { origChainPtr = origChainPtr->getNext(); // Advance pointer // Get next item from original chain ItemType nextItem = origChainPtr->getItem(); // Create a new node containing the next item Node<ItemType>* newNodePtr = new Node<ItemType>(nextItem); // Link new node to end of new chain newChainPtr->setNext(newNodePtr); // Advance pointer to new last node newChainPtr = newChainPtr->getNext(); } newChainPtr->setNext( nullptr ); // Flag end of new chain } }
7439d5c1bb0c2ca81a34cb11178528b9e8a35bce
5f628e78502f72564cad0032d747a28664a6ed6d
/src/core/testing/interfaces_test/v0/auto_populate_v0.hpp
ebe8dbf2d3489715aba7c4b3860627bd2d71046f
[]
no_license
danAllmann/wgtf
ee735e8ed05aef7b63250a6e0d2734daafd79e89
1288f488acc46b1505e1b1966d4be4641d0ead94
refs/heads/master
2021-06-01T07:09:08.856847
2016-06-03T06:59:35
2016-06-03T06:59:35
null
0
0
null
null
null
null
UTF-8
C++
false
false
485
hpp
auto_populate_v0.hpp
#ifndef V0_AUTO_POPULATE_V0_HPP #define V0_AUTO_POPULATE_V0_HPP #include "core_dependency_system/i_interface.hpp" namespace wgt { DECLARE_INTERFACE_BEGIN( AutoPopulate, 0, 0 ) typedef INTERFACE_VERSION( TestInterface, 0, 1 ) InterfaceA; typedef INTERFACE_VERSION( TestInterface, 0, 0 ) InterfaceB; virtual InterfaceA * getInterfaceA() = 0; virtual std::vector< InterfaceB * > getInterfaceBs() = 0; DECLARE_INTERFACE_END() } // end namespace wgt #endif //V0_AUTO_POPULATE_V0_HPP
34834b291859d26363abce5dfc1cade8c8996779
451c5ed3258fe768273e0e906e0c837fe07d64f1
/Source/QzGraphDemo/Demos/ComboDemo.cpp
1a43069684645227068783a4ae8eb69cd8bf6569
[]
no_license
bdmihai/qzgraph
0e223acd2fd43ef39fecc84b0c1b2831927aca99
4d92198d24ce7dcfb4c129add665e7edc35f0e6c
refs/heads/master
2016-09-16T02:11:15.093270
2012-05-20T17:58:37
2012-05-20T17:58:37
32,224,338
0
0
null
null
null
null
UTF-8
C++
false
false
228
cpp
ComboDemo.cpp
#include "Stable.h" #include "ComboDemo.h" ComboDemo::ComboDemo() : DemoBase("General/Combo Demo", "A demo that combines bar charts with line graphs, curve filling, text items, etc.") { } ComboDemo::~ComboDemo() { }
2e892ac750503a0184dadb7cee93d9dd494401ab
3fd377a081a3a77b6b565df8eee38e70e740d9d1
/aulib/rpgen/rand_rp.h
ea984d5ab4c4c532b7fa1c724de0b4d763262d01
[]
no_license
nh2oh/au
5181e1f4c852fbd3ed6816f90e8b65116dc0d5bb
fe37faff945f78396c2cfdf7150c350200364987
refs/heads/master
2021-06-17T16:16:04.090670
2019-08-18T13:50:10
2019-08-18T13:50:10
142,479,438
0
0
null
null
null
null
UTF-8
C++
false
false
1,731
h
rand_rp.h
#pragma once #include "..\types\nv_t.h" #include "..\types\ts_t.h" #include "..\types\beat_bar_t.h" #include "..\types\rp_t.h" #include <vector> #include <chrono> struct randrp_input { ts_t ts {}; std::vector<d_t> nvset {}; std::vector<double> pd {}; int nnts {0}; bar_t nbars {0}; std::chrono::seconds maxt {3}; // timeout bool operator==(randrp_input const& rhs) const { return (ts==rhs.ts && nvset==rhs.nvset && pd==rhs.pd && nnts == rhs.nnts && nbars == rhs.nbars); // TODO: chck maxt // TODO: Also == if the elements of nvset are the same but out of order }; }; struct randrp_result { bool success {false}; rp_t rp {}; }; randrp_result rand_rp(const randrp_input&); randrp_result rand_rp(ts_t,std::vector<d_t>,std::vector<double>,int,bar_t,std::chrono::seconds); struct rrpinput_validator_result { bool input_is_valid {false}; bool nvset_is_valid {false}; bool pd_is_valid {false}; bool nnts_is_valid {false}; bool nbars_is_valid {false}; bool maxt_is_valid {false}; std::string msg {}; }; rrpinput_validator_result validate_randrp_input(const randrp_input&); /* // // My randrp_input parser // As w/ all uih parsers, returns a uih_parser_result struct. Member // o_result is a std::optional<randrp_input>. If there is some problem // w/ the input, you can inspect member .failmsg (set by operator()) to // find out why. // // Construct like: // au::uih_parser<parse_randrp_input> my_parser {parse_randrp_input {}, // "Here is some helpful info about rand_rp()"}; // ... Then add additional predicates as needed. // struct parse_randrp_input { using PIType = typename randrp_input const&; au::uih_parser_result<randrp_input> operator()(randrp_input const&) const; }; */
af66df11371314c9a6f8a3835127bbfb5cfe887a
55e6980609fbd9780877e189ae363b0a4946fa35
/akApps/dailySketch4_13_17/src/ofApp.cpp
d1b7e7c703863fc2d614e9f8d3e37cda7b9de27f
[]
no_license
echoechochamber/ofSketches
2cf67cc1c7955443de55ae97f27496c3a8f8c606
6b4dddd394da59d8692835d1a8170a46fc3f9d6f
refs/heads/master
2021-04-15T10:03:57.852059
2017-08-17T18:01:27
2017-08-17T18:01:27
94,575,071
0
0
null
null
null
null
UTF-8
C++
false
false
2,357
cpp
ofApp.cpp
#include "ofApp.h" using namespace ofxCv; //-------------------------------------------------------------- void ofApp::setup(){ ofSetVerticalSync(true); vid.initGrabber(width, height); tracker.setup(); } //-------------------------------------------------------------- void ofApp::update(){ vid.update(); if(vid.isFrameNew()){ tracker.update(toCv(vid)); // anything you need to do in order to do with the new pixels } } //-------------------------------------------------------------- void ofApp::draw(){ ofClear(0,0,0); vid.draw(0,0); // vector<ofVec2f> getImagePoints() const; // vector<ofVec3f> getObjectPoints() const; // vector<ofVec3f> getMeanObjectPoints() const; if(tracker.getFound()){ vector<ofVec2f> points = tracker.getImagePoints(); for(int i = 0; i < points.size(); i++){ ofDrawCircle(points[i].x, points[i].y, 2.0); // getPOints returns a vector of ofVec3f // use the x and y values of each point to draw the points that are available } } else { ofDrawRectangle(0, 0, 40., 40.); } } //-------------------------------------------------------------- void ofApp::keyPressed(int key){ } //-------------------------------------------------------------- void ofApp::keyReleased(int key){ } //-------------------------------------------------------------- void ofApp::mouseMoved(int x, int y ){ } //-------------------------------------------------------------- void ofApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseReleased(int x, int y, int button){ } //-------------------------------------------------------------- void ofApp::mouseEntered(int x, int y){ } //-------------------------------------------------------------- void ofApp::mouseExited(int x, int y){ } //-------------------------------------------------------------- void ofApp::windowResized(int w, int h){ } //-------------------------------------------------------------- void ofApp::gotMessage(ofMessage msg){ } //-------------------------------------------------------------- void ofApp::dragEvent(ofDragInfo dragInfo){ }
9aa382f02a8b7ed617e921ec566a28208d9705a3
0b8c13c58803c2f65fc06c3882bde711674d869f
/helpers/golHelpers.h
4a5779827accb4ccfa32e926d548a4d06d9bfe02
[]
no_license
DenisTDR/PA-GameOfLife
5359d60c69704abc05eb6e23e254a01e33613fce
0088ad8f2240bd66f9bbd095b249ab6b8fe563b5
refs/heads/master
2020-12-22T02:06:28.878745
2020-02-11T06:06:06
2020-02-11T06:06:06
236,637,904
1
0
null
null
null
null
UTF-8
C++
false
false
340
h
golHelpers.h
// // Created by nm on 28.01.2020. // #ifndef PA_GOLHELPERS_H #define PA_GOLHELPERS_H #include <vector> using namespace std; void addPadding(vector<vector<bool>> &vv, int up, int right, int bottom, int left); void updateCell(bool **in, bool **out, int i, int j); int countAliveCells(bool **w, int n, int m); #endif //PA_GOLHELPERS_H
659cd76b89d4cc034598088209ae56b671ea406d
c1e1b96e34eae3e4499877785730f37062d57a7a
/utc-0.1/include/Conduit.h
df23c575b953bfdba4f1cfe71f2407e71c88e95e
[]
no_license
Lazybird-Chao/UTC
8d3cc6b1e07ff26c3d525042fa4db2e8a44a76a9
2380b6de445fd54607397fd7d3e63f3bb2b0faf5
refs/heads/master
2021-03-27T10:15:47.591041
2017-10-04T21:10:59
2017-10-04T21:10:59
42,334,435
0
0
null
null
null
null
UTF-8
C++
false
false
2,493
h
Conduit.h
#ifndef UTC_CONDUIT_H_ #define UTC_CONDUIT_H_ #include "TaskBase.h" #include "ConduitBase.h" //#define ENABLE_OPBY_FINISH #define DISABLE_OPBY_FINISH namespace iUtc{ enum class ConduitType{ unknown =0, c2c //cputask to cputask }; enum class ConduitOpType{ unknown =0, read, write, readby, writeby, readbyfirst, writbyfirst }; // forward declaration class ConduitManager; class Conduit { public: Conduit(); Conduit(TaskBase* srctask, TaskBase* dsttask); //Conduit(TaskBase* srctask, TaskBase* dsttask, int capacity); //void setCapacity(int capacity); int getCapacity(); std::string getName(); TaskBase* getSrcTask(); TaskBase* getDstTask(); TaskBase* getAnotherTask(); ConduitId_t getConduitId(); void Connect(TaskBase* src, TaskBase* dst); int Write(void* DataPtr, DataSize_t DataSize, int tag); int WriteBy(ThreadRank_t thread, void* DataPtr, DataSize_t DataSize, int tag); #ifdef ENABLE_OPBY_FINISH void WriteBy_Finish(int tag); #endif int WriteByFirst(void* DataPtr, DataSize_t DataSize, int tag); int BWrite(void* DataPtr, DataSize_t DataSize, int tag); int BWriteBy(ThreadRank_t thread, void* DataPtr, DataSize_t DataSize, int tag); #ifdef ENABLE_OPBY_FINISH void BWriteBy_Finish(int tag); #endif int PWrite(void* DataPtr, DataSize_t DataSize, int tag); int PWriteBy(ThreadRank_t thread, void* DataPtr, DataSize_t DataSize, int tag); #ifdef ENABLE_OPBY_FINISH void PWriteBy_Finish(int tag); #endif int Read(void* DataPtr, DataSize_t DataSize, int tag); int ReadBy(ThreadRank_t thread, void* DataPtr, DataSize_t DataSize, int tag); #ifdef ENABLE_OPBY_FINISH void ReadBy_Finish(int tag); #endif int ReadByFirst(void* DataPtr, DataSize_t DataSize, int tag); int AsyncWrite(void* DataPtr, DataSize_t DataSize, int tag); void AsyncWrite_Finish(int tag); int AsyncRead(void* DataPtr, DataSize_t DataSize, int tag); void AsyncRead_Finish(int tag); ~Conduit(); private: int initConduit_C2C(TaskBase* srctask, TaskBase* dsttask, int capacity); ConduitType m_cdtType; ConduitManager* m_cdtMgr; TaskBase* m_srcTask; TaskBase* m_dstTask; TaskId_t m_srcId; TaskId_t m_dstId; std::string m_Name; int m_conduitId; int m_capacity; // ConduitBase *m_realConduitPtr; // Conduit& operator=(const Conduit& other)=delete; Conduit(const Conduit& other)=delete; }; }// end namespace iUtc #endif
2b4b57bbda2d0efa2d5270e5e2aa98471450b50d
3c283cd167fb7b06ffafb40b4be7f644c48380dc
/include/graphics/window/BaseWindow.h
c5b8fc3502cdcf9efacd41f644a427821262d602
[ "Apache-2.0" ]
permissive
arnozhang/strawframework
40f47efb1b33cfb221e671c0f04ea84b2f99b9f1
630a9a543cc819d966f888211717423eed9a8497
refs/heads/master
2023-08-05T10:20:09.301655
2023-04-05T08:49:04
2023-04-05T08:49:04
70,670,573
17
2
null
null
null
null
UTF-8
C++
false
false
2,384
h
BaseWindow.h
/* * Copyright (C) 2016. The Straw Framework Project. * * @author Arno Zhang * @date 2016/03/18 */ #pragma once #include "base/ptr/RefPtrObject.h" #include "graphics/view/Element.h" #ifdef STRAW_BUILD_FOR_WIN32 #include <Windows.h> #endif // STRAW_BUILD_FOR_WIN32 namespace sf { enum SizeableType { Disabled = 0x00, VerticalSizeable = 0x02, HorizontalSizeable = 0x01, BothSizeable = HorizontalSizeable | VerticalSizeable }; struct NativeWindow { #ifdef STRAW_BUILD_FOR_WIN32 HWND hwnd; bool operator== (const NativeWindow& rhs) const { return hwnd == rhs.hwnd; } #else #endif // STRAW_BUILD_FOR_WIN32 }; class STRAW_FRAMEWORK_API BaseWindow : public ElementInherit<BaseWindow, Element, true> { public: BaseWindow(const Context& context) : ElementInherit(context) {} virtual ElementType getElementType() const { return sf::ElementType::Element_Window; } virtual void close() = 0; virtual void show() = 0; virtual void hide() = 0; virtual void setFocus() = 0; virtual void setPosition(int x, int y) = 0; virtual void setSize(int width, int height) = 0; virtual void setAlpha(float alpha) = 0; virtual void setSizeable(SizeableType type) = 0; virtual void setCenterInScreen(bool center) = 0; virtual void setMinimizable(bool enable) = 0; virtual void setMaximizable(bool enable) = 0; virtual Point getPosition() const = 0; virtual Size getSize() const = 0; virtual float getAlpha() const = 0; virtual void setTitle(const std::string& title) = 0; virtual std::string getTitle() const = 0; virtual void bringToTopMost() const = 0; virtual void cancelTopMost() const = 0; virtual void minWindow() const = 0; virtual void maxOrResotreWindow() const = 0; virtual bool isMinimized() const = 0; virtual bool isMaximized() const = 0; virtual bool isShown() const = 0; virtual bool isActived() const = 0; virtual void requestFocus() const = 0; virtual Point getCursorPosition() const = 0; virtual Point getCursorPositionInScreen() const = 0; virtual NativeWindow getNativeWindowInfo() const = 0; }; }
1ae672076d1835dbef9e69f5150352cd1f181e5f
a68efe9a519480623f1ac57218137a68986e9768
/ising2D_cl.cpp
87d53f0f6dac16305afdcc713f4f84c82de66e18
[]
no_license
bloerg/clmuca
833f419d182d310f1c78202174a0ff10bfc0c9de
7481beb4ee282c14b0f28ea7028f4e710f43c7f3
refs/heads/master
2020-03-16T10:35:55.744768
2018-05-08T16:30:39
2018-05-08T16:30:39
132,636,123
1
0
null
null
null
null
UTF-8
C++
false
false
13,890
cpp
ising2D_cl.cpp
// OpenCL #include <CL/cl.hpp> // This includes my_uint64 type #include "ising2D_io.hpp" #include "muca.hpp" #include <sys/time.h> // Random Number Generator #include "Random123/philox.h" #include "Random123/examples/uniform.hpp" // 256 threads per block ensures the possibility of full occupancy // for all compute capabilities if thread count small enough #define WORKERS_PER_BLOCK 256 // choose random number generator typedef r123::Philox4x32_R<7> RNG; using namespace std; int main(int argc, char** argv) { parseArgs(argc, argv); if (NUM_WORKERS % WORKERS_PER_BLOCK != 0) { cerr << "ERROR: NUM_WORKERS must be multiple of " << WORKERS_PER_BLOCK << endl; } // select device vector<cl::Platform> all_platforms; cl::Platform::get(&all_platforms); if (all_platforms.size() == 0) { cerr << "ERROR: No platforms found. Check OpenCL installation!\n"; exit(1); } cl::Platform default_platform=all_platforms[1]; cout << "\nINFO: Using platform: "<<default_platform.getInfo<CL_PLATFORM_NAME>()<<"\n"; vector<cl::Device> all_devices; default_platform.getDevices(CL_DEVICE_TYPE_GPU, &all_devices); int deviceCount = all_devices.size(); if (deviceCount == 0) { cerr << "ERROR: No devices found. Check OpenCL installation!\n"; exit(1); } cl::Device device; if(REQUESTED_GPU >= 0 and REQUESTED_GPU < deviceCount) { device = all_devices[REQUESTED_GPU]; } else { device = all_devices[0]; } cout << "INFO: Using device " << device.getInfo<CL_DEVICE_NAME>() << "\n"; // figure out optimal execution configuration // based on GPU architecture and generation int maxresidentthreads = device.getInfo<CL_DEVICE_MAX_WORK_GROUP_SIZE>(); int totalmultiprocessors = device.getInfo<CL_DEVICE_MAX_COMPUTE_UNITS>(); int optimum_number_of_workers = maxresidentthreads*totalmultiprocessors; if (NUM_WORKERS == 0) { NUM_WORKERS = optimum_number_of_workers * 2; } cout << "INFO: Number of Workers: " << NUM_WORKERS << "\n"; cout << "INFO: GPU capabilities\n CL_DEVICE_MAX_WORK_GROUP_SIZE: " << maxresidentthreads << "\n CL_DEVICE_MAX_COMPUTE_UNITS: " << totalmultiprocessors << "\n"; cl::Context cl_context({device}); cl::CommandQueue cl_queue(cl_context, device); // read the kernel from source file std::ifstream cl_program_file_ising("ising2D_cl.cl"); std::string cl_program_string_ising( std::istreambuf_iterator<char>(cl_program_file_ising), (std::istreambuf_iterator<char>()) ); cl::Program cl_program_ising(cl_context, cl_program_string_ising, true); if (cl_program_ising.build({ device }, "-I include") != CL_SUCCESS){ cerr << "ERROR: Error building: " << cl_program_ising.getBuildInfo<CL_PROGRAM_BUILD_LOG>(device) << "\n"; getchar(); exit(1); } cl::Kernel cl_kernel_compute_energies(cl_program_ising, "computeEnergies"); cl::Kernel cl_kernel_muca_iteration(cl_program_ising, "mucaIteration"); int memory_operation_status; //for debugging int kernel_run_result; //for debugging // initialize NUM_WORKERS (LxL) lattices RNG rng; vector<cl_char> h_lattice(NUM_WORKERS * N); cl::Buffer d_lattice_buf ( cl_context, CL_MEM_READ_WRITE, NUM_WORKERS * N * sizeof(cl_char), NULL, &memory_operation_status ); for (unsigned worker=0; worker < NUM_WORKERS; worker++) { RNG::key_type k = {{worker, 0xdecafbad}}; RNG::ctr_type c = {{0, seed, 0xBADCAB1E, 0xBADC0DED}}; RNG::ctr_type r; for (size_t i = 0; i < N; i++) { if (i%4 == 0) { ++c[0]; r = rng(c, k); } h_lattice.at(i * NUM_WORKERS + worker) = 2 * (r123::u01fixedpt<float>(r.v[i%4]) < 0.5) - 1; } } // cout << "DEBUG: return value of create buffer d_lattice_buf: " << memory_operation_status << "\n"; memory_operation_status = cl_queue.enqueueWriteBuffer(d_lattice_buf, CL_TRUE, 0, NUM_WORKERS * N * sizeof(cl_char), &h_lattice[0]); // cout << "DEBUG: return value of writing d_lattice_buf to device" << memory_operation_status << "\n"; // initialize all energies cl::Buffer d_energies_buf ( cl_context, CL_MEM_READ_WRITE, NUM_WORKERS * sizeof(cl_int), NULL, &memory_operation_status ); // cout << "DEBUG: return value of create buffer d_energies_buf: " << memory_operation_status << "\n"; cl_kernel_compute_energies.setArg(0, d_lattice_buf); cl_kernel_compute_energies.setArg(1, d_energies_buf); cl_kernel_compute_energies.setArg(2, L); cl_kernel_compute_energies.setArg(3, N); cl_kernel_compute_energies.setArg(4, NUM_WORKERS); kernel_run_result = cl_queue.enqueueNDRangeKernel( cl_kernel_compute_energies, cl::NDRange(0), cl::NDRange(NUM_WORKERS), cl::NDRange(WORKERS_PER_BLOCK) ); // cout << "DEBUG: return value of cl_kernel_compute_energies start: " << kernel_run_result << "\n"; // initialize ONE global weight array vector<cl_float> h_log_weights(N + 1, 0.0f); cl::Buffer d_log_weights_buf ( cl_context, CL_MEM_READ_WRITE, ( N + 1 ) * sizeof(cl_float), NULL, &memory_operation_status ); // std::cout << "DEBUG: return value of create buffer d_log_weights: " << memory_operation_status << "\n"; //~ FIXME: I there a way to do the following in Opencl? Maybe images. //~ cudaBindTexture(NULL, t_log_weights, d_log_weights, (N + 1) * sizeof(float)); // initialize ONE global histogram vector<my_uint64> h_histogram((N + 1), 0); cl::Buffer d_histogram_buf ( cl_context, CL_MEM_READ_WRITE, ( N + 1 ) * sizeof(my_uint64), NULL, &memory_operation_status ); // cout << "DEBUG: return value of create buffer d_histogram_buf:: " << memory_operation_status << "\n"; memory_operation_status = cl_queue.enqueueWriteBuffer(d_histogram_buf, CL_TRUE, 0, (N+1) * sizeof(my_uint64), &h_histogram[0]); // cout << "DEBUG: return value of writing d_histogram_buf to device: " << memory_operation_status << "\n"; // timing and statistics vector<long double> times; timespec start, stop; ofstream iterfile; iterfile.open("run_iterations.dat"); // initial estimate of width at infinite temperature // (random initialization requires practically no thermalization) unsigned width = 10; double nupdates_run = 1; // heuristic factor that determines the number of statistic per iteration // should be related to the integrated autocorrelation time double z = 2.25; // main iteration loop for (cl_ulong k=0; k < MAX_ITER; k++) { cout << "DEBUG: Starting iteration " << k << "\n"; // start timer //~ cudaDeviceSynchronize(); //This should be true in OpenCL after the last kernel run and buffer read. clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // copy global weights to GPU memory_operation_status = cl_queue.enqueueWriteBuffer(d_log_weights_buf, CL_TRUE, 0, (N+1) * sizeof(cl_float), &h_log_weights[0]); cout << "DEBUG: return value of writing d_log_weights_buf to device: " << memory_operation_status << "\n"; // acceptance rate and correlation time corrected "random walk" // in factor 30 we adjusted acceptance rate and >L range requirement of our present Ising situation NUPDATES_THERM = 30 * width; if (width<N) { // 6 is motivated by the average acceptance rate of a multicanonical simulation ~0.45 -> (1/0.45)**z~6 nupdates_run = 6 * pow(width, z) / NUM_WORKERS; } else { // for a flat spanning histogram, we assume roughly equally distributed // walkers and reduce the thermalization time // heuristic modification factor; // (>1; small enough to introduce statistical fluctuations on the convergence measure) nupdates_run *= 1.1; } NUPDATES = static_cast<my_uint64>(nupdates_run)+1; // local iteration on each thread, writing to global histogram cl_kernel_muca_iteration.setArg(0, d_lattice_buf); cl_kernel_muca_iteration.setArg(1, d_histogram_buf); cl_kernel_muca_iteration.setArg(2, d_energies_buf); cl_kernel_muca_iteration.setArg(3, d_log_weights_buf); cl_kernel_muca_iteration.setArg(4, k); cl_kernel_muca_iteration.setArg(5, seed); cl_kernel_muca_iteration.setArg(6, NUPDATES_THERM); cl_kernel_muca_iteration.setArg(7, NUPDATES); cl_kernel_muca_iteration.setArg(8, L); cl_kernel_muca_iteration.setArg(9, N); cl_kernel_muca_iteration.setArg(10, NUM_WORKERS); kernel_run_result = cl_queue.enqueueNDRangeKernel(cl_kernel_muca_iteration, cl::NDRange(0), cl::NDRange(NUM_WORKERS), cl::NDRange(WORKERS_PER_BLOCK)); // cout << "DEBUG: Result of cl_kernel_muca_iteration start: " << kernel_run_result << "\n"; // copy global histogram back to CPU memory_operation_status = cl_queue.enqueueReadBuffer(d_histogram_buf, CL_TRUE, 0, ( N + 1 ) * sizeof(my_uint64), &h_histogram[0]); // cout << "DEBUG: return value of reading d_histogram_buf from device: " << memory_operation_status << "\n"; // stop timer //~ cudaDeviceSynchronize(); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop); long double elapsed = 1e9* (stop.tv_sec - start.tv_sec) + (stop.tv_nsec - start.tv_nsec); times.push_back(elapsed); TOTAL_THERM += NUPDATES_THERM; TOTAL_UPDATES += NUPDATES; // flatness in terms of kullback-leibler-divergence; // requires sufficient thermalization!!! double dk = d_kullback(h_histogram); iterfile << "#NITER = " << k << " dk=" << dk << endl; writeHistograms(h_log_weights, h_histogram, iterfile); if (dk<1e-4) { break; } // measure width of the current histogram size_t start,end; getHistogramRange(h_histogram, start, end); unsigned width_new = end-start; if (width_new > width) width=width_new; // update logarithmic weights with basic scheme if not converged updateWeights(h_log_weights, h_histogram); } iterfile.close(); ofstream sout; sout.open("stats.dat"); writeStatistics(times, sout); sout << "total number of thermalization steps/Worker : " << TOTAL_THERM << "\n"; sout << "total number of iteration updates /Worker : " << TOTAL_UPDATES << "\n"; sout << "total number of all updates /Worker : " << TOTAL_THERM+TOTAL_UPDATES << "\n"; sout.close(); if (production) { std::cout << "start production run ..." << std::endl; // copy global weights to GPU memory_operation_status = cl_queue.enqueueWriteBuffer(d_log_weights_buf, CL_TRUE, 0, (N+1) * sizeof(cl_float), &h_log_weights[0]); // cout << "DEBUG: return value of writing d_log_weights_buf to device: " << memory_operation_status << "\n"; // thermalization NUPDATES_THERM = pow(N,z); cl_kernel_muca_iteration.setArg(0, d_lattice_buf); cl_kernel_muca_iteration.setArg(1, d_histogram_buf); cl_kernel_muca_iteration.setArg(2, d_energies_buf); cl_kernel_muca_iteration.setArg(3, d_log_weights_buf); cl_kernel_muca_iteration.setArg(4, 0); cl_kernel_muca_iteration.setArg(5, seed+1000); cl_kernel_muca_iteration.setArg(6, NUPDATES_THERM); cl_kernel_muca_iteration.setArg(7, 0); cl_kernel_muca_iteration.setArg(8, L); cl_kernel_muca_iteration.setArg(9, N); cl_kernel_muca_iteration.setArg(10, NUM_WORKERS); kernel_run_result = cl_queue.enqueueNDRangeKernel(cl_kernel_muca_iteration, cl::NDRange(0), cl::NDRange(NUM_WORKERS), cl::NDRange(WORKERS_PER_BLOCK)); // cout << "DEBUG: Result of cl_kernel_muca_iteration start: " << kernel_run_result << "\n"; // set jackknife size_t JACKS = 100; NUPDATES = NUPDATES_PRODUCTION/JACKS; // loop over Jackknife bins clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); for (size_t k = 0; k < JACKS; k++) { //~ cudaDeviceSynchronize(); // local production on each thread, writing to global histogram cl_kernel_muca_iteration.setArg(0, d_lattice_buf); cl_kernel_muca_iteration.setArg(1, d_histogram_buf); cl_kernel_muca_iteration.setArg(2, d_energies_buf); cl_kernel_muca_iteration.setArg(3, d_log_weights_buf); cl_kernel_muca_iteration.setArg(4, k); cl_kernel_muca_iteration.setArg(5, seed+2000); cl_kernel_muca_iteration.setArg(6, 0); cl_kernel_muca_iteration.setArg(7, NUPDATES); cl_kernel_muca_iteration.setArg(8, L); cl_kernel_muca_iteration.setArg(9, N); cl_kernel_muca_iteration.setArg(10, NUM_WORKERS); kernel_run_result = cl_queue.enqueueNDRangeKernel(cl_kernel_muca_iteration, cl::NDRange(0), cl::NDRange(NUM_WORKERS), cl::NDRange(WORKERS_PER_BLOCK)); // cout << "DEBUG: Result of cl_kernel_muca_iteration start: " << kernel_run_result << "\n"; // copy global histogram back to CPU memory_operation_status = cl_queue.enqueueReadBuffer(d_histogram_buf, CL_TRUE, 0, ( N + 1 ) * sizeof(my_uint64), &h_histogram[0]); // cout << "DEBUG: return value of reading d_histogram_buf from device: " << memory_operation_status << "\n"; std::stringstream filename; filename << "production" << std::setw(3) << std::setfill('0') << k << ".dat"; iterfile.open(filename.str().c_str()); writeHistograms(h_log_weights, h_histogram, iterfile); iterfile.close(); } clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &stop); std::cout << "production run updates JACK: " << NUPDATES << "*WORKER \n"; std::cout << "production run updates total: " << NUPDATES*100 << "*WORKER \n"; std::cout << "production run time total : " << (stop.tv_sec - start.tv_sec) + (stop.tv_nsec - start.tv_nsec)*1e-9 << "s\n"; sout.open("stats.dat", std::fstream::out | std::fstream::app); sout << "production run updates JACK: " << NUPDATES << "*WORKER \n"; sout << "production run updates total: " << NUPDATES*100 << "*WORKER \n"; sout << "production run time total : " << (stop.tv_sec - start.tv_sec) + (stop.tv_nsec - start.tv_nsec)*1e-9 << "s\n"; sout.close(); } return 0; }
1692bfa8a808f5fc9c0355ad86440488fa5d25d2
95fa2a38d0558fae54c282a56cfc533fb733e8ff
/Exaustive Search & Backtracking/GenerateBinarySequence.cpp
d2da25cd6f380291d130e70812c4161a5445f211
[]
no_license
Intekhab96/Programming_Fundamentals
cc517a2450aa9f49991a173880d2e05453afecaa
b059d775206e4aa6f71a2ae6f029e8ff7525af64
refs/heads/master
2023-07-03T14:09:05.873854
2021-08-14T20:21:44
2021-08-14T20:21:44
135,049,328
0
0
null
null
null
null
UTF-8
C++
false
false
525
cpp
GenerateBinarySequence.cpp
#include<bits/stdc++.h> using namespace std ; // Generates binary Sequence of n bits ( Prototype ) void GenerateBinarySequence( int n , string prefix = "" ); int main(){ // Test Cases for(int i = 1 ; i <= 5 ; i++ ) { GenerateBinarySequence(i); cout << endl << endl ; } return 0 ; } void GenerateBinarySequence( int n , string prefix ) { if ( n == 0 ) cout << prefix << endl ; else { GenerateBinarySequence(n-1 , prefix + "0" ); GenerateBinarySequence(n-1 , prefix + "1" ); } }
fee71778cb0dc260b356deb13e2e8790059920c4
dec4ef167e1ce49062645cbf036be324ea677b5e
/SDK/PUBG_ABP_Weapon_M24_parameters.hpp
89ab4f1c0288df2c71e5b670f55fa9262dba6997
[]
no_license
qrluc/pubg-sdk-3.7.19.5
519746887fa2204f27f5c16354049a8527367bfb
583559ee1fb428e8ba76398486c281099e92e011
refs/heads/master
2021-04-15T06:40:38.144620
2018-03-26T00:55:36
2018-03-26T00:55:36
126,754,368
1
0
null
null
null
null
UTF-8
C++
false
false
1,719
hpp
PUBG_ABP_Weapon_M24_parameters.hpp
#pragma once // PlayerUnknown's Battlegrounds (3.5.7.7) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "PUBG_ABP_Weapon_M24_classes.hpp" namespace PUBG { //--------------------------------------------------------------------------- //Parameters //--------------------------------------------------------------------------- // Function ABP_Weapon_M24.ABP_Weapon_M24_C.BlueprintUpdateAnimation struct UABP_Weapon_M24_C_BlueprintUpdateAnimation_Params { float* DeltaTimeX; // (Parm, ZeroConstructor, IsPlainOldData) }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.WeaponFireCycle_Event_1 struct UABP_Weapon_M24_C_WeaponFireCycle_Event_1_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.Reload2_Event_1 struct UABP_Weapon_M24_C_Reload2_Event_1_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.BlueprintInitializeAnimation struct UABP_Weapon_M24_C_BlueprintInitializeAnimation_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.AnimNotify_ShellEject struct UABP_Weapon_M24_C_AnimNotify_ShellEject_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.Reload1_Event_1 struct UABP_Weapon_M24_C_Reload1_Event_1_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.CancelReload_Event_1 struct UABP_Weapon_M24_C_CancelReload_Event_1_Params { }; // Function ABP_Weapon_M24.ABP_Weapon_M24_C.ExecuteUbergraph_ABP_Weapon_M24 struct UABP_Weapon_M24_C_ExecuteUbergraph_ABP_Weapon_M24_Params { int EntryPoint; // (Parm, ZeroConstructor, IsPlainOldData) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
1188629b8aa0525cec32feb97bcb0d372b4762c1
fc63a4d1f745fc48ca43226a8e2a03d70945540a
/c++/src/Utils/Rect.cpp
9d6d5c006e016e5c7c5b38549a5aaf66e375ffcd
[]
no_license
Aaron3154518/Sandbox-Game
2f2d379ee65b4ab2f35faed19a784b2916c841a4
631a9d64cb25f2ed1d301a2160a08a375bd97b4e
refs/heads/main
2023-08-15T08:53:59.272711
2021-10-09T02:47:59
2021-10-09T02:47:59
392,156,782
0
0
null
null
null
null
UTF-8
C++
false
false
6,003
cpp
Rect.cpp
#include "Rect.h" //namespace utils { // Rect Rect::Rect() { x = 0; y = 0; w = 0; h = 0; } Rect::Rect(int x, int y, int w, int h) { this->x = x; this->y = y; this->w = w; this->h = h; } Rect::Rect(const SDL_Rect& other) : Rect(other.x, other.y, other.w, other.h) {} Rect::~Rect() {} Rect& Rect::operator=(const SDL_Rect& rhs) { x = rhs.x; y = rhs.y; w = rhs.w; h = rhs.h; #ifdef DEBUG std::cerr << "Copy Rect: " << rhs << std::endl; std::cerr << " New Rect: " << *this << std::endl; #endif return *this; } bool Rect::operator==(const Rect& rhs) { return x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h; } void Rect::shift(int dX, int dY) { #ifdef DEBUG std::cerr << "\033[92mMoving Rectangle\033[0m" << std::endl; std::cerr << "Before: " << *this << std::endl; #endif x += dX; y += dY; #ifdef DEBUG std::cerr << "After: " << *this << std::endl; #endif } void Rect::setPos(const Rect& r, Rect::PosType mode) { setPos(r, mode, mode); } void Rect::setPos(const Rect& r, Rect::PosType xMode, Rect::PosType yMode) { switch (xMode) { case PosType::pCenter: setCX(r.cX()); break; case PosType::pBotRight: setX2(r.x2()); break; default: x = r.x; break; } switch (yMode) { case PosType::pCenter: setCY(r.cY()); break; case PosType::pBotRight: setY2(r.y2()); break; default: y = r.y; break; } } void Rect::setCenter(double nCX, double nCY) { x = (int)(nCX - w / 2); y = (int)(nCY - h / 2); } void Rect::setCenter(const SDL_Point& pos) { setCenter(pos.x, pos.y); } void Rect::setTopLeft(const SDL_Point& pos) { x = pos.x; y = pos.y; } void Rect::setBottomRight(const SDL_Point& pos) { setX2(pos.x); setY2(pos.y); } void Rect::resize(SDL_Point nDim, bool center) { resize(nDim.x, nDim.y, center); } void Rect::resize(int nW, int nH, bool center) { #ifdef DEBUG std::cerr << "\033[92mResizing Rectangle\033[0m" << std::endl; std::cerr << "Before: " << *this << std::endl; #endif double oldCX = cX(), oldCY = cY(); w = nW; h = nH; if (center) { x = (int)(oldCX - w / 2); y = (int)(oldCY - h / 2); } #ifdef DEBUG std::cerr << "After: " << *this << std::endl; #endif } void Rect::resizeFactor(double factor, bool center) { resize((int)(w * factor + .5), (int)(h * factor + .5), center); } void Rect::normalize() { // Swap x and x2 if (w < 0) { x += w; w *= -1; } // Swap y and y2 if (h < 0) { y += h; h *= -1; } } Rect Rect::getMinRect(SDL_Texture* tex, int maxW, int maxH) { int imgW, imgH; if (SDL_QueryTexture(tex, NULL, NULL, &imgW, &imgH) != 0) { SDL_Log("SDL_QueryTexture failed: %s", SDL_GetError()); return Rect(0, 0, maxW, maxH); } Rect r = getMinRect(imgW, imgH, maxW, maxH); #ifdef DEBUG std::cerr << "Got " << r << " from image with size " << imgW << " x " << imgH << std::endl; #endif return r; } Rect Rect::getMinRect(int w, int h, int maxW, int maxH) { // Save signs and make w/h positive int wSign = 1, hSign = 1; if (w < 0) { w *= -1; wSign = -1; } if (h < 0) { h *= -1; hSign = -1; } // maxW/maxH <= 0 or w/h == 0 means ignore that dimensions bool noW = maxW * w <= 0, noH = maxH * h <= 0; double factor = 1.; if (!noW && !noH) { factor = std::min((double)maxW / w, (double)maxH / h); } else if (noW) { factor = (double)maxH / h; } else if (noH) { factor = (double)maxW / w; } return Rect(0, 0, (int)(wSign * w * factor), (int)(hSign * h * factor)); } std::ostream& operator <<(std::ostream& os, const Rect& rhs) { os << "(" << rhs.x << "," << rhs.y << ") -> (" << rhs.x2() << "," << rhs.y2() << "), size = " << rhs.w << " x " << rhs.h << ", center = (" << rhs.cX() << "," << rhs.cY() << ")"; return os; } Rect& operator +=(Rect& lhs, const SDL_Point& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } Rect operator +(Rect lhs, const SDL_Point& rhs) { return lhs += rhs; } Rect& operator -=(Rect& lhs, const SDL_Point& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } Rect operator -(Rect lhs, const SDL_Point& rhs) { return lhs -= rhs; } //} bool operator ==(const SDL_Point& lhs, const SDL_Point& rhs) { return lhs.x == rhs.x && lhs.y == rhs.y; } bool operator !=(const SDL_Point& lhs, const SDL_Point& rhs) { return !(lhs == rhs); } // Point with point SDL_Point& operator +=(SDL_Point& lhs, const SDL_Point& rhs) { lhs.x += rhs.x; lhs.y += rhs.y; return lhs; } SDL_Point operator +(SDL_Point lhs, const SDL_Point& rhs) { return lhs += rhs; } SDL_Point& operator -=(SDL_Point& lhs, const SDL_Point& rhs) { lhs.x -= rhs.x; lhs.y -= rhs.y; return lhs; } SDL_Point operator -(SDL_Point lhs, const SDL_Point& rhs) { return lhs -= rhs; } SDL_Point& operator *=(SDL_Point& lhs, const SDL_Point& rhs) { lhs.x *= rhs.x; lhs.y *= rhs.y; return lhs; } SDL_Point operator *(SDL_Point lhs, const SDL_Point& rhs) { return lhs *= rhs; } SDL_Point& operator /=(SDL_Point& lhs, const SDL_Point& rhs) { lhs.x /= rhs.x; lhs.y /= rhs.y; return lhs; } SDL_Point operator /(SDL_Point lhs, const SDL_Point& rhs) { return lhs /= rhs; } // Point with double SDL_Point& operator +=(SDL_Point& lhs, const double& rhs) { lhs.x = std::floor(lhs.x + rhs); lhs.y = std::floor(lhs.y + rhs); return lhs; } SDL_Point operator +(SDL_Point lhs, const double& rhs) { return lhs += rhs; } SDL_Point& operator -=(SDL_Point& lhs, const double& rhs) { lhs.x = std::floor(lhs.x - rhs); lhs.y = std::floor(lhs.y - rhs); return lhs; } SDL_Point operator -(SDL_Point lhs, const double& rhs) { return lhs -= rhs; } SDL_Point& operator *=(SDL_Point& lhs, const double& rhs) { lhs.x = std::floor(lhs.x * rhs); lhs.y = std::floor(lhs.y * rhs); return lhs; } SDL_Point operator *(SDL_Point lhs, const double& rhs) { return lhs *= rhs; } SDL_Point& operator /=(SDL_Point& lhs, const double& rhs) { lhs.x = std::floor(lhs.x / rhs); lhs.y = std::floor(lhs.y / rhs); return lhs; } SDL_Point operator /(SDL_Point lhs, const double& rhs) { return lhs /= rhs; } std::ostream& operator <<(std::ostream& os, const SDL_Point& rhs) { os << "(" << rhs.x << "," << rhs.y << ")"; return os; }
7b51f6265b2e70c4527206720755914256ffe2d5
2cf838b54b556987cfc49f42935f8aa7563ea1f4
/aws-cpp-sdk-mediastore-data/include/aws/mediastore-data/MediaStoreDataClient.h
cfdc98f52ffb3af8d4009b9ddde66e46d344c74f
[ "MIT", "Apache-2.0", "JSON" ]
permissive
QPC-database/aws-sdk-cpp
d11e9f0ff6958c64e793c87a49f1e034813dac32
9f83105f7e07fe04380232981ab073c247d6fc85
refs/heads/main
2023-06-14T17:41:04.817304
2021-07-09T20:28:20
2021-07-09T20:28:20
384,714,703
1
0
Apache-2.0
2021-07-10T14:16:41
2021-07-10T14:16:41
null
UTF-8
C++
false
false
14,796
h
MediaStoreDataClient.h
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/mediastore-data/MediaStoreData_EXPORTS.h> #include <aws/mediastore-data/MediaStoreDataErrors.h> #include <aws/core/client/AWSError.h> #include <aws/core/client/ClientConfiguration.h> #include <aws/core/client/AWSClient.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/mediastore-data/model/DeleteObjectResult.h> #include <aws/mediastore-data/model/DescribeObjectResult.h> #include <aws/mediastore-data/model/GetObjectResult.h> #include <aws/mediastore-data/model/ListItemsResult.h> #include <aws/mediastore-data/model/PutObjectResult.h> #include <aws/core/client/AsyncCallerContext.h> #include <aws/core/http/HttpTypes.h> #include <future> #include <functional> namespace Aws { namespace Http { class HttpClient; class HttpClientFactory; } // namespace Http namespace Utils { template< typename R, typename E> class Outcome; namespace Threading { class Executor; } // namespace Threading } // namespace Utils namespace Auth { class AWSCredentials; class AWSCredentialsProvider; } // namespace Auth namespace Client { class RetryStrategy; } // namespace Client namespace MediaStoreData { namespace Model { class DeleteObjectRequest; class DescribeObjectRequest; class GetObjectRequest; class ListItemsRequest; class PutObjectRequest; typedef Aws::Utils::Outcome<DeleteObjectResult, MediaStoreDataError> DeleteObjectOutcome; typedef Aws::Utils::Outcome<DescribeObjectResult, MediaStoreDataError> DescribeObjectOutcome; typedef Aws::Utils::Outcome<GetObjectResult, MediaStoreDataError> GetObjectOutcome; typedef Aws::Utils::Outcome<ListItemsResult, MediaStoreDataError> ListItemsOutcome; typedef Aws::Utils::Outcome<PutObjectResult, MediaStoreDataError> PutObjectOutcome; typedef std::future<DeleteObjectOutcome> DeleteObjectOutcomeCallable; typedef std::future<DescribeObjectOutcome> DescribeObjectOutcomeCallable; typedef std::future<GetObjectOutcome> GetObjectOutcomeCallable; typedef std::future<ListItemsOutcome> ListItemsOutcomeCallable; typedef std::future<PutObjectOutcome> PutObjectOutcomeCallable; } // namespace Model class MediaStoreDataClient; typedef std::function<void(const MediaStoreDataClient*, const Model::DeleteObjectRequest&, const Model::DeleteObjectOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DeleteObjectResponseReceivedHandler; typedef std::function<void(const MediaStoreDataClient*, const Model::DescribeObjectRequest&, const Model::DescribeObjectOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > DescribeObjectResponseReceivedHandler; typedef std::function<void(const MediaStoreDataClient*, const Model::GetObjectRequest&, Model::GetObjectOutcome, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > GetObjectResponseReceivedHandler; typedef std::function<void(const MediaStoreDataClient*, const Model::ListItemsRequest&, const Model::ListItemsOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > ListItemsResponseReceivedHandler; typedef std::function<void(const MediaStoreDataClient*, const Model::PutObjectRequest&, const Model::PutObjectOutcome&, const std::shared_ptr<const Aws::Client::AsyncCallerContext>&) > PutObjectResponseReceivedHandler; /** * <p>An AWS Elemental MediaStore asset is an object, similar to an object in the * Amazon S3 service. Objects are the fundamental entities that are stored in AWS * Elemental MediaStore.</p> */ class AWS_MEDIASTOREDATA_API MediaStoreDataClient : public Aws::Client::AWSJsonClient { public: typedef Aws::Client::AWSJsonClient BASECLASS; /** * Initializes client to use DefaultCredentialProviderChain, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ MediaStoreDataClient(const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); /** * Initializes client to use SimpleAWSCredentialsProvider, with default http client factory, and optional client config. If client config * is not specified, it will be initialized to default values. */ MediaStoreDataClient(const Aws::Auth::AWSCredentials& credentials, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); /** * Initializes client to use specified credentials provider with specified client config. If http client factory is not supplied, * the default http client factory will be used */ MediaStoreDataClient(const std::shared_ptr<Aws::Auth::AWSCredentialsProvider>& credentialsProvider, const Aws::Client::ClientConfiguration& clientConfiguration = Aws::Client::ClientConfiguration()); virtual ~MediaStoreDataClient(); /** * <p>Deletes an object at the specified path.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DeleteObject">AWS * API Reference</a></p> */ virtual Model::DeleteObjectOutcome DeleteObject(const Model::DeleteObjectRequest& request) const; /** * <p>Deletes an object at the specified path.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DeleteObject">AWS * API Reference</a></p> * * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::DeleteObjectOutcomeCallable DeleteObjectCallable(const Model::DeleteObjectRequest& request) const; /** * <p>Deletes an object at the specified path.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DeleteObject">AWS * API Reference</a></p> * * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void DeleteObjectAsync(const Model::DeleteObjectRequest& request, const DeleteObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const; /** * <p>Gets the headers for an object at the specified path.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">AWS * API Reference</a></p> */ virtual Model::DescribeObjectOutcome DescribeObject(const Model::DescribeObjectRequest& request) const; /** * <p>Gets the headers for an object at the specified path.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">AWS * API Reference</a></p> * * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::DescribeObjectOutcomeCallable DescribeObjectCallable(const Model::DescribeObjectRequest& request) const; /** * <p>Gets the headers for an object at the specified path.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/DescribeObject">AWS * API Reference</a></p> * * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void DescribeObjectAsync(const Model::DescribeObjectRequest& request, const DescribeObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const; /** * <p>Downloads the object at the specified path. If the object’s upload * availability is set to <code>streaming</code>, AWS Elemental MediaStore * downloads the object even if it’s still uploading the object.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/GetObject">AWS * API Reference</a></p> */ virtual Model::GetObjectOutcome GetObject(const Model::GetObjectRequest& request) const; /** * <p>Downloads the object at the specified path. If the object’s upload * availability is set to <code>streaming</code>, AWS Elemental MediaStore * downloads the object even if it’s still uploading the object.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/GetObject">AWS * API Reference</a></p> * * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::GetObjectOutcomeCallable GetObjectCallable(const Model::GetObjectRequest& request) const; /** * <p>Downloads the object at the specified path. If the object’s upload * availability is set to <code>streaming</code>, AWS Elemental MediaStore * downloads the object even if it’s still uploading the object.</p><p><h3>See * Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/GetObject">AWS * API Reference</a></p> * * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void GetObjectAsync(const Model::GetObjectRequest& request, const GetObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const; /** * <p>Provides a list of metadata entries about folders and objects in the * specified folder.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/ListItems">AWS * API Reference</a></p> */ virtual Model::ListItemsOutcome ListItems(const Model::ListItemsRequest& request) const; /** * <p>Provides a list of metadata entries about folders and objects in the * specified folder.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/ListItems">AWS * API Reference</a></p> * * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::ListItemsOutcomeCallable ListItemsCallable(const Model::ListItemsRequest& request) const; /** * <p>Provides a list of metadata entries about folders and objects in the * specified folder.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/ListItems">AWS * API Reference</a></p> * * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void ListItemsAsync(const Model::ListItemsRequest& request, const ListItemsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const; /** * <p>Uploads an object to the specified path. Object sizes are limited to 25 MB * for standard upload availability and 10 MB for streaming upload * availability.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/PutObject">AWS * API Reference</a></p> */ virtual Model::PutObjectOutcome PutObject(const Model::PutObjectRequest& request) const; /** * <p>Uploads an object to the specified path. Object sizes are limited to 25 MB * for standard upload availability and 10 MB for streaming upload * availability.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/PutObject">AWS * API Reference</a></p> * * returns a future to the operation so that it can be executed in parallel to other requests. */ virtual Model::PutObjectOutcomeCallable PutObjectCallable(const Model::PutObjectRequest& request) const; /** * <p>Uploads an object to the specified path. Object sizes are limited to 25 MB * for standard upload availability and 10 MB for streaming upload * availability.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/mediastore-data-2017-09-01/PutObject">AWS * API Reference</a></p> * * Queues the request into a thread executor and triggers associated callback when operation has finished. */ virtual void PutObjectAsync(const Model::PutObjectRequest& request, const PutObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context = nullptr) const; void OverrideEndpoint(const Aws::String& endpoint); private: void init(const Aws::Client::ClientConfiguration& clientConfiguration); void DeleteObjectAsyncHelper(const Model::DeleteObjectRequest& request, const DeleteObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const; void DescribeObjectAsyncHelper(const Model::DescribeObjectRequest& request, const DescribeObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const; void GetObjectAsyncHelper(const Model::GetObjectRequest& request, const GetObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const; void ListItemsAsyncHelper(const Model::ListItemsRequest& request, const ListItemsResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const; void PutObjectAsyncHelper(const Model::PutObjectRequest& request, const PutObjectResponseReceivedHandler& handler, const std::shared_ptr<const Aws::Client::AsyncCallerContext>& context) const; Aws::String m_uri; Aws::String m_configScheme; std::shared_ptr<Aws::Utils::Threading::Executor> m_executor; }; } // namespace MediaStoreData } // namespace Aws
886b262ed0aa4bd8370534d6a06c0f0e3d08afad
e07e3f41c9774c9684c4700a9772712bf6ac3533
/app/Temp/StagingArea/Data/il2cppOutput/AssemblyU2DCSharp_GSNPicker2311934918.h
caa6d35c50e1190489e6eaad196873d79c08e65f
[]
no_license
gdesmarais-gsn/inprocess-mobile-skill-client
0171a0d4aaed13dbbc9cca248aec646ec5020025
2499d8ab5149a306001995064852353c33208fc3
refs/heads/master
2020-12-03T09:22:52.530033
2017-06-27T22:08:38
2017-06-27T22:08:38
95,603,544
0
0
null
null
null
null
UTF-8
C++
false
false
1,731
h
AssemblyU2DCSharp_GSNPicker2311934918.h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.String struct String_t; // TMPro.TMP_InputField/SelectionEvent struct SelectionEvent_t3883897865; #include "UnityEngine_UnityEngine_MonoBehaviour1158329972.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // GSNPicker struct GSNPicker_t2311934918 : public MonoBehaviour_t1158329972 { public: // System.String GSNPicker::_parentName String_t* ____parentName_3; // TMPro.TMP_InputField/SelectionEvent GSNPicker::m_OnDeselect SelectionEvent_t3883897865 * ___m_OnDeselect_4; public: inline static int32_t get_offset_of__parentName_3() { return static_cast<int32_t>(offsetof(GSNPicker_t2311934918, ____parentName_3)); } inline String_t* get__parentName_3() const { return ____parentName_3; } inline String_t** get_address_of__parentName_3() { return &____parentName_3; } inline void set__parentName_3(String_t* value) { ____parentName_3 = value; Il2CppCodeGenWriteBarrier(&____parentName_3, value); } inline static int32_t get_offset_of_m_OnDeselect_4() { return static_cast<int32_t>(offsetof(GSNPicker_t2311934918, ___m_OnDeselect_4)); } inline SelectionEvent_t3883897865 * get_m_OnDeselect_4() const { return ___m_OnDeselect_4; } inline SelectionEvent_t3883897865 ** get_address_of_m_OnDeselect_4() { return &___m_OnDeselect_4; } inline void set_m_OnDeselect_4(SelectionEvent_t3883897865 * value) { ___m_OnDeselect_4 = value; Il2CppCodeGenWriteBarrier(&___m_OnDeselect_4, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
bb2c2db1b3f05b6ec18d6de7bee4b7acc3a33cd1
590334eabc56115c000ac598160e170aa77c7c55
/lista revisao/capicua.cpp
57b5f2c74092a1880d0365e6b6601621bee38c57
[]
no_license
arthur-es/aed1
f72deabdee4b58c6cae1673f29714b9fc352f9e0
86df5401a3b53e292355d4b4fcb191566a5a48d0
refs/heads/master
2020-07-17T17:00:57.720424
2019-09-03T14:32:20
2019-09-03T14:32:20
206,059,438
0
0
null
null
null
null
UTF-8
C++
false
false
1,073
cpp
capicua.cpp
#include<iostream> #include <vector> using namespace std; int capicua(int numero); int fazedorDeNumeroQuebrado(int centena, int dezena, int unidade); int main() { int quantidade; int leituras[1000]; cin >> quantidade; for(int i = 0; i < quantidade; i++) { cin >> leituras[i]; } for(int i = 0; i < quantidade; i++){ capicua(leituras[i]); if(quantidade - i > 1){ cout << " "; } else { cout << endl; } } return 0; } int fazedorDeNumeroQuebrado(int milhar, int centena, int dezena, int unidade){ return milhar*1000 + centena*100 + dezena*10 + unidade; } int capicua(int numero) { int unidade, dezena, centena, milhar; milhar = numero / 1000; centena = (numero % 1000) / 100; dezena = ((numero % 1000) % 100) / 10; unidade = ((numero % 1000) % 100) % 10; int resultado = fazedorDeNumeroQuebrado(unidade, dezena, centena, milhar); if(resultado == numero) { cout << "yes"; } else { cout << "no"; } return 0; }
6f5d6b080c7c27a90d767cda6f68f074ae4548a8
0eff74b05b60098333ad66cf801bdd93becc9ea4
/second/download/curl/gumtree/curl_repos_function_567_curl-7.14.0.cpp
f692110e6231b89b7fffef8743516761f903b32d
[]
no_license
niuxu18/logTracker-old
97543445ea7e414ed40bdc681239365d33418975
f2b060f13a0295387fe02187543db124916eb446
refs/heads/master
2021-09-13T21:39:37.686481
2017-12-11T03:36:34
2017-12-11T03:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
444
cpp
curl_repos_function_567_curl-7.14.0.cpp
static CURLcode ftp_cwd_and_mkd(struct connectdata *conn, char *path) { CURLcode result; result = ftp_cwd(conn, path); if (result) { if(conn->data->set.ftp_create_missing_dirs) { result = ftp_mkd(conn, path); if (result) /* ftp_mkd() calls failf() itself */ return result; result = ftp_cwd(conn, path); } if(result) failf(conn->data, "Couldn't CWD to %s", path); } return result; }
d87e76266d26c6c5941018784eb755e16488619e
4d7d584641666310db1cbf4c71e20e89b81be42f
/source/client_Conector.h
9d0fd4ae7354fde1420c81e6cadad87845ab8181
[]
no_license
lautaroerinaldi/alerta_desbordamiento_rios_c_plus_plus
3e8a64280bf07146589e88a6e7f91ea113bdb059
7374438bd0ec92c99d8cf9353ff024c51474dc8e
refs/heads/master
2020-04-02T15:44:27.582495
2018-11-03T11:14:00
2018-11-03T11:14:00
154,581,617
0
0
null
null
null
null
UTF-8
C++
false
false
2,527
h
client_Conector.h
/* * Conector.h */ #ifndef CLIENT_CONECTOR_H_ #define CLIENT_CONECTOR_H_ #include <string> #include <map> #include "common_SocketComunicador.h" #define OK 0 #define ERROR 1 /* * Permite crear un objeto que dadas las muestras que va recibiendo, calcula y * envia las modas al servidor mediantes una conexion utilizando un socket. */ class Conector { std::string nombre_seccion; unsigned int cant_muestras_para_moda; std::map<int, int> niveles; std::map<int, int> caudales; unsigned int cant_muestras_leidas; SocketComunicador socket; /* * Dado un mapa que tiene la cantidad EXACTA de muestras necesaria para * calcular la moda, lo recorre y devuelve el valor que tiene frecuencia * máxima; en caso de empate en frecuencia, retorna la de mayor módulo. */ int getModa(std::map<int, int> & mapa); /* * Envía al server datos procesados (las muestras MODA DE NIVEL y CAUDAL). * Estas muestras MODA son las que se reciben por parametro * Vendría a ser el mensaje "actualizar nivel <xxxx> caudal <yyyy>\n" */ int actualizar(int nivel, int caudal); /* * Envía al server el mensaje inicial informando el nombre de seccion; * Vendría a ser el encabezado "conector seccion <xxxx>\n" */ int informarSeccion(); /* * Envía al server el mensaje final antes de que se cierre la conexion; * Vendría a ser el mensaje de despedida "fin\n" */ int finalizar(); public: /* * Inicializa la clase y abre un socket de comunicacion en la IP y puerto * pasados por parametro. Luego envia el nombre de seccion al servidor. */ Conector(const std::string & ip, const std::string & puerto, const std::string & nombre_seccion, unsigned int cant_muestras_para_moda); /* Dados un valor de nivel y caudal, las almacena en el mapa y actualiza * su frecuencia de aparición. En caso de que se hayan alcanzado el numero * de muestras EXACTAS para calcular la moda, las obtiene, las envia al * server y reinicia el mapa y las cuentas de frecuencias de niveles y * caudales. * Supone que la conexion con el servidor es valida (puede consultarse * desde fuera con el metodo conexionExitosa(). */ void procesarMuestra(int nivel_leido, int caudal_leido); /* * Retorna true si la conexion con el server fue exitosa y false en otro * caso */ bool conexionExitosa(); /* * Envia el mensaje de finalizar transmision al servidor, cierra el socket * de conexion y libera los recursos utilizados por el conector. */ ~Conector(); }; #endif /* CLIENT_CONECTOR_H_ */
c38edb6bc7a93f74d19531ce43ff00470473f768
43f2f0af217dcb13f9df6c864eb0624943f96c0a
/Temperatur_messen.ino
e3fa4c39701af7d1577451a6d68290a03d8a9f33
[]
no_license
vinceyyyy/Arduino-Code
12d2136a13bb8e3b2fd866b1d602e8728d80689f
877a68c8f4dd960018ac38c1003fd2bf3c6dd638
refs/heads/main
2023-04-24T09:17:41.679836
2021-05-17T19:58:40
2021-05-17T19:58:40
368,283,277
0
0
null
null
null
null
UTF-8
C++
false
false
2,070
ino
Temperatur_messen.ino
//Einrichtung des Servos und DHT-Sensors #include <Servo.h> Servo myservo; #include "DHT.h" #include "Adafruit_Sensor.h" #define DHTPIN 2 #define DHTTYPE DHT22 DHT dht(DHTPIN, DHTTYPE); //Variable für map-Befehl unten float servostellung; //Variablen für RGB LED int red_light_pin = 11; int green_light_pin = 10; int blue_light_pin = 9; void setup() { //Servo Einstellung myservo.attach(3); //Serieller Monitor Serial.begin(9600); dht.begin(); //Einstellung der RGB LED pinMode(red_light_pin, OUTPUT); pinMode(green_light_pin, OUTPUT); pinMode(blue_light_pin, OUTPUT); } void loop() { //Variablen für Luftfeuchtigkeit/Temperatur float Luftfeuchtigkeit = dht.readHumidity(); float Temperatur = dht.readTemperature(); //Werte der Luftfeuchtigkeit (0 bis 100%) werden für Servostellung gemappt (0 bis 180°) servostellung = map(Luftfeuchtigkeit, 0, 100, 0, 180); //Proportional zum Wert der Luftfeuchtigkeit dreht sich der Servo bis zu 180 Grad //und gibt die Werte im seriellen Monitor an. if( Luftfeuchtigkeit >= 0 ){ delay(1000); myservo.write(0); myservo.write(servostellung); Serial.print("Luftfeuchtigkeit -> " ); Serial.print(Luftfeuchtigkeit); Serial.println("%"); } //Temperatur wird im seriellen Monitor angezeigt Serial.print("Temperatur -> " ); Serial.print(Temperatur); Serial.println("°C"); delay(500); //Ist die Temperatur bei 24° (oder drunter), leuchtet LED grün //Ist die Temperatur bei 25° (oder darüber), leuchtet LED rot //Ist die Temperatur dazwischen, leuchtet LED gelb float min = 24.0; float max = 25.0; if (Temperatur <= min) { RGB_color(0, 255, 0); } else if (Temperatur >= max) { RGB_color(255, 0, 0); } else { RGB_color(255, 255, 0); } } //Deklarieren von "RGB_color" void RGB_color(int red_light_value, int green_light_value, int blue_light_value) { analogWrite(red_light_pin, red_light_value); analogWrite(green_light_pin, green_light_value); analogWrite(blue_light_pin, blue_light_value); }
902c4e7531371c000f5db3f378f0ea4e99fb492a
d66f1dbacab9ee1617b5ce9c7ae2357e1c2b4169
/prog2-template/parallel_sort.cpp
58fd88ba00737daadba58bb60138dd922301c3d6
[]
no_license
Yuzhuoran/MPI
910493ffb80b5a5277fabb579bd9a289e5425b01
ed9c8de79384cd719268433aa9739d3d269a907d
refs/heads/master
2021-04-30T13:29:27.110355
2018-09-15T16:08:19
2018-09-15T16:08:19
121,295,888
0
0
null
null
null
null
UTF-8
C++
false
false
593
cpp
parallel_sort.cpp
/** * @file parallel_sort.cpp * @author Patrick Flick <patrick.flick@gmail.com> * @brief Implements the parallel, distributed sorting function. * * Copyright (c) 2014 Georgia Institute of Technology. All Rights Reserved. */ #include "parallel_sort.h" // implementation of your parallel sorting void parallel_sort(int * begin, int* end, MPI_Comm comm) { } /********************************************************************* * Implement your own helper functions here: * *********************************************************************/ // ...
1ac917a85e864e4ea0295521e2156fd7eb1ddb03
bd06b96be087a3a053bd0f7deba4d90a6f9adb74
/Assignment - Backtracking , Binary Search And Merge Sort Problems/Sudoku_Solver.cpp
7cd62c859065ffdc5d31cfd3c139458de04a616d
[]
no_license
Sahu-Ayush/Coding-Ninjas-Competitive-Programming
49722a596b3ce822d8669386bc569a58b93a8c66
c06a37a4fc23320f4a5943a400e57fafb2e48d47
refs/heads/master
2022-04-18T19:33:23.192924
2020-04-14T09:36:04
2020-04-14T09:36:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,599
cpp
Sudoku_Solver.cpp
#include<iostream> using namespace std; int n=9; bool find_empty_location(int **arr, int& row, int &col) { for(int i=0; i<n; i++) { for(int j=0; j<n; j++) { if(arr[i][j]==0) { row = i; col = j; return true; } } } return false; } bool vertical(int **arr, int row, int col, int value) { for(int i=0; i<n; i++) { if(arr[i][col]==value) { return false; } } return true; } bool horizontal(int **arr, int row, int col, int value) { for (int i = 0; i < n; i++) { if (arr[row][i] == value) { return false; } } return true; } bool box(int **arr, int row, int col, int value) { int row_factor = row - (row % 3); int col_factor = col - (col % 3); for(int i=0; i<3; i++) { for(int j=0; j<3; j++) { if(arr[i+row_factor][j+col_factor]==value) { return false; } } } return true; } bool checker(int **arr, int value, int row, int col) { if(vertical(arr, row, col, value)&&horizontal(arr, row, col, value)&&box(arr, row, col, value)) { return true; } return false; } bool solveSudoku(int **arr) { int row=0, col=0; if(!find_empty_location(arr, row, col)) { return true; } for(int i=1; i<=n; i++) { if(checker(arr, i, row, col)) { arr[row][col] = i; if(solveSudoku(arr)) { return true; } else { arr[row][col] = 0; } } } return false; } bool sudokuSolver(int board[][9]) { int **arr=new int *[n]; for(int i=0; i<n; i++) { arr[i]=new int [n]; for(int j=0; j<n; j++) { arr[i][j]=board[i][j]; } } return solveSudoku(arr); }
8e23b0ab77b11d99bde957c67d27ffed3d856064
7a0cf4e53c690f092c94f4c711919d70f0c03630
/src/wmecore/TextureElement2D.h
a192d2f6ce548dc074e3cf8977fdf5d7860f03f0
[ "MIT" ]
permissive
retrodump/wme
d4d6718eabd285bc59473c0911055d83e8a9052d
54cf8905091736aef0a35fe6d3e05b818441f3c8
refs/heads/master
2021-09-21T02:19:06.317073
2012-07-08T16:09:56
2012-07-08T16:09:56
null
0
0
null
null
null
null
UTF-8
C++
false
false
805
h
TextureElement2D.h
// This file is part of Wintermute Engine // For conditions of distribution and use, see copyright notice in license.txt #ifndef __WmeTextureElement2D_H__ #define __WmeTextureElement2D_H__ #include "Element2D.h" namespace Wme { class SpriteSubFrame; class WmeDllExport TextureElement2D : public Element2D { public: TextureElement2D(); virtual ~TextureElement2D(); void AddGeometry(); bool IsTransparentAt(float x, float y); void SetSubFrame(SpriteSubFrame* subFrame); SpriteSubFrame* GetSubFrame() const { return m_SubFrame; } void SetColor(const Ogre::ColourValue& color); Ogre::ColourValue GetColor() const { return m_Color; } private: SpriteSubFrame* m_SubFrame; Ogre::ColourValue m_Color; }; } #endif // __WmeTextureElement2D_H__
1f4d1df33fe95b4e1d6a0a6aec53e42d73234535
90222726ecafa3fe3897fae20740c69d82bbe812
/assignment/average.cpp
0ee08ccfe2a4843d219a4891673c2dbbc54718fb
[]
no_license
VenkateshBhatOP/PGJQP_Venkatesh-bhat
0c17b3bc8b7bd6b349c7bc35dd718af16e408ab5
aef231d06b35c5ccd7016646819f1d7ee18337a9
refs/heads/main
2023-03-31T19:10:19.738974
2021-04-02T10:56:11
2021-04-02T10:56:11
311,357,962
0
0
null
null
null
null
UTF-8
C++
false
false
640
cpp
average.cpp
#include<iostream> using namespace std; class Average { int num1,num2,num3,num4,num5,Average; public :void avg() { cout<<"Enter the first number: \n"; cin>>num1; cout<<"Enter the second number: \n"; cin>>num2; cout<<"Enter the third number: \n"; cin>>num3; cout<<"Enter the fourth number: \n"; cin>>num4; cout<<"Enter the fifth number:\n"; cin>>num5; Average=(num1+num2+num3+num4+num5)/5; cout<<"The average of the above five numbers is: "<<Average; } }; int main() { Average obj; obj.avg(); }
e921981f2f9775e408f6644b69d7865ac9855eca
816d6fbc1379c91c72720cdda6e38ed0d52c2ad4
/palindromePatition.cpp
01dae5be2a6a36dcf638adad49145aceb5d70355
[]
no_license
kanwangkerry/Leetcode
61f22558f0c76903b490b26aee4d89814df2552a
739532df41d1613b229ddfb6fe1af1bdb6dec6ef
refs/heads/master
2021-01-19T11:15:54.816703
2013-11-07T04:22:18
2013-11-07T04:22:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,491
cpp
palindromePatition.cpp
class Solution { public: vector<vector<string>> partition(string s) { // Note: The Solution object is instantiated only once and is reused by each test case. int len = s.size(); bool **isPa = new bool*[len]; for(int i = 0 ; i < len ; i++){ isPa[i] = new bool[len]; } for(int i = 0 ; i < len -1; i++){ isPa[i][i] = true; isPa[i][i+1] = (s[i] == s[i+1]); } isPa[len-1][len-1] = true; for(int l = 2; l < len ; l ++){ for(int i = 0 ; i < len - l ; i ++){ isPa[i][i+l] = isPa[i+1][i+l-1] && (s[i] == s[i+l]); } } return partitionHelper(s, isPa); } vector<vector<string>> partitionHelper(string s, bool **isPa){ vector<vector<string>> result, temp; if(s.size() == 0){ vector<string> v; result.push_back(v); return result; } if(s.size() == 1){ vector<string> v; v.push_back(s); result.push_back(v); return result; } for(int i = s.size()-1 ; i >= 0 ; i--){ if(isPa[i][s.size()-1]){ temp = partitionHelper(s.substr(0, i), isPa); for(vector<string> v:temp){ v.push_back(s.substr(i, s.size()-i)); result.push_back(v); } } } return result; } };
a1814c50c9c89b52953a5111082d809107453834
9f7e92f2f4e99755694fba5ca055bdecaa417488
/allocator/chunk.h
5e741debe0a95e9353ed42d5f060793268155fb8
[ "MIT" ]
permissive
volatilflerovium/MultiIndex
46e62bb86e4556927c9f064581914514dd02bd48
1e49ae2e5bdfe2414160cfd67942fb01ac51599f
refs/heads/master
2021-08-20T07:58:15.348625
2020-07-17T10:21:45
2020-07-17T10:21:45
213,941,726
0
0
null
null
null
null
UTF-8
C++
false
false
1,510
h
chunk.h
/********************************************************************* * Allocator::Chunk structure * * * * Version: 1.0 * * Date: 16-07-202 * * Author: Dan Machado * * **********************************************************************/ #ifndef CHUNK_H #define CHUNK_H #include <cstdlib> namespace Allocator{ struct Chunk{ unsigned char* p_data; unsigned char first_available_block; unsigned char available_blocks; void init(std::size_t block_size, unsigned char blocks); void release(); void* allocate(std::size_t block_size); void deallocate(unsigned char* to_release, std::size_t block_size); bool in_chunk(unsigned char* p, unsigned int r); int get_position(unsigned char* p); }; /* Chunk does not define constructors, destructors, or assignment operator. Defining proper copy semantics at this level hurts efficiency at upper levels, where we store Chunk objects in a list. */ //====================================================================== inline bool Chunk::in_chunk(unsigned char* p, unsigned int r){ if(p_data<=p && p<=p_data+r){ return true; } return false; } //====================================================================== // --- end namespace } #endif
1d68f22e73e6b840f4602fc56a7befada97a71b5
e5a761290c75ae48cf47442f3b87db190cd01f8f
/raytracer/raytracer/math/functions/easing-function.h
51b1668a1107249378a6c9076df0f9d8303d711d
[]
no_license
thomasvangoidsenhoven/Raytracer-3D-Cplus
d5dd0950cec6cc9ffabf527732f506af2973704d
c7741ae3d02cd1cc5d35e97613252d580724d25a
refs/heads/master
2020-04-29T19:47:10.530740
2019-01-09T10:09:59
2019-01-09T10:09:59
176,365,933
2
1
null
null
null
null
UTF-8
C++
false
false
294
h
easing-function.h
#pragma once #include "math/function.h" namespace math { namespace functions { /// <summary> /// Define EasingFunction as a synonym for math::Function&lt;double(double)&gt;. /// </summary> typedef math::Function<double(double)> EasingFunction; } }
d6a1dae8737fe0e3c2b1328f8c421d878923867b
8526eb7f36529f51b22ce40ea25f2b6b306778eb
/158A next round.cpp
19b8dc915436f929824ad620904c3e799eb5d17d
[]
no_license
Caprinos52B/Codeforces
1710708c661a8643a75993f1efd92eae392871db
a56bc6d483651103133ce99b287923dcc0a0cf44
refs/heads/master
2020-06-26T16:29:01.347883
2019-07-30T16:08:06
2019-07-30T16:08:06
199,685,577
0
0
null
null
null
null
UTF-8
C++
false
false
198
cpp
158A next round.cpp
#include<iostream> using namespace std; int main(){ int i,n,k,a[50],s=0; cin>>n>>k; for(i=0;i<n;i++) cin>>a[i]; for(i=0;i<n;i++){ if(a[i]>=a[k-1]&&a[i]>0) s++; } cout<<s; return 0; }
7fbc1ffdefa44f3162ba664a554fc97aaf458409
fa3b89c5ead0d403f7db4be81f791a272f4fe62e
/alg/poj/archive/2000/5796896_AC_0MS_156K.cpp
8c83691a160a21f6f7f92dd4373dbdc85383c104
[]
no_license
ruleless/programming
aa32e916a5b3792ead2a6d48ab924d3554cd085f
c381d1ef7b1c7c0aff17603484e19a027593429b
refs/heads/master
2022-11-14T02:07:47.443657
2022-11-03T23:47:32
2022-11-03T23:47:32
86,163,253
4
0
null
null
null
null
UTF-8
C++
false
false
272
cpp
5796896_AC_0MS_156K.cpp
#include<iostream> using namespace std; int main() { int N,n,i,t; while(scanf("%d",&N)!=EOF&&N) { for(n=1;N-n*(n+1)/2>n+1;n++); t=0; for(i=1;i<=n;i++) t+=i*i; for(i=1;i<=N-n*(n+1)/2;i++) t+=(n+1); printf("%d %d\n",N,t); } return 0; }
cf5c8f2fb925e2ceea5690e444d8ef16377bbeaf
c90097519f71cfe7ab5bf34b7ec0861748c68730
/2017/F06.cpp
4c2c0a682acc7bf95c45eb6d394912eac4b5d188
[]
no_license
mattya-lab/PCKoshien
7d24add440c008f3535df845d5bd7887b5353085
96a2fe8d171363490664ded04e70cafe1c84f951
refs/heads/master
2021-03-23T19:08:08.007544
2020-09-05T11:22:18
2020-09-05T11:22:18
247,477,284
1
0
null
null
null
null
UTF-8
C++
false
false
553
cpp
F06.cpp
#include<bits/stdc++.h> using namespace std; #define rep(i, n) for(int i = 0; i < n; i++) int main(){ int w, h; string s[1000]; set<string> st; char c; cin >> w >> h; for(int i = 0; i < h; st.insert(s[i++])) rep(j, w) cin >> c, s[i] += c; sort(s, s+h); bool ans = 1; int cnt = 0; rep(i, w){ if(s[0][i] == '1') cnt++; if(s[h/2-1][i] == s[(h+1)/2][i]) ans = 0; } if((cnt != w/2 && cnt != (w+1)/2) || st.size() != 2) ans = 0; cout << (ans? "yes":"no") << endl; return 0; }
ad89168b83707ae6fd91bda1ac42fc41706cb0a0
aae79375bee5bbcaff765fc319a799f843b75bac
/tco_2018/Resistance.cpp
d4ecfcafbcc7c313de93ff83f7d2209c654537ad
[]
no_license
firewood/topcoder
b50b6a709ea0f5d521c2c8870012940f7adc6b19
4ad02fc500bd63bc4b29750f97d4642eeab36079
refs/heads/master
2023-08-17T18:50:01.575463
2023-08-11T10:28:59
2023-08-11T10:28:59
1,628,606
21
6
null
null
null
null
UTF-8
C++
false
false
5,095
cpp
Resistance.cpp
// BEGIN CUT HERE /* TCO18 R1A Medium (500) 問題 -P人のプレーヤーがいる -そのうちS人はスパイである -P人のうち何人かが参加してミッションを行う -スパイが参加するミッションは失敗する可能性がある -N個のミッションについて、各人が参加したかどうかと、成功したかどうかの記録が与えられる -ミッションの記録が正しい場合、各人がスパイである確率を求めよ */ // END CUT HERE #include <algorithm> #include <string> #include <vector> #include <iostream> #include <sstream> #include <cstring> using namespace std; static inline int popcount(unsigned int b) { #ifdef __GNUC__ return __builtin_popcount(b); #elif _MSC_VER >= 1400 return __popcnt(b); #else b = (b & 0x55555555) + (b >> 1 & 0x55555555); b = (b & 0x33333333) + (b >> 2 & 0x33333333); b = (b & 0x0F0F0F0F) + (b >> 4 & 0x0F0F0F0F); b += b >> 8; b += b >> 16; return b & 0x3F; #endif } class Resistance { public: vector <double> spyProbability(int P, int S, vector <string> missions) { int m = (int)missions.size(); int bm = 1 << P; int vc = 0; int scnt[10] = {}; for (int b = 0; b < bm; ++b) { if (popcount(b) == S) { bool valid = true; for (int i = 0; i < m; ++i) { if (missions[i][0] == 'F') { bool ok = false; for (int j = 0; j < P; ++j) { if (missions[i][j+1] == '1' && (((1 << j) & b) != 0)) { ok = true; break; } } if (!ok) { valid = false; break; } } } if (valid) { ++vc; for (int j = 0; j < P; ++j) { for (int i = 0; i < m; ++i) { if ((((1 << j) & b) != 0)) { scnt[j]++; break; } } } } } } vector <double> ans; if (vc) { for (int j = 0; j < P; ++j) { ans.push_back((1.0 * scnt[j]) / vc); } } return ans; } // BEGIN CUT HERE private: template <typename T> string print_array(const vector<T> &V) { ostringstream os; os << "{ "; for (typename vector<T>::const_iterator iter = V.begin(); iter != V.end(); ++iter) os << '\"' << *iter << "\","; os << " }"; return os.str(); } void verify_case(int Case, const vector <double> &Expected, const vector <double> &Received) { cerr << "Test Case #" << Case << "..."; if (Expected == Received) cerr << "PASSED" << endl; else { cerr << "FAILED" << endl; cerr << "\tExpected: " << print_array(Expected) << endl; cerr << "\tReceived: " << print_array(Received) << endl; } } public: void run_test(int Case) { int n = 0; // test_case_0 if ((Case == -1) || (Case == n)){ int Arg0 = 4; int Arg1 = 1; string Arr2[] = {"S0110", "F1100", "S0011"}; double Arr3[] = {0.5, 0.5, 0.0, 0.0 }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; // test_case_1 if ((Case == -1) || (Case == n)){ int Arg0 = 4; int Arg1 = 2; string Arr2[] = {"F0100", "S0101", "F1010", "S1011"}; double Arr3[] = {0.5, 1.0, 0.5, 0.0 }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; // test_case_2 if ((Case == -1) || (Case == n)){ int Arg0 = 3; int Arg1 = 1; string Arr2[] = {"F110", "F101", "F011"}; // double Arr3[] = { }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3; verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; // test_case_3 if ((Case == -1) || (Case == n)){ int Arg0 = 5; int Arg1 = 2; string Arr2[] = {"F11000", "S00011", "F10100", "S01111"}; double Arr3[] = {0.8, 0.4, 0.4, 0.2, 0.2 }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; // test_case_4 if ((Case == -1) || (Case == n)){ int Arg0 = 9; int Arg1 = 3; string Arr2[] = {"S100001100", "F011110000", "F001000010", "F100010101", "S010010001", "F100001010", "F000100100"}; double Arr3[] = {0.3, 0.1, 0.4, 0.5, 0.2, 0.1, 0.6, 0.7, 0.1 }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; if ((Case == -1) || (Case == n)) { int Arg0 = 5; int Arg1 = 2; string Arr2[] = { "S100001100" }; double Arr3[] = { 0.4, 0.4, 0.4, 0.4, 0.4 }; vector <string> Arg2(Arr2, Arr2 + (sizeof(Arr2) / sizeof(Arr2[0]))); vector <double> Arg3(Arr3, Arr3 + (sizeof(Arr3) / sizeof(Arr3[0]))); verify_case(n, Arg3, spyProbability(Arg0, Arg1, Arg2)); } n++; } // END CUT HERE }; // BEGIN CUT HERE int main() { Resistance ___test; ___test.run_test(-1); } // END CUT HERE
c31f75f93e74cb070e7f4e9db88190fbbe8e21f8
ff142cfb461d748846fab7a9779b6c2ab9fd29d0
/src/chrono_vehicle/powertrain/SimpleCVTPowertrain.cpp
17e0a4ff1605c85d7c4f6d10a03f0dc24d4d41c6
[ "BSD-3-Clause" ]
permissive
cecilysunday/chrono
f739749153d40973c262c5b060b1a7af7c5ce127
903463bd5b71aaba052d3981eb6ca8bf3c3eab4f
refs/heads/develop
2022-10-17T05:48:56.406791
2022-05-04T16:00:10
2022-05-04T16:00:10
154,656,858
3
0
BSD-3-Clause
2020-11-04T17:47:40
2018-10-25T11:07:38
C++
UTF-8
C++
false
false
2,155
cpp
SimpleCVTPowertrain.cpp
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2019 projectchrono.org // All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban, Rainer Gericke // ============================================================================= // // Simplified cvt powertrain model constructed with data from file (JSON format). // // ============================================================================= #include "chrono/core/ChGlobal.h" #include "chrono_vehicle/powertrain/SimpleCVTPowertrain.h" #include "chrono_vehicle/utils/ChUtilsJSON.h" using namespace rapidjson; namespace chrono { namespace vehicle { // ----------------------------------------------------------------------------- // ----------------------------------------------------------------------------- SimpleCVTPowertrain::SimpleCVTPowertrain(const std::string& filename) : ChSimpleCVTPowertrain("") { Document d; ReadFileJSON(filename, d); if (d.IsNull()) return; Create(d); GetLog() << "Loaded JSON: " << filename.c_str() << "\n"; } SimpleCVTPowertrain::SimpleCVTPowertrain(const rapidjson::Document& d) : ChSimpleCVTPowertrain("") { Create(d); } void SimpleCVTPowertrain::Create(const rapidjson::Document& d) { // Invoke base class method. ChPart::Create(d); // Read data m_fwd_gear_ratio = d["Forward Gear Ratio"].GetDouble(); m_rev_gear_ratio = d["Reverse Gear Ratio"].GetDouble(); m_max_torque = d["Maximum Engine Torque"].GetDouble(); m_max_power = d["Maximum Engine Power"].GetDouble(); m_max_speed = d["Maximum Engine Speed"].GetDouble(); } void SimpleCVTPowertrain::SetGearRatios(std::vector<double>& fwd, double& rev) { rev = m_rev_gear_ratio; fwd.push_back(m_fwd_gear_ratio); } } // end namespace vehicle } // end namespace chrono
980aa32b697b478ae3c80f5ac54e6c5c24a7053f
4fbb59d8073277598b92c96ea78ae0c3773e27c5
/src/shamelaimportinfo.cpp
db95d8dc860d621b1d07635d567b3fb30cecc28a
[]
no_license
boussouira/moltaqa
44e07205a2fb67a6a59d1623dc5cad741a6ad4c9
b3f50d20d0a9aa1b515ce0e50f7a75f8dfaeb972
refs/heads/master
2023-01-09T20:00:22.332723
2014-03-18T09:52:49
2014-03-18T09:52:49
177,351,483
1
0
null
null
null
null
UTF-8
C++
false
false
927
cpp
shamelaimportinfo.cpp
#include "shamelaimportinfo.h" #include "stringutils.h" ShamelaBookInfo::ShamelaBookInfo(int bid, QString bname, QString bbetaka, QString binfo, int barchive, int bcat, int bauth, QString bauthName, QString btafessirName) : id(bid), name(bname.trimmed()), info(Utils::Html::format(binfo)), betaka(bbetaka.replace(QRegExp("[\\r\\n]+"), "\n")), archive(barchive), cat(bcat), authorID(bauth), authName(bauthName.trimmed()), tafessirName(btafessirName) { } ShamelaBookInfo::~ShamelaBookInfo() { } void ShamelaBookInfo::genInfo() { mainTable = (archive) ? QString("b%1").arg(id) : "book"; tocTable = (archive) ? QString("t%1").arg(id) : "title"; } void ShamelaBookInfo::genInfo(ShamelaInfo *shaInfo) { genInfo(); path = shaInfo->buildFilePath(QString::number(id), archive); }
affd7eaf6e9da22ba8f5e93badab2a4f236bece3
cf523952f733aa524a663fb69db545fac3222550
/Process/OpenProcessDlg.h
13367a55c277cb04e5204ef1efe9451138cec397
[]
no_license
wangchlxt/FirstTest
7dcbeca7105d386bb6cfe6171f47511c21cd8c4a
dc9fd990118f17e5cdf6af80b27445e0324758d3
refs/heads/master
2021-01-23T19:34:23.751253
2018-03-05T11:54:39
2018-03-05T11:54:39
102,826,470
1
0
null
null
null
null
GB18030
C++
false
false
559
h
OpenProcessDlg.h
#pragma once #include "afxwin.h" // COpenProcessDlg 对话框 class COpenProcessDlg : public CDialogEx { DECLARE_DYNAMIC(COpenProcessDlg) public: COpenProcessDlg(CWnd* pParent = NULL); // 标准构造函数 virtual ~COpenProcessDlg(); // 对话框数据 #ifdef AFX_DESIGN_TIME enum { IDD = IDD_DIALOG_OPEN_PROCESS }; #endif protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 DECLARE_MESSAGE_MAP() public: CEdit m_cEditFile; afx_msg void OnBnClickedButtonOpen(); afx_msg void OnBnClickedButtonOpenProcess2(); };
ea21437ac33ac8788cd2d8729879b86dfd84d662
0b820c7c63a965d2ca5ec39341ee561fde75dec8
/IsometricRogueLike/WindowManager.h
b56cce7a183ef9fcb6008eef1b40500164c9da7d
[]
no_license
TheBearmachine/IsometricRogueLike
d8aeed791e9f88e64c2795e3352c15d82dc2e9f4
0bc7dd0dce38845c4f40da1c58156ea9f9564d5c
refs/heads/master
2022-12-22T18:55:15.246572
2020-09-26T22:32:13
2020-09-26T22:32:13
112,231,522
0
0
null
null
null
null
UTF-8
C++
false
false
642
h
WindowManager.h
#pragma once #include "Window.h" #include "DrawThis.h" #include "EventObserver.h" #include <vector> #include <stack> class WindowManager : public IWindowListener, public EventObserver { public: WindowManager(); ~WindowManager(); void addWindow(Window* window); void onWindowClose(Window* window); bool observe(const sf::Event& _event) override; void registerEvents(); void unregisterEvents(); void clearGarbage(); void arrangeWindows(Window* window); virtual void drawPrep(DrawingManager* drawingMan); static void setup(EventManager* eventManager); private: std::vector<Window*> mWindows; std::stack<Window*> mGarbage; };
609c332f3bdb299be84be2c1c3d4c69c67bc2b0f
2845bf27054eac02045051b0b33e2ee35a474527
/13-roman-to-integer.cpp
abd627c05748edb0eda8eb3391d15ff431d2652f
[]
no_license
lizishen/leetcode
69c62e6ee67f3e69469fb757e1a93c0152d8c971
00c7370707d4671ad8b6c2ded7b154f4dc9a6754
refs/heads/master
2020-12-25T22:28:49.432394
2015-10-13T02:53:19
2015-10-13T02:53:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
793
cpp
13-roman-to-integer.cpp
class Solution { public: int romanToInt(string s) { int ans = 0; string str = ""; for (int i = 0; i < s.size(); i++) { int v = find(str + s[i]); if (i + 1 < s.size()) { int p = find(str + s[i] + s[i + 1]); if (p != -1) { v = p; i++; } } ans += v; } return ans; } private : int find(string s) { string symbol[] = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"}; int value[] = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1}; for (int i = 0; i < 13; i++) if (symbol[i] == s) return value[i]; return -1; } };
77ca2b46056ca715487e309e2dc662581df24ff7
d74abbef9cac5dd4452a43b9f41b3e9ed13514bd
/CS 433 - Operating Systems/A3/SJF.h
e6381e70fc9241ff7fb185553fe2906e7f10336f
[]
no_license
alecguilin/CSUSM
b6efdab9049ef660bc77e2e4582fda093cc763c0
ad0c6fad5c444d40e9f5c5c396bd1bac08a5a62c
refs/heads/master
2023-07-24T19:41:10.967823
2021-09-04T19:16:12
2021-09-04T19:16:12
270,516,688
0
0
null
null
null
null
UTF-8
C++
false
false
1,014
h
SJF.h
#pragma once #include <queue> #include "event.h" #include "process.h" #include "simulation.h" // overrides priority queues comparison logic // comparsion based on next cpu burst struct SJFCompare { bool operator () (Process* p1, Process* p2) const { return p1->priority > p2->priority; } }; // implementation of SJF scheduler class SJF { public: std::priority_queue<Process*, std::vector<Process*>, SJFCompare> ready_queue; // ready queue for SJF scheduler Simulation * DES; // reference to DES void handle_event(Event &e); // handle for Event SJF(); // defualt constructor SJF(Simulation * s); // constructor with sim paramater private: void handle_process_arrival(Event &e); // handle for process arrival void handle_cpuburst_completion(Event &e); // handle for cpu_completion void handle_io_completion(Event &e); // handle for io_completion void handle_timer_expiration(Event &e); // handle for time_expiration void schedule(); // dispatch process };
a5013a4595e3ddcbcc0c428b5f2bf8881cbad710
5c7414c94acbecea6441bdf72fc58b8578e448e4
/assignments/05-classes/invoice_utility.cpp
dababf50d2f9a5779c9771e7763917162c324e0f
[]
no_license
acc-cosc-1337-fall-2018/acc-cosc-1337-fall-2018-ayla00
e241002d25d30a77dac2cef5c7055f007dce5cfb
6580d33ff41430ae3aede12e501c16491dc5164c
refs/heads/master
2021-08-19T01:05:59.719925
2018-12-12T02:40:26
2018-12-12T02:40:26
147,436,020
0
0
null
2018-11-19T17:47:24
2018-09-05T00:20:40
C++
UTF-8
C++
false
false
117
cpp
invoice_utility.cpp
#include "invoice_utility.h" double InvoiceUtility::get_total() const { return Invoice::get_total() + fixed_cost; }
888241233aad0632d1a29ab4d32b3790a3f02f27
a7764174fb0351ea666faa9f3b5dfe304390a011
/src/V3d/V3d_ColorScaleLayerItem.cxx
23f94669d34dbd3fae06b9f37585142e1c5d77e8
[]
no_license
uel-dataexchange/Opencascade_uel
f7123943e9d8124f4fa67579e3cd3f85cfe52d91
06ec93d238d3e3ea2881ff44ba8c21cf870435cd
refs/heads/master
2022-11-16T07:40:30.837854
2020-07-08T01:56:37
2020-07-08T01:56:37
276,290,778
0
0
null
null
null
null
UTF-8
C++
false
false
657
cxx
V3d_ColorScaleLayerItem.cxx
/*********************************************************************** ************************************************************************/ // for the class #include <V3d_ColorScaleLayerItem.ixx> // //-Constructors // V3d_ColorScaleLayerItem::V3d_ColorScaleLayerItem ( const Handle(V3d_ColorScale)& aColorScale ): Visual3d_LayerItem(), MyColorScale(aColorScale) { } void V3d_ColorScaleLayerItem::ComputeLayerPrs() { Visual3d_LayerItem::ComputeLayerPrs(); } void V3d_ColorScaleLayerItem::RedrawLayerPrs() { Visual3d_LayerItem::RedrawLayerPrs(); if ( !MyColorScale.IsNull() ) MyColorScale->DrawScale(); }
76ba1c2770b257ed82835d864e1cf07f046dad3a
a65c77b44164b2c69dfe4bfa2772d18ae8e0cce2
/tioj/1023.cpp
5a1c5ba25f82be308a8b29b8c90af550ecf99b1c
[]
no_license
dl8sd11/online-judge
553422b55080e49e6bd9b38834ccf1076fb95395
5ef8e3c5390e54381683f62f88d03629e1355d1d
refs/heads/master
2021-12-22T15:13:34.279988
2021-12-13T06:45:49
2021-12-13T06:45:49
111,268,306
1
6
null
null
null
null
UTF-8
C++
false
false
496
cpp
1023.cpp
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<n;i++) int m,r,b,tmp; int cntr[503],cntb[503]; int main () { ios::sync_with_stdio(0); cin.tie(0); while (cin>>m) { r=0;b=0; REP(i,m) { cin>>tmp; cntr[tmp]++; } REP(i,m) { cin>>tmp; cntb[tmp]++; } long long ret = 0; REP(i,m) { while(!cntr[r]) r++; while(!cntb[b]) b++; ret+=r*b; cntr[r]--;cntb[b]--; } cout<<ret<<endl; } }
cedd6ab8e895975cb5090d34767b8633ccafa086
48298469e7d828ab1aa54a419701c23afeeadce1
/Server/Skills/ImpactLogic/StdImpact009.cpp
18cc41dae5e325b9c0f548c5443c831b2969ec52
[]
no_license
brock7/TianLong
c39fccb3fd2aa0ad42c9c4183d67a843ab2ce9c2
8142f9ccb118e76a5cd0a8b168bcf25e58e0be8b
refs/heads/master
2021-01-10T14:19:19.850859
2016-02-20T13:58:55
2016-02-20T13:58:55
52,155,393
5
3
null
null
null
null
GB18030
C++
false
false
1,733
cpp
StdImpact009.cpp
#include "stdafx.h" /////////////////////////////////////////////////////////////////////////////// // 文件名:StdImpact009.cpp // 功能说明:效果--传送角色到指定位置 // // 修改记录: // // // /////////////////////////////////////////////////////////////////////////////// #include "StdImpact009.h" #include "Obj_Human.h" #include "Scene.h" namespace Combat_Module { using namespace Combat_Module::Skill_Module; namespace Impact_Module { BOOL StdImpact009_T::InitFromData(OWN_IMPACT& rImp, ImpactData_T const& rData) const { __ENTER_FUNCTION SetSceneID(rImp, Impact_GetImpactDataDescriptorValueByIndex(rImp.GetDataIndex(), ImpactDataDescriptorIndex_T::IDX_SCENE_ID)); SetPosition_X(rImp, Impact_GetImpactDataDescriptorValueByIndex(rImp.GetDataIndex(), ImpactDataDescriptorIndex_T::IDX_POSITION_X)+0.f); SetPosition_Z(rImp, Impact_GetImpactDataDescriptorValueByIndex(rImp.GetDataIndex(), ImpactDataDescriptorIndex_T::IDX_POSITION_Z)+0.f); return TRUE; __LEAVE_FUNCTION return FALSE; } VOID StdImpact009_T::OnActive(OWN_IMPACT& rImp, Obj_Character& rMe) const { __ENTER_FUNCTION Scene* pScene = rMe.getScene(); if(NULL==pScene) { return; } //Teleport here WORLD_POS pos; SceneID_t nScene = GetSceneID(rImp); pos.m_fX = GetPosition_X(rImp)/100.0f; pos.m_fZ = GetPosition_Z(rImp)/100.0f; if(INVALID_ID==nScene || pScene->SceneID() == nScene) { Obj& rObj = static_cast<Obj&>(rMe); rObj.Teleport(&pos); } else { if(Obj::OBJ_TYPE_HUMAN==rMe.GetObjType()) { Obj_Human& rHuman = static_cast<Obj_Human&>(rMe); rHuman.ChangeScene(pScene->SceneID(), nScene, pos, 9); } } __LEAVE_FUNCTION } }; };
66d05fb98899bdd7fabcc4b19dde9ddb0970e0dd
d62600407e56451c7c31606a0fd6e8a0c1d920de
/i_am_miss_nobody/991A.cpp
dbfca9e8c26d8ac480c6a5559f4c6a664748cca6
[]
no_license
nafisa11bd/My-Codeforces-AC-submissions
f25058e2391840f5d1b267264d15e3fc14e38b61
b456b9a526e076a54ed1fe38792481263cfffb62
refs/heads/main
2023-05-12T01:49:27.649597
2021-06-03T14:35:45
2021-06-03T14:35:45
303,282,892
0
0
null
null
null
null
UTF-8
C++
false
false
195
cpp
991A.cpp
#include<bits/stdc++.h> using namespace std; int main(){ int A,B,C,N,R; cin>>A>>B>>C>>N; if((A+B-C)>=N){ cout<<-1<<endl; } else if (C>A||C>B) cout<<-1; else cout<<N-(A+B-C); }
c79fa365b9e01eea8b8201dfd2e2239059aee001
ddad5e9ee062d18c33b9192e3db95b58a4a67f77
/util/fibers/event_count.h
a167651f1b25c15ac15b12a7adfa85b0800ce8a3
[ "BSD-2-Clause" ]
permissive
romange/gaia
c7115acf55e4b4939f8111f08e5331dff964fd02
8ef14627a4bf42eba83bb6df4d180beca305b307
refs/heads/master
2022-01-11T13:35:22.352252
2021-12-28T16:11:13
2021-12-28T16:11:13
114,404,005
84
17
BSD-2-Clause
2021-12-28T16:11:14
2017-12-15T19:20:34
C++
UTF-8
C++
false
false
6,195
h
event_count.h
// Copyright 2019, Beeri 15. All rights reserved. // Author: Roman Gershman (romange@gmail.com) // // Based on the design of folly event_count which in turn based on // Dmitry Vyukov's proposal at // https://software.intel.com/en-us/forums/intel-threading-building-blocks/topic/299245 #pragma once #include <boost/fiber/context.hpp> #include "base/macros.h" namespace util { namespace fibers_ext { // This class is all about reducing the contention on the producer side (notifications). // We want notifications to be as light as possible, while waits are less important // since they on the path of being suspended anyway. However, we also want to reduce number of // spurious waits on the consumer side. // This class has another wonderful property: notification thread does not need to lock mutex, // which means it can be used from the io_context (ring0) fiber. class EventCount { using spinlock_lock_t = ::boost::fibers::detail::spinlock_lock; using wait_queue_t = ::boost::fibers::context::wait_queue_t; //! Please note that we must use spinlock_lock_t because we suspend and unlock atomically // and fibers lib supports only this type for that. ::boost::fibers::detail::spinlock wait_queue_splk_{}; wait_queue_t wait_queue_{}; public: EventCount() noexcept : val_(0) {} class Key { friend class EventCount; EventCount* me_; uint32_t epoch_; explicit Key(EventCount* me, uint32_t e) noexcept : me_(me), epoch_(e) {} Key(const Key&) = delete; public: Key(Key&&) noexcept = default; ~Key() { // memory_order_relaxed would suffice for correctness, but the faster // #waiters gets to 0, the less likely it is that we'll do spurious wakeups // (and thus system calls). me_->val_.fetch_sub(kAddWaiter, std::memory_order_seq_cst); } uint32_t epoch() const { return epoch_; } }; // Return true if a notification was made, false if no notification was issued. bool notify() noexcept; bool notifyAll() noexcept; Key prepareWait() noexcept { uint64_t prev = val_.fetch_add(kAddWaiter, std::memory_order_acq_rel); return Key(this, prev >> kEpochShift); } void wait(uint32_t epoch) noexcept; /** * Wait for condition() to become true. Will clean up appropriately if * condition() throws. Returns true if had to preempt using wait_queue. */ template <typename Condition> bool await(Condition condition); private: friend class Key; static bool should_switch(::boost::fibers::context* ctx, std::intptr_t expected) { return ctx->twstatus.compare_exchange_strong(expected, static_cast<std::intptr_t>(-1), std::memory_order_acq_rel) || expected == 0; } EventCount(const EventCount&) = delete; EventCount(EventCount&&) = delete; EventCount& operator=(const EventCount&) = delete; EventCount& operator=(EventCount&&) = delete; // This requires 64-bit static_assert(sizeof(uint32_t) == 4, "bad platform"); static_assert(sizeof(uint64_t) == 8, "bad platform"); // val_ stores the epoch in the most significant 32 bits and the // waiter count in the least significant 32 bits. std::atomic<uint64_t> val_; static constexpr uint64_t kAddWaiter = uint64_t(1); static constexpr size_t kEpochShift = 32; static constexpr uint64_t kAddEpoch = uint64_t(1) << kEpochShift; static constexpr uint64_t kWaiterMask = kAddEpoch - 1; }; inline bool EventCount::notify() noexcept { uint64_t prev = val_.fetch_add(kAddEpoch, std::memory_order_release); if (UNLIKELY(prev & kWaiterMask)) { auto* active_ctx = ::boost::fibers::context::active(); /* lk makes sure that when a waiting thread is entered the critical section in EventCount::wait, it atomically checks val_ when entering the WAIT state. We need it in order to make sure that cnd_.notify() is not called before the waiting thread enters WAIT state and thus the notification is missed. */ spinlock_lock_t lk{wait_queue_splk_}; while (!wait_queue_.empty()) { auto* ctx = &wait_queue_.front(); wait_queue_.pop_front(); if (should_switch(ctx, reinterpret_cast<std::intptr_t>(this))) { // notify context lk.unlock(); active_ctx->schedule(ctx); break; } } return true; } return false; } inline bool EventCount::notifyAll() noexcept { uint64_t prev = val_.fetch_add(kAddEpoch, std::memory_order_release); if (UNLIKELY(prev & kWaiterMask)) { auto* active_ctx = ::boost::fibers::context::active(); spinlock_lock_t lk{wait_queue_splk_}; wait_queue_t tmp; tmp.swap(wait_queue_); lk.unlock(); while (!tmp.empty()) { ::boost::fibers::context* ctx = &tmp.front(); tmp.pop_front(); if (should_switch(ctx, reinterpret_cast<std::intptr_t>(this))) { // notify context active_ctx->schedule(ctx); } } } return false; }; // Atomically checks for epoch and waits on cond_var. inline void EventCount::wait(uint32_t epoch) noexcept { if ((val_.load(std::memory_order_acquire) >> kEpochShift) != epoch) return; auto* active_ctx = ::boost::fibers::context::active(); spinlock_lock_t lk{wait_queue_splk_}; if ((val_.load(std::memory_order_acquire) >> kEpochShift) == epoch) { // atomically call lt.unlock() and block on *this // store this fiber in waiting-queue active_ctx->wait_link(wait_queue_); active_ctx->twstatus.store(static_cast<std::intptr_t>(0), std::memory_order_release); // suspend this fiber active_ctx->suspend(lk); } } // Returns true if had to preempt, false if no preemption happenned. template <typename Condition> bool EventCount::await(Condition condition) { if (condition()) return false; // fast path // condition() is the only thing that may throw, everything else is // noexcept, Key destructor makes sure to cancelWait state when exiting the function. bool preempt = false; while (true) { Key key = prepareWait(); if (condition()) { break; } preempt = true; wait(key.epoch()); } return preempt; } } // namespace fibers_ext } // namespace util
c2cad03edf6451cdc6498a15e9c9af710988c16f
09458cae55d5285ca2b1331840220d4babfd0e63
/maze_game.cpp
48c67c0991e3cc74ef439c1aa91a10d806f67d23
[]
no_license
SDredz/C-Maze-Game-in-Windows-CMD-Terminal
e8f0e5b1d7a8ef814d7fd2acec3a634eb9917522
f2df99afeb951d4c85cd62bd9a9bb1d43867dd21
refs/heads/main
2023-08-03T13:32:19.375683
2021-09-19T20:38:42
2021-09-19T20:38:42
408,230,812
0
0
null
null
null
null
UTF-8
C++
false
false
22,785
cpp
maze_game.cpp
/*--------------------------------------------------------------- Name: Tyreke Scott Date: July 1, 2021 Purpose: To create a program that has a maze which is an array that the user should navigate from room to room until s/he reaches one of two exits I CERTIFY THAT I HAVE NOT GIVEN OR RECEIVED ANY UNAUTHORIZED ASSISTANCE ON THIS ASSIGNMENT ---------------------------------------------------------------*/ #include<iostream> using namespace std; #define MAPR 15 #define MAPC 22 void play_game() { //variables I use to hold the values needed to allow the player to move along the maze int move; int pos; /*cout<<"\nWhere do you want to move?"; cin>>move; while(maze_array !=21) { } run1.maze_array[1][1]= 2; run*/ } void print_update_maze() { //Borders for the maze array int top_left = 201; int hor_mid = 205; int top_right = 187; int ver_mid = 186; int bas_left = 200; int bas_right = 188; //Symbols for the special rooms char R1 = 5; char R2 = 5; char R3 = 5; char R4 = 5; char R5 = 5; char R6 = 5; //Symbols for the exits char E2 = 6; char E4 = 6; int lnum, lnum2; char maze_array[MAPR][MAPC] = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, R1, 1, 0, 0, 0, 0, 1, R2, 1, 0, 0, 0, 0, 1, R3, 1, 0, 0, 0, 0, 1,}, {1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1}, {1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, R5, 1}, {1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1}, {E2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}, {1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, R4, 1}, {1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, R6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, E4, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; /*==================================================*/ printf("\n%c", top_left);//Top left cober of the border //Loop to create the top mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid); } printf("%c\n", top_right);//Top right coner of the border //Start of the loop to print the maze inside of the borders for(lnum = 0; lnum < 1; lnum++) { //Attempting to insert the maze into the borders for(int row=0; row<=14; row++) { printf("%c", ver_mid);//Left mid section of the border for(int col=0; col<=21; col++) { cout<<maze_array[row][col]<<" ";//The actual array gets printed at this point } printf("%c", ver_mid);//Right mid section of the border cout<<endl; } } printf("%c", bas_left);//Base left corner of the border //Loop to create the base mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid); } printf("%c", bas_right);//Base right corner of the border } void print_maze() { //Borders for the maze array int top_left = 201; int hor_mid = 205; int top_right = 187; int ver_mid = 186; int bas_left = 200; int bas_right = 188; //Symbols for the special rooms char R1 = 5; char R2 = 5; char R3 = 5; char R4 = 5; char R5 = 5; char R6 = 5; //Symbols for the exits char E2 = 6; char E4 = 6; char person = 3; int lnum, lnum2; /*Making the thing use 'CHAR' as its data type outputs it as this ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ ☺ Versus when using 'DOUBLE' as the data type I get 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4.43842e-317 1 0 0 0 0 1 6.91692e-323 1 0 0 0 0 1 4.94066e-324 1 0 0 0 0 1 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1 0 1 1 1 1 0 1 0 1 1 1 1 0 1 0 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2.07493e-317 1 1 1 1 1 1 0 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 1 1 1 1 1 1 0 1 7.90505e-323 0 0 0 0 0 1 0 1 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 1 0 0 1 0 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 2.37152e-322 1 1 1 1 1 1 1 1 1 thus for now I will use the 'CHAR' data type instead */ //Making the array that is going to serve as the map char maze_array[MAPR][MAPC] = { {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, {1, R1, 1, 0, 0, 0, 0, 1, R2, 1, 0, 0, 0, 0, 1, R3, 1, 0, 0, 0, 0, 1,}, {1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1}, {1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, R5, 1}, {1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1}, {E2, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1}, {1, 1, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, R4, 1}, {1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1}, {1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, R6, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1}, {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, E4, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; //For the player I will use 3 to represent where they are located and 2 to represent where they where //When the data type is 'CHAR' 2 is outputed as ☻ and 3 is outputed as ♥. //This is how the outer borders are created in the terminal /*=========================================================*/ //Attempt to print a number grind for the maze /*int loca = 0; while(loca<23) { cout<<loca++<<" "; }*/ printf("\n%c", top_left);//Top left cober of the border //Loop to create the top mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid, " "); } printf("%c\n", top_right);//Top right coner of the border //Start of the loop to print the maze inside of the borders for(lnum = 0; lnum < 1; lnum++) { //Attempting to insert the maze into the borders for(int row=0; row<=14; row++) { printf("%c", ver_mid);//Left mid section of the border for(int col=0; col<=21; col++) { cout<<maze_array[row][col]<<" ";//The actual array gets printed at this point } printf("%c", ver_mid);//Right mid section of the border cout<<endl; } } printf("%c", bas_left);//Base left corner of the border //Loop to create the base mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid); } printf("%c", bas_right);//Base right corner of the border /*=========================================================*/ /* Old code testing the array maze map to see if it works*/ /*=============================================================== //Prints out the array into the terminal so it can be seen for(int row=0; row<=14; row++) { for(int col=0; col<=21; col++) { cout<<maze_array[row][col]<<" "; } cout<<endl; } ==================================================================*/ //Values for the positioning in array? int ROW = 1; int COL = 1; //variables I use to hold the values needed to allow the player to move along the maze int direct; int maze_posi = 0; int loop,loop1; int start_room; int hops = 0; int sm_hops;//This is for the distance to the nearest exit int sp_rooms = 0;//This is a variable for count of the special rooms found do { cout<<"\nWhich room do you want to start in? R1, R2, R3, R4, R5 or R6."<<endl; cout<<"\nType the room number for the room that corresponds with it."<<endl; cin>>start_room; //Here the spawn point of the user/player is decided if(start_room == 1) { ROW = 1; COL = 1; cout<<"Player spawned"; loop = 1; sm_hops = 16;//The distance to the nearest exit } else if(start_room == 2) { ROW = 1; COL = 8; cout<<"Player spawned"; loop = 1; sm_hops = 15;//The distance to the nearest exit } else if(start_room == 3) { ROW = 1; COL = 15; cout<<"Player spawned"; loop = 1; sm_hops = 16;//The distance to the nearest exit } else if(start_room == 4) { ROW = 4; COL = 20; cout<<"Player spawned"; loop = 1; sm_hops = 18;//The distance to the nearest exit } else if(start_room == 5) { ROW = 9; COL = 20; cout<<"Player spawned"; loop = 1; sm_hops = 19;//The distance to the nearest exit } else if(start_room == 6) { ROW = 13; COL = 1; cout<<"Player spawned"; loop = 1; sm_hops = 30;//The distance to the nearest exit } else if(start_room == 7 || start_room == 8 || start_room == 9 || start_room == 0) { } else { cout<<"Press the one of the keys 1, 3, 5, 7 or 8 to select a spawn point."; } } while (loop1==1); /*======================================================================================================= //Here is the do loop I used to allow the player to interact and change the array as the game is played =======================================================================================================*/ do { loop = 1; //maze_posi = maze_array[ROW+1][COL]; //This is where the user/player can begin to move around the array cout<<"\nYour character is at position "<<ROW<<" "<<COL<<endl; cout<<"\nWhich direction do you want to move? Right(6), Left(4), Up(8) or Down(2)."; cout<<"\nPress 1 to display the maze again, and press 0 to exit"<<endl; cout<<"--> "; cin>>direct; if(direct == 2) { ROW = ROW + 1; hops = hops + 1;//Here I add one to the varible hops evertime the player moves //This is how the program detects if there is a wall (the value '1') at the location that //the player wants to move to if(maze_array[ROW][COL]==1) { //It tells the user if there is a wall in their way and then moves them back to where //then moves them back to where they were ROW = ROW - 1; cout<<"There is a wall there you cannot move"; hops = hops - 1;//Here I remove one from 'hops' if the player hits a wall and gets set back onto the path so the amount of moves taken are still acurate } maze_array[ROW][COL]=4; loop = 1; } else if(direct == 4) { COL = COL - 1; hops = hops + 1; //It does the same here if(maze_array[ROW][COL]==1) { COL = COL + 1; cout<<"There is a wall there you cannot move"; hops = hops - 1; } maze_array[ROW][COL]=4; loop = 1; } else if(direct == 6) { COL = COL + 1; hops = hops + 1; if(maze_array[ROW][COL]==1) { COL = COL - 1; cout<<"There is a wall there you cannot move"; hops = hops - 1; } maze_array[ROW][COL]=4; loop = 1; } else if(direct == 8) { ROW = ROW - 1; hops = hops + 1; if(maze_array[ROW][COL]==1) { ROW = ROW + 1; cout<<"\nThere is a wall there you cannot move"; hops = hops - 1; } maze_array[ROW][COL]=4; loop = 1; } else if(direct == 1) { print_update_maze(); } else if(direct == 0) { maze_array[ROW][COL]=3; loop = 0; } else//This is so that if anything other than what I expect the user to input is inputed into the program it knows what to do { cout<<"error"; loop = 1; } //Here is how I make the program tell wether or not the player is at a special room or exit. if(ROW == 1 && COL == 1) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 1!"<<endl; } else if(ROW == 1 && COL == 8) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 3!"<<endl; } else if(ROW == 1 && COL == 15) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 5!"<<endl; } else if(ROW == 4 && COL == 20) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 7!"<<endl; } else if(ROW == 9 && COL == 20) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 6!"<<endl; } else if(ROW == 13 && COL == 1) { sp_rooms = sp_rooms + 1; cout<<"\nYou found special room 8!"<<endl; } else if(ROW == 8 && COL == 0) { cout<<"\nCongrats! You found exit #2!"<<endl; cout<<"\nYOU HAVE COMPLETED AND EXITED THE MAZE!!!!!"<<endl; cout<<"\nYou moved "<<hops<<" times to get to the exit"; cout<<"\nThe shortest route to the exit was only "<<sm_hops<<" moves!"; cout<<"\nYou have found "<<sp_rooms<<" special rooms."<<endl; maze_array[8][0] = 3; loop = 0; } else if(ROW == 14 && COL == 12) { cout<<"\nCongrats! You found exit #4!"<<endl; cout<<"\nYOU HAVE COMPLETED AND EXITED THE MAZE!!!!!"<<endl; cout<<"\nYou moved "<<hops<<" times to get to the exit"; cout<<"\nThe shortest route to the exit was only "<<sm_hops<<" moves!"; maze_array[14][12] = 3; loop = 0; } /*==============old code========== if(direct == 8) cout<<maze_array; ==================================*/ } while(loop == 1); /*=================================================== Printing the new array with the progress of the player ====================================================*/ printf("\n%c", top_left);//Top left cober of the border //Loop to create the top mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid); } printf("%c\n", top_right);//Top right coner of the border //Start of the loop to print the maze inside of the borders for(lnum = 0; lnum < 1; lnum++) { //Attempting to insert the maze into the borders for(int row=0; row<=14; row++) { printf("%c", ver_mid);//Left mid section of the border for(int col=0; col<=21; col++) { cout<<maze_array[row][col]<<" ";//The actual array gets printed at this point } printf("%c", ver_mid);//Right mid section of the border cout<<endl; } } printf("%c", bas_left);//Base left corner of the border //Loop to create the base mid section of the border for(lnum = 1; lnum < 45; lnum++) { printf("%c", hor_mid); } printf("%c", bas_right);//Base right corner of the border cout<<"\n\nThe shortest route to the exit was only "<<sm_hops<<" moves!"; /*==============old code========== //while(loop == 1); //maze_array[1][1]= 2; ==================================*/ } /*============================================================== Old code to move the player around the array that is abandoned ==============================================================*/ /*mvoid move_player(char maze_array) { //Values for the positioning in array? int ROW = 1; int COL = 1; //variables I use to hold the values needed to allow the player to move along the maze int direct; int maze_posi = 0; cout<<"\nWhere do you want to move?"; cin>>direct; while(maze_array[ROW][COL] !=21) { //maze_posi = maze_array[ROW+1][COL]; cout<<"Your character is at position "<<ROW<<" "<<COL<<endl; cout<<"\nWHich direction do you want to move? Left(6), Right(4), Up(8) or Down(2)"; cin>>direct; if(direct == 2) { ROW = ROW + 1; maze_array[ROW][COL]=4; } if(direct == 8) break; } maze_array[1][1]= 2; }*/ /*void movement() { cout<<"\nWhere do you want to move?"; cin>>move; while(maze_array !=21) { } maze_array[1][1]= 2; }++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ void intro() { char u_resp; cout<<"++++++++++++++++++++++++++++++++++++++++++++Welcome to the Sython Maze game!++++++++++++++++++++++++++++++++++++++++++++"<<endl; cout<<"Start game? (Y for yes/ N for no)"<<endl; cin>>u_resp; if(u_resp == 'Y' || u_resp == 'y') { cout<<"\n+++++++++++++++++++++++++++RULES+++++++++++++++++++++++++++"; cout<<"\nThis is a maze game where you try and get to the exit one move at a time."; cout<<"\nThere are 6(six) rooms and 2(two) exits. At the start of the game you choose"; cout<<"\nwhere you want to spawn into or begin in the map."; cout<<"\nFrom there you get to either exits to beat the game."; cout<<"\nYou can also find one of the rooms that you can spawn into to gain extra points!"; cout<<"\nKey: clover = special room"; cout<<"\nHeart = Player's Character (You)"; cout<<"\nDiamond = The path you've taken"; cout<<"\nHollow Smilely Face = The inner walls of the maze"; cout<<"\nLines = The outer walls of the maze"; cout<<"\nSpade = The Exits"; cout<<"\n+++++++++++++++++++++++++++GOOD LUCK!!!+++++++++++++++++++++++++++"<<endl; print_maze(); } else if (u_resp == 'N' || u_resp == 'n') { cout<<"Thank you for playing the Sython Maze game"; } else { printf("It didn't work?"); } } int main() { //start_game(); //print_maze(); intro(); return 0; }
e5cf861ada0012d3367fdbdde912d10a21815ef8
78d0e38754de3e2d3a1f1ac8f80ca17aa5c24283
/OBD_PND/OBDPNDDlgTipInfo.h
e3cad04c2fbf8a19718f4df58ff3ca0e0c022971
[]
no_license
Aavesh/obd_pnd
7a76354b81dcff84adcfc3ebe96d425c0f8d9da9
f2296e7e65701f6bb574359748cf56e9ed09224e
refs/heads/master
2020-12-11T06:11:02.931797
2014-01-13T03:52:56
2014-01-13T03:52:56
null
0
0
null
null
null
null
GB18030
C++
false
false
1,266
h
OBDPNDDlgTipInfo.h
#pragma once #include "OBDPNDDlgBase.h" enum TIP_INFO_TYPE { TIP_INFO_TEXT, TIP_INFO_WARN, TIP_INFO_ERROR, }; // COBDPNDDlgTipInfo 对话框 class COBDPNDDlgTipInfo : public CDialog,public COBDPNDDlgBase { DECLARE_DYNAMIC(COBDPNDDlgTipInfo) public: COBDPNDDlgTipInfo(CWnd* pParent = NULL); // 标准构造函数 virtual ~COBDPNDDlgTipInfo(); // 对话框数据 enum { IDD = IDD_OBD_PND_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持 virtual BOOL OnInitDialog(); afx_msg void OnLButtonDown(UINT nFlags, CPoint point); afx_msg void OnLButtonUp(UINT nFlags, CPoint point); afx_msg BOOL OnEraseBkgnd(CDC* pDC); afx_msg void OnPaint(); afx_msg void OnTimer(UINT_PTR nIDEvent); DECLARE_MESSAGE_MAP() public: //初始化界面位置,字体等信息 void fInitUI(); void fSetTipText(CString strText,WORD wType = TIP_INFO_TEXT); void fSetSoundFile(CString strSoundFile); void fShowTipText(CString strText=_T(""),WORD wType = TIP_INFO_TEXT); void fHideTipText(); private: CRect m_rect; CRect m_rectTipText; CFont m_fontText; DWORD m_dwTipType; COLORREF m_clrTextNormal; COLORREF m_clrTextWarn; COLORREF m_clrTextError; CString m_strTipText; CString m_strSoundFile; WORD m_wCount; };
37a4a4001bfac5b150129d0e9467d4aded28565a
9704b65c04f981351dbf068bf072feb67c95b21c
/CC AND.cpp
6beb4dee57d24cc550a73bab19e083a17b5e2b13
[]
no_license
rohitsikka/CodeChef
b3f64a9db79c907e9f5b54604b7871ebc9b1c29e
f6ba8ce71770adfac11833909c9e80bc71b34215
refs/heads/master
2016-09-01T18:24:58.870319
2015-02-20T10:46:51
2015-02-20T10:46:51
31,067,740
0
0
null
null
null
null
UTF-8
C++
false
false
553
cpp
CC AND.cpp
#include<iostream> #include<cstdio> #include<cstring> using namespace std; int main() { freopen("temp.txt","r",stdin); int n,num,bitCount[30]; scanf("%d",&n); memset(bitCount,0,sizeof(bitCount)); for(int i=0;i<n;i++) { scanf("%d",&num); for(int i=0;i<30&&num;i++,num>>=1) if(num&1) bitCount[i]++; } long long int ans=0; for(int i=0;i<30;i++) ans=ans+((long long)(1<<i)*(long long)bitCount[i]*(long long)(bitCount[i]-1)); printf("%lld\n",ans/2); return 0; }
03fe09e083b4188f2e0f9bd02f945b88bb6c4735
f2a8d9be4c207816d6e6fc0ee68ecda11f4512d6
/return_by_reference.cpp
7cfb806b7c85480e4c73d64701bbdffa00bcdac5
[]
no_license
rushilg13/Cpp-Complete
83e93af437478ee69716a1a53ddc10a00d585761
c5d16702ae8d9fd27d4e60499620e29bb27b9b66
refs/heads/main
2023-01-24T01:14:58.166616
2020-12-01T13:23:18
2020-12-01T13:23:18
317,242,901
0
0
null
null
null
null
UTF-8
C++
false
false
257
cpp
return_by_reference.cpp
#include<iostream> using namespace std; int & print(int &a) { cout<<a<<endl; return a; } int main(int argc, char const *argv[]) { int x = 10; print(x) = 25; // We have a function at the left side of an assignment operator. cout<<x; return 0; }
3b4fa4d822a0556199c1f5d95bcfda4776cb6de2
5de7df0be411b4bad61f927cae845bdb8223308f
/src/libs/flow/flow_workspace.cpp
fda3a0dd7f33d76969273f53c127cf553ead0685
[ "BSD-3-Clause", "Zlib" ]
permissive
Alpine-DAV/ascent
cb40429167a93c62f78fe650a0121258be279162
e52b7bb8c9fd131f2fd49edf58037cc5ef77a166
refs/heads/develop
2023-09-06T07:57:11.558238
2023-08-25T16:05:31
2023-08-25T16:05:31
81,366,855
151
61
NOASSERTION
2023-09-13T19:31:09
2017-02-08T19:21:22
C++
UTF-8
C++
false
false
17,167
cpp
flow_workspace.cpp
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// // Copyright (c) Lawrence Livermore National Security, LLC and other Ascent // Project developers. See top-level LICENSE AND COPYRIGHT files for dates and // other details. No copyright assignment is required to contribute to Ascent. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~// //----------------------------------------------------------------------------- /// /// file: flow_workspace.cpp /// //----------------------------------------------------------------------------- #include "flow_workspace.hpp" #include "flow_timer.hpp" // standard lib includes #include <iostream> #include <string.h> #include <limits.h> #include <cstdlib> using namespace conduit; using namespace std; //----------------------------------------------------------------------------- // -- begin flow:: -- //----------------------------------------------------------------------------- namespace flow { // we init m_default_mpi_comm to -1, it's not clear if we can // pick a safe non-inited value w/o the mpi headers, but // we will try this strategy. int Workspace::m_default_mpi_comm = -1; static int g_timing_exec_count = 0; //----------------------------------------------------------------------------- class Workspace::ExecutionPlan { public: static void generate(Graph &g, conduit::Node &traversals); private: ExecutionPlan(); ~ExecutionPlan(); static void bf_topo_sort_visit(Graph &graph, const std::string &filter_name, conduit::Node &tags, conduit::Node &tarv); }; //----------------------------------------------------------------------------- class Workspace::FilterFactory { public: static std::map<std::string,FilterFactoryMethod> &registered_types() { return m_filter_types; } private: static std::map<std::string,FilterFactoryMethod> m_filter_types; }; //----------------------------------------------------------------------------- std::map<std::string,FilterFactoryMethod> Workspace::FilterFactory::m_filter_types; //----------------------------------------------------------------------------- Workspace::ExecutionPlan::ExecutionPlan() { // empty } //----------------------------------------------------------------------------- Workspace::ExecutionPlan::~ExecutionPlan() { // empty } //----------------------------------------------------------------------------- void Workspace::ExecutionPlan::generate(Graph &graph, conduit::Node &traversals) { traversals.reset(); Node snks; Node srcs; std::map<std::string,Filter*>::iterator itr; for(itr = graph.m_filters.begin(); itr != graph.m_filters.end(); itr++) { Filter *f = itr->second; // check for snk if( !f->output_port() || graph.edges_out(f->name()).number_of_children() == 0) { snks.append().set(f->name()); } // check for src if( f->output_port() && !graph.edges()["in"].has_child(f->name()) ) { srcs.append().set(f->name()); } } // init tags Node tags; for(itr = graph.m_filters.begin(); itr != graph.m_filters.end() ; itr++) { Filter *f = itr->second; tags[f->name()].set_int32(0); } // execute bf traversal from each snk NodeConstIterator snk_itr(&snks); while(snk_itr.has_next()) { std::string snk_name = snk_itr.next().as_string(); Node snk_trav; bf_topo_sort_visit(graph, snk_name, tags, snk_trav); if(snk_trav.number_of_children() > 0) { traversals.append().set(snk_trav); } } } //----------------------------------------------------------------------------- void Workspace::ExecutionPlan::bf_topo_sort_visit(Graph &graph, const std::string &f_name, conduit::Node &tags, conduit::Node &trav) { if( tags[f_name].as_int32() != 0 ) { return; } int uref = 1; tags[f_name].set_int32(1); Filter *f = graph.m_filters[f_name]; if(f->output_port()) { int num_refs = graph.edges_out(f_name).number_of_children(); uref = num_refs > 0 ? num_refs : 1; } if ( f->port_names().number_of_children() > 0 ) { NodeConstIterator f_inputs(&graph.edges_in(f_name)); while(f_inputs.has_next()) { const Node &n_f_input = f_inputs.next(); if(n_f_input.dtype().is_string()) { std::string f_in_name = n_f_input.as_string(); bf_topo_sort_visit(graph, f_in_name, tags, trav); } else // missing input. { index_t port_idx = f_inputs.index(); CONDUIT_ERROR("Filter " << f->detailed_name() << " is missing connection to input port " << port_idx << " (" << f->port_index_to_name(port_idx) << ")"); uref = 0; } } } // conduit nodes keep insert order, so we can use // obj instead of list if(uref > 0) { trav[f_name] = uref; } } //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- Workspace::Workspace() :m_graph(this), m_registry(), m_timing_info(), m_enable_timings(false) { } //----------------------------------------------------------------------------- Workspace::~Workspace() { } //----------------------------------------------------------------------------- Graph & Workspace::graph() { return m_graph; } //----------------------------------------------------------------------------- const Graph & Workspace::graph() const { return m_graph; } //----------------------------------------------------------------------------- Registry & Workspace::registry() { return m_registry; } //----------------------------------------------------------------------------- const Registry & Workspace::registry() const { return m_registry; } //----------------------------------------------------------------------------- void Workspace::traversals(Node &traversals) { traversals.reset(); ExecutionPlan::generate(graph(),traversals); } //----------------------------------------------------------------------------- void Workspace::execute() { Timer t_total_exec; Node traversals; ExecutionPlan::generate(graph(),traversals); // execute traversals NodeIterator travs_itr = traversals.children(); while(travs_itr.has_next()) { NodeIterator trav_itr(&travs_itr.next()); while(trav_itr.has_next()) { Node &t = trav_itr.next(); std::string f_name = trav_itr.name(); int uref = t.to_int32(); Filter *f = graph().filters()[f_name]; f->reset_inputs_and_output(); // fetch inputs from reg, attach to filter's ports NodeConstIterator ports_itr = NodeConstIterator(&f->port_names()); //registry().print(); std::vector<std::string> f_i_names; while(ports_itr.has_next()) { std::string port_name = ports_itr.next().as_string(); std::string f_input_name = graph().edges_in(f_name)[port_name].as_string(); f->set_input(port_name,&registry().fetch(f_input_name)); } Timer t_flt_exec; // execute f->execute(); if(m_enable_timings) { m_timing_info << g_timing_exec_count << " " << f->name() << " " << std::fixed << t_flt_exec.elapsed() <<"\n"; } // if has output, set output if(f->output_port()) { if(f->output().data_ptr() == NULL) { CONDUIT_ERROR("filter output is NULL, was set_output() called?"); } registry().add(f_name, f->output(), uref); } f->reset_inputs_and_output(); // consume inputs ports_itr.to_front(); while(ports_itr.has_next()) { std::string port_name = ports_itr.next().as_string(); std::string f_input_name = graph().edges_in(f_name)[port_name].as_string(); registry().consume(f_input_name); } } } if(m_enable_timings) { m_timing_info << g_timing_exec_count << " [total] " << std::fixed << t_total_exec.elapsed() <<"\n"; g_timing_exec_count++; } } //----------------------------------------------------------------------------- void Workspace::enable_timings(bool enabled) { m_enable_timings = enabled; } //----------------------------------------------------------------------------- void Workspace::reset() { graph().reset(); registry().reset(); } //----------------------------------------------------------------------------- void Workspace::info(Node &out) const { out.reset(); graph().info(out["graph"]); registry().info(out["registry"]); out["timings"] = timing_info(); } //----------------------------------------------------------------------------- std::string Workspace::to_json() const { Node out; info(out); ostringstream oss; out.to_json_stream(oss); return oss.str(); } //----------------------------------------------------------------------------- std::string Workspace::to_yaml() const { Node out; info(out); ostringstream oss; out.to_yaml_stream(oss); return oss.str(); } //----------------------------------------------------------------------------- void Workspace::print() const { CONDUIT_INFO(to_yaml()); } //----------------------------------------------------------------------------- void Workspace::reset_timing_info() { g_timing_exec_count = 0; m_timing_info.str(""); } //----------------------------------------------------------------------------- string Workspace::timing_info() const { return m_timing_info.str(); } //----------------------------------------------------------------------------- Filter * Workspace::create_filter(const std::string &filter_type_name) { if(!supports_filter_type(filter_type_name)) { CONDUIT_WARN("Cannot create unknown filter type: " << filter_type_name); return NULL; } return FilterFactory::registered_types()[filter_type_name](filter_type_name.c_str()); } //----------------------------------------------------------------------------- void Workspace::set_default_mpi_comm(int mpi_comm_id) { m_default_mpi_comm = mpi_comm_id; } int Workspace::default_mpi_comm() { // we init m_default_mpi_comm to -1, it's not clear if we can // pick a safe non-inited value w/o the mpi headers, but // we will try this strategy. if(m_default_mpi_comm == -1) { CONDUIT_ERROR("flow::Workspace default MPI communicator is not initialized.") } return m_default_mpi_comm; } //----------------------------------------------------------------------------- bool Workspace::supports_filter_type(const std::string &filter_type_name) { std::map<std::string,FilterFactoryMethod>::const_iterator itr; itr = FilterFactory::registered_types().find(filter_type_name); return (itr != FilterFactory::registered_types().end()); } //----------------------------------------------------------------------------- bool Workspace::supports_filter_type(FilterFactoryMethod fr) { Filter *f = fr(""); Node iface; std::string f_type_name = "(type_name missing!)"; f->declare_interface(iface); delete f; if(iface.has_child("type_name") && iface["type_name"].dtype().is_string()) { f_type_name = iface["type_name"].as_string(); } return supports_filter_type(f_type_name); } //----------------------------------------------------------------------------- void Workspace::remove_filter_type(const std::string &filter_type_name) { std::map<std::string,FilterFactoryMethod>::const_iterator itr; itr = FilterFactory::registered_types().find(filter_type_name); if(itr != FilterFactory::registered_types().end()) { FilterFactory::registered_types().erase(filter_type_name); } } //----------------------------------------------------------------------------- void Workspace::register_filter_type(FilterFactoryMethod fr) { if(supports_filter_type(fr)) { // already registered return; } // obtain type name // check that filter is valid by creating // an instance Filter *f = fr(""); // verify f provides proper interface declares Node i_test; Node v_info; std::string f_type_name = "(type_name missing!)"; f->declare_interface(i_test); if(!Filter::verify_interface(i_test,v_info)) { // if the type name was provided, that helps improve // the error message, so try to include it if(i_test.has_child("type_name") && i_test["type_name"].dtype().is_string()) { f_type_name = i_test["type_name"].as_string(); } // failed interface verify ... CONDUIT_ERROR("filter type interface verify failed." << std::endl << f_type_name << std::endl << "Details:" << std::endl << v_info.to_yaml()); } f_type_name =i_test["type_name"].as_string(); // we no longer need this instance ... delete f; register_filter_type(f_type_name,fr); } //----------------------------------------------------------------------------- void Workspace::register_filter_type(const std::string &filter_type_name, FilterFactoryMethod fr) { if(supports_filter_type(filter_type_name)) { CONDUIT_INFO("filter type named:" << filter_type_name << " is already registered"); return; } // check that filter is valid by creating // an instance Filter *f = fr(filter_type_name.c_str()); // verify f provides proper interface declares Node i_test; Node v_info; std::string f_type_name = "(type_name missing!)"; f->declare_interface(i_test); if(!Filter::verify_interface(i_test,v_info)) { // if the type name was provided, that helps improve // the error message, so try to include it if(i_test.has_child("type_name") && i_test["type_name"].dtype().is_string()) { f_type_name = i_test["type_name"].as_string(); } // failed interface verify ... CONDUIT_ERROR("filter type interface verify failed." << std::endl << f_type_name << std::endl << "Details:" << std::endl << v_info.to_yaml()); } f_type_name =i_test["type_name"].as_string(); // we no longer need this instance ... delete f; if(supports_filter_type(f_type_name)) { CONDUIT_ERROR("filter type named:" << f_type_name << " is already registered"); } FilterFactory::registered_types()[filter_type_name] = fr; } //----------------------------------------------------------------------------- std::string Workspace::filter_type_name(FilterFactoryMethod fr) { Filter *f = fr(""); Node iface; std::string f_type_name = "(type_name missing!)"; f->declare_interface(iface); delete f; if(iface.has_child("type_name") && iface["type_name"].dtype().is_string()) { f_type_name = iface["type_name"].as_string(); } if(!supports_filter_type(f_type_name)) { // TODO ERROR } return f_type_name; } //----------------------------------------------------------------------------- void Workspace::clear_supported_filter_types() { FilterFactory::registered_types().clear(); } //----------------------------------------------------------------------------- }; //----------------------------------------------------------------------------- // -- end flow:: -- //-----------------------------------------------------------------------------
918996a32d57e2653d0a1e51a160775139e6bb9e
2ce759256cd9e1ef94277a93bf365ded26607428
/spoj/USUBQSUBtest.cpp
c17540217a61c9790de062ff10a0ebd099989583
[]
no_license
SaxenaKartik/Competitive-Coding
a240d8319c8b97221fd741002d21835f8abd2c1e
b52496f86855a7cee4f39285604f92638c99b6cf
refs/heads/master
2021-11-11T13:41:26.714053
2021-10-31T11:22:44
2021-10-31T11:22:44
151,931,070
1
5
null
2021-10-31T11:22:45
2018-10-07T10:45:54
C++
UTF-8
C++
false
false
2,615
cpp
USUBQSUBtest.cpp
#include <stdio.h> #include <stdlib.h> typedef long long int lli; /*lli ***bit;*/ lli bit[5][1005][1005]; int n, m; void update(int no, int x, int y, lli val) { while (x <= n) { int y1 = y; while (y1 <= n) { bit[no][x][y1] += val; y1 += y1 & (-y1); } x += x & (-x); } } lli query(int no, int x, int y) { lli sum = 0; while (x > 0) { int y1 = y; while (y1 > 0) { sum += bit[no][x][y1]; y1 -= y1 & (-y1); } x -= x & (-x); } return sum; } void update_r(int x1, int y1, int x2, int y2, int val) { // updating first tree update(0, x1, y1, val); update(0, x1, y2+1, -val); update(0, x2+1, y1, -val); update(0, x2+1, y2+1, val); // updating second tree update(1, x1, y1, val*(1-y1)); update(1, x1, y2+1, val*y2); update(1, x2+1, y1, val*(y1-1)); update(1, x2+1, y2+1, -val*y2); // updating third tree update(2, x1, y1, val*(1-x1)); update(2, x1, y2+1, (x1-1)*val); update(2, x2+1, y1, val*x2); update(2, x2+1, y2+1, -x2*val); // updating fourth tree update(3, x1, y1, (x1-1)*(y1-1)*val); update(3, x1, y2+1, -y2*(x1-1)*val); update(3, x2+1, y1, -x2*(y1-1)*val); update(3, x2+1, y2+1, x2*y2*val); } lli query_n(int x, int y) { return query(0, x, y) * x * y + query(1, x, y) * x + query(2, x, y) * y + query(3, x, y); } lli query_r(int x1, int y1, int x2, int y2) { lli sum = 0; sum += query_n(x2, y2) - query_n(x1-1, y2) - query_n(x2, y1-1) + query_n(x1-1, y1-1); return sum; } int main(void) { scanf("%d %d", &n, &m); /*bit = (lli ***) calloc(5, sizeof(lli***)); int i, j; for (i = 0; i < 4; i++) { bit[i] = (lli **) calloc(n+10, sizeof(lli**)); for (j = 0; j < n+10; j++) bit[i][j] = (lli *) calloc(n+10, sizeof(lli)); }*/ int type, x1, x2, y1, y2, val; while (m--) { scanf("%d %d %d %d %d", &type, &x1, &y1, &x2, &y2); if (type == 1) { printf("%lld\n", query_r(x1, y1, x2, y2)); } else { scanf("%d", &val); update_r(x1, y1, x2, y2, val); for(int k=0;k<4;k++) { printf("Tree No. : %d\n", k); for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { printf("%lld ",query(k,i,j)); } printf("\n"); } printf("\n\n"); } } } return 0; }
40fa62f4edb1d4917ba64dbbfcc800a477bb37f8
7fa4fb0b3c56fd76ef473f725d21d0c7c9541a99
/mekd/src/MEKD_MG.cpp
fc82bef00f7746e6119fb6f6bb1721e4613d4ba1
[]
no_license
jhugon/hmumuAnalysis
ccc0558f09dfdb92d993d1e4c6e9785ab160d0f1
4d1fe34a4610f7db23241daa3e1e693839cc435b
refs/heads/master
2020-04-05T23:46:36.493543
2013-08-06T14:30:25
2013-08-06T14:30:25
11,926,126
0
1
null
null
null
null
UTF-8
C++
false
false
136,961
cpp
MEKD_MG.cpp
#ifndef MEKD_MG_cpp #define MEKD_MG_cpp /// C++ libraries #include <iostream> // #include <fstream> #include <sstream> #include <string> #include <vector> #include <algorithm> // for sorting #include <cmath> /// CMSSW includes #ifndef MEKD_STANDALONE #include "FWCore/ParameterSet/interface/FileInPath.h" #endif /// MEs, ZZ #include "MadGraphSrc/BKG_DN_OF.h" #include "MadGraphSrc/BKG_DN_SF.h" #include "MadGraphSrc/BKG_UP_OF.h" #include "MadGraphSrc/BKG_UP_SF.h" #include "MadGraphSrc/BKG_DN_OFpA.h" #include "MadGraphSrc/BKG_DN_SFpA.h" #include "MadGraphSrc/BKG_UP_OFpA.h" #include "MadGraphSrc/BKG_UP_SFpA.h" #include "MadGraphSrc/Spin0_gg_OF.h" #include "MadGraphSrc/Spin0_gg_SF.h" #include "MadGraphSrc/Spin0_gg_OFpA.h" #include "MadGraphSrc/Spin0_gg_SFpA.h" #include "MadGraphSrc/Spin0_qq_DN_OF.h" #include "MadGraphSrc/Spin0_qq_DN_SF.h" #include "MadGraphSrc/Spin0_qq_UP_OF.h" #include "MadGraphSrc/Spin0_qq_UP_SF.h" #include "MadGraphSrc/Spin0_qq_DN_OFpA.h" #include "MadGraphSrc/Spin0_qq_DN_SFpA.h" #include "MadGraphSrc/Spin0_qq_UP_OFpA.h" #include "MadGraphSrc/Spin0_qq_UP_SFpA.h" #include "MadGraphSrc/Spin1_DN_OF.h" #include "MadGraphSrc/Spin1_DN_SF.h" #include "MadGraphSrc/Spin1_UP_OF.h" #include "MadGraphSrc/Spin1_UP_SF.h" #include "MadGraphSrc/Spin1_DN_OFpA.h" #include "MadGraphSrc/Spin1_DN_SFpA.h" #include "MadGraphSrc/Spin1_UP_OFpA.h" #include "MadGraphSrc/Spin1_UP_SFpA.h" #include "MadGraphSrc/Spin2_gg_OF.h" #include "MadGraphSrc/Spin2_gg_SF.h" #include "MadGraphSrc/Spin2_gg_OFpA.h" #include "MadGraphSrc/Spin2_gg_SFpA.h" #include "MadGraphSrc/Spin2_qq_DN_OF.h" #include "MadGraphSrc/Spin2_qq_DN_SF.h" #include "MadGraphSrc/Spin2_qq_UP_OF.h" #include "MadGraphSrc/Spin2_qq_UP_SF.h" #include "MadGraphSrc/Spin2_qq_DN_OFpA.h" #include "MadGraphSrc/Spin2_qq_DN_SFpA.h" #include "MadGraphSrc/Spin2_qq_UP_OFpA.h" #include "MadGraphSrc/Spin2_qq_UP_SFpA.h" /// MEs, 2mu #include "MadGraphSrc/BKG_DY_qq_DN_2l.h" #include "MadGraphSrc/BKG_DY_qq_UP_2l.h" #include "MadGraphSrc/BKG_DY_qq_DN_2lpA.h" #include "MadGraphSrc/BKG_DY_qq_UP_2lpA.h" #include "MadGraphSrc/Spin0_gg_2l.h" #include "MadGraphSrc/Spin0_gg_2lpA.h" #include "MadGraphSrc/Spin0_qq_DN_2l.h" #include "MadGraphSrc/Spin0_qq_UP_2l.h" #include "MadGraphSrc/Spin0_qq_DN_2lpA.h" #include "MadGraphSrc/Spin0_qq_UP_2lpA.h" #include "MadGraphSrc/Spin1_qq_DN_2l.h" #include "MadGraphSrc/Spin1_qq_UP_2l.h" #include "MadGraphSrc/Spin1_qq_DN_2lpA.h" #include "MadGraphSrc/Spin1_qq_UP_2lpA.h" #include "MadGraphSrc/Spin2_gg_2l.h" #include "MadGraphSrc/Spin2_gg_2lpA.h" #include "MadGraphSrc/Spin2_qq_DN_2l.h" #include "MadGraphSrc/Spin2_qq_UP_2l.h" #include "MadGraphSrc/Spin2_qq_DN_2lpA.h" #include "MadGraphSrc/Spin2_qq_UP_2lpA.h" extern "C" { #include "Extra_code/MEKD_CalcHEP_PDF.h" #include "PDFTables/pdt.h" } #include "Extra_code/MEKD_CalcHEP_Extra_functions.h" #include "Extra_code/MEKD_MG_Boosts.h" #include "higgs_properties/hggeffective.h" #include "MadGraphSrc/read_slha.h" #include "../interface/MEKD_MG.h" using namespace std; /// Part of pdfreader extern "C" pdtStr pdtSg, pdtSd, pdtSu, pdtSs, pdtSc, pdtSad, pdtSau, pdtSas, pdtSac; // #define PDTFILE "PDFTables/cteq6l.pdt" // CalCHEP reads a table for CTEQ6L. You can change PDF set as you want. /// ZZ decay mode BKG_DN_OF ME_Background_ZZ_qq_DownType_OF; BKG_DN_SF ME_Background_ZZ_qq_DownType_SF; BKG_UP_OF ME_Background_ZZ_qq_UpType_OF; BKG_UP_SF ME_Background_ZZ_qq_UpType_SF; BKG_DN_OFpA ME_Background_ZZ_qq_DownType_OFpA; BKG_DN_SFpA ME_Background_ZZ_qq_DownType_SFpA; BKG_UP_OFpA ME_Background_ZZ_qq_UpType_OFpA; BKG_UP_SFpA ME_Background_ZZ_qq_UpType_SFpA; Spin0_gg_OF ME_Signal_Spin0_gg_OF; Spin0_gg_SF ME_Signal_Spin0_gg_SF; Spin0_gg_OFpA ME_Signal_Spin0_gg_OFpA; Spin0_gg_SFpA ME_Signal_Spin0_gg_SFpA; Spin0_qq_DN_OF ME_Signal_Spin0_qq_DownType_OF; Spin0_qq_DN_SF ME_Signal_Spin0_qq_DownType_SF; Spin0_qq_UP_OF ME_Signal_Spin0_qq_UpType_OF; Spin0_qq_UP_SF ME_Signal_Spin0_qq_UpType_SF; Spin0_qq_DN_OFpA ME_Signal_Spin0_qq_DownType_OFpA; Spin0_qq_DN_SFpA ME_Signal_Spin0_qq_DownType_SFpA; Spin0_qq_UP_OFpA ME_Signal_Spin0_qq_UpType_OFpA; Spin0_qq_UP_SFpA ME_Signal_Spin0_qq_UpType_SFpA; Spin1_DN_OF ME_Signal_Spin1_qq_DownType_OF; Spin1_DN_SF ME_Signal_Spin1_qq_DownType_SF; Spin1_UP_OF ME_Signal_Spin1_qq_UpType_OF; Spin1_UP_SF ME_Signal_Spin1_qq_UpType_SF; Spin1_DN_OFpA ME_Signal_Spin1_qq_DownType_OFpA; Spin1_DN_SFpA ME_Signal_Spin1_qq_DownType_SFpA; Spin1_UP_OFpA ME_Signal_Spin1_qq_UpType_OFpA; Spin1_UP_SFpA ME_Signal_Spin1_qq_UpType_SFpA; Spin2_gg_OF ME_Signal_Spin2_gg_OF; Spin2_gg_SF ME_Signal_Spin2_gg_SF; Spin2_gg_OFpA ME_Signal_Spin2_gg_OFpA; Spin2_gg_SFpA ME_Signal_Spin2_gg_SFpA; Spin2_qq_DN_OF ME_Signal_Spin2_qq_DownType_OF; Spin2_qq_DN_SF ME_Signal_Spin2_qq_DownType_SF; Spin2_qq_UP_OF ME_Signal_Spin2_qq_UpType_OF; Spin2_qq_UP_SF ME_Signal_Spin2_qq_UpType_SF; Spin2_qq_DN_OFpA ME_Signal_Spin2_qq_DownType_OFpA; Spin2_qq_DN_SFpA ME_Signal_Spin2_qq_DownType_SFpA; Spin2_qq_UP_OFpA ME_Signal_Spin2_qq_UpType_OFpA; Spin2_qq_UP_SFpA ME_Signal_Spin2_qq_UpType_SFpA; /// 2mu decay mode BKG_DY_qq_DN_2l ME_Background_DY_qq_DownType_2l; BKG_DY_qq_UP_2l ME_Background_DY_qq_UpType_2l; BKG_DY_qq_DN_2lpA ME_Background_DY_qq_DownType_2lpA; BKG_DY_qq_UP_2lpA ME_Background_DY_qq_UpType_2lpA; Spin0_gg_2l ME_Signal_Spin0_gg_2l; Spin0_gg_2lpA ME_Signal_Spin0_gg_2lpA; Spin0_qq_DN_2l ME_Signal_Spin0_qq_DownType_2l; Spin0_qq_UP_2l ME_Signal_Spin0_qq_UpType_2l; Spin0_qq_DN_2lpA ME_Signal_Spin0_qq_DownType_2lpA; Spin0_qq_UP_2lpA ME_Signal_Spin0_qq_UpType_2lpA; Spin1_qq_DN_2l ME_Signal_Spin1_qq_DownType_2l; Spin1_qq_UP_2l ME_Signal_Spin1_qq_UpType_2l; Spin1_qq_DN_2lpA ME_Signal_Spin1_qq_DownType_2lpA; Spin1_qq_UP_2lpA ME_Signal_Spin1_qq_UpType_2lpA; Spin2_gg_2l ME_Signal_Spin2_gg_2l; Spin2_gg_2lpA ME_Signal_Spin2_gg_2lpA; Spin2_qq_DN_2l ME_Signal_Spin2_qq_DownType_2l; Spin2_qq_UP_2l ME_Signal_Spin2_qq_UpType_2l; Spin2_qq_DN_2lpA ME_Signal_Spin2_qq_DownType_2lpA; Spin2_qq_UP_2lpA ME_Signal_Spin2_qq_UpType_2lpA; MEKD_MG::MEKD_MG() { Set_Default_MEKD_MG_Parameters(); /// Cross-cheking MEs for consistency. ZZ if( ME_Background_ZZ_qq_DownType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_DownType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_UpType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_UpType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_DownType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_DownType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_UpType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_ZZ_qq_UpType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_OF.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_SF.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_OFpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_SFpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_OF.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_SF.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_OFpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_SFpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_OF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_SF.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_OFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_SFpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } /// Cross-cheking MEs for consistency. 2mu if( ME_Background_DY_qq_DownType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_DY_qq_UpType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_DY_qq_DownType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Background_DY_qq_UpType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_2l.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_gg_2lpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_DownType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin0_qq_UpType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_DownType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin1_qq_UpType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_2l.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_gg_2lpA.nprocesses!=1 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_2l.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_DownType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } if( ME_Signal_Spin2_qq_UpType_2lpA.nprocesses!=2 ) { cerr << "Problem in ME class detected. Exiting.\n"; exit(1); } p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); p_set.push_back( new double[4] ); // a photon comes here, otherwise, unused p1 = new double[4]; p2 = new double[4]; p3 = new double[4]; p4 = new double[4]; p5 = new double[4]; id1 = 10000; id2 = 10000; id3 = 10000; id4 = 10000; id5 = 10000; id_set.push_back( id1 ); id_set.push_back( id2 ); id_set.push_back( id3 ); id_set.push_back( id4 ); id_set.push_back( id5 ); pl1_internal = NULL; pl2_internal = NULL; pl3_internal = NULL; pl4_internal = NULL; pA1_internal = NULL; Parameters_Are_Loaded = false; } MEKD_MG::~MEKD_MG() { if( Parameters_Are_Loaded ) Unload_pdfreader(); p_set.clear(); id_set.clear(); } int MEKD_MG::Load_Parameters() { Set_Of_Model_Parameters.read_slha_file( Parameter_file ); /// Initializing parameters // ZZ ME_Background_ZZ_qq_UpType_SF.initProc( Parameter_file ); ME_Background_ZZ_qq_UpType_OF.initProc( Parameter_file ); ME_Background_ZZ_qq_DownType_SF.initProc( Parameter_file ); ME_Background_ZZ_qq_DownType_OF.initProc( Parameter_file ); ME_Background_ZZ_qq_UpType_SFpA.initProc( Parameter_file ); ME_Background_ZZ_qq_UpType_OFpA.initProc( Parameter_file ); ME_Background_ZZ_qq_DownType_SFpA.initProc( Parameter_file ); ME_Background_ZZ_qq_DownType_OFpA.initProc( Parameter_file ); ME_Signal_Spin0_gg_SF.initProc( Parameter_file ); ME_Signal_Spin0_gg_OF.initProc( Parameter_file ); ME_Signal_Spin0_gg_SFpA.initProc( Parameter_file ); ME_Signal_Spin0_gg_OFpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_SF.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_OF.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_SF.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_OF.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_SFpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_OFpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_SFpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_OFpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_SF.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_OF.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_SF.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_OF.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_SFpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_OFpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_SFpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_OFpA.initProc( Parameter_file ); ME_Signal_Spin2_gg_SF.initProc( Parameter_file ); ME_Signal_Spin2_gg_OF.initProc( Parameter_file ); ME_Signal_Spin2_gg_SFpA.initProc( Parameter_file ); ME_Signal_Spin2_gg_OFpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_SF.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_OF.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_SF.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_OF.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_SFpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_OFpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_SFpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_OFpA.initProc( Parameter_file ); // 2mu ME_Background_DY_qq_UpType_2l.initProc( Parameter_file ); ME_Background_DY_qq_DownType_2l.initProc( Parameter_file ); ME_Background_DY_qq_UpType_2lpA.initProc( Parameter_file ); ME_Background_DY_qq_DownType_2lpA.initProc( Parameter_file ); ME_Signal_Spin0_gg_2l.initProc( Parameter_file ); ME_Signal_Spin0_gg_2lpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_2l.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_2l.initProc( Parameter_file ); ME_Signal_Spin0_qq_DownType_2lpA.initProc( Parameter_file ); ME_Signal_Spin0_qq_UpType_2lpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_2l.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_2l.initProc( Parameter_file ); ME_Signal_Spin1_qq_DownType_2lpA.initProc( Parameter_file ); ME_Signal_Spin1_qq_UpType_2lpA.initProc( Parameter_file ); ME_Signal_Spin2_gg_2l.initProc( Parameter_file ); ME_Signal_Spin2_gg_2lpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_2l.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_2l.initProc( Parameter_file ); ME_Signal_Spin2_qq_DownType_2lpA.initProc( Parameter_file ); ME_Signal_Spin2_qq_UpType_2lpA.initProc( Parameter_file ); params_m_d = Set_Of_Model_Parameters.get_block_entry( "mass", 1, 0 ); params_m_u = Set_Of_Model_Parameters.get_block_entry( "mass", 2, 0 ); params_m_s = Set_Of_Model_Parameters.get_block_entry( "mass", 3, 0 ); params_m_c = Set_Of_Model_Parameters.get_block_entry( "mass", 4, 0 ); params_m_e = Set_Of_Model_Parameters.get_block_entry( "mass", 11, 0 ); params_m_mu = Set_Of_Model_Parameters.get_block_entry( "mass", 13, 0 ); params_m_Z = Set_Of_Model_Parameters.get_block_entry( "mass", 23, 9.11876e+01 ); params_rhou11 = Set_Of_Model_Parameters.get_block_entry( "heff", 9, 0 ); params_rhou12 = Set_Of_Model_Parameters.get_block_entry( "heff", 10, 0 ); params_rhoc11 = Set_Of_Model_Parameters.get_block_entry( "heff", 11, 0 ); params_rhoc12 = Set_Of_Model_Parameters.get_block_entry( "heff", 12, 0 ); params_rhod11 = Set_Of_Model_Parameters.get_block_entry( "heff", 13, 0 ); params_rhod12 = Set_Of_Model_Parameters.get_block_entry( "heff", 14, 0 ); params_rhos11 = Set_Of_Model_Parameters.get_block_entry( "heff", 15, 0 ); params_rhos12 = Set_Of_Model_Parameters.get_block_entry( "heff", 16, 0 ); params_rhob11 = Set_Of_Model_Parameters.get_block_entry( "heff", 17, 0 ); params_rhob12 = Set_Of_Model_Parameters.get_block_entry( "heff", 18, 0 ); params_rhou11 = Set_Of_Model_Parameters.get_block_entry( "vec", 3, 0 ); params_rhou12 = Set_Of_Model_Parameters.get_block_entry( "vec", 4, 0 ); params_rhou13 = Set_Of_Model_Parameters.get_block_entry( "vec", 5, 0 ); params_rhou14 = Set_Of_Model_Parameters.get_block_entry( "vec", 6, 0 ); params_rhoc11 = Set_Of_Model_Parameters.get_block_entry( "vec", 7, 0 ); params_rhoc12 = Set_Of_Model_Parameters.get_block_entry( "vec", 8, 0 ); params_rhoc13 = Set_Of_Model_Parameters.get_block_entry( "vec", 9, 0 ); params_rhoc14 = Set_Of_Model_Parameters.get_block_entry( "vec", 10, 0 ); params_rhod11 = Set_Of_Model_Parameters.get_block_entry( "vec", 11, 0 ); params_rhod12 = Set_Of_Model_Parameters.get_block_entry( "vec", 12, 0 ); params_rhod13 = Set_Of_Model_Parameters.get_block_entry( "vec", 13, 0 ); params_rhod14 = Set_Of_Model_Parameters.get_block_entry( "vec", 14, 0 ); params_rhos11 = Set_Of_Model_Parameters.get_block_entry( "vec", 15, 0 ); params_rhos12 = Set_Of_Model_Parameters.get_block_entry( "vec", 16, 0 ); params_rhos13 = Set_Of_Model_Parameters.get_block_entry( "vec", 17, 0 ); params_rhos14 = Set_Of_Model_Parameters.get_block_entry( "vec", 18, 0 ); params_rhob11 = Set_Of_Model_Parameters.get_block_entry( "vec", 19, 0 ); params_rhob12 = Set_Of_Model_Parameters.get_block_entry( "vec", 20, 0 ); params_rhob13 = Set_Of_Model_Parameters.get_block_entry( "vec", 21, 0 ); params_rhob14 = Set_Of_Model_Parameters.get_block_entry( "vec", 22, 0 ); params_rhou21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 21, 0 ); params_rhou22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 22, 0 ); params_rhou23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 23, 0 ); params_rhou24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 24, 0 ); params_rhoc21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 25, 0 ); params_rhoc22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 26, 0 ); params_rhoc23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 27, 0 ); params_rhoc24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 28, 0 ); params_rhod21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 29, 0 ); params_rhod22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 30, 0 ); params_rhod23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 31, 0 ); params_rhod24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 32, 0 ); params_rhos21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 33, 0 ); params_rhos22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 34, 0 ); params_rhos23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 35, 0 ); params_rhos24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 36, 0 ); params_rhob21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 37, 0 ); params_rhob22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 38, 0 ); params_rhob23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 39, 0 ); params_rhob24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 40, 0 ); v_expectation = 1/sqrt( sqrt(2)*Set_Of_Model_Parameters.get_block_entry( "sminputs", 2, 1.166370e-05 ) ); hZZ_coupling = 2*params_m_Z*params_m_Z/v_expectation; Load_pdfreader( const_cast<char*>(PDF_file.c_str()) ); Parameters_Are_Loaded = true; return 0; } int MEKD_MG::Reload_Parameters() { if( !Parameters_Are_Loaded ) return 1; Set_Of_Model_Parameters.read_slha_file( static_cast<string>(Parameter_file) ); params_m_d = Set_Of_Model_Parameters.get_block_entry( "mass", 1, 0 ); params_m_u = Set_Of_Model_Parameters.get_block_entry( "mass", 2, 0 ); params_m_s = Set_Of_Model_Parameters.get_block_entry( "mass", 3, 0 ); params_m_c = Set_Of_Model_Parameters.get_block_entry( "mass", 4, 0 ); params_m_e = Set_Of_Model_Parameters.get_block_entry( "mass", 11, 0 ); params_m_mu = Set_Of_Model_Parameters.get_block_entry( "mass", 13, 0 ); params_m_Z = Set_Of_Model_Parameters.get_block_entry( "mass", 23, 9.11876e+01 ); params_rhou11 = Set_Of_Model_Parameters.get_block_entry( "vec", 3, 0 ); params_rhou12 = Set_Of_Model_Parameters.get_block_entry( "vec", 4, 0 ); params_rhou13 = Set_Of_Model_Parameters.get_block_entry( "vec", 5, 0 ); params_rhou14 = Set_Of_Model_Parameters.get_block_entry( "vec", 6, 0 ); params_rhoc11 = Set_Of_Model_Parameters.get_block_entry( "vec", 7, 0 ); params_rhoc12 = Set_Of_Model_Parameters.get_block_entry( "vec", 8, 0 ); params_rhoc13 = Set_Of_Model_Parameters.get_block_entry( "vec", 9, 0 ); params_rhoc14 = Set_Of_Model_Parameters.get_block_entry( "vec", 10, 0 ); params_rhod11 = Set_Of_Model_Parameters.get_block_entry( "vec", 11, 0 ); params_rhod12 = Set_Of_Model_Parameters.get_block_entry( "vec", 12, 0 ); params_rhod13 = Set_Of_Model_Parameters.get_block_entry( "vec", 13, 0 ); params_rhod14 = Set_Of_Model_Parameters.get_block_entry( "vec", 14, 0 ); params_rhos11 = Set_Of_Model_Parameters.get_block_entry( "vec", 15, 0 ); params_rhos12 = Set_Of_Model_Parameters.get_block_entry( "vec", 16, 0 ); params_rhos13 = Set_Of_Model_Parameters.get_block_entry( "vec", 17, 0 ); params_rhos14 = Set_Of_Model_Parameters.get_block_entry( "vec", 18, 0 ); params_rhob11 = Set_Of_Model_Parameters.get_block_entry( "vec", 19, 0 ); params_rhob12 = Set_Of_Model_Parameters.get_block_entry( "vec", 20, 0 ); params_rhob13 = Set_Of_Model_Parameters.get_block_entry( "vec", 21, 0 ); params_rhob14 = Set_Of_Model_Parameters.get_block_entry( "vec", 22, 0 ); params_rhou11 = Set_Of_Model_Parameters.get_block_entry( "heff", 9, 0 ); params_rhou12 = Set_Of_Model_Parameters.get_block_entry( "heff", 10, 0 ); params_rhoc11 = Set_Of_Model_Parameters.get_block_entry( "heff", 11, 0 ); params_rhoc12 = Set_Of_Model_Parameters.get_block_entry( "heff", 12, 0 ); params_rhod11 = Set_Of_Model_Parameters.get_block_entry( "heff", 13, 0 ); params_rhod12 = Set_Of_Model_Parameters.get_block_entry( "heff", 14, 0 ); params_rhos11 = Set_Of_Model_Parameters.get_block_entry( "heff", 15, 0 ); params_rhos12 = Set_Of_Model_Parameters.get_block_entry( "heff", 16, 0 ); params_rhob11 = Set_Of_Model_Parameters.get_block_entry( "heff", 17, 0 ); params_rhob12 = Set_Of_Model_Parameters.get_block_entry( "heff", 18, 0 ); params_rhou21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 21, 0 ); params_rhou22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 22, 0 ); params_rhou23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 23, 0 ); params_rhou24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 24, 0 ); params_rhoc21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 25, 0 ); params_rhoc22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 26, 0 ); params_rhoc23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 27, 0 ); params_rhoc24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 28, 0 ); params_rhod21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 29, 0 ); params_rhod22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 30, 0 ); params_rhod23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 31, 0 ); params_rhod24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 32, 0 ); params_rhos21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 33, 0 ); params_rhos22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 34, 0 ); params_rhos23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 35, 0 ); params_rhos24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 36, 0 ); params_rhob21 = Set_Of_Model_Parameters.get_block_entry( "gravity", 37, 0 ); params_rhob22 = Set_Of_Model_Parameters.get_block_entry( "gravity", 38, 0 ); params_rhob23 = Set_Of_Model_Parameters.get_block_entry( "gravity", 39, 0 ); params_rhob24 = Set_Of_Model_Parameters.get_block_entry( "gravity", 40, 0 ); v_expectation = 1/sqrt( sqrt(2)*Set_Of_Model_Parameters.get_block_entry( "sminputs", 2, 1.166370e-05 ) ); hZZ_coupling = 2*params_m_Z*params_m_Z/v_expectation; Unload_pdfreader(); Load_pdfreader( const_cast<char*>(PDF_file.c_str()) ); return 0; } void MEKD_MG::Set_Default_MEKD_MG_Parameters() { Boost_To_CM = true; // for a boosted data Debug_Mode = false; // Enable debugging mode // Force_g3_running = false; // unused. At some point was included for alpha_QCD Overwrite_e_and_mu_masses = false; // switch for manual m_e, m_mu masses Use_mh_eq_m4l = true; // Set mh to m4l for every event Use_Higgs_width = true; // if false, width is fixed to =1 Use_PDF_w_pT0 = true; // Use PDFs in the pT=0 frame. If true, Boost_To_CM is ignored Vary_signal_couplings = true; // Allow couplings to change with mass Warning_Mode = true; // Print warnings ContributionCoeff_d = 0; //42 /// the value has no effect if PDF is used but the variable is always used ContributionCoeff_u = 1; //217 ContributionCoeff_s = 0; //5 ContributionCoeff_c = 0; //3 // GG=0; // Assign QCD coupling, force g3 running if needed Sqrt_s = 8000; //Max energy, collision energy Electron_mass = 0; //0.0005109989, for enabled overwriting Higgs_mass = 125; // Works only if Use_mh_eq_m4l=false Higgs_width = 5.753088e-03; // Practically not used, for future implementations Muon_mass = 0; //0.10565837, for enabled overwriting Proton_mass = 0.93827205; // Always used if needed Final_state = "2e2m"; // Final state, for the moment: 4e, 4mu, 2e2mu Resonance_decay_mode = "ZZ"; // default: ZZ. Alternatives: 2mu Test_Model = "1"; // 0 or Custon; 1 or SMHiggs; 2 or CPoddScalar; 3 or CPevenScalar #ifndef MEKD_STANDALONE string inputParameterFile = "ZZMatrixElement/MEKD/src/Cards/param_card.dat"; // Location where a parameter card is stored string inputPDFFile = "ZZMatrixElement/MEKD/src/PDFTables/cteq6l.pdt"; // PDF/PDT table file edm::FileInPath parameterFileWithFullPath(inputParameterFile); edm::FileInPath pdfFileWithFullPath(inputPDFFile); Parameter_file = parameterFileWithFullPath.fullPath(); PDF_file = pdfFileWithFullPath.fullPath(); #else Parameter_file = "../src/Cards/param_card.dat"; // Location where a parameter card is stored PDF_file = "../src/PDFTables/cteq6l.pdt"; // PDF/PDT table file #endif } int MEKD_MG::Run_MEKD_MG() { if( !Parameters_Are_Loaded ) Load_Parameters(); if( Arrange_Internal_pls() == 1 ) { cerr << "Particle id error. Exiting.\n"; exit(1); } double CollisionE; PDFx1 = 0; PDFx2 = 0; Background_ME = 0; Signal_ME = 0; if( Overwrite_e_and_mu_masses ) { Set_Of_Model_Parameters.set_block_entry( "mass", 11, Electron_mass ); Set_Of_Model_Parameters.set_block_entry( "mass", 13, Muon_mass ); params_m_e = Electron_mass; params_m_mu = Muon_mass; } if( Final_state == "4e" || Final_state == "4eA" ) { ml1=Set_Of_Model_Parameters.get_block_entry( "mass", 11, Electron_mass ); ml2=ml1; ml3=ml1; ml4=ml1; } if( Final_state == "4m" || Final_state == "4mu" || Final_state == "4mA" || Final_state == "4muA" ) { ml1=Set_Of_Model_Parameters.get_block_entry( "mass", 13, Muon_mass ); ml2=ml1; ml3=ml1; ml4=ml1; } if( Final_state == "2e2m" || Final_state == "2e2mu" || Final_state == "2e2mA" || Final_state == "2e2muA" ) { ml1=Set_Of_Model_Parameters.get_block_entry( "mass", 11, Electron_mass ); ml2=ml1; ml3=Set_Of_Model_Parameters.get_block_entry( "mass", 13, Muon_mass ); ml4=ml3; } if( Final_state == "2m" || Final_state == "2mu" || Final_state == "2mA" || Final_state == "2muA" ) { ml1=Set_Of_Model_Parameters.get_block_entry( "mass", 13, Muon_mass ); ml2=ml1; ml3=0; ml4=0; } /// No boosting setup for initial partons for( int i=0; i<4; i++ ) { p_set[0][i] = 0; p_set[1][i] = 0; if( pl1_internal == NULL ) p_set[2][i] = 0; else p_set[2][i] = pl1_internal[i]; if( pl2_internal == NULL ) p_set[3][i] = 0; else p_set[3][i] = pl2_internal[i]; if( pl3_internal == NULL ) p_set[4][i] = 0; else p_set[4][i] = pl3_internal[i]; if( pl4_internal == NULL ) p_set[5][i] = 0; else p_set[5][i] = pl4_internal[i]; if( pA1_internal == NULL ) p_set[6][i] = 0; else p_set[6][i] = pA1_internal[i]; } PDFx1 = ( (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) + (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) )/Sqrt_s; PDFx2 = ( (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) - (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) )/Sqrt_s; // 0 mass approximation p_set[0][0] = 0.5*PDFx1*Sqrt_s; p_set[0][1] = 0; p_set[0][2] = 0; p_set[0][3] = 0.5*PDFx1*Sqrt_s; // to be updated p_set[1][0] = 0.5*PDFx2*Sqrt_s; p_set[1][1] = 0; p_set[1][2] = 0; p_set[1][3] = -0.5*PDFx2*Sqrt_s; // to be updated /// Calculate values needed for the PDF in the pT=0 frame if( Use_PDF_w_pT0 ) { p_set[0][0] = Sqrt_s/2; p_set[1][0] = Sqrt_s/2; // p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - Proton_mass*Proton_mass ); // p_set[1][3] = -p_set[0][3]; // /// Using forward-beam approximation // Boost_4p_and_2p_2_pT0( ml1, p_set[2], ml2, p_set[3], ml3, p_set[4], ml4, p_set[5], Proton_mass, p_set[0], Proton_mass, p_set[1] ); // Boost_4p_2_pT0( ml1, p_set[2], ml2, p_set[3], ml3, p_set[4], ml4, p_set[5] ); Boost_5p_2_pT0( ml1, p_set[2], ml2, p_set[3], ml3, p_set[4], ml4, p_set[5], 0, p_set[6] ); PDFx1 = ( (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) + (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) )/( 2*p_set[0][0] ); PDFx2 = ( (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) - (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) )/( 2*p_set[0][0] ); /// Setting up partons p_set[0][0]*= PDFx1; p_set[0][1] = 0; p_set[0][2] = 0; p_set[0][3] = 0; // to be updated p_set[1][0]*= PDFx2; p_set[1][1] = 0; p_set[1][2] = 0; p_set[1][3] = 0; // to be updated if( Debug_Mode ) { printf( "Coefficients for PDF ( x1, x2 ): ( %.10E, %.10E )\n", PDFx1, PDFx2 ); } } /// If flag is true, boost to CM frame iff PDF is NOT included. if( Boost_To_CM && !Use_PDF_w_pT0 ) { // Boost2CM( ml1, p_set[2], ml2, p_set[3], ml3, p_set[4], ml4, p_set[5] ); Boost2CM( ml1, p_set[2], ml2, p_set[3], ml3, p_set[4], ml4, p_set[5], 0, p_set[6] ); CollisionE = p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]; p_set[0][0] = CollisionE/2; p_set[1][0] = CollisionE/2; } Mass_4l = sqrt( (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0])*(p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) - (p_set[2][1]+p_set[3][1]+p_set[4][1]+p_set[5][1]+p_set[6][1])*(p_set[2][1]+p_set[3][1]+p_set[4][1]+p_set[5][1]+p_set[6][1]) - (p_set[2][2]+p_set[3][2]+p_set[4][2]+p_set[5][2]+p_set[6][2])*(p_set[2][2]+p_set[3][2]+p_set[4][2]+p_set[5][2]+p_set[6][2]) - (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3])*(p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) ); /// Pick quark flavors to use if PDFs are not set. Normalizing coefficients here. if( !Use_PDF_w_pT0 ) { buffer = new double; (*buffer) = ( ContributionCoeff_d+ContributionCoeff_u+ContributionCoeff_s+ContributionCoeff_c ); ContributionCoeff_d = (ContributionCoeff_d)/(*buffer); ContributionCoeff_u = (ContributionCoeff_u)/(*buffer); ContributionCoeff_c = (ContributionCoeff_c)/(*buffer); ContributionCoeff_s = (ContributionCoeff_s)/(*buffer); delete buffer; } if( Debug_Mode ) { printf( "Energy of Parton 1: %.10E\nEnergy of Parton 2: %.10E\n", p_set[0][0], p_set[1][0] ); printf( "Final-state four-momenta entering ME (E px py px):\n" ); printf( "%.10E %.10E %.10E %.10E\n", p_set[2][0], p_set[2][1], p_set[2][2], p_set[2][3] ); printf( "%.10E %.10E %.10E %.10E\n", p_set[3][0], p_set[3][1], p_set[3][2], p_set[3][3] ); printf( "%.10E %.10E %.10E %.10E\n", p_set[4][0], p_set[4][1], p_set[4][2], p_set[4][3] ); printf( "%.10E %.10E %.10E %.10E\n", p_set[5][0], p_set[5][1], p_set[5][2], p_set[5][3] ); printf( "%.10E %.10E %.10E %.10E\n", p_set[6][0], p_set[6][1], p_set[6][2], p_set[6][3] ); printf( "Sum px=%.10E\n", (p_set[2][1]+p_set[3][1]+p_set[4][1]+p_set[5][1]+p_set[6][1]) ); printf( "Sum py=%.10E\n", (p_set[2][2]+p_set[3][2]+p_set[4][2]+p_set[5][2]+p_set[6][2]) ); printf( "Sum pz=%.10E\n", (p_set[2][3]+p_set[3][3]+p_set[4][3]+p_set[5][3]+p_set[6][3]) ); printf( "Sum E=%.10E\n", (p_set[2][0]+p_set[3][0]+p_set[4][0]+p_set[5][0]+p_set[6][0]) ); } /// Resonance mode alert if( Warning_Mode && Resonance_decay_mode == "ZZ" ) { if( Final_state!="4e" && Final_state!="4eA" && Final_state!="2e2m" && Final_state!="2e2mu" && Final_state!="2e2mA" && Final_state!="2e2muA" && Final_state!="4m" && Final_state!="4mu" && Final_state!="4mA" && Final_state!="4muA") cout << "WARNING! A mismatch between the resonance mode and the expected final state. Priority: final state.\n"; } if( Warning_Mode && Resonance_decay_mode == "2mu" ) { if( Final_state!="2m" && Final_state!="2mu" && Final_state!="2mA" && Final_state!="2muA" ) cout << "WARNING! A mismatch between the resonance mode and the expected final state. Priority: final state.\n"; } /// Background is interesting in any case, except for the Signal Runs if( Test_Model[0]!='!' ) Run_MEKD_MG_ME_BKG(); /// Signal ME(s) is(are) chosen here if( Test_Models.size() > 0 && Test_Model[0]!='!' ) { Signal_MEs.clear(); for( unsigned int i=0; i<Test_Models.size(); i++) { if( Test_Models[i]=="-1" || Test_Models[i]=="ZZ" || Test_Models[i]=="DY" ) { Run_MEKD_MG_ME_BKG(); Signal_ME=Background_ME; } if( Test_Models[i]=="0" || Test_Models[i]=="Custom" ) Run_MEKD_MG_ME_Custom(); if( Test_Models[i]=="1" || Test_Models[i]=="SMHiggs" || Test_Models[i]=="Higgs" || Test_Models[i]=="Spin0SMH" || Test_Models[i]=="ggSpin0SMH" || Test_Models[i]=="ggSpin0Pm" ) Run_MEKD_MG_ME_ggSMHiggs(); if( Test_Models[i]=="2" || Test_Models[i]=="CPoddScalar" || Test_Models[i]=="CP-odd" || Test_Models[i]=="Spin0M" || Test_Models[i]=="ggSpin0M" ) Run_MEKD_MG_ME_ggSpin0M(); if( Test_Models[i]=="3" || Test_Models[i]=="Spin0PH" || Test_Models[i]=="Spin0Ph" || Test_Models[i]=="ggSpin0Ph" ) Run_MEKD_MG_ME_ggSpin0Ph(); if( Test_Models[i]=="4" || Test_Models[i]=="Spin1particle" || Test_Models[i]=="Spin1M" || Test_Models[i]=="qqSpin1M" ) Run_MEKD_MG_ME_Spin1M(); if( Test_Models[i]=="5" || Test_Models[i]=="Spin1P" || Test_Models[i]=="qqSpin1P" ) Run_MEKD_MG_ME_Spin1P(); if( Test_Models[i]=="6" || Test_Models[i]=="Spin2particle" || Test_Models[i]=="Spin2Pm" || Test_Models[i]=="ggSpin2Pm" ) Run_MEKD_MG_ME_ggSpin2Pm(); if( Test_Models[i]=="7" || Test_Models[i]=="qqSpin2Pm" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Models[i]=="8" || Test_Models[i]=="CPevenScalar" || Test_Models[i]=="CP-even" ) Run_MEKD_MG_ME_CPevenScalar(); if( Test_Models[i]=="9" || Test_Models[i]=="ggSpin2Ph" ) Run_MEKD_MG_ME_ggSpin2Ph(); if( Test_Models[i]=="10" || Test_Models[i]=="ggSpin2Mh" ) Run_MEKD_MG_ME_ggSpin2Mh(); if( Test_Models[i]=="11" || Test_Models[i]=="ggSpin2Pb" ) Run_MEKD_MG_ME_ggSpin2Pb(); if( Test_Models[i]=="12" || Test_Models[i]=="qqSpin2Ph" ) Run_MEKD_MG_ME_qqSpin2Ph(); if( Test_Models[i]=="13" || Test_Models[i]=="qqSpin2Mh" ) Run_MEKD_MG_ME_qqSpin2Mh(); if( Test_Models[i]=="14" || Test_Models[i]=="qqSpin2Pb" ) Run_MEKD_MG_ME_qqSpin2Pb(); Signal_MEs.push_back( Signal_ME ); } } else { if( Test_Model=="-1" || Test_Model=="ZZ" || Test_Model=="DY" || Test_Model=="!-1" || Test_Model=="!ZZ" || Test_Model=="!DY" ) { Run_MEKD_MG_ME_BKG(); Signal_ME=Background_ME; } if( Test_Model=="0" || Test_Model=="Custom" || Test_Model=="!0" || Test_Model=="!Custom" ) Run_MEKD_MG_ME_Custom(); if( Test_Model=="1" || Test_Model=="SMHiggs" || Test_Model=="Higgs" || Test_Model=="Spin0SMH" || Test_Model=="ggSpin0SMH" || Test_Model=="ggSpin0Pm" || Test_Model=="!1" || Test_Model=="!SMHiggs" || Test_Model=="!Higgs" || Test_Model=="!Spin0SMH" || Test_Model=="!ggSpin0SMH" || Test_Model=="!ggSpin0Pm" ) Run_MEKD_MG_ME_ggSMHiggs(); if( Test_Model=="2" || Test_Model=="CPoddScalar" || Test_Model=="CP-odd" || Test_Model=="Spin0M" || Test_Model=="ggSpin0M" || Test_Model=="!2" || Test_Model=="!CPoddScalar" || Test_Model=="!CP-odd" || Test_Model=="!Spin0M" || Test_Model=="!ggSpin0M" ) Run_MEKD_MG_ME_ggSpin0M(); if( Test_Model=="3" || Test_Model=="Spin0PH" || Test_Model=="Spin0Ph" || Test_Model=="ggSpin0Ph" || Test_Model=="!3" || Test_Model=="!Spin0PH" || Test_Model=="!Spin0Ph" || Test_Model=="!ggSpin0Ph" ) Run_MEKD_MG_ME_ggSpin0Ph(); if( Test_Model=="4" || Test_Model=="Spin1particle" || Test_Model=="Spin1M" || Test_Model=="qqSpin1M" || Test_Model=="!4" || Test_Model=="!Spin1particle" || Test_Model=="!Spin1M" || Test_Model=="!qqSpin1M" ) Run_MEKD_MG_ME_Spin1M(); if( Test_Model=="5" || Test_Model=="Spin1P" || Test_Model=="qqSpin1P" || Test_Model=="!5" || Test_Model=="!Spin1P" || Test_Model=="!qqSpin1P" ) Run_MEKD_MG_ME_Spin1P(); if( Test_Model=="6" || Test_Model=="Spin2particle" || Test_Model=="Spin2Pm" || Test_Model=="ggSpin2Pm" || Test_Model=="!6" || Test_Model=="!Spin2particle" || Test_Model=="!Spin2Pm" || Test_Model=="!ggSpin2Pm" ) Run_MEKD_MG_ME_ggSpin2Pm(); if( Test_Model=="7" || Test_Model=="qqSpin2Pm" || Test_Model=="!7" || Test_Model=="!qqSpin2Pm" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="8" || Test_Model=="CPevenScalar" || Test_Model=="CP-even" || Test_Model=="!8" || Test_Model=="!CPevenScalar" || Test_Model=="!CP-even" ) Run_MEKD_MG_ME_CPevenScalar(); if( Test_Model=="9" || Test_Model=="ggSpin2Ph" || Test_Model=="!9" || Test_Model=="!ggSpin2Ph" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="10" || Test_Model=="ggSpin2Mh" || Test_Model=="!10" || Test_Model=="!ggSpin2Mh" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="11" || Test_Model=="ggSpin2Pb" || Test_Model=="!11" || Test_Model=="!ggSpin2Pb" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="12" || Test_Model=="qqSpin2Ph" || Test_Model=="!12" || Test_Model=="!qqSpin2Ph" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="13" || Test_Model=="qqSpin2Mh" || Test_Model=="!13" || Test_Model=="!qqSpin2Mh" ) Run_MEKD_MG_ME_qqSpin2Pm(); if( Test_Model=="14" || Test_Model=="qqSpin2Pb" || Test_Model=="!14" || Test_Model=="!qqSpin2Pb" ) Run_MEKD_MG_ME_qqSpin2Pm(); } if( Test_Model[0]!='!' ) KD = log( Signal_ME/Background_ME ); return 0; } int MEKD_MG::Run_MEKD_MG(string Input_Model) { buffer_string = Test_Model; Test_Model = "!"; Test_Model += Input_Model; error_value = Run_MEKD_MG(); Test_Model = buffer_string; return error_value; } ///#include "MEKD_MG_RunMEs.cpp" /////////////////////////////////// /// INCLUDED MEKD_MG_RunMEs.cpp /// /// code follows below /// /// /// /// Part responsible for ME /// /// calculations /// /////////////////////////////////// int MEKD_MG::Run_MEKD_MG_ME_BKG() { return Run_MEKD_MG_MEs_BKG( "qq" ); } int MEKD_MG::Run_MEKD_MG_ME_Custom() { if( (error_value=Run_MEKD_MG_MEs_SIG_Spin0( "gg" ))!=0 ) return error_value; buffer_Custom = Signal_ME; if( (error_value=Run_MEKD_MG_MEs_SIG_Spin1( "qq" ))!=0 ) return error_value; buffer_Custom += Signal_ME; if( (error_value=Run_MEKD_MG_MEs_SIG_Spin2( "gg" ))!=0 ) return error_value; buffer_Custom += Signal_ME; if( (error_value=Run_MEKD_MG_MEs_SIG_Spin2( "qq" ))!=0 ) return error_value; Signal_ME += buffer_Custom; return 0; } int MEKD_MG::Run_MEKD_MG_ME_ggSMHiggs() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Mass_4l) ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, hZZ_coupling ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Higgs_mass) ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, hZZ_coupling ); } } Set_Of_Model_Parameters.set_block_entry( "heff", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 8, 0 ); params_rhou01 = 0; params_rhou02 = 0; params_rhoc01 = 0; params_rhoc02 = 0; params_rhod01 = 0; params_rhod02 = 0; params_rhos01 = 0; params_rhos02 = 0; params_rhob01 = 0; params_rhob02 = 0; return Run_MEKD_MG_MEs_SIG_Spin0( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin0M() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 4, 4*LmbdGG(Mass_4l)*sqrt(3) ); Set_Of_Model_Parameters.set_block_entry( "heff", 8, 2*hZZ_coupling/params_m_Z/params_m_Z*sqrt(3) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 4, 4*LmbdGG(Higgs_mass)*sqrt(3) ); Set_Of_Model_Parameters.set_block_entry( "heff", 8, 2*hZZ_coupling/params_m_Z/params_m_Z*sqrt(3) ); } } Set_Of_Model_Parameters.set_block_entry( "heff", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 7, 0 ); params_rhou01 = 0; params_rhou02 = 0; params_rhoc01 = 0; params_rhoc02 = 0; params_rhod01 = 0; params_rhod02 = 0; params_rhos01 = 0; params_rhos02 = 0; params_rhob01 = 0; params_rhob02 = 0; return Run_MEKD_MG_MEs_SIG_Spin0( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_CPevenScalar() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 1, 4*LmbdGG(Mass_4l)*Mass_4l*Mass_4l ); Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Mass_4l) ); Set_Of_Model_Parameters.set_block_entry( "heff", 3, 4*LmbdGG(Mass_4l)/Mass_4l/Mass_4l/Mass_4l/Mass_4l ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, hZZ_coupling ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 2*hZZ_coupling/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "heff", 7, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z/params_m_Z); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 1, 4*LmbdGG(Higgs_mass)*Higgs_mass*Higgs_mass ); Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Higgs_mass) ); Set_Of_Model_Parameters.set_block_entry( "heff", 3, 4*LmbdGG(Higgs_mass)/Higgs_mass/Higgs_mass ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, hZZ_coupling ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 2*hZZ_coupling/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "heff", 7, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z/params_m_Z ); } } Set_Of_Model_Parameters.set_block_entry( "heff", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 8, 0 ); params_rhou01 = 0; params_rhou02 = 0; params_rhoc01 = 0; params_rhoc02 = 0; params_rhod01 = 0; params_rhod02 = 0; params_rhos01 = 0; params_rhos02 = 0; params_rhob01 = 0; params_rhob02 = 0; return Run_MEKD_MG_MEs_SIG_Spin0( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin0Ph() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Mass_4l)*sqrt(3) ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 2*hZZ_coupling/params_m_Z/params_m_Z*sqrt(3) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000006, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000006, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "heff", 2, 4*LmbdGG(Higgs_mass)*sqrt(3) ); Set_Of_Model_Parameters.set_block_entry( "heff", 6, 2*hZZ_coupling/params_m_Z/params_m_Z*sqrt(3) ); } } Set_Of_Model_Parameters.set_block_entry( "heff", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "heff", 8, 0 ); params_rhou01 = 0; params_rhou02 = 0; params_rhoc01 = 0; params_rhoc02 = 0; params_rhod01 = 0; params_rhod02 = 0; params_rhos01 = 0; params_rhos02 = 0; params_rhob01 = 0; params_rhob02 = 0; return Run_MEKD_MG_MEs_SIG_Spin0( "gg" ); } /// A vector default configuration int MEKD_MG::Run_MEKD_MG_ME_Spin1M() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 300, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 300, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 300, 1 ); if( Vary_signal_couplings ) { params_rhod11 = LmbdGG(Mass_4l)*v_expectation; params_rhos11 = LmbdGG(Mass_4l)*v_expectation; params_rhob11 = LmbdGG(Mass_4l)*v_expectation; params_rhou11 = LmbdGG(Mass_4l)*v_expectation; params_rhoc11 = LmbdGG(Mass_4l)*v_expectation; Set_Of_Model_Parameters.set_block_entry( "vec", 1, hZZ_coupling/2/params_m_Z ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 300, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 300, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 300, 1 ); if( Vary_signal_couplings ) { params_rhod11 = LmbdGG(Higgs_mass)*v_expectation; params_rhos11 = LmbdGG(Higgs_mass)*v_expectation; params_rhob11 = LmbdGG(Higgs_mass)*v_expectation; params_rhou11 = LmbdGG(Higgs_mass)*v_expectation; params_rhoc11 = LmbdGG(Higgs_mass)*v_expectation; Set_Of_Model_Parameters.set_block_entry( "vec", 1, hZZ_coupling/2/params_m_Z ); } } Set_Of_Model_Parameters.set_block_entry( "vec", 2, 0 ); params_rhod12 = 0; params_rhod13 = 0; params_rhod14 = 0; params_rhos12 = 0; params_rhos13 = 0; params_rhos14 = 0; params_rhob12 = 0; params_rhob13 = 0; params_rhob14 = 0; params_rhou12 = 0; params_rhou13 = 0; params_rhou14 = 0; params_rhoc12 = 0; params_rhoc13 = 0; params_rhoc14 = 0; return Run_MEKD_MG_MEs_SIG_Spin1( "qq" ); } /// A pseudovector default configuration int MEKD_MG::Run_MEKD_MG_ME_Spin1P() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 300, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 300, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 300, 1 ); if( Vary_signal_couplings ) { params_rhod12 = LmbdGG(Mass_4l)*v_expectation; params_rhos12 = LmbdGG(Mass_4l)*v_expectation; params_rhob12 = LmbdGG(Mass_4l)*v_expectation; params_rhou12 = LmbdGG(Mass_4l)*v_expectation; params_rhoc12 = LmbdGG(Mass_4l)*v_expectation; Set_Of_Model_Parameters.set_block_entry( "vec", 2, hZZ_coupling/4/params_m_Z ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 300, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 300, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 300, 1 ); if( Vary_signal_couplings ) { params_rhod12 = LmbdGG(Higgs_mass)*v_expectation; params_rhos12 = LmbdGG(Higgs_mass)*v_expectation; params_rhob12 = LmbdGG(Higgs_mass)*v_expectation; params_rhou12 = LmbdGG(Higgs_mass)*v_expectation; params_rhoc12 = LmbdGG(Higgs_mass)*v_expectation; Set_Of_Model_Parameters.set_block_entry( "vec", 2, hZZ_coupling/4/params_m_Z ); } } Set_Of_Model_Parameters.set_block_entry( "vec", 1, 0 ); params_rhod11 = 0; params_rhod13 = 0; params_rhod14 = 0; params_rhos11 = 0; params_rhos13 = 0; params_rhos14 = 0; params_rhob11 = 0; params_rhob13 = 0; params_rhob14 = 0; params_rhou11 = 0; params_rhou13 = 0; params_rhou14 = 0; params_rhoc11 = 0; params_rhoc13 = 0; params_rhoc14 = 0; return Run_MEKD_MG_MEs_SIG_Spin1( "qq" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin2Pm() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Mass_4l) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Higgs_mass) ); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, -hZZ_coupling/sqrt(2)/params_m_Z/params_m_Z ); // to match model: sqrt(2) -> 2 but numbers will go too low Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, hZZ_coupling/sqrt(2) ); // to match model: sqrt(2) -> 2 but numbers will go too low Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin2Ph() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Mass_4l) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Higgs_mass) ); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin2Mh() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Mass_4l) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Higgs_mass) ); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_ggSpin2Pb() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Mass_4l) ); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 4*LmbdGG(Higgs_mass) ); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, hZZ_coupling ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "gg" ); } int MEKD_MG::Run_MEKD_MG_ME_qqSpin2Pm() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Mass_4l); params_rhos21 = LmbdGG(Mass_4l); params_rhob21 = LmbdGG(Mass_4l); params_rhou21 = LmbdGG(Mass_4l); params_rhoc21 = LmbdGG(Mass_4l); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Higgs_mass); params_rhos21 = LmbdGG(Higgs_mass); params_rhob21 = LmbdGG(Higgs_mass); params_rhou21 = LmbdGG(Higgs_mass); params_rhoc21 = LmbdGG(Higgs_mass); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, -hZZ_coupling/2/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, hZZ_coupling/2 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); // params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; // params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; // params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; // params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; // params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "qq" ); } int MEKD_MG::Run_MEKD_MG_ME_qqSpin2Ph() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Mass_4l); params_rhos21 = LmbdGG(Mass_4l); params_rhob21 = LmbdGG(Mass_4l); params_rhou21 = LmbdGG(Mass_4l); params_rhoc21 = LmbdGG(Mass_4l); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Higgs_mass); params_rhos21 = LmbdGG(Higgs_mass); params_rhob21 = LmbdGG(Higgs_mass); params_rhou21 = LmbdGG(Higgs_mass); params_rhoc21 = LmbdGG(Higgs_mass); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); // params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; // params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; // params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; // params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; // params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "qq" ); } int MEKD_MG::Run_MEKD_MG_ME_qqSpin2Mh() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod22 = LmbdGG(Mass_4l); params_rhos22 = LmbdGG(Mass_4l); params_rhob22 = LmbdGG(Mass_4l); params_rhou22 = LmbdGG(Mass_4l); params_rhoc22 = LmbdGG(Mass_4l); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod22 = LmbdGG(Higgs_mass); params_rhos22 = LmbdGG(Higgs_mass); params_rhob22 = LmbdGG(Higgs_mass); params_rhou22 = LmbdGG(Higgs_mass); params_rhoc22 = LmbdGG(Higgs_mass); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, hZZ_coupling/params_m_Z/params_m_Z/params_m_Z ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); params_rhod21 = 0; // params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; params_rhos21 = 0; // params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; params_rhos21 = 0; // params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; params_rhos21 = 0; // params_rhou22 = 0; params_rhou23 = 0; // params_rhou24 = 0; params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "qq" ); } int MEKD_MG::Run_MEKD_MG_ME_qqSpin2Pb() { if( Use_mh_eq_m4l ) { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Mass_4l ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, static_cast<double>( MEKD_CalcHEP_Extra::Higgs_width(Mass_4l) ) ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Mass_4l); params_rhos21 = LmbdGG(Mass_4l); params_rhob21 = LmbdGG(Mass_4l); params_rhou21 = LmbdGG(Mass_4l); params_rhoc21 = LmbdGG(Mass_4l); } } else { Set_Of_Model_Parameters.set_block_entry( "mass", 9000007, Higgs_mass ); if( Use_Higgs_width ) Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, Higgs_width ); else Set_Of_Model_Parameters.set_block_entry( "decay", 9000007, 1 ); if( Vary_signal_couplings ) { params_rhod21 = LmbdGG(Higgs_mass); params_rhos21 = LmbdGG(Higgs_mass); params_rhob21 = LmbdGG(Higgs_mass); params_rhou21 = LmbdGG(Higgs_mass); params_rhoc21 = LmbdGG(Higgs_mass); } } Set_Of_Model_Parameters.set_block_entry( "gravity", 1, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 2, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 3, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 4, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 5, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 6, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 7, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 8, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 9, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 10, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 11, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 12, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 13, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 14, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 15, hZZ_coupling ); Set_Of_Model_Parameters.set_block_entry( "gravity", 16, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 17, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 18, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 19, 0 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 20, 0 ); // params_rhod21 = 0; params_rhod22 = 0; params_rhod23 = 0; params_rhod24 = 0; // params_rhos21 = 0; params_rhos22 = 0; params_rhos23 = 0; params_rhos24 = 0; // params_rhos21 = 0; params_rhob22 = 0; params_rhob23 = 0; params_rhob24 = 0; // params_rhos21 = 0; params_rhou22 = 0; params_rhou23 = 0; params_rhou24 = 0; // params_rhos21 = 0; params_rhoc22 = 0; params_rhoc23 = 0; params_rhoc24 = 0; return Run_MEKD_MG_MEs_SIG_Spin2( "qq" ); } int MEKD_MG::Run_MEKD_MG_MEs_BKG(string initial_state) { if( Final_state=="4e" || Final_state=="4eA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_e ); if( Final_state=="4eA" ) return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "SF", false ); } if( Final_state=="2e2m" || Final_state=="2e2mu" || Final_state=="2e2mA" || Final_state=="2e2muA" ) { /// Common mass for the opposite-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 11, params_m_e ); Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2e2mA" || Final_state=="2e2muA" ) return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "OF", true ); return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "OF", false ); } if( Final_state=="4m" || Final_state=="4mu" || Final_state=="4mA" || Final_state=="4muA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="4mA" || Final_state=="4muA" ) return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "SF", false ); } if( Final_state=="2m" || Final_state=="2mu" || Final_state=="2mA" || Final_state=="2muA" ) { /// Mass for the muons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2mA" || Final_state=="2muA" ) return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "2l", true ); return Run_MEKD_MG_MEs_BKG_Sub( initial_state, "2l", false ); } return 1; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin0(string initial_state) { if( Final_state=="4e" || Final_state=="4eA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_e ); if( Final_state=="4eA" ) return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "SF", false ); } if( Final_state=="2e2m" || Final_state=="2e2mu" || Final_state=="2e2mA" || Final_state=="2e2muA" ) { /// Common mass for the opposite-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 11, params_m_e ); Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2e2mA" || Final_state=="2e2muA" ) return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "OF", true ); return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "OF", false ); } if( Final_state=="4m" || Final_state=="4mu" || Final_state=="4mA" || Final_state=="4muA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="4mA" || Final_state=="4muA" ) return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "SF", false ); } if( Final_state=="2m" || Final_state=="2mu" || Final_state=="2mA" || Final_state=="2muA" ) { /// Mass for the muons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2mA" || Final_state=="2muA" ) return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "2l", true ); return Run_MEKD_MG_MEs_SIG_Spin0_Sub( initial_state, "2l", false ); } return 1; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin1(string initial_state) { if( Final_state=="4e" || Final_state=="4eA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_e ); if( Final_state=="4eA" ) return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "SF", false ); } if( Final_state=="2e2m" || Final_state=="2e2mu" || Final_state=="2e2mA" || Final_state=="2e2muA" ) { /// Common mass for the opposite-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 11, params_m_e ); Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2e2mA" || Final_state=="2e2muA" ) return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "OF", true ); return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "OF", false ); } if( Final_state=="4m" || Final_state=="4mu" || Final_state=="4mA" || Final_state=="4muA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="4mA" || Final_state=="4muA" ) return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "SF", false ); } if( Final_state=="2m" || Final_state=="2mu" || Final_state=="2mA" || Final_state=="2muA" ) { /// Mass for the muons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2mA" || Final_state=="2muA" ) return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "2l", true ); return Run_MEKD_MG_MEs_SIG_Spin1_Sub( initial_state, "2l", false ); } return 1; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin2(string initial_state) { if( Final_state=="4e" || Final_state=="4eA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_e ); if( Final_state=="4eA" ) return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "SF", false ); } if( Final_state=="2e2m" || Final_state=="2e2mu" || Final_state=="2e2mA" || Final_state=="2e2muA" ) { /// Common mass for the opposite-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 11, params_m_e ); Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2e2mA" || Final_state=="2e2muA" ) return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "OF", true ); return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "OF", false ); } if( Final_state=="4m" || Final_state=="4mu" || Final_state=="4mA" || Final_state=="4muA" ) { /// Common mass for the same-flavor leptons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="4mA" || Final_state=="4muA" ) return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "SF", true ); return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "SF", false ); } if( Final_state=="2m" || Final_state=="2mu" || Final_state=="2mA" || Final_state=="2muA" ) { /// Mass for the muons Set_Of_Model_Parameters.set_block_entry( "mass", 13, params_m_mu ); if( Final_state=="2mA" || Final_state=="2muA" ) return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "2l", true ); return Run_MEKD_MG_MEs_SIG_Spin2_Sub( initial_state, "2l", false ); } return 1; } int MEKD_MG::Run_MEKD_MG_MEs_BKG_Sub(string initial_state, string flavor, bool photon) { if( initial_state=="qq" ) { /// Down quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_d ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_d*params_m_d ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_d*params_m_d ); if( flavor == "SF" && !photon ) { ME_Background_ZZ_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_SF.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Background_ZZ_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_OF.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Background_DY_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_DownType_2l.setMomenta( p_set ); ME_Background_DY_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Background_ZZ_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_SFpA.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Background_ZZ_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_OFpA.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Background_DY_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_DownType_2lpA.setMomenta( p_set ); ME_Background_DY_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_d = pdfreader( 1, PDFx1, Mass_4l )*pdfreader( -1, PDFx2, Mass_4l ); Background_ME = ContributionCoeff_d*buffer[0]; ContributionCoeff_d = pdfreader( -1, PDFx1, Mass_4l )*pdfreader( 1, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_d*buffer[1]; } else Background_ME = ContributionCoeff_d*(buffer[0]+buffer[1]); /// Strange quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_s ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_s*params_m_s ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_s*params_m_s ); if( flavor == "SF" && !photon ) { ME_Background_ZZ_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_SF.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Background_ZZ_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_OF.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Background_DY_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_DownType_2l.setMomenta( p_set ); ME_Background_DY_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Background_ZZ_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_SFpA.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Background_ZZ_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_DownType_OFpA.setMomenta( p_set ); ME_Background_ZZ_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Background_DY_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_DownType_2lpA.setMomenta( p_set ); ME_Background_DY_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_s= pdfreader( 3, PDFx1, Mass_4l )*pdfreader( -3, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_s*buffer[0]; ContributionCoeff_s = pdfreader( -3, PDFx1, Mass_4l )*pdfreader( 3, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_s*buffer[1]; } else Background_ME += ContributionCoeff_s*(buffer[0]+buffer[1]); /// Up quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_u ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_u*params_m_u ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_u*params_m_u ); if( flavor == "SF" && !photon ) { ME_Background_ZZ_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_SF.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Background_ZZ_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_OF.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Background_DY_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_UpType_2l.setMomenta( p_set ); ME_Background_DY_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Background_ZZ_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_SFpA.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Background_ZZ_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_OFpA.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Background_DY_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_UpType_2lpA.setMomenta( p_set ); ME_Background_DY_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_u = pdfreader( 2, PDFx1, Mass_4l )*pdfreader( -2, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_u*buffer[0]; ContributionCoeff_u = pdfreader( -2, PDFx1, Mass_4l )*pdfreader( 2, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_u*buffer[1]; } else Background_ME += ContributionCoeff_u*(buffer[0]+buffer[1]); /// Charm quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_c ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_c*params_m_c ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_c*params_m_c ); if( flavor == "SF" && !photon ) { ME_Background_ZZ_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_SF.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Background_ZZ_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_OF.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Background_DY_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_UpType_2l.setMomenta( p_set ); ME_Background_DY_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Background_ZZ_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_SFpA.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Background_ZZ_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Background_ZZ_qq_UpType_OFpA.setMomenta( p_set ); ME_Background_ZZ_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_ZZ_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Background_DY_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Background_DY_qq_UpType_2lpA.setMomenta( p_set ); ME_Background_DY_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Background_DY_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_c = pdfreader( 4, PDFx1, Mass_4l )*pdfreader( -4, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_c*buffer[0]; ContributionCoeff_c = pdfreader( -4, PDFx1, Mass_4l )*pdfreader( 4, PDFx2, Mass_4l ); Background_ME += ContributionCoeff_c*buffer[1]; } else Background_ME += ContributionCoeff_c*(buffer[0]+buffer[1]); } return 0; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin0_Sub(string initial_state, string flavor, bool photon) { if( initial_state=="gg" ) { /// gg block p_set[0][3] = p_set[0][0]; p_set[1][3] = -p_set[1][0]; if( flavor == "SF" && !photon ) { ME_Signal_Spin0_gg_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_SF.setMomenta( p_set ); ME_Signal_Spin0_gg_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin0_gg_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_OF.setMomenta( p_set ); ME_Signal_Spin0_gg_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin0_gg_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_2l.setMomenta( p_set ); ME_Signal_Spin0_gg_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin0_gg_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_SFpA.setMomenta( p_set ); ME_Signal_Spin0_gg_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin0_gg_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_OFpA.setMomenta( p_set ); ME_Signal_Spin0_gg_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin0_gg_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_gg_2lpA.setMomenta( p_set ); ME_Signal_Spin0_gg_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_gg_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { Signal_ME = pdfreader( 21, PDFx1, Mass_4l )*pdfreader( 21, PDFx2, Mass_4l )*buffer[0]; } else Signal_ME = buffer[0]; } if( initial_state=="qq" ) { /// Down quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_d ); Set_Of_Model_Parameters.set_block_entry( "heff", 15, params_rhod01 ); Set_Of_Model_Parameters.set_block_entry( "heff", 16, params_rhod02 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_d*params_m_d ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_d*params_m_d ); if( flavor == "SF" && !photon ) { ME_Signal_Spin0_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin0_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin0_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin0_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin0_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin0_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_d = pdfreader( 1, PDFx1, Mass_4l )*pdfreader( -1, PDFx2, Mass_4l ); Signal_ME = ContributionCoeff_d*buffer[0]; ContributionCoeff_d = pdfreader( -1, PDFx1, Mass_4l )*pdfreader( 1, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_d*buffer[1]; } else Signal_ME = ContributionCoeff_d*(buffer[0]+buffer[1]); /// Strange quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_s ); Set_Of_Model_Parameters.set_block_entry( "heff", 15, params_rhos01 ); Set_Of_Model_Parameters.set_block_entry( "heff", 16, params_rhos02 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_s*params_m_s ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_s*params_m_s ); if( flavor == "SF" && !photon ) { ME_Signal_Spin0_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin0_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin0_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin0_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin0_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin0_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin0_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_s= pdfreader( 3, PDFx1, Mass_4l )*pdfreader( -3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[0]; ContributionCoeff_s = pdfreader( -3, PDFx1, Mass_4l )*pdfreader( 3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[1]; } else Signal_ME += ContributionCoeff_s*(buffer[0]+buffer[1]); /// Up quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_u ); Set_Of_Model_Parameters.set_block_entry( "heff", 11, params_rhou01 ); Set_Of_Model_Parameters.set_block_entry( "heff", 12, params_rhou02 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_u*params_m_u ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_u*params_m_u ); if( flavor == "SF" && !photon ) { ME_Signal_Spin0_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin0_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin0_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin0_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin0_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin0_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_u = pdfreader( 2, PDFx1, Mass_4l )*pdfreader( -2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[0]; ContributionCoeff_u = pdfreader( -2, PDFx1, Mass_4l )*pdfreader( 2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[1]; } else Signal_ME += ContributionCoeff_u*(buffer[0]+buffer[1]); /// Charm quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_c ); Set_Of_Model_Parameters.set_block_entry( "heff", 11, params_rhoc01 ); Set_Of_Model_Parameters.set_block_entry( "heff", 12, params_rhoc02 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_c*params_m_c ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_c*params_m_c ); if( flavor == "SF" && !photon ) { ME_Signal_Spin0_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin0_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin0_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin0_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin0_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin0_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin0_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin0_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin0_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_c = pdfreader( 4, PDFx1, Mass_4l )*pdfreader( -4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[0]; ContributionCoeff_c = pdfreader( -4, PDFx1, Mass_4l )*pdfreader( 4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[1]; } else Signal_ME += ContributionCoeff_c*(buffer[0]+buffer[1]); } return 0; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin1_Sub(string initial_state, string flavor, bool photon) { if( initial_state=="qq" ) { /// Down quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_d ); Set_Of_Model_Parameters.set_block_entry( "vec", 15, params_rhod11 ); Set_Of_Model_Parameters.set_block_entry( "vec", 16, params_rhod12 ); Set_Of_Model_Parameters.set_block_entry( "vec", 17, params_rhod13 ); Set_Of_Model_Parameters.set_block_entry( "vec", 18, params_rhod14 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_d*params_m_d ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_d*params_m_d ); if( flavor == "SF" && !photon ) { ME_Signal_Spin1_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin1_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin1_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin1_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin1_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin1_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_d = pdfreader( 1, PDFx1, Mass_4l )*pdfreader( -1, PDFx2, Mass_4l ); Signal_ME = ContributionCoeff_d*buffer[0]; ContributionCoeff_d = pdfreader( -1, PDFx1, Mass_4l )*pdfreader( 1, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_d*buffer[1]; } else Signal_ME = ContributionCoeff_d*(buffer[0]+buffer[1]); /// Strange quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_s ); Set_Of_Model_Parameters.set_block_entry( "vec", 15, params_rhos11 ); Set_Of_Model_Parameters.set_block_entry( "vec", 16, params_rhos12 ); Set_Of_Model_Parameters.set_block_entry( "vec", 17, params_rhos13 ); Set_Of_Model_Parameters.set_block_entry( "vec", 18, params_rhos14 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_s*params_m_s ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_s*params_m_s ); if( flavor == "SF" && !photon ) { ME_Signal_Spin1_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin1_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin1_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin1_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin1_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin1_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin1_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_s= pdfreader( 3, PDFx1, Mass_4l )*pdfreader( -3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[0]; ContributionCoeff_s = pdfreader( -3, PDFx1, Mass_4l )*pdfreader( 3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[1]; } else Signal_ME += ContributionCoeff_s*(buffer[0]+buffer[1]); /// Up quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_u ); Set_Of_Model_Parameters.set_block_entry( "vec", 7, params_rhou11 ); Set_Of_Model_Parameters.set_block_entry( "vec", 8, params_rhou12 ); Set_Of_Model_Parameters.set_block_entry( "vec", 9, params_rhou13 ); Set_Of_Model_Parameters.set_block_entry( "vec", 10, params_rhou14 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_u*params_m_u ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_u*params_m_u ); if( flavor == "SF" && !photon ) { ME_Signal_Spin1_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin1_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin1_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin1_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin1_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin1_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_u = pdfreader( 2, PDFx1, Mass_4l )*pdfreader( -2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[0]; ContributionCoeff_u = pdfreader( -2, PDFx1, Mass_4l )*pdfreader( 2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[1]; } else Signal_ME += ContributionCoeff_u*(buffer[0]+buffer[1]); /// Charm quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_c ); Set_Of_Model_Parameters.set_block_entry( "vec", 7, params_rhoc11 ); Set_Of_Model_Parameters.set_block_entry( "vec", 8, params_rhoc12 ); Set_Of_Model_Parameters.set_block_entry( "vec", 9, params_rhoc13 ); Set_Of_Model_Parameters.set_block_entry( "vec", 10, params_rhoc14 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_c*params_m_c ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_c*params_m_c ); if( flavor == "SF" && !photon ) { ME_Signal_Spin1_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin1_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin1_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin1_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin1_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin1_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin1_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin1_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin1_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_c = pdfreader( 4, PDFx1, Mass_4l )*pdfreader( -4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[0]; ContributionCoeff_c = pdfreader( -4, PDFx1, Mass_4l )*pdfreader( 4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[1]; } else Signal_ME += ContributionCoeff_c*(buffer[0]+buffer[1]); } return 0; } int MEKD_MG::Run_MEKD_MG_MEs_SIG_Spin2_Sub(string initial_state, string flavor, bool photon) { if( initial_state=="gg" ) { /// gg block p_set[0][3] = p_set[0][0]; p_set[1][3] = -p_set[1][0]; if( flavor == "SF" && !photon ) { ME_Signal_Spin2_gg_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_SF.setMomenta( p_set ); ME_Signal_Spin2_gg_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin2_gg_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_OF.setMomenta( p_set ); ME_Signal_Spin2_gg_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin2_gg_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_2l.setMomenta( p_set ); ME_Signal_Spin2_gg_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin2_gg_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_SFpA.setMomenta( p_set ); ME_Signal_Spin2_gg_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin2_gg_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_OFpA.setMomenta( p_set ); ME_Signal_Spin2_gg_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin2_gg_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_gg_2lpA.setMomenta( p_set ); ME_Signal_Spin2_gg_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_gg_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { Signal_ME = pdfreader( 21, PDFx1, Mass_4l )*pdfreader( 21, PDFx2, Mass_4l )*buffer[0]; } else Signal_ME = buffer[0]; } if( initial_state=="qq" ) { /// Down quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_d ); Set_Of_Model_Parameters.set_block_entry( "gravity", 33, params_rhod21 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 34, params_rhod22 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 35, params_rhod23 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 36, params_rhod24 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_d*params_m_d ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_d*params_m_d ); if( flavor == "SF" && !photon ) { ME_Signal_Spin2_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin2_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin2_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin2_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin2_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin2_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_d = pdfreader( 1, PDFx1, Mass_4l )*pdfreader( -1, PDFx2, Mass_4l ); Signal_ME = ContributionCoeff_d*buffer[0]; ContributionCoeff_d = pdfreader( -1, PDFx1, Mass_4l )*pdfreader( 1, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_d*buffer[1]; } else Signal_ME = ContributionCoeff_d*(buffer[0]+buffer[1]); /// Strange quark block Set_Of_Model_Parameters.set_block_entry( "mass", 3, params_m_s ); Set_Of_Model_Parameters.set_block_entry( "gravity", 33, params_rhos21 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 34, params_rhos22 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 35, params_rhos23 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 36, params_rhos24 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_s*params_m_s ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_s*params_m_s ); if( flavor == "SF" && !photon ) { ME_Signal_Spin2_qq_DownType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_SF.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin2_qq_DownType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_OF.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin2_qq_DownType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_2l.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin2_qq_DownType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_SFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin2_qq_DownType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_OFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin2_qq_DownType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_DownType_2lpA.setMomenta( p_set ); ME_Signal_Spin2_qq_DownType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_DownType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_s= pdfreader( 3, PDFx1, Mass_4l )*pdfreader( -3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[0]; ContributionCoeff_s = pdfreader( -3, PDFx1, Mass_4l )*pdfreader( 3, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_s*buffer[1]; } else Signal_ME += ContributionCoeff_s*(buffer[0]+buffer[1]); /// Up quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_u ); Set_Of_Model_Parameters.set_block_entry( "gravity", 25, params_rhou21 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 26, params_rhou22 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 27, params_rhou23 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 28, params_rhou24 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_u*params_m_u ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_u*params_m_u ); if( flavor == "SF" && !photon ) { ME_Signal_Spin2_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin2_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin2_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin2_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin2_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin2_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_u = pdfreader( 2, PDFx1, Mass_4l )*pdfreader( -2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[0]; ContributionCoeff_u = pdfreader( -2, PDFx1, Mass_4l )*pdfreader( 2, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_u*buffer[1]; } else Signal_ME += ContributionCoeff_u*(buffer[0]+buffer[1]); /// Charm quark block Set_Of_Model_Parameters.set_block_entry( "mass", 4, params_m_c ); Set_Of_Model_Parameters.set_block_entry( "gravity", 25, params_rhoc21 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 26, params_rhoc22 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 27, params_rhoc23 ); Set_Of_Model_Parameters.set_block_entry( "gravity", 28, params_rhoc24 ); p_set[0][3] = sqrt( p_set[0][0]*p_set[0][0] - params_m_c*params_m_c ); p_set[1][3] = -sqrt( p_set[1][0]*p_set[1][0] - params_m_c*params_m_c ); if( flavor == "SF" && !photon ) { ME_Signal_Spin2_qq_UpType_SF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_SF.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_SF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_SF.getMatrixElements() ); } if( flavor == "OF" && !photon ) { ME_Signal_Spin2_qq_UpType_OF.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_OF.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_OF.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_OF.getMatrixElements() ); } if( flavor == "2l" && !photon ) { ME_Signal_Spin2_qq_UpType_2l.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_2l.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_2l.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_2l.getMatrixElements() ); } if( flavor == "SF" && photon ) { ME_Signal_Spin2_qq_UpType_SFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_SFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_SFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_SFpA.getMatrixElements() ); } if( flavor == "OF" && photon ) { ME_Signal_Spin2_qq_UpType_OFpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_OFpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_OFpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_OFpA.getMatrixElements() ); } if( flavor == "2l" && photon ) { ME_Signal_Spin2_qq_UpType_2lpA.updateProc( Set_Of_Model_Parameters ); ME_Signal_Spin2_qq_UpType_2lpA.setMomenta( p_set ); ME_Signal_Spin2_qq_UpType_2lpA.sigmaKin(); buffer = const_cast<double*>( ME_Signal_Spin2_qq_UpType_2lpA.getMatrixElements() ); } if( Use_PDF_w_pT0 ) { ContributionCoeff_c = pdfreader( 4, PDFx1, Mass_4l )*pdfreader( -4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[0]; ContributionCoeff_c = pdfreader( -4, PDFx1, Mass_4l )*pdfreader( 4, PDFx2, Mass_4l ); Signal_ME += ContributionCoeff_c*buffer[1]; } else Signal_ME += ContributionCoeff_c*(buffer[0]+buffer[1]); } return 0; } /////////////////////////////////// /// END OF MEKD_MG_RunMEs.cpp /// /////////////////////////////////// ///#include "MEKD_MG_Sorter.cpp" /////////////////////////////////// /// INCLUDED MEKD_MG_Sorter.cpp /// /// code follows below /// /// /// /// Part responsible for /// /// momenta rearrangement /// /////////////////////////////////// int MEKD_MG::Arrange_Internal_pls() { id_set[0]=id1; id_set[1]=id2; id_set[2]=id3; id_set[3]=id4; id_set[4]=id5; if( id_set[0] == 0 ) id_set[0]=10000; if( id_set[1] == 0 ) id_set[1]=10000; if( id_set[2] == 0 ) id_set[2]=10000; if( id_set[3] == 0 ) id_set[3]=10000; if( id_set[4] == 0 ) id_set[4]=10000; sort( id_set.begin(), id_set.end() ); //////////////////////////// /// 2mu-decay-mode block /// //////////////////////////// /// Two-lepton final state block if( id_set[0] == -13 && id_set[1] == 13 && id_set[2] == 10000 && id_set[3] == 10000 && id_set[4] == 10000 ) { if( id1 == 13 ) pl1_internal = p1; if( id2 == 13 ) pl1_internal = p2; if( id1 == -13 ) pl2_internal = p1; if( id2 == -13 ) pl2_internal = p2; pA1_internal = NULL; Final_state = "2m"; return 0; } /// Two-lepton + photon final state block if( id_set[0] == -13 && id_set[1] == 13 && id_set[2] == 22 && id_set[3] == 10000 && id_set[4] == 10000 ) { if( id1 == 13 ) pl1_internal = p1; if( id2 == 13 ) pl1_internal = p2; if( id3 == 13 ) pl1_internal = p3; if( id1 == -13 ) pl2_internal = p1; if( id2 == -13 ) pl2_internal = p2; if( id3 == -13 ) pl2_internal = p3; if( id1 == 22 ) pA1_internal = p1; if( id2 == 22 ) pA1_internal = p2; if( id3 == 22 ) pA1_internal = p3; Final_state = "2mA"; return 0; } /////////////////////////// /// ZZ-decay-mode block /// /////////////////////////// /// Four-lepton final state block if( id_set[0] == -13 && id_set[1] == -11 && id_set[2] == 11 && id_set[3] == 13 && id_set[4] == 10000 ) { if( id1 == 11 ) pl1_internal = p1; if( id2 == 11 ) pl1_internal = p2; if( id3 == 11 ) pl1_internal = p3; if( id4 == 11 ) pl1_internal = p4; if( id1 == -11 ) pl2_internal = p1; if( id2 == -11 ) pl2_internal = p2; if( id3 == -11 ) pl2_internal = p3; if( id4 == -11 ) pl2_internal = p4; if( id1 == 13 ) pl3_internal = p1; if( id2 == 13 ) pl3_internal = p2; if( id3 == 13 ) pl3_internal = p3; if( id4 == 13 ) pl3_internal = p4; if( id1 == -13 ) pl4_internal = p1; if( id2 == -13 ) pl4_internal = p2; if( id3 == -13 ) pl4_internal = p3; if( id4 == -13 ) pl4_internal = p4; pA1_internal = NULL; Final_state = "2e2m"; return 0; } if( id_set[0] == -13 && id_set[1] == -13 && id_set[2] == 13 && id_set[3] == 13 && id_set[4] == 10000 ) { buffer_bool = false; //first muon has beed caught if( id1 == 13 && !buffer_bool ) { pl1_internal=p1; buffer_bool=true; } if( id2 == 13 && buffer_bool ) pl3_internal = p2; if( id2 == 13 && !buffer_bool ) { pl1_internal=p2; buffer_bool=true; } if( id3 == 13 && buffer_bool ) pl3_internal = p3; if( id3 == 13 && !buffer_bool ) { pl1_internal=p3; buffer_bool=true; } if( id4 == 13 && buffer_bool ) pl3_internal = p4; buffer_bool = false; //first antimuon has beed caught if( id1 == -13 && !buffer_bool ) { pl2_internal=p1; buffer_bool=true; } if( id2 == -13 && buffer_bool ) pl4_internal = p2; if( id2 == -13 && !buffer_bool ) { pl2_internal=p2; buffer_bool=true; } if( id3 == -13 && buffer_bool ) pl4_internal = p3; if( id3 == -13 && !buffer_bool ) { pl2_internal=p3; buffer_bool=true; } if( id4 == -13 && buffer_bool ) pl4_internal = p4; pA1_internal = NULL; Final_state = "4mu"; return 0; } if( id_set[0] == -11 && id_set[1] == -11 && id_set[2] == 11 && id_set[3] == 11 && id_set[4] == 10000 ) { buffer_bool = false; //first electron has beed caught if( id1 == 11 && !buffer_bool ) { pl1_internal=p1; buffer_bool=true; } if( id2 == 11 && buffer_bool ) pl3_internal = p2; if( id2 == 11 && !buffer_bool ) { pl1_internal=p2; buffer_bool=true; } if( id3 == 11 && buffer_bool ) pl3_internal = p3; if( id3 == 11 && !buffer_bool ) { pl1_internal=p3; buffer_bool=true; } if( id4 == 11 && buffer_bool ) pl3_internal = p4; buffer_bool = false; //first positron has beed caught if( id1 == -11 && !buffer_bool ) { pl2_internal=p1; buffer_bool=true; } if( id2 == -11 && buffer_bool ) pl4_internal = p2; if( id2 == -11 && !buffer_bool ) { pl2_internal=p2; buffer_bool=true; } if( id3 == -11 && buffer_bool ) pl4_internal = p3; if( id3 == -11 && !buffer_bool ) { pl2_internal=p3; buffer_bool=true; } if( id4 == -11 && buffer_bool ) pl4_internal = p4; pA1_internal = NULL; Final_state = "4e"; return 0; } /// Four-lepton + photon final state block if( id_set[0] == -13 && id_set[1] == -11 && id_set[2] == 11 && id_set[3] == 13 && id_set[4] == 22 ) { if( id1 == 11 ) pl1_internal = p1; if( id2 == 11 ) pl1_internal = p2; if( id3 == 11 ) pl1_internal = p3; if( id4 == 11 ) pl1_internal = p4; if( id5 == 11 ) pl1_internal = p5; if( id1 == -11 ) pl2_internal = p1; if( id2 == -11 ) pl2_internal = p2; if( id3 == -11 ) pl2_internal = p3; if( id4 == -11 ) pl2_internal = p4; if( id5 == -11 ) pl1_internal = p5; if( id1 == 13 ) pl3_internal = p1; if( id2 == 13 ) pl3_internal = p2; if( id3 == 13 ) pl3_internal = p3; if( id4 == 13 ) pl3_internal = p4; if( id5 == 13 ) pl3_internal = p5; if( id1 == -13 ) pl4_internal = p1; if( id2 == -13 ) pl4_internal = p2; if( id3 == -13 ) pl4_internal = p3; if( id4 == -13 ) pl4_internal = p4; if( id5 == -13 ) pl4_internal = p5; if( id1 == 22 ) pA1_internal = p1; if( id2 == 22 ) pA1_internal = p2; if( id3 == 22 ) pA1_internal = p3; if( id4 == 22 ) pA1_internal = p4; if( id5 == 22 ) pA1_internal = p5; Final_state = "2e2mA"; return 0; } if( id_set[0] == -13 && id_set[1] == -13 && id_set[2] == 13 && id_set[3] == 13 && id_set[4] == 22 ) { buffer_bool = false; //first muon has beed caught if( id1 == 13 && !buffer_bool ) { pl1_internal=p1; buffer_bool=true; } if( id2 == 13 && buffer_bool ) pl3_internal = p2; if( id2 == 13 && !buffer_bool ) { pl1_internal=p2; buffer_bool=true; } if( id3 == 13 && buffer_bool ) pl3_internal = p3; if( id3 == 13 && !buffer_bool ) { pl1_internal=p3; buffer_bool=true; } if( id4 == 13 && buffer_bool ) pl3_internal = p4; if( id4 == 13 && !buffer_bool ) { pl1_internal=p4; buffer_bool=true; } if( id5 == 13 && buffer_bool ) pl3_internal = p5; buffer_bool = false; //first antimuon has beed caught if( id1 == -13 && !buffer_bool ) { pl2_internal=p1; buffer_bool=true; } if( id2 == -13 && buffer_bool ) pl4_internal = p2; if( id2 == -13 && !buffer_bool ) { pl2_internal=p2; buffer_bool=true; } if( id3 == -13 && buffer_bool ) pl4_internal = p3; if( id3 == -13 && !buffer_bool ) { pl2_internal=p3; buffer_bool=true; } if( id4 == -13 && buffer_bool ) pl4_internal = p4; if( id4 == -13 && !buffer_bool ) { pl2_internal=p4; buffer_bool=true; } if( id5 == -13 && buffer_bool ) pl4_internal = p5; if( id1 == 22 ) pA1_internal = p1; if( id2 == 22 ) pA1_internal = p2; if( id3 == 22 ) pA1_internal = p3; if( id4 == 22 ) pA1_internal = p4; if( id5 == 22 ) pA1_internal = p5; Final_state = "4muA"; return 0; } if( id_set[0] == -11 && id_set[1] == -11 && id_set[2] == 11 && id_set[3] == 11 && id_set[4] == 22 ) { buffer_bool = false; //first electron has beed caught if( id1 == 11 && !buffer_bool ) { pl1_internal=p1; buffer_bool=true; } if( id2 == 11 && buffer_bool ) pl3_internal = p2; if( id2 == 11 && !buffer_bool ) { pl1_internal=p2; buffer_bool=true; } if( id3 == 11 && buffer_bool ) pl3_internal = p3; if( id3 == 11 && !buffer_bool ) { pl1_internal=p3; buffer_bool=true; } if( id4 == 11 && buffer_bool ) pl3_internal = p4; if( id4 == 11 && !buffer_bool ) { pl1_internal=p4; buffer_bool=true; } if( id5 == 11 && buffer_bool ) pl3_internal = p5; buffer_bool = false; //first positron has beed caught if( id1 == -11 && !buffer_bool ) { pl2_internal=p1; buffer_bool=true; } if( id2 == -11 && buffer_bool ) pl4_internal = p2; if( id2 == -11 && !buffer_bool ) { pl2_internal=p2; buffer_bool=true; } if( id3 == -11 && buffer_bool ) pl4_internal = p3; if( id3 == -11 && !buffer_bool ) { pl2_internal=p3; buffer_bool=true; } if( id4 == -11 && buffer_bool ) pl4_internal = p4; if( id4 == -11 && !buffer_bool ) { pl2_internal=p4; buffer_bool=true; } if( id5 == -11 && buffer_bool ) pl4_internal = p5; if( id1 == 22 ) pA1_internal = p1; if( id2 == 22 ) pA1_internal = p2; if( id3 == 22 ) pA1_internal = p3; if( id4 == 22 ) pA1_internal = p4; if( id5 == 22 ) pA1_internal = p5; Final_state = "4eA"; return 0; } if( id_set[0] == 10000 && id_set[1] == 10000 && id_set[2] == 10000 && id_set[3] == 10000 && id_set[4] == 10000 ) { if( Warning_Mode ) cout << "Warning. Particle ids are not set. Assuming a proper input-particle configuration.\n"; if( Warning_Mode ) cout << "Proceeding according to a specified final state (" << Final_state << ").\n"; pl1_internal=p1; pl2_internal=p2; pl3_internal=p3; pl4_internal=p4; pA1_internal=p5; return 0; } return 1; } /////////////////////////////////// /// END OF MEKD_MG_Sorter.cpp /// /////////////////////////////////// #endif
532c07b21a5461bbc3bfa4f945a2407a6e3c6ca3
fa7d082e43eef61794c0dcec4f4523fbda228e0e
/RedPitayaSup/src/drvRedPitaya.h
93e93bbfa5f636a3b4c1e0807338043cd3f20ef6
[ "BSD-3-Clause" ]
permissive
Mrwnlflt/redpitaya-epics
b7c3e52f9f062612089f60e79cfe95bb3d16dac7
7cb584ef341b4244e66610df064c53b30c549481
refs/heads/master
2023-03-17T02:42:06.125015
2021-02-25T00:07:11
2021-02-25T00:07:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,142
h
drvRedPitaya.h
/* Description: * This is an ASYN port driver to be used with an on board IOC for * RedPitaya. * * Copyright (c) 2018 Australian Synchrotron * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * Contact details: * andraz.pozar@synchrotron.org.au * 800 Blackburn Road, Clayton, Victoria 3168, Australia. */ #ifndef DRV_REDPITAYA_H_ #define DRV_REDPITAYA_H_ #include <epicsTime.h> #include <epicsTypes.h> #include <epicsThread.h> #include <asynPortDriver.h> class epicsShareFunc RedPitayaDriver : public asynPortDriver { public: explicit RedPitayaDriver (const char* port_name, const double pollingInterval = 0.01); ~RedPitayaDriver (); /** * Enum which represents all supported driver actions. This is used to distinguish which * action should be executed. The order of qualifiers here has is directly mapped to the * qualifierList which contains list of commands. */ enum Qualifiers { // General info // DriverVersion = 0, // EPICS driver version // Digital pins and LEDs // NDigPinDir, // Direction of N digital pins PDigPinDir, // Direction of P digital pins NDigPinState, // State of N digital pins PDigPinState, // State of P digital pins LedState, // State of LEDs // Analogue pins // AnalogPinOut, // Analog output pin value AnalogPinIn, // Analog input pin value // Data acquisition on two fast input channels // SingleAcquisitionStart, // Start acquisition of data after a single trigger ContAcquisitionStart, // Start continuous data acquisition AcquisitionStop, // Stop acquisition AcquisitionReset, // Reset acquisition AcquisitionStatus, // Status of the acquisition Decimation, // Decimation factor SamplingRate, // Sampling rate Averaging, // Averaging TriggerSrc, // Acquisition trigger TriggerState, // Acquisition trigger state TriggerDelay, // Acquisition trigger delay TriggerHysteresis, // Trigger hysteresis AcquisitionGain, // Acquisition source gain 1-4 channels TriggerLevel, // Acquisition trigger level BufferSize, // Acquisition buffer size AcquisitionRate, // Rate of continuous acquisition SourceData, // 16K float array for 2 input channels // Waveform generation on two fast output channels // GenerationReset, // Reset generation OutputEnabled, // Enable/disable output SignalAmplitude, // Output signal amplitude SignalOffset, // Output signal DC offset SignalFrequency, // Output signal frequency SignalPhase, // Output signal phase SignalWaveformType, // Output signal waveform type PWMDutyCycle, // PWM duty cycle ratio SignalGenerationMode, // Signal generation mode (CONTINUOUS, BURST, STREAM SignalBurstCount, // Number of generated waveforms in a burst SignalBurstRepetitions, // Number of burst repetitions SignalBurstPeriod, // Burst period in uS OutputTriggerSrc, // Output trigger source OutputSSChannel, // Single shot trigger channel selection OutputSSTrigger, // Single shot trigger SignalWaveform, // Arbitrary signal waveform NUMBER_QUALIFIERS // Number of qualifiers - MUST be last }; // Override asynPortDriver functions needed for this driver. // void report (FILE* fp, int details); asynStatus readOctet (asynUser* pasynUser, char* value, size_t maxChars, size_t* nActual, int* eomReason); // A function that runs in a separate thread and is acquiring the data // void dataAcquisition(); asynStatus readInt32 (asynUser* pasynUser, epicsInt32* value); asynStatus writeInt32 (asynUser* pasynUser, epicsInt32 value); asynStatus readFloat64 (asynUser* pasynUser, epicsFloat64* value); asynStatus writeFloat64 (asynUser* pasynUser, epicsFloat64 value); asynStatus writeFloat32Array(asynUser *pasynUser, epicsFloat32 *value, size_t nElements); asynStatus readFloat32Array(asynUser *pasynUser, epicsFloat32 *value, size_t nElements, size_t *nIn); private: static const char* qualifierImage (Qualifiers qualifer); static void shutdown (void* arg); /** * Checks if the address provided is within the limits for the given action. * * @param qualifier The qualifier used to identify the action to be executed. * @param addr Address provided from EPICS database record. * * @return asynSuccess if the address is within bounds and asynError otherwise. */ asynStatus checkAddrLimits (const Qualifiers qualifier, const int addr); int indexList [NUMBER_QUALIFIERS]; // used by asynPortDriver char full_name [80]; int is_initialised; // Device found, but initialisation failed. bool acquiring; // Is acquiring data double acquisitionSleep; // Continuous data acquisition rate epicsInt32 ssChannelSelected; // Selected channels to be triggered as a single shot int out1TriggerSource; // Trigger source for output 1 int out2TriggerSource; // Trigger source for output 2 double triggerPollingInterval; // Interval at which we poll for new trigger status }; #endif // DRV_REDPITAYA_H_
b8aee4c15845ee7d4860a54826602f5a3c159767
6522e532b7c657a6085053e223a9b18e5dcf0e6b
/include/commons/IS/Map/Map.hpp
bf92ca27efaacff11468c2955868e937e696cf62
[]
no_license
Mthomas3/Bomberman
19ceef98d8bb144248d60a26954320554f1aafb4
f028670c2456dfee1209a0bee39163058ffd84fa
refs/heads/master
2020-05-25T19:54:02.770618
2016-09-09T22:40:50
2016-09-09T22:40:50
60,961,167
0
0
null
null
null
null
UTF-8
C++
false
false
1,891
hpp
Map.hpp
#pragma once #include <cstdint> #include <functional> #include <map> #include <memory> #include <vector> #include <IS/GameObject/GameObject.h> namespace IS { namespace Scene { class Scene; } } namespace IS { class Map { public: typedef IS::GameObject::GameObject objT; typedef IS::Scene::Scene insT; typedef Ogre::Real posT; typedef std::pair<int8_t, int8_t> unitPos; typedef std::pair<posT, posT> realPos; typedef std::function<posT(int8_t)> f_convert; typedef std::function<objT*(realPos, insT *)> f_init; public: enum TileType { None = 0, Border, UnbreakBlock, BreakBlock, Powerup, Bomb }; public: struct Tile; struct Config; public: Map(std::shared_ptr<Config> const &, insT *); ~Map(); public: std::vector<std::shared_ptr<Tile>> &getArround(unitPos const&); std::vector<std::shared_ptr<Tile>> &getWalkable(unitPos const&); int getAt(realPos const &); void setAt(unitPos const &, TileType); unitPos const &getDimension() const; std::shared_ptr<Tile> operator[](unitPos const&); public: unitPos const ogreToMap(realPos const &); realPos const mapToOgre(unitPos const &); private: void createStaticBlock(); void createBreakableBlock(); void putTile(unitPos const &, TileType); private: std::shared_ptr<Config> _config; insT *_instManager; std::map<unitPos, std::shared_ptr<Tile>> _tiles; std::vector<std::shared_ptr<unitPos>> _walkable; }; }; std::ostream& operator<<(std::ostream&, IS::Map &); IS::Map::unitPos operator+(IS::Map::unitPos const&, IS::Map::unitPos const&); IS::Map::unitPos operator-(IS::Map::unitPos const&, IS::Map::unitPos const&); IS::Map::realPos operator+(IS::Map::realPos const&, IS::Map::realPos const&); IS::Map::realPos operator-(IS::Map::realPos const&, IS::Map::realPos const&);
47b78521c562a5a0902d8226816cc4f4989da3cf
eef5b04a28b932df654f26763269a260c7d5da80
/arduinoCar.ino
a34c5a972cd9bb9dd8d51d3e379ea02485eacfca
[]
no_license
SebastianBienert/CarApp
c032cc00f272e05e8ddd2f62fa1fb149781fe857
6f8e8baabfbea89f8a80407f6585fb46cc89c5b6
refs/heads/master
2021-05-04T22:25:44.305757
2018-02-02T22:01:14
2018-02-02T22:01:14
120,033,403
0
0
null
null
null
null
UTF-8
C++
false
false
2,574
ino
arduinoCar.ino
#include <LiquidCrystal.h> //Dołączenie bilbioteki LiquidCrystal lcd(2, 3, 4, 8, 11, 12); //Informacja o podłączeniu nowego wyświetlacza int izqA = 5; int izqB = 6; int derA = 9; int derB = 10; int vel = 127; // Predkosc silnikow (0 - 255) int data = 12; // inicjowanie sygnalem stopu bool updateLCD = false; void serialFlush() { while (Serial.available() > 0) { char t = Serial.read(); } } void setup() { Serial.begin(9600); pinMode(derA, OUTPUT); pinMode(derB, OUTPUT); pinMode(izqA, OUTPUT); pinMode(izqB, OUTPUT); lcd.begin(16, 2); //Deklaracja typu lcd.setCursor(0, 0); //Ustawienie kursora lcd.print("XDDDDDDDDDDD"); //Wyświetlenie tekstu lcd.setCursor(0, 1); //Ustawienie kursora lcd.print(" !!!!!! "); //Wyświetlenie tekstu } void ControlMovements() { if (data == 14) { // Forward analogWrite(derB, 0); analogWrite(izqB, 0); analogWrite(derA, vel); analogWrite(izqA, vel); } if (data == 11) { // right analogWrite(derB, vel); analogWrite(izqB, 0); analogWrite(derA, 0); analogWrite(izqA, vel); } if (data == 12) { // Stop analogWrite(derB, 0); analogWrite(izqB, 0); analogWrite(derA, 0); analogWrite(izqA, 0); } if (data == 13) { // left analogWrite(derB, 0); analogWrite(izqB, vel); analogWrite(izqA, 0); analogWrite(derA, vel); } if (data == 10) { // Reverse analogWrite(derA, 0); analogWrite(izqA, 0); analogWrite(derB, vel); analogWrite(izqB, vel); } } void UpdateLCDText(String text) { Serial.println("Updating.."); String temp; if(text.length() > 16) { temp = text.substring(0,16); lcd.clear(); lcd.print(temp); lcd.setCursor(0, 1); temp = text.substring(16, text.length()); lcd.print(temp); } else { lcd.clear(); lcd.print(text); } } String ReadStringFromStream() { String result =""; char t; while(Serial.available() > 0) { t = Serial.read(); result += t; } Serial.println(result); return result; } void loop() { if (Serial.available() > 0) { Serial.println("1 charakter"); if(Serial.peek() == 9) { Serial.read(); vel = Serial.read(); UpdateLCDText("Predkosc: " + String(vel) ); } if(Serial.available() > 1 && Serial.peek() > 20 ) { delay(100); data = 'c'; Serial.println("cosiedzieje"); UpdateLCDText(ReadStringFromStream()); } data = Serial.read(); } ControlMovements(); delay(10); //Serial.println(data); }
98ebb3085aa309bfa0e73ad8134a77dd72f20a26
674053246614a1b6d9ffebe348c67bfe2c970e2c
/Risk/GameEngine.h
095b0d677bd4a85a580cdbe83e49ac52bae6dc71
[]
no_license
daniakalomiris/risk
52dad37873d7d6ffdabfd4d7fb20b93bd1171ede
ea611b713c4bee4f1b6d922083d1e3f1a05f0dd6
refs/heads/master
2022-04-08T05:54:48.704579
2020-03-07T20:04:51
2020-03-07T20:04:51
216,266,039
0
0
null
null
null
null
UTF-8
C++
false
false
3,003
h
GameEngine.h
#pragma once #include <vector> #include <memory> #include "Player.h" #include "Map.h" #include "MapLoader.h" #include "Cards.h" #include "GameObservers.h" class Tournament; class GameEngine: public Subject{ private: std::unique_ptr<int> numberOfPlayers; std::unique_ptr<int> phase; std::vector <Player*> allPlayers; Map* map; MapLoader* maploader; Deck* deck; std::unique_ptr<int> numberOfArmiesPerPlayer; std::unique_ptr<bool> endGame; //tells if it is the end of the game std::unique_ptr<int> maxNumTurn; //maximum number of turns std::unique_ptr<bool>gameMode; //tells if the game mode is a tournament std::unique_ptr<std::string> winner; //contains the name of the winner public: GameEngine(); //constructor GameEngine(const GameEngine& orig); //copy constructor const GameEngine& operator=(const GameEngine& g); ~GameEngine(); int currentPlayerIndex; int currentDefenderIndex; int getNumberOfPlayers(); void setNumberOfPlayers(int numberOfPlayers); void setNumberOfArmiesPerPlayer(); int getNumberOfArmiesPerPlayer(); void setArmiesToCountries(); bool getEndGame(); int getPhase(); void setEndGame(bool value); void setPlayerOrder(); void setPlayer(Player* player); void setPhase(int phase); Map* getMap(); void setMap(Map* map); void setGameMode(bool mode); bool getGamemode(); string getWinner(); void setWinner(std::string name); std::vector <Player*> getAllPlayers(); Deck* getDeck(); int getMaxNumTurn(); void setMaxNumTurn(int max); void askNumberOfPlayers(); void createMap(std::string mapFile); void createMap(); void createPlayers(); void showPlayerOrder(); void assignCountriesToPlayers(); void displayCountriesOfPlayers(); void mainGameLoop(); }; class Tournament { public: Tournament(); Tournament(const Tournament& orig); //copy constructor ~Tournament(); void tournamentSettings(); //display menu to prompts the user for tournament settings void mapSelection();//selecting the different maps to play on void createGames(bool isTournamentOn); //create the different games according to user input void playerSelection(); //selecting the strategy for each players void displayGamesResults(); int getNumMaps(); void setNumMaps(int num); int getNumGames(); void setNumGames(int num); int getNumTurns(); void setNumTurns(int num); int getNumComps(); void setNumComps(int num); std::vector<GameEngine*> getGames(); vector<std::string> getTournamentMaps(); void setTournamentMaps(std::string map); private: unique_ptr<int> numMaps; unique_ptr<int> numComps; //number of computers; unique_ptr<int> numGames; unique_ptr<int> numTurns; std::vector<GameEngine*> games; //vector of gameEngines objects std::vector<Player*> allCompPlayers; //vector of computers std::vector<std::string> tournamentMaps; };
85d1f03947869e320706c3d76681f49f558701c0
60c93ffbeb4e85490ced5c9b76cc869b21bd56cc
/bRenderer/implementation/Font.cpp
2c4523ead803dbdd4011c16a2de5a7816d733e6a
[]
no_license
bthdimension/bRenderer
cafb82342b38baa52e011bab3b4685e7f7daa828
a46fb0cd26a89664106442cd85495f28fed715a2
refs/heads/master
2021-12-29T07:19:24.864187
2021-12-27T20:41:58
2021-12-27T20:41:58
33,089,906
10
6
null
null
null
null
UTF-8
C++
false
false
1,429
cpp
Font.cpp
#include "headers/Font.h" #include "headers/Logger.h" #include "headers/FileHandler.h" #include "headers/Configuration.h" Font::Font(const std::string &fontFileName, GLuint fontPixelSize) { _initialized = false; init(fontFileName, fontPixelSize); } ftgl::texture_glyph_t *Font::getCharacter(char c) { return ftgl::texture_font_get_glyph(_font, c); } /* Private Functions */ void Font::init(const std::string &fontFileName, GLuint fontPixelSize) { if (fontPixelSize > bRenderer::FONT_MAX_PIXEL_SIZE()) fontPixelSize = bRenderer::FONT_MAX_PIXEL_SIZE(); if (_fontFileName != fontFileName || _fontPixelSize != fontPixelSize){ if (_initialized) deleteFont(); // If the font has been initialized before everything has to be reset _atlas = ftgl::texture_atlas_new(8 * fontPixelSize, 8 * fontPixelSize, 1); _font = ftgl::texture_font_new_from_file(_atlas, fontPixelSize, bRenderer::getFilePath(fontFileName).c_str()); // Load character to initialize atlas (otherwise id is 0) ftgl::texture_font_get_glyph(_font, 'b'); _atlasTexture = TexturePtr(new Texture(_atlas->id)); } _fontFileName = fontFileName; _fontPixelSize = fontPixelSize; _initialized = true; } void Font::deleteFont() { if (_atlas) ftgl::texture_atlas_delete(_atlas); if (_font) ftgl::texture_font_delete(_font); if (_atlasTexture) _atlasTexture->deleteTexture(); _atlas = nullptr; _font = nullptr; _atlasTexture = nullptr; }
0eb3bd3a0eb8922a4c2ee261121f0d8b52ce9ec1
90517ce1375e290f539748716fb8ef02aa60823b
/solved/f-h/feynman/feynman.cpp
fb40243fe250c658b1cb2e66d56ff9cbd1da0466
[ "Unlicense", "LicenseRef-scancode-public-domain" ]
permissive
Code4fun4ever/pc-code
23e4b677cffa57c758deeb655fd4f71b36807281
77ce51d692acf6edcb9e47aeb7b7f06bf56e4e90
refs/heads/master
2021-01-15T08:15:00.681534
2014-09-08T05:28:39
2014-09-08T05:28:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
305
cpp
feynman.cpp
#include <cstdio> #define MAXN 100 int N; int f[MAXN + 1]; void prepare() { for (int i = 1; i <= MAXN; ++i) f[i] = f[i - 1] + i*i; } int main() { prepare(); while (true) { scanf("%d", &N); if (N == 0) break; printf("%d\n", f[N]); } return 0; }
cda8d8033d4279ee7bffa45f02121dfe7adc3c1e
49e8aee9bed5773a56ed51936525767ff5cc359d
/cpp/aoj/aoj/1508.cpp
974ddea8d4b15f68aa7a4e3a6dab205bc03d8b34
[]
no_license
minaminao/competitive-programming
3985655badc3808df3e85f71cf4dbbb3cef82bcb
a127be6e54368d26d6961af3069d8c7e43bf11db
refs/heads/master
2021-07-15T02:46:18.414431
2021-03-21T18:21:58
2021-03-21T18:21:58
81,536,306
8
1
null
null
null
null
SHIFT_JIS
C++
false
false
3,439
cpp
1508.cpp
#include "bits/stdc++.h" using namespace std; #ifdef _DEBUG #include "dump.hpp" #else #define dump(...) #endif //#define int long long #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) #define all(c) begin(c),end(c) const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f; const int MOD = (int)(1e9) + 7; template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; } template<class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return true; } return false; } struct Node { int val; Node *ch[2]; int priority; int cnt; int sum; int mini; Node(int v, int p) : val(v), mini(v), priority(p), cnt(1), sum(v) { ch[0] = ch[1] = NULL; } }; int count(Node *t) { return !t ? 0 : t->cnt; } int sum(Node *t) { return !t ? 0 : t->sum; } int val(Node *t) { assert(t); return t->val; } int mini(Node *t) { return !t ? INF : t->mini; } void inorder(Node* root, string name = "") { function<void(Node*)> rec = [&](Node *x) { if (!x)return; rec(x->ch[0]); cerr << x->val << " "; rec(x->ch[1]); }; cerr << name << ": "; rec(root); cerr << endl; } int mini(Node *t, int l, int r) { if (!t)return INF; if (r <= l)return INF; if (r - l == count(t)) return mini(t); else if (count(t->ch[0]) >= r) return mini(t->ch[0], l, r); else if (count(t->ch[0]) < l) return mini(t->ch[1], l - (count(t->ch[0]) + 1), r - (count(t->ch[0]) + 1)); return min({ val(t), mini(t->ch[0], l, count(t->ch[0])), mini(t->ch[1], 0, r - (count(t->ch[0]) + 1)) }); } // 子が変わったときに必ず呼ぶ Node *update(Node *t) { if (!t)return t; t->cnt = count(t->ch[0]) + count(t->ch[1]) + 1; t->sum = sum(t->ch[0]) + sum(t->ch[1]) + t->val; t->mini = min({ val(t),mini(t->ch[0]),mini(t->ch[1]) }); return t; } Node *merge(Node *l, Node *r) { if (!l)return r; if (!r)return l; if (l->priority > r->priority) { l->ch[1] = merge(l->ch[1], r); return update(l); } else { r->ch[0] = merge(l, r->ch[0]); return update(r); } } // ([0, k), [k, n)) pair<Node*, Node*> split(Node *t, int k) { if (!t)return pair<Node*, Node*>(NULL, NULL); if (k <= count(t->ch[0])) { pair<Node*, Node*> s = split(t->ch[0], k); t->ch[0] = s.second; return make_pair(s.first, update(t)); } else { pair<Node*, Node*> s = split(t->ch[1], k - count(t->ch[0]) - 1); t->ch[1] = s.first; return make_pair(update(t), s.second); } } Node *insert(Node *t, int k, int v) { auto s = split(t, k); Node *m = new Node(v, rand()); return merge(merge(s.first, m), s.second); } Node *erase(Node *t, int k) { auto s1 = split(t, k); auto s2 = split(s1.second, 1); return merge(s1.first, s2.second); } Node* circularShift(Node *t, int l, int r) { Node *a, *b, *c, *d; tie(a, d) = split(t, r); tie(a, b) = split(a, l); tie(b, c) = split(b, r - l - 1); return merge(merge(a, merge(c, b)), d); } Node *update(Node*t, int k, int v) { t = erase(t, k); t = insert(t, k, v); return t; } signed main() { cin.tie(0); ios::sync_with_stdio(false); int n, q; cin >> n >> q; Node *root = NULL; rep(i, 0, n) { int a; cin >> a; root = insert(root, i, a); } rep(i, 0, q) { int x, y, z; cin >> x >> y >> z; dump(x, y, z); if (x == 0) { root = circularShift(root, y, z + 1); } else if (x == 1) { cout << mini(root, y, z + 1) << endl; } else { root = update(root, y, z); } } return 0; }
d096ab0decf28ad97a94e3fa2c6c443ef1981b14
28822eab0d6003b2818d31196d0c655b7ce4e76c
/include/nbla/function/sign.hpp
2c9c0203f75e4f0bd44baeddbbb621759f87bd45
[ "Apache-2.0" ]
permissive
Pandinosaurus/nnabla
e00218a36e4f4c1e52e08476be4a36834832da05
93211d0f322d76efc48cfcf27decae7bd818f923
refs/heads/master
2023-08-30T22:52:31.961668
2023-08-22T03:30:22
2023-08-22T03:30:22
157,704,914
1
0
Apache-2.0
2023-08-24T15:35:11
2018-11-15T12:07:05
Python
UTF-8
C++
false
false
1,478
hpp
sign.hpp
// Copyright 2017,2018,2019,2020,2021 Sony Corporation. // Copyright 2021 Sony Group Corporation. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** Sign */ #ifndef __NBLA_FUNCTION_SIGN_HPP__ #define __NBLA_FUNCTION_SIGN_HPP__ #include <nbla/function/utils/base_transform_unary.hpp> namespace nbla { NBLA_REGISTER_FUNCTION_HEADER(Sign, float); /** @class Sign @brief Implementation of the elementwise sign function @f[ y = \left\{ \begin{array}{ll} 1 & (x > 0)\\ \alpha & (x = 0)\\ -1 & (x < 0) \end{array} \right. @f] where the gradient is a `full` straight through, i.e., the gradient is not modified by this function. By default, @f$ \alpha @f$ = 1.0 . Inputs: - N-D array. Outputs: - N-D array. @param alpha Value for x == 0.0 */ NBLA_DEFINE_TRANSFORM_UNARY_1(Sign, (x > (T)0) ? (T)1 : ((x < (T)0) ? (T)-1 : (T)a0), dy, false, false, float); } // namespace nbla #endif
06c208d01fa2f3f4c747b88c1aa61244c7f31200
bf1f40886a54ff8ae25ac612cceee6d8701100f0
/maximal_square.cc
938d65d0c8e117d1f9f80a5837b7e4e48967f61b
[]
no_license
gqqh/leetcodes
be57941888c61fec51fa9b86f5f94f9e4c77cd2d
9ff1709820b5d17544fc8d6c84e0335cdb49f940
refs/heads/master
2021-01-25T08:49:06.612971
2016-12-07T03:53:08
2016-12-07T03:53:08
40,632,656
0
0
null
null
null
null
UTF-8
C++
false
false
1,602
cc
maximal_square.cc
//求一个0、1矩阵中最大的全1方阵大小 //使用动态规划,类似与LCS算法 #include <iostream> #include <vector> using namespace std; class Solution { public: //动态规划,使用一个二数组dp[][]来表示,同时max记录最大的边长 // dp[x][y] = min(dp[x][y-1], dp[x-1][y], dp[x-1][y-1]) + 1 int maximalSquare(vector<vector<char>>& matrix) { int rows = matrix.size(); if(rows < 1) return 0; int cols = matrix[0].size(); if(cols < 1) return 0; vector<vector<int> > dp(rows, vector<int>(cols, 0)); int max = 0; for(int j = 0; j < cols; j++){ dp[0][j] = matrix[0][j] - '0'; if(dp[0][j] == 1) max = 1; cout<<dp[0][j]<<endl; } for(int i = 0; i < rows; i++){ dp[i][0] = matrix[i][0] - '0'; if(dp[i][0] == 1) max = 1; } for(int i = 1; i < rows; i++){ for(int j = 1; j < cols; j++){ if(matrix[i][j] == '0') dp[i][j] = 0; else{ dp[i][j] = min_tri(dp[i-1][j-1], dp[i][j-1], dp[i-1][j]) + 1; max = dp[i][j] > max ? dp[i][j] : max; } } } return max * max; } private: //返回a,b,c中的最小值 inline int min_tri(int a, int b, int c){ a = a < b ? a : b; return (a < c ? a : c); } }; int main(int argc, char const *argv[]) { vector<vector<char> > v = {{'1'}}; Solution test; cout<<test.maximalSquare(v)<<endl; return 0; }
b7d4247630d794aaf3f1c25e5898483b7271dcdd
087c2ecf26a605536fa70187cb31dc0238881aeb
/day7/day7_daxpy.cpp
9340b7dd15fdb68a6a0b1c3f2e55c3808d1e1f75
[]
no_license
lyu/ams595
862bb50a3b760b2d538b5197d5573ebd0118d6dc
35578bbbd68906af775f7d772a83e271060b821b
refs/heads/master
2020-04-04T10:43:03.814788
2019-12-01T03:38:00
2019-12-01T03:45:09
155,863,486
1
1
null
null
null
null
UTF-8
C++
false
false
994
cpp
day7_daxpy.cpp
// A simple daxpy program that computes double-precision a * x + y // This example shows what the optimizaiton flags do, and the concept // of the memory wall // // Obviously, this operation is memory-bound, so even if you have an x86 CPU // that is produced after 2013, which can do this operation in one clock cycle // (FMA: g++ enables it when -march=native is used), you still won't get a good // speedup, because you are limited by the memory's speed. #include <iostream> void daxpy(const double a, double* x, double* y, const size_t N) { for (size_t i = 0; i < N; i++) y[i] = a * x[i] + y[i]; } int main() { // Danger: make this number smaller when you run the program on your machine const size_t N = 1 << 29; double* x = new double[N]; double* y = new double[N]; for (size_t i = 0; i < N; i++) { x[i] = double(i); y[i] = -double(i); } daxpy(1.2, x, y, N); std::cout << y[1] << '\n'; delete[] x; delete[] y; }
64c199ef9c79350159770593a7bd91eaa893cada
723ba58443ae6b4e8e1918cc5bbc42f6bab2d12f
/src/process.cpp
39879e5befc7aba49e181d3961fe22ee287e2d14
[]
no_license
technical-ko/Multi-Core-Processing-Scheduler
b050744245ed810bad2d4a3b682eb44cfeed8a79
1334f7d19fcd8ac8adcc0890ec6d148122d1182c
refs/heads/master
2022-04-14T03:23:04.465076
2020-03-21T01:35:46
2020-03-21T01:35:46
244,400,008
0
0
null
null
null
null
UTF-8
C++
false
false
7,304
cpp
process.cpp
#include "process.h" #include "vector" // Process class methods Process::Process(ProcessDetails details, uint32_t current_time) { int i; pid = details.pid; start_time = details.start_time; num_bursts = details.num_bursts; current_burst = 0; burst_times = new uint32_t[num_bursts]; cpu_io_times = new uint32_t[num_bursts]; for (i = 0; i < num_bursts; i++) { burst_times[i] = details.burst_times[i]; cpu_io_times[i] = details.burst_times[i]; } priority = details.priority; state = (start_time == 0) ? State::Ready : State::NotStarted; if (state == State::Ready) { launch_time = current_time; } core = -1; turn_time = 0; wait_time = 0; cpu_time = 0; lastCpuTime = 0; lastWaitTime = 0; remain_time = 0; into_queue_time = 0; burstStartTime = 0; burstTimeElapsed = 0; launched = false; fromRunningToReady = false; wait_times; waitTimeNow = 0; rrFlag = 0; roundRobinStartTime = 0; ppTime = 0; ppFlag = 0; for (i = 0; i < num_bursts; i+=2) { remain_time += burst_times[i]; } total_remain_time = remain_time; } Process::~Process() { delete[] burst_times; } void Process::setPPFlag(){ ppFlag = 1; } uint32_t Process::getPPTime() const { return ppTime; } void Process::setPPTime(uint32_t current_time){ ppTime = current_time; } uint32_t Process::getRoundRobinStartTime() const { return roundRobinStartTime; } void Process::setRoundRobinStartTime(uint32_t current_time){ roundRobinStartTime = current_time; } void Process::setRRFlag(){ rrFlag = 1; } uint16_t Process::getPid() const { return pid; } uint32_t Process::getStartTime() const { return start_time; } // Gets the most recent time the process was placed on the core uint32_t Process::getLastCpuTime() const { return lastCpuTime; } // Sets the last cpu time to the current time void Process::setLastCpuTime(uint32_t current_time) { lastCpuTime = current_time; } // Gets the most recent time the process was placed into the ready queue uint32_t Process::getLastWaitTime() const { return lastWaitTime; } // Sets the last wait time to the current time void Process::setLastWaitTime(uint32_t current_time) { lastWaitTime = current_time; } void Process::setIntoQueueTime(uint32_t current_time){ into_queue_time = current_time; } uint32_t Process::getBurstStartTime() const{ return burstStartTime; } void Process::setBurstStartTime(uint32_t current_time){ burstStartTime = current_time; } void Process::updateCurrentBurst(){ current_burst++; } uint16_t Process::getCurrentBurst() const { return current_burst; } uint32_t Process::getCurrentBurstTime() const { return cpu_io_times[current_burst]; } uint32_t Process::getBurstTimeElapsed() const { return burstTimeElapsed; } void Process::resetBurstTimeElapsed(){ burstTimeElapsed = 0; } uint8_t Process::getPriority() const { return priority; } Process::State Process::getState() const { return state; } int8_t Process::getCpuCore() const { return core; } double Process::getTurnaroundTime() const { return (double)turn_time / 1000.0; } double Process::getWaitTime() const { return (double)wait_time / 1000.0; } double Process::getCpuTime() const { return (double)cpu_time / 1000.0; } double Process::getRemainingTime() const { return (double)remain_time / 1000.0; } bool Process::isLaunched() { return launched; } void Process::setLaunched(bool set){ launched = set; } void Process::setState(State new_state, uint32_t current_time) { if (state == Process::State::Ready && new_state == Process::State::Running){ wait_times.push_back(waitTimeNow); } state = new_state; } void Process::setLaunchTime(uint32_t current_time){ launch_time = current_time; } void Process::setCpuCore(int8_t core_num) { core = core_num; } void Process::updateProcess(uint32_t current_time) { // use `current_time` to update turnaround time, wait time, burst times, // cpu time, and remaining time if (state != Process::State::Terminated && launch_time != 0){ turn_time = current_time - launch_time; } if (state == Process::State::Running && rrFlag == 0){ uint32_t burstTimesSoFar = 0; for (int i = current_burst-2; i >=0; i-=2){ burstTimesSoFar = burstTimesSoFar + cpu_io_times[i]; } cpu_time = burstTimesSoFar + (current_time - burstStartTime); remain_time = total_remain_time - cpu_time; burstTimeElapsed = current_time - burstStartTime; } if (state == Process::State::Running && rrFlag == 1){ uint32_t burstTimesSoFar = 0; uint32_t currentBurstTimesSoFar = 0; if (cpu_io_times[current_burst] != burst_times[current_burst]){ burstTimesSoFar = cpu_io_times[current_burst] - burst_times[current_burst]; currentBurstTimesSoFar = cpu_io_times[current_burst] - burst_times[current_burst]; } for (int i = current_burst-2; i >=0; i-=2){ burstTimesSoFar = burstTimesSoFar + cpu_io_times[i]; } cpu_time = burstTimesSoFar + (current_time - roundRobinStartTime); remain_time = total_remain_time - cpu_time; burstTimeElapsed = currentBurstTimesSoFar + (current_time - roundRobinStartTime); } if (state == Process::State::Running && ppFlag == 1){ uint32_t burstTimesSoFar = 0; uint32_t currentBurstTimesSoFar = 0; if (cpu_io_times[current_burst] != burst_times[current_burst]){ burstTimesSoFar = cpu_io_times[current_burst] - burst_times[current_burst]; currentBurstTimesSoFar = cpu_io_times[current_burst] - burst_times[current_burst]; } for (int i = current_burst-2; i >=0; i-=2){ burstTimesSoFar = burstTimesSoFar + cpu_io_times[i]; } cpu_time = burstTimesSoFar + (current_time - ppTime); remain_time = total_remain_time - cpu_time; burstTimeElapsed = currentBurstTimesSoFar + (current_time - ppTime); } if (state == Process::State::Ready){ uint32_t waitSums = 0; waitTimeNow = 0; for (int i = 0; i<wait_times.size(); i++){ waitSums = waitSums + wait_times.at(i); } waitTimeNow = (current_time - into_queue_time); wait_time = waitSums + waitTimeNow; } if (state == Process::State::IO){ burstTimeElapsed = current_time - burstStartTime; } if (state == Process::State::Terminated){ remain_time = 0; } } void Process::updateBurstTime(int burst_idx, uint32_t new_time) { burst_times[burst_idx] = burst_times[burst_idx] - new_time; } // Comparator methods: used in std::list sort() method // No comparator needed for FCFS or RR (ready queue never sorted) // SJF - comparator for sorting read queue based on shortest remaining CPU time bool SjfComparator::operator ()(const Process *p1, const Process *p2) { return p1->getRemainingTime() < p2->getRemainingTime(); } // PP - comparator for sorting read queue based on priority bool PpComparator::operator ()(const Process *p1, const Process *p2) { return p1->getPriority() < p2->getPriority(); }
9952dc0f17f814a04785987b1374f065cc863ff4
3a22daa3121c8bb47472062a1af40edc7515858f
/UDPNetworking/src/ConnControl.h
8177dee973f3ea273a5e57a98e4e480abb5761ba
[]
no_license
ahmedatya/UDP-Client-Server-C-
6e671932dc30b7cbdee332b0327a50c4605696b3
b893706e48250a364bbbd13d4ff752c7dc693191
refs/heads/master
2020-04-11T02:58:15.880293
2013-06-29T01:16:33
2013-06-29T01:16:33
10,946,485
0
0
null
null
null
null
UTF-8
C++
false
false
1,805
h
ConnControl.h
/* * ConnControl.h * * Created on: Jun 28, 2013 * Author: aatya */ #ifndef CONNCONTROL_H_ #define CONNCONTROL_H_ #include "UDPHandler.h" #include <math.h> #include <stdlib.h> #include <time.h> namespace SISA_NET { /* * Flow Control and Reliability Definitions */ #define MAX_NUM_RETX 5 // maximum number of retransmission /* * Packets type + To figure the type of packets and the payload it carries */ enum MAGIC_TYPE { REQ = 0x80, REP = 0x81, DATA = 0x82, REQ_CNT = 0x90, REP_CNT = 0x91, CNT = 0x92 }; struct ConnHeader { uint32 sequence_num; // Sequence number 4 bytes uint8 magic; // Packet type uint8 version; // Flow Control Algo. version uint16 control; // Two bytes control uint32 ack_num; // Acknowledgment number 4 bytes }; /* * Segments Construction */ struct SEG { ConnHeader header; // This contains our header byte * paylod; //[MAX_SEG_SIZE]; }; /* * This Class contains the interfaces for all the flow control schemes * A control instance per flow */ class ConnControl { private: uint16 flow_id; uint32 seq_num; uint8 version; // Convert a stream of data to segments SEG * Segmentation(byte * buffer, uint32 length); byte * DeSegmentation(SEG * seg_ptr, uint32 num); virtual STATE FlowControl() = 0; virtual STATE FlowInfo() = 0; virtual STATE ReTrasmit(uint32 seq_num) = 0; public: virtual STATE SendTo(byte * buffer, uint32 length, char * ip_addr) = 0; virtual STATE RecvFrom(byte * buffer, uint32 length, char * ip_addr = "") = 0; ConnControl(); ConnControl(uint16 id, uint16 ver); void SetFlowID(uint16 id){flow_id = id;} uint16 GetFlowID(){return flow_id;} void SetVersion(uint16 ver){version = ver;} uint16 GetVersion(){return version;} virtual ~ConnControl(){} }; } /* namespace SISA_NET */ #endif /* CONNCONTROL_H_ */
997280eb30c422361476233d60b5ad890376c90f
5349a61fe3aa9cfb5aa8ebcbb57528118787a9e1
/BundlerViewer/include/OgreAppFrameListener.h
4caca429e29a037a5da4cce3c4437b00d97af6a0
[ "MIT" ]
permissive
pitzer/SFMToolkit
f6d986e7f93d79182c42e70929677b3ccbe650eb
32442d63f985622238d66ca99e8935ad83ca2ba9
refs/heads/master
2021-01-16T20:06:59.695220
2013-03-11T00:43:22
2013-03-11T00:43:22
8,319,269
1
1
null
null
null
null
UTF-8
C++
false
false
2,016
h
OgreAppFrameListener.h
/* Copyright (c) 2010 ASTRE Henri (http://www.visual-experiments.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef OGREOGREAPPFRAMELISTENER_H #define OGREOGREAPPFRAMELISTENER_H #include <Ogre.h> class OgreApp; class OgreAppFrameListener : public Ogre::FrameListener, public Ogre::WindowEventListener { public: // Constructor takes a RenderWindow because it uses that to determine input context OgreAppFrameListener(OgreApp* app); virtual ~OgreAppFrameListener(); //Adjust mouse clipping area virtual void windowResized(Ogre::RenderWindow* rw); virtual void windowMoved(Ogre::RenderWindow* rw); //Unattach OIS before window shutdown (very important under Linux) virtual void windowClosed(Ogre::RenderWindow* rw); // Override frameStarted event to process that (don't care about frameEnded) //bool frameStarted(const Ogre::FrameEvent& evt); bool frameRenderingQueued(const Ogre::FrameEvent& evt); protected: OgreApp *mApplication; bool mWindowClosed; }; #endif // OGREOGREAPPFRAMELISTENER_H
6ec1d78edcb916f5beb4c96cda6d394dfd250538
9ab0a110bac0dd121cefef70e15675efadfd77c9
/#03/331. 验证二叉树的前序序列化/331. 验证二叉树的前序序列化.cpp
57949a4df1a9c49e0f4dcf0d908656e8e0a7d383
[]
no_license
LymphV/Leetcode-of-LymphV
e25174f77d18fcbe03e57b93771a892f7a51f663
d673ef54a1771da0be37d460cc3446f99fc555d0
refs/heads/master
2023-05-04T08:45:18.591625
2021-05-26T07:49:46
2021-05-26T07:49:46
297,265,757
0
0
null
null
null
null
UTF-8
C++
false
false
2,177
cpp
331. 验证二叉树的前序序列化.cpp
#if defined(LocalLymphV) #include "../../leetcode.h" #include <LymphV> #else #define print(...) 0 #endif #if !defined(LocalLymphV) || !defined(DebugLymphV) #define debug(x) 0 #endif /** 序列化二叉树的一种方法是使用前序遍历。当我们遇到一个非空节点时,我们可以记录下这个节点的值。如果它是一个空节点,我们可以使用一个标记值记录,例如 #。 _9_ / \ 3 2 / \ / \ 4 1 # 6 / \ / \ / \ # # # # # # 例如,上面的二叉树可以被序列化为字符串 "9,3,4,#,#,1,#,#,2,#,6,#,#",其中 # 代表一个空节点。 给定一串以逗号分隔的序列,验证它是否是正确的二叉树的前序序列化。编写一个在不重构树的条件下的可行算法。 每个以逗号分隔的字符或为一个整数或为一个表示 null 指针的 '#' 。 你可以认为输入格式总是有效的,例如它永远不会包含两个连续的逗号,比如 "1,,3" 。 示例 1: 输入: "9,3,4,#,#,1,#,#,2,#,6,#,#" 输出: true 示例 2: 输入: "1,#" 输出: false 示例 3: 输入: "9,#,#,1" 输出: false 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/verify-preorder-serialization-of-a-binary-tree 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。 */ #define FOR(x,y) for (int x = 0; x < y; ++x) #define ffor(x,y,z) for (int x = y; x < z; ++x) class Solution {///4ms 74.27% 6.6M 86.35% public: bool isValidSerialization(string preorder) { for (int i = 0, now = 1, n = preorder.size(); i < n; ++i) { if (preorder[i] == ',') continue; if (preorder[i] == '#') --now; else { ++now; for (; i + 1 < n && preorder[i + 1] != ','; ++i); } if (i == n - 1) return now == 0; else if (now == 0) return 0; } return 0; } }; #if defined(LocalLymphV) int main() { vector<string> xs{"9,3,4,#,#,1,#,#,2,#,6,#,#"}; for (auto & x : xs) print(x), print(Solution().isValidSerialization(x)), print("==="); return 0; } #endif
5df832effa57b63b6bf6df63f011012c40b0edc4
eff68e9a9810bb7d00cd5ef0fb36952db414e6f8
/oreilly_examples/len.cpp
a441f8c6962cd71f7b19b813dfc85366393608c7
[]
no_license
rhealbarnett/learning_cpp
e4d9ab15c9df56c9b44a243b8c140fd390cf009c
7a7d2524fe9c8d71a636108aa07cae1e8116e1ea
refs/heads/master
2023-02-26T13:46:05.749558
2021-02-04T22:22:49
2021-02-04T22:22:49
335,861,326
1
0
null
null
null
null
UTF-8
C++
false
false
210
cpp
len.cpp
#include <iostream> using namespace std; char line[100]; int main() { cout << "Enter a line: "; cin.getline(line,sizeof(line)); cout << "The length of the line is: " << strlen(line) << "\n"; return(0); }
2839a87a7e23fdc0d287314952a885594146fb77
2aa40ab42188b9b4d249df03b38168ee940ceffb
/src/UI/LEONIS_CINEMA_CineCast/maintainform.h
e607fd6556d94029f80372f3e8a487ccb42df52b
[]
no_license
killerlife/CineCast
bea93404dc28be9e887f73d36eb506885f2806c5
955a42a69399b8bb22d9042a50c758a46cba4cf5
refs/heads/master
2020-04-12T06:38:03.387855
2018-08-02T05:20:24
2018-08-02T05:20:24
61,522,406
2
1
null
null
null
null
UTF-8
C++
false
false
561
h
maintainform.h
#ifndef MAINTAINFORM_H #define MAINTAINFORM_H #include <QWidget> namespace Ui { class MaintainForm; } class MaintainForm : public QWidget { Q_OBJECT public: explicit MaintainForm(QWidget *parent = 0); ~MaintainForm(); void setProgressBarValue(int maxvalue = 100,int value = 0); private slots: void on_pushButton_format_clicked(); void formatsignalupdateImage(); private: void ButtonInit(); private: Ui::MaintainForm *ui; signals: void formatsignal(); //private slots: // void format(); }; #endif // MAINTAINFORM_H
89a07b80425f04f9d9266ee063cbcf0f96c8e150
38804bb6bbe2ebf4953e4ee834edb41ce0f9a55c
/402_Remove_K_Digits/402.cpp
98794c09b2c8e8355476552e6ff80269019f76af
[]
no_license
mumuxijili/MyLCode
d90da042477193e23a2a215c8e4d29d4911a2dd3
5998073e400f732b144f742d257b8f97631cbc00
refs/heads/master
2021-01-01T05:19:06.388875
2017-06-02T03:50:04
2017-06-02T03:50:04
59,084,603
0
0
null
null
null
null
UTF-8
C++
false
false
485
cpp
402.cpp
#include <iostream> #include <string> #include <vector> using namespace std; class Solution { public: string removeKdigits(string num, int k) { string res = ""; int n = num.size(); int keep = n - k; for(auto c : num) { while(k > 0 && res.size() > 0 && res.back() > c) { res.pop_back(); k--; } res.push_back(c); } res.resize(keep); int i = 0; while(i < res.size() && res[i] == '0') i++; res.erase(0, i); return res == "" ? "0" : res; } };
4d2e594d35733f3dc575c496275d995eb0856552
089077acd7dc512a1afde017692382b0b9ada02f
/aBaseTool/include/math/quat.h
eebdac91569c9188d15466c038b46974057831ff
[]
no_license
lizzyly7/SmartDraw
6830b172cebcf2005366b7438d771af3faa137cf
cb891dbe66d75bbb3f692fce72e91402e1c97010
refs/heads/main
2023-04-19T05:54:52.948266
2021-05-04T11:02:01
2021-05-04T11:02:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
723
h
quat.h
/******************************************************************** created: 2003/08/09 created: 9:8:2003 13:03 filename: D:\Project\ITK\include\Math\quat.h file path: D:\Project\ITK\include\Math file base: quat file ext: h author: purpose: *********************************************************************/ #ifndef __QUAT_H__ #define __QUAT_H__ namespace itk{ // q = w + xi + yj + zk typedef struct tagQuat{ double w; // imaginary part double x; // real part double y; double z; }QUAT_T,* PQUAT_T; }; extern itk::QUAT_T __declspec(dllexport) operator *(const itk::QUAT_T quat1,const itk::QUAT_T quat2); extern itk::QUAT_T __declspec(dllexport) Inverse(const itk::QUAT_T quat); #endif
57c118005a907898a1a2b9f877b84c110a651d99
7bb4675395c0bcc95bebc17c6e2268d0421d6403
/CamperMaster/serialhandler.ino
b49f984b1eca3fb943fed0a72db8fce388383675
[]
no_license
chrisjoyce911/Camper-Control
8f263e4cc10fd08bf3f76199f566b7ca210f3129
b80a314e8ee888771fd44abf74453bc25d4fd089
refs/heads/master
2020-12-02T20:50:06.247492
2017-07-09T14:40:45
2017-07-09T14:40:45
96,221,544
0
0
null
null
null
null
UTF-8
C++
false
false
1,701
ino
serialhandler.ino
void recvWithStartEndMarkers() { static boolean recvInProgress = false; static byte ndx = 0; char startMarker = '<'; char endMarker = '>'; char rc; while (Serial3.available() > 0 && newData == false) { rc = Serial3.read(); if (recvInProgress == true) { if (rc != endMarker) { receivedChars[ndx] = rc; ndx++; if (ndx >= numChars) { ndx = numChars - 1; } } else { receivedChars[ndx] = '\0'; // terminate the string recvInProgress = false; ndx = 0; newData = true; } } else if (rc == startMarker) { recvInProgress = true; } } } void runcommandint(String function , int i) { Serial.print("COMMAND MESSAGE : "); Serial.println(function); Serial.print("Int arg : "); Serial.println(i); if (function == "mydelay") { mydelay(i); } } void runcommand(String function) { Serial.print("COMMAND MESSAGE : "); Serial.println(function); if (function == "ledon") { ledon(); } if (function == "ledoff") { ledoff(); } } void ledon() { digitalWrite(LED_BUILTIN, HIGH); } void ledoff() { digitalWrite(LED_BUILTIN, LOW); } void mydelay(int d) { delay(d); } void parseLightData() { Serial.println("LIGHT MESSAGE"); Serial.print("Message ID :"); Serial.println(rxlight.messageID); Serial.print("Light Bit "); Serial.println(rxlight.lightbit); Serial.print("Light State "); Serial.println(rxlight.lightstate); }
ed2b24bd39c752e55700bafc6b02245121d6172c
885775fc2a7a40d409c828066d483140d200f467
/Pressure/Software/pressure_test/pressure_test.ino
386a8a804c02cef49a58cf16a0f85144df3ef5f3
[]
no_license
andrewcollison/HighTemp
941b954bf141068093f31209dbb693382476a862
6dd72393ae13eaaa62179149c27a3b456ed43800
refs/heads/master
2023-03-13T19:19:11.989654
2021-03-19T01:59:20
2021-03-19T01:59:20
279,719,390
0
0
null
null
null
null
UTF-8
C++
false
false
1,796
ino
pressure_test.ino
float resultData[5] = {0, 0, 0, 0, 0}; //______________________________________________ // Map values as floats float fmap(float x, float in_min, float in_max, float out_min, float out_max) { return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; } //______________________________________________ // Get pressure data void getPress(){ resultData[0] = avgPress(A0, 50); // resultData[1] = avgPress(A1, 100); // resultData[2] = avgPress(A2, 100); // resultData[3] = avgPress(A3, 100); // resultData[4] = avgPress(A6, 100); } //______________________________________________ // Analog to pressure float avgPress(int anPin, int ns){ float tallyList[ns] = {}; for(int i=0; i < ns; i++){ float an = analogRead(anPin); float testV= fmap(an, 0.000, 1023.000, 0.000, 3.300); tallyList[i] = fmap(testV, 0.681, 3.400, 0.000, 100.000); // Serial.print("Average tally"); // Serial.println(String(tallyList)); delay(100); } float tallyP; for(int i =0; i < ns; i++){ tallyP = tallyP + tallyList[i]; } // Serial.print("tallyP: "); // Serial.println(tallyP); float avgP = (tallyP/ns)*0.01; // Serial.print("Average Press: "); // Serial.println(avgP, 3); return avgP; } void setup() { // put your setup code here, to run once: Serial.begin(9600); delay(1000); Serial.println("Setup Complete"); pinMode(A1, INPUT); } void loop() { // put your main code here, to run repeatedly: int anPin; int ns; // avgPress(A0, 100); getPress(); String datString = String(resultData[0],3) + "," + String(resultData[1]) + "," + String(resultData[2]) + "," + String(resultData[3]) + "," + String(resultData[4]); Serial.println(datString); delay(500); }
2080ef921f705b160743c93892e3e3abb49cd3c2
2160fd4cc5cb24bb8427ec78ef9b2d3a9549c2c5
/src/scm/src/service.cpp
7e330a6d1966151ec965edb2f68284daa7e5f9f5
[ "MIT" ]
permissive
solosTec/cyng
7e698487ef57f050fc2b3e287aa79463b2debc9f
a55fc9a7566254cb8e60a51b9884b40f19f866b9
refs/heads/master
2023-07-25T11:49:07.089159
2022-10-21T15:17:13
2022-10-21T15:17:13
115,027,279
0
2
MIT
2022-10-21T15:17:14
2017-12-21T16:46:54
C++
UTF-8
C++
false
false
128
cpp
service.cpp
/* * The MIT License (MIT) * * Copyright (c) 2021 Sylko Olzscher * */ #include <cyng/scm/service.hpp> #include <string.h>
2bc19e796d7c5bdaed3fcb8f8da358ba1c087a24
6b2a8dd202fdce77c971c412717e305e1caaac51
/solutions_1485488_1/C++/jxwuyi/main.cpp
84d0d4145b6467df9420184cafefaecf1efca167
[]
no_license
alexandraback/datacollection
0bc67a9ace00abbc843f4912562f3a064992e0e9
076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf
refs/heads/master
2021-01-24T18:27:24.417992
2017-05-23T09:23:38
2017-05-23T09:23:38
84,313,442
2
4
null
null
null
null
UTF-8
C++
false
false
2,933
cpp
main.cpp
#include<iostream> #include<algorithm> #include<vector> #include<set> #include<cstdio> #include<cstring> #include<cstdlib> #include<string> #include<queue> using namespace std; const int dir[4][2]={{0,1},{1,0},{-1,0},{0,-1}}; int N, M, H; int C[200][200], F[200][200]; inline bool inside(int x,int y){return x>=0&&x<N&&y>=0&&y<M;} int D[200][200]; inline bool checkmx(int &a, int b) { if(a < 0 || (b < a)) { a = b; return true; } return false; } struct data { int x, y, dis; inline data(int x=0,int y=0,int dis=0):x(x),y(y),dis(dis){}; }; bool operator < (const data&a, const data&b) { return a.dis > b.dis; } int checktime(int t, int a, int b, int c, int d) { //time to wait from (a,b) to (c,d) at time t if(F[c][d] + 50 > C[c][d]) return -1; if(F[a][b] + 50 > C[c][d]) return -1; if(F[c][d] + 50 > C[a][b]) return -1; int x = H - t + 50 - C[c][d]; if(x < 0) x = 0; return x; } inline int checkcost(int t, int a, int b) { int h = H - t; if(h >= F[a][b] + 20) return 10; else return 100; } void Dfs(int x,int y) { if(D[x][y] > -1) return; D[x][y] = 0; for(int d=0;d<4;++d) { int tx = x + dir[d][0], ty = y + dir[d][1]; if(!inside(tx,ty)) continue; if(checktime(0, x,y,tx,ty) == 0) Dfs(tx,ty); } } bool vis[200][200]; int que[200*200][2], fron, tail; void run() { scanf("%d %d %d", &H, &N, &M); cerr << H<<" "<<N<<" "<<M<<endl; for(int i=0;i<N;++i) for(int j=0;j<M;++j) scanf("%d", &C[i][j]); for(int i=0;i<N;++i) for(int j=0;j<M;++j) scanf("%d", &F[i][j]); memset(D, -1, sizeof(D)); set<data> T; T.insert(data(0,0,0)); D[0][0]=0; while(T.size()) { data t = *T.begin();T.erase(T.begin()); for(int d=0;d<4;++d) { int x = t.x + dir[d][0], y = t.y + dir[d][1]; if(inside(x,y)&&checktime(0,t.x,t.y,x,y)==0&&D[x][y]<0) { D[x][y]=0; T.insert(data(x,y,0)); } } } if(D[N-1][M-1]>-1) { printf("0.0\n"); return ; } priority_queue<data> Q; for(int i=0;i<N;++i) for(int j=0;j<M;++j) if(D[i][j] > -1) Q.push(data(i,j,0)); while(!Q.empty()) { data t = Q.top(); Q.pop(); if(t.dis != D[t.x][t.y]) continue; int x = t.x, y = t.y, dis = t.dis; if(x == N-1 && y == M -1) { printf("%d.%d\n", dis/10, dis%10); return; } int tx, ty, tmp; for(int d = 0; d < 4; ++ d) { tx = x + dir[d][0], ty = y + dir[d][1]; if(!inside(tx,ty)) continue; int wait = checktime(dis, x, y, tx, ty); if(wait < 0) continue; tmp = dis + wait + checkcost(dis + wait, x, y); if(checkmx(D[tx][ty], tmp)) Q.push(data(tx,ty,tmp)); } } } int main() { freopen("B.in", "r", stdin); freopen("B.out", "w", stdout); int test;scanf("%d", &test); for(int no=1;no<=test;++no) { printf("Case #%d: ",no); cerr << "no#"<<no<<endl; run(); } return 0; }
ff24da7eec5c8617dcb5b6edc04d956b0eeb16bd
83f67435eca92b0d1f4d7460f170671b7ecc1525
/system-app-master/src/StatisticsManager.cpp
0b08b02ad016f44ee9ec2379e53c48891403797f
[]
no_license
hirnevan/NanoFirewall
4310bce27549703bdfe7beba98231c47bbc35463
773c93d004d6c416321688ecf68e45ce56d9986d
refs/heads/master
2023-08-05T00:26:19.163964
2021-09-12T05:27:32
2021-09-12T05:27:32
405,502,067
1
0
null
null
null
null
UTF-8
C++
false
false
1,261
cpp
StatisticsManager.cpp
/* * StatisticsManager.cpp * * Created on: Apr 1, 2021 * Author: */ #include <ConfigManager.h> #include <StatisticsManager.h> #include <bits/types/struct_tm.h> #include <bits/types/time_t.h> #include <ctime> StatisticsManager::StatisticsManager() {} StatisticsManager::~StatisticsManager() {} /* * Increments one violation stat for today, but first checks whether the day * needs to be incremented * ConfigManager uses atomics violation counter so this function is thread-safe */ void StatisticsManager::add_violation() { time_t raw_time = time(NULL); tm *local_time = localtime(&raw_time); int day = local_time->tm_wday; StatisticsManager::update_day(day); ConfigManager::getInstanceConfigManager()->add_violation(day); } /* * Updates the config manager with the last day we set violation stats for * This function locks and is thread safe */ void StatisticsManager::update_day(int day) { ConfigManager *cm = ConfigManager::getInstanceConfigManager(); // Only one instance of this function should be ran at a time static std::mutex day_mutex; std::unique_lock<std::mutex> lock(day_mutex); if (day != cm->get_last_day()) { cm->set_last_day(day); cm->reset_violations(day); cm->writeConfigFile(); } }
4d485ba08982cb29ebc6fc7ffcb3725de41dfdf9
d0d0a4a33bf5aa1b9c608702e1bbaa1fd2b5e3eb
/oficina/arduino_code/luz.ino
7f77142ce19ef2fb88286a0a375361a0469ce462
[]
no_license
juanengml/oficinaEZAutomacao
0b2e79d829ca26faf13620bef464fc429d9f3a65
0a870c921f3aeb1431de1549ce9a8c6268ee61b3
refs/heads/master
2020-03-21T19:46:09.324838
2018-06-28T05:14:06
2018-06-28T05:14:06
138,968,681
0
0
null
null
null
null
UTF-8
C++
false
false
247
ino
luz.ino
int luz = 7; char letra; void setup() { Serial.begin(9600); pinMode(luz,OUTPUT); } void loop(){ letra = Serial.read(); switch(letra){ case 'l': digitalWrite(luz,HIGH); break; case 'd': digitalWrite(luz,LOW); break; } }
da33095623093c4b86f3f7b6e69e0dfa8de14a36
654fa2779996e7c9016f17d922acf03d0c806aef
/SIM5360_INTERNET.h
4ca5f72f1bdaa8ba5015f57055d136c256980d05
[]
no_license
abhayghatpande/IOXhop_SIM5360
e064a7165287a7bcd1210e37882d84456b77dc72
198393ec992e2ec0d2cb8d408330e89f9381ec35
refs/heads/master
2021-05-15T14:48:38.252866
2017-09-30T11:48:49
2017-09-30T11:48:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
594
h
SIM5360_INTERNET.h
/* File : SIM5360_INTERNET.h Codeing By IOXhop : www.ioxhop.com Sonthaya Nongnuch : www.fb.me/maxthai */ #ifndef SIM5360_INTERNET_H__ #define SIM5360_INTERNET_H__ #include "Arduino.h" #include <SoftwareSerial.h> #include "SIM5360.h" class SIM5360_INTERNET: public SIM5360 { public: SIM5360_INTERNET(SIM5360* obj) : MainObj(obj) { } bool AutoAPN(String Operator) ; void SetAPN(String APN, String Username, String Password) ; bool start() ; bool stop() ; private: String _APN_NAME, _APN_USERNAME, _APN_PASSWORD; SIM5360* MainObj; } ; #endif
3acb2121d84b79b6190b7d4c75e37ff84d12e1a4
dce759420dacb7bedba7501ac35f61eb04a0b66c
/Chapter5/Chapter5.cpp
a4576f16e5e6dfea31d0f169dd9c494f5058c2e5
[]
no_license
tyfurness/cpractice
f0b46a1e55f242a4e7f4b3fb1ba7c4f187c0273a
1fd89689d2c03ee1fe951ce761a96b5103bb49cc
refs/heads/master
2021-01-22T13:52:28.833343
2016-12-07T15:28:44
2016-12-07T15:28:44
68,628,930
0
0
null
null
null
null
UTF-8
C++
false
false
1,041
cpp
Chapter5.cpp
// Chapter5.cpp : Defines the entry point for the console application. // #pragma region Chapter 5.3 Quiz 1 #include "stdafx.h" #include <iostream> #include <cstdio> using namespace std; int calculate(int a, int b, char c) { switch (c) { case '+': return a + b; break; case '-': return a - b; break; case '*': return a * b; break; case '/': return a / b; break; case '%': return a % b; break; default: cout << "You didn't enter a valid operator" << endl; return 0; break; } } int main() { int valuea; int valueb; char valuec; cout << "Please enter the first int" << endl; cin >> valuea; cout << "Please enter the second int" << endl; cin >> valueb; cout << "Please enter one of the following +, -, *, /, or %" << endl; cin >> valuec; int sum = calculate(valuea, valueb, valuec); //cout << valuea << " " << valuec << " " << valueb << " is " << calculate(valuea, valueb, valuec); cout << "Sum is the following: " << sum << endl; std::getchar(); return 0; } #pragma endregion
6c25833cd2b55a14607db0728e36861e0babb859
6f06493bf8df1900ef5352208a2b8ebd2bfac37f
/OpenGLProject/fix_normals_material.cpp
c715a66a3bf1c7e29b05cfd4298f717129826ce2
[]
no_license
Cresspresso/RocketChess
c5df0f107cae1fc392976b9f2fb442c67e56431a
96c0372317e5f4ca2d866094f02e95f341794ce2
refs/heads/master
2022-03-14T06:40:50.469855
2019-11-11T01:42:51
2019-11-11T01:42:51
198,104,578
1
0
null
2019-09-02T04:31:58
2019-07-21T20:56:09
C++
UTF-8
C++
false
false
957
cpp
fix_normals_material.cpp
/* ** Bachelor of Software Engineering ** Media Design School ** Auckland ** New Zealand ** ** (c) 2019 Media Design School ** ** File : fix_normals_material.cpp ** ** Summary : Basic material with Model, FixNormals, and MVP matrices. ** ** Project : Robotron Summative ** Author : Elijah Shadbolt ** Email : elijah.sha7979@mediadesign.school.nz ** Date Edited : 10/06/2019 */ #include "world_math.hpp" #include "globals.hpp" #include "nvToolsExt.h" #include "fix_normals_material.hpp" void FixNormalsMaterial::prepare() { Super::prepare(); model = g_modelMatrix; fixNormals = calculateFixNormalsMatrix(model); } void FixNormalsMaterial::apply(GLuint program) { nvtxRangePush(__FUNCTIONW__); Super::apply(program); glUniformMatrix4fv(glGetUniformLocation(program, "model"), 1, GL_FALSE, glm::value_ptr(model)); glUniformMatrix3fv(glGetUniformLocation(program, "fixNormals"), 1, GL_FALSE, glm::value_ptr(fixNormals)); nvtxRangePop(); }
c89dc52205c2acb4b2889a2a110011072c2bcdb1
e636b2c888278f30d5ed8f3e898a79c616eae623
/src/UserSettings.hpp
b4210121693c9c3f6203f398c07bc0aac8f84e15
[ "MIT" ]
permissive
hephaisto/sharebuy
b160f55db67918ef8567cf7504f3785038781775
12a14aba0f7119d6db59f57e067d1f438f7a6329
refs/heads/master
2021-01-17T06:18:03.093559
2017-12-24T00:57:06
2017-12-24T00:57:06
51,721,797
0
0
null
null
null
null
UTF-8
C++
false
false
172
hpp
UserSettings.hpp
#include <Wt/WContainerWidget> #include "user/User.hpp" class UserSettings : public Wt::WContainerWidget { public: UserSettings(Wt::WContainerWidget *parent = NULL); };
2f6f4b3599e617ba28e3ce79fac5f21a3abe1bc9
6d4299ea826239093a91ff56c2399f66f76cc72a
/Visual Studio 2017/Projects/bbbb/bbbb/a.cpp
741591778822c847cf4f61ef3a5a83ef08e1dacb
[]
no_license
kongyi123/Algorithms
3eba88cff7dfb36fb4c7f3dc03800640b685801b
302750036b06cd6ead374d034d29a1144f190979
refs/heads/master
2022-06-18T07:23:35.652041
2022-05-29T16:07:56
2022-05-29T16:07:56
142,523,662
3
0
null
null
null
null
UTF-8
C++
false
false
424
cpp
a.cpp
#include <stdio.h> int arr[100]; int search(int s, int e, int val) { while (s <= e) { int mid = (s + e) / 2; if (val == arr[mid]) s = mid + 1; else if (val < arr[mid]) e = mid - 1; else s = mid + 1; } return s; } int main(void) { int n; scanf("%d", &n); for (int i = 1;i <= n;i++) { scanf("%d", &arr[i]); } int val; scanf("%d", &val); fprintf(stdout, "\ndap = %d", search(1, n, val)); return 0; }
c2a885c92cc5dc00bfe9bf14a12ecc3bba8b97a2
0f8a64268b51e650c3563164cb02886e6e0cd9a3
/client/Functools.h
76dc3d7ae99d59d44a0d7b69be857c3d2b38965b
[]
no_license
zbzbzb/ChatRoom
2a06205fad2609a9054ea8c322d0cc5b414a14a6
8188cba99d04146dbff62d3d150016b017dc7728
refs/heads/master
2021-04-29T12:58:39.438377
2018-03-17T06:47:08
2018-03-17T06:47:08
121,731,070
0
0
null
null
null
null
UTF-8
C++
false
false
371
h
Functools.h
// // Created by zhoubin on 2/15/18. // #ifndef SERVER_FUNCTOOLS_H #define SERVER_FUNCTOOLS_H #include<string> #include<vector> #include<map> using namespace std; class Functools { public: static void Split(std::string& s,std::string& delim,std::vector<std::string> & ret); static void PrintVector(const vector<string> &v); }; #endif //SERVER_FUNCTOOLS_H
23e188d46e93bcd78117196e444e281910cc5d27
051c898be81003a5c90f5a1ce77a252252774973
/preliminary/G/33915914.cpp
7f7139d5f7cb9da2690a05d75d0bc35ce51e3d0b
[]
no_license
mmatrosov/FKN2020
29caffa241882e672df654b4857b5674d5f96f6e
38bfa7811d4af175415f7cc4da81df44b5b4a74c
refs/heads/master
2022-12-27T19:15:05.849915
2020-10-16T07:12:27
2020-10-16T07:12:27
298,350,636
0
0
null
null
null
null
UTF-8
C++
false
false
2,307
cpp
33915914.cpp
#include<iostream> #include<cmath> #include<algorithm> #include<vector> #include<map> #include<unordered_set> #include<unordered_map> #include<map> #include<set> #include<random> #include<string> #include<algorithm> #include<queue> #include<stack> #include<deque> #include<bitset> #include<cstdio> #include<cassert> #include<sstream> #include<set> #define int long long int using namespace std; const int maxLog = 32; struct node{ int ind; node * go[2]; node(int ind = -1){ this->ind = ind; go[0] = nullptr; go[1] = nullptr; } }; typedef node * pnode; vector<int> getBin(int x){ vector<int> ans; for(int i = 0; i < maxLog; i++){ ans.push_back(x % 2); x /= 2; } reverse(ans.begin(), ans.end()); return ans; } struct trie{ pnode root; trie(){ root = new node(); } void add(int x, int ind){ vector<int> a = getBin(x); pnode v = root; for(auto i : a){ if(!v->go[i])v->go[i] = new node(); v = v->go[i]; } v->ind = ind; } void print(pnode v){ if(v->ind > -1)cout << v->ind << " "; if(v->go[0])print(v->go[0]); if(v->go[1])print(v->go[1]); } int getMaxXor(int x){ vector<int> a = getBin(x); pnode v = root; for(auto i : a){ if(v->go[i ^ 1])v = v->go[i ^ 1]; else v = v->go[i]; } return v->ind; } }; int n; vector<vector<pair<int, int>>> g; vector<int> pxor; void dfs(int v, int p = -1, int d = 0){ pxor[v] = d; for(auto t : g[v]){ int to = t.first, w = t.second; if(to == p)continue; dfs(to, v, d ^ w); } } signed main(){ cin >> n; g.resize(n); pxor.resize(n); for(int i = 1; i < n; i++){ int a, b, w; cin >> a >> b >> w; a--; b--; g[a].push_back({b, w}); g[b].push_back({a, w}); } dfs(0); trie t; t.add(pxor[0], 0); int ans = 0, a = 0, b = 0; for(int i = 1; i < n; i++){ int ind = t.getMaxXor(pxor[i]); if((pxor[ind] ^ pxor[i]) >= ans){ ans = pxor[ind] ^ pxor[i]; a = ind; b = i; } t.add(pxor[i], i); } cout << a + 1 << " " << b + 1 << "\n"; return 0; }
d993fe779adeb253313cd5707a65ea30cb6a29f6
b91504b35ed7b719ca786ffe8553b4fa00339aa5
/Search/LinearSearch.cpp
72686bcd003b1bdceb0671174b1de1c9db7526d9
[ "MIT" ]
permissive
kishoreuppalapati/Algorithms
661bb0c56c7a7f504c94b5b1effea249b882d78f
d29a10316219f320b0116ef3b412457a1c1aea26
refs/heads/master
2022-01-21T13:13:38.350628
2019-08-14T08:43:11
2019-08-14T08:43:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
419
cpp
LinearSearch.cpp
#include <bits/stdc++.h> using namespace std; int linear_search(int arr[], int n, int num); int main(void) { int arr[] = {3, 2, 1, 5, 4}; int searchNum = 5; cout << (linear_search(arr, 5, searchNum) == -1? "Not Found":"Found") << endl; return 0; } int linear_search(int arr[], int n, int num) { for(int i = 0; i < n; i++){ if(num == arr[i]) return 1; } return -1; }
1b63463cff7053af3316ffb41bddf07901d6aa5f
6430a1bd2fd5ef80959869deede66a06de1576e6
/src/Unigram_Model/Formatter/Unigram_Train_Data_Formatter.h
619101bd53b6aec40110f14b07113da44e85661a
[]
no_license
nandigama/Yahoo_LDA
d6df356012f71eb024287585e615732eb3cdf87c
37639dbd494d589858b7c428c8d49a7acbab399f
refs/heads/master
2020-04-08T21:13:18.516914
2011-07-14T06:40:43
2011-07-14T06:40:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,765
h
Unigram_Train_Data_Formatter.h
/***************************************************************************** The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/MPL/ Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. The Original Code is Copyright (C) by Yahoo! Research. The Initial Developer of the Original Code is Shravan Narayanamurthy. All Rights Reserved. ******************************************************************************/ /* * Unigram_Train_Data_Formatter.h * * Created on: 11-Jan-2011 * */ #ifndef UNIGRAM_TRAIN_DATA_FORMATTER_H_ #define UNIGRAM_TRAIN_DATA_FORMATTER_H_ #include "commons/Formatter/Data_Formatter.h" #include "commons/DocumentWriter.h" #include <fstream> #include "boost/unordered_set.hpp" class Unigram_Train_Data_Formatter: public Data_Formatter { public: Unigram_Train_Data_Formatter(); virtual ~Unigram_Train_Data_Formatter(); void format(); WordIndexDictionary& get_dictionary(); int get_num_docs(); int get_total_num_words(); protected: virtual int insert_word_to_dict(std::string word); int read_from_inp(LDA::unigram_document & wdoc, std::istream& inp); protected: WordIndexDictionary _dict; int _num_docs, _num_words_in_all_docs; boost::unordered_set<string> _stopWords; std::ifstream _in; DocumentWriter* _doc_writer; }; #endif /* UNIGRAM_TRAIN_DATA_FORMATTER_H_ */
bf0783aa1789fddf8e8f8eeee70ed6d7a78af3d9
35f9995cbc7c7a81bb66a862b52112f26ee6313e
/workdir/macros/basicFits.cc
611fec7b370681bb2a45873480fa16479b2dfb37
[]
no_license
yhshin11/AnaNaS
0ba38ed0850981cb517404ea498c209f66e95d1b
a249b5eaf2ab5eb6c842249490d081404ca723d6
refs/heads/master
2021-03-12T21:44:56.437693
2014-06-19T23:02:23
2014-06-19T23:02:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,456
cc
basicFits.cc
void fitMll() { RooRealVar m_Z0( "m_Z0", "Z0 mass", 91.188, "GeV/c^{2}" ); RooRealVar gamma_Z0( "gamma_Z0", "Z0 width", 2.4952, "GeV/c^{2}" ); RooRealVar m_ee( "m_ee","m_ee",50,120,"GeV/c^{2}" ); RooRealVar cb_bias_ee( "cb_bias_ee", "bias", 0.0, -1.0, 1.0,"GeV/c^{2}" ); RooRealVar cb_width_ee( "cb_width_ee","width", 1.31,0.9,1.8,"GeV/c^{2}" ); RooRealVar cb_alpha_ee( "cb_alpha_ee","alpha", 1.1,0.6,2.0 ); RooRealVar cb_power_ee( "cb_power_ee","power", 3.5, 0.5, 5.0 ); RooCBShape cb_pdf_ee( "cb_pdf_ee", "A Crystal Ball Lineshape", m_ee, cb_bias_ee, cb_width_ee, cb_alpha_ee, cb_power_ee ); RooBreitWigner bw_Z0( "bw_Z0","The true Z0 lineshape (BW)", m_ee , m_Z0, gamma_Z0 ); RooNumConvPdf bw_ee("bw_ee","Convolution", m_ee, bw_Z0, cb_pdf_ee ); bw_ee.setConvolutionWindow( cb_bias_ee, cb_width_ee, 50 ); RooRealVar lambda_ee( "lambda_ee", "exponent of background", 0., -100., 0.); RooExponential exp_ee( "pdf_bkg_ee", "Exponential background", m_ee, lambda_ee ); RooRealVar n_Z_ee( "n_Z_ee","n_Z_ee", 0., 20000.); RooRealVar n_bkg_ee( "n_bkg_ee","n_bkg_ee", 0., 1000.); RooRealVar f_bkg_ee( "f_bkg_ee","f_bkg_ee", 0., 1.); //RooRealVar xp("xp","xp",91,80,100,"GeV/c^{2}"); //RooRealVar sigp("sigp","sigp",2.5,0,10,"GeV/c^{2}"); //RooRealVar xi("xi","xi",-0.2002,-5,5); //RooRealVar rho1("rho1","rho1",0.1165,0,5); //RooRealVar rho2("rho2","rho2",-0.168,-5,5); //RooBukinPdf bukin_ee("bukin", "bukin", m_ee, xp, sigp, xi, rho1, rho2 ); // RooRealVar mean("xp","xp",91,80,100,"GeV/c^{2}"); // RooRealVar sigL("sigL","sigL",2.5,0,10,"GeV/c^{2}"); // RooRealVar sigR("sigR","sigR",2.5,0,10,"GeV/c^{2}"); // RooBifurGauss bg_ee("bg_ee", "bg_ee", m_ee, mean, sigL, sigR ); // RooArgList listPdf( exp_ee, bg_ee ); RooArgList listPdf( exp_ee, bw_ee ); //RooArgList listPdf( exp_ee, bukin_ee ); // RooArgList listPdfCoef( n_Z_ee, n_bkg_ee ); RooArgList listPdfCoef( f_bkg_ee ); RooAddPdf pdf( "pdf", "PDF ee", listPdf, listPdfCoef ); RooArgSet* params = pdf.getParameters( RooDataSet() ); params->readFromFile( "config/Zee.config", "READ", "Zee: Fit Parameters" ); cout << "Parameters configured" << endl; params->selectByAttrib("READ",kTRUE)->Print("v") ; cout << "Parameters NOT configured" << endl; params->selectByAttrib("READ",kFALSE)->Print("v") ; // // fitting // // RooFitResult* result = pdf.fitTo(*dataset,RooFit::FitOptions("rm0") ); RooFitResult* result = RooFitUtils::fit( pdf, *dataset ); // // RooPlot // RooPlot* plot = m_ee.frame(140); dataset->plotOn(plot); pdf.plotOn(plot, RooFit::Components("pdf_bkg_ee"), RooFit::LineStyle(kDashed), RooFit::LineColor(kRed)); pdf.plotOn(plot); plot->Draw(); // // Gautier's version of RooPlot... :) // TCanvas* c = RooFitUtils::newAddPdfPlot( pdf, *dataset, m_ee ); c->SetLogy(); c->Print(); } void fitMet() { RooRealVar peak("peak","peak",10,0,50); RooRealVar tail("tail","tail",0.1,-1,5); RooRealVar width("width","width",10,0,50); RooRealVar met("met","met",0,100,"GeV/c^{2}"); RooNovosibirsk pdf("novosibirsk", "novosibirsk", met, peak, width, tail ); RooArgSet* params = pdf.getParameters( RooDataSet() ); params->readFromFile( "config/Zee.config", "READ", "Zee: Fit Parameters" ); cout << "Parameters configured" << endl; params->selectByAttrib("READ",kTRUE)->Print("v") ; cout << "Parameters NOT configured" << endl; params->selectByAttrib("READ",kFALSE)->Print("v") ; RooFitResult* result = pdf.fitTo(*dataset,"rm0","c"); result->Print(); RooPlot* plot = met.frame(100); dataset->plotOn(plot); pdf.plotOn(plot); plot->Draw(); } void fitMatthieu() { TH1 *MET = new TH1D("MET","MET with PU",150,0,150); MET->SetBinContent(1,36); MET->SetBinContent(2,53); MET->SetBinContent(3,100); MET->SetBinContent(4,140); MET->SetBinContent(5,188); MET->SetBinContent(6,243); MET->SetBinContent(7,275); MET->SetBinContent(8,350); MET->SetBinContent(9,339); MET->SetBinContent(10,411); MET->SetBinContent(11,435); MET->SetBinContent(12,528); MET->SetBinContent(13,537); MET->SetBinContent(14,585); MET->SetBinContent(15,567); MET->SetBinContent(16,603); MET->SetBinContent(17,624); MET->SetBinContent(18,679); MET->SetBinContent(19,677); MET->SetBinContent(20,707); MET->SetBinContent(21,719); MET->SetBinContent(22,749); MET->SetBinContent(23,733); MET->SetBinContent(24,776); MET->SetBinContent(25,754); MET->SetBinContent(26,850); MET->SetBinContent(27,812); MET->SetBinContent(28,848); MET->SetBinContent(29,823); MET->SetBinContent(30,839); MET->SetBinContent(31,863); MET->SetBinContent(32,780); MET->SetBinContent(33,784); MET->SetBinContent(34,776); MET->SetBinContent(35,869); MET->SetBinContent(36,799); MET->SetBinContent(37,765); MET->SetBinContent(38,760); MET->SetBinContent(39,764); MET->SetBinContent(40,758); MET->SetBinContent(41,697); MET->SetBinContent(42,735); MET->SetBinContent(43,640); MET->SetBinContent(44,694); MET->SetBinContent(45,683); MET->SetBinContent(46,653); MET->SetBinContent(47,619); MET->SetBinContent(48,628); MET->SetBinContent(49,589); MET->SetBinContent(50,564); MET->SetBinContent(51,574); MET->SetBinContent(52,560); MET->SetBinContent(53,490); MET->SetBinContent(54,519); MET->SetBinContent(55,476); MET->SetBinContent(56,407); MET->SetBinContent(57,410); MET->SetBinContent(58,414); MET->SetBinContent(59,346); MET->SetBinContent(60,367); MET->SetBinContent(61,349); MET->SetBinContent(62,339); MET->SetBinContent(63,317); MET->SetBinContent(64,279); MET->SetBinContent(65,270); MET->SetBinContent(66,258); MET->SetBinContent(67,233); MET->SetBinContent(68,222); MET->SetBinContent(69,205); MET->SetBinContent(70,202); MET->SetBinContent(71,183); MET->SetBinContent(72,192); MET->SetBinContent(73,160); MET->SetBinContent(74,168); MET->SetBinContent(75,137); MET->SetBinContent(76,124); MET->SetBinContent(77,133); MET->SetBinContent(78,87); MET->SetBinContent(79,99); MET->SetBinContent(80,80); MET->SetBinContent(81,91); MET->SetBinContent(82,83); MET->SetBinContent(83,92); MET->SetBinContent(84,61); MET->SetBinContent(85,70); MET->SetBinContent(86,59); MET->SetBinContent(87,53); MET->SetBinContent(88,47); MET->SetBinContent(89,43); MET->SetBinContent(90,48); MET->SetBinContent(91,35); MET->SetBinContent(92,28); MET->SetBinContent(93,32); MET->SetBinContent(94,25); MET->SetBinContent(95,23); MET->SetBinContent(96,26); MET->SetBinContent(97,20); MET->SetBinContent(98,12); MET->SetBinContent(99,16); MET->SetBinContent(100,12); MET->SetBinContent(101,17); MET->SetBinContent(102,12); MET->SetBinContent(103,13); MET->SetBinContent(104,6); MET->SetBinContent(105,10); MET->SetBinContent(106,10); MET->SetBinContent(107,7); MET->SetBinContent(108,2); MET->SetBinContent(109,4); MET->SetBinContent(110,7); MET->SetBinContent(111,4); MET->SetBinContent(112,2); MET->SetBinContent(113,4); MET->SetBinContent(114,4); MET->SetBinContent(115,4); MET->SetBinContent(116,2); MET->SetBinContent(118,5); MET->SetBinContent(120,2); MET->SetBinContent(124,2); MET->SetBinContent(125,1); MET->SetBinContent(128,1); MET->SetBinContent(129,1); MET->SetBinContent(131,1); MET->SetBinContent(132,1); MET->SetBinContent(134,1); MET->SetBinContent(145,1); MET->Draw(); RooRealVar peak("peak","peak",10,0,50); RooRealVar tail("tail","tail",0.1,-1,5); RooRealVar width("width","width",10,0,50); RooRealVar lambda( "lambda","lambda",0, -100., 0.); RooRealVar met("met","met",0,200,"GeV/c^{2}"); RooNovosibirsk sig("novosibirsk", "novosibirsk", met, peak, width, tail ); RooExponential bkg( "exponential","exponential", met, lambda ); RooRealVar f( "f","f", 0, 0., 1. ); RooAddPdf pdf( "pdf", "pdf", bkg, sig, f ); Chi2 chi2( "chi2", MET, met, pdf ); cout << "Done. Now fit." << endl; RooFitResult* fitResult = chi2.fit(); // chi2.evaluate(); cout << "Done." << endl; fitResult->Print(); TFile* dumFile = TFile::Open("dum.root", "RECREATE" ); chi2.writeHist( dumFile ); }
0d26b38c9434636a3ea90ce12bead500fda8d472
d4041bd766a9cd3a3e41df6cc0b2b7971c7bbf25
/Template/function_template2.cpp
35956f26f14b2d9cba84f9742a591fa1143580c9
[]
no_license
Myung-Hyun/Object-Oriented-Programming
5962364c4c798d192aecc4c3e11b9ba7ae9fa083
cf371afdc977ed63ee3e553636d31a79394ebbfc
refs/heads/master
2022-12-22T08:17:11.286794
2020-10-01T08:57:34
2020-10-01T08:57:34
294,853,913
0
0
null
null
null
null
UTF-8
C++
false
false
593
cpp
function_template2.cpp
#include <iostream> using namespace std; //혼합된 매개변수를 이용하는 템플릿 함수. template<class TYPE> TYPE biggest (TYPE arr[], int arr_size); void main() { int ary1[4] = {10, 7, 11, 24}; cout << "Biggest Value is " << biggest(ary1, 4) << endl; float ary2[4] = {3.5f, 1.12f, 3.14f, 0.25f}; cout << "Biggest Value is " << biggest(ary2, 4) << endl; } template<class TYPE> TYPE biggest (TYPE arr[], int arr_size) { TYPE biggestVal = arr[0]; for( int idx = 0; idx < arr_size; idx++ ) { if( arr[idx] > biggestVal ) biggestVal = arr[idx]; } return biggestVal; }
5edf36e0926b4dac649b6293bd4f4f25acf5b643
84f3a4a858afa1a1f494556643b29aa706292261
/OpenMoCap/src/Input/BvhReader.h
e3edb02154774cb41c3ef2cc6b86d154f51f35f3
[]
no_license
jamieforth/OpenMoCap
ac44a86554983030ed0448855720084e4488d73b
45eaa1347d3160719147e52a20279937cc199837
refs/heads/master
2020-03-07T00:12:16.479130
2014-08-02T21:50:53
2014-08-02T21:50:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
531
h
BvhReader.h
/* * BvhReader.h * * Created on: 04/03/2009 * Author: David */ #ifndef BVHREADER_H_ #define BVHREADER_H_ #include <fstream> #include <iostream> #include "../Entities/Skeleton.h" #include "../Utils/Log.h" using namespace std; class BvhReader { public: BvhReader() { } BvhReader(string bvhFilePath); Skeleton getSkeleton(); private: void parseJoint(string parentJointName); CvPoint3D64f parseOffset(); Skeleton _skeleton; ifstream _bvhStream; }; #endif /* BVHREADER_H_ */
6e3dc878acfbe5f1f439d3ca70b4281b95aabf54
e685f4a1d066e61d9c79bdf47af2b7fe3ecf2fed
/Parser.cpp
bc9471959e3bd6495ea86c9735a9d326f57130a3
[]
no_license
winorun/NanoPC-asm
d3340e824632c252059d937de2ddd5d1df2eb283
3db47f7197c5ba3bb4319815426348bc71d47a17
refs/heads/master
2023-07-17T00:04:10.796017
2021-08-30T07:41:49
2021-08-30T07:41:49
387,640,186
0
0
null
null
null
null
UTF-8
C++
false
false
113
cpp
Parser.cpp
#include "Parser.h" Parser::Parser(std::istream &in = std::cin):d_scanner(in){ // d_scanner = Scanner(in); }
6f565b9a8821bceb7ca51d84b8e7cb4553e03ed7
ae1615a09bfb11551485dda857fe2e63837d4d73
/src/CrsFunctions.cc
4360df8637491a431a35e46e10debab507bbb200
[]
no_license
duanebyer/gen-tcs
64ae227a4d285632044f42ee5bef3186944913b7
25408eb4df779db93d2f7749005e5b4a00df5bf3
refs/heads/master
2023-01-03T06:35:23.782621
2020-10-29T21:08:46
2020-10-29T21:08:46
305,568,940
0
0
null
null
null
null
UTF-8
C++
false
false
2,082
cc
CrsFunctions.cc
#include <CrsFunctions.h> #include <KinFunctions.h> #include <iostream> #include <cmath> using namespace KinFuncs; static double sq(double x) { return x * x; } double CrsFuncs::BH( double s, double t, double p2, double p2prime, double q2prime, double k2, double a, double b, int weight) { // Fine structure constant. double alpha_em = 1. / 137; // Magnetic moment of the proton. double ammp = 2.793; double p2avg = 0.5*(p2 + p2prime); double beta = sqrt(1 - (4*k2)/q2prime); double r = sqrt(sq(s - q2prime - p2prime) - 4*q2prime*p2prime); // From Byckling equation (4.4.9). double cos_TH_Cm = (2*s*(t - p2 - p2prime) + (s + p2)*(s + p2prime - q2prime)) / sqrt(Lambda(s,p2,0)*Lambda(s,p2prime,q2prime)); double sin_TH_Cm = sqrt(1 - cos_TH_Cm*cos_TH_Cm); double Delta_Perp = sin_TH_Cm*r/(2*sqrt(s)); double L_BH = (sq(q2prime - t) - sq(b))/4; // TODO: Simplify sin(acos(...)) expression in L0_BH. double theta = acos(a / (beta * r)); double L0_BH = sq(q2prime*sin(theta))/4; // TODO: Fix this too. double A_BH = sq((s - p2)*Delta_Perp) - t*a*(a + b) - 0.5*(p2 + p2prime)*b*b - t*(2*p2 + 2*p2prime - t)*q2prime + (k2/L_BH)*( sq((q2prime - t)*(a + b) - (s - p2)*b) + t*(2*p2 + 2*p2prime - t)*sq(q2prime - t)); double B_BH = sq(q2prime + t) + b*b + 8*k2*q2prime - 4*k2*(t + 2*k2)*sq(q2prime - t)/L_BH; // TODO: Test if cross section changes if proton mass or p2avg is used for // form factor. double F1p = (1./((1 - t/0.71)*(1 - t/0.71)))*(1/(1 - t/(4.*p2avg) ))*( 1 - 2.79*t/( 4*p2avg) ); double F2p = (1./((1 - t/0.71)*(1 - t/0.71)))*(1/(1 - t/(4.*p2avg) ))*(ammp - 1); double weight_factor = weight == 1 ? L_BH / L0_BH : 1; double crs = (1/(2*M_PI))*weight_factor *(alpha_em*alpha_em*alpha_em/(4*M_PI*sq(s - p2))) *(beta/(-t*L_BH)) *((A_BH/(-t))*(sq(F1p) - (t/(4*p2avg))*sq(F2p)) + sq(F1p + F2p)*B_BH/2) *0.389379*1e9; return crs; } double CrsFuncs::BHInt( double s, double t, double p2, double p2prime, double q2prime, double k2, double a, double b, double Dterm, int weight) { return 0; }
6b291ad2e594057b1e330b44a4e56d4b0136e499
a4ea0b83c3443e174ba7d0b60fc6c6da3a031851
/src/output/concrete/OutputConsole.cpp
a0c030457146f626e1c06d68c105b54d82229f7f
[ "MIT" ]
permissive
ZeyadOsama/LoggerCPP
639ded4cfb417a08be047cf2a8da47f8af83f4a8
bc14e3ce318f15442462452d75a8c2b5cb30a20d
refs/heads/master
2023-02-15T20:16:29.272094
2021-01-09T17:19:42
2021-01-09T17:19:42
288,230,861
0
0
null
null
null
null
UTF-8
C++
false
false
923
cpp
OutputConsole.cpp
// // Created by zeyad-osama on 25/07/2020. // #include <logger/output/concrete/OutputConsole.hpp> #include <logger/utils/Utils.hpp> using namespace logger; using namespace logger::configurations; using namespace logger::output; using namespace logger::utils; OutputConsole::OutputConsole(const Configuration::Pointer &apConfiguration) { (void) apConfiguration; } void OutputConsole::Out(const Channel::Pointer &apChannel, const Log &apLog) const { const Timestamp &time = apLog.GetTimestamp(); fprintf(stdout, "\x1B[%02um%.4u-%.2u-%.2u %.2u:%.2u:%.2u.%.3u %-12s %s %s\x1b[39m\n", to_escape_code(apLog.GetLevel()), time.year, time.month, time.day, time.hour, time.minute, time.second, time.ms, apChannel->GetName(), to_string(apLog.GetLevel()), (apLog.GetStream()).str().c_str()); fflush(stdout); } void OutputConsole::Terminate() const {}
eaeb3c846d23a3cb378b98ef67629595f5f78f5a
317a15d287d27d5a6648a00e0da83a91aacb07a6
/Misc/EncoderPID/robot-config.h
bde26288964c7f71317cf818d9dcda59b19d2ce4
[]
no_license
DaleNaci/VEX
529f31b6d8169944d6a236d994a60a735cf1fa39
1a0d61076df5582760502c7934e99db9681c56f3
refs/heads/master
2020-04-18T03:53:17.361529
2019-04-26T23:00:59
2019-04-26T23:00:59
167,217,449
0
1
null
2019-02-08T23:37:01
2019-01-23T16:43:58
C++
UTF-8
C++
false
false
1,174
h
robot-config.h
/************************************************** * * * Team: 750E * Game: Turning Point * Header File * * ***************************************************/ //uses namespace for cleaner code; using namespace vex; /**************************************************/ /*Motor Port Declaration Panel*/ const int FRONT_RIGHT_PORT = PORT17; const int BACK_RIGHT_PORT = PORT10; const int FRONT_LEFT_PORT = PORT19; const int BACK_LEFT_PORT = PORT18; const int ROLLER_PORT = PORT20; const int LAUNCHER_PORT = PORT2; /***************************************************/ /**************************************************/ /*Initializing Panel*/ brain Brain = brain(); controller Controller1 = controller(); competition comp = competition(); motor RightMotorFront = motor(FRONT_RIGHT_PORT, true); motor RightMotorBack = motor(BACK_RIGHT_PORT, true); motor LeftMotorFront = motor(FRONT_LEFT_PORT, false); motor LeftMotorBack = motor(BACK_LEFT_PORT, false); motor RollerMotor = motor(ROLLER_PORT, false); motor LauncherMotor = motor(LAUNCHER_PORT, true); /**************************************************/ vex::gyro g = vex::gyro(Brain.ThreeWirePort.A);
8b0164cf46760b3025b791db301c5de49e11ad8f
460d867758e7805f77020269b82a34525b2ae99e
/src/graphics/SpriteManager.cc
16752b038c1d1c5f0a5de909d6a4762ab3af78a6
[]
no_license
mufeez-amjad/quadris
5b009207ee2bb5b42dbc9e27b10fffd8cf5cd7f7
e722ea7ddf3cb8d4918e810353413724493765be
refs/heads/master
2023-02-13T18:36:57.512074
2021-01-13T02:22:28
2021-01-13T02:22:28
322,971,229
0
0
null
null
null
null
UTF-8
C++
false
false
644
cc
SpriteManager.cc
#include "SpriteManager.h" #include <fstream> // Loads sprite asset files specified per line in spriteFile SpriteManager::SpriteManager(const std::string& spriteFile) { std::ifstream infile(spriteFile); std::string asset; while (infile >> asset) { std::shared_ptr<Sprite2D> sprite = std::make_shared<Sprite2D>(asset); this->_sprites[asset] = sprite; } } // Retrieve a sprite based off of the sprite's asset file std::shared_ptr<Sprite2D> SpriteManager::getSprite(const std::string& spriteFile) { if (this->_sprites.find(spriteFile) == this->_sprites.end()) return nullptr; return this->_sprites.at(spriteFile); }
05c4945c8ef2ad143135fb0d56be78eae4c0e6b8
c611b35a08d0abbce62c8a3e80ab747967460e4a
/tags/open64-1.0/osprey1.0/crayf90/sgi/cwh_preg.cxx
eaf9e9bfd7a6daf46a7c8c4fd79ce73fffad2b89
[]
no_license
svn2github/open64
301f132bdcb602d4e677fc23881ce602f3961969
88431de7e6860ed692c0c160724620e798de428a
refs/heads/master
2021-01-20T06:59:43.507059
2014-12-31T18:38:48
2014-12-31T18:38:48
24,089,237
3
1
null
null
null
null
UTF-8
C++
false
false
4,709
cxx
cwh_preg.cxx
/* Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it would be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Further, this software is distributed without any warranty that it is free of the rightful claim of any third person regarding infringement or the like. Any license provided herein, whether implied or otherwise, applies only to this software file. Patent licenses, if any, provided herein do not apply to combinations of this program with other software, or any other product whatsoever. You should have received a copy of the GNU General Public License along with this program; if not, write the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, Mountain View, CA 94043, or: http://www.sgi.com For further information regarding this notice, see: http://oss.sgi.com/projects/GenInfo/NoticeExplan */ /* ==================================================================== * ==================================================================== * * Module: cwh_preg.c * $Revision: 1.1.1.1 $ * $Date: 2005/10/21 19:00:00 $ * $Author: marcel $ * $Source: /proj/osprey/CVS/open64/osprey1.0/crayf90/sgi/cwh_preg.cxx,v $ * * Revision history: * dd-mmm-95 - Original Version * * Description: This file contains routines to provide pregs. * Copied from edwhirl.c, but later all the code to * recycle pregs was removed. * * ==================================================================== * ==================================================================== */ static char *source_file = __FILE__; #ifdef _KEEP_RCS_ID static char *rcs_id = "$Source: /proj/osprey/CVS/open64/osprey1.0/crayf90/sgi/cwh_preg.cxx,v $ $Revision: 1.1.1.1 $"; #endif /* _KEEP_RCS_ID */ /* sgi includes */ #include "defs.h" #include "stab.h" #include "strtab.h" #include "wn.h" /* conversion removes */ #include "cwh_defines.h" #include "cwh_preg.h" #include "cwh_addr.h" #define MTYPE_MAX MTYPE_V static TYPE_ID preg_ty_typeid[MTYPE_MAX]; static TYPE_ID preg_bt_typeid[MTYPE_MAX]; /*============================================= * * cwh_preg_next_preg * * Get the next preg of the given MTYPE. * *============================================= */ extern PREG_det cwh_preg_next_preg (TYPE_ID btype, char * name, WN * home_wn ) { PREG_det det ; DevAssert(((btype < MTYPE_MAX) && (btype > MTYPE_FIRST)), ("Missing mtype - 2")) ; det.preg_ty = Be_Type_Tbl(preg_ty_typeid[btype]) ; det.preg_st = MTYPE_To_PREG(preg_bt_typeid[btype]); det.preg = Create_Preg (btype, name); return (det); } /*============================================= * * cwh_preg_temp_save * * Saves the given WN in a preg, whose type is * that of the expression, and returns a * LDID of the preg. * *============================================= */ extern WN * cwh_preg_temp_save(char * name, WN * expr ) { TYPE_ID bt; PREG_NUM pr; WN *wn; bt = WNRTY(expr); pr = Create_Preg(bt,Index_To_Str(Save_Str(name))); cwh_addr_store_ST(MTYPE_To_PREG(bt), pr, NULL, expr); wn = WN_LdidPreg(bt,pr); return wn; } /*============================================= * * fe_preg_init * * Set up preg tables. * *============================================= */ extern void fe_preg_init (void) { int i ; for (i = 0 ; i < MTYPE_MAX ; i++ ) { preg_ty_typeid[i] = MTYPE_I4 ; preg_bt_typeid[i] = MTYPE_I4 ; } preg_ty_typeid[MTYPE_I8] = MTYPE_I8 ; preg_bt_typeid[MTYPE_I8] = MTYPE_I8 ; preg_ty_typeid[MTYPE_U1] = MTYPE_U4 ; preg_ty_typeid[MTYPE_U2] = MTYPE_U4 ; preg_ty_typeid[MTYPE_U4] = MTYPE_U4 ; preg_ty_typeid[MTYPE_U8] = MTYPE_U8 ; preg_bt_typeid[MTYPE_U8] = MTYPE_I8 ; preg_ty_typeid[MTYPE_F4] = MTYPE_F4 ; preg_bt_typeid[MTYPE_F4] = MTYPE_F4 ; preg_ty_typeid[MTYPE_F8] = MTYPE_F8 ; preg_bt_typeid[MTYPE_F8] = MTYPE_F8 ; preg_ty_typeid[MTYPE_FQ] = MTYPE_FQ ; preg_bt_typeid[MTYPE_FQ] = MTYPE_FQ ; preg_ty_typeid[MTYPE_C4] = MTYPE_F4 ; preg_bt_typeid[MTYPE_C4] = MTYPE_F4 ; preg_ty_typeid[MTYPE_C8] = MTYPE_F8 ; preg_bt_typeid[MTYPE_C8] = MTYPE_F8 ; preg_ty_typeid[MTYPE_CQ] = MTYPE_FQ ; preg_bt_typeid[MTYPE_CQ] = MTYPE_FQ ; } /* fe_preg_init */
e9476e0779e43971b8636bbee6eb754fea541f55
b2c0517a0421c32f6782d76e4df842875d6ffce5
/Algorithms/Math/1022. Smallest Integer Divisible by K.cpp
b19a0aca2c54012796f06c74b5786cf62c8e4eb4
[]
no_license
SuYuxi/yuxi
e875b1536dc4b363194d0bef7f9a5aecb5d6199a
45ad23a47592172101072a80a90de17772491e04
refs/heads/master
2022-10-04T21:29:42.017462
2022-09-30T04:00:48
2022-09-30T04:00:48
66,703,247
1
0
null
null
null
null
UTF-8
C++
false
false
625
cpp
1022. Smallest Integer Divisible by K.cpp
//Pigeonhole principle //if there is only K - 1 remainders with K, there will bee a duplicate remainders which //will cause a modulo loop. So either there is no number divisible by K //or there is a number which the number is less than or equal K //1 % 6 = 1 //11 % 6 = 5 //111 % 6 = 3 //1111 % 6 = 1 equal (111 % 6) * 10 + 1 //11111 % 6 = 5 //111111 % 6 = 3 class Solution { public: int smallestRepunitDivByK(int K) { if((K & 1) == 0 || (K % 10) == 5) return -1; //it's optional int N = 0; for(int bits = 1; bits <= K; bits += 1) { N = (N * 10 + 1) % K; if(N == 0) return bits; } return -1; } };
89ba5f6b7ffb9e7ace6b85b46da7a6c300e25fe6
96af801758f51262f725d68c6b04b7b31d4d7a51
/poj/graph/3255.cpp
3b629b38f5cb83f24d52115777bbca4717761114
[]
no_license
wangjild/oj
2a2e3e60dfebffb3b28a3f71534c09540528ed7e
7daedce47bbef61055a4ad01b0e7a439351f1f7f
refs/heads/master
2021-01-01T17:38:03.488140
2014-04-01T07:07:32
2014-04-01T07:07:32
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,594
cpp
3255.cpp
#include <vector> #include <cstdio> #include <cstdlib> #include <limits.h> #include <utility> #include <queue> #include <vector> using namespace std; typedef struct edge_e { int to, cost; } edge; #define MAX_N 5001 int N, R; vector<edge> G[MAX_N]; int dist[MAX_N]; int dist2[MAX_N]; int main() { typedef pair<int, int> P; priority_queue<P, vector<P>, greater<P> > que; scanf("%d%d", &N, &R); int from, to, cost; while (R--) { scanf("%d%d%d", &from, &to, &cost); edge e; e.to = to; e.cost = cost; G[from].push_back(e); } fill(dist, dist + N + 1, INT_MAX); fill(dist2, dist2 + N + 1, INT_MAX); dist[1] = 0; que.push(P(0, 1)); while (!que.empty()) { P p = que.top(); que.pop(); int v = p.second, d = p.first; if (dist2[v] < d) continue; for (int i = 0; i < G[v].size(); ++i) { edge &e = G[v][i]; int d2 = d + e.cost; if (dist[e.to] > d2) { swap(dist[e.to], d2); que.push(P(dist[e.to], e.to)); } if (dist2[e.to] > d2 && dist[e.to] < d2) { dist2[e.to] = d2; que.push(P(dist2[e.to], e.to)); } } printf("cost1: "); for (int i = 0; i < N + 1; ++i) { printf("%10d ", dist[i]); } printf("\ncost2: "); for (int i = 0; i < N + 1; ++i) { printf("%10d ", dist2[i]); } printf("\n"); } printf("%d\n", dist2[N]); return 0; }
e4448ec905a64adcf62cbe4a49e2be3281c589e1
fc7c9b414bdb2c8e3a7690ca24ee7b37614e2478
/modules/PrizeBoardModule.cpp
bee8938693c40eca5d2919dc5ac5c456d785592e
[]
no_license
davidpuzey/peanuts
3be4e5f9563f400af541137c4dbb90586f67b28a
1cf879bc1db55163ce055b70143c7864cf5cd188
refs/heads/master
2016-09-05T21:38:04.235450
2015-12-19T18:42:22
2015-12-19T18:42:22
7,327,311
0
0
null
null
null
null
UTF-8
C++
false
false
5,789
cpp
PrizeBoardModule.cpp
#include <ctime> #include <QtWidgets> #include <QSound> #include "PrizeBoardModule.h" PrizeBoardModule::PrizeBoardModule() { setTitle("Prize Board"); setSettingsWidget(new BaseSettings); setControlWidget(new PrizeBoardControl); setLiveWidget(new PrizeBoardLive); BaseControl *control = getControlWidget(); BaseLive *live = getLiveWidget(); BaseSettings *settings = getSettingsWidget(); connect(control, SIGNAL(numberClicked(int)), live, SLOT(chooseNumber(int))); settings->set("test", "blah"); } PrizeBoardControl::PrizeBoardControl() { QGridLayout *layout = new QGridLayout(this); QHBoxLayout *lastRow = new QHBoxLayout(); int noButtons = 25; int cols = qCeil(qSqrt(noButtons)); // The closest square root value (works out best fit for the items) int cellSwitch = noButtons - (noButtons % cols); // The cell at which the last row starts // QSignalMapper seems to be the only way to pass the number clicked through (or at least the only way my limited googling turned up) QSignalMapper *signalMapper = new QSignalMapper(this); for (int i = 0; i < noButtons; i++) { QPushButton *button = new QPushButton(QString::number(i+1), this); button->setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); button->setCheckable(true); connect(button, SIGNAL(clicked(bool)), button, SLOT(setDisabled(bool))); connect(button, SIGNAL(clicked()), signalMapper, SLOT(map())); signalMapper->setMapping(button, i); if (i < cellSwitch) layout->addWidget(button, i / cols, i % cols); // To work out rows we divide the current item number by the number of items. To work out columns we take the remainder from the division (ie use modulus). else lastRow->addWidget(button); } if (cellSwitch != 0) layout->addLayout(lastRow, layout->rowCount(), 0, 1, cols); // Add the last row in seperately, this allows us to centre the buttons is there are less than the number of columns connect(signalMapper, SIGNAL(mapped(int)), this, SIGNAL(numberClicked(int))); setLayout(layout); } PrizeBoardLive::PrizeBoardLive() { QGridLayout *layout = new QGridLayout(this); QHBoxLayout *lastRow = new QHBoxLayout(); prizeBronze = new QPixmap("media/images/PrizeBronze.png"); prizeSilver = new QPixmap("media/images/PrizeSilver.png"); prizeGold = new QPixmap("media/images/PrizeGold.png"); int noButtons = 25; int cols = qCeil(qSqrt(noButtons)); // The closest square root value (works out best fit for the items) int cellSwitch = noButtons - (noButtons % cols); // The cell at which the last row starts /* Assign and randomise prizes */ int i = 0; // Keep track of the current array item int x = qCeil((noButtons*0.3)+0.5); // The point at which the prizes switch from silver to bronze, I'm thinking maybe about 30% of the total number are silver prizes prizes = new char[noButtons]; prizes[0] = 'G'; // Since we only want 1 gold we shall assign that now for (i = 1; i < x; i++) prizes[i] = 'S'; // Assign silver prizes for (;i < noButtons; i++) prizes[i] = 'B'; // Assing the rest as silver prizes qsrand(time(0)); for (i = 0; i < noButtons; i++) { // Shuffle prizes int j = qrand() % noButtons; char cur = prizes[i]; prizes[i] = prizes[j]; prizes[j] = cur; } numbers = new QLabelArray[noButtons]; for (int i = 0; i < noButtons; i++) { //numbers[i] = new QLabel(QString::number(i+1), this); numbers[i] = new QLabel(this); numbers[i]->setPixmap(outlineText(QString::number(i+1))); numbers[i]->setStyleSheet("qproperty-alignment: AlignCenter;"); if (i < cellSwitch) layout->addWidget(numbers[i], i / cols, i % cols); // To work out rows we divide the current item number by the number of items. To work out columns we take the remainder from the devision (ie use modulus). else lastRow->addWidget(numbers[i]); } if (cellSwitch != 0) layout->addLayout(lastRow, layout->rowCount(), 0, 1, cols); // Add the last row in seperately, this allows us to centre the buttons is there are less than the number of columns setLayout(layout); } void PrizeBoardLive::chooseNumber(int number) { //numbers[number]->setText(QString(QChar(prizes[number]))); QPixmap *prizeImage; switch(prizes[number]) { case 'B': if (isVisible()) QSound::play("media/sounds/PrizeBronze.wav"); prizeImage = prizeBronze; break; case 'S': if (isVisible()) QSound::play("media/sounds/PrizeSilver.wav"); prizeImage = prizeSilver; break; case 'G': if (isVisible()) QSound::play("media/sounds/PrizeGold.wav"); prizeImage = prizeGold; break; default: return; // TODO Some kind of error reporting perhaps? } QPixmap smallerPrize = prizeImage->scaled(numbers[number]->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation); QLabel *medal = new QLabel(numbers[number]->parentWidget()); medal->setPixmap(smallerPrize); medal->resize(smallerPrize.size()); // Using . rather than -> with smallerPrize because smallerPrize isn't a pointer medal->move(numbers[number]->geometry().center() - medal->geometry().center()); medal->show(); } QPixmap PrizeBoardLive::outlineText(QString text) { QPixmap *canvas = new QPixmap(200,200); canvas->fill(Qt::transparent); QFont font; font.setPointSize(60); font.setBold(true); QPen pen; // Give a nice black outline pen.setWidth(5); QPainterPath path; // Have to use path to get an outline path.addText(0,90, font, text); QPainter painter(canvas); // Make the outlines text painter.setBrush(QBrush(QColor(230, 0, 255))); painter.setPen(pen); painter.setRenderHint(QPainter::Antialiasing); painter.drawPath(path); painter.setFont(font); // Remove the rubbish from the image so we only have the text QRect textBounds = painter.boundingRect(canvas->rect(), 0, text); return canvas->copy(textBounds); }
a0c30b6cf4bb96d10d02df4b5466ba1f97286f0c
788cc0506043ff42faeffc2d265f6024927f2c78
/v1/test/test.h
64170bece790acd165c351e8f03206df5c338e64
[]
no_license
jumperbeng/pda_zw
85b1c2c3d3165fe44cc3cd0d71c99745a00f4ce5
0c8431d3a5ba8bf5d91f007a9a84b0c21f468a6d
refs/heads/master
2021-07-22T11:45:37.640146
2017-11-01T03:47:09
2017-11-01T03:47:09
106,499,784
2
0
null
null
null
null
UTF-8
C++
false
false
317
h
test.h
#include <iostream> #include <map> #include <utility> using namespace std; class Macro{ public: Macro(){w=0;h=0;} Macro(double w_value, double h_value){w=w_value;h=h_value;} double get_w(){return w;} double get_h(){return h;} private: double w; double h; }; //extern map<string, Macro> macro_list;
e2bf16ef82e4498cc3113e36fadee8a586bb6344
767aaefe9e81fe2327694e52afa935350620a265
/Invoice/main.cpp
7ba74a5abd93c833e2bcdf9aa7f24d1dfec967eb
[]
no_license
GLIKCH/Laborat-rio-LP1
13eb125626d8d84e3ffcb0edd4350f937b068487
864ebeac4a97f93b338346eb54e4f190f19e68a0
refs/heads/master
2022-02-12T13:31:40.403322
2019-07-24T01:53:01
2019-07-24T01:53:01
null
0
0
null
null
null
null
UTF-8
C++
false
false
581
cpp
main.cpp
#include <iostream> #include "Invoice.h" #include <string> using namespace std; int main() { Invoice t1 = Invoice(2, 3, "Item aleatorio", 300); cout<<"teste : "<<t1.getNum()<<"/"<<t1.getQtd()<<"/"<<t1.getDes()<<"/"<<t1.getVal()<<endl; cout<<"Total : "<<t1.getInvoiceAmount()<<endl; cout<<endl; t1.setNum(25); t1.setQtd(5); t1.setDes("Alo"); t1.setVal(5); cout<<"teste : "<<t1.getNum()<<"/"<<t1.getQtd()<<"/"<<t1.getDes()<<"/"<<t1.getVal()<<endl; cout<<"Total : "<<t1.getInvoiceAmount()<<endl; return 0; }
b9c0b2b7e8e4da74549df03f5d38c5855e24cf21
826572de7e451d38ea907bda59de2a9a86577112
/mainwindow.h
de3325afee97f3f4183a33485944bbe26cfdf4f4
[]
no_license
ffellix46/ControlBoxGUI
1565b961872372b13860f67979676cc0fb4010b5
0c16c4d411cea000a870f8068c927a6ddbd361fb
refs/heads/master
2020-04-10T01:55:27.874621
2019-01-06T11:14:45
2019-01-06T11:14:45
160,729,473
0
0
null
null
null
null
UTF-8
C++
false
false
2,014
h
mainwindow.h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QObject> #include <QDir> #include <QList> #include <QTableView> #include <QTimer> #include "UIclass/switch.h" #include "digitaloutputmodule.h" #include "digitalinputmodule.h" #include "controlboxserver.h" #include "typedefinitions.h" namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_startServerButton_clicked(); void on_stopServerButton_clicked(); void on_helpButton_clicked(); void on_DigitalSaveButton_clicked(); //Outputs void on_openDoorButton_pressed(); void on_openDoorButton_released(); void on_closeDoorButton_pressed(); void on_closeDoorButton_released(); void on_openTensButton_pressed(); void on_openTensButton_released(); void on_closeTensButton_pressed(); void on_closeTensButton_released(); void on_runProcessButton_pressed(); void on_runProcessButton_released(); void on_stopProcessButton_pressed(); void on_stopProcessButton_released(); //Inputs void on_addInputButton_clicked(); void on_cancelStackButton_clicked(); void on_pinSelectionButton_clicked(); void on_backStackButton_clicked(); void on_saveSettingsButton_popUP_clicked(); void on_deleteInputButton_clicked(); void updateIconStatus(); private: Ui::MainWindow *ui; QTimer *timer; DigitalOutputModule *digitalOutputModule; DigitalInputModule *digitalInputModule; ControlBoxServer *controlBoxServer; Colors *colors; MachineInputStatus *machineInputStatus; IsStatus *isStatus; InputStatusItem *inputstatusItem; int statusItem; bool isServer; void setupTable(); void ReadUserSavedVariable(); void writeInLog(QString message); void addStatus(QString status); void updateStatus(QString status); void deleteStatus(QString status); }; #endif // MAINWINDOW_H
248f949e3751c8226130b4cbc6746029ec48e33a
381ddecd3170b752288d298f6b69b72feb780347
/Classes/Card.h
238b3a06f8fa2d770fc3512def5e9acf540cbded
[]
no_license
danielZhang0601/DDZ
20dcae5124cd12839d280dbff907d622c577631f
411303ee0b814de955724d0d01a4b83d5785484c
refs/heads/master
2020-09-23T16:52:49.431901
2016-09-06T18:55:59
2016-09-06T18:55:59
67,536,345
1
0
null
null
null
null
UTF-8
C++
false
false
886
h
Card.h
// // Card.h // ddz // // Created by Admin on 16/9/7. // // #ifndef Card_h #define Card_h #include "cocos2d.h" enum CardNumber { Three = 3, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace, Two, Joker }; enum CardType { Diamond = 0, Club, Heart, Spade, Black, Red }; enum CardSide { Positive = 0, Negative }; class Card : public cocos2d::Sprite { public: Card(CardType type, CardNumber number); ~Card(); CardNumber getCardNumber(); CardType getCardType(); int getCardIndex(); void setCardSide(CardSide side); CardSide getCardSide(); void setSelected(bool select); bool isSelected(); private: CardNumber cardNumber; CardType cardType; int cardIndex; CardSide cardSide; bool isSelect; }; #endif /* Card_h */