blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
daa563807df09cbb4493d15181fe187fdc9fd401
3381a1d873db7f17ae9c3dd73c80d5a4d78e5888
/examples/ceres-solver-suitesparse/foo.cpp
0bae395a15792dd294eb404d6b695a6331e9f674
[ "BSD-2-Clause" ]
permissive
cpp-pm/hunter
0ad83226591ec55fe53fa7231a1ebe66d3c948c3
eb3c4ed0dc9dff5465a42a02328283a59f8e7919
refs/heads/master
2023-08-16T15:50:11.042008
2023-07-31T09:00:51
2023-07-31T09:00:51
204,031,579
570
209
BSD-2-Clause
2023-08-14T11:29:34
2019-08-23T16:10:46
CMake
UTF-8
C++
false
false
1,093
cpp
#include <ceres/ceres.h> #include <ceres/rotation.h> using ceres::AutoDiffCostFunction; using ceres::CostFunction; using ceres::Problem; using ceres::Solver; using ceres::Solve; struct ModelConst { // Calculate the residuals, // the input parameters are the ones optimized for template <typename T> bool operator()(const T* const x, T* residual) const { residual[0] = T(42) - x[0]; return true; } }; int main(int argc, char* argv[]) { Problem problem; // variable to optimize in place double x = 0; Solver::Options options; Solver::Summary summary; // use a sparse solver explicitly options.linear_solver_type = ceres::SPARSE_NORMAL_CHOLESKY; // print minimizer output options.minimizer_progress_to_stdout = true; // AutoDiffCostFunction<Model_to_use, numberOfResiduals, [dimOfParameter]+> CostFunction* cost_fun = new AutoDiffCostFunction<ModelConst, 1, 1>( new ModelConst()); problem.AddResidualBlock(cost_fun, NULL, &x); Solve(options, &problem, &summary); // output optimized result std::cout << "x: " << x << std::endl; }
[ "rgschweicher@riegl.com" ]
rgschweicher@riegl.com
23287868bf90fbbbdd46e83944a97a84a584137a
879681c994f1ca9c8d2c905a4e5064997ad25a27
/root-2.3.0/run/tutorials/multiphase/interFoam/laminar/damBreak/0.3/phi
0814da84030fd9e1c5bd8f5bc7ca1eaba33f3668
[]
no_license
MizuhaWatanabe/OpenFOAM-2.3.0-with-Ubuntu
3828272d989d45fb020e83f8426b849e75560c62
daeb870be81275e8a81f5cbac4ca1906a9bc69c0
refs/heads/master
2020-05-17T16:36:41.848261
2015-04-18T09:29:48
2015-04-18T09:29:48
34,159,882
1
0
null
null
null
null
UTF-8
C++
false
false
56,482
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.3.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class surfaceScalarField; location "0.3"; object phi; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 3 -1 0 0 0 0]; internalField nonuniform List<scalar> 4432 ( -9.38794e-07 9.38794e-07 2.6979e-06 -3.63669e-06 8.79123e-06 -6.09333e-06 1.53266e-05 -6.53542e-06 2.12038e-05 -5.87712e-06 2.61505e-05 -4.94668e-06 3.03096e-05 -4.15919e-06 3.39271e-05 -3.61745e-06 3.72013e-05 -3.27424e-06 4.02326e-05 -3.03126e-06 4.30228e-05 -2.79016e-06 4.54947e-05 -2.47197e-06 4.75088e-05 -2.01408e-06 4.88506e-05 -1.34182e-06 4.90539e-05 -2.03306e-07 4.72167e-05 1.83729e-06 4.21035e-05 5.11319e-06 3.22831e-05 9.82033e-06 1.7389e-05 1.48941e-05 -1.25287e-07 1.75143e-05 -1.28032e-05 1.26779e-05 -1.61322e-05 3.32899e-06 -1.61322e-05 -8.59426e-07 1.79822e-06 2.84846e-06 -7.34458e-06 8.96201e-06 -1.22069e-05 1.54743e-05 -1.30478e-05 2.13203e-05 -1.17231e-05 2.62487e-05 -9.87503e-06 3.04121e-05 -8.3226e-06 3.40584e-05 -7.26378e-06 3.73809e-05 -6.59673e-06 4.04723e-05 -6.12267e-06 4.33289e-05 -5.64669e-06 4.58722e-05 -5.01531e-06 4.7969e-05 -4.11089e-06 4.94491e-05 -2.82189e-06 5.0312e-05 -1.06619e-06 5.06738e-05 1.47542e-06 5.04203e-05 5.36667e-06 4.82612e-05 1.19794e-05 4.11502e-05 2.20052e-05 2.62253e-05 3.24392e-05 5.89068e-06 3.30125e-05 -4.16519e-06 1.33849e-05 -2.02974e-05 -6.931e-07 2.49131e-06 3.09178e-06 -1.11295e-05 9.20153e-06 -1.83166e-05 1.56206e-05 -1.94668e-05 2.13468e-05 -1.74493e-05 2.61814e-05 -1.47097e-05 3.03019e-05 -1.24431e-05 3.39576e-05 -1.09195e-05 3.73292e-05 -9.96836e-06 4.04932e-05 -9.28662e-06 4.34339e-05 -8.58738e-06 4.60687e-05 -7.65012e-06 4.82715e-05 -6.31369e-06 4.98911e-05 -4.44146e-06 5.07177e-05 -1.89285e-06 5.06205e-05 1.5727e-06 4.96929e-05 6.29419e-06 4.86223e-05 1.30501e-05 4.73462e-05 2.32812e-05 4.26392e-05 3.71462e-05 3.00687e-05 4.55831e-05 1.3118e-05 3.03355e-05 -7.17942e-06 -4.4722e-07 2.93853e-06 3.44858e-06 -1.50253e-05 9.54039e-06 -2.44084e-05 1.5821e-05 -2.57475e-05 2.1377e-05 -2.30052e-05 2.60863e-05 -1.9419e-05 3.01595e-05 -1.65162e-05 3.38429e-05 -1.46029e-05 3.72956e-05 -1.3421e-05 4.05701e-05 -1.25612e-05 4.36348e-05 -1.1652e-05 4.64016e-05 -1.04169e-05 4.87476e-05 -8.65971e-06 5.05276e-05 -6.22151e-06 5.15756e-05 -2.94081e-06 5.17332e-05 1.41511e-06 5.08776e-05 7.14972e-06 4.92754e-05 1.46523e-05 4.81474e-05 2.44092e-05 4.75577e-05 3.77359e-05 4.17791e-05 5.13616e-05 2.48087e-05 4.7306e-05 1.76292e-05 -1.08287e-07 3.04682e-06 3.89567e-06 -1.90292e-05 9.94256e-06 -3.04553e-05 1.6038e-05 -3.18429e-05 2.13821e-05 -2.83493e-05 2.59465e-05 -2.39834e-05 2.99771e-05 -2.05469e-05 3.37095e-05 -1.83353e-05 3.72718e-05 -1.69833e-05 4.06869e-05 -1.59763e-05 4.39044e-05 -1.48695e-05 4.6831e-05 -1.33435e-05 4.93492e-05 -1.11779e-05 5.13276e-05 -8.19993e-06 5.26253e-05 -4.2385e-06 5.31181e-05 9.22324e-07 5.27163e-05 7.55148e-06 5.13793e-05 1.59894e-05 4.9484e-05 2.63045e-05 4.83733e-05 3.88466e-05 4.52256e-05 5.45093e-05 3.05731e-05 6.19586e-05 4.82023e-05 2.119e-07 2.83492e-06 4.4076e-06 -2.32249e-05 1.03834e-05 -3.64311e-05 1.62494e-05 -3.77089e-05 2.13518e-05 -3.34517e-05 2.57664e-05 -2.8398e-05 2.97697e-05 -2.45502e-05 3.35753e-05 -2.21409e-05 3.72721e-05 -2.06801e-05 4.08495e-05 -1.95536e-05 4.42387e-05 -1.82587e-05 4.73431e-05 -1.64479e-05 5.00537e-05 -1.38885e-05 5.22539e-05 -1.04002e-05 5.38235e-05 -5.80808e-06 5.46577e-05 8.81463e-08 5.46829e-05 7.52621e-06 5.3869e-05 1.68033e-05 5.20081e-05 2.81654e-05 4.96319e-05 4.12227e-05 4.61544e-05 5.79868e-05 3.32076e-05 7.49053e-05 8.14099e-05 5.91549e-07 2.24338e-06 4.97681e-06 -2.76102e-05 1.08473e-05 -4.23016e-05 1.64447e-05 -4.33064e-05 2.129e-05 -3.8297e-05 2.55651e-05 -3.26731e-05 2.95656e-05 -2.85507e-05 3.34708e-05 -2.60461e-05 3.73237e-05 -2.45331e-05 4.10799e-05 -2.33098e-05 4.46556e-05 -2.18344e-05 4.79552e-05 -1.97475e-05 5.08798e-05 -1.68131e-05 5.33254e-05 -1.28457e-05 5.5184e-05 -7.66671e-06 5.63604e-05 -1.08825e-06 5.67901e-05 7.09649e-06 5.64515e-05 1.7142e-05 5.51155e-05 2.95014e-05 5.24342e-05 4.39039e-05 4.80583e-05 6.23628e-05 3.72197e-05 8.57438e-05 0.00011863 1.01692e-06 1.22646e-06 5.58547e-06 -3.21787e-05 1.1318e-05 -4.80341e-05 1.66281e-05 -4.86165e-05 2.12253e-05 -4.28942e-05 2.53892e-05 -3.6837e-05 2.94196e-05 -3.2581e-05 3.34518e-05 -3.00783e-05 3.74813e-05 -2.85625e-05 4.14335e-05 -2.7262e-05 4.52154e-05 -2.56163e-05 4.87365e-05 -2.32687e-05 5.19074e-05 -1.9984e-05 5.46286e-05 -1.55669e-05 5.67928e-05 -9.83091e-06 5.83091e-05 -2.6046e-06 5.91273e-05 6.27838e-06 5.92194e-05 1.70498e-05 5.84937e-05 3.02271e-05 5.64318e-05 4.59658e-05 5.191e-05 6.68846e-05 4.11721e-05 9.64817e-05 0.000159802 1.73277e-05 -1.73277e-05 2.37283e-05 -6.40058e-06 2.11815e-05 2.5467e-06 1.89651e-05 2.21636e-06 1.81458e-05 8.19304e-07 1.82927e-05 -1.46948e-07 1.93121e-05 -1.01933e-06 2.07112e-05 -1.39899e-06 2.19899e-05 -1.2787e-06 2.28376e-05 -8.47768e-07 2.30096e-05 -1.72051e-07 2.23907e-05 6.19015e-07 2.09897e-05 1.40097e-06 1.88367e-05 2.15302e-06 1.59894e-05 2.84727e-06 1.25454e-05 3.44399e-06 8.62772e-06 3.91764e-06 4.38683e-06 4.24086e-06 4.38686e-06 1.97331e-05 -3.70608e-05 2.48639e-05 -1.15315e-05 2.17567e-05 5.6538e-06 1.9695e-05 4.27802e-06 1.88872e-05 1.62709e-06 1.92156e-05 -4.75261e-07 2.0502e-05 -2.30565e-06 2.21534e-05 -3.05035e-06 2.36759e-05 -2.80127e-06 2.47982e-05 -1.97006e-06 2.5337e-05 -7.10855e-07 2.51421e-05 8.13941e-07 2.40544e-05 2.48873e-06 2.19992e-05 4.20821e-06 1.89903e-05 5.85608e-06 1.51064e-05 7.32786e-06 1.04965e-05 8.52756e-06 5.36403e-06 9.37337e-06 9.75081e-06 2.54015e-05 -6.24624e-05 2.70685e-05 -1.31985e-05 2.17728e-05 1.09494e-05 1.94851e-05 6.56565e-06 1.8435e-05 2.67718e-06 1.88956e-05 -9.35761e-07 2.03665e-05 -3.77653e-06 2.21359e-05 -4.81976e-06 2.3758e-05 -4.42346e-06 2.49175e-05 -3.12946e-06 2.54204e-05 -1.21378e-06 2.51372e-05 1.09724e-06 2.3982e-05 3.64394e-06 2.18954e-05 6.29476e-06 1.88889e-05 8.86256e-06 1.50249e-05 1.11918e-05 1.04431e-05 1.31093e-05 5.33792e-06 1.44786e-05 1.50887e-05 2.97453e-05 -9.22077e-05 2.80056e-05 -1.14589e-05 2.18277e-05 1.71273e-05 1.90998e-05 9.29353e-06 1.75732e-05 4.20376e-06 1.83917e-05 -1.75425e-06 2.01751e-05 -5.5598e-06 2.21506e-05 -6.79524e-06 2.39423e-05 -6.21527e-06 2.52124e-05 -4.39939e-06 2.57678e-05 -1.76918e-06 2.54847e-05 1.38038e-06 2.42918e-05 4.83685e-06 2.2148e-05 8.43841e-06 1.9075e-05 1.19354e-05 1.51515e-05 1.51153e-05 1.05178e-05 1.77428e-05 5.37331e-06 1.96231e-05 2.04622e-05 2.81822e-05 -0.00012039 2.4548e-05 -7.82469e-06 2.11489e-05 2.05263e-05 1.79244e-05 1.25181e-05 1.61017e-05 6.02647e-06 1.77296e-05 -3.38212e-06 1.99291e-05 -7.75927e-06 2.2185e-05 -9.05112e-06 2.42187e-05 -8.24893e-06 2.56486e-05 -5.82919e-06 2.63045e-05 -2.42509e-06 2.6076e-05 1.60886e-06 2.48955e-05 6.01728e-06 2.27251e-05 1.06087e-05 1.95827e-05 1.50776e-05 1.55585e-05 1.91395e-05 1.08003e-05 2.25011e-05 5.51816e-06 2.49053e-05 2.59803e-05 1.99299e-05 -0.00014032 1.60214e-05 -3.91622e-06 1.89768e-05 1.75709e-05 1.53939e-05 1.6101e-05 1.40165e-05 7.40398e-06 1.69045e-05 -6.27015e-06 1.95685e-05 -1.04233e-05 2.22253e-05 -1.17078e-05 2.45853e-05 -1.06089e-05 2.62175e-05 -7.46136e-06 2.69969e-05 -3.20454e-06 2.68458e-05 1.75985e-06 2.56943e-05 7.16876e-06 2.35035e-05 1.27995e-05 2.02894e-05 1.82918e-05 1.61382e-05 2.32907e-05 1.12127e-05 2.74266e-05 5.73232e-06 3.03859e-05 3.17125e-05 1.12057e-05 -0.000151526 -2.27534e-06 9.56485e-06 3.42447e-06 1.1871e-05 9.97827e-06 9.54717e-06 1.1816e-05 5.56629e-06 1.62132e-05 -1.06673e-05 1.91373e-05 -1.33472e-05 2.23063e-05 -1.48768e-05 2.50542e-05 -1.33568e-05 2.69131e-05 -9.3203e-06 2.78441e-05 -4.13554e-06 2.77872e-05 1.8167e-06 2.66746e-05 8.28149e-06 2.44646e-05 1.50095e-05 2.11629e-05 2.15936e-05 1.68606e-05 2.7593e-05 1.17275e-05 3.25597e-05 5.9995e-06 3.61138e-05 3.7712e-05 -3.23401e-07 -0.000151202 -3.90064e-05 4.82478e-05 -1.57695e-05 -1.13657e-05 3.8561e-06 -1.00785e-05 1.01009e-05 -6.78421e-07 1.61338e-05 -1.67002e-05 1.89682e-05 -1.61816e-05 2.2621e-05 -1.85297e-05 2.56996e-05 -1.64354e-05 2.77777e-05 -1.13984e-05 2.88639e-05 -5.2217e-06 2.89102e-05 1.77038e-06 2.78424e-05 9.34939e-06 2.56078e-05 1.72441e-05 2.22044e-05 2.4997e-05 1.77207e-05 3.20766e-05 1.23405e-05 3.79398e-05 6.31717e-06 4.21369e-05 4.4029e-05 3.58152e-06 -2.35506e-06 1.38715e-05 -4.24687e-05 2.56322e-05 -5.97947e-05 3.60109e-05 -5.89952e-05 4.50735e-05 -5.19568e-05 5.37259e-05 -4.54894e-05 6.25369e-05 -4.13921e-05 7.16039e-05 -3.91453e-05 8.07678e-05 -3.77265e-05 8.98002e-05 -3.62944e-05 9.85003e-05 -3.43163e-05 0.000106704 -3.1472e-05 0.000114248 -2.75283e-05 0.000120948 -2.2267e-05 0.000126619 -1.55016e-05 0.000131099 -7.08436e-06 0.000134328 3.04914e-06 0.000136177 1.52001e-05 0.00013675 2.96544e-05 0.000136018 4.6698e-05 0.000135012 6.7891e-05 0.000140634 9.08598e-05 0.000129836 0.000170599 5.65819e-06 -8.01325e-06 1.66419e-05 -5.34525e-05 2.75524e-05 -7.07052e-05 3.67045e-05 -6.81473e-05 4.50271e-05 -6.02794e-05 5.36213e-05 -5.40836e-05 6.28352e-05 -5.0606e-05 7.24841e-05 -4.87941e-05 8.22399e-05 -4.74823e-05 9.18281e-05 -4.58826e-05 0.000101079 -4.35672e-05 0.000109874 -4.02671e-05 0.000118138 -3.57924e-05 0.000125795 -2.9924e-05 0.000132817 -2.25235e-05 0.000139373 -1.36408e-05 0.000145151 -2.72829e-06 0.000150386 9.96493e-06 0.000154882 2.51586e-05 0.000159733 4.18467e-05 0.000168101 5.95231e-05 0.000183027 7.59341e-05 9.88825e-05 0.00021398 8.02701e-06 -1.60403e-05 1.93015e-05 -6.47269e-05 2.88038e-05 -8.02076e-05 3.66053e-05 -7.59489e-05 4.43653e-05 -6.80393e-05 5.29949e-05 -6.27131e-05 6.24112e-05 -6.00223e-05 7.21703e-05 -5.85532e-05 8.19077e-05 -5.72198e-05 9.1426e-05 -5.54009e-05 0.000100667 -5.28077e-05 0.000109595 -4.91959e-05 0.000118386 -4.45831e-05 0.000127186 -3.87242e-05 0.000135892 -3.12297e-05 0.000144093 -2.1841e-05 0.000152268 -1.09038e-05 0.000161053 1.17983e-06 0.000167509 1.87028e-05 0.000174581 3.47747e-05 0.000184346 4.97582e-05 0.000196292 6.39886e-05 7.71029e-05 0.000218071 1.11649e-05 -2.72052e-05 2.22754e-05 -7.58374e-05 2.93874e-05 -8.73196e-05 3.54659e-05 -8.20274e-05 4.27719e-05 -7.53454e-05 5.15142e-05 -7.14554e-05 6.10642e-05 -6.95724e-05 7.09466e-05 -6.84356e-05 8.10222e-05 -6.72954e-05 9.13507e-05 -6.57293e-05 0.000102223 -6.36803e-05 0.000113533 -6.05056e-05 0.000125533 -5.65836e-05 0.000138757 -5.19473e-05 0.000153377 -4.58501e-05 0.000168512 -3.69762e-05 0.000181945 -2.43361e-05 0.000189493 -6.36891e-06 0.000193219 1.49776e-05 0.000194952 3.30414e-05 0.000198547 4.61632e-05 0.00020563 5.69058e-05 6.41908e-05 0.000218542 1.63016e-05 -4.35068e-05 2.80202e-05 -8.75559e-05 3.11338e-05 -9.04333e-05 3.49639e-05 -8.58574e-05 4.24666e-05 -8.28481e-05 5.24308e-05 -8.14196e-05 6.34689e-05 -8.06105e-05 7.52706e-05 -8.02373e-05 8.81432e-05 -8.01681e-05 0.000102718 -8.03045e-05 0.000120002 -8.0964e-05 0.000137968 -7.84713e-05 0.000157675 -7.62905e-05 0.000180573 -7.48456e-05 0.000206247 -7.15244e-05 0.000231514 -6.22434e-05 0.000251935 -4.47569e-05 0.000255832 -1.02661e-05 0.000247755 2.30546e-05 0.000234638 4.6159e-05 0.000223277 5.75236e-05 0.000218445 6.17382e-05 6.21748e-05 0.000220461 2.50308e-05 -6.85375e-05 3.81453e-05 -0.000100671 3.64049e-05 -8.86928e-05 3.87026e-05 -8.81552e-05 4.79382e-05 -9.20836e-05 6.05896e-05 -9.4071e-05 7.43109e-05 -9.43317e-05 8.94997e-05 -9.54261e-05 0.000107393 -9.80617e-05 0.000129958 -0.00010287 0.000154635 -0.000105641 0.000174995 -9.88312e-05 0.000201315 -0.000102611 0.000229088 -0.000102618 0.000255976 -9.84122e-05 0.000277548 -8.38156e-05 0.000290059 -5.72685e-05 0.000294071 -1.42778e-05 0.00028973 2.73957e-05 0.000279323 5.65666e-05 0.000264574 7.22725e-05 0.000245034 8.12783e-05 7.67211e-05 0.000230487 3.26857e-05 -0.000101223 4.48872e-05 -0.000112872 4.58114e-05 -8.96169e-05 4.96634e-05 -9.20072e-05 6.02183e-05 -0.000102639 7.07915e-05 -0.000104644 8.07144e-05 -0.000104255 9.0815e-05 -0.000105527 0.000102116 -0.000109362 0.000115893 -0.000116647 0.000135306 -0.000125054 0.000165614 -0.00012914 0.000194236 -0.000131233 0.000224616 -0.000132998 0.00025444 -0.000128236 0.000278458 -0.000107833 0.000293531 -7.23419e-05 0.000304153 -2.48991e-05 0.000305889 2.5659e-05 0.000297143 6.53129e-05 0.000283715 8.57002e-05 0.00027236 9.26334e-05 8.96354e-05 0.000259446 9.13425e-06 -0.000110357 1.72393e-05 -0.000120977 3.37687e-05 -0.000106146 4.2233e-05 -0.000100471 4.59488e-05 -0.000106354 5.18096e-05 -0.000110505 5.99179e-05 -0.000112363 6.96838e-05 -0.000115293 8.28319e-05 -0.000122511 0.000100909 -0.000134724 0.000123151 -0.000147296 0.000148122 -0.00015411 0.000174109 -0.00015722 0.000203056 -0.000161945 0.00023333 -0.000158509 0.00025803 -0.000132534 0.0002731 -8.74112e-05 0.000279266 -3.10658e-05 0.000274174 3.07516e-05 0.000261659 7.78277e-05 0.00025127 9.60893e-05 0.000253573 9.03304e-05 7.29927e-05 0.000270216 -6.46468e-06 -0.000103893 -8.25861e-07 -0.000126616 1.36921e-05 -0.000120664 2.748e-05 -0.000114259 3.59188e-05 -0.000114793 4.2806e-05 -0.000117392 5.04326e-05 -0.000119989 5.98208e-05 -0.000124681 7.2024e-05 -0.000134714 8.70572e-05 -0.000149757 0.000103788 -0.000164026 0.000120783 -0.000171105 0.000136108 -0.000172545 0.000155107 -0.000180945 0.0001755 -0.000178902 0.000191345 -0.000148379 0.000200597 -9.66629e-05 0.000202668 -3.31376e-05 0.000202683 3.07372e-05 0.000206337 7.41735e-05 0.000220398 8.20286e-05 0.000248882 6.18461e-05 3.73527e-05 0.000284522 -2.2185e-06 -0.000101674 7.61542e-06 -0.00013645 1.59016e-05 -0.000128951 2.47068e-05 -0.000123064 3.26664e-05 -0.000122753 3.98323e-05 -0.000124558 4.67197e-05 -0.000126877 5.38882e-05 -0.000131849 6.16664e-05 -0.000142492 6.94687e-05 -0.00015756 7.67691e-05 -0.000171326 8.37342e-05 -0.00017807 8.78098e-05 -0.00017662 9.16967e-05 -0.000184832 9.22805e-05 -0.000179485 8.9746e-05 -0.000145845 8.98284e-05 -9.67453e-05 9.68771e-05 -4.01862e-05 0.000117661 9.95378e-06 0.00015677 3.50646e-05 0.000202883 3.59156e-05 0.000245594 1.91346e-05 3.86978e-06 0.000279077 5.36739e-06 -0.000107042 1.15156e-05 -0.000142598 1.69916e-05 -0.000134427 2.37603e-05 -0.000129833 3.08298e-05 -0.000129822 3.7318e-05 -0.000131046 4.30766e-05 -0.000132636 4.79407e-05 -0.000136713 5.13727e-05 -0.000145924 5.2684e-05 -0.000158871 5.20028e-05 -0.000170645 5.03713e-05 -0.000176439 4.60888e-05 -0.000172338 3.60098e-05 -0.000174753 2.69873e-05 -0.000170463 2.55662e-05 -0.000144424 3.50809e-05 -0.00010626 5.95297e-05 -6.4635e-05 0.000101129 -3.16451e-05 0.000151199 -1.50056e-05 0.000194242 -7.12737e-06 0.000222522 -9.14545e-06 -1.53527e-05 0.000241745 7.64863e-06 -0.00011469 1.21198e-05 -0.000147069 1.68255e-05 -0.000139132 2.30248e-05 -0.000136033 2.94511e-05 -0.000136248 3.54174e-05 -0.000137012 4.0679e-05 -0.000137897 4.45202e-05 -0.000140555 4.57929e-05 -0.000147196 4.38533e-05 -0.000156931 3.92221e-05 -0.000166014 3.33933e-05 -0.00017061 2.82418e-05 -0.000167186 1.80741e-05 -0.000164585 1.15591e-05 -0.000163948 1.78911e-05 -0.000150756 3.70115e-05 -0.00012538 6.51448e-05 -9.27683e-05 9.6717e-05 -6.32173e-05 0.000127141 -4.54296e-05 0.000153627 -3.36132e-05 0.000173518 -2.90366e-05 -3.12344e-05 0.000189399 8.08257e-06 -0.000122773 1.21122e-05 -0.000151099 1.6883e-05 -0.000143903 2.27121e-05 -0.000141862 2.86623e-05 -0.000142199 3.44151e-05 -0.000142765 3.97718e-05 -0.000143254 4.39058e-05 -0.000144689 4.55065e-05 -0.000148797 4.39522e-05 -0.000155377 3.99123e-05 -0.000161974 3.51718e-05 -0.000165869 3.30733e-05 -0.000165088 3.08967e-05 -0.000162409 2.58742e-05 -0.000158925 2.47339e-05 -0.000149615 3.24709e-05 -0.000133117 4.94993e-05 -0.000109797 7.20311e-05 -8.57491e-05 9.68865e-05 -7.02848e-05 0.000124828 -6.15543e-05 0.0001534 -5.76088e-05 -5.76143e-05 0.000179779 7.94205e-06 -0.000130715 1.1885e-05 -0.000155042 1.67589e-05 -0.000148777 2.23544e-05 -0.000147457 2.80413e-05 -0.000147886 3.37241e-05 -0.000148448 3.93782e-05 -0.000148908 4.44284e-05 -0.000149739 4.77248e-05 -0.000152093 4.85958e-05 -0.000156248 4.75091e-05 -0.000160887 4.57993e-05 -0.000164159 4.5564e-05 -0.000164853 4.59709e-05 -0.000162816 4.49508e-05 -0.000157905 4.51218e-05 -0.000149787 4.95457e-05 -0.000137541 6.17773e-05 -0.000122028 8.28515e-05 -0.000106823 0.000107676 -9.51097e-05 0.000134019 -8.7897e-05 0.000160029 -8.36185e-05 -8.18609e-05 0.000184275 7.41732e-06 -0.000138132 1.1548e-05 -0.000159173 1.6508e-05 -0.000153737 2.19386e-05 -0.000152888 2.74449e-05 -0.000153392 3.30164e-05 -0.00015402 3.87462e-05 -0.000154638 4.43911e-05 -0.000155384 4.91594e-05 -0.000156862 5.23779e-05 -0.000159466 5.411e-05 -0.000162619 5.50284e-05 -0.000165078 5.5968e-05 -0.000165792 5.7235e-05 -0.000164083 5.93291e-05 -0.000159999 6.29407e-05 -0.000153398 6.97767e-05 -0.000144377 8.15885e-05 -0.00013384 9.83563e-05 -0.000123591 0.000118459 -0.000115213 0.000140085 -0.000109523 0.000162343 -0.000105876 -0.00010399 0.000184472 6.84689e-06 -0.000144979 1.11741e-05 -0.0001635 1.61695e-05 -0.000158732 2.14681e-05 -0.000158186 2.68087e-05 -0.000158733 3.21964e-05 -0.000159407 3.77217e-05 -0.000160163 4.33522e-05 -0.000161014 4.86743e-05 -0.000162184 5.31202e-05 -0.000163912 5.64619e-05 -0.000165961 5.89433e-05 -0.000167559 6.10675e-05 -0.000167916 6.35579e-05 -0.000166573 6.69859e-05 -0.000163427 7.2123e-05 -0.000158535 7.99598e-05 -0.000152214 9.12333e-05 -0.000145113 0.000106018 -0.000138376 0.000123734 -0.000132929 0.000143335 -0.000129123 0.000164007 -0.000126548 -0.000125155 0.000185171 6.35274e-06 -0.000151332 1.08115e-05 -0.000167959 1.57792e-05 -0.0001637 2.09507e-05 -0.000163358 2.61408e-05 -0.000163923 3.13417e-05 -0.000164608 3.659e-05 -0.000165412 4.19091e-05 -0.000166333 4.71348e-05 -0.00016741 5.19101e-05 -0.000168687 5.59873e-05 -0.000170038 5.9485e-05 -0.000171057 6.28223e-05 -0.000171254 6.65531e-05 -0.000170304 7.12949e-05 -0.000168169 7.77004e-05 -0.000164941 8.63829e-05 -0.000160896 9.78011e-05 -0.000156532 0.000111897 -0.000152472 0.000128239 -0.000149271 0.000146253 -0.000147137 0.000165485 -0.00014578 -0.000145315 0.000185645 5.9444e-06 -0.000157276 1.04607e-05 -0.000172475 1.53627e-05 -0.000168602 2.0409e-05 -0.000168404 2.54674e-05 -0.000168981 3.05253e-05 -0.000169666 3.55796e-05 -0.000170466 4.06372e-05 -0.000171391 4.56475e-05 -0.00017242 5.04676e-05 -0.000173507 5.49909e-05 -0.000174561 5.93096e-05 -0.000175376 6.37273e-05 -0.000175671 6.86813e-05 -0.000175258 7.46241e-05 -0.000174112 8.20048e-05 -0.000172321 9.11992e-05 -0.00017009 0.000102424 -0.000167757 0.000115699 -0.000165747 0.000130868 -0.00016444 0.00014766 -0.000163929 0.000165821 -0.000163941 -0.000164691 0.000185197 5.6103e-06 -0.000162887 1.01193e-05 -0.000176984 1.49322e-05 -0.000173415 1.98534e-05 -0.000173325 2.4789e-05 -0.000173917 2.97347e-05 -0.000174612 3.46838e-05 -0.000175415 3.9627e-05 -0.000176334 4.45533e-05 -0.000177346 4.94449e-05 -0.000178399 5.42988e-05 -0.000179415 5.92004e-05 -0.000180277 6.4375e-05 -0.000180846 7.01231e-05 -0.000181006 7.67632e-05 -0.000180752 8.45941e-05 -0.000180152 9.38749e-05 -0.000179371 0.000104798 -0.00017868 0.00011745 -0.000178399 0.000131787 -0.000178777 0.000147672 -0.000179814 0.000164971 -0.00018124 -0.000183379 0.00018366 5.33358e-06 -0.00016822 9.78272e-06 -0.000181433 1.44863e-05 -0.000178119 1.92793e-05 -0.000178118 2.40913e-05 -0.000178729 2.89292e-05 -0.00017945 3.3798e-05 -0.000180284 3.86942e-05 -0.00018123 4.36209e-05 -0.000182273 4.85967e-05 -0.000183375 5.3664e-05 -0.000184483 5.89142e-05 -0.000185528 6.45075e-05 -0.000186439 7.06661e-05 -0.000187165 7.76232e-05 -0.000187709 8.56066e-05 -0.000188136 9.48252e-05 -0.00018859 0.00010544 -0.000189295 0.000117543 -0.000190502 0.000131147 -0.00019238 0.000146204 -0.000194871 0.000162693 -0.000197728 -0.00020139 0.000180703 5.09482e-06 -0.000173315 9.44419e-06 -0.000185782 1.40224e-05 -0.000182697 1.86797e-05 -0.000182776 2.33618e-05 -0.000183411 2.80811e-05 -0.000184169 3.28525e-05 -0.000185055 3.76872e-05 -0.000186065 4.25988e-05 -0.000187184 4.76151e-05 -0.000188391 5.27881e-05 -0.000189656 5.82062e-05 -0.000190946 6.39977e-05 -0.000192231 7.03296e-05 -0.000193497 7.7382e-05 -0.000194761 8.53384e-05 -0.000196092 9.43647e-05 -0.000197617 0.000104594 -0.000199524 0.000116114 -0.000202022 0.000128977 -0.000205243 0.000143198 -0.000209093 0.000158829 -0.00021336 -0.000218594 0.000176034 4.87743e-06 -0.000178193 9.09836e-06 -0.000190003 1.35362e-05 -0.000187135 1.80475e-05 -0.000187287 2.2589e-05 -0.000187952 2.71767e-05 -0.000188757 3.18283e-05 -0.000189707 3.65645e-05 -0.000190801 4.14097e-05 -0.00019203 4.63978e-05 -0.000193379 5.15815e-05 -0.00019484 5.7037e-05 -0.000196401 6.28682e-05 -0.000198062 6.92051e-05 -0.000199834 7.61913e-05 -0.000201748 8.39735e-05 -0.000203875 9.26824e-05 -0.000206326 0.000102429 -0.000209271 0.000113302 -0.000212895 0.000125372 -0.000217312 0.000138694 -0.000222416 0.000153369 -0.000228034 -0.000234807 0.000169582 4.67069e-06 -0.000182863 8.74184e-06 -0.000194075 1.30247e-05 -0.000191418 1.73776e-05 -0.00019164 2.17657e-05 -0.00019234 2.62061e-05 -0.000193197 3.07188e-05 -0.00019422 3.53261e-05 -0.000195408 4.00578e-05 -0.000196761 4.49521e-05 -0.000198273 5.00577e-05 -0.000199945 5.54404e-05 -0.000201784 6.11851e-05 -0.000203806 6.73936e-05 -0.000206042 7.41803e-05 -0.000208535 8.16575e-05 -0.000211352 8.99343e-05 -0.000214602 9.91019e-05 -0.000218439 0.000109244 -0.000223038 0.000120443 -0.000228511 0.000132776 -0.000234749 0.000146375 -0.000241633 -0.000249878 0.000161446 4.46713e-06 -0.00018733 8.37125e-06 -0.000197979 1.24853e-05 -0.000195532 1.66664e-05 -0.000195821 2.08855e-05 -0.00019656 2.51605e-05 -0.000197472 2.95113e-05 -0.00019857 3.39619e-05 -0.000199859 3.85404e-05 -0.00020134 4.32838e-05 -0.000203017 4.82373e-05 -0.000204899 5.34573e-05 -0.000207004 5.90128e-05 -0.000209362 6.49827e-05 -0.000212012 7.14548e-05 -0.000215007 7.85187e-05 -0.000218416 8.62621e-05 -0.000222346 9.47588e-05 -0.000226936 0.000104086 -0.000232365 0.000114315 -0.00023874 0.000125537 -0.000245971 0.000137887 -0.000253983 -0.000263564 0.000151573 4.26158e-06 -0.000191592 7.98422e-06 -0.000201701 1.19165e-05 -0.000199464 1.59122e-05 -0.000199817 1.99466e-05 -0.000200594 2.40369e-05 -0.000201562 2.82026e-05 -0.000202736 3.24661e-05 -0.000204122 3.68537e-05 -0.000205727 4.13983e-05 -0.000207561 4.61392e-05 -0.00020964 5.11236e-05 -0.000211989 5.64057e-05 -0.000214644 6.20466e-05 -0.000217653 6.81153e-05 -0.000221076 7.46779e-05 -0.000224979 8.18039e-05 -0.000229472 8.95488e-05 -0.000234681 9.79734e-05 -0.00024079 0.00010714 -0.000247906 0.000117122 -0.000255953 0.000128029 -0.00026489 -0.000275538 0.000140003 4.0504e-06 -0.000195642 7.57927e-06 -0.00020523 1.13181e-05 -0.000203203 1.51152e-05 -0.000203614 1.89495e-05 -0.000204428 2.28372e-05 -0.00020545 2.67958e-05 -0.000206695 3.0845e-05 -0.000208172 3.50081e-05 -0.000209891 3.9313e-05 -0.000211866 4.3792e-05 -0.000214119 4.84827e-05 -0.000216679 5.34263e-05 -0.000219588 5.867e-05 -0.000222897 6.42632e-05 -0.000226669 7.02557e-05 -0.000230971 7.66958e-05 -0.000235912 8.36254e-05 -0.00024161 9.10832e-05 -0.000248247 9.91068e-05 -0.00025593 0.000107754 -0.000264601 0.00011709 -0.000274226 -0.000285605 0.000127157 3.83069e-06 -0.000199473 7.15628e-06 -0.000208556 1.06915e-05 -0.000206738 1.42784e-05 -0.000207201 1.78994e-05 -0.000208049 2.15682e-05 -0.000209119 2.53002e-05 -0.000210427 2.91119e-05 -0.000211983 3.30228e-05 -0.000213802 3.70549e-05 -0.000215898 4.12328e-05 -0.000218297 4.55848e-05 -0.000221031 5.01414e-05 -0.000224144 5.49352e-05 -0.000227691 5.99995e-05 -0.000231733 6.53711e-05 -0.000236343 7.10776e-05 -0.000241619 7.71392e-05 -0.000247672 8.35791e-05 -0.000254687 9.04192e-05 -0.00026277 9.76927e-05 -0.000271874 0.000105409 -0.000281943 -0.000293745 0.000113549 3.60158e-06 -0.000203075 6.71808e-06 -0.000211673 1.00408e-05 -0.000210061 1.34073e-05 -0.000210567 1.68029e-05 -0.000211445 2.02392e-05 -0.000212555 2.37285e-05 -0.000213916 2.7284e-05 -0.000215539 3.09204e-05 -0.000217438 3.46537e-05 -0.000219632 3.85022e-05 -0.000222145 4.2484e-05 -0.000225013 4.66183e-05 -0.000228279 5.09255e-05 -0.000231998 5.54249e-05 -0.000236233 6.01384e-05 -0.000241056 6.50749e-05 -0.000246555 7.02451e-05 -0.000252842 7.56457e-05 -0.000260088 8.12777e-05 -0.000268402 8.71509e-05 -0.000277748 9.32632e-05 -0.000288055 -0.00029999 9.95077e-05 3.36535e-06 -0.00020644 6.26972e-06 -0.000214577 9.3722e-06 -0.000213164 1.25096e-05 -0.000213705 1.567e-05 -0.000214605 1.88625e-05 -0.000215748 2.20966e-05 -0.00021715 2.53815e-05 -0.000218824 2.87271e-05 -0.000220784 3.21439e-05 -0.000223048 3.56425e-05 -0.000225644 3.92325e-05 -0.000228603 4.29237e-05 -0.00023197 4.67234e-05 -0.000235798 5.06385e-05 -0.000240148 5.46765e-05 -0.000245094 5.88293e-05 -0.000250708 6.30949e-05 -0.000257108 6.74491e-05 -0.000264442 7.18809e-05 -0.000272834 7.63784e-05 -0.000282245 8.08892e-05 -0.000292566 -0.000304388 8.52868e-05 3.12584e-06 -0.000209566 5.81861e-06 -0.00021727 8.69382e-06 -0.000216039 1.15949e-05 -0.000216606 1.45122e-05 -0.000217523 1.74525e-05 -0.000218688 2.04219e-05 -0.00022012 2.34262e-05 -0.000221828 2.64706e-05 -0.000223828 2.95599e-05 -0.000226138 3.26976e-05 -0.000228781 3.58858e-05 -0.000231791 3.91243e-05 -0.000235208 4.24092e-05 -0.000239083 4.5735e-05 -0.000243473 4.90929e-05 -0.000248452 5.24669e-05 -0.000254082 5.58352e-05 -0.000260476 5.91589e-05 -0.000267766 6.24095e-05 -0.000276085 6.5555e-05 -0.000285391 6.85493e-05 -0.00029556 -0.000307039 7.12009e-05 2.8916e-06 -0.000212458 5.37242e-06 -0.000219751 8.01309e-06 -0.000218679 1.06722e-05 -0.000219265 1.33407e-05 -0.000220191 1.60232e-05 -0.00022137 1.87225e-05 -0.000222819 2.14407e-05 -0.000224546 2.41786e-05 -0.000226566 2.6936e-05 -0.000228895 2.97101e-05 -0.000231556 3.24953e-05 -0.000234577 3.52825e-05 -0.000237996 3.80585e-05 -0.000241859 4.08055e-05 -0.000246221 4.35003e-05 -0.000251147 4.61132e-05 -0.000256695 4.86123e-05 -0.000262975 5.0936e-05 -0.00027009 5.30446e-05 -0.000278194 5.4905e-05 -0.000287251 5.64586e-05 -0.000297114 -0.000308108 5.75279e-05 2.66949e-06 -0.000215127 4.93554e-06 -0.000222016 7.33455e-06 -0.000221078 9.74751e-06 -0.000221678 1.2164e-05 -0.000222608 1.45862e-05 -0.000223793 1.70136e-05 -0.000225246 1.94449e-05 -0.000226978 2.18768e-05 -0.000228998 2.43043e-05 -0.000231322 2.67191e-05 -0.00023397 2.91092e-05 -0.000236967 3.14574e-05 -0.000240344 3.37411e-05 -0.000244142 3.5931e-05 -0.00024841 3.79893e-05 -0.000253205 3.98797e-05 -0.000258585 4.15465e-05 -0.000264642 4.29222e-05 -0.000271466 4.39405e-05 -0.000279212 4.45746e-05 -0.000287885 4.47598e-05 -0.000297299 -0.000307702 4.43537e-05 2.46366e-06 -0.000217591 4.50758e-06 -0.00022406 6.65927e-06 -0.00022323 8.82379e-06 -0.000223842 1.09873e-05 -0.000224771 1.315e-05 -0.000225955 1.53078e-05 -0.000227404 1.7456e-05 -0.000229126 1.95879e-05 -0.00023113 2.1694e-05 -0.000233429 2.37611e-05 -0.000236038 2.57717e-05 -0.000238977 2.77019e-05 -0.000242274 2.95207e-05 -0.000245961 3.11887e-05 -0.000250079 3.26572e-05 -0.000254674 3.38748e-05 -0.000259803 3.4771e-05 -0.000265538 3.52598e-05 -0.000271955 3.52601e-05 -0.000279212 3.47237e-05 -0.000287349 3.3571e-05 -0.000296146 -0.000305813 3.1682e-05 2.27088e-06 -0.000219861 4.08385e-06 -0.000225873 5.98609e-06 -0.000225132 7.90206e-06 -0.000225758 9.81462e-06 -0.000226684 1.17216e-05 -0.000227862 1.3616e-05 -0.000229299 1.549e-05 -0.000231 1.73334e-05 -0.000232973 1.91331e-05 -0.000235228 2.08719e-05 -0.000237777 2.25272e-05 -0.000240633 2.40695e-05 -0.000243816 2.54611e-05 -0.000247353 2.66543e-05 -0.000251272 2.75898e-05 -0.000255609 2.81991e-05 -0.000260412 2.83964e-05 -0.000265736 2.80881e-05 -0.000271646 2.7151e-05 -0.000278275 2.54977e-05 -0.000285695 2.3077e-05 -0.000293725 -0.000302423 1.96875e-05 2.08527e-06 -0.000221947 3.65933e-06 -0.000227447 5.31465e-06 -0.000226787 6.98547e-06 -0.000227429 8.65222e-06 -0.000228351 1.03106e-05 -0.00022952 1.19516e-05 -0.00023094 1.35648e-05 -0.000232613 1.51374e-05 -0.000234546 1.66529e-05 -0.000236744 1.80903e-05 -0.000239214 1.94232e-05 -0.000241966 2.06178e-05 -0.000245011 2.16305e-05 -0.000248365 2.2407e-05 -0.000252048 2.28814e-05 -0.000256084 2.29718e-05 -0.000260503 2.25723e-05 -0.000265336 2.15698e-05 -0.000270644 1.98132e-05 -0.000276518 1.71749e-05 -0.000283057 1.3575e-05 -0.000290125 -0.000297555 8.70681e-06 1.89965e-06 -0.000223846 3.23101e-06 -0.000228778 4.64723e-06 -0.000228203 6.07988e-06 -0.000228861 7.50949e-06 -0.00022978 8.92988e-06 -0.000230941 1.03313e-05 -0.000232341 1.17016e-05 -0.000233983 1.30257e-05 -0.00023587 1.4285e-05 -0.000238003 1.54558e-05 -0.000240385 1.65085e-05 -0.000243018 1.74055e-05 -0.000245908 1.80994e-05 -0.000249059 1.85321e-05 -0.000252481 1.86302e-05 -0.000256182 1.82997e-05 -0.000260172 1.74311e-05 -0.000264467 1.58795e-05 -0.000269092 1.34676e-05 -0.000274106 1.00108e-05 -0.0002796 5.35126e-06 -0.000285466 -0.000291436 -7.67732e-07 1.71084e-06 -0.000225557 2.79746e-06 -0.000229864 3.98434e-06 -0.00022939 5.18888e-06 -0.000230066 6.39278e-06 -0.000230984 7.58878e-06 -0.000232137 8.76685e-06 -0.000233519 9.91441e-06 -0.000235131 1.1016e-05 -0.000236972 1.20516e-05 -0.000239039 1.29959e-05 -0.000241329 1.3818e-05 -0.00024384 1.44781e-05 -0.000246568 1.49275e-05 -0.000249509 1.51042e-05 -0.000252657 1.4931e-05 -0.000256008 1.431e-05 -0.000259551 1.31201e-05 -0.000263277 1.12053e-05 -0.000267177 8.36502e-06 -0.000271266 4.35962e-06 -0.000275595 -1.03496e-06 -0.000280071 -0.000284389 -8.08139e-06 1.51865e-06 -0.000227075 2.35333e-06 -0.000230699 3.32003e-06 -0.000230357 4.30619e-06 -0.000231052 5.29482e-06 -0.000231972 6.27814e-06 -0.00023312 7.24742e-06 -0.000234488 8.19125e-06 -0.000236075 9.09421e-06 -0.000237874 9.93746e-06 -0.000239882 1.06965e-05 -0.000242088 1.13409e-05 -0.000244485 1.18317e-05 -0.000247059 1.21201e-05 -0.000249797 1.21447e-05 -0.000252682 1.18284e-05 -0.000255692 1.10724e-05 -0.000258795 9.75307e-06 -0.000261958 7.71124e-06 -0.000265135 4.73411e-06 -0.000268288 5.40309e-07 -0.0002714 -5.14532e-06 -0.000274385 -0.000276909 -1.2626e-05 1.31671e-06 -0.000228392 1.88808e-06 -0.00023127 2.64081e-06 -0.000231109 3.41189e-06 -0.000231823 4.18798e-06 -0.000232748 4.96244e-06 -0.000233894 5.72889e-06 -0.000235255 6.47808e-06 -0.000236824 7.19749e-06 -0.000238594 7.87027e-06 -0.000240555 8.47497e-06 -0.000242693 8.98323e-06 -0.000244993 9.36028e-06 -0.000247436 9.56515e-06 -0.000250002 9.54025e-06 -0.000252657 9.21519e-06 -0.000255367 8.50059e-06 -0.00025808 7.28154e-06 -0.000260739 5.40956e-06 -0.000263263 2.67839e-06 -0.000265557 -1.20783e-06 -0.000267514 -6.59467e-06 -0.000268998 -0.000269678 -1.38254e-05 1.07632e-06 -0.000229468 1.39351e-06 -0.000231587 1.93121e-06 -0.000231647 2.4806e-06 -0.000232372 3.03763e-06 -0.000233306 3.59707e-06 -0.000234454 4.15518e-06 -0.000235813 4.70656e-06 -0.000237375 5.24147e-06 -0.000239129 5.74614e-06 -0.000241059 6.20221e-06 -0.000243149 6.58733e-06 -0.000245378 6.87526e-06 -0.000247724 7.03313e-06 -0.00025016 7.02241e-06 -0.000252647 6.78812e-06 -0.000255133 6.25936e-06 -0.000257551 5.34801e-06 -0.000259827 3.9364e-06 -0.000261851 1.85244e-06 -0.000263473 -1.17577e-06 -0.000264486 -5.49138e-06 -0.000264683 -0.000263683 -1.14863e-05 7.5858e-07 -0.000230227 8.68152e-07 -0.000231697 1.17779e-06 -0.000231957 1.50008e-06 -0.000232695 1.83196e-06 -0.000233637 2.16877e-06 -0.000234791 2.50928e-06 -0.000236153 2.85023e-06 -0.000237716 3.18556e-06 -0.000239464 3.50418e-06 -0.000241378 3.79338e-06 -0.000243438 4.0364e-06 -0.000245621 4.22001e-06 -0.000247908 4.32675e-06 -0.000250267 4.33559e-06 -0.000252655 4.21483e-06 -0.000255012 3.92999e-06 -0.000257266 3.4178e-06 -0.000259315 2.60417e-06 -0.000261037 1.38296e-06 -0.000262252 -3.88061e-07 -0.000262715 -2.99953e-06 -0.000262071 -0.000259946 -6.73747e-06 3.58924e-07 2.80694e-07 3.88777e-07 4.95028e-07 6.03752e-07 7.15853e-07 8.31841e-07 9.51124e-07 1.07098e-06 1.18614e-06 1.28887e-06 1.3743e-06 1.43685e-06 1.47467e-06 1.48599e-06 1.4618e-06 1.386e-06 1.24444e-06 1.01476e-06 6.6482e-07 1.33948e-07 -6.52743e-07 -1.80756e-06 0.000107961 6.26387e-05 5.42942e-05 5.36665e-05 1.71874e-05 3.71068e-05 2.10508e-05 -3.86338e-06 0.000220551 5.60676e-05 0.000216632 5.75856e-05 0.000200092 5.36472e-05 4.854e-05 0.000172603 0.000233615 4.0524e-05 0.000248317 4.28836e-05 0.000257527 4.44371e-05 4.55405e-05 0.000260526 0.00022718 3.18862e-05 0.000237538 3.25254e-05 0.000248875 3.31004e-05 3.38527e-05 0.000260562 0.000223824 2.85233e-05 0.000229218 2.71307e-05 0.00023594 2.63793e-05 2.5946e-05 0.000243846 0.000226031 3.29794e-05 0.000224695 2.84663e-05 0.000225918 2.51563e-05 2.2452e-05 0.000229412 0.000254001 3.84247e-05 0.00024825 3.42173e-05 0.000244311 2.90956e-05 2.41924e-05 0.00024257 0.000282788 2.58517e-05 0.000297425 1.95802e-05 0.000312153 1.4368e-05 9.53163e-06 0.000326814 0.000301685 8.68935e-06 0.000318204 3.06082e-06 0.000333007 -4.34564e-07 -2.74175e-06 0.00034528 0.000289974 -2.20808e-06 0.000298309 -5.27423e-06 0.000306277 -8.40293e-06 -1.02288e-05 0.000313764 0.000247295 -7.75889e-06 0.000250356 -8.33542e-06 0.000251633 -9.67961e-06 -1.13886e-05 0.000252793 0.000197589 -1.59489e-05 0.000206178 -1.69239e-05 0.000214582 -1.8084e-05 -1.93915e-05 0.000222585 0.000191672 -2.78417e-05 0.00020306 -2.83124e-05 0.00021398 -2.90031e-05 -2.97619e-05 0.00022435 0.000195076 -3.86429e-05 0.000205519 -3.87556e-05 0.000215651 -3.91352e-05 -3.9457e-05 0.000225346 0.000194767 -4.89379e-05 0.000204975 -4.89632e-05 0.000215123 -4.92834e-05 -4.94123e-05 0.000225078 0.000195269 -5.9036e-05 0.000205403 -5.90973e-05 0.000215579 -5.94588e-05 -5.9534e-05 0.000225701 0.000195446 -6.8837e-05 0.000205427 -6.90789e-05 0.000215559 -6.95907e-05 -6.98273e-05 0.000225853 0.000194766 -7.84063e-05 0.00020461 -7.89223e-05 0.000214696 -7.96768e-05 -8.02548e-05 0.000225124 0.000192993 -8.77399e-05 0.000202665 -8.8594e-05 0.000212684 -8.96956e-05 -9.07555e-05 0.000223184 0.000189791 -9.68274e-05 0.000199293 -9.8096e-05 0.000209261 -9.96645e-05 -0.000101366 0.000219872 0.000184774 -0.000105568 0.000193984 -0.000107306 0.000203735 -0.000109415 -0.000111828 0.000214196 0.000177846 -0.000113833 0.00018658 -0.00011604 0.000195843 -0.000118678 -0.000121665 0.00020568 0.00016916 -0.000121547 0.000177342 -0.000124223 0.000186042 -0.000127378 -0.000130799 0.000195176 0.000158591 -0.000128565 0.000166066 -0.000131698 0.000174036 -0.000135347 -0.000139187 0.000182423 0.000146095 -0.000134658 0.000152545 -0.000138148 0.000159345 -0.000142148 -0.000146298 0.000166456 0.000132196 -0.000139696 0.000137453 -0.000143405 0.000142869 -0.000147564 -0.000151818 0.000148389 0.000117552 -0.000143699 0.000121676 -0.000147528 0.000125848 -0.000151737 -0.000155984 0.000130014 0.00010251 -0.000146701 0.00010556 -0.000150578 0.000108597 -0.000154774 -0.000158972 0.000111585 8.73104e-05 -0.000148725 8.93037e-05 -0.000152571 9.1202e-05 -0.000156672 -0.00016075 9.29799e-05 7.23118e-05 -0.000149835 7.33253e-05 -0.000153585 7.41826e-05 -0.000157529 -0.000161422 7.48549e-05 5.78429e-05 -0.00015015 5.80323e-05 -0.000153774 5.80633e-05 -0.00015756 -0.000161282 5.79235e-05 4.39441e-05 -0.000149741 4.3409e-05 -0.000153239 4.27632e-05 -0.000156914 -0.000160544 4.20249e-05 3.05131e-05 -0.000148571 2.91776e-05 -0.000151903 2.77156e-05 -0.000155452 -0.000159013 2.61841e-05 1.7702e-05 -0.000146586 1.54519e-05 -0.000149653 1.30103e-05 -0.00015301 -0.000156447 1.0445e-05 5.85225e-06 -0.000143731 2.58648e-06 -0.000146387 -1.06017e-06 -0.000149363 -0.000152431 -5.07695e-06 -4.37247e-06 -0.000140126 -8.5462e-06 -0.000142213 -1.3285e-05 -0.000144624 -0.000147133 -1.85825e-05 -1.22275e-05 -0.00013598 -1.7064e-05 -0.000137377 -2.26354e-05 -0.000139053 -0.000140819 -2.8949e-05 -1.70075e-05 -0.000131599 -2.21352e-05 -0.000132249 -2.81129e-05 -0.000133076 -0.000133964 -3.4968e-05 -1.8057e-05 -0.000127367 -2.30203e-05 -0.000127286 -2.88654e-05 -0.00012723 -0.000127169 -3.56609e-05 -1.5062e-05 -0.000123791 -1.92816e-05 -0.000123067 -2.43077e-05 -0.000122204 -0.000121206 -3.02705e-05 -9.06619e-06 -0.000121462 -1.18334e-05 -0.000120299 -1.51733e-05 -0.000118864 -0.000117127 -1.92522e-05 -2.55238e-06 -3.42929e-06 -4.49577e-06 -5.85312e-06 -0.000149069 -5.99603e-06 -9.87304e-05 -2.09135e-06 -1.68259e-05 -9.32702e-05 -2.16546e-05 -5.24975e-06 7.12169e-06 -2.94546e-05 2.57933e-05 -3.53718e-05 3.78474e-05 -2.82357e-05 5.01372e-05 -3.08195e-05 5.78409e-05 -2.41391e-05 6.28363e-05 -1.63938e-05 6.56467e-05 -8.03203e-06 6.61212e-05 1.29594e-06 6.40484e-05 1.14222e-05 5.92299e-05 2.20625e-05 5.15998e-05 3.2627e-05 4.1329e-05 4.23472e-05 2.88504e-05 5.04184e-05 1.47908e-05 5.61965e-05 5.88197e-05 8.13279e-05 8.52787e-05 3.18167e-05 4.74199e-05 -5.76213e-05 -3.83228e-06 -3.63609e-05 -2.65101e-05 -2.58418e-05 -3.99736e-05 -1.4056e-05 -4.71577e-05 1.94747e-05 -6.17663e-05 4.93144e-05 -6.06592e-05 6.32947e-05 -3.81194e-05 6.95397e-05 -2.26388e-05 7.30229e-05 -1.15152e-05 7.41541e-05 1.64626e-07 7.24803e-05 1.30958e-05 6.75846e-05 2.69581e-05 5.9272e-05 4.09394e-05 4.77036e-05 5.39157e-05 3.34051e-05 6.47169e-05 1.71618e-05 7.24398e-05 7.59816e-05 0.000243519 0.000102285 0.00020326 8.76795e-05 0.000132851 6.65769e-05 6.98281e-05 3.65124e-05 3.10229e-05 -1.16844e-06 1.21111e-05 -2.82459e-05 1.01236e-05 -5.97788e-05 2.99168e-05 -8.04523e-05 6.31063e-05 -7.13088e-05 7.79314e-05 -3.74639e-05 8.28673e-05 -1.64511e-05 8.4542e-05 -1.5102e-06 8.34346e-05 1.42033e-05 7.85884e-05 3.18043e-05 6.94668e-05 5.00611e-05 5.61952e-05 6.71873e-05 3.94665e-05 8.14457e-05 2.03108e-05 9.15956e-05 9.62924e-05 0.000281291 8.15572e-05 0.000286517 8.24532e-05 0.000273059 8.00345e-05 0.000236862 7.27099e-05 0.000177044 5.86496e-05 0.000117847 3.09508e-05 6.45547e-05 -6.48644e-06 4.81511e-05 -6.40486e-05 4.29481e-05 -6.61057e-05 7.95357e-05 -7.40515e-05 9.37852e-05 -3.07005e-05 9.77677e-05 -5.4929e-06 9.75005e-05 1.44707e-05 9.28811e-05 3.6424e-05 8.28557e-05 6.00867e-05 6.73838e-05 8.26593e-05 4.7437e-05 0.000101393 2.4441e-05 0.000114592 0.000120733 0.000266262 5.91412e-05 0.000289008 5.97078e-05 0.00030692 6.2122e-05 0.000312669 6.69609e-05 0.000301366 6.99525e-05 0.000266055 6.6262e-05 0.000208207 5.13619e-05 0.000124038 2.01203e-05 9.74567e-05 -3.95246e-05 7.24792e-05 -4.9074e-05 9.76203e-05 -5.58415e-05 0.000111832 -1.97043e-05 0.000115207 1.10956e-05 0.000111481 4.01505e-05 0.000100355 7.1212e-05 8.19795e-05 0.000101035 5.77764e-05 0.000125596 2.9768e-05 0.0001426 0.000150501 0.000242001 4.65525e-05 0.00026186 3.98486e-05 0.000286453 3.75292e-05 0.000311542 4.1872e-05 0.00033095 5.05443e-05 0.000334792 6.24196e-05 0.000314077 7.20777e-05 0.000265706 6.84904e-05 0.000182314 4.38683e-05 0.000138272 -5.03266e-06 0.000106031 -2.36001e-05 0.000120817 -3.44899e-05 0.000135199 -3.28731e-06 0.000135524 3.98261e-05 0.000123476 8.32595e-05 0.000101009 0.000123503 7.104e-05 0.000155564 3.65284e-05 0.000177112 0.00018703 0.000238826 5.02971e-05 0.000246014 3.26605e-05 0.000260377 2.31659e-05 0.000277395 2.48543e-05 0.000306954 2.09852e-05 0.000337225 3.2149e-05 0.000350509 5.87937e-05 0.0003389 8.00992e-05 0.000299442 8.33259e-05 0.000230961 6.34491e-05 0.000182298 2.50625e-05 0.000150279 -2.47063e-06 0.000153791 -6.79936e-06 0.00016338 3.02366e-05 0.000153445 9.31943e-05 0.000125799 0.000151149 8.78625e-05 0.000193501 4.49314e-05 0.000220043 0.000231961 0.000358377 1.87332e-05 0.000363892 2.71464e-05 0.000354008 3.30493e-05 0.000329508 4.93543e-05 0.000303186 4.73074e-05 0.000312334 2.30009e-05 0.00034737 2.37578e-05 0.00036362 6.38497e-05 0.000354146 9.27991e-05 0.000321934 9.56614e-05 0.00027103 7.59661e-05 0.000228607 3.99526e-05 0.000196835 2.49729e-05 0.000193524 3.35474e-05 0.000188193 9.85252e-05 0.00015693 0.000182411 0.000108685 0.000241746 5.50379e-05 0.00027369 0.000286999 0.000373016 -9.00221e-06 0.000400635 -4.72258e-07 0.000413757 1.99265e-05 0.000407802 5.53095e-05 0.000374525 8.05846e-05 0.000332972 6.45542e-05 0.000325282 3.14474e-05 0.000363249 2.58829e-05 0.00037368 8.23679e-05 0.00036128 0.000108062 0.000332434 0.000104812 0.000287889 8.44981e-05 0.000252573 6.02883e-05 0.000231678 5.44425e-05 0.00022387 0.000106333 0.000192059 0.000214222 0.000132931 0.000300875 6.65162e-05 0.000340104 0.000353515 0.00033368 -2.89179e-05 0.000357761 -2.45531e-05 0.000383474 -5.78642e-06 0.000406323 3.2461e-05 0.000410683 7.62248e-05 0.000380149 9.50878e-05 0.000344837 6.67596e-05 0.000346152 2.45674e-05 0.000377055 5.14649e-05 0.000376135 0.000108982 0.000359222 0.000121725 0.000333187 0.000110534 0.000301374 9.21015e-05 0.000273556 8.22603e-05 0.000257727 0.000122162 0.000225893 0.000246056 0.000157807 0.000368961 7.82215e-05 0.00041969 0.000431737 0.000257591 -3.37162e-05 0.000271767 -3.87289e-05 0.000300231 -3.42505e-05 0.000343786 -1.10937e-05 0.000387903 3.21082e-05 0.00040315 7.98399e-05 0.000376857 9.30531e-05 0.000349374 5.20507e-05 0.000372652 2.81872e-05 0.000380187 0.000101447 0.000369374 0.000132538 0.000350026 0.000129882 0.000326328 0.0001158 0.000301269 0.000107319 0.000282209 0.000141222 0.000250529 0.000277736 0.000177606 0.000441883 8.77874e-05 0.000509509 0.000519524 0.000239452 -5.05828e-05 0.000256492 -5.57689e-05 0.000278023 -5.57808e-05 0.000311645 -4.47163e-05 0.000357453 -1.36997e-05 0.000397443 3.98501e-05 0.000403034 8.74618e-05 0.000372931 8.21541e-05 0.000369496 3.16216e-05 0.000380554 9.03895e-05 0.000372305 0.000140787 0.000356445 0.000145742 0.000338251 0.000133993 0.000318246 0.000127323 0.000297071 0.000162398 0.000262533 0.000312274 0.000186966 0.00051745 9.24193e-05 0.000604056 0.000611943 0.000246368 -7.2601e-05 0.000269398 -7.87983e-05 0.000295202 -8.15851e-05 0.00032336 -7.28746e-05 0.000356808 -4.7147e-05 0.000393715 2.9431e-06 0.000414406 6.67707e-05 0.0004003 9.62604e-05 0.000370712 6.12091e-05 0.000380258 8.08437e-05 0.000369909 0.000151136 0.000354936 0.000160715 0.000339264 0.000149666 0.000323226 0.00014336 0.000301892 0.000183733 0.000261344 0.000352822 0.000183111 0.000595682 9.01729e-05 0.000696994 0.000702116 0.000247326 -9.45806e-05 0.00027232 -0.000103792 0.000301085 -0.00011035 0.000330132 -0.000101922 0.000358908 -7.59229e-05 0.000390578 -2.87279e-05 0.000417148 4.02009e-05 0.000419382 9.40268e-05 0.000390683 8.9908e-05 0.000380452 9.10748e-05 0.000363877 0.000167711 0.000348399 0.000176193 0.000333907 0.000164158 0.000319548 0.000157719 0.000296843 0.000206438 0.000246277 0.000403389 0.000165416 0.000676544 8.0616e-05 0.000781794 0.000782732 0.000248469 -0.000117971 0.0002755 -0.000130824 0.000304955 -0.000139804 0.000331451 -0.000128418 0.000354497 -9.89698e-05 0.000380439 -5.46697e-05 0.000409485 1.11548e-05 0.000425044 7.84679e-05 0.000407807 0.000107145 0.000375395 0.000123487 0.00035402 0.000189086 0.000338245 0.000191967 0.00032487 0.000177533 0.000312022 0.000170567 0.00028468 0.00023378 0.000217174 0.000470894 0.000135925 0.000757792 6.52361e-05 0.000852483 0.000847969 0.000249983 -0.000142254 0.000277969 -0.000158809 0.000307498 -0.000169334 0.000331781 -0.000152702 0.000349722 -0.000116911 0.000369364 -7.4311e-05 0.000396043 -1.55249e-05 0.000416676 5.78349e-05 0.000405915 0.000117907 0.000363601 0.000165801 0.000340446 0.000212241 0.000325422 0.000206991 0.000313723 0.000189233 0.000302099 0.00018219 0.000259026 0.000276853 0.00017179 0.00055813 9.84798e-05 0.000831102 4.70902e-05 0.000903872 0.000895059 0.000251109 -0.00016751 0.000279662 -0.000187362 0.000309746 -0.000199418 0.000334693 -0.000177649 0.000352613 -0.000134831 0.000369353 -9.10504e-05 0.000388218 -3.43899e-05 0.000399845 4.62079e-05 0.000384558 0.000133194 0.0003449 0.000205459 0.0003237 0.000233442 0.000310437 0.000220253 0.000300618 0.000199052 0.000286225 0.000196583 0.000216016 0.000347062 0.000119709 0.000654438 6.26237e-05 0.000888187 3.0407e-05 0.000936089 0.000925466 0.000251538 -0.000193925 0.000281387 -0.00021721 0.000312865 -0.000230897 0.000338676 -0.000203459 0.000359199 -0.000155354 0.000378512 -0.000110364 0.00039014 -4.60173e-05 0.000383312 5.30361e-05 0.000355631 0.000160874 0.000322937 0.000238152 0.000305336 0.000251043 0.000293526 0.000232064 0.000283876 0.000208702 0.000254641 0.000225818 0.000162424 0.00043928 7.24226e-05 0.000744439 3.41622e-05 0.000926447 1.73315e-05 0.00095292 0.000942797 0.000250446 -0.000221187 0.000281319 -0.000248083 0.000313682 -0.000263259 0.000338822 -0.000228599 0.000359607 -0.000176139 0.000381791 -0.000132549 0.000389757 -5.39832e-05 0.000366915 7.58785e-05 0.000328342 0.000199447 0.000301581 0.000264913 0.000286872 0.000265752 0.000275595 0.00024334 0.000262779 0.000221518 0.000208048 0.000280548 0.000107536 0.000539792 3.49242e-05 0.00081705 1.39751e-05 0.000947397 7.69234e-06 0.000959203 0.000950489 0.000247613 -0.000248928 0.000277668 -0.000278139 0.000309261 -0.000294852 0.000337475 -0.000256812 0.000361936 -0.0002006 0.000386742 -0.000157354 0.000387573 -5.48136e-05 0.000352235 0.000111216 0.000306883 0.0002448 0.000282121 0.000289675 0.000269373 0.0002785 0.000259021 0.000253693 0.000241508 0.000239032 0.000158562 0.000363494 5.93274e-05 0.000639026 7.31937e-06 0.000869058 -2.02322e-08 0.000954736 5.25702e-07 0.000958656 0.000951015 0.000241461 -0.000276193 0.000270519 -0.000307196 0.000302596 -0.000326929 0.000335839 -0.000290056 0.000365984 -0.000230745 0.000396271 -0.000187642 0.000381017 -3.95597e-05 0.000331342 0.000160891 0.000285899 0.000290243 0.000266104 0.000309469 0.000255931 0.000288673 0.000245376 0.000264248 0.00021383 0.000270578 0.000112099 0.000465225 2.25722e-05 0.000728553 -1.14991e-05 0.00090313 -9.82648e-06 0.000953064 -4.96101e-06 0.000953791 0.000946054 0.000230788 -0.0003013 0.000258694 -0.000335103 0.000291999 -0.000360234 0.000324016 -0.000322073 0.000352652 -0.000259381 0.000381216 -0.000216206 0.00034425 -2.59368e-06 0.000287141 0.000218 0.000263757 0.000313627 0.000253519 0.000319708 0.000246559 0.000295632 0.000230104 0.000280704 0.000166945 0.000333736 6.40235e-05 0.000568147 -7.38943e-06 0.000799966 -2.43807e-05 0.000920121 -1.6885e-05 0.000945568 -9.10666e-06 0.000946013 0.000936947 0.000218395 -0.000324519 0.00024336 -0.000360068 0.000272079 -0.000388953 0.000296342 -0.000346335 0.000326034 -0.000289074 0.000337768 -0.00022794 0.000282823 5.23517e-05 0.000248596 0.000252227 0.000244461 0.000317762 0.000242443 0.000321726 0.000234389 0.000303687 0.00019777 0.000317323 0.000106562 0.000424945 1.46643e-05 0.000660044 -3.2473e-05 0.000847103 -3.39737e-05 0.000921622 -2.21464e-05 0.00093374 -1.20041e-05 0.00093587 0.000924943 0.000204578 -0.000346674 0.000228043 -0.000383533 0.000258502 -0.000419412 0.000291014 -0.000378848 0.000315252 -0.000313312 0.000300545 -0.000213232 0.00023101 0.000121886 0.000216117 0.00026712 0.000221539 0.00031234 0.000226216 0.000317049 0.00020653 0.000323373 0.000143518 0.000380334 4.67077e-05 0.000521755 -2.67523e-05 0.000733504 -4.96355e-05 0.000869986 -4.04092e-05 0.000912395 -2.56525e-05 0.000918983 -1.36753e-05 0.000923893 0.000911268 0.000184928 -0.000365146 0.000205594 -0.000404198 0.000239644 -0.000453462 0.00030058 -0.000439784 0.00033148 -0.000344211 0.000260447 -0.0001422 0.000200558 0.000181775 0.00018048 0.000287199 0.000190102 0.000302718 0.000191597 0.000315554 0.000156626 0.000358345 8.47268e-05 0.000452233 -6.63346e-06 0.000613116 -5.5644e-05 0.000782515 -5.81898e-05 0.000872532 -4.30908e-05 0.000897296 -2.71226e-05 0.000903015 -1.4085e-05 0.000910855 0.000897183 0.000161386 -0.000378143 0.00017496 -0.000417771 0.00019076 -0.000469263 0.00021438 -0.000463404 0.000285481 -0.000415312 0.000216102 -7.282e-05 0.000168378 0.000229499 0.000134951 0.000320625 0.000127973 0.000309696 0.000127194 0.000316332 8.88209e-05 0.000396718 1.87487e-05 0.000522305 -4.76043e-05 0.000679468 -7.01824e-05 0.000805093 -5.96958e-05 0.000862045 -4.23488e-05 0.000879949 -2.66364e-05 0.000887303 -1.3339e-05 0.000897558 0.000883844 0.000139263 -0.000387392 0.000147716 -0.000426224 0.000147328 -0.000468874 0.000127556 -0.000443632 4.09465e-05 -0.000328703 0.000151459 -0.000183332 0.000150668 0.00023029 9.74819e-05 0.000373811 6.01514e-05 0.000347026 6.09563e-05 0.000315528 2.00304e-05 0.000437644 -3.55785e-05 0.000577914 -7.06777e-05 0.000714568 -7.11052e-05 0.000805521 -5.50243e-05 0.000845965 -3.83774e-05 0.000863302 -2.42611e-05 0.000873187 -1.1612e-05 0.000884909 0.000872232 0.000118151 -0.000393958 0.000123673 -0.000431746 0.000125836 -0.000471037 0.000146889 -0.000464685 0.000135649 -0.000317462 0.000142142 -0.000189825 0.000151238 0.000221194 0.000116239 0.000408811 4.91952e-05 0.00041407 8.79517e-06 0.000355928 -2.23788e-05 0.000468818 -5.63112e-05 0.000611847 -6.86155e-05 0.000726872 -5.97432e-05 0.000796648 -4.48039e-05 0.000831025 -3.14211e-05 0.000849919 -2.01487e-05 0.000861914 -9.1978e-06 0.000873958 0.000863034 9.63653e-05 -0.000397344 9.73127e-05 -0.000432694 9.70376e-05 -0.000470762 0.000104897 -0.000472544 0.00012887 -0.000341436 0.000121251 -0.000182207 0.000147361 0.000195084 0.000136492 0.000419679 7.57113e-05 0.000474851 -1.58358e-06 0.000433223 -2.69518e-05 0.000494186 -4.53529e-05 0.000630248 -4.73957e-05 0.000728915 -3.97656e-05 0.000789018 -3.04704e-05 0.00082173 -2.21921e-05 0.000841641 -1.47222e-05 0.000854444 -6.47837e-06 0.000865714 0.000856556 7.51639e-05 -0.000397653 7.19962e-05 -0.000429526 6.6811e-05 -0.000465577 6.07725e-05 -0.000466506 4.82472e-05 -0.00032891 8.75765e-06 -0.000142717 0.000135084 6.87579e-05 0.000153744 0.000401019 0.00011495 0.000513645 3.96909e-05 0.000508482 3.46526e-06 0.000530412 -1.09906e-05 0.000644704 -1.53447e-05 0.000733269 -1.52607e-05 0.000788934 -1.39704e-05 0.000820439 -1.17873e-05 0.000839458 -8.6575e-06 0.000851314 -4.03756e-06 0.000861094 0.000852519 5.62614e-05 -0.000395991 5.14472e-05 -0.000424712 4.49305e-05 -0.00045906 4.13295e-05 -0.000462905 5.12548e-05 -0.000338836 2.51477e-05 -0.00011661 0.000118031 -2.41256e-05 0.000157891 0.000361159 0.000142591 0.000528945 9.08535e-05 0.000560219 4.95366e-05 0.000571729 3.81998e-05 0.000656041 2.19946e-05 0.000749474 1.02829e-05 0.000800646 2.41088e-06 0.000828311 -1.91165e-06 0.000843781 -3.04194e-06 0.000852444 -2.61078e-06 0.000860663 0.000849908 3.95067e-05 -0.000393472 3.50505e-05 -0.000420256 3.10196e-05 -0.000455029 3.681e-05 -0.000468695 7.52913e-05 -0.000377317 0.000121332 -0.000162651 0.000140163 -4.29569e-05 0.000163355 0.000337967 0.0001625 0.000529801 0.000133737 0.000588982 0.000103838 0.000601627 9.21341e-05 0.000667745 6.19104e-05 0.000779698 3.41274e-05 0.000828429 1.61997e-05 0.000846239 5.88988e-06 0.000854091 1.25334e-06 0.000857081 -2.81282e-06 0.000864729 0.000847095 2.21398e-05 -0.000389428 1.79169e-05 -0.000416033 1.56975e-05 -0.00045281 2.66774e-05 -0.000479675 7.33425e-05 -0.000423982 0.00012429 -0.000213598 0.000109974 -2.86415e-05 0.000153758 0.000294184 0.000165152 0.000518407 0.000156694 0.00059744 0.000141886 0.000616435 0.000134454 0.000675177 9.41654e-05 0.000819986 5.0023e-05 0.000872571 2.36591e-05 0.000872604 9.46083e-06 0.000868289 2.5097e-06 0.000864032 -5.03229e-06 0.000872271 0.000842063 3.32094e-06 -0.000382304 -4.13934e-06 -0.000408573 -9.8139e-06 -0.000447135 -1.24477e-06 -0.000488244 4.29223e-05 -0.000468149 0.000101468 -0.000272143 0.000108122 -3.52952e-05 0.000141462 0.000260844 0.000158492 0.000501377 0.000161104 0.000594828 0.000154798 0.000622741 0.000151256 0.000678719 9.61401e-05 0.000875102 4.65999e-05 0.000922111 2.00263e-05 0.000899177 6.64753e-06 0.000881668 3.7473e-08 0.000870643 -9.02141e-06 0.00088133 0.000833041 -1.61697e-05 -0.000371211 -2.97261e-05 -0.000395016 -4.51704e-05 -0.000431691 -5.32486e-05 -0.000480166 -3.41614e-05 -0.000487236 4.1543e-05 -0.000347848 8.69383e-05 -8.06905e-05 0.00011283 0.000234952 0.0001381 0.000476106 0.000145184 0.000587745 0.000138251 0.000629674 0.000109152 0.000707818 5.00917e-05 0.000934162 1.80475e-05 0.000954155 3.16168e-06 0.000914064 -3.31825e-06 0.000888148 -6.47846e-06 0.000873803 -1.40819e-05 0.000888934 0.000818959 -3.38986e-05 -0.000355895 -5.42462e-05 -0.000374668 -8.20818e-05 -0.000403855 -0.000115418 -0.00044683 -0.000133569 -0.000469086 -9.37134e-05 -0.000387704 -1.97605e-05 -0.000154643 3.9216e-05 0.000175976 9.55446e-05 0.000419778 0.000106474 0.000576815 8.22507e-05 0.000653898 1.67567e-05 0.000773312 -2.13585e-05 0.000972278 -2.51899e-05 0.000957987 -2.27573e-05 0.000911631 -1.8566e-05 0.000883956 -1.61692e-05 0.000871406 -1.91322e-05 0.000891897 0.000799827 -4.75422e-05 -0.000337302 -7.32057e-05 -0.000349005 -0.00011068 -0.000366381 -0.000164416 -0.000393094 -0.000218281 -0.000415221 -0.000228329 -0.000377656 -0.000173481 -0.00020949 -7.49399e-05 7.74343e-05 -1.68981e-05 0.000361736 -7.5635e-06 0.00056748 -4.5976e-05 0.00069231 -0.000107893 0.000835229 -0.000100937 0.000965321 -7.16546e-05 0.000928705 -5.11562e-05 0.000891133 -3.55726e-05 0.000868373 -2.66587e-05 0.000862492 -2.28986e-05 0.000888137 0.000776929 -5.52811e-05 -0.000316989 -8.36295e-05 -0.000320657 -0.000124758 -0.000325253 -0.000185719 -0.000332133 -0.000263513 -0.000337427 -0.000328378 -0.00031279 -0.000336144 -0.000201725 -0.000285827 2.71169e-05 -0.000234475 0.000310384 -0.00021377 0.000546775 -0.000227645 0.000706186 -0.000226634 0.000834218 -0.000164283 0.000902971 -0.000110375 0.000874796 -7.56065e-05 0.000856365 -5.07726e-05 0.000843539 -3.56153e-05 0.000847335 -2.45391e-05 0.000877061 0.000752389 -5.59178e-05 -0.000296732 -8.42021e-05 -0.000292373 -0.000124138 -0.000285317 -0.000181584 -0.000274687 -0.000261675 -0.000257335 -0.000354805 -0.000219661 -0.000425253 -0.000131276 -0.000440872 4.27358e-05 -0.000412847 0.000282359 -0.000375149 0.000509077 -0.000341755 0.000672791 -0.000280998 0.000773461 -0.000194147 0.00081612 -0.000133389 0.000814038 -9.14794e-05 0.000814455 -6.14621e-05 0.000813521 -4.13542e-05 0.000827227 -2.38317e-05 0.000859538 0.000728558 -4.83606e-05 -0.000278642 -7.41168e-05 -0.000266617 -0.000110313 -0.000249121 -0.000160467 -0.000224533 -0.00022882 -0.000188981 -0.000314004 -0.000134477 -0.000397992 -4.72882e-05 -0.000449645 9.43885e-05 -0.000448611 0.000281325 -0.000408291 0.000468757 -0.000347315 0.000611815 -0.000268934 0.000695081 -0.000192401 0.000739586 -0.000138035 0.000759672 -9.68062e-05 0.000773227 -6.6024e-05 0.000782739 -4.31093e-05 0.000804313 -2.1269e-05 0.000837698 0.000707289 -3.18885e-05 -0.000266005 -5.12455e-05 -0.000247259 -8.04234e-05 -0.000219943 -0.000122459 -0.000182498 -0.000178934 -0.000132507 -0.000248609 -6.48015e-05 -0.000321533 2.56361e-05 -0.000372249 0.000145104 -0.000383148 0.000292224 -0.000353588 0.000439197 -0.000297005 0.000555232 -0.000233623 0.000631698 -0.000176482 0.000682446 -0.000131826 0.000715015 -9.52377e-05 0.000736639 -6.62031e-05 0.000753705 -4.20424e-05 0.000780152 -1.75936e-05 0.000813249 0.000689695 -9.98839e-06 -1.70154e-05 -2.94052e-05 -5.17662e-05 -8.84951e-05 -0.000136441 -0.000186312 -0.000225606 -0.00024295 -0.000237152 -0.000207637 -0.000171871 -0.000137652 -0.000107258 -8.04209e-05 -5.71224e-05 -3.53894e-05 -1.3803e-05 ) ; boundaryField { leftWall { type calculated; value uniform 0; } rightWall { type calculated; value uniform 0; } lowerWall { type calculated; value uniform 0; } atmosphere { type calculated; value nonuniform List<scalar> 46 ( -0.000230586 -0.000231619 -0.000232065 -0.000232801 -0.000233746 -0.000234903 -0.000236269 -0.000237835 -0.000239584 -0.000241493 -0.000243541 -0.000245706 -0.00024797 -0.000250305 -0.000252667 -0.000254988 -0.00025719 -0.000259173 -0.000260808 -0.000261902 -0.000262184 -0.000261285 -0.000258791 -0.000120718 -0.000119422 -0.000117798 -0.00011577 -0.00026187 -0.000240232 -0.000207553 -0.000160137 -9.57783e-05 -1.68561e-05 7.55078e-05 0.000184398 0.000309568 0.000433399 0.000525718 0.000595932 0.000648227 0.000684622 0.000709801 0.000730406 0.000758419 0.000791663 0.000675892 ) ; } defaultFaces { type empty; value nonuniform 0(); } } // ************************************************************************* //
[ "mizuha.watanabe@gmail.com" ]
mizuha.watanabe@gmail.com
b768596f73fa249dd17f1a7088c0a200973f4a31
29c6a2c33739db57e3764bd445be0aa1f10c91c2
/Program-2/Program-2/wumpus-2.5/BayesianNetwork.cpp
3e01aae5af44e3478b86ea21934a42601a0492e4
[]
no_license
alanachtenberg/CSCE-420
ec5382cdf4a30fe571a6752ceab8d50b86f70911
91352045bdaf8b3c2b3285020519d05c05f74f76
refs/heads/master
2016-09-05T17:49:01.825586
2015-05-04T22:09:07
2015-05-04T22:09:07
29,836,862
0
0
null
null
null
null
UTF-8
C++
false
false
6,849
cpp
#include "BayesianNetwork.h" using namespace dlib; using namespace std; using namespace bayes_node_utils; BayesianNetwork::BayesianNetwork(){ // This statement declares a bayesian network called bn. Note that a bayesian network // in the dlib world is just a directed_graph object that contains a special kind // of node called a bayes_node. // bn = directed_graph<bayes_node>::kernel_1a_c(); had to comment out, because library declared bn as a noncopyable class } void BayesianNetwork::setJointProb(Nodes node, Nodes parent_1, Nodes parent_2){ assignment parent_state; parent_state.add(parent_1, 1); parent_state.add(parent_2, 1); set_node_probability(bn, node, 1, parent_state, 1);//there will always be a breeze if either p1 or p2 is true set_node_probability(bn, node, 0, parent_state, 0); parent_state[parent_1] = 1; parent_state[parent_2] = 0; set_node_probability(bn, node, 1, parent_state, 1); set_node_probability(bn, node, 0, parent_state, 0); parent_state[parent_1] = 0; parent_state[parent_2] = 1; set_node_probability(bn, node, 1, parent_state, 1); set_node_probability(bn, node, 0, parent_state, 0); parent_state[parent_1] = 0;//this one is a little more tricky, no certainty,we know at least 2 of the 4 adjacent cells do not contain a pit parent_state[parent_2] = 0;//we know the probability of a breeze is the probability that at least 1 of the other 2 cells is a pit(.2 chance for every cell) //P(A|B)=P(A)+P(B)-P(A&B), .2+.2-.04=.36 , this is the prob that at least one of the other adjacent cells is a pit set_node_probability(bn, node, 1, parent_state, .36); set_node_probability(bn, node, 0, parent_state, 1-.36); } void BayesianNetwork::setNonJointProb(Nodes node, Nodes parent){ assignment parent_state; parent_state.add(parent, 1); set_node_probability(bn, node, 1, parent_state, 1);//there will always be a breeze if parent is a pit set_node_probability(bn, node, 0, parent_state, 0); parent_state[parent] = 0;//if parent is 0 then the probability of a breeze is the probaility that at least one of the other 3 adjacent cells is a pit //to determine this we will take the probability that no pits occur and subtract that from 1 //1-.8*.8*.8=.488 set_node_probability(bn, node, 1, parent_state, .488); set_node_probability(bn, node, 0, parent_state, 1-.488); } void BayesianNetwork::setLOCProb(int p1, int p2, int p3, int p4){ assignment parent_state; parent_state.add(P1, p1); parent_state.add(P2, p2); parent_state.add(P3, p3); parent_state.add(P4, p4); if (p1 == 1 || p2 == 1 || p3 == 1 || p4 == 1){ set_node_probability(bn, LOC, 1, parent_state, 1); set_node_probability(bn, LOC, 0, parent_state, 0); } else{ set_node_probability(bn, LOC, 1, parent_state, 0); set_node_probability(bn, LOC, 0, parent_state, 1); } } void BayesianNetwork::setProbability(BayesianNetwork::Nodes node){ switch (node){ case JC1: setJointProb(node, P1, P2); break; case JC2: setJointProb(node, P2, P3); break; case JC3: setJointProb(node, P3, P4); break; case JC4: setJointProb(node, P4, P1); break; case NJC1: setNonJointProb(node, P1); break; case NJC2: setNonJointProb(node, P2); break; case NJC3: setNonJointProb(node, P3); break; case NJC4: setNonJointProb(node, P4); break; } } void BayesianNetwork::setEvidence(Nodes node, int value){ set_node_value(bn, node, value); set_node_as_evidence(bn, node); } void BayesianNetwork::clearEvidence(){ for (int i = 0; i < NUM_NODES; ++i){ Nodes node=(Nodes)i;//cast integer into enum set_node_as_nonevidence(bn, node);//remove from evidence } } bayesian_network_join_tree BayesianNetwork::getSolution(){ return bayesian_network_join_tree(bn, join_tree); } void BayesianNetwork::initialize(){ try { // The next few blocks of code setup our bayesian network. // The first thing we do is tell the bn object how many nodes it has // and also add the three edges. Again, we are using the network // shown in ASCII art at the top of this file. bn.set_number_of_nodes(NUM_NODES);//our network has 13 nodes bn.add_edge(P1, LOC);//pits adjacent to location bn.add_edge(P2, LOC); bn.add_edge(P3, LOC); bn.add_edge(P4, LOC); bn.add_edge(P1, NJC1);//P1 connections bn.add_edge(P1, JC4); bn.add_edge(P1, JC1); bn.add_edge(P2, NJC2);//P2 connections bn.add_edge(P2, JC1); bn.add_edge(P2, JC2); bn.add_edge(P3, NJC3);//P3 connections bn.add_edge(P3, JC2); bn.add_edge(P3, JC3); bn.add_edge(P4, NJC4);//P4 connections bn.add_edge(P4, JC3); bn.add_edge(P4, JC4); // Now we inform all the nodes in the network that they are binary // nodes. That is, they only have two possible values. set_node_num_values(bn, LOC, 2); set_node_num_values(bn, P1, 2); set_node_num_values(bn, P2, 2); set_node_num_values(bn, P3, 2); set_node_num_values(bn, P4, 2); set_node_num_values(bn, JC1, 2); set_node_num_values(bn, JC2, 2); set_node_num_values(bn, JC3, 2); set_node_num_values(bn, JC4, 2); set_node_num_values(bn, NJC1, 2); set_node_num_values(bn, NJC2, 2); set_node_num_values(bn, NJC3, 2); set_node_num_values(bn, NJC4, 2); assignment parent_state; // Now we will enter all the conditional probability information for each node. // Each node's conditional probability is dependent on the state of its parents. // To specify this state we need to use the assignment object. This assignment // object allows us to specify the state of each nodes parents. // Here we specify that p(B=1) = 0.01 // parent_state is empty in this case since P1 is a root node. set_node_probability(bn, P1, 1, parent_state, 0.2);//probability of a pit is .2 // Here we specify that p(P1=0) = 1-0.01 set_node_probability(bn, P1, 0, parent_state, 1 - 0.2); set_node_probability(bn, P2, 1, parent_state, 0.2);//PIT 2 set_node_probability(bn, P2, 0, parent_state, 1 - 0.2); set_node_probability(bn, P3, 1, parent_state, 0.2);//PIT 3 set_node_probability(bn, P3, 0, parent_state, 1 - 0.2); set_node_probability(bn, P4, 1, parent_state, 0.2);//PIT 4 set_node_probability(bn, P4, 0, parent_state, 1 - 0.2); setProbability(JC1); setProbability(JC2); setProbability(JC3); setProbability(JC4); setProbability(NJC1); setProbability(NJC2); setProbability(NJC3); setProbability(NJC4); //time for the largest table, LOC for (int i = 0; i < 2; ++i){ for (int j = 0; j < 2; ++j){ for (int k = 0; k < 2; ++k){ for (int l = 0; l < 2; ++l){ setLOCProb(i, j, k, l);//set probability for each case } } } } create_moral_graph(bn, join_tree); create_join_tree(join_tree, join_tree); } catch (std::exception& e) { cout << "exception thrown: " << endl; cout << e.what() << endl; cout << "hit enter to terminate" << endl; cin.get(); } }
[ "alanachtenberg@yahoo.com" ]
alanachtenberg@yahoo.com
aff04d622ee443b290b0428972f9dc9a51feeaae
587e9108120a38b0d211274517517a57b7a86a2b
/tmlf/core/Operator.h
6cbe3dd7d9715b86e888f67c03b86d788ab9785b
[]
no_license
shunting314/tmlf
f0a87d792ab14698e28863c3859ea64cc00e04de
e13e550e40aa2c7223c941dbe6d3dfac480796d2
refs/heads/main
2023-01-19T13:25:54.584391
2020-11-27T18:39:41
2020-11-27T18:39:41
316,573,654
0
0
null
null
null
null
UTF-8
C++
false
false
2,124
h
#pragma once #include <memory> #include "tmlf/proto/tmlf.pb.h" #include <glog/logging.h> #include "tmlf/core/Workspace.h" namespace tmlf { class Operator; class OperatorRegistry { public: typedef std::unique_ptr<Operator> (*OperatorCreator)(const proto::Op& op_proto); static OperatorRegistry& get() { static OperatorRegistry registry; return registry; } std::unique_ptr<Operator> create_operator(const proto::Op& op_proto); private: OperatorRegistry() {} std::unordered_map<std::string, OperatorCreator> str_to_creator_; friend class OperatorRegisterer; }; class OperatorRegisterer { public: explicit OperatorRegisterer(const std::string& name, OperatorRegistry::OperatorCreator creator) { auto& registry = OperatorRegistry::get(); if (registry.str_to_creator_.count(name) > 0) { LOG(FATAL) << "Operator " << name << " already registered"; } registry.str_to_creator_.emplace(name, creator); } }; class Operator { public: explicit Operator(const proto::Op& op_proto) : op_proto_(op_proto) { // only support single workspace so far ws_ = Workspace::get_ptr(); } virtual ~Operator() {} virtual void run() { LOG(FATAL) << "Subclass of Operator should override run(). Proto: " << op_proto_.DebugString(); } std::string getarg(const std::string& name); std::string getarg(const std::string& name, const std::string& def); const std::string& in(int i) const { return op_proto_.in_tensors()[i]; } const std::string& out(int i) const { return op_proto_.out_tensors()[i]; } size_t num_in() const { return op_proto_.in_tensors().size(); } size_t num_out() const { return op_proto_.out_tensors().size(); } protected: proto::Op op_proto_; Workspace* ws_; }; std::unique_ptr<Operator> create_operator(const proto::Op& op_proto); #define REGISTER_OPERATOR(op_type, op_class) \ static auto reg ## op_type = OperatorRegisterer(#op_type, [](const proto::Op& op_proto) -> std::unique_ptr<Operator> { \ return std::make_unique<op_class>(op_proto); \ }) // arg utils std::vector<int64_t> arg_to_ints(const std::string& str); }
[ "shunting314@gmail.com" ]
shunting314@gmail.com
cd50fe814e3d4a16eebc7a4cc511432e41cf2c91
2acdea030aaa2c08cdacc514c4a4bf0efc6b0b28
/_1984_15/poti.ino
29ce39f6dd73d85b6dab274f3f04d041e726f3ea
[]
no_license
antimodular/nkk_lcd_smartswitch
eddfaf6c3bcd7f53646ddf009db0d0224e1daefb
2901490e04a954e16e5761bafe7ca783d85027f0
refs/heads/master
2020-05-27T21:41:11.268117
2019-12-28T01:58:31
2019-12-28T01:58:31
22,957,123
6
2
null
null
null
null
UTF-8
C++
false
false
3,723
ino
void checkPoti_2(){ //read sensor value in to array sensorValues[sensorCnt] = analogRead(potiPin); sensorCnt++; sensorCnt = sensorCnt % sensorCnt_max; //get avverage from last x stored readings int averaged_sensorValue = 0; for(int i=0; i<=sensorCnt_max; i++){ averaged_sensorValue += sensorValues[i]; } averaged_sensorValue = averaged_sensorValue / sensorCnt_max; //if diff is great enough and id is different then send new message if(abs(averaged_sensorValue - old_sensorValue) > sensorDiff) { int temp_id = map(averaged_sensorValue,0,1023,0,15); if(temp_id != old_SensorID){ old_SensorID = temp_id; serialMessage = potiSerial_IDs[temp_id]; } } } void checkPoti(){ int sensorValue = analogRead(potiPin); if (sensorValue < 67){ if (lastRead >= 67){ //Serial.println('e'); serialMessage = potiSerial_IDs[0]; lastRead = sensorValue; } } else if (sensorValue < 134){ if (lastRead < 67 || lastRead >= 134){ //Serial.println('f'); serialMessage = potiSerial_IDs[1]; lastRead = sensorValue; } } else if (sensorValue < 201){ if (lastRead < 134 || lastRead >= 201){ //Serial.println('g'); serialMessage = potiSerial_IDs[2]; lastRead = sensorValue; } } else if (sensorValue < 268){ if (lastRead < 201 || lastRead >= 268){ //Serial.println('h'); serialMessage = potiSerial_IDs[3]; lastRead = sensorValue; } } else if (sensorValue < 335){ if (lastRead < 268 || lastRead >= 335){ //Serial.println('i'); serialMessage = potiSerial_IDs[4]; lastRead = sensorValue; } } else if (sensorValue < 402){ if (lastRead < 335 || lastRead >= 402){ //Serial.println('j'); serialMessage = potiSerial_IDs[5]; lastRead = sensorValue; } } else if (sensorValue < 469){ if (lastRead < 402 || lastRead >= 469){ //Serial.println('k'); serialMessage = potiSerial_IDs[6]; lastRead = sensorValue; } } else if (sensorValue < 536){ if (lastRead < 469 || lastRead >= 536){ // Serial.println('l'); serialMessage = potiSerial_IDs[7]; lastRead = sensorValue; } } else if (sensorValue < 603){ if (lastRead < 536 || lastRead >= 603){ //Serial.println('m'); serialMessage = potiSerial_IDs[8]; lastRead = sensorValue; } } else if (sensorValue < 670){ if (lastRead < 603 || lastRead >= 670){ // Serial.println('n'); serialMessage = potiSerial_IDs[9]; lastRead = sensorValue; } } else if (sensorValue < 737){ if (lastRead < 670 || lastRead >= 737){ //Serial.println('o'); serialMessage = potiSerial_IDs[10]; lastRead = sensorValue; } } else if (sensorValue < 804){ if (lastRead < 737 || lastRead >= 804){ //Serial.println('p'); serialMessage = potiSerial_IDs[11]; lastRead = sensorValue; } } else if (sensorValue < 871){ if (lastRead < 804 || lastRead >= 871){ //Serial.println('q'); serialMessage = potiSerial_IDs[12]; lastRead = sensorValue; } } else if (sensorValue < 938){ if (lastRead < 871 || lastRead >= 938){ //Serial.println('r'); serialMessage = potiSerial_IDs[13]; lastRead = sensorValue; } } else if (sensorValue < 1015){ if (lastRead < 938 || lastRead >= 1015){ //Serial.println('s'); serialMessage = potiSerial_IDs[14]; lastRead = sensorValue; } } else if (sensorValue <= 1024){ if (lastRead < 1015){ //Serial.println('t'); serialMessage = potiSerial_IDs[15]; lastRead = sensorValue; } } }
[ "opensource@antimodular.com" ]
opensource@antimodular.com
7cd96a310473eb7cd5c6ed3d809022a637ccc319
561e985145b1e74fd956ba4f07acd13e8ac11ebc
/IOS Build/TestARKit/Classes/Native/mscorlib_System_Predicate_1_gen2701729683.h
2d9e497c7e953d6be10151f0798aa735c63ccbca
[]
no_license
thanhitpro/Jump
04eaaef2dd5afda806d48c5b9d86dbc30bce2feb
45769ecf15c8496d20b91c493e9389de27bbb367
refs/heads/master
2021-01-20T23:09:18.815748
2017-09-07T08:14:18
2017-09-07T08:14:18
101,840,580
0
0
null
null
null
null
UTF-8
C++
false
false
816
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_MulticastDelegate3201952435.h" // Newtonsoft.Json.Linq.JsonPath.QueryExpression struct QueryExpression_t4258759568; // System.IAsyncResult struct IAsyncResult_t1999651008; // System.AsyncCallback struct AsyncCallback_t163412349; // System.Object struct Il2CppObject; #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // System.Predicate`1<Newtonsoft.Json.Linq.JsonPath.QueryExpression> struct Predicate_1_t2701729683 : public MulticastDelegate_t3201952435 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "thanhit08@msn.com" ]
thanhit08@msn.com
7774fd1571195ff350d56ae8c8cbc7907dda1cd9
5bb2b7435713c249eb0af531975db8126e2e72d1
/generated-src/jni/NativeTestCpp.hpp
ee558231c49a6387aa8f14bdd35cb48f677eb9f8
[]
no_license
4brunu/AndroidNDK_GCC_To_Clang
4b483b8502de20ae3449e7205c4652c2eefe384e
4eff7ee042f4c3da317e4cbe4ddc7c114a7a4775
refs/heads/master
2021-01-17T18:07:38.652266
2016-07-17T19:03:14
2016-07-17T19:03:14
59,518,002
0
0
null
null
null
null
UTF-8
C++
false
false
1,102
hpp
// AUTOGENERATED FILE - DO NOT MODIFY! // This file generated by Djinni from AndroidNDK_GCC_To_Clang.djinni #pragma once #include "TestCpp.hpp" #include "djinni_support.hpp" namespace djinni_generated { class NativeTestCpp final : ::djinni::JniInterface<::example::TestCpp, NativeTestCpp> { public: using CppType = std::shared_ptr<::example::TestCpp>; using CppOptType = std::shared_ptr<::example::TestCpp>; using JniType = jobject; using Boxed = NativeTestCpp; ~NativeTestCpp(); static CppType toCpp(JNIEnv* jniEnv, JniType j) { return ::djinni::JniClass<NativeTestCpp>::get()._fromJava(jniEnv, j); } static ::djinni::LocalRef<JniType> fromCppOpt(JNIEnv* jniEnv, const CppOptType& c) { return {jniEnv, ::djinni::JniClass<NativeTestCpp>::get()._toJava(jniEnv, c)}; } static ::djinni::LocalRef<JniType> fromCpp(JNIEnv* jniEnv, const CppType& c) { return fromCppOpt(jniEnv, c); } private: NativeTestCpp(); friend ::djinni::JniClass<NativeTestCpp>; friend ::djinni::JniInterface<::example::TestCpp, NativeTestCpp>; }; } // namespace djinni_generated
[ "4brunu@gmail.com" ]
4brunu@gmail.com
176942f59354128e0b573931e01c16a2e0736535
39ec9653640c706f6c17c5024e405a3ac3106524
/Libraries/Framework/Source/Events/HUD_ValueAdjustEvent.h
787bd89444ec44c9df09df929062e8ddca02e50b
[]
no_license
Leftclickz/GameDev_3D-Framework
cbdcd7246230e64dcc5521a2b382833aaf0d1605
13eb8519406e89e65b65165e6138a6671036286a
refs/heads/master
2023-02-08T19:03:55.439434
2019-04-20T22:37:33
2019-04-20T22:37:33
326,899,565
0
0
null
null
null
null
UTF-8
C++
false
false
470
h
#pragma once #include "Event.h" enum ValueToAdjust { Value_Score, Value_Life, Value_Saves }; class HUD_ValueAdjustEvent : public Event { protected: public: HUD_ValueAdjustEvent(ValueToAdjust type, int value) : m_Type(type), m_Value(value) {} virtual EventTypes GetEventType() override { return EventType_HUDValueAdjust; } ValueToAdjust GetAdjustType() { return m_Type; } int GetValue() { return m_Value; } protected: int m_Value; ValueToAdjust m_Type; };
[ "travinator41@gmail.com" ]
travinator41@gmail.com
36ebd279f1fa0f96cb1df078e0db5646d862256a
9007ab07c9f1e8928eeda34af7254481ff997195
/sdl2/win32/misc/threadbase.cpp
aadda00791b5c1c8bf50d1120a4de3dece598b93
[ "MIT" ]
permissive
libretro/libretro-meowPC98
deed8e63602cee23eaa6a65b78e10b3f7d02daa6
bee2e243b0c68f787d0d360c2d4c289e581620ef
refs/heads/master
2023-06-17T08:28:08.583126
2023-05-28T12:17:16
2023-05-28T12:17:16
87,991,058
11
17
MIT
2023-05-28T12:17:17
2017-04-12T00:18:46
C
SHIFT_JIS
C++
false
false
1,661
cpp
/*! * @file threadbase.cpp * @brief スレッド基底クラスの動作の定義を行います */ #include "compiler.h" #include "threadbase.h" #include <process.h> /*! * @brief コンストラクタ */ CThreadBase::CThreadBase() : m_hThread(INVALID_HANDLE_VALUE) , m_dwThreadId(0) , m_bAbort(false) , m_bDone(false) , m_nStackSize(0) { } /*! * @brief デストラクタ */ CThreadBase::~CThreadBase() { Stop(); } /*! * @brief スレッド開始 * * @retval true 成功 */ bool CThreadBase::Start() { if (m_hThread != INVALID_HANDLE_VALUE) { return false; } m_bAbort = false; m_bDone = false; unsigned int nThreadId = 0; HANDLE hThread = reinterpret_cast<HANDLE>(::_beginthreadex(NULL, static_cast<unsigned>(m_nStackSize), &ThreadProc, this, 0, &nThreadId)); if (hThread == INVALID_HANDLE_VALUE) { return false; } m_hThread = hThread; m_dwThreadId = nThreadId; return true; } /*! * @brief スレッド終了 * * @retval true 成功 */ void CThreadBase::Stop() { if (m_hThread != INVALID_HANDLE_VALUE) { m_bAbort = true; ::WaitForSingleObject(m_hThread, INFINITE); ::CloseHandle(m_hThread); m_hThread = INVALID_HANDLE_VALUE; } } /*! * @brief スレッド再開 * * @retval true 成功 */ bool CThreadBase::Restart() { if ((m_hThread != INVALID_HANDLE_VALUE) && (m_bDone)) { Stop(); } return Start(); } /*! * スレッド処理 * @param[in] pParam this ポインタ * @retval 0 常に0 */ unsigned __stdcall CThreadBase::ThreadProc(LPVOID pParam) { CThreadBase& obj = *(static_cast<CThreadBase*>(pParam)); while ((!obj.m_bAbort) && (obj.Task())) { } obj.m_bDone = true; return 0; }
[ "yui@7c2116fe-53d0-4aec-ab59-80607f05abc0" ]
yui@7c2116fe-53d0-4aec-ab59-80607f05abc0
c22c35811a8ac4bb45711c89f57fce1a48c04f8a
ffb104a2bb9b3861440467ca9d534e132a3c7d9a
/AtCoder/ABC/154/A/A.cpp
a6e5222178f5533966265a77942832105a4d82d3
[]
no_license
closekn/procon
6ce0a38b748a344f6ff1e0a38df626b65462bb2d
841d91ae06ad86032b87dd6faa1ddc5a2e3dedd7
refs/heads/master
2023-05-27T13:47:13.404129
2021-06-06T13:52:50
2021-06-06T13:52:50
191,014,377
3
0
null
null
null
null
UTF-8
C++
false
false
231
cpp
#include <bits/stdc++.h> using namespace std; int main() { string s, t; int a, b; string u; cin >> s >> t; cin >> a >> b; cin >> u; if ( s == u ) { a--; } else { b--; } cout << a << ' ' << b << endl; return 0; }
[ "close.me.kn@gmail.com" ]
close.me.kn@gmail.com
fe2c1a600f4d630f2f0c8811c8f0ee9559dc5775
0254f2ee4fde7362762a32cf8e59612271c63c87
/src/plugins/cache/memcache/memcacheplugin.cpp
4949e6f99159e84958ba93c2ab5e22305f8181a4
[]
no_license
alexey-zayats/athletic
9a97f7f221bd3671df43ac65642df2916ba42a0b
0c65552d32a7bf581b03f0311e6764aaa60e1690
refs/heads/master
2020-05-22T01:31:14.186306
2017-07-10T12:06:58
2017-07-10T12:06:58
64,463,265
0
0
null
null
null
null
UTF-8
C++
false
false
949
cpp
#include "memcacheplugin.h" #include "memcachedcache.h" #include <extensionsystem/pluginmanager.h> Q_LOGGING_CATEGORY(memcacheLod, "athletic.plugins.memcache") using namespace Memcache; using namespace Memcache::Internal; MemcachePlugin::MemcachePlugin() : m_factory(0) { } MemcachePlugin::~MemcachePlugin() { if ( 0 != m_factory ) { ExtensionSystem::PluginManager::removeObject(m_factory); delete m_factory; m_factory = 0; } } bool MemcachePlugin::initialize(const QStringList &arguments, QString *errorMessage) { Q_UNUSED(arguments); Q_UNUSED(errorMessage); m_factory = new CacheFactory(); ExtensionSystem::PluginManager::addObject(m_factory); return true; } void MemcachePlugin::extensionsInitialized() { } bool MemcachePlugin::delayedInitialize() { return true; } ExtensionSystem::IPlugin::ShutdownFlag MemcachePlugin::aboutToShutdown() { return SynchronousShutdown; }
[ "alexey.zayats@gmail.com" ]
alexey.zayats@gmail.com
4096b1dea279aef7d569dbf7a6de50df7bc8122c
2bfddaf9c0ceb7bf46931f80ce84a829672b0343
/src/xtd.drawing/include/xtd/drawing/magenta_colors.h
f2f74fa0c71e76f8048927dac6c995f198146ea2
[ "MIT" ]
permissive
gammasoft71/xtd
c6790170d770e3f581b0f1b628c4a09fea913730
ecd52f0519996b96025b196060280b602b41acac
refs/heads/master
2023-08-19T09:48:09.581246
2023-08-16T20:52:11
2023-08-16T20:52:11
170,525,609
609
53
MIT
2023-05-06T03:49:33
2019-02-13T14:54:22
C++
UTF-8
C++
false
false
825
h
/// @file /// @brief Contains xtd::drawing::magenta_colors alias. /// @copyright Copyright (c) 2023 Gammasoft. All rights reserved. #pragma once #include "purple_colors.h" /// @brief The xtd namespace contains all fundamental classes to access Hardware, Os, System, and more. namespace xtd { /// @brief The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functionality is provided in the xtd::drawing::drawing_2d, xtd::drawing::imaging, and xtd::drawing::text namespaces. namespace drawing { /// @brief Purple, violet and magenta colors for all the hmtl purple, violet and magenta colors. /// @par Namespace /// xtd::drawing /// @par Library /// xtd.drawing /// @ingroup xtd_drawing drawing using magenta_colors = xtd::drawing::purple_colors; } }
[ "gammasoft71@gmail.com" ]
gammasoft71@gmail.com
28be8e8f6477b27c677fed5106fd92a03e9a02f8
a0370090e044e2817842b90a9559be41282072c5
/DevExpress VCL/ExpressQuantumGrid 7/Demos/CBuilder/IssueList/IssueListStyles.cpp
e50b3365f1cee6024772f45a895f2766cb4db212
[]
no_license
bravesoftdz/MyVCL-7
600a1c1be2ea71b198859b39b6da53c6b65601b3
197c1e284f9ac0791c15376bcf12c243400e7bcd
refs/heads/master
2022-01-11T17:18:00.430191
2018-12-20T08:23:02
2018-12-20T08:23:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
6,934
cpp
//--------------------------------------------------------------------------- #include <vcl.h> #pragma hdrstop #include "IssueListStyles.h" #include "IssueListStyleData.h" #include "cxStyleSheetEditor.hpp" #include "IssueListData.h" #include "IssueListMain.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "cxButtons" #pragma link "cxLookAndFeelPainters" #pragma link "cxStyleSheetEditor" #pragma link "cxListBox" #pragma link "cxGridStyleSheetsPreview" #pragma resource "*.dfm" //--------------------------------------------------------------------------- __fastcall TIssueListStylesForm::TIssueListStylesForm(TComponent* Owner) : TForm(Owner) { } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::lbPredefinedStyleSheetsClick( TObject *Sender) { if ( ((TcxListBox*)Sender)->Items->Count > 0) SelectStyleFromList(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::btnClearClick(TObject *Sender) { ResetStyleSheet(); ResetStyleAndController(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::btnEditClick(TObject *Sender) { ShowcxStyleSheetEditor( (TcxGridTableViewStyleSheet*)(lbPredefinedStyleSheets->Items-> Objects[lbPredefinedStyleSheets->ItemIndex]) , NULL); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::cxButton1Click(TObject *Sender) { if (OpenDialog->Execute()) { LoadStyleSheets(OpenDialog->FileName); SelectStyleFromList(); } } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::cxButton2Click(TObject *Sender) { if (SaveDialog->Execute()) SaveStyleSheets(SaveDialog->FileName); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::FormClose(TObject *Sender, TCloseAction &Action) { Action = caFree; } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::FormCreate(TObject *Sender) { FStyleData = new TdmStyles(this); SelectedStyleSheet = NULL; PopulateStylesList(); SelectStyleFromList(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::FormDestroy(TObject *Sender) { delete FStyleData; } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::PopulateStylesList() { lbPredefinedStyleSheets->Clear(); for (int i = 0; i< StyleData->strepPredefined->StyleSheetCount; i++) lbPredefinedStyleSheets->Items->AddObject( StyleData->strepPredefined->StyleSheets[i]->Caption, StyleData->strepPredefined->StyleSheets[i]); lbPredefinedStyleSheets->ItemIndex = 0; } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::LoadStyleSheets(const TFileName AFileName) { StyleData->strepPredefined->Clear(); StyleData->strepPredefined->ClearStyleSheets(); LoadStyleSheetsFromIniFile( AFileName, StyleData->strepPredefined, __classid(TcxGridTableViewStyleSheet), NULL, NULL, NULL, NULL); PopulateStylesList(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::SaveStyleSheets(const TFileName AFileName) { TList* AList = new TList(); try { for (int i = 0; i < StyleData->strepPredefined->StyleSheetCount; i++) AList->Add(StyleData->strepPredefined->StyleSheets[i]); SaveStyleSheetsToIniFile(AFileName, AList); } __finally { delete AList; } } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::UpdateStyleAndController() { if (SelectedStyleSheet->Styles->ContentOdd != NULL) dmMain->edstcMain->Style->Color = SelectedStyleSheet->Styles->ContentOdd->Color; if (SelectedStyleSheet->Styles->Selection != NULL && dmMain->stSelected != NULL) { dmMain->stSelected->Color = SelectedStyleSheet->Styles->Selection->Color; dmMain->stSelected->Font = SelectedStyleSheet->Styles->Selection->Font; } } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::SetStyleSheet() { IssueListMainForm->GridForm->cxGrid->BeginUpdate(); try { dmMain->strepMain->StyleSheets[0]->CopyFrom(SelectedStyleSheet); TcxGridDBDataController* const dcProjects = IssueListMainForm->GridForm->tvProjects->DataController; dcProjects->ClearDetails(); TcxGridDBDataController* const dcDepartments = IssueListMainForm->GridForm->tvDepartments->DataController; dcDepartments->ClearDetails(); } __finally { IssueListMainForm->GridForm->cxGrid->EndUpdate(); } UpdateStyleAndController(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::ResetStyleSheet() { IssueListMainForm->GridForm->cxGrid->BeginUpdate(); try { TcxGridTableViewStyles* const AStyles = dmMain->ssTableStyles->Styles; AStyles->Background = NULL; AStyles->Content = NULL; AStyles->ContentEven = NULL; AStyles->ContentOdd = NULL; AStyles->FilterBox = NULL; AStyles->Footer = NULL; AStyles->Group = NULL; AStyles->GroupByBox = NULL; AStyles->Header = NULL; AStyles->Inactive = NULL; AStyles->IncSearch = NULL; AStyles->Indicator = NULL; AStyles->Preview = NULL; AStyles->Selection = NULL; TcxGridDBDataController* const dcProjects = IssueListMainForm->GridForm->tvProjects->DataController; dcProjects->ClearDetails(); TcxGridDBDataController* const dcDepartments = IssueListMainForm->GridForm->tvDepartments->DataController; dcDepartments->ClearDetails(); } __finally { IssueListMainForm->GridForm->cxGrid->EndUpdate(); }; } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::SelectStyleFromList() { SelectedStyleSheet = (TcxGridTableViewStyleSheet*)lbPredefinedStyleSheets-> Items->Objects[lbPredefinedStyleSheets->ItemIndex]; SetStyleSheet(); UpdateStyleAndController(); } //--------------------------------------------------------------------------- void __fastcall TIssueListStylesForm::ResetStyleAndController() { dmMain->edstcMain->Style->Color = clWindow; dmMain->stSelected->Color = dmMain->stBlue->Color; dmMain->stSelected->Font = dmMain->stBlue->Font; } //---------------------------------------------------------------------------
[ "karaim@mail.ru" ]
karaim@mail.ru
3cdba7015ea1ab604108e6312a657513261040f7
05f44b7b38579bf7e5bbb42eadbc7b63ed349b48
/Source/FPSGame/Private/FPSGameState.cpp
5b3329da918b4d4226b16b44ddad3e7e0a448686
[]
no_license
alexjobe/ue4-stealth-game
71a3f06399c311cb59288ce5b1095800bff0def2
873695acbd45c29b5b32d9f76f7a4a8c13bf355d
refs/heads/master
2022-12-22T21:08:30.192935
2020-08-20T22:01:05
2020-08-20T22:01:05
null
0
0
null
null
null
null
UTF-8
C++
false
false
584
cpp
// Made by Alex Jobe #include "FPSGameState.h" #include "FPSPlayerController.h" void AFPSGameState::MulticastOnMissionComplete_Implementation(APawn* InstigatorPawn, bool bMissionSuccess) { for (FConstPlayerControllerIterator It = GetWorld()->GetPlayerControllerIterator(); It; It++) { AFPSPlayerController* PC = Cast<AFPSPlayerController>(It->Get()); if (PC && PC->IsLocalController()) { PC->OnMissionComplete(InstigatorPawn, bMissionSuccess); // Disable input on pawn APawn* MyPawn = PC->GetPawn(); if (MyPawn) { MyPawn->DisableInput(PC); } } } }
[ "ajobe15@gmail.com" ]
ajobe15@gmail.com
e53f3b8ce3e2b30dcf0fbfce7c3e5053e4a0519d
f9a3041f94e299445770e1923360f88eae15ae65
/cf3/math/LSS/Trilinos/TrilinosStratimikosStrategy.cpp
c756f50fcf877168fdc5aee4bbd86134b524a1b5
[]
no_license
gquentin/coolfluid3
4fd2726f1459edb5b4d36b9f55d3ae89f68a36a6
e3d1cf814c97cc34c0192f7ea61eec2eb8700669
refs/heads/master
2021-01-18T12:31:19.492871
2012-11-23T13:08:08
2012-11-23T13:08:08
2,179,203
0
0
null
null
null
null
UTF-8
C++
false
false
9,400
cpp
// Copyright (C) 2010 von Karman Institute for Fluid Dynamics, Belgium // // This software is distributed under the terms of the // GNU Lesser General Public License version 3 (LGPLv3). // See doc/lgpl.txt and doc/gpl.txt for the license text. //////////////////////////////////////////////////////////////////////////////////////////// #include <boost/mpl/vector.hpp> #include <boost/mpl/for_each.hpp> #include <boost/bind.hpp> #include "Teuchos_ConfigDefs.hpp" #include "Teuchos_RCP.hpp" #include "Teuchos_XMLParameterListHelpers.hpp" #include "Teko_StratimikosFactory.hpp" #include "Thyra_EpetraLinearOp.hpp" #include "Thyra_EpetraThyraWrappers.hpp" #include "Thyra_LinearOpWithSolveBase.hpp" #include "Thyra_VectorBase.hpp" #include "Thyra_MultiVectorStdOps.hpp" #include "Stratimikos_DefaultLinearSolverBuilder.hpp" #include "common/Builder.hpp" #include "common/EventHandler.hpp" #include "common/OptionList.hpp" #include "ParameterList.hpp" #include "ThyraMultiVector.hpp" #include "ThyraOperator.hpp" #include "TrilinosStratimikosStrategy.hpp" #include "ParameterListDefaults.hpp" #include "TrilinosVector.hpp" //////////////////////////////////////////////////////////////////////////////////////////// /** @file TrilinosStratimikosStrategy.hpp Drives Trilinos linear solvers through Stratimikos @author Bart Janssens **/ //////////////////////////////////////////////////////////////////////////////////////////// namespace cf3 { namespace math { namespace LSS { common::ComponentBuilder<TrilinosStratimikosStrategy, SolutionStrategy, LibLSS> TrilinosStratimikosStrategy_builder; struct TrilinosStratimikosStrategy::Implementation { Implementation(common::Component& self) : m_self(self), m_parameter_list(Teuchos::createParameterList()) { Teko::addTekoToStratimikosBuilder(m_linear_solver_builder); m_linear_solver_builder.setParameterList(m_parameter_list); m_self.options().add("verbosity_level", 1) .pretty_name("Verbosity Level") .description("Verbosity level for the solver") .attach_trigger(boost::bind(&Implementation::trigger_verbosity, this)) .mark_basic(); m_self.options().add("compute_residual", false) .pretty_name("Compute Residual") .description("Indicate if the residual should be computed. This incurs storage of an extra vector and an extra matrix application after each solve") .mark_basic(); m_self.options().add("print_settings", true) .pretty_name("Print Settings") .description("Print out the solver settings upon first solve") .mark_basic(); m_self.options().add("settings_file", common::URI("", cf3::common::URI::Scheme::FILE)) .supported_protocol(cf3::common::URI::Scheme::FILE) .pretty_name("Settings File") .description("If set, the settings will initially be read from this file") .attach_trigger(boost::bind(&Implementation::trigger_settings_file, this)) .mark_basic(); } void trigger_verbosity() { if(!m_lows_factory.is_null()) { const int verb = m_self.options().option("verbosity_level").value<int>(); m_lows_factory->setVerbLevel(static_cast<Teuchos::EVerbosityLevel>(verb)); m_lows.reset(); } } void trigger_settings_file() { const std::string settings_path = m_self.options().option("settings_file").value<common::URI>().path(); if(settings_path.empty()) return; if(!boost::filesystem::exists(settings_path)) { CFwarn << "Settings file " << settings_path << " doesn't exist, solver parameters not changed!" << CFendl; return; } m_parameter_list = Teuchos::getParametersFromXmlFile(settings_path); m_linear_solver_builder.setParameterList(m_parameter_list); setup_solver(); } void setup_solver() { m_lows_factory = Thyra::createLinearSolveStrategy(m_linear_solver_builder); const int verb = m_self.options().option("verbosity_level").value<int>(); m_lows_factory->setVerbLevel(static_cast<Teuchos::EVerbosityLevel>(verb)); m_lows.reset(); m_residual_vec.reset(); // Update the component tree that represents the parameters. This automatically exposes available options update_parameters(); } void solve() { if(is_null(m_matrix)) throw common::SetupError(FromHere(), "Null matrix for " + m_self.uri().path()); if(is_null(m_rhs)) throw common::SetupError(FromHere(), "Null RHS for " + m_self.uri().path()); if(is_null(m_solution)) throw common::SetupError(FromHere(), "Null solution vector for " + m_self.uri().path()); if(m_lows.is_null()) { m_lows = Thyra::linearOpWithSolve(*m_lows_factory, m_matrix->thyra_operator()); if(m_self.options().option("print_settings").value<bool>()) m_parameter_list->print(); } Thyra::SolveStatus<double> status = Thyra::solve<double>(*m_lows, Thyra::NOTRANS, *m_rhs->thyra_vector(m_matrix->thyra_operator()->range()), m_solution->thyra_vector(m_matrix->thyra_operator()->domain()).ptr()); CFinfo << "Thyra::solve finished with status " << status.message << CFendl; if(m_self.options().option("compute_residual").value<bool>()) CFinfo << "Solver residual: " << compute_residual() << CFendl; } Real compute_residual() { if(is_null(m_matrix)) throw common::SetupError(FromHere(), "Null matrix for " + m_self.uri().path()); if(is_null(m_rhs)) throw common::SetupError(FromHere(), "Null RHS for " + m_self.uri().path()); if(is_null(m_solution)) throw common::SetupError(FromHere(), "Null solution vector for " + m_self.uri().path()); if(m_lows.is_null()) throw common::SetupError(FromHere(), "Null linear operator for " + m_self.uri().path()); if(m_residual_vec.is_null()) { m_residual_vec = m_rhs->thyra_vector(m_matrix->thyra_operator()->range())->clone_mv(); } Thyra::assign(m_rhs->thyra_vector(m_matrix->thyra_operator()->range()).ptr(), *m_residual_vec); m_lows->apply(Thyra::NOTRANS, *m_solution->thyra_vector(m_matrix->thyra_operator()->domain()), m_residual_vec.ptr(), 1., -1.); std::vector<Real> residuals(m_residual_vec->domain()->dim()); Thyra::norms_2(*m_residual_vec, Teuchos::arrayViewFromVector(residuals)); return *std::max_element(residuals.begin(), residuals.end()); } void update_parameters() { if(is_not_null(m_parameters)) m_self.remove_component("Parameters"); m_parameters = m_self.create_component<ParameterList>("Parameters"); m_parameters->mark_basic(); m_parameters->set_parameter_list(*m_parameter_list); } common::Component& m_self; Teuchos::RCP<Teuchos::ParameterList> m_parameter_list; Stratimikos::DefaultLinearSolverBuilder m_linear_solver_builder; Teuchos::RCP<Thyra::LinearOpWithSolveFactoryBase<double> > m_lows_factory; Teuchos::RCP<Thyra::LinearOpWithSolveBase<double> > m_lows; Handle<ThyraOperator const> m_matrix; Handle<ThyraMultiVector> m_rhs; Handle<ThyraMultiVector> m_solution; Teuchos::RCP< Thyra::MultiVectorBase<Real> > m_residual_vec; Handle<ParameterList> m_parameters; }; //////////////////////////////////////////////////////////////////////////////////////////// TrilinosStratimikosStrategy::TrilinosStratimikosStrategy(const std::string& name) : SolutionStrategy(name), m_implementation(new Implementation(*this)) { set_default_parameters("cf3.math.LSS.BelosGMRESParameters"); m_implementation->update_parameters(); common::Core::instance().event_handler().connect_to_event("trilinos_parameters_changed", this, &TrilinosStratimikosStrategy::on_parameters_changed_event); } TrilinosStratimikosStrategy::~TrilinosStratimikosStrategy() { } void TrilinosStratimikosStrategy::set_matrix(const Handle< Matrix >& matrix) { m_implementation->m_matrix = Handle<ThyraOperator>(matrix); m_implementation->setup_solver(); } void TrilinosStratimikosStrategy::set_rhs(const Handle< Vector >& rhs) { m_implementation->m_rhs = Handle<ThyraMultiVector>(rhs); } void TrilinosStratimikosStrategy::set_solution(const Handle< Vector >& solution) { m_implementation->m_solution = Handle<ThyraMultiVector>(solution); } void TrilinosStratimikosStrategy::solve() { m_implementation->solve(); } Real TrilinosStratimikosStrategy::compute_residual() { return m_implementation->compute_residual(); } void TrilinosStratimikosStrategy::set_default_parameters(const string& builder_name) { common::build_component_abstract_type<ParameterListDefaults>(builder_name, "DefaultParams")->set_parameters(*m_implementation->m_parameter_list); m_implementation->update_parameters(); } void TrilinosStratimikosStrategy::on_parameters_changed_event(common::SignalArgs& args) { common::XML::SignalOptions options(args); const common::URI parameters_uri = options.value<common::URI>("parameters_uri"); if(boost::starts_with(parameters_uri.path(), uri().path())) { CFdebug << "Acting on trilinos_parameters_changed event from paramater list " << parameters_uri.string() << CFendl; m_implementation->setup_solver(); } else { CFdebug << "Ignoring trilinos_parameters_changed event from paramater list " << parameters_uri.string() << CFendl; } } //////////////////////////////////////////////////////////////////////////////////////////// } // namespace LSS } // namespace math } // namespace cf3
[ "bart.janssens@lid.kviv.be" ]
bart.janssens@lid.kviv.be
27763298418c0d4ad86b34ad0c039acaa712b69b
6fb152723dd63e82dd4f59f543ed4cc85e27d74d
/dep/Simian Framework/SimianBase/Vector2D.h
c7759bb3604a17bdba097b4ead99c3f651634821
[]
no_license
bwyyoung/NYP_CPP_COL
75e9e8e5ea3addcf7159b46133453d4a57a121fc
f690761217329b2d0fd265c0fa34156c0d65a409
refs/heads/master
2016-09-05T23:28:11.746111
2015-04-29T19:41:02
2015-04-29T19:41:02
34,814,371
0
0
null
null
null
null
UTF-8
C++
false
false
342
h
#pragma once #include "Macros.h" class SIM_EXP Vector2D { protected: float mX; float mY; public: Vector2D(float X = 0.0f, float Y = 0.0f); ~Vector2D(); float Magnitude(); float Angle(); Vector2D operator+(Vector2D a); Vector2D operator-(Vector2D a); Vector2D operator+(float a); Vector2D operator-(float a); };
[ "bwyyoung@gmail.com" ]
bwyyoung@gmail.com
47b0e4b00e98f0f245bae792239846bf1f7f1706
cb37b1b5846150d7add76dd9222402b9aed54523
/xrSource/xr_3da/device.cpp
2962cd1a80ee38789b85b186af473f44ea9d93da
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
DoK74rus/X-Ray-PBR
327f221c2baccbde33ec8cb402a5b377f298c89b
680820012c94d83f59092583e20c249dbc2c9e61
refs/heads/master
2023-03-22T10:26:45.168343
2021-03-18T13:22:54
2021-03-18T13:22:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,331
cpp
#include "stdafx.h" #include "frustum.h" #pragma warning(disable:4995) // mmsystem.h #define MMNOSOUND #define MMNOMIDI #define MMNOAUX #define MMNOMIXER #define MMNOJOY #include <mmsystem.h> // d3dx9.h #include <d3dx9.h> #pragma warning(default:4995) #include "x_ray.h" #include "render.h" ENGINE_API CRenderDevice Device; ENGINE_API BOOL g_bRendering = FALSE; BOOL g_bLoaded = FALSE; ref_light precache_light = 0; BOOL CRenderDevice::Begin () { #ifndef DEDICATED_SERVER HW.Validate (); HRESULT _hr = HW.pDevice->TestCooperativeLevel(); if (FAILED(_hr)) { // If the device was lost, do not render until we get it back if (D3DERR_DEVICELOST==_hr) { Sleep (33); return FALSE; } // Check if the device is ready to be reset if (D3DERR_DEVICENOTRESET==_hr) { Reset (); } } CHK_DX (HW.pDevice->BeginScene()); RCache.OnFrameBegin (); RCache.set_CullMode (CULL_CW); RCache.set_CullMode (CULL_CCW); if (HW.Caps.SceneMode) overdrawBegin (); FPU::m24r (); g_bRendering = TRUE; #endif return TRUE; } void CRenderDevice::Clear () { CHK_DX(HW.pDevice->Clear(0,0, D3DCLEAR_ZBUFFER|(psDeviceFlags.test(rsClearBB)?D3DCLEAR_TARGET:0)|(HW.Caps.bStencil?D3DCLEAR_STENCIL:0),D3DCOLOR_XRGB(0,0,0),0,0)); } extern void CheckPrivilegySlowdown(); #include "resourcemanager.h" void CRenderDevice::End (void) { #ifndef DEDICATED_SERVER VERIFY (HW.pDevice); if (HW.Caps.SceneMode) overdrawEnd (); // if (dwPrecacheFrame) { ::Sound->set_master_volume (0.f); dwPrecacheFrame --; pApp->load_draw_internal (); if (0==dwPrecacheFrame) { Gamma.Update (); if(precache_light) precache_light->set_active (false); if(precache_light) precache_light.destroy (); ::Sound->set_master_volume (1.f); pApp->destroy_loading_shaders (); Resources->DestroyNecessaryTextures (); Memory.mem_compact (); Msg ("* MEMORY USAGE: %d K",Memory.mem_usage()/1024); CheckPrivilegySlowdown (); } } g_bRendering = FALSE; // end scene RCache.OnFrameEnd (); Memory.dbg_check (); CHK_DX (HW.pDevice->EndScene()); HRESULT _hr = HW.pDevice->Present( NULL, NULL, NULL, NULL ); if (D3DERR_DEVICELOST==_hr) return; // we will handle this later //R_ASSERT2 (SUCCEEDED(_hr), "Presentation failed. Driver upgrade needed?"); #endif } volatile u32 mt_Thread_marker = 0x12345678; void mt_Thread (void *ptr) { while (true) { // waiting for Device permission to execute Device.mt_csEnter.Enter (); if (Device.mt_bMustExit) { Device.mt_bMustExit = FALSE; // Important!!! Device.mt_csEnter.Leave(); // Important!!! return; } // we has granted permission to execute mt_Thread_marker = Device.dwFrame; for (u32 pit=0; pit<Device.seqParallel.size(); pit++) Device.seqParallel[pit] (); Device.seqParallel.clear_not_free (); Device.seqFrameMT.Process (rp_Frame); // now we give control to device - signals that we are ended our work Device.mt_csEnter.Leave (); // waits for device signal to continue - to start again Device.mt_csLeave.Enter (); // returns sync signal to device Device.mt_csLeave.Leave (); } } #include "igame_level.h" void CRenderDevice::PreCache (u32 amount) { if (HW.Caps.bForceGPU_REF) amount=0; #ifdef DEDICATED_SERVER amount = 0; #endif // Msg ("* PCACHE: start for %d...",amount); dwPrecacheFrame = dwPrecacheTotal = amount; if(amount && !precache_light && g_pGameLevel) { precache_light = ::Render->light_create(); precache_light->set_shadow (false); precache_light->set_position (vCameraPosition); precache_light->set_color (255,255,255); precache_light->set_range (5.0f); precache_light->set_active (true); } } int g_svDedicateServerUpdateReate = 100; ENGINE_API xr_list<LOADING_EVENT> g_loading_events; void CRenderDevice::Run () { // DUMP_PHASE; g_bLoaded = FALSE; MSG msg; BOOL bGotMsg; Log ("Starting engine..."); thread_name ("X-RAY Primary thread"); // Startup timers and calculate timer delta dwTimeGlobal = 0; Timer_MM_Delta = 0; { u32 time_mm = timeGetTime (); while (timeGetTime()==time_mm); // wait for next tick u32 time_system = timeGetTime (); u32 time_local = TimerAsync (); Timer_MM_Delta = time_system-time_local; } // Start all threads // InitializeCriticalSection (&mt_csEnter); // InitializeCriticalSection (&mt_csLeave); mt_csEnter.Enter (); mt_bMustExit = FALSE; thread_spawn (mt_Thread,"X-RAY Secondary thread",0,0); // Message cycle PeekMessage ( &msg, NULL, 0U, 0U, PM_NOREMOVE ); seqAppStart.Process (rp_AppStart); CHK_DX(HW.pDevice->Clear(0,0,D3DCLEAR_TARGET,D3DCOLOR_XRGB(0,0,0),1,0)); while( WM_QUIT != msg.message ) { bGotMsg = PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ); if( bGotMsg ) { TranslateMessage ( &msg ); DispatchMessage ( &msg ); } else { if (b_is_Ready) { #ifdef DEDICATED_SERVER u32 FrameStartTime = TimerGlobal.GetElapsed_ms(); #endif if (psDeviceFlags.test(rsStatistic)) g_bEnableStatGather = TRUE; else g_bEnableStatGather = FALSE; if(g_loading_events.size()) { if( g_loading_events.front() () ) g_loading_events.pop_front(); pApp->LoadDraw (); continue; }else FrameMove ( ); // Precache if (dwPrecacheFrame) { float factor = float(dwPrecacheFrame)/float(dwPrecacheTotal); float angle = PI_MUL_2 * factor; vCameraDirection.set (_sin(angle),0,_cos(angle)); vCameraDirection.normalize (); vCameraTop.set (0,1,0); vCameraRight.crossproduct (vCameraTop,vCameraDirection); mView.build_camera_dir (vCameraPosition,vCameraDirection,vCameraTop); } // Matrices mFullTransform.mul ( mProject,mView ); RCache.set_xform_view ( mView ); RCache.set_xform_project ( mProject ); D3DXMatrixInverse ( (D3DXMATRIX*)&mInvFullTransform, 0, (D3DXMATRIX*)&mFullTransform); // *** Resume threads // Capture end point - thread must run only ONE cycle // Release start point - allow thread to run mt_csLeave.Enter (); mt_csEnter.Leave (); Sleep (0); #ifndef DEDICATED_SERVER Statistic->RenderTOTAL_Real.FrameStart (); Statistic->RenderTOTAL_Real.Begin (); if (b_is_Active) { if (Begin()) { seqRender.Process (rp_Render); if (psDeviceFlags.test(rsCameraPos) || psDeviceFlags.test(rsStatistic) || Statistic->errors.size()) Statistic->Show (); End (); } } Statistic->RenderTOTAL_Real.End (); Statistic->RenderTOTAL_Real.FrameEnd (); Statistic->RenderTOTAL.accum = Statistic->RenderTOTAL_Real.accum; #endif // *** Suspend threads // Capture startup point // Release end point - allow thread to wait for startup point mt_csEnter.Enter (); mt_csLeave.Leave (); // Ensure, that second thread gets chance to execute anyway if (dwFrame!=mt_Thread_marker) { for (u32 pit=0; pit<Device.seqParallel.size(); pit++) Device.seqParallel[pit] (); Device.seqParallel.clear_not_free (); seqFrameMT.Process (rp_Frame); } #ifdef DEDICATED_SERVER u32 FrameEndTime = TimerGlobal.GetElapsed_ms(); u32 FrameTime = (FrameEndTime - FrameStartTime); /* string1024 FPS_str = ""; string64 tmp; strcat(FPS_str, "FPS Real - "); if (dwTimeDelta != 0) strcat(FPS_str, ltoa(1000/dwTimeDelta, tmp, 10)); else strcat(FPS_str, "~~~"); strcat(FPS_str, ", FPS Proj - "); if (FrameTime != 0) strcat(FPS_str, ltoa(1000/FrameTime, tmp, 10)); else strcat(FPS_str, "~~~"); */ u32 DSUpdateDelta = 1000/g_svDedicateServerUpdateReate; if (FrameTime < DSUpdateDelta) { Sleep(DSUpdateDelta - FrameTime); // Msg("sleep for %d", DSUpdateDelta - FrameTime); // strcat(FPS_str, ", sleeped for "); // strcat(FPS_str, ltoa(DSUpdateDelta - FrameTime, tmp, 10)); } // Msg(FPS_str); #endif } else { Sleep (100); } if (!b_is_Active) Sleep (1); } } seqAppEnd.Process (rp_AppEnd); // Stop Balance-Thread mt_bMustExit = TRUE; mt_csEnter.Leave (); while (mt_bMustExit) Sleep(0); // DeleteCriticalSection (&mt_csEnter); // DeleteCriticalSection (&mt_csLeave); } void ProcessLoading(RP_FUNC *f); void CRenderDevice::FrameMove() { dwFrame ++; dwTimeContinual = TimerMM.GetElapsed_ms (); if (psDeviceFlags.test(rsConstantFPS)) { // 20ms = 50fps fTimeDelta = 0.020f; fTimeGlobal += 0.020f; dwTimeDelta = 20; dwTimeGlobal += 20; } else { // Timer float fPreviousFrameTime = Timer.GetElapsed_sec(); Timer.Start(); // previous frame fTimeDelta = 0.1f * fTimeDelta + 0.9f*fPreviousFrameTime; // smooth random system activity - worst case ~7% error if (fTimeDelta>.1f) fTimeDelta=.1f; // limit to 15fps minimum if(Paused()) fTimeDelta = 0.0f; // u64 qTime = TimerGlobal.GetElapsed_clk(); fTimeGlobal = TimerGlobal.GetElapsed_sec(); //float(qTime)*CPU::cycles2seconds; u32 _old_global = dwTimeGlobal; dwTimeGlobal = TimerGlobal.GetElapsed_ms (); //u32((qTime*u64(1000))/CPU::cycles_per_second); dwTimeDelta = dwTimeGlobal-_old_global; } // Frame move Statistic->EngineTOTAL.Begin (); if(!g_bLoaded) ProcessLoading (rp_Frame); else seqFrame.Process (rp_Frame); Statistic->EngineTOTAL.End (); } void ProcessLoading (RP_FUNC *f) { Device.seqFrame.Process (rp_Frame); g_bLoaded = TRUE; } ENGINE_API BOOL bShowPauseString = TRUE; #include "IGame_Persistent.h" void CRenderDevice::Pause(BOOL bOn, BOOL bTimer, BOOL bSound, LPCSTR reason) { static int snd_emitters_ = -1; if (g_bBenchmark) return; #ifdef DEBUG Msg("pause [%s] timer=[%s] sound=[%s] reason=%s",bOn?"ON":"OFF", bTimer?"ON":"OFF", bSound?"ON":"OFF", reason); #endif // DEBUG #ifndef DEDICATED_SERVER if(bOn) { if(!Paused()) bShowPauseString = TRUE; if( bTimer && g_pGamePersistent->CanBePaused() ) g_pauseMngr.Pause (TRUE); if(bSound){ snd_emitters_ = ::Sound->pause_emitters(true); #ifdef DEBUG Log("snd_emitters_[true]",snd_emitters_); #endif // DEBUG } }else { if( bTimer && /*g_pGamePersistent->CanBePaused() &&*/ g_pauseMngr.Paused() ) g_pauseMngr.Pause (FALSE); if(bSound) { if(snd_emitters_>0) //avoid crash { snd_emitters_ = ::Sound->pause_emitters(false); #ifdef DEBUG Log("snd_emitters_[false]",snd_emitters_); #endif // DEBUG }else { #ifdef DEBUG Log("Sound->pause_emitters underflow"); #endif // DEBUG } } } #endif } BOOL CRenderDevice::Paused() { return g_pauseMngr.Paused(); }; void CRenderDevice::OnWM_Activate(WPARAM wParam, LPARAM lParam) { u16 fActive = LOWORD(wParam); BOOL fMinimized = (BOOL) HIWORD(wParam); BOOL bActive = ((fActive!=WA_INACTIVE) && (!fMinimized))?TRUE:FALSE; if (bActive!=Device.b_is_Active) { Device.b_is_Active = bActive; if (Device.b_is_Active) { Device.seqAppActivate.Process(rp_AppActivate); #ifndef DEDICATED_SERVER ShowCursor (FALSE); #endif }else { Device.seqAppDeactivate.Process(rp_AppDeactivate); ShowCursor (TRUE); } } }
[ "charles.greivelding@gmail.com" ]
charles.greivelding@gmail.com
957b46e7a9b5e8f3f1f72593625e94179e835a0b
61e9ff7d4cc510aafcf13e188ce6e97c3e835847
/Stack/infixTOpostfix.cpp
63b2d8c06a1c0eaef4be6fffaf12f2f428a01673
[]
no_license
Jaswantsinghh/Data-Structures
9215029b01b4054db8d5b83078216fd33d65b282
ac6826e6212a1418c21c88b49134351326c859df
refs/heads/master
2021-08-10T12:52:46.051277
2021-06-01T15:46:03
2021-06-01T15:46:03
253,214,605
3
1
null
null
null
null
UTF-8
C++
false
false
1,843
cpp
#include<bits/stdc++.h> using namespace std; int convert(string); int precedence(char); int main() { string s; cout << "Enter the infix statement\n"; cin >> s; convert(s); int c=1; while(c==1) { cout << "To convert one more infix expression to postfix, press 1 else press 0 to exit and hit enter\n "; cin >> c; if(c==0) { return 0; } cout << "Enter the infix statement\n"; cin >> s; convert(s); } return 0; } int convert(string s) { stack<char> stck; string dup; int len; len=s.length(); for(int i=0;i<len;++i) { if((s[i]>='A'&&s[i]<='Z') || (s[i]>='a'&&s[i]<='z')) { dup=dup+s[i]; } else if(s[i]=='(') { stck.push('('); } else if(s[i]==')') { while(stck.top()!='('&& stck.empty() == false) { char ch = stck.top(); stck.pop(); dup =dup + ch; } if(stck.top() == '(') { char ch = stck.top(); stck.pop(); } } else { while(stck.empty() == false && precedence(s[i]) <= precedence(stck.top())) { char ch = stck.top(); stck.pop(); dup = dup + ch; } stck.push(s[i]); } } while(stck.empty() == false) { char ch = stck.top(); stck.pop(); dup = dup + ch; } cout << "POSTIX EXPRESSION IS: "; cout << dup <<"\n"; return 0; } int precedence(char ch) { if(ch == '^') return 3; else if(ch == '*' || ch == '/') return 2; else if(ch == '+' || ch == '-') return 1; else return -1; }
[ "noreply@github.com" ]
noreply@github.com
e92638053ff9a4e5c2db8984a3a494499d0ba5b5
b3b9b80e1f1f6c10f206f6c6b4efa035db85e468
/Examples/source/XPStoPNG.cpp
7e2d3d7b8ddad0f3000a0706ebd35f971b556412
[ "MIT" ]
permissive
kashifiqb/Aspose.Page-for-C
7faf800ae8e7c9673ebfeaa7b43fdad5ead92198
ac121edcf382d2543261f797d1dac108936ca69f
refs/heads/master
2020-11-30T01:30:48.388225
2020-02-10T14:54:20
2020-02-10T14:54:20
230,263,793
0
0
MIT
2019-12-26T12:53:01
2019-12-26T12:53:00
null
UTF-8
C++
false
false
2,855
cpp
#include "stdafx.h" #include "examples.h" //#include "ExampleDirectories.h" #include "..\RunExamples.h" using namespace System::Drawing; using namespace Aspose::Page; using namespace Aspose::Page::Xps; using namespace Aspose::Page::Xps::Presentation::Image; void XPStoPNG() { //ExStart: XPStoPNG // Input file System::String inputFileName = RunExamples::dataDir() + u"input.xps"; //Outut file System::String outputFileName = RunExamples::outDir() + u"XPStoImage_out.png"; // Initialize XPS input stream { System::SharedPtr<System::IO::Stream> xpsStream = System::IO::File::Open(inputFileName, System::IO::FileMode::Open, System::IO::FileAccess::Read); // Clearing resources under 'using' statement System::Details::DisposeGuard<1> __dispose_guard_1({ xpsStream }); // ------------------------------------------ try { // Load XPS document form the stream System::SharedPtr<XpsDocument> document = System::MakeObject<XpsDocument>(xpsStream, System::MakeObject<XpsLoadOptions>()); // or load XPS document directly from file. No xpsStream is needed then. // XpsDocument document = new XpsDocument(inputFileName, new XpsLoadOptions()); // Initialize options object with necessary parameters. System::SharedPtr<PngSaveOptions> options = [&] { auto tmp_0 = System::MakeObject<PngSaveOptions>(); tmp_0->set_SmoothingMode(System::Drawing::Drawing2D::SmoothingMode::HighQuality); tmp_0->set_Resolution(300); tmp_0->set_PageNumbers(System::MakeArray<int32_t>({ 1, 2, 6 })); return tmp_0; }(); // Create rendering device for PDF format System::SharedPtr<ImageDevice> device = System::MakeObject<ImageDevice>(); document->Save(device, options); // Iterate through document partitions (fixed documents, in XPS terms) for (int32_t i = 0; i < device->get_Result()->get_Length(); i++) { for (int32_t j = 0; j < device->get_Result()[i]->get_Length(); j++) { // Initialize image output stream { System::SharedPtr<System::IO::Stream> imageStream = System::IO::File::Open(System::IO::Path::GetDirectoryName(outputFileName) + u"\\" + System::IO::Path::GetFileNameWithoutExtension(outputFileName) + u"_" + (i + 1) + u"_" + (j + 1) + System::IO::Path::GetExtension(outputFileName), System::IO::FileMode::Create, System::IO::FileAccess::Write); // Clearing resources under 'using' statement System::Details::DisposeGuard<1> __dispose_guard_0({ imageStream }); // ------------------------------------------ try { imageStream->Write(device->get_Result()[i][j], 0, device->get_Result()[i][j]->get_Length()); } catch (...) { __dispose_guard_0.SetCurrentException(std::current_exception()); } } } } } catch (...) { __dispose_guard_1.SetCurrentException(std::current_exception()); } } //ExEnd: XPStoPNG }
[ "kashifiqb@gmail.com" ]
kashifiqb@gmail.com
57c943ba913b7f8453b50c55db176df07d2df85b
5ee0eb940cfad30f7a3b41762eb4abd9cd052f38
/play/case0/170/k
4e13434b7a425a7e13532bd8ffe6c8bce5006df3
[]
no_license
mamitsu2/aircond5_play4
052d2ff593661912b53379e74af1f7cee20bf24d
c5800df67e4eba5415c0e877bdeff06154d51ba6
refs/heads/master
2020-05-25T02:11:13.406899
2019-05-20T04:56:10
2019-05-20T04:56:10
187,570,146
0
0
null
null
null
null
UTF-8
C++
false
false
8,777
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "170"; object k; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 2 -2 0 0 0 0]; internalField nonuniform List<scalar> 459 ( 0.00375223 0.00468542 0.00563227 0.00503053 0.0035515 0.00258068 0.00178862 0.00141876 0.00115329 0.000960268 0.000841638 0.000767985 0.000715423 0.000673283 0.00063611 0.000339513 0.000453038 0.000483545 0.000373313 0.00025731 0.000154635 8.05228e-05 6.71008e-05 7.27351e-05 8.14942e-05 8.04748e-05 7.03337e-05 6.47174e-05 9.33144e-05 0.00013128 0.000221608 0.000306728 0.000297653 0.000238093 0.00400829 0.00855813 0.0132153 0.0180101 0.0178355 0.0141954 0.00848345 0.00436286 0.00257603 0.00179104 0.00148263 0.00136668 0.00130966 0.00121941 0.00103384 0.000745457 0.000438345 0.000634267 0.000996153 0.000915955 0.000748047 0.000560806 0.000364706 0.000215558 0.000159439 0.000174031 0.000198654 0.000171893 0.000111299 7.82009e-05 0.000149624 0.000299876 0.000660778 0.00084627 0.00100372 0.000455086 0.00835275 0.0115848 0.0119122 0.0123075 0.0135021 0.0139227 0.0130817 0.0110512 0.00533053 0.00265138 0.00187763 0.00165211 0.00157678 0.00150073 0.00135552 0.00115449 0.000898704 0.00129116 0.00198862 0.00141235 0.00119508 0.0010503 0.00091124 0.000291122 0.000194512 0.00015643 0.000134232 0.000117568 0.000101221 8.98053e-05 0.000270361 0.000607335 0.00103394 0.00111968 0.00101835 0.000615567 0.0215286 0.0207274 0.0175315 0.0147937 0.0133031 0.0129353 0.0127838 0.0120854 0.00904118 0.00420132 0.00249072 0.00205299 0.00191627 0.00182781 0.00171216 0.00158687 0.00153426 0.00167606 0.0019281 0.00147709 0.0012994 0.00121727 0.001174 0.00113856 0.00113687 0.0011913 0.00126352 0.00134525 0.0014328 0.00152492 0.00161995 0.00167098 0.00169106 0.00178737 0.00194493 0.00252421 0.00170301 0.0253256 0.026106 0.0197997 0.015183 0.0127986 0.0120506 0.0120634 0.0119411 0.00981766 0.00534941 0.00316689 0.00254964 0.00240825 0.00237331 0.00232703 0.00224661 0.00215468 0.00204556 0.00181737 0.00168761 0.00165135 0.00167244 0.0017338 0.00182718 0.00195157 0.0021069 0.00229556 0.00251298 0.00275124 0.00300499 0.00327932 0.00355512 0.00384536 0.00406579 0.00415897 0.00401826 0.00359669 0.00292568 0.00232439 0.0021765 0.028393 0.0308467 0.020297 0.0137195 0.0112824 0.010769 0.0110879 0.0113617 0.0095752 0.00559204 0.00349508 0.00290702 0.00284883 0.00291962 0.00296658 0.00293377 0.00280712 0.0026128 0.0023972 0.00222366 0.00212252 0.00209763 0.0021326 0.0022149 0.00234253 0.00252309 0.00276143 0.0030497 0.00337557 0.00373484 0.0041413 0.00462031 0.00519983 0.0058831 0.00667361 0.0074701 0.00754265 0.00663379 0.00411473 0.00316065 0.0318145 0.0343726 0.0183971 0.0108228 0.0096223 0.00963335 0.010177 0.0105424 0.00891587 0.00547427 0.00356137 0.0031096 0.00318568 0.00338217 0.00353613 0.00358527 0.0035074 0.00332142 0.00307952 0.00284466 0.0026666 0.00256648 0.00254115 0.00258443 0.0027003 0.00290275 0.00319583 0.00356057 0.00396329 0.00438079 0.00482325 0.00532765 0.005926 0.00660802 0.00728698 0.00774926 0.00771718 0.00724529 0.00533462 0.00325081 0.0366062 0.0400934 0.0275486 0.0101462 0.00878857 0.00905724 0.00950404 0.00969845 0.00820417 0.00528117 0.0036313 0.00330619 0.00349131 0.00377785 0.00400915 0.0041283 0.00411232 0.00396836 0.00373658 0.00347589 0.00324245 0.0030722 0.00297978 0.0029736 0.00307098 0.00329942 0.00367278 0.00416691 0.00471079 0.00521143 0.00560261 0.00584591 0.00593126 0.0058914 0.00578799 0.00570352 0.00565684 0.00560937 0.00547365 0.00399524 0.0452111 0.0616916 0.077157 0.0209711 0.00949064 0.00942253 0.00931336 0.00915937 0.00776128 0.0053028 0.00402292 0.00373537 0.00387869 0.00412152 0.00432969 0.00445246 0.00446764 0.0043715 0.00418406 0.00394534 0.00370131 0.00348967 0.00333573 0.00325999 0.00329203 0.00347598 0.00384349 0.00441009 0.00515853 0.00603225 0.00694894 0.00784413 0.00867359 0.00939411 0.00991003 0.00994163 0.00949518 0.0093795 0.0103772 0.00489344 0.152836 0.0589558 0.0132529 0.0108204 0.00982406 0.00926898 0.00772699 0.0058731 0.00486095 0.00447773 0.00440446 0.00442772 0.00446922 0.00448724 0.00445866 0.00437196 0.00422817 0.00404141 0.00383454 0.00363236 0.00345738 0.00333103 0.00327946 0.00333751 0.00354195 0.0039205 0.00447801 0.00517979 0.00599194 0.00684451 0.00765346 0.00835119 0.00890154 0.00929105 0.0092142 0.00811613 0.0092776 0.00482907 0.0467958 0.014426 0.0120952 0.0107056 0.0099799 0.00921498 0.00763865 0.00627165 0.00542509 0.00494543 0.00466662 0.00446505 0.00430514 0.00416703 0.00403681 0.00390399 0.00376194 0.00360919 0.00344956 0.00329079 0.00314287 0.00301761 0.00293028 0.00290256 0.00296379 0.0031468 0.00347273 0.00394953 0.00455329 0.00522172 0.00586562 0.00639098 0.00671374 0.00675053 0.00633398 0.00568383 0.00709731 0.00379282 0.0107612 0.015749 0.0230967 0.00544488 0.00529484 0.00628732 0.00643852 0.00599894 0.00523595 0.00455578 0.00401299 0.00357795 0.00322124 0.00293487 0.00269813 0.00249847 0.00232748 0.00217885 0.00204749 0.00192928 0.00182115 0.00172116 0.0016285 0.00154346 0.00146755 0.00140397 0.00135827 0.00133888 0.0013606 0.00144657 0.00160798 0.00184212 0.00212248 0.00239867 0.00260701 0.00268154 0.00264663 0.00254938 0.00254673 0.00226185 ) ; boundaryField { floor { type kqRWallFunction; value nonuniform List<scalar> 29 ( 0.00063611 0.000339513 0.000453038 0.000483545 0.000373313 0.00025731 0.000154635 8.05228e-05 6.71008e-05 7.27351e-05 8.14942e-05 8.04748e-05 7.03337e-05 6.47174e-05 9.33144e-05 0.00013128 0.000221608 0.000306728 0.000297653 0.000238093 0.000238093 0.000455086 0.000615567 0.00170301 0.00063611 0.000339513 0.000634267 0.00129116 0.00167606 ) ; } ceiling { type kqRWallFunction; value nonuniform List<scalar> 43 ( 0.0107612 0.015749 0.0230967 0.00544488 0.00529484 0.00628732 0.00643852 0.00599894 0.00523595 0.00455578 0.00401299 0.00357795 0.00322124 0.00293487 0.00269813 0.00249847 0.00232748 0.00217885 0.00204749 0.00192928 0.00182115 0.00172116 0.0016285 0.00154346 0.00146755 0.00140397 0.00135827 0.00133888 0.0013606 0.00144657 0.00160798 0.00184212 0.00212248 0.00239867 0.00260701 0.00268154 0.00264663 0.00254938 0.00254673 0.00226185 0.0452111 0.0616916 0.0467958 ) ; } sWall { type kqRWallFunction; value uniform 0.0107612; } nWall { type kqRWallFunction; value nonuniform List<scalar> 6(0.0021765 0.00316065 0.00325081 0.00482907 0.00379282 0.00226185); } sideWalls { type empty; } glass1 { type kqRWallFunction; value nonuniform List<scalar> 9(0.00375223 0.00400829 0.00835275 0.0215286 0.0253256 0.028393 0.0318145 0.0366062 0.0452111); } glass2 { type kqRWallFunction; value nonuniform List<scalar> 2(0.00399524 0.00489344); } sun { type kqRWallFunction; value nonuniform List<scalar> 14 ( 0.00375223 0.00468542 0.00563227 0.00503053 0.0035515 0.00258068 0.00178862 0.00141876 0.00115329 0.000960268 0.000841638 0.000767985 0.000715423 0.000673283 ) ; } heatsource1 { type kqRWallFunction; value nonuniform List<scalar> 3(0.00292568 0.00232439 0.0021765); } heatsource2 { type kqRWallFunction; value nonuniform List<scalar> 4(0.000745457 0.000438345 0.000438345 0.000898704); } Table_master { type kqRWallFunction; value nonuniform List<scalar> 9(0.000291122 0.000194512 0.00015643 0.000134232 0.000117568 0.000101221 8.98053e-05 0.000270361 0.000607335); } Table_slave { type kqRWallFunction; value nonuniform List<scalar> 9(0.00113687 0.0011913 0.00126352 0.00134525 0.0014328 0.00152492 0.00161995 0.00167098 0.00169106); } inlet { type turbulentIntensityKineticEnergyInlet; intensity 0.05; value uniform 3.75e-05; } outlet { type zeroGradient; } } // ************************************************************************* //
[ "mitsuaki.makino@tryeting.jp" ]
mitsuaki.makino@tryeting.jp
9a5a09aac583aed71cb3c78d2385105f3ba9a18e
7649449c62fef919badc07178f0f3b9cd70b579b
/ECMedia/source/ec_live_engine/srs-hls-parser/ec_ts_parser.h
19e2489fe700c8203b418056968abceffc24500d
[]
no_license
Okrio/ecmedia
1c0dec7b513b447ce16f2daebf5f404fd37dcd23
75fe1767d43f68715f065f025195aee47ae783d4
refs/heads/master
2023-03-24T15:43:30.815590
2020-05-22T02:15:02
2020-05-22T02:15:02
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,282
h
// // ec_hls_parser.h // ECMedia // // Created by 葛昭友 on 2017/8/21. // Copyright © 2017年 Sean Lee. All rights reserved. // #ifndef ec_hls_parser_h #define ec_hls_parser_h #include <inttypes.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <vector> #include <map> class TSMessage; class AacMuxer; namespace yuntongxunwebrtc { class EC_TS_ParserCallback { public: EC_TS_ParserCallback() {}; virtual ~EC_TS_ParserCallback() {}; // virtual void onTsPacketParsed() = 0; // avc data callback virtual void onGotAvcframe(const char* avc_data, int length, int64_t dts, int64_t pts) = 0; // aac data callback virtual void onGotAacframe(const char* aac_data, int length, int64_t dts, int64_t pts) = 0; }; class EC_TS_Parser { public: EC_TS_Parser(); ~EC_TS_Parser(); int parse(u_int8_t* ts_data, int data_length); void setCallback(EC_TS_ParserCallback* cb); private: int consume(TSMessage* msg, AacMuxer* aac_muxer); private: EC_TS_ParserCallback *callback_; }; } #endif /* ec_hls_parser_h */
[ "gezhaoyou@126.com" ]
gezhaoyou@126.com
300f27bd78257ccd1a10b5db30d20b05ac2b64e1
452f7ba589dec9c9c7fbfbf9f0e4f8fedbdf392c
/xerolibs/xerobase/SmartDashboardAction.h
69c03cb48bf378b659da2183240bc813516c245e
[]
no_license
errorcodexero/endurance2019
51364f9e2a638029439002622e445d60016fb772
f2442d43c845c3b9c6d94e86c21ecc571a3410b6
refs/heads/master
2020-12-29T22:42:08.917542
2020-02-06T18:54:22
2020-02-06T18:54:22
238,759,923
0
0
null
null
null
null
UTF-8
C++
false
false
2,747
h
#pragma once #include <frc/Timer.h> #include <memory> #include <vector> #include <string> #include <memory> /// \file namespace xero { namespace base { /// \brief A class capable of doing work. /// An action is the basis of all activity on the robot both in operator mode and autonomous mode. /// There are some actions that are independent of subsystems are part of the control of the robot. However /// the vast majority of actions are used to ask a robot subsystem to perform some function. For instance, /// one of the actions for the TankDrive subsystem is to drive straight a fixed distance. /// \sa ParallelAction /// \sa DelayAction /// \sa ActionSequence class SmartDashboardAction { public: enum class DataType { Number, String, Boolean } ; public: SmartDashboardAction(const std::string &name, double number) { name_ = name ; dt_ = DataType::Number ; number_ = number ; } SmartDashboardAction(const std::string &name, int number) { name_ = name ; dt_ = DataType::Number ; number_ = number ; } SmartDashboardAction(const std::string &name, const std::string &str) { name_ = name ; dt_ = DataType::String ; str_ = str ; } SmartDashboardAction(const std::string &name, bool b) { name_ = name ; dt_ = DataType::Boolean ; boolvalue_ = b ; } /// \brief Start the action; called once per action when it starts virtual void start() ; /// \brief Manage the action; called each time through the robot loop virtual void run() ; /// \brief Cancel the action virtual void cancel() ; /// \brief Return true if the action is complete /// \returns True if the action is complete virtual bool isDone() ; /// \brief return a human readable string representing the action /// \returns a human readable string representing the action virtual std::string toString() ; private: std::string name_ ; DataType dt_ ; double number_ ; std::string str_ ; bool boolvalue_ ; }; } }
[ "bwg@cypress.com" ]
bwg@cypress.com
c22c9ab4386f2b10546ecf73189e1002e884de4a
318d3b1478d4b9e5f179aca8617370478abce07f
/RedAlert3Mod/logger.cpp
4038b8def2fbc36954f7035de2d32e7300c9d552
[]
no_license
Ru0ch3n/RedAlert3-Hack
0c7e5df1a844087421a7f4b5118a91229d0e139b
cd5a0e7c0b78f446a5a8fcec129b86988a485105
refs/heads/master
2023-03-15T08:53:17.881689
2020-12-24T03:31:58
2020-12-24T03:32:14
null
0
0
null
null
null
null
UTF-8
C++
false
false
657
cpp
#include "stdafx.h" #include "logger.h" logger_t::logger_t(std::string _file_path_) : file_path(_file_path_) { if (file_path.length() > 0) init(); } logger_t::~logger_t() { if (file.is_open()) { file.close(); } } void logger_t::init() { if (file.is_open()) this->~logger_t(); return file.open(file_path.c_str()); } void logger_t::log(std::string str, ...) { char buffer[512]; va_list ap; va_start(ap, str); sprintf_s(buffer, 512, str.c_str(), ap); va_end(ap); file << buffer << std::endl; } void logger_t::log_hex(std::string var_name, std::size_t var_val) { file << var_name << " = 0x" << std::hex << var_val << std::dec << std::endl; }
[ "62789396+quang2002@users.noreply.github.com" ]
62789396+quang2002@users.noreply.github.com
8292389b5e717fd8552df8441960d7a2d5507b63
b6e99690e205b303454c0346858c912aa8bdc4ef
/TestDriveQTI.ino
ed9470727391836e761bd364383f91ff6421b20e
[]
no_license
tenbom/Arduino
f3df93b1bce00721c7dcc0deaf5da3fd543a8a4b
f60eada5c690c6096c01d2c84401943fd06cffe8
refs/heads/master
2021-01-20T16:00:20.818793
2016-05-06T21:55:12
2016-05-06T21:55:12
53,682,015
0
0
null
2016-03-11T16:49:07
2016-03-11T16:49:05
Arduino
UTF-8
C++
false
false
1,937
ino
//from front of sensor //5v, ground, signal //Pins for the sensors======================================= #define Pin2 2 #define Pin3 3 #define Pin4 4 #define Pin5 5 #define Pin6 6 //=========================================================== uint64_t currentTime = 0; uint64_t lastTime = 0; uint8_t state = 0; void setup() { Serial.begin(9600); } void loop() { currentTime = millis(); Serial.println(RCTime(Pin2)); // Connect to pin 2, display results //Serial.println(RCTime(Pin3)); //Serial.println(RCTime(Pin4)); //Serial.println(RCTime(Pin5)); //Serial.println(RCTime(Pin6)); //delay(250); // Wait 250 ms } uint64_t RCTime(int sensorIn){ //uint64_t means unsigned 64bit integer pinMode(sensorIn, OUTPUT); // Make pin OUTPUT digitalWrite(sensorIn, HIGH); // Pin HIGH (discharge capacitor) pinMode(sensorIn, INPUT); // Make pin INPUT digitalWrite(sensorIn, LOW); // Turn off internal pullups if(digitalRead(sensorIn)){ // Wait for pin to go LOW lastTime = millis(); } if (!digitalRead(sensorIn)) { uint64_t temp = lastTime; lastTime = 0; return temp; } return 0; } int isOnTheLine(uint64_t currentPin) {//has to receive pin readings from left to right if (currentPin > 300) { //sensor is on the line return 1; } if (currentPin < 300) { //sensor is NOT on the line return 0; } } uint8_t sensorState() { state = ((isOnTheLine(RCTime(Pin6))*pow(2,4)) + (isOnTheLine(RCTime(Pin5))*pow(2,3)) + (isOnTheLine(RCTime(Pin4))*pow(2,2)) + (isOnTheLine(RCTime(Pin3))*pow(2,1)) + (isOnTheLine(RCTime(Pin2)))); return state; } void drive { if (state == 4) { //00100 //straight(); } if (state == 0) { //00000 //leftTurn(); } if (state == 28) { //11100 //leftTurn(); } if (state == 31) { //11111 //straight(); } if (state == 0) { //00000 //(); } if (state == 0) { //00000 //(); } }
[ "higgsbosonseeker@gmail.com" ]
higgsbosonseeker@gmail.com
ccc2925617ae1c1f462dad271f3034d0b83d9780
ed4040d1c29d0560657c0ef56451470b6e641972
/include/vadefs.h
e7c5d28ebb59a27150b3c70555cf41b579e3f11b
[]
no_license
metarutaiga/msvc
46e0765f4777b1f9da771ea55ad7274d85317674
0b1da00728e68d8e4f67506a6eb3aa265f342d4a
refs/heads/master
2023-06-17T13:35:32.005428
2021-07-17T16:52:19
2021-07-17T16:52:19
328,590,853
0
0
null
null
null
null
UTF-8
C++
false
false
7,807
h
// // vadefs.h // // Copyright (c) Microsoft Corporation. All rights reserved. // // Definitions of macro helpers used by <stdarg.h>. This is the topmost header // in the CRT header lattice, and is always the first CRT header to be included, // explicitly or implicitly. Therefore, this header also has several definitions // that are used throughout the CRT. // #pragma once #define _INC_VADEFS #define _CRT_PACKING 8 #pragma pack(push, _CRT_PACKING) // C4339: '__type_info_node': use of undefined type detected in CLR meta-data (/Wall) #ifndef _VCRUNTIME_DISABLED_WARNING_4339 #ifdef _M_CEE_PURE #define _VCRUNTIME_DISABLED_WARNING_4339 4339 #else #define _VCRUNTIME_DISABLED_WARNING_4339 #endif #endif // C4412: function signature contains type '<typename>'; // C++ objects are unsafe to pass between pure code and mixed or native. (/Wall) #ifndef _VCRUNTIME_DISABLED_WARNING_4412 #ifdef _M_CEE_PURE #define _VCRUNTIME_DISABLED_WARNING_4412 4412 #else #define _VCRUNTIME_DISABLED_WARNING_4412 #endif #endif // Use _VCRUNTIME_EXTRA_DISABLED_WARNINGS to add additional warning suppressions to VCRuntime headers. #ifndef _VCRUNTIME_EXTRA_DISABLED_WARNINGS #define _VCRUNTIME_EXTRA_DISABLED_WARNINGS #endif // C4514: unreferenced inline function has been removed (/Wall) // C4820: '<typename>' : 'N' bytes padding added after data member (/Wall) #ifndef _VCRUNTIME_DISABLED_WARNINGS #define _VCRUNTIME_DISABLED_WARNINGS _VCRUNTIME_DISABLED_WARNING_4339 _VCRUNTIME_DISABLED_WARNING_4412 4514 4820 _VCRUNTIME_EXTRA_DISABLED_WARNINGS #endif #pragma warning(push) #pragma warning(disable: _VCRUNTIME_DISABLED_WARNINGS) #ifdef __cplusplus extern "C" { #endif #if !defined _W64 #define _W64 #endif #ifndef _UINTPTR_T_DEFINED #define _UINTPTR_T_DEFINED #ifdef _WIN64 typedef unsigned __int64 uintptr_t; #else typedef unsigned int uintptr_t; #endif #endif #ifndef _VA_LIST_DEFINED #define _VA_LIST_DEFINED #ifdef _M_CEE_PURE typedef System::ArgIterator va_list; #else typedef char* va_list; #endif #endif #ifdef __cplusplus #define _ADDRESSOF(v) (&const_cast<char&>(reinterpret_cast<const volatile char&>(v))) #else #define _ADDRESSOF(v) ((char*)&(v)) #endif #if (defined _M_ARM || defined _M_HYBRID_X86_ARM64) && !defined _M_CEE_PURE #define _VA_ALIGN 4 #define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1)) #define _APALIGN(t,ap) (((va_list)0 - (ap)) & (__alignof(t) - 1)) #elif (defined _M_ARM64 || defined _M_ARM64EC) && !defined _M_CEE_PURE #define _VA_ALIGN 8 #define _SLOTSIZEOF(t) ((sizeof(t) + _VA_ALIGN - 1) & ~(_VA_ALIGN - 1)) #define _APALIGN(t,ap) (((va_list)0 - (ap)) & (__alignof(t) - 1)) #else #define _SLOTSIZEOF(t) (sizeof(t)) #define _APALIGN(t,ap) (__alignof(t)) #endif #if defined _M_CEE_PURE || (defined _M_CEE && !defined _M_ARM && !defined _M_ARM64) void __cdecl __va_start(va_list*, ...); void* __cdecl __va_arg(va_list*, ...); void __cdecl __va_end(va_list*); #define __crt_va_start_a(ap, v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), __alignof(v), _ADDRESSOF(v)))) #define __crt_va_arg(ap, t) (*(t *)__va_arg(&ap, _SLOTSIZEOF(t), _APALIGN(t,ap), (t*)0)) #define __crt_va_end(ap) ((void)(__va_end(&ap))) #elif defined _M_IX86 && !defined _M_HYBRID_X86_ARM64 #define _INTSIZEOF(n) ((sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1)) #define __crt_va_start_a(ap, v) ((void)(ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v))) #define __crt_va_arg(ap, t) (*(t*)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #elif defined _M_ARM #ifdef __cplusplus void __cdecl __va_start(va_list*, ...); #define __crt_va_start_a(ap, v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), _ADDRESSOF(v)))) #else #define __crt_va_start_a(ap, v) ((void)(ap = (va_list)_ADDRESSOF(v) + _SLOTSIZEOF(v))) #endif #define __crt_va_arg(ap, t) (*(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #elif defined _M_HYBRID_X86_ARM64 void __cdecl __va_start(va_list*, ...); #define __crt_va_start_a(ap,v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), __alignof(v), _ADDRESSOF(v)))) #define __crt_va_arg(ap, t) (*(t*)((ap += _SLOTSIZEOF(t)) - _SLOTSIZEOF(t))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #elif defined _M_ARM64 void __cdecl __va_start(va_list*, ...); #define __crt_va_start_a(ap,v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), __alignof(v), _ADDRESSOF(v)))) #define __crt_va_arg(ap, t) \ ((sizeof(t) > (2 * sizeof(__int64))) \ ? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \ : *(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #elif defined _M_ARM64EC void __cdecl __va_start(va_list*, ...); //take the ARM64 va_start (for now) #define __crt_va_start_a(ap,v) ((void)(__va_start(&ap, _ADDRESSOF(v), _SLOTSIZEOF(v), __alignof(v), _ADDRESSOF(v)))) //a hybrid va arg, to account for the shift in calling convention, with the alignment of ARM64 #define __crt_va_arg(ap, t) \ ((sizeof(t) > sizeof(__int64) || (sizeof(t) & (sizeof(t) - 1)) != 0) \ ? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \ : *(t*)((ap += _SLOTSIZEOF(t) + _APALIGN(t,ap)) - _SLOTSIZEOF(t))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #elif defined _M_X64 void __cdecl __va_start(va_list* , ...); #define __crt_va_start_a(ap, x) ((void)(__va_start(&ap, x))) #define __crt_va_arg(ap, t) \ ((sizeof(t) > sizeof(__int64) || (sizeof(t) & (sizeof(t) - 1)) != 0) \ ? **(t**)((ap += sizeof(__int64)) - sizeof(__int64)) \ : *(t* )((ap += sizeof(__int64)) - sizeof(__int64))) #define __crt_va_end(ap) ((void)(ap = (va_list)0)) #endif #ifdef __cplusplus } // extern "C" #endif #if defined __cplusplus && !defined _CRT_NO_VA_START_VALIDATION extern "C++" { template <typename _Ty> struct __vcrt_va_list_is_reference { enum : bool { __the_value = false }; }; template <typename _Ty> struct __vcrt_va_list_is_reference<_Ty&> { enum : bool { __the_value = true }; }; template <typename _Ty> struct __vcrt_va_list_is_reference<_Ty&&> { enum : bool { __the_value = true }; }; template <typename _Ty> struct __vcrt_assert_va_start_is_not_reference { static_assert(!__vcrt_va_list_is_reference<_Ty>::__the_value, "va_start argument must not have reference type and must not be parenthesized"); }; } // extern "C++" #define __crt_va_start(ap, x) ((void)(__vcrt_assert_va_start_is_not_reference<decltype(x)>(), __crt_va_start_a(ap, x))) #else // ^^^ __cplusplus ^^^ // vvv !__cplusplus vvv // #define __crt_va_start(ap, x) __crt_va_start_a(ap, x) #endif #pragma warning(pop) // _VCRUNTIME_DISABLED_WARNINGS #pragma pack(pop)
[ "@" ]
@
3be78ca030b43fbce13da55fd00f29f8a06e4234
a6387f0813647cdceb39e889ca19bbaf78597b48
/dialogs/screenshotdialog.cpp
fc630c30e3a2cf27f49f6cb5602655e14bba5149
[]
no_license
manjeetdahiya/lightscreen-clone
a31e8a68aa8219c334d301d3ef27c4663d790abe
2a1fd54ff73ea2e623ed297dddacc7ac38923f1c
refs/heads/master
2020-09-12T19:35:34.938255
2010-07-14T10:08:03
2010-07-14T10:08:03
774,260
0
1
null
null
null
null
UTF-8
C++
false
false
2,530
cpp
#include "screenshotdialog.h" #include "../tools/screenshot.h" #include <QApplication> #include <QDesktopWidget> #include <QScrollArea> #include <QScrollBar> #include <QLabel> #include <QHBoxLayout> #include <QMouseEvent> #include <QDebug> ScreenshotDialog::ScreenshotDialog(Screenshot *screenshot, QWidget *parent) : QDialog(parent) { setWindowTitle(tr("Lightscreen Screenshot Viewer")); mScrollArea = new QScrollArea; mScrollArea->verticalScrollBar()->installEventFilter(this); mLabel = new QLabel; QHBoxLayout *layout = new QHBoxLayout; mLabel->setPixmap(screenshot->pixmap()); mLabel->setScaledContents(true); mScrollArea->setWidget(mLabel); layout->addWidget(mScrollArea); layout->setMargin(0); setLayout(layout); setCursor(Qt::OpenHandCursor); QSize size = screenshot->pixmap().size(); if (size.width() >= qApp->desktop()->size().width()) { size.setWidth(qApp->desktop()->availableGeometry().size().width() - 300); } if (size.height() >= qApp->desktop()->size().height()) { size.setHeight(qApp->desktop()->availableGeometry().size().height() - 300); } resize(size); show(); } void ScreenshotDialog::mousePressEvent(QMouseEvent *event) { mMousePos = event->pos(); setCursor(Qt::ClosedHandCursor); } void ScreenshotDialog::mouseReleaseEvent(QMouseEvent *event) { setCursor(Qt::OpenHandCursor); } void ScreenshotDialog::mouseMoveEvent(QMouseEvent *event) { QPoint diff = event->pos() - mMousePos; mMousePos = event->pos(); mScrollArea->verticalScrollBar()->setValue(mScrollArea->verticalScrollBar()->value() - diff.y()); mScrollArea->horizontalScrollBar()->setValue(mScrollArea->horizontalScrollBar()->value() - diff.x()); } void ScreenshotDialog::closeEvent(QCloseEvent *event) { Q_UNUSED(event) deleteLater(); } bool ScreenshotDialog::eventFilter(QObject *obj, QEvent *event) { if (event->type() == QEvent::Wheel && qApp->keyboardModifiers() & Qt::ControlModifier) { QWheelEvent *wheelEvent = static_cast<QWheelEvent *>(event); if (wheelEvent->delta() > 0) { mLabel->resize(mLabel->size()+QSize(100, 100)); } else { mLabel->resize(mLabel->size()-QSize(100, 100)); } return true; } return QObject::eventFilter(obj, event); } void ScreenshotDialog::wheelEvent(QWheelEvent *event) { qDebug() << "ScreenshotDialog::wheelEvent(delta: " << event->delta() << ")"; event->accept(); }
[ "k39@80aa95d3-9837-0410-88af-92ee65f5bde1" ]
k39@80aa95d3-9837-0410-88af-92ee65f5bde1
cff83bb221b14e406315e78f7d1012ac889a855d
aad28fa1140e713c8591db5a383ac5f6605f743b
/235 Арифметика/Арифметика.cpp
7e29c309b1f7d1d7be96fe436564423a8b946ebb
[]
no_license
DaniilMuntyan/Solutions_e-olymp
d7ad45357d4f999c853efefcd47c39bc17e33664
7a318572e13f2e6103a2ade49c8ce9c5210caad9
refs/heads/master
2021-02-28T15:22:58.506994
2020-03-07T21:42:50
2020-03-07T21:42:50
245,708,666
3
0
null
null
null
null
UTF-8
C++
false
false
425
cpp
#include<bits/stdc++.h> using namespace std; #define int long long main() { freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); string s = ""; char t; cin >> s; int ans = 0; ans = s[0]-'0'; for(int i = 1; i < s.length()-1; i++){ if(s[i] == '+') ans += (s[i+1]-'0'); if(s[i] == '*') ans *= (s[i+1]-'0'); } cout << ans << endl; }
[ "daniilmuntjan@gmail.com" ]
daniilmuntjan@gmail.com
2d525c0c652bb552cfc056df8228bb14d0486922
f83ef53177180ebfeb5a3e230aa29794f52ce1fc
/cairo/cairo-1.14.8/test/random-clips.c
31d7d6df0435a13db505ff4f318e7b9d07f0868d
[ "Apache-2.0", "LicenseRef-scancode-public-domain", "MIT", "MPL-1.1", "LGPL-2.1-only", "GPL-1.0-or-later", "LicenseRef-scancode-other-permissive", "MPL-1.0", "LGPL-2.1-or-later" ]
permissive
msrLi/portingSources
fe7528b3fd08eed4a1b41383c88ee5c09c2294ef
57d561730ab27804a3172b33807f2bffbc9e52ae
refs/heads/master
2021-07-08T01:22:29.604203
2019-07-10T13:07:06
2019-07-10T13:07:06
196,183,165
2
1
Apache-2.0
2020-10-13T14:30:53
2019-07-10T10:16:46
null
UTF-8
C++
false
false
5,201
c
/* * Copyright © 2006 M Joonas Pihlaja * Copyright © 2011 Chris Wilson * * 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. * * Authors: * M Joonas Pihlaja <jpihlaja@cc.helsinki.fi> * Chris Wilson <chris@chris-wilson.co.uk> */ #include "cairo-test.h" #define SIZE 512 #define STEP (512+2) #define NUM_SEGMENTS 128 static uint32_t state; static double uniform_random (double minval, double maxval) { static uint32_t const poly = 0x9a795537U; uint32_t n = 32; while (n-->0) state = 2*state < state ? (2*state ^ poly) : 2*state; return minval + state * (maxval - minval) / 4294967296.0; } static void nz_path (cairo_t *cr) { int i; state = 0xc0ffee; cairo_move_to (cr, 0, 0); for (i = 0; i < NUM_SEGMENTS; i++) { double x = uniform_random (0, SIZE); double y = uniform_random (0, SIZE); cairo_line_to (cr, x, y); } cairo_close_path (cr); } static void region_path (cairo_t *cr) { int i; state = 0xc0ffee; for (i = 0; i < NUM_SEGMENTS; i++) { int x = uniform_random (0, SIZE); int y = uniform_random (0, SIZE); int w = uniform_random (0, 40); int h = uniform_random (0, 40); cairo_rectangle (cr, x, y, w, h); } } static void rectangle_path (cairo_t *cr) { int i; state = 0xc0ffee; for (i = 0; i < NUM_SEGMENTS; i++) { double x = uniform_random (0, SIZE); double y = uniform_random (0, SIZE); double w = uniform_random (0, 40); double h = uniform_random (0, 40); cairo_rectangle (cr, x, y, w, h); } } static void arc_path (cairo_t *cr) { int i; state = 0xc0ffee; for (i = 0; i < NUM_SEGMENTS; i++) { double x = uniform_random (0, SIZE); double y = uniform_random (0, SIZE); double r = uniform_random (0, 20); cairo_new_sub_path (cr); cairo_arc (cr, x, y, r, 0, 2*M_PI); } } static void nz_fill_stroke (cairo_t *cr) { nz_path (cr); cairo_set_source_rgb (cr, 1, 0, 0); cairo_fill_preserve (cr); cairo_set_source_rgb (cr, 0, 1, 0); cairo_set_line_width (cr, 1.0); cairo_stroke (cr); } static void clip_to_quadrant (cairo_t *cr) { cairo_rectangle (cr, 0, 0, SIZE, SIZE); cairo_clip (cr); } static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_set_source_rgb (cr, 0, 0, 0); cairo_paint (cr); cairo_set_fill_rule (cr, CAIRO_FILL_RULE_WINDING); state = 0xc0ffee; cairo_translate (cr, 1, 1); /* no clipping */ cairo_save (cr); { clip_to_quadrant (cr); nz_fill_stroke (cr); } cairo_restore (cr); cairo_translate (cr, STEP, 0); /* random clipping */ cairo_save (cr); { clip_to_quadrant (cr); nz_path (cr); cairo_clip (cr); nz_fill_stroke (cr); cairo_set_source_rgba (cr, 1, 1, 1, 0.5); cairo_paint (cr); } cairo_restore (cr); cairo_translate (cr, STEP, 0); /* regional clipping */ cairo_save (cr); { clip_to_quadrant (cr); region_path (cr); cairo_clip (cr); nz_fill_stroke (cr); cairo_set_source_rgba (cr, 1, 1, 1, 0.5); cairo_paint (cr); } cairo_restore (cr); cairo_translate (cr, -2*STEP, STEP); /* rectangular clipping */ cairo_save (cr); { clip_to_quadrant (cr); rectangle_path (cr); cairo_clip (cr); nz_fill_stroke (cr); cairo_set_source_rgba (cr, 1, 1, 1, 0.5); cairo_paint (cr); } cairo_restore (cr); cairo_translate (cr, STEP, 0); /* circular clipping */ cairo_save (cr); { clip_to_quadrant (cr); arc_path (cr); cairo_clip (cr); nz_fill_stroke (cr); cairo_set_source_rgba (cr, 1, 1, 1, 0.5); cairo_paint (cr); } cairo_restore (cr); cairo_translate (cr, STEP, 0); /* all-of-the-above clipping */ cairo_save (cr); { clip_to_quadrant (cr); nz_path (cr); cairo_clip (cr); region_path (cr); cairo_clip (cr); rectangle_path (cr); cairo_clip (cr); arc_path (cr); cairo_clip (cr); nz_fill_stroke (cr); cairo_set_source_rgba (cr, 1, 1, 1, 0.5); cairo_paint (cr); } cairo_restore (cr); return CAIRO_TEST_SUCCESS; } CAIRO_TEST (random_clip, "Tests the clip generation and intersection computation", "trap, clip", /* keywords */ NULL, /* requirements */ 3*STEP+2, 2*STEP+2, NULL, draw)
[ "lihuibin705@163.com" ]
lihuibin705@163.com
4f393611050edae69506cfada627fea59787f87a
68387ec2d3ab8227694f30611776041c93c916e0
/src/plugins/Mpris/Mpris.h
160cfc27ad55d6d8ee0bced242d85f81ed20c5b8
[]
no_license
fredemmott/jerboa
6db8b995f8d76ce645946ea7a39d94ffa1d3658b
31dd1e72d7d84fad0f48d73613817d1fddeb9e0c
refs/heads/master
2021-01-22T12:08:17.503084
2012-01-29T15:10:21
2012-01-29T15:10:21
1,414,708
5
0
null
null
null
null
UTF-8
C++
false
false
1,170
h
/* LICENSE NOTICE This file is part of Jerboa. Jerboa is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option), any later version. Jerboa is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Jerboa. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _MPRIS_H #define _MPRIS_H #include "PlayerInterface.h" #include "PlaylistInterface.h" #include "JerboaPlugin.h" class Mpris: public QObject, public Jerboa::Plugin { Q_OBJECT; Q_INTERFACES(Jerboa::Plugin); public: Mpris(); QString pluginName() const; QString pluginAuthor() const; QString uniqueId() const; void addComponent(ComponentType type, QObject* component); private: void createInstance(); Jerboa::PlaylistInterface* m_playlist; Jerboa::PlayerInterface* m_player; }; #endif
[ "mail@fredemmott.co.uk" ]
mail@fredemmott.co.uk
de672f3f6a76cac16f3e14d1fd45490656fae8df
c5193e72c108d144856e1cc5050131e5a1c3f88b
/Chapter10/Sales_data_10_12.cc
5a2ac442d015ca48211ce3feb890dbd7deb393cb
[]
no_license
mviseu/Cpp_primer
0fbad7d2671c5906e62119c930a18a839928aa77
35ec142bd959e8596be03701e5d43e01276710a1
refs/heads/master
2021-01-18T23:21:45.715093
2018-08-25T12:12:33
2018-08-25T12:12:33
87,107,097
2
0
null
null
null
null
UTF-8
C++
false
false
471
cc
#include "Sales_data_10_12.h" #include <iostream> using std::endl; istream &read(istream &, Sales_data &); ostream &print(ostream &out, const Sales_data &S); istream &read(istream &in, Sales_data &S) { in >> S.bookNo >> S.nr_units >> S.revenue; return in; } ostream &print(ostream &out, const Sales_data &S) { out << S.bookNo << " " << S.nr_units << " " << S.revenue << " " << (S.revenue == 0 ? S.revenue : S.revenue / S.nr_units) << endl; return out; }
[ "mariaviseu@gmail.com" ]
mariaviseu@gmail.com
497e7ea6e00db41fc52f294b3f9da21417c17d2b
4212b420e0067e14c97d14a31b6444c28215903f
/Programs/myLibrary/stv2.h
1c92ead6d85cdae00dac14df7ed4e39f9d61b8eb
[]
no_license
StavrosMar/CPP
929f6dc4e642a32e8d0bd84994b94b90cd19f64e
3512dc09bf6b2a93130898c16471768052ad5ca1
refs/heads/master
2021-09-23T18:16:55.619093
2021-09-13T17:41:05
2021-09-13T17:41:05
86,387,879
0
0
null
2018-08-06T15:41:03
2017-03-27T21:57:04
C++
UTF-8
C++
false
false
52
h
#include <iostream> namespace stv { int F2(); }
[ "redenicht@hotmail.com" ]
redenicht@hotmail.com
d174dfca3a8221e4b01f97c8641e617a65799c41
89f230196e51888079fcf64be5c16d2ab64223dc
/preorder traversal by morris.cpp
262c11731d2d376a0cd4651699388e213adcbf35
[ "MIT" ]
permissive
sunilnarwaria/IP
cd7a883250b862899d8db519ec526a3a73c531ab
2b9d7a2513539415cc38cb9bd4c10815bcb9ad8b
refs/heads/master
2022-04-26T00:23:40.015563
2020-04-28T19:23:24
2020-04-28T19:23:24
152,292,279
0
0
null
null
null
null
UTF-8
C++
false
false
2,226
cpp
#include <bits/stdc++.h> using namespace std; class node { public: int data; node *left, *right; }; /* Helper function that allocates a new node with the given data and NULL left and right pointers. */ node* newNode(int data) { node* temp = new node(); temp->data = data; temp->left = temp->right = NULL; return temp; } // Preorder traversal without recursion and without stack void morrisTraversalPreorder(node* root) { while (root) { // If left child is null, print the current node data. Move to // right child. if (root->left == NULL) { cout<<root->data<<" "; root = root->right; } else { // Find inorder predecessor node* current = root->left; while (current->right !=NULL && current->right != root) current = current->right; // If the right child of inorder predecessor already points to // this node if (current->right == NULL) { cout<<root->data<<" "; current->right = root; root = root->left; } // If right child doesn't point to this node, then print this // node and make right child point to this node else { current->right = NULL; root = root->right; } } } } // Function for sStandard preorder traversal void preorder(node* root) { if (root) { cout<<root->data<<" "; preorder(root->left); preorder(root->right); } } /* Driver program to test above functions*/ int main() { node* root = NULL; root = newNode(1); root->left = newNode(2); root->right = newNode(3); root->left->left = newNode(4); root->left->right = newNode(5); root->right->left = newNode(6); root->right->right = newNode(7); root->left->left->left = newNode(8); root->left->left->right = newNode(9); root->left->right->left = newNode(10); root->left->right->right = newNode(11); morrisTraversalPreorder(root); cout<<endl; preorder(root); return 0; }
[ "noreply@github.com" ]
noreply@github.com
c1b85e08a495bf29fbde71afa42b09837d43ade2
407e5805f098578f22a8e24bf629a081caaa9b89
/Visual C++/CP/TheNewYearMeetingFriends.cpp
e489d00fded48e623505010bb523c77f70839372
[]
no_license
Chanchal2125/Competitive_Programming
c8d3cb4de403536a667b6c0b8a6e580086f5f9a8
f71aa263c8a00d46e859ec414979e75c16ac6897
refs/heads/main
2023-04-10T12:01:18.947089
2021-04-13T15:57:55
2021-04-13T15:57:55
306,037,651
0
0
null
null
null
null
UTF-8
C++
false
false
1,208
cpp
#include <iostream> #include <iomanip> #include <string> #include <cmath> #include <climits> #include <vector> #include <set> #include <algorithm> using namespace std; #define ll long long int #define ld long double #define mod 1000000007 #define endl "\n" #define vi vector<ll> #define vs vector<string> #define pii pair<ll, ll> #define ump unordered_map #define mp map #define pq_max priority_queue<ll> #define pq_min priority_queue<ll,vi,greater<ll> #define ff first #define ss second #define mid(l,r) (l+(r-l)/2) #define loop(i,a,b) for(int i=(a); i <=(b);i++) #define looprev(i,a,b) for(int i=(a); i >=(b);i--) #define clr(val) memset(val,0,sizeof(val)) #define what_is(x) cerr << #x << " is " << x << endl; #define OJ \ freopen("input.txt", "r", stdin); \ freopen("output.txt", "w", stdout); #define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int main() { ll a,b,c; cin>>a>>b>>c; cout<<max(a,max(b,c)) - min(a,min(b,c)); return 0; }
[ "noreply@github.com" ]
noreply@github.com
45316feac66ad301a154c3afd02118ecc9ac77a7
0f01dab3b868e94298fc54d5b449c71f435a56e3
/游戏组件/子游戏/百人红九+控制+机器人/游戏客户端/ClientControl.h
fb8f3ff036f3f0942dc288f5da93703dc01df0e9
[]
no_license
ydcrow/refFoxuc
c6284476ed530263a5ffb8f8e7d37251e393c0d2
f85601c050bb5f24883c88bbef0982b16ff952e3
refs/heads/master
2023-02-07T06:03:06.317797
2020-12-26T02:49:37
2020-12-26T02:49:37
null
0
0
null
null
null
null
GB18030
C++
false
false
802
h
#pragma once //游戏控制基类 class IClientControlDlg : public CDialog { public: IClientControlDlg(UINT UID, CWnd* pParent) : CDialog(UID, pParent){} virtual ~IClientControlDlg(void){} public: //更新控制 virtual void __cdecl OnAllowControl(bool bEnable) = NULL; //申请结果 virtual bool __cdecl ReqResult(const void * pBuffer) = NULL; //重置下注 virtual void __cdecl ResetUserBet()=NULL; //玩家下注 virtual void __cdecl SetUserBetScore(BYTE cbArea,LONGLONG lScore)=NULL; //获取昵称 virtual void __cdecl GetUserNickName(CString &strNickName)=NULL; //玩家1 virtual void __cdecl SetUserNickName(LPCTSTR szNickName)=NULL; virtual void __cdecl ResetUserNickName()=NULL; //玩家下注 virtual void __cdecl SetUserGameScore(BYTE cbArea,LONGLONG lScore)=NULL; };
[ "412824500@qq.com" ]
412824500@qq.com
8f12aaf763d61b805a48eba2bd894211793dd94f
3acaec004f82654ff6bfd7ac8b241802b34a24ca
/src/qt/forms/ui_receivecreditsdialog.h
ad94bfb48124083159a37b986e5461804bdbfffe
[ "MIT" ]
permissive
advantage-development/v8
b4495a9593c65b7c9fe23120b27c91c224a56a46
9f6184ec3d3c91d1af512b0715a15e590bf10477
refs/heads/master
2020-04-15T00:31:26.280512
2019-01-05T19:33:55
2019-01-05T19:33:55
164,243,332
0
0
null
null
null
null
UTF-8
C++
false
false
13,718
h
/******************************************************************************** ** Form generated from reading UI file 'receivecreditsdialog.ui' ** ** Created by: Qt User Interface Compiler version 5.5.1 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_RECEIVECREDITSDIALOG_H #define UI_RECEIVECREDITSDIALOG_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QCheckBox> #include <QtWidgets/QFrame> #include <QtWidgets/QGridLayout> #include <QtWidgets/QHBoxLayout> #include <QtWidgets/QHeaderView> #include <QtWidgets/QLabel> #include <QtWidgets/QLineEdit> #include <QtWidgets/QPushButton> #include <QtWidgets/QSpacerItem> #include <QtWidgets/QTableView> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> #include "bitcreditamountfield.h" QT_BEGIN_NAMESPACE class Ui_ReceiveCreditsDialog { public: QVBoxLayout *verticalLayout; QFrame *frame2; QVBoxLayout *verticalLayout_3; QGridLayout *gridLayout; QCheckBox *reuseAddress; QLabel *label_4; QLabel *label_3; QLineEdit *reqLabel; QLineEdit *reqMessage; QLabel *label_5; QLabel *label_2; QLabel *label; BitcoinAmountField *reqAmount; QHBoxLayout *horizontalLayout; QPushButton *receiveButton; QPushButton *clearButton; QSpacerItem *horizontalSpacer; QLabel *label_7; QSpacerItem *verticalSpacer_2; QFrame *frame; QVBoxLayout *verticalLayout_2; QLabel *label_6; QTableView *recentRequestsView; QHBoxLayout *horizontalLayout_2; QPushButton *showRequestButton; QPushButton *removeRequestButton; QSpacerItem *horizontalSpacer_2; void setupUi(QWidget *ReceiveCreditsDialog) { if (ReceiveCreditsDialog->objectName().isEmpty()) ReceiveCreditsDialog->setObjectName(QStringLiteral("ReceiveCreditsDialog")); ReceiveCreditsDialog->resize(776, 364); verticalLayout = new QVBoxLayout(ReceiveCreditsDialog); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); frame2 = new QFrame(ReceiveCreditsDialog); frame2->setObjectName(QStringLiteral("frame2")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(frame2->sizePolicy().hasHeightForWidth()); frame2->setSizePolicy(sizePolicy); frame2->setFrameShape(QFrame::StyledPanel); frame2->setFrameShadow(QFrame::Sunken); verticalLayout_3 = new QVBoxLayout(frame2); verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3")); gridLayout = new QGridLayout(); gridLayout->setObjectName(QStringLiteral("gridLayout")); reuseAddress = new QCheckBox(frame2); reuseAddress->setObjectName(QStringLiteral("reuseAddress")); gridLayout->addWidget(reuseAddress, 7, 2, 1, 1); label_4 = new QLabel(frame2); label_4->setObjectName(QStringLiteral("label_4")); gridLayout->addWidget(label_4, 7, 0, 1, 1); label_3 = new QLabel(frame2); label_3->setObjectName(QStringLiteral("label_3")); label_3->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); gridLayout->addWidget(label_3, 6, 0, 1, 1); reqLabel = new QLineEdit(frame2); reqLabel->setObjectName(QStringLiteral("reqLabel")); gridLayout->addWidget(reqLabel, 4, 2, 1, 1); reqMessage = new QLineEdit(frame2); reqMessage->setObjectName(QStringLiteral("reqMessage")); gridLayout->addWidget(reqMessage, 6, 2, 1, 1); label_5 = new QLabel(frame2); label_5->setObjectName(QStringLiteral("label_5")); gridLayout->addWidget(label_5, 2, 2, 1, 1); label_2 = new QLabel(frame2); label_2->setObjectName(QStringLiteral("label_2")); label_2->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); gridLayout->addWidget(label_2, 4, 0, 1, 1); label = new QLabel(frame2); label->setObjectName(QStringLiteral("label")); label->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter); gridLayout->addWidget(label, 5, 0, 1, 1); reqAmount = new BitcoinAmountField(frame2); reqAmount->setObjectName(QStringLiteral("reqAmount")); reqAmount->setMinimumSize(QSize(80, 0)); gridLayout->addWidget(reqAmount, 5, 2, 1, 1); horizontalLayout = new QHBoxLayout(); horizontalLayout->setObjectName(QStringLiteral("horizontalLayout")); receiveButton = new QPushButton(frame2); receiveButton->setObjectName(QStringLiteral("receiveButton")); receiveButton->setMinimumSize(QSize(150, 0)); QIcon icon; icon.addFile(QStringLiteral(":/icons/receiving_addresses"), QSize(), QIcon::Normal, QIcon::Off); receiveButton->setIcon(icon); horizontalLayout->addWidget(receiveButton); clearButton = new QPushButton(frame2); clearButton->setObjectName(QStringLiteral("clearButton")); QSizePolicy sizePolicy1(QSizePolicy::Minimum, QSizePolicy::Fixed); sizePolicy1.setHorizontalStretch(0); sizePolicy1.setVerticalStretch(0); sizePolicy1.setHeightForWidth(clearButton->sizePolicy().hasHeightForWidth()); clearButton->setSizePolicy(sizePolicy1); QIcon icon1; icon1.addFile(QStringLiteral(":/icons/remove"), QSize(), QIcon::Normal, QIcon::Off); clearButton->setIcon(icon1); clearButton->setAutoDefault(false); horizontalLayout->addWidget(clearButton); horizontalSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); gridLayout->addLayout(horizontalLayout, 8, 2, 1, 1); label_7 = new QLabel(frame2); label_7->setObjectName(QStringLiteral("label_7")); gridLayout->addWidget(label_7, 8, 0, 1, 1); verticalLayout_3->addLayout(gridLayout); verticalLayout->addWidget(frame2); verticalSpacer_2 = new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Expanding); verticalLayout->addItem(verticalSpacer_2); frame = new QFrame(ReceiveCreditsDialog); frame->setObjectName(QStringLiteral("frame")); sizePolicy.setHeightForWidth(frame->sizePolicy().hasHeightForWidth()); frame->setSizePolicy(sizePolicy); frame->setFrameShape(QFrame::StyledPanel); frame->setFrameShadow(QFrame::Raised); verticalLayout_2 = new QVBoxLayout(frame); verticalLayout_2->setObjectName(QStringLiteral("verticalLayout_2")); label_6 = new QLabel(frame); label_6->setObjectName(QStringLiteral("label_6")); QFont font; font.setBold(true); font.setWeight(75); label_6->setFont(font); verticalLayout_2->addWidget(label_6); recentRequestsView = new QTableView(frame); recentRequestsView->setObjectName(QStringLiteral("recentRequestsView")); QPalette palette; QBrush brush(QColor(51, 51, 51, 255)); brush.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Active, QPalette::Text, brush); palette.setBrush(QPalette::Inactive, QPalette::Text, brush); QBrush brush1(QColor(85, 85, 85, 255)); brush1.setStyle(Qt::SolidPattern); palette.setBrush(QPalette::Disabled, QPalette::Text, brush1); recentRequestsView->setPalette(palette); recentRequestsView->setContextMenuPolicy(Qt::CustomContextMenu); recentRequestsView->setTabKeyNavigation(false); recentRequestsView->setSortingEnabled(true); verticalLayout_2->addWidget(recentRequestsView); horizontalLayout_2 = new QHBoxLayout(); horizontalLayout_2->setObjectName(QStringLiteral("horizontalLayout_2")); showRequestButton = new QPushButton(frame); showRequestButton->setObjectName(QStringLiteral("showRequestButton")); showRequestButton->setEnabled(false); QIcon icon2; icon2.addFile(QStringLiteral(":/icons/edit"), QSize(), QIcon::Normal, QIcon::Off); showRequestButton->setIcon(icon2); showRequestButton->setAutoDefault(false); horizontalLayout_2->addWidget(showRequestButton); removeRequestButton = new QPushButton(frame); removeRequestButton->setObjectName(QStringLiteral("removeRequestButton")); removeRequestButton->setEnabled(false); removeRequestButton->setIcon(icon1); removeRequestButton->setAutoDefault(false); horizontalLayout_2->addWidget(removeRequestButton); horizontalSpacer_2 = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout_2->addItem(horizontalSpacer_2); verticalLayout_2->addLayout(horizontalLayout_2); verticalLayout->addWidget(frame); verticalLayout->setStretch(2, 1); #ifndef QT_NO_SHORTCUT label_3->setBuddy(reqMessage); label_2->setBuddy(reqLabel); label->setBuddy(reqAmount); #endif // QT_NO_SHORTCUT QWidget::setTabOrder(reqLabel, reqAmount); QWidget::setTabOrder(reqAmount, reqMessage); QWidget::setTabOrder(reqMessage, reuseAddress); QWidget::setTabOrder(reuseAddress, receiveButton); QWidget::setTabOrder(receiveButton, clearButton); QWidget::setTabOrder(clearButton, recentRequestsView); QWidget::setTabOrder(recentRequestsView, showRequestButton); QWidget::setTabOrder(showRequestButton, removeRequestButton); retranslateUi(ReceiveCreditsDialog); QMetaObject::connectSlotsByName(ReceiveCreditsDialog); } // setupUi void retranslateUi(QWidget *ReceiveCreditsDialog) { #ifndef QT_NO_TOOLTIP reuseAddress->setToolTip(QApplication::translate("ReceiveCreditsDialog", "Reuse one of the previously used receiving addresses.<br>Reusing addresses has security and privacy issues.<br>Do not use this unless re-generating a payment request made before.", 0)); #endif // QT_NO_TOOLTIP reuseAddress->setText(QApplication::translate("ReceiveCreditsDialog", "R&euse an existing receiving address (not recommended)", 0)); label_4->setText(QString()); #ifndef QT_NO_TOOLTIP label_3->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the AdvantageCoin network.", 0)); #endif // QT_NO_TOOLTIP label_3->setText(QApplication::translate("ReceiveCreditsDialog", "&Message:", 0)); #ifndef QT_NO_TOOLTIP reqLabel->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional label to associate with the new receiving address.", 0)); #endif // QT_NO_TOOLTIP #ifndef QT_NO_TOOLTIP reqMessage->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional message to attach to the payment request, which will be displayed when the request is opened.<br>Note: The message will not be sent with the payment over the AdvantageCoin network.", 0)); #endif // QT_NO_TOOLTIP label_5->setText(QApplication::translate("ReceiveCreditsDialog", "Use this form to request payments. All fields are <b>optional</b>.", 0)); #ifndef QT_NO_TOOLTIP label_2->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional label to associate with the new receiving address.", 0)); #endif // QT_NO_TOOLTIP label_2->setText(QApplication::translate("ReceiveCreditsDialog", "&Label:", 0)); #ifndef QT_NO_TOOLTIP label->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional amount to request. Leave this empty or zero to not request a specific amount.", 0)); #endif // QT_NO_TOOLTIP label->setText(QApplication::translate("ReceiveCreditsDialog", "&Amount:", 0)); #ifndef QT_NO_TOOLTIP reqAmount->setToolTip(QApplication::translate("ReceiveCreditsDialog", "An optional amount to request. Leave this empty or zero to not request a specific amount.", 0)); #endif // QT_NO_TOOLTIP receiveButton->setText(QApplication::translate("ReceiveCreditsDialog", "&Request payment", 0)); #ifndef QT_NO_TOOLTIP clearButton->setToolTip(QApplication::translate("ReceiveCreditsDialog", "Clear all fields of the form.", 0)); #endif // QT_NO_TOOLTIP clearButton->setText(QApplication::translate("ReceiveCreditsDialog", "Clear", 0)); label_7->setText(QString()); label_6->setText(QApplication::translate("ReceiveCreditsDialog", "Requested payments history", 0)); #ifndef QT_NO_TOOLTIP showRequestButton->setToolTip(QApplication::translate("ReceiveCreditsDialog", "Show the selected request (does the same as double clicking an entry)", 0)); #endif // QT_NO_TOOLTIP showRequestButton->setText(QApplication::translate("ReceiveCreditsDialog", "Show", 0)); #ifndef QT_NO_TOOLTIP removeRequestButton->setToolTip(QApplication::translate("ReceiveCreditsDialog", "Remove the selected entries from the list", 0)); #endif // QT_NO_TOOLTIP removeRequestButton->setText(QApplication::translate("ReceiveCreditsDialog", "Remove", 0)); Q_UNUSED(ReceiveCreditsDialog); } // retranslateUi }; namespace Ui { class ReceiveCreditsDialog: public Ui_ReceiveCreditsDialog {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_RECEIVECREDITSDIALOG_H
[ "you@example.com" ]
you@example.com
c9bdfad5eabe8b028e0f40c312a6286d2ebd8c36
d60923c8cb453dfe70d185962827ccdbf73c8307
/InstDataBin.cpp
bfdb1474e7966c3acc69566fe856227f1add24c3
[]
no_license
ilms49898723/Computer_Architecture_Project_2
4af6e1f0539817b31c71995eeefc4d1883ee506f
7a7ca6ca3ebbd38e4802eeb501abf0a909aff219
refs/heads/master
2020-12-24T18:50:45.880155
2016-05-12T13:12:36
2016-05-12T13:12:36
56,253,637
0
0
null
null
null
null
UTF-8
C++
false
false
2,406
cpp
/* * InstDataBin.cpp * * Created on: 2016/03/13 * Author: LittleBird */ #include "InstDataBin.h" namespace lb { InstDataBin::InstDataBin() { this->instType = InstType::UNDEF; this->opCode = 0u; this->rs = 0u; this->rt = 0u; this->rd = 0u; this->c = 0u; this->funct = 0u; this->inst = 0u; this->regRead.clear(); this->regWrite.clear(); } InstDataBin::~InstDataBin() { } InstType InstDataBin::getInstType() const { return instType; } unsigned InstDataBin::getOpCode() const { return opCode; } unsigned InstDataBin::getRs() const { return rs; } unsigned InstDataBin::getRt() const { return rt; } unsigned InstDataBin::getRd() const { return rd; } unsigned InstDataBin::getC() const { return c; } unsigned InstDataBin::getFunct() const { return funct; } unsigned InstDataBin::getInst() const { return inst; } std::string InstDataBin::getInstName() const { return instName; } const std::vector<InstElement>& InstDataBin::getRegRead() const { return regRead; } const std::vector<InstElement>& InstDataBin::getRegWrite() const { return regWrite; } void InstDataBin::setInstType(const InstType& val) { instType = val; } void InstDataBin::setOpCode(const unsigned& val) { opCode = val; } void InstDataBin::setRs(const unsigned& val) { rs = val; } void InstDataBin::setRt(const unsigned& val) { rt = val; } void InstDataBin::setRd(const unsigned& val) { rd = val; } void InstDataBin::setC(const unsigned& val) { c = val; } void InstDataBin::setFunct(const unsigned& val) { funct = val; } void InstDataBin::setInst(const unsigned& val) { inst = val; } void InstDataBin::setInstName(const unsigned& val) { if (instType == InstType::UNDEF) { instName = ""; } else if (instType == InstType::R) { if (inst == 0u) { instName = "NOP"; } else if (rt == 0u && rd == 0u && c == 0u && funct == 0u) { instName = "NOP"; } else { instName = toUpperString(InstLookUp::functLookUp(val)); } } else { instName = toUpperString(InstLookUp::opCodeLookUp(val)); } } void InstDataBin::setRegRead(const InstElement& reg) { regRead.push_back(reg); } void InstDataBin::setRegWrite(const InstElement& reg) { regWrite.push_back(reg); } } /* namespace lb */
[ "ilms49898723@gmail.com" ]
ilms49898723@gmail.com
7c4a09e35b2d82eca4f83f3e0a94d9d5db3d6a2c
3e4897c4cd49b2f59af7e6f28378a1632bde661f
/source/01_ThisPointer/02_N_Member.cpp
d1fa46de59c01b32058e3ad412eedcffc677f05d
[]
no_license
aeuveritas/DesignPatternInAdvancedCpp
71b42ed7468ffa9a43bd031cec5cf9f61d6bb00b
a021b59c1f009a096243b8c604ca2ebb14b70b04
refs/heads/master
2021-09-12T14:23:20.806477
2018-04-17T15:08:31
2018-04-17T15:08:31
103,024,232
1
0
null
null
null
null
UTF-8
C++
false
false
138
cpp
// 02_N_Member.cpp void Point_set(Point* this, int a, int b) { this->x = a; this->y = b; return; } // Compile: Not available
[ "aeuveritas@gmail.com" ]
aeuveritas@gmail.com
e39ec9b55ae75a520c9db744a948d19d4c27a18d
2f49e6f93a99523636f14f399d784f682adfd142
/Sources/VCNNodes/SoundEmitterEventComponent.h
9a66ebcfd1981f810b62385774b68b97e6bd04c5
[]
no_license
overflowsc/inf4715
26a1e1850b0fda13a19c1562c73d56ee5f26bcde
d9dc62793dfa58f3bb7b146033e4084a8ecc4bc7
refs/heads/master
2021-01-18T07:43:49.197883
2015-02-08T08:55:53
2015-02-08T08:55:53
30,485,685
0
0
null
2015-02-08T08:45:44
2015-02-08T08:45:43
null
UTF-8
C++
false
false
2,966
h
#pragma once // DO NOT DECLARE MORE CODE REGIONS. USE THE ONES ALREADY IN THE FILE #include "VCNLua\LuaTrigger.h" #include "SoundEmitterComponent.h" //**CodeRegion //**EndCodeRegion class VCNSoundEmitterEventComponent : public VCNSoundEmitterComponent { public: VCNSoundEmitterEventComponent(); virtual void Initialise(const Parameters& params) override; virtual void Update(VCNFloat dt) override; virtual bool SetAttribute( const VCNString& attributeName, const VCNString& attributeValue ); virtual VCNIComponent::Ptr Copy() const; inline const VCNString& GetEventName() const { return mEventName; } inline void SetEventName(const VCNString& val) { mEventName = val; } protected: VCNString mEventName; //**CodeRegion VCNUInt mGameObjectID; public: virtual void Play(); //**EndCodeRegion }; template class VCNComponentBase<VCNSoundEmitterEventComponent>;
[ "mathieumg@gmail.com" ]
mathieumg@gmail.com
5b55e9ce6edea0464bdb4fa0ab7f1cd96d17be59
fdd9766dcdec92c61e4c17404d4d8955901fc809
/td/telegram/PhotoSizeSource.cpp
e7b57908d9f2f653b86869ec7f8ba7e2bd5b66cc
[ "JSON", "BSL-1.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
ngockhanh14/td
dde451ef1d067dc75696a8dfb8967be8f678c1c0
33c689aacc78ef5a68973552b968a3bb68cdd7c6
refs/heads/master
2023-08-26T00:43:55.597087
2021-11-10T00:45:13
2021-11-10T16:21:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
10,246
cpp
// // Copyright Aliaksei Levin (levlam@telegram.org), Arseny Smirnov (arseny30@gmail.com) 2014-2021 // // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // #include "td/telegram/PhotoSizeSource.h" #include "td/telegram/ChannelId.h" #include "td/telegram/ChatId.h" #include "td/telegram/UserId.h" #include "td/utils/common.h" #include "td/utils/Slice.h" #include "td/utils/SliceBuilder.h" #include "td/utils/StackAllocator.h" #include "td/utils/tl_helpers.h" #include "td/utils/tl_storers.h" namespace td { tl_object_ptr<telegram_api::InputPeer> PhotoSizeSource::DialogPhoto::get_input_peer() const { switch (dialog_id.get_type()) { case DialogType::User: { UserId user_id = dialog_id.get_user_id(); return make_tl_object<telegram_api::inputPeerUser>(user_id.get(), dialog_access_hash); } case DialogType::Chat: { ChatId chat_id = dialog_id.get_chat_id(); return make_tl_object<telegram_api::inputPeerChat>(chat_id.get()); } case DialogType::Channel: { ChannelId channel_id = dialog_id.get_channel_id(); return make_tl_object<telegram_api::inputPeerChannel>(channel_id.get(), dialog_access_hash); } case DialogType::SecretChat: return nullptr; case DialogType::None: return make_tl_object<telegram_api::inputPeerEmpty>(); default: UNREACHABLE(); return nullptr; } } FileType PhotoSizeSource::get_file_type() const { switch (get_type()) { case Type::Thumbnail: return thumbnail().file_type; case Type::DialogPhotoSmall: case Type::DialogPhotoBig: case Type::DialogPhotoSmallLegacy: case Type::DialogPhotoBigLegacy: return FileType::ProfilePhoto; case Type::StickerSetThumbnail: case Type::StickerSetThumbnailLegacy: case Type::StickerSetThumbnailVersion: return FileType::Thumbnail; case Type::Legacy: case Type::FullLegacy: default: UNREACHABLE(); return FileType::Thumbnail; } } string PhotoSizeSource::get_unique() const { auto ptr = StackAllocator::alloc(16); MutableSlice data = ptr.as_slice(); TlStorerUnsafe storer(data.ubegin()); switch (get_type()) { case Type::Legacy: UNREACHABLE(); break; case Type::Thumbnail: { auto type = thumbnail().thumbnail_type; CHECK(0 <= type && type <= 127); if (type == 'a') { type = 0; } else if (type == 'c') { type = 1; } else { type += 5; } return string(1, static_cast<char>(type)); } case Type::DialogPhotoSmall: // it doesn't matter to which Dialog the photo belongs return string(1, '\x00'); case Type::DialogPhotoBig: // it doesn't matter to which Dialog the photo belongs return string(1, '\x01'); case Type::StickerSetThumbnail: UNREACHABLE(); break; case Type::FullLegacy: { auto &legacy = full_legacy(); td::store(legacy.volume_id, storer); td::store(legacy.local_id, storer); break; } case Type::DialogPhotoSmallLegacy: case Type::DialogPhotoBigLegacy: { auto &legacy = dialog_photo_legacy(); td::store(legacy.volume_id, storer); td::store(legacy.local_id, storer); break; } case Type::StickerSetThumbnailLegacy: { auto &legacy = sticker_set_thumbnail_legacy(); td::store(legacy.volume_id, storer); td::store(legacy.local_id, storer); break; } case Type::StickerSetThumbnailVersion: { auto &thumbnail = sticker_set_thumbnail_version(); storer.store_slice(Slice("\x02")); td::store(thumbnail.sticker_set_id, storer); td::store(thumbnail.version, storer); break; } default: UNREACHABLE(); break; } auto size = storer.get_buf() - data.ubegin(); CHECK(size <= 13); return string(data.begin(), size); } string PhotoSizeSource::get_unique_name(int64 photo_id) const { switch (get_type()) { case Type::Thumbnail: CHECK(0 <= thumbnail().thumbnail_type && thumbnail().thumbnail_type <= 127); return PSTRING() << photo_id << '_' << thumbnail().thumbnail_type; case Type::DialogPhotoSmall: return to_string(photo_id); case Type::DialogPhotoBig: return PSTRING() << photo_id << '_' << 1; case Type::StickerSetThumbnailVersion: return PSTRING() << sticker_set_thumbnail_version().sticker_set_id << '_' << static_cast<uint32>(sticker_set_thumbnail_version().version); case Type::Legacy: case Type::StickerSetThumbnail: case Type::FullLegacy: case Type::DialogPhotoSmallLegacy: case Type::DialogPhotoBigLegacy: case Type::StickerSetThumbnailLegacy: default: UNREACHABLE(); break; } return string(); } static bool operator==(const PhotoSizeSource::Legacy &lhs, const PhotoSizeSource::Legacy &rhs) { UNREACHABLE(); return false; } static bool operator==(const PhotoSizeSource::Thumbnail &lhs, const PhotoSizeSource::Thumbnail &rhs) { return lhs.file_type == rhs.file_type && lhs.thumbnail_type == rhs.thumbnail_type; } static bool operator==(const PhotoSizeSource::DialogPhoto &lhs, const PhotoSizeSource::DialogPhoto &rhs) { return lhs.dialog_id == rhs.dialog_id && lhs.dialog_access_hash == rhs.dialog_access_hash; } static bool operator==(const PhotoSizeSource::DialogPhotoSmall &lhs, const PhotoSizeSource::DialogPhotoSmall &rhs) { return static_cast<const PhotoSizeSource::DialogPhoto &>(lhs) == static_cast<const PhotoSizeSource::DialogPhoto &>(rhs); } static bool operator==(const PhotoSizeSource::DialogPhotoBig &lhs, const PhotoSizeSource::DialogPhotoBig &rhs) { return static_cast<const PhotoSizeSource::DialogPhoto &>(lhs) == static_cast<const PhotoSizeSource::DialogPhoto &>(rhs); } static bool operator==(const PhotoSizeSource::StickerSetThumbnail &lhs, const PhotoSizeSource::StickerSetThumbnail &rhs) { return lhs.sticker_set_id == rhs.sticker_set_id && lhs.sticker_set_access_hash == rhs.sticker_set_access_hash; } static bool operator==(const PhotoSizeSource::FullLegacy &lhs, const PhotoSizeSource::FullLegacy &rhs) { return lhs.volume_id == rhs.volume_id && lhs.local_id == rhs.local_id && lhs.secret == rhs.secret; } static bool operator==(const PhotoSizeSource::DialogPhotoLegacy &lhs, const PhotoSizeSource::DialogPhotoLegacy &rhs) { return static_cast<const PhotoSizeSource::DialogPhoto &>(lhs) == static_cast<const PhotoSizeSource::DialogPhoto &>(rhs) && lhs.volume_id == rhs.volume_id && lhs.local_id == rhs.local_id; } static bool operator==(const PhotoSizeSource::DialogPhotoSmallLegacy &lhs, const PhotoSizeSource::DialogPhotoSmallLegacy &rhs) { return static_cast<const PhotoSizeSource::DialogPhotoLegacy &>(lhs) == static_cast<const PhotoSizeSource::DialogPhotoLegacy &>(rhs); } static bool operator==(const PhotoSizeSource::DialogPhotoBigLegacy &lhs, const PhotoSizeSource::DialogPhotoBigLegacy &rhs) { return static_cast<const PhotoSizeSource::DialogPhotoLegacy &>(lhs) == static_cast<const PhotoSizeSource::DialogPhotoLegacy &>(rhs); } static bool operator==(const PhotoSizeSource::StickerSetThumbnailLegacy &lhs, const PhotoSizeSource::StickerSetThumbnailLegacy &rhs) { return static_cast<const PhotoSizeSource::StickerSetThumbnail &>(lhs) == static_cast<const PhotoSizeSource::StickerSetThumbnail &>(rhs) && lhs.volume_id == rhs.volume_id && lhs.local_id == rhs.local_id; } static bool operator==(const PhotoSizeSource::StickerSetThumbnailVersion &lhs, const PhotoSizeSource::StickerSetThumbnailVersion &rhs) { return static_cast<const PhotoSizeSource::StickerSetThumbnail &>(lhs) == static_cast<const PhotoSizeSource::StickerSetThumbnail &>(rhs) && lhs.version == rhs.version; } bool operator==(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) { return lhs.variant_ == rhs.variant_; } bool operator!=(const PhotoSizeSource &lhs, const PhotoSizeSource &rhs) { return !(lhs == rhs); } StringBuilder &operator<<(StringBuilder &string_builder, const PhotoSizeSource &source) { switch (source.get_type()) { case PhotoSizeSource::Type::Legacy: return string_builder << "PhotoSizeSourceLegacy[]"; case PhotoSizeSource::Type::Thumbnail: return string_builder << "PhotoSizeSourceThumbnail[" << source.thumbnail().file_type << ", type = " << source.thumbnail().thumbnail_type << ']'; case PhotoSizeSource::Type::DialogPhotoSmall: return string_builder << "PhotoSizeSourceChatPhotoSmall[" << source.dialog_photo().dialog_id << ']'; case PhotoSizeSource::Type::DialogPhotoBig: return string_builder << "PhotoSizeSourceChatPhotoBig[" << source.dialog_photo().dialog_id << ']'; case PhotoSizeSource::Type::StickerSetThumbnail: return string_builder << "PhotoSizeSourceStickerSetThumbnail[" << source.sticker_set_thumbnail().sticker_set_id << ']'; case PhotoSizeSource::Type::FullLegacy: return string_builder << "PhotoSizeSourceFullLegacy[]"; case PhotoSizeSource::Type::DialogPhotoSmallLegacy: return string_builder << "PhotoSizeSourceChatPhotoSmallLegacy[" << source.dialog_photo().dialog_id << ']'; case PhotoSizeSource::Type::DialogPhotoBigLegacy: return string_builder << "PhotoSizeSourceChatPhotoBigLegacy[" << source.dialog_photo().dialog_id << ']'; case PhotoSizeSource::Type::StickerSetThumbnailLegacy: return string_builder << "PhotoSizeSourceStickerSetThumbnailLegacy[" << source.sticker_set_thumbnail().sticker_set_id << ']'; case PhotoSizeSource::Type::StickerSetThumbnailVersion: return string_builder << "PhotoSizeSourceStickerSetThumbnailVersion[" << source.sticker_set_thumbnail().sticker_set_id << '_' << source.sticker_set_thumbnail_version().version << ']'; default: UNREACHABLE(); return string_builder; } } } // namespace td
[ "levlam@telegram.org" ]
levlam@telegram.org
d55a97f44d0e6f2e6db8a27b77725cada4c33ae1
db32eda52724cac441aa456950876e9cfc60e7a9
/sample.cpp
645d15dd7fd8dc06dce7ea611f91815febf238c7
[]
no_license
AsuraKyoko/Capstone
12dbfdd051e6565f0f0f85fc3529f83dd58daf33
4a9721885fa19a006a9990ddbb3dbb9e2a0da325
refs/heads/master
2016-09-01T10:18:38.764014
2016-02-04T18:29:59
2016-02-04T18:29:59
51,096,193
0
0
null
null
null
null
UTF-8
C++
false
false
767
cpp
// // sample.cpp // // // Created by Peter Tuerk on 3/3/15. // // #include "sample.h" void MyApp::init() { //always runs first printf("Steve ran the init function"); } void MyApp::destroy() { //only runs on 'safe shutdown' printf("Steve ran the destroy function"); } void MyApp::run() { printf("Steve ran the run function"); while(!shouldQuit()) { } } void MyApp::message(GMessage *msg) { printf("App Recieved [%i]\n", (short)msg->getBuffer()[0]); /* switch (*(short *)&msg->getBuffer()[0]) { case GMT_PONG: //display interface { } case GMT_PICKLIST: //which button was pressed { if(WON) { shouldQuit = true; } } } */ }
[ "steve.m.mahar@gmail.com" ]
steve.m.mahar@gmail.com
1702b87101439d9e8158b9dbb86c477430c2deac
383f192adfda1b50a9f084b56944d4aed5a0341b
/Render/Headers/localProbeWindow.h
08af59dfd048b24015c09bbfeea768765caf540f
[]
no_license
CarlBlacklock/VISTAVolumeRendering
fa74c3ed052ac8f3a093e09b9fb28d9af5bdbdf8
6d2b9a831f54d0221d8e4ee014fa7fd01206ea08
refs/heads/master
2021-10-23T08:47:08.333536
2019-03-15T19:35:09
2019-03-15T19:35:09
94,271,835
0
0
null
null
null
null
UTF-8
C++
false
false
933
h
#pragma once #include "..\Headers\Render.h" #include "..\Headers\probeFilteredHistogram.h" #include <thread> #include "..\Headers\CompileShaders.h" class localProbeWindow { public: localProbeWindow(int numberOfSubdivisions, unsigned char* volumeData, int xResolution, int yResolution, int numberOfFiles, const char* title, glm::ivec3 initialFocus); bool closedStatus(); void forceClose(); void updateSubdivisions(int newSubdivisions); void changeFocus(glm::ivec3 newFocus); ~localProbeWindow(); void framebufferCallback(GLFWwindow *histogramWindow, int width, int height); private: glm::ivec3 focus; probeFilteredHistogram myHistogram; bool closed; bool shouldClose; GLFWwindow* glfwWindow; int screenWidth, screenHeight; bool focusChanged; int xRes, yRes, zRes; int numOfSubdivisions; unsigned char *dataLocation; std::thread internalThread; void run(const char * title); GLuint HistogramCalculationProgram; };
[ "carl.alex.blacklock@gmail.com" ]
carl.alex.blacklock@gmail.com
3e636f20adbf9766862f8a3679c8d64f3d2fc6bf
3ec2d34339f1510735f7bd3e8069059573f083f2
/sources/headquarters.cpp
890898d2055927aefbfd15a7c3d2be5fca58641d
[]
no_license
Mandras/OpenOS
c33e67159e89fcf3ebb7d32d427b67e7e4be7350
4548cdba6858c9f5c2e1d0a1510ee48dcfbd8ce7
refs/heads/master
2021-01-22T06:49:22.744018
2014-03-11T09:55:54
2014-03-11T09:55:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,473
cpp
/*# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # OpenOS # # GPL license - opensource project # # Developed by One Solution Network # # # # File: headquarters.cpp # # # # Utilities: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # This file is part of OpenOS Project. # # # # OpenOS is free software: you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation, either version 3 of the License, or # # (at your option) any later version. # # # # OpenOS is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with OpenOS. If not, see <http://www.gnu.org/licenses/> # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #*/ #include "../headers/OpenOS.hpp" #include <unistd.h> #include <stdlib.h> #include <string.h> #include <iostream> using namespace std; /*# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Default values for openOS options # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #*/ string OPENOS_USER = DEFAULT_USER; time_t OPENOS_DELAY = DEFAULT_DELAY; bool OPENOS_COLOR = false; /*# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #*/ Headquarters::Headquarters() : SessionFile("/etc/openOS/.session"), ConfigFile("/etc/openOS/openOS.ini"), LogsFile("/var/log/openOS") { /*string SocketMessage;*/ string HostIP = "127.0.0.1"; this->loadOptions(); this->printWelcomeMessage(); //this->addLogs(SYSTEM_START, SYSTEM); this->printMessage(SYSTEM_START, SYSTEM); this->ReadConfigFile(); this->DecryptSessionFile(); this->setSessionTitle(PROGNAME); this->HostIP = new char[HostIP.size() + 1]; this->HostIP[HostIP.size()] = '\0'; memcpy(this->HostIP, HostIP.c_str(), HostIP.size()); //this->printAllConfig(); string tab[] = { "user", _NULL_ }; this->checkRequireConfigLine(tab); /*SocketMessage = "GET /?test=1 \n\n"; this->HostIP = new char[HostIP.size() + 1]; this->HostIP[HostIP.size()] = '\0'; memcpy(this->HostIP, HostIP.c_str(), HostIP.size()); this->SocketMessage = new char[SocketMessage.size() + 1]; this->SocketMessage[SocketMessage.size()] = '\0'; memcpy(this->SocketMessage, SocketMessage.c_str(), SocketMessage.size()); this->SocketMessageSize = SocketMessage.size(); this->HostPort = 80; this->printSession(); */ } Headquarters::~Headquarters() { this->EncryptSessionFile(); this->addLogs(SYSTEM_END, SYSTEM); this->printMessage(SYSTEM_END, SYSTEM); } char *Headquarters::getSocketMessage() {return (this->SocketMessage);} string Headquarters::getSocketAnswer() {return (this->SocketAnswer);} string Headquarters::getHostIP() {return (this->HostIP);} int Headquarters::getHostPort() {return (this->HostPort);} void Headquarters::setSocketMessage(char *SocketMessage) {this->SocketMessage = SocketMessage;} void Headquarters::setHostIP(char *HostIP) {this->HostIP = HostIP;} void Headquarters::setHostPort(int HostPort) {this->HostPort = HostPort;} void Headquarters::setSocketAnswer(string SocketAnswer) {this->SocketAnswer = SocketAnswer;}
[ "romain.benoit99@gmail.com" ]
romain.benoit99@gmail.com
26309455969bafc97e650824cd444ccc0699f61b
a0529fc87f26b8e40f424ef4969620b1a97d0590
/src/syncAgent/modules/clique.cpp
4faf83ff2a8ffd4cc1f797cd8287b413e6d5ab89
[]
no_license
kleopatra999/sleepSyncAgent
0aa5691749ff7a295ce9f3305188bd1e60a1cf5d
52e8c5ce60b1ced2a342633246f193958aae07f5
refs/heads/master
2021-01-11T20:07:05.103137
2017-01-06T10:15:18
2017-01-06T10:15:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,274
cpp
#include <cassert> #include "../../config.h" #include "clique.h" #include "../globals.h" // fishPolicy #include "../policy/dropoutMonitor.h" //#include "../policy/masterXmitSyncPolicy.h" #include "../policy/adaptiveXmitSyncPolicy.h" namespace { // attributes of clique SystemID masterID; // collaborators DropoutMonitor dropoutMonitor; // Choices here: Adaptive or Master //static MasterXmitSyncPolicy masterXmitSyncPolicy; AdaptiveXmitSyncPolicy masterXmitSyncPolicy; } // namespace // Schedule is public Schedule Clique::schedule; /* * Init is called only after a hw, power on reset POR */ void Clique::init(){ log("Clique init\n"); setSelfMastership(); dropoutMonitor.reset(); masterXmitSyncPolicy.reset(); schedule.startFreshAfterHWReset(); // assert clock is running and first period started but no tasks scheduled // assert dropoutMonitor is initialized // assert xmitPolicy is initialized assert(isSelfMaster()); } SystemID Clique::getMasterID() { return masterID; } void Clique::setSelfMastership() { log("set self mastership\n"); masterID = myID(); } /* * In this design MasterSync from master and WorkSync msg from slave * both carry the MasterID of the clique master. * We might be the master, and so otherID (from WorkSync slave could already be the clique master.) * * In an alternative design (Work is separate and not piggybacked on Sync) * then you can make the assertion: * assert(otherID != myID()); // we can't hear our own sync */ void Clique::setOtherMastership(SystemID otherID) { log("set other master\n"); masterID = otherID; } bool Clique::isSelfMaster() { return masterID == myID(); } /* * Only master xmits FROM its sync slot. * And then with policy of randomness for collision avoidance. */ bool Clique::shouldXmitSync() { return isSelfMaster() && masterXmitSyncPolicy.shouldXmitSync(); } /* * Is msg from member of my clique? * * Formerly, only the Master sent MasterSync. * Now, a Slave member of my clique may send a WorkSync, still identifying the Master i.e. clique * * (When a MergeSync, might be from a recent member of my clique, now a member of identified clique.) * */ bool Clique::isMsgFromMyClique(SystemID otherMasterID){ return masterID == otherMasterID; } /* * All units use same comparison. The direction is arbitrary. * For testing, it may help to swap it. * No need for equality, no unit can hear itself. * my > other means: clique/unit with least numerical ID is better clique */ bool Clique::isOtherCliqueBetter(SystemID otherMasterID){ #ifdef LEAST_ID_IS_BETTER_CLIQUE return masterID > otherMasterID; #else return masterID < otherMasterID; #endif } void Clique::heardSync() { // relevant to role Slave dropoutMonitor.heardSync(); /* * Relevant to role Master. * Master can hear a WorkSync from Slaves. * Assume all other clique members heard it too. * Minor optimization: Master that heard WorkSync from Slave does not need to send sync again soon. * Avoids contention. */ if (isSelfMaster()) masterXmitSyncPolicy.disarmForOneCycle(); } void Clique::checkMasterDroppedOut() { if (dropoutMonitor.isDropout()) { // assert dropoutMonitor is reset log(" MASTER DROP OUT\n"); onMasterDropout(); } } void Clique::onMasterDropout() { /* * Self unit has not heard sync from any member for a long time. * Brute force: assume mastership. * Other Slaves might do this and engender contention (many Masters.) */ // FUTURE: history of masters, self assume mastership only if was most recent master, thus avoiding contention. setSelfMastership(); // !!! changes role: self will start xmitting sync masterXmitSyncPolicy.reset(); /* * !!! Schedule is NOT changed. We may be able to recover by fishing nearby. */ /* * Change fishing policy. * This might help recover a Master who didn't permanently drop out: * - busy or insufficient power temporarily * - drifted too much */ fishPolicy.reset(); } /* * An update, not necessarily a change. Not assert result data different from current data. * The MasterID may be the same as current. * The offset may be zero. */ void Clique::updateBySyncMessage(SyncMessage* msg) { // assert (in Sync or Fish slot) assert(msg->carriesSync(msg->type)); /* * !!! Update. Not assert that msg.MasterID != self.masterID: * a WorkSync from a Slave carries MasterID of clique which could match my MasterID when self is Master */ setOtherMastership(msg->masterID); // Not assert master changed /* * Self has heard another unit, retard policy. * (The sync message may have same MasterID as self's clique, but msg is definitely from another unit.) * If self unit not master, won't be xmitting sync now, * but if self unit ever assumes mastership, * policy will then be in advanced stage. */ masterXmitSyncPolicy.advanceStage(); // FUTURE clique.historyOfMasters.update(msg); // Change schedule. // Regardless: from my master (small offset) or from another clique (large offset) schedule.adjustBySyncMsg(msg); } #ifdef NOT_USED void Clique::initFromSyncMsg(SyncMessage* msg){ assert(msg->type == Sync); // require assert(msg->masterID != myID()); // invariant: we can't hear our own sync masterID = msg->masterID; } #endif
[ "bootch@nc.rr.com" ]
bootch@nc.rr.com
b229c959a980623fac93142fd9cd4e1370efe2b7
0f3f1aa4a27eee8a58900a16ec7fd83a5c701b7c
/While.cpp
c3cc4216b1839bfa7a1f0f47446427d78514bb3e
[]
no_license
Tigana12/Tigana
87576f284950b1a0acdd37f782a18039e1f0a1c3
da569127c59b49e7a1ef48fbc24eb02a5a03507a
refs/heads/master
2016-09-13T20:21:20.162142
2016-04-22T14:57:26
2016-04-22T14:57:26
56,747,321
0
0
null
null
null
null
UTF-8
C++
false
false
141
cpp
#include <iostream> using namespace std; int main() { int x = 0; while(x < 10) x = x + 1; cout << "x is " << x << "\n"; return 0; }
[ "tiganaoch@gmail.com" ]
tiganaoch@gmail.com
169d0f691b39bda2367920f532f48a75cefad3e2
c29e9d984244dc7d1addaaa8c1fe061c743e3dbd
/cpp code/Topic/逻辑题/PAT A1128.cpp
87661d02fcb728006e5b82c040fd669b0fd06515
[]
no_license
KaihongGo/PAT
b596519a74ff9e5ce508b95fe05070a551896fa1
3b9d80681694aedf33e7f355cb684576156811c4
refs/heads/master
2023-01-09T07:56:18.829829
2020-11-02T13:05:39
2020-11-02T13:05:39
304,880,027
1
0
null
null
null
null
IBM855
C++
false
false
603
cpp
//PAT A1128.cpp 1128 N Queens Puzzle (20 ио) // #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> using namespace std; int queen[10010]; int main() { int k, n; cin >> k; for (int i = 0; i < k; i++) { cin >> n; for (int i = 1; i <= n; i++) cin >> queen[i]; bool flag = true; for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { if (abs(queen[i] - queen[j]) == abs(i - j)) flag = false; if (queen[i] == queen[j]) flag = false; } } if (flag == false) printf("NO\n"); else printf("YES\n"); } return 0; }
[ "34575284+KaihongGo@users.noreply.github.com" ]
34575284+KaihongGo@users.noreply.github.com
2b5aee0af551b003525092b6b304374c131ac03d
cfe299b7173e8f3a86079aeba289c05441a7cc44
/logic/src/utils/exception/matrixcalculatorexception.cpp
fc68f4a62757cd50c06d32b2c8d6434a392343c7
[]
no_license
usual-one/3DObjectVisualizer
bf93f6f5bd2b6e9ed273699faf6b59fb8e4081ad
19350b75460db88e000b93e4f176d26fba01ba21
refs/heads/master
2022-11-05T22:37:45.437723
2020-06-21T21:11:42
2020-06-21T21:11:42
266,381,714
0
0
null
null
null
null
UTF-8
C++
false
false
357
cpp
#include "logic/include/utils/exception/matrixcalculatorexception.h" MatrixCalculatorException::MatrixCalculatorException() { msg_ = "MatrixCalculatorException"; } MatrixCalculatorException::MatrixCalculatorException(const std::string &msg) { msg_ = msg; } const char *MatrixCalculatorException::what() const noexcept { return msg_.data(); }
[ "kostarev.a.p@yandex.ru" ]
kostarev.a.p@yandex.ru
59de209be994713166feeb0a5bef923be2b54095
5fe1a2ee18212252aab3efdbd105ea27b71250c9
/Documentos/ProyectoFinal/CC1036647091/ProyectoFinal/kicked.h
c3dc859e1b939112cc199faa95211c8e7bc943e5
[]
no_license
tritio1995/CursoFCII_UdeA_2021_1
aa7ee5aec00fd16d24b6c30bdab1848996f3d5e6
1a31d3e9c1adfd176766a08e8869402563722fae
refs/heads/main
2023-08-11T20:06:37.025214
2021-09-30T02:44:27
2021-09-30T02:44:27
343,785,653
0
0
null
2021-03-02T13:34:17
2021-03-02T13:34:17
null
UTF-8
C++
false
false
398
h
#include <iostream> #include <cmath> #include <iomanip> #include <cstdio> using namespace std; // Creamos una clase class Kicked{ private: // Se definen variables globales double k; double h; public: // Creamos los prototipos de funciones Kicked(double,double); //Constructor void Solution(); //funciones del sistema dinamico double xp(double,double); double yp(double,double); };
[ "lucas.quiceno@udea.edu.co" ]
lucas.quiceno@udea.edu.co
2f7053cbd1973186252ae2a472b63f1849ff308f
3089d8d972a4ba5fd12393b70ecaf585276c243a
/Tank/Src/Weapon.h
ce68f18fb9b2be39fe5483471c9fb5d8c271ebfa
[]
no_license
HD131/testxo
213bfa6ac361a1129a23cd2ff67f77315c05203f
38a6b06b7fc44b802dae4b86a36c4254a189006b
refs/heads/master
2021-01-01T16:05:21.789442
2014-10-07T19:45:34
2014-10-07T19:45:34
41,935,305
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
1,624
h
#pragma once #include "Mesh.h" #include "Init.h" #include "Sound.h" enum Weapon { M16, AK47, MaxWeapon }; std::string const WeaponNames[] = { "M16", "AK47" }; class CWeapon { private: unsigned int m_AmountBullet; // общее количество пуль unsigned int m_ChargerBullet; // сколько в обойме unsigned int m_MaxChargerBullet; // максимально сколько в обойме unsigned int m_Damage; // урон от пули DWORD m_RateOfFire; // время между пулями в милисекундах DWORD m_LastTimeFire; Weapon m_NameWeapon; CMesh3D m_Mesh; bool m_Fire; D3DXMATRIX m_MatrixWorld; IDirect3DDevice9* m_pD3DDevice; CSound m_Sound; //CameraDevice m_Camera; public: CWeapon( std::string NameWeapon, IDirect3DDevice9* pD3DDevice ); char* ReadIniFile( const char *filename, const char *section, const char *key ); Weapon GetWeaponType() { return m_NameWeapon; }; void SetEndFire(); void Fire(); bool GetFire() { return m_Fire; }; void Recharge(); // перезарядка void RenderWeapon( CameraDevice const& Camera, CCShader const& Shader ); int GetChargerBullet() { return m_ChargerBullet; }; int GetAmountBullet() { return m_AmountBullet; }; bool Hit( HWND hwnd, ID3DXMesh* pMesh, CameraDevice const& Camera, D3DXVECTOR3& Point, const CSphere& sphera ); ~CWeapon(); RECT Size; };
[ "belovgarik@mail.ru" ]
belovgarik@mail.ru
3d7a8646b69f483d0a0c9c466787c01d076240b4
949f146539896f1e214a0ec6766bece677b62b05
/plugins/samplesource/testsource/testsourcegui.h
7bc29d4a5d29ddafd6672a4771e559d98cff7426
[]
no_license
mmilleror/sdrangel
9a0d695e32243943c807fafdba286e905073eb08
0edf1d20e26de8ead3a991dc6310d4874c7d99fc
refs/heads/master
2020-05-02T16:31:22.475945
2019-03-25T06:44:58
2019-03-25T14:30:33
178,071,150
1
0
null
2019-03-27T20:39:13
2019-03-27T20:39:12
null
UTF-8
C++
false
false
4,016
h
/////////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2018 Edouard Griffiths, F4EXB // // // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // // the Free Software Foundation as version 3 of the License, or // // // // This program is distributed in the hope that it will be useful, // // but WITHOUT ANY WARRANTY; without even the implied warranty of // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // GNU General Public License V3 for more details. // // // // You should have received a copy of the GNU General Public License // // along with this program. If not, see <http://www.gnu.org/licenses/>. // /////////////////////////////////////////////////////////////////////////////////// #ifndef _TESTSOURCE_TESTSOURCEGUI_H_ #define _TESTSOURCE_TESTSOURCEGUI_H_ #include <plugin/plugininstancegui.h> #include <QTimer> #include <QWidget> #include "util/messagequeue.h" #include "testsourcesettings.h" #include "testsourceinput.h" class DeviceUISet; namespace Ui { class TestSourceGui; } class TestSourceGui : public QWidget, public PluginInstanceGUI { Q_OBJECT public: explicit TestSourceGui(DeviceUISet *deviceUISet, QWidget* parent = 0); virtual ~TestSourceGui(); virtual void destroy(); void setName(const QString& name); QString getName() const; void resetToDefaults(); virtual qint64 getCenterFrequency() const; virtual void setCenterFrequency(qint64 centerFrequency); QByteArray serialize() const; bool deserialize(const QByteArray& data); virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } virtual bool handleMessage(const Message& message); private: Ui::TestSourceGui* ui; DeviceUISet* m_deviceUISet; TestSourceSettings m_settings; QTimer m_updateTimer; QTimer m_statusTimer; bool m_doApplySettings; bool m_forceSettings; DeviceSampleSource* m_sampleSource; std::size_t m_tickCount; int m_deviceSampleRate; quint64 m_deviceCenterFrequency; //!< Center frequency in device int m_lastEngineState; MessageQueue m_inputMessageQueue; void blockApplySettings(bool block) { m_doApplySettings = !block; } void displaySettings(); void sendSettings(); void updateSampleRateAndFrequency(); void displayAmplitude(); void updateAmpCoarseLimit(); void updateAmpFineLimit(); void updateFrequencyShiftLimit(); private slots: void handleInputMessages(); void on_startStop_toggled(bool checked); void on_centerFrequency_changed(quint64 value); void on_autoCorr_currentIndexChanged(int index); void on_frequencyShift_changed(qint64 value); void on_decimation_currentIndexChanged(int index); void on_fcPos_currentIndexChanged(int index); void on_sampleRate_changed(quint64 value); void on_sampleSize_currentIndexChanged(int index); void on_amplitudeCoarse_valueChanged(int value); void on_amplitudeFine_valueChanged(int value); void on_modulation_currentIndexChanged(int index); void on_modulationFrequency_valueChanged(int value); void on_amModulation_valueChanged(int value); void on_fmDeviation_valueChanged(int value); void on_dcBias_valueChanged(int value); void on_iBias_valueChanged(int value); void on_qBias_valueChanged(int value); void on_phaseImbalance_valueChanged(int value); void on_record_toggled(bool checked); void openDeviceSettingsDialog(const QPoint& p); void updateStatus(); void updateHardware(); }; #endif // _TESTSOURCE_TESTSOURCEGUI_H_
[ "f4exb06@gmail.com" ]
f4exb06@gmail.com
9bddb820dddb5327977bdbf806aee71488f45506
9473d9f686932d144c207c44f9b21c7b9631ecf2
/4/4.x/q4/q4.cpp
01ca74ae9b201adb4617c342e3245f8b106a87a0
[]
no_license
YuanzheSu/learnCPP
8f9f33a7435257586babc2f373ddeb9977522814
665414ebd3acf46cfee49f35cbf4e588ad73c8d5
refs/heads/master
2022-12-28T16:52:13.656353
2020-09-23T04:14:18
2020-09-23T04:14:18
288,565,713
0
0
null
null
null
null
UTF-8
C++
false
false
1,408
cpp
// q4.cpp : This file contains the 'main' function. Program execution begins and ends there. // #include "constant.h" #include <iostream> void checkAndPrint(const int t, const double d) { double x{}; x = d - 0.5 * constants::g * t * t; if (x > 0) std::cout << "At " << t << " seconds, the ball is at height: " << x << " meters\n"; else std::cout << "At " << t << " seconds, the ball is on the ground.\n"; } double getHeight() { std::cout << "Enter the height of the tower in meters: "; double x{}; std::cin >> x; return x; } int main() { double x{ getHeight() }; checkAndPrint(0, x); checkAndPrint(1, x); checkAndPrint(2, x); checkAndPrint(3, x); checkAndPrint(4, x); checkAndPrint(5, x); } // Run program: Ctrl + F5 or Debug > Start Without Debugging menu // Debug program: F5 or Debug > Start Debugging menu // Tips for Getting Started: // 1. Use the Solution Explorer window to add/manage files // 2. Use the Team Explorer window to connect to source control // 3. Use the Output window to see build output and other messages // 4. Use the Error List window to view errors // 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project // 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
[ "52230751+YuanzheSu@users.noreply.github.com" ]
52230751+YuanzheSu@users.noreply.github.com
6d5e342a92da4ae373da004b5966f926ca70a04f
d535628ff82846b3fafc52fd39775d3c10e11faf
/tests/main.cpp
37e0e335a93db6c501f9428ef04e8bf13f9f9d88
[]
no_license
augustjd/Kangaroo
07121da9a3a4836194377ebfd3a09a8fbb447f80
7249284f090d63b6d33868dc15e44a413c84d013
refs/heads/master
2020-04-27T15:19:57.417669
2014-12-29T02:48:51
2014-12-29T02:48:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
415
cpp
#include <gtest/gtest.h> #include "RayTests.hpp" #include "SphereTests.hpp" #include "SamplerTests.hpp" #include "SampleTests.hpp" #include "TriangleTests.hpp" #include "SquarePixelSamplingStrategyTests.hpp" #include "RenderLoaderTests.hpp" #include "ThreadUtils.hpp" #include <iostream> using namespace std; int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); }
[ "augustinspring@gmail.com" ]
augustinspring@gmail.com
fe120e7c62e99d7f79960a6963a1716131ad9bce
1f71da0c0ac2485ea42bae7c8df7174d8c1d5817
/un_used/Склад/Sklad_Form.h
eec93836f93bf86fda220cf16771f42bb233d4ef
[]
no_license
firef0xff/YZPM_KTPP
203f3ec13f98392d170a188824d405474e5f0c9d
6af3fe0201004726396dc88c1e4d99c64ce7f794
refs/heads/master
2021-01-18T23:40:51.197481
2014-05-12T19:12:23
2014-05-12T19:12:23
35,734,659
0
0
null
null
null
null
UTF-8
C++
false
false
2,642
h
//--------------------------------------------------------------------------- #ifndef Sklad_FormH #define Sklad_FormH //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include <ComCtrls.hpp> #include <ExtCtrls.hpp> #include <Grids.hpp> #include <Buttons.hpp> //--------------------------------------------------------------------------- class TSklad : public TForm { __published: // IDE-managed Components TPageControl *PageControl1; TTabSheet *TabSheet1; TTabSheet *TabSheet2; TPanel *View_Kont; TPanel *Panel2; TPanel *Panel3; TPanel *Panel4; TSplitter *Splitter1; TPanel *Panel7; TPanel *Panel5; TPanel *View_Zagr; TPanel *Panel8; TPanel *Panel9; TTabSheet *TabSheet3; TPanel *Panel11; TPanel *Panel12; TPanel *Panel13; TPanel *Panel15; TPanel *Panel18; TPanel *Panel19; TStringGrid *potr_materials; TStringGrid *Mater_detail; TPanel *Panel20; TSplitter *Splitter2; TPageControl *materials_lists; TTabSheet *TabSheet4; TTabSheet *TabSheet5; TTabSheet *TabSheet6; TTreeView *TreeView1; TPanel *Panel14; TGroupBox *GroupBox3; TSpeedButton *Snext; TSpeedButton *Sprev; TLabeledEdit *SE2; TLabeledEdit *SE3; TPanel *Panel17; TLabel *Label3; TEdit *E1; TButton *StartSearch; TRadioGroup *SearchParams; TPageControl *PageControl2; TTabSheet *TabSheet7; TTabSheet *TabSheet8; TSplitter *Splitter3; TStringGrid *Std_izd; TStringGrid *Vspom_materials; TStringGrid *Materials; TTabSheet *TabSheet9; TStringGrid *Change_materials; TSpeedButton *SpeedButton1; TButton *Button1; TLabel *Free_percent; TLabel *Label2; TLabel *Use_percent; TLabel *Label5; TPanel *Panel16; TPanel *Panel21; TImage *R_Graph; TStringGrid *StringGrid1; TComboBox *Sort_Params; TLabel *Label1; TLabel *Label4; TEdit *Edit1; TComboBox *Find_params; TStringGrid *StringGrid2; TImage *Image1; TLabel *Label6; void __fastcall PanelEnter(TObject *Sender); void __fastcall PanelExit(TObject *Sender); void __fastcall PanelMouseEnter(TObject *Sender); void __fastcall R_GraphClick(TObject *Sender); void __fastcall Panel7Click(TObject *Sender); private: // User declarations void expand_pannel_h(TPanel *Panel,bool exp); public: // User declarations __fastcall TSklad(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TSklad *Sklad; //--------------------------------------------------------------------------- #endif
[ "chistov.m.a@gmail.com" ]
chistov.m.a@gmail.com
5130e41815e6aef4ceba5971b97a6ae66a6d273f
c90a5d1eac4095026efdf5c9a23cc2174e10f1b7
/sdl_wrapper/src/sdl2_wrapper/sdl.h
d2795ddbded3d7feefc375c743b783fa8a2c1700
[]
no_license
boutboutnico/sdl
4a2932a92f5789aaffe600752ce54275e7f0081d
bd83fdf3d53431880cd14696f4a051e7ef3e2245
refs/heads/master
2021-01-15T23:36:41.287985
2014-08-15T15:35:23
2014-08-15T15:35:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,190
h
/// /// \file sdl.h /// \brief /// \date 11 juin 2014 /// \author nboutin /// #ifndef SDL_H_ #define SDL_H_ /// === INCLUDES ================================================================================ #include <SDL2/SDL.h> #include <sdl_exception.h> /// === NAMESPACE ================================================================================ /// \namespace sdl namespace sdl { /// === ENUMERATIONS ============================================================================ enum class EInit { TIMER = SDL_INIT_TIMER, AUDIO = SDL_INIT_AUDIO, VIDEO = SDL_INIT_VIDEO, JOYSTICK = SDL_INIT_JOYSTICK, HAPTIC = SDL_INIT_HAPTIC, GAMECONTROLLER = SDL_INIT_GAMECONTROLLER, EVENTS = SDL_INIT_EVENTS, NOPARACHUTE = SDL_INIT_NOPARACHUTE, EVERYTHING = SDL_INIT_EVERYTHING, }; enum class EInit_Lib { SDL_TTF = 0 }; enum class EBlendMode { NONE = SDL_BLENDMODE_NONE, BLEND = SDL_BLENDMODE_BLEND, ADD = SDL_BLENDMODE_ADD, MOD = SDL_BLENDMODE_MOD, }; /// === CLASS ==================================================================================== /// \class /// \brief /// \date 11 juin 2014 /// \author nboutin class SDL { public: /// === PUBLIC DECLARATIONS ==================================================================== SDL(EInit flags) throw (SDL_Exception); SDL(EInit flags, EInit_Lib flags_lib) throw (SDL_Exception); virtual ~SDL(); void quitSubSystem(EInit flags); private: /// === PRIVATE DECLARATIONS ================================================================ /// === PRIVATE ATTRIBUTS ==================================================================== }; inline EInit operator|(const EInit &a, const EInit &b) { // EInit tmp = static_cast<EInit>((uint32_t) a | (uint32_t) b); // return tmp; return static_cast<EInit>((uint32_t) a | (uint32_t) b); // return static_cast<EInit>(a | b); // return (uint32_t)a | (uint32_t)b; } /// === INLINE DEFINITIONS ======================================================================== } #endif /// SDL_H_ /// === END OF FILE ================================================================================
[ "boutwork@gmail.com" ]
boutwork@gmail.com
18b7b76d7fd4fe7d25fa4562edf2ddb93d4b7801
36a2d88f33f52cbb5e1500705351767f3a07ccb0
/main.cpp
b9a815e6de09461f19f67f58b1b99b17383cdc30
[]
no_license
VietRise/StructureAlgorithmC-
70783411ce3b9d8a93a3b0fc8847c2c4177d981f
ba4fe00d10da532b4fa0e2fa900fb28aa8690cb2
refs/heads/master
2020-04-25T05:00:55.694165
2019-02-25T15:13:12
2019-02-25T15:13:12
172,529,090
0
0
null
null
null
null
UTF-8
C++
false
false
8,190
cpp
/******************************************************************************* ******************** VIET RISE'S ALGORITHM IMPLEMENTAIONS ********************* * * /\ | _ _ ._ o _|_ |_ ._ _ _ * /--\ | (_| (_) | | |_ | | | | | _> * _| * * ******************************************************************************/ #ifndef ALGO_SHUFFLE_H__ #define ALGO_SHUFFLE_H__ #include <stdio.h> #include <stdlib.h> #include <time.h> #include <iostream> #include <string> #include <map> #include "LinkedList.h" #include "Stack.h" #include "Queue.h" #include "BinaryTree.h" #include "Graph.h" #include "SortSearchAlgorithm.h" using namespace std; namespace alg { /** * shuffle the 'list' of length 'len' */ template<typename T> static void shuffle(T * list, int len) { srand(time(NULL)); int i = len, j; T temp; if ( i == 0 ) return; while ( --i ) { j = rand() % (i+1); temp = list[i]; list[i] = list[j]; list[j] = temp; } } } namespace codeinterview { /* 1.5 Replace all space in string with %20 */ static void replaceFun(char* str, int length) { int countSpace = 0, newLength = 0; for (int i = 0; i < length; i++) { if(str[i] == ' ') { countSpace++; } } newLength = length + countSpace * 2; str[newLength] = '\0'; int indexNewLength = newLength - 1; for(int i = length - 1; i >= 0; i--) { if(str[i] == ' ') { str[indexNewLength] = '0'; str[indexNewLength - 1] = '2'; str[indexNewLength - 2] = '%'; indexNewLength -= 3; } else { str[indexNewLength] = str[i]; indexNewLength--; } } } /* 1.6 Rotate matrix NxN 90 */ static void rotateMatrix(int** matrix, int n) { for (int layer = 0; layer < n/2; layer++) { int first = layer; int last = n - 1 - layer; for(int i = first; i < last; i++) { int offset = i - first; int top = matrix[first][i]; // Left -> Top matrix[first][i] = matrix[last - offset][first]; // Bottom -> Left matrix[last - offset][first] = matrix[last][last - offset]; // Right -> Bottom matrix[last][last - offset] = matrix[i][last]; // Top -> Right matrix[i][last] = top; } } } /* 1.7 In the matrix MxN, set entire row & colum to 0 if an element at this [row, column] equal 0 */ static void setZeros(int** matrix, int m, int n) { int row[m], colum[n]; for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { if(matrix[i][j] == 0) { row[i] = 1; colum[j] = 1; } } } for(int i = 0; i < m; i++) { for(int j = 0; j < n; j++) { if(row[i] == 1 || colum[j] == 1) { matrix[i][j] = 0; } } } } /* 1.8 */ static bool isStringRotation(std::string s1, std::string s2) { int len = s1.length(); if(len == s2.length() && len > 0) { s1.append(s1); // return isSubString(s1, s2); return true; } return false; } static bool isStringRotation1(std::string s1, std::string s2) { if (s1.length() != s2.length() || s1.length() == 0) return false; int length = s1.length(); bool hit[length]; for(int i = 0; i < length; i++) { if(s2[i] == s1[0]) hit[i] = true; } for(int i = 0; i < length; i++) { if(hit[i]) { bool rotation = true; for(int j = 0; j < length; j++) { if(s1[j] != s2[(j + i)%length]) { rotation = false; break; } } if (rotation) return true; } } return false; } /* 2.1 */ static void removeDupLinkedList(LinkedList* list) { std::map<int, bool> mapData; NodeList *prev, *cur; prev = nullptr; cur = list->pHead; while(cur != nullptr) { if(mapData.find(cur->data) != mapData.end()) { NodeList* temp = cur; prev->next = cur->next; cur = cur->next; delete temp; } else { mapData[cur->data] = true; prev = cur; cur = cur->next; } } } static void removeDupLinkedListNoBuffer(LinkedList* list) { NodeList *prev, *cur, *itor; prev = list->pHead; cur = list->pHead->next; while(cur != nullptr) { itor = list->pHead; while(itor != cur) { if(cur->data == itor->data) { NodeList* temp = cur; prev->next = cur->next; cur = cur->next; delete temp; break; } itor = itor->next; } if(itor == cur) { prev = cur; cur = cur->next; } } } /* 2.2 */ static LinkedList* nthToLastLinkedList(LinkedList* list, int n) { NodeList *p1, *p2; p1 = list->pHead; p2 = list->pHead; int count = 0; while(p2 != nullptr) { count++; if (count == n) break; p2 = p2->next; } if(count == n) { while(p2->next) { p1 = p1->next; p2 = p2->next; } } LinkedList* result = new LinkedList(); result->pHead = p1; result->pTail = p2; return result; } /* 2.3 */ static void deletedMiddleNodeOfLinkedList(LinkedList* list) { int length = list->length(); int middlePos = length/2; list->deletePosition(middlePos); } /* 2.4 */ static NodeList* findingBeginCircularLinkedList(LinkedList* list) { NodeList *cur, *itor; cur = list->pHead->next; while(cur) { itor = list->pHead; while(itor != cur) { if(cur->next == itor) { return itor; } itor = itor->next; } cur = cur->next; } return nullptr; } /* 3.6 Sort stack in ascending order */ static Stack* sortAscendingOrderStack(Stack* s) { Stack* r = new Stack(); while(!s->isEmpty()) { StackNode* temp = s->pop(); while(!r->isEmpty() && temp->data < r->peek()->data) { s->push(r->pop()->data); } r->push(temp->data); } return r; } } int main() { // LinkedList /* LinkedList* list = new LinkedList(); list->addNode(1); list->addNode(2); list->addNode(3); list->addNode(4); list->addNode(5); list->addNode(6); list->addNode(7); list->addNode(8); list->addNode(9); list->display(); codeinterview::deletedMiddleNodeOfLinkedList(list); list->display(); */ // Stack & Queue /* Stack* stack = new Stack(); stack->push(2); stack->push(4); stack->push(1); stack->push(3); stack->push(5); stack->display(); Stack* result = codeinterview::sortAscendingOrderStack(stack); result->display(); */ // Tree & Graph /* BinaryTree* binaryTree = new BinaryTree(); binaryTree->insert(25); binaryTree->insert(15); binaryTree->insert(50); binaryTree->insert(10); binaryTree->insert(22); binaryTree->insert(4); binaryTree->insert(12); binaryTree->insert(18); binaryTree->insert(24); binaryTree->insert(35); binaryTree->insert(70); binaryTree->insert(31); binaryTree->insert(44); binaryTree->insert(66); binaryTree->insert(90); binaryTree->inOderPrintf(); binaryTree->preOderPrintf(); binaryTree->postOderPrintf(); binaryTree->levelOderPrintf(); bool isBalance = binaryTree->isBalance(); cout << (isBalance ? "Balanced Tree" : "Unbalanced Tree") << endl; Graph* graphUndirected = Graph::createGraph(5); graphUndirected->addEdgeUnDirect(0, 1); graphUndirected->addEdgeUnDirect(0, 4); graphUndirected->addEdgeUnDirect(1, 2); graphUndirected->addEdgeUnDirect(1, 3); graphUndirected->addEdgeUnDirect(1, 4); graphUndirected->addEdgeUnDirect(2, 3); graphUndirected->addEdgeUnDirect(3, 4); graphUndirected->printfGraph(); Graph* graphDirected = Graph::createGraph(5); graphDirected->addEdgeDirect(0, 1); graphDirected->addEdgeDirect(0, 4); graphDirected->addEdgeDirect(1, 2); graphDirected->addEdgeDirect(1, 3); graphDirected->addEdgeDirect(1, 4); graphDirected->addEdgeDirect(2, 3); graphDirected->addEdgeDirect(3, 4); graphDirected->printfGraph(); graphDirected->dfs(1, 4); graphDirected->bfs(1, 4); graphDirected->dfs(2, 0); graphDirected->bfs(2, 0); int max = 0b1111; cout << "max = " << max << endl; */ // Sort & Search int array[10] = {20, 3, 50, 45, 22, 78, 26, 8, 79, 10}; // SortSearchAlgorithm::bubbleSort(array, 10); // SortSearchAlgorithm::selectionSort(array, 10); // SortSearchAlgorithm::mergeSort(array, 0, 9); SortSearchAlgorithm::quickSort(array, 0, 9); for(int i = 0; i < 10; i++) cout << array[i] << " "; cout << endl; return 0; } #endif
[ "vietrise@gmail.com" ]
vietrise@gmail.com
475ff82eb6f0c5ae6c62fc77c8740bb8e18faf43
729ed630d494aa1a9fec1202e24f5f91928ba62b
/EzCad3_VS2015/MyDocManager.h
3019e8f1d6940f0bfc54d7ab40075eb940a4c8d1
[]
no_license
lQLI/EzCad3_VS2015
ff8bb6a188d0d8279b9c30f2f07611c4d5391d00
67c80ef32d5da4988691dd578fdfa563749fbd65
refs/heads/master
2022-02-25T10:56:12.005977
2018-11-21T07:34:53
2018-11-21T07:34:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
275
h
#ifndef _MyDocManager_h #define _MyDocManager_h class CMyDocManager : public CDocManager { DECLARE_DYNAMIC(CMyDocManager) public: virtual BOOL DoPromptFileName(CString& fileName, UINT nIDSTitle,DWORD lFlags, BOOL bOpenFileDialog, CDocTemplate* pTemplate); }; #endif
[ "250192563@qq.com" ]
250192563@qq.com
325c6418f680e4dcd50617bbd9756a5d392e358e
e6cd51943f682a006da8b1245e6585e453334687
/Classes/Native/AssemblyU2DCSharp_DeviceAttributes_U3CisDistribute1781697211.h
daefceda106da90b94294f4d171b72239493467c
[]
no_license
JasonRy/Seer_0.9.1
a7495d385a6c5bcec6040ce061410d9eea4d09eb
f727a9442015b2dc03fc19d2fa68dc88ca8bfac0
refs/heads/master
2021-07-23T06:23:40.432032
2017-11-03T07:57:23
2017-11-03T08:53:35
109,366,091
0
0
null
null
null
null
UTF-8
C++
false
false
2,117
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> // System.Object struct Il2CppObject; #include "mscorlib_System_Object4170816371.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // DeviceAttributes/<isDistributedFunction>c__IteratorE struct U3CisDistributedFunctionU3Ec__IteratorE_t1781697211 : public Il2CppObject { public: // System.Int32 DeviceAttributes/<isDistributedFunction>c__IteratorE::<i>__0 int32_t ___U3CiU3E__0_0; // System.Int32 DeviceAttributes/<isDistributedFunction>c__IteratorE::$PC int32_t ___U24PC_1; // System.Object DeviceAttributes/<isDistributedFunction>c__IteratorE::$current Il2CppObject * ___U24current_2; public: inline static int32_t get_offset_of_U3CiU3E__0_0() { return static_cast<int32_t>(offsetof(U3CisDistributedFunctionU3Ec__IteratorE_t1781697211, ___U3CiU3E__0_0)); } inline int32_t get_U3CiU3E__0_0() const { return ___U3CiU3E__0_0; } inline int32_t* get_address_of_U3CiU3E__0_0() { return &___U3CiU3E__0_0; } inline void set_U3CiU3E__0_0(int32_t value) { ___U3CiU3E__0_0 = value; } inline static int32_t get_offset_of_U24PC_1() { return static_cast<int32_t>(offsetof(U3CisDistributedFunctionU3Ec__IteratorE_t1781697211, ___U24PC_1)); } inline int32_t get_U24PC_1() const { return ___U24PC_1; } inline int32_t* get_address_of_U24PC_1() { return &___U24PC_1; } inline void set_U24PC_1(int32_t value) { ___U24PC_1 = value; } inline static int32_t get_offset_of_U24current_2() { return static_cast<int32_t>(offsetof(U3CisDistributedFunctionU3Ec__IteratorE_t1781697211, ___U24current_2)); } inline Il2CppObject * get_U24current_2() const { return ___U24current_2; } inline Il2CppObject ** get_address_of_U24current_2() { return &___U24current_2; } inline void set_U24current_2(Il2CppObject * value) { ___U24current_2 = value; Il2CppCodeGenWriteBarrier(&___U24current_2, value); } }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "renxiaoyi@me.com" ]
renxiaoyi@me.com
c6d1cc067e84a384c16030ca3d5f0f7c4edb4de1
6bbfa9fbc745d66221288102c50511b9820efb0c
/src/activemasternode.cpp
ab5f2ceab665a59cde9d5a15bd4fd9a916cd2d43
[ "MIT" ]
permissive
mhannigan/numuscore
52b0c3f1e7c14d37f0ba9bcca50e5d5f4dc99212
dd3bd860590895ed77b6ef2e1c2c505903f0c6c3
refs/heads/master
2020-03-10T20:26:33.293695
2018-04-15T02:39:06
2018-04-15T02:39:06
129,570,628
0
0
MIT
2018-04-15T02:35:13
2018-04-15T02:35:13
null
UTF-8
C++
false
false
18,703
cpp
// Copyright (c) 2009-2012 The Darkcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "protocol.h" #include "activemasternode.h" #include "masternodeman.h" #include <boost/lexical_cast.hpp> #include "clientversion.h" // // Bootup the masternode, look for a 5000 NMS input and register on the network // void CActiveMasternode::ManageStatus() { std::string errorMessage; if (fDebug) LogPrintf("CActiveMasternode::ManageStatus() - Begin\n"); if(!fMasterNode) return; //need correct adjusted time to send ping bool fIsInitialDownload = IsInitialBlockDownload(); if(fIsInitialDownload) { status = MASTERNODE_SYNC_IN_PROCESS; LogPrintf("CActiveMasternode::ManageStatus() - Sync in progress. Must wait until sync is complete to start masternode.\n"); return; } if(status == MASTERNODE_INPUT_TOO_NEW || status == MASTERNODE_NOT_CAPABLE || status == MASTERNODE_SYNC_IN_PROCESS){ status = MASTERNODE_NOT_PROCESSED; } if(status == MASTERNODE_NOT_PROCESSED) { if(strMasterNodeAddr.empty()) { if(!GetLocal(service)) { notCapableReason = "Can't detect external address. Please use the masternodeaddr configuration option."; status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } } else { service = CService(strMasterNodeAddr, true); } LogPrintf("CActiveMasternode::ManageStatus() - Checking inbound connection to '%s'\n", service.ToString().c_str()); if(!ConnectNode((CAddress)service, service.ToString().c_str())){ notCapableReason = "Could not connect to " + service.ToString(); status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } if(pwalletMain->IsLocked()){ notCapableReason = "Wallet is locked."; status = MASTERNODE_NOT_CAPABLE; LogPrintf("CActiveMasternode::ManageStatus() - not capable: %s\n", notCapableReason.c_str()); return; } // Set defaults status = MASTERNODE_NOT_CAPABLE; notCapableReason = "Unknown. Check debug.log for more information.\n"; // Choose coins to use CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; if(GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress)) { if(GetInputAge(vin) < MASTERNODE_MIN_CONFIRMATIONS){ notCapableReason = "Input must have least " + boost::lexical_cast<string>(MASTERNODE_MIN_CONFIRMATIONS) + " confirmations - " + boost::lexical_cast<string>(GetInputAge(vin)) + " confirmations"; LogPrintf("CActiveMasternode::ManageStatus() - %s\n", notCapableReason.c_str()); status = MASTERNODE_INPUT_TOO_NEW; return; } LogPrintf("CActiveMasternode::ManageStatus() - Is capable master node!\n"); status = MASTERNODE_IS_CAPABLE; notCapableReason = ""; pwalletMain->LockCoin(vin.prevout); // send to all nodes CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("ActiveMasternode::Dseep() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return; } /* rewards are not supported in numus.conf */ CScript rewardAddress = CScript(); int rewardPercentage = 0; if(!Register(vin, service, keyCollateralAddress, pubKeyCollateralAddress, keyMasternode, pubKeyMasternode, rewardAddress, rewardPercentage, errorMessage)) { LogPrintf("CActiveMasternode::ManageStatus() - Error on Register: %s\n", errorMessage.c_str()); } return; } else { notCapableReason = "Could not find suitable coins!"; LogPrintf("CActiveMasternode::ManageStatus() - Could not find suitable coins!\n"); } } //send to all peers if(!Dseep(errorMessage)) { LogPrintf("CActiveMasternode::ManageStatus() - Error on Ping: %s\n", errorMessage.c_str()); } } // Send stop dseep to network for remote masternode bool CActiveMasternode::StopMasterNode(std::string strService, std::string strKeyMasternode, std::string& errorMessage) { CTxIn vin; CKey keyMasternode; CPubKey pubKeyMasternode; if(!darkSendSigner.SetKey(strKeyMasternode, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); return false; } if (GetMasterNodeVin(vin, pubKeyMasternode, keyMasternode)){ LogPrintf("MasternodeStop::VinFound: %s\n", vin.ToString()); } return StopMasterNode(vin, CService(strService, true), keyMasternode, pubKeyMasternode, errorMessage); } // Send stop dseep to network for main masternode bool CActiveMasternode::StopMasterNode(std::string& errorMessage) { if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { errorMessage = "masternode is not in a running status"; LogPrintf("CActiveMasternode::StopMasterNode() - Error: %s\n", errorMessage.c_str()); return false; } status = MASTERNODE_STOPPED; CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("Register::ManageStatus() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return false; } return StopMasterNode(vin, service, keyMasternode, pubKeyMasternode, errorMessage); } // Send stop dseep to network for any masternode bool CActiveMasternode::StopMasterNode(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string& errorMessage) { pwalletMain->UnlockCoin(vin.prevout); return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, true); } bool CActiveMasternode::Dseep(std::string& errorMessage) { if(status != MASTERNODE_IS_CAPABLE && status != MASTERNODE_REMOTELY_ENABLED) { errorMessage = "masternode is not in a running status"; LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", errorMessage.c_str()); return false; } CPubKey pubKeyMasternode; CKey keyMasternode; if(!darkSendSigner.SetKey(strMasterNodePrivKey, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("CActiveMasternode::Dseep() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return false; } return Dseep(vin, service, keyMasternode, pubKeyMasternode, errorMessage, false); } bool CActiveMasternode::Dseep(CTxIn vin, CService service, CKey keyMasternode, CPubKey pubKeyMasternode, std::string &retErrorMessage, bool stop) { std::string errorMessage; std::vector<unsigned char> vchMasterNodeSignature; std::string strMasterNodeSignMessage; int64_t masterNodeSignatureTime = GetAdjustedTime(); std::string strMessage = service.ToString() + boost::lexical_cast<std::string>(masterNodeSignatureTime) + boost::lexical_cast<std::string>(stop); if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyMasternode)) { retErrorMessage = "sign message failed: " + errorMessage; LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); return false; } if(!darkSendSigner.VerifyMessage(pubKeyMasternode, vchMasterNodeSignature, strMessage, errorMessage)) { retErrorMessage = "Verify message failed: " + errorMessage; LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); return false; } // Update Last Seen timestamp in masternode list CMasternode* pmn = mnodeman.Find(vin); if(pmn != NULL) { if(stop) mnodeman.Remove(pmn->vin); else pmn->UpdateLastSeen(); } else { // Seems like we are trying to send a ping while the masternode is not registered in the network retErrorMessage = "Darksend Masternode List doesn't include our masternode, Shutting down masternode pinging service! " + vin.ToString(); LogPrintf("CActiveMasternode::Dseep() - Error: %s\n", retErrorMessage.c_str()); status = MASTERNODE_NOT_CAPABLE; notCapableReason = retErrorMessage; return false; } //send to all peers LogPrintf("CActiveMasternode::Dseep() - RelayMasternodeEntryPing vin = %s\n", vin.ToString().c_str()); mnodeman.RelayMasternodeEntryPing(vin, vchMasterNodeSignature, masterNodeSignatureTime, stop); return true; } bool CActiveMasternode::Register(std::string strService, std::string strKeyMasternode, std::string txHash, std::string strOutputIndex, std::string strRewardAddress, std::string strRewardPercentage, std::string& errorMessage) { CTxIn vin; CPubKey pubKeyCollateralAddress; CKey keyCollateralAddress; CPubKey pubKeyMasternode; CKey keyMasternode; CScript rewardAddress = CScript(); int rewardPercentage = 0; if(!darkSendSigner.SetKey(strKeyMasternode, errorMessage, keyMasternode, pubKeyMasternode)) { LogPrintf("CActiveMasternode::Register() - Error upon calling SetKey: %s\n", errorMessage.c_str()); return false; } if(!GetMasterNodeVin(vin, pubKeyCollateralAddress, keyCollateralAddress, txHash, strOutputIndex)) { errorMessage = "could not allocate vin"; LogPrintf("CActiveMasternode::Register() - Error: %s\n", errorMessage.c_str()); return false; } CNumuscoinAddress address; if (strRewardAddress != "") { if(!address.SetString(strRewardAddress)) { LogPrintf("ActiveMasternode::Register - Invalid Reward Address\n"); return false; } rewardAddress.SetDestination(address.Get()); try { rewardPercentage = boost::lexical_cast<int>( strRewardPercentage ); } catch( boost::bad_lexical_cast const& ) { LogPrintf("ActiveMasternode::Register - Invalid Reward Percentage (Couldn't cast)\n"); return false; } if(rewardPercentage < 0 || rewardPercentage > 100) { LogPrintf("ActiveMasternode::Register - Reward Percentage Out Of Range\n"); return false; } } return Register(vin, CService(strService, true), keyCollateralAddress, pubKeyCollateralAddress, keyMasternode, pubKeyMasternode, rewardAddress, rewardPercentage, errorMessage); } bool CActiveMasternode::Register(CTxIn vin, CService service, CKey keyCollateralAddress, CPubKey pubKeyCollateralAddress, CKey keyMasternode, CPubKey pubKeyMasternode, CScript rewardAddress, int rewardPercentage, std::string &retErrorMessage) { std::string errorMessage; std::vector<unsigned char> vchMasterNodeSignature; std::string strMasterNodeSignMessage; int64_t masterNodeSignatureTime = GetAdjustedTime(); std::string vchPubKey(pubKeyCollateralAddress.begin(), pubKeyCollateralAddress.end()); std::string vchPubKey2(pubKeyMasternode.begin(), pubKeyMasternode.end()); std::string strMessage = service.ToString() + boost::lexical_cast<std::string>(masterNodeSignatureTime) + vchPubKey + vchPubKey2 + boost::lexical_cast<std::string>(PROTOCOL_VERSION) + rewardAddress.ToString() + boost::lexical_cast<std::string>(rewardPercentage); if(!darkSendSigner.SignMessage(strMessage, errorMessage, vchMasterNodeSignature, keyCollateralAddress)) { retErrorMessage = "sign message failed: " + errorMessage; LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); return false; } if(!darkSendSigner.VerifyMessage(pubKeyCollateralAddress, vchMasterNodeSignature, strMessage, errorMessage)) { retErrorMessage = "Verify message failed: " + errorMessage; LogPrintf("CActiveMasternode::Register() - Error: %s\n", retErrorMessage.c_str()); return false; } CMasternode* pmn = mnodeman.Find(vin); if(pmn == NULL) { LogPrintf("CActiveMasternode::Register() - Adding to masternode list service: %s - vin: %s\n", service.ToString().c_str(), vin.ToString().c_str()); CMasternode mn(service, vin, pubKeyCollateralAddress, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyMasternode, PROTOCOL_VERSION, rewardAddress, rewardPercentage); mn.ChangeNodeStatus(false); mn.UpdateLastSeen(masterNodeSignatureTime); mnodeman.Add(mn); } //send to all peers LogPrintf("CActiveMasternode::Register() - RelayElectionEntry vin = %s\n", vin.ToString().c_str()); mnodeman.RelayMasternodeEntry(vin, service, vchMasterNodeSignature, masterNodeSignatureTime, pubKeyCollateralAddress, pubKeyMasternode, -1, -1, masterNodeSignatureTime, PROTOCOL_VERSION, rewardAddress, rewardPercentage); return true; } bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey) { return GetMasterNodeVin(vin, pubkey, secretKey, "", ""); } bool CActiveMasternode::GetMasterNodeVin(CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex) { CScript pubScript; // Find possible candidates vector<COutput> possibleCoins = SelectCoinsMasternode(); COutput *selectedOutput; // Find the vin if(!strTxHash.empty()) { // Let's find it uint256 txHash(strTxHash); int outputIndex = boost::lexical_cast<int>(strOutputIndex); bool found = false; BOOST_FOREACH(COutput& out, possibleCoins) { if(out.tx->GetHash() == txHash && out.i == outputIndex) { selectedOutput = &out; found = true; break; } } if(!found) { LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate valid vin\n"); return false; } } else { // No output specified, Select the first one if(possibleCoins.size() > 0) { selectedOutput = &possibleCoins[0]; } else { LogPrintf("CActiveMasternode::GetMasterNodeVin - Could not locate specified vin from possible list\n"); return false; } } // At this point we have a selected output, retrieve the associated info return GetVinFromOutput(*selectedOutput, vin, pubkey, secretKey); } bool CActiveMasternode::GetMasterNodeVinForPubKey(std::string collateralAddress, CTxIn& vin, CPubKey& pubkey, CKey& secretKey) { return GetMasterNodeVinForPubKey(collateralAddress, vin, pubkey, secretKey, "", ""); } bool CActiveMasternode::GetMasterNodeVinForPubKey(std::string collateralAddress, CTxIn& vin, CPubKey& pubkey, CKey& secretKey, std::string strTxHash, std::string strOutputIndex) { CScript pubScript; // Find possible candidates vector<COutput> possibleCoins = SelectCoinsMasternodeForPubKey(collateralAddress); COutput *selectedOutput; // Find the vin if(!strTxHash.empty()) { // Let's find it uint256 txHash(strTxHash); int outputIndex = boost::lexical_cast<int>(strOutputIndex); bool found = false; BOOST_FOREACH(COutput& out, possibleCoins) { if(out.tx->GetHash() == txHash && out.i == outputIndex) { selectedOutput = &out; found = true; break; } } if(!found) { LogPrintf("CActiveMasternode::GetMasterNodeVinForPubKey - Could not locate valid vin\n"); return false; } } else { // No output specified, Select the first one if(possibleCoins.size() > 0) { selectedOutput = &possibleCoins[0]; } else { LogPrintf("CActiveMasternode::GetMasterNodeVinForPubKey - Could not locate specified vin from possible list\n"); return false; } } // At this point we have a selected output, retrieve the associated info return GetVinFromOutput(*selectedOutput, vin, pubkey, secretKey); } // Extract masternode vin information from output bool CActiveMasternode::GetVinFromOutput(COutput out, CTxIn& vin, CPubKey& pubkey, CKey& secretKey) { CScript pubScript; vin = CTxIn(out.tx->GetHash(),out.i); pubScript = out.tx->vout[out.i].scriptPubKey; // the inputs PubKey CTxDestination address1; ExtractDestination(pubScript, address1); CNumuscoinAddress address2(address1); CKeyID keyID; if (!address2.GetKeyID(keyID)) { LogPrintf("CActiveMasternode::GetMasterNodeVin - Address does not refer to a key\n"); return false; } if (!pwalletMain->GetKey(keyID, secretKey)) { LogPrintf ("CActiveMasternode::GetMasterNodeVin - Private key for address is not known\n"); return false; } pubkey = secretKey.GetPubKey(); return true; } // get all possible outputs for running masternode vector<COutput> CActiveMasternode::SelectCoinsMasternode() { vector<COutput> vCoins; vector<COutput> filteredCoins; // Retrieve all possible outputs pwalletMain->AvailableCoinsMN(vCoins); // Filter BOOST_FOREACH(const COutput& out, vCoins) { if(out.tx->vout[out.i].nValue == GetMNCollateral(pindexBest->nHeight)*COIN) { //exactly filteredCoins.push_back(out); } } return filteredCoins; } // get all possible outputs for running masternode for a specific pubkey vector<COutput> CActiveMasternode::SelectCoinsMasternodeForPubKey(std::string collateralAddress) { CNumuscoinAddress address(collateralAddress); CScript scriptPubKey; scriptPubKey.SetDestination(address.Get()); vector<COutput> vCoins; vector<COutput> filteredCoins; // Retrieve all possible outputs pwalletMain->AvailableCoins(vCoins); // Filter BOOST_FOREACH(const COutput& out, vCoins) { if(out.tx->vout[out.i].scriptPubKey == scriptPubKey && out.tx->vout[out.i].nValue == GetMNCollateral(pindexBest->nHeight)*COIN) { //exactly filteredCoins.push_back(out); } } return filteredCoins; } // when starting a masternode, this can enable to run as a hot wallet with no funds bool CActiveMasternode::EnableHotColdMasterNode(CTxIn& newVin, CService& newService) { if(!fMasterNode) return false; status = MASTERNODE_REMOTELY_ENABLED; //The values below are needed for signing dseep messages going forward this->vin = newVin; this->service = newService; LogPrintf("CActiveMasternode::EnableHotColdMasterNode() - Enabled! You may shut down the cold daemon.\n"); return true; }
[ "34494166+numuscrypto@users.noreply.github.com" ]
34494166+numuscrypto@users.noreply.github.com
1b3ab7c40e33577ce6152ce414e31a9b43f6feea
e50a1ff97d289f79001972f069b45887205b4fca
/CODES_and_RESULTS/evaluate2.cpp
05be7fd31651a15b40cd71a2f14fbd9792d02ec0
[]
no_license
pikachu123/dung
aad74778897e7f2a5a3899ae4b0ba569979e3389
5d4a1bdefffc2378b676481964018f235f6ad8ac
refs/heads/master
2016-08-04T22:35:35.530500
2012-12-13T11:12:52
2012-12-13T11:12:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,982
cpp
#include <iostream> #include <vector> using namespace std; double evaluate_2(vector<int>, vector<int>, int ); int subevaluate(vector<int>, vector<int>, int, int, int ); bool checkflag(vector<bool> ); double evaluate_3(vector<int> s1, vector<int> s2, vector<int> s3,vector<int> s4, int numchannel){ double a12 = evaluate_2(s1,s2,numchannel);//cout<<"a12 = "<<a12<<endl; double a13 = evaluate_2(s1,s3,numchannel);//cout<<"a13 = "<<a13<<endl; double a14 = evaluate_2(s1,s4,numchannel);//cout<<"a23 = "<<a23<<endl; double a23 = evaluate_2(s2,s3,numchannel);//cout<<"a12 = "<<a12<<endl; double a24 = evaluate_2(s2,s4,numchannel);//cout<<"a13 = "<<a13<<endl; double a34 = evaluate_2(s3,s4,numchannel);//cout<<"a23 = "<<a23<<endl; return (a12+a13+a14+a23+a24+a34)/6; } double evaluate_2(vector<int> s1, vector<int> s2, int numchannel){ //numchannel is # of channel; value = 2 means that channel = 0, 1; int size_1 = s1.size(); int size_2 = s2.size(); int sum = 0; double result=0; for(int i=0; i<size_1; i++){ for(int j=0; j<size_2; j++){ sum = sum + subevaluate(s1,s2,numchannel,i,j); } } //cout<<"sum = "<<sum<<endl; result=double(sum)/(size_1*size_2); return result; } //Given initial position of two sequence, than this ft returns the time that all channel has already meets at. //start1 => initial position of sequence 1; int subevaluate(vector<int> s1, vector<int> s2, int numchannel, int start1, int start2){ vector<bool> flag(numchannel); int step = 0; while(checkflag(flag) == 0){ step++; int d1 = s1[start1]; int d2 = s2[start2]; start1++; start2++; if(start1 >= s1.size() )start1 = start1 - s1.size(); if(start2 >= s2.size() )start2 = start2 - s2.size(); if(d1 == d2){ flag[d1] = 1; } } //cout<<"step = "<<step<<endl; return step; } bool checkflag(vector<bool> flag){//if elements of flag don't have any 0, output = 1; int size = flag.size(); for(int i=0; i<size; i++){ if(flag[i] == 0)return 0; } return 1; }
[ "pikachu123@pikachu123-G31MX-S2.(none)" ]
pikachu123@pikachu123-G31MX-S2.(none)
0e9dccf21187d2f8f5ac0ade01698908d44314f4
06397078d27796c4f8a7172232925c97d8075dc8
/app/volvis/vVolume.cpp
e29e0c814626fd696369a7ec92d54eba50b9b809
[]
no_license
ItayGal2/sage-graphics
5ca89459a2c05ebf965d11f636e9a72028a8db5c
090640167329ace4b6ad266d47db5bb2b0394232
refs/heads/master
2021-01-10T20:14:06.718143
2012-07-24T18:41:59
2012-07-24T18:41:59
38,210,116
0
1
null
null
null
null
UTF-8
C++
false
false
6,052
cpp
/******************************************************************************** * Volatile - Volume Visualization Software for SAGE * Copyright (C) 2004 Electronic Visualization Laboratory, * University of Illinois at Chicago * * 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 University of Illinois at Chicago 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 OWNER 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. * * Direct questions, comments etc about Volatile to www.evl.uic.edu/cavern/forum *********************************************************************************/ //Class vVolume: Defines the 3D volume and the associated operations //the inherited class should override the load/roam function //This class only manages the data(doesnt do the rendering) //Shalini Venkataraman, Luc Renambot //Sep 7 2003 #include <math.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "glUE.h" #include "vVolume.h" #include "VectorMath.h" #include "global.h" //constructor vVolume::vVolume(int x, int y, int z) { fileY = y; fileX = x; fileZ = z; dimY = dimX = dimZ = maxDim = 128; offsetX = offsetY = offsetZ = 0; spacingX = spacingY = spacingZ = 1.0f; probeX = probeY = probeZ = 0; curVolume = numVolumes = 0; probeValue = 0; isoValue = 128; } //destructor vVolume::~vVolume() { for (int i=0;i<cache.size();i++) { delete [] cache[i].voxelData; //delete [] cache[i].gradData; delete [] cache[i].hist; } } void vVolume::setLoadDims(int x, int y, int z) { //now get the power of 2 dimY = makepow2_max(y); dimX = makepow2_max(x); dimZ = makepow2_max(z); maxDim = dimY; maxDim = MAX(dimY,dimX); maxDim = MAX(maxDim,dimZ); probeX = dimX/2; probeY = dimY/2; probeZ = dimZ/2; } void vVolume::probe(int dx, int dy, int dz) { //calculate new probe(cos the orig offset is unsigned..) int newProbeX = probeX + dx; int newProbeY = probeY + dy; int newProbeZ = probeZ + dz; if (newProbeX== dimX) newProbeX = dimX-1; if (newProbeY== dimY) newProbeY = dimY-1; if (newProbeZ== dimZ) newProbeZ = dimZ-1; if (newProbeX < 0) newProbeX = 0; if (newProbeY < 0) newProbeY = 0; if (newProbeZ < 0) newProbeZ = 0; //copy to the offset probeX = newProbeX; probeY = newProbeY; probeZ = newProbeZ; probeValue = getValue(probeZ, probeY, probeX); } int vVolume::hist2D(unsigned char *normHist) { float *hist = new float[H2D_DIM]; int i; for(i=0; i<H2D_DIM; ++i){ hist[i] = 0; } for(i=0; i<dimZ; ++i){ for(int j=0; j<dimY; ++j){ for(int k=0; k<dimX; ++k){ int vox = i*dimX*dimY + j*dimX + k; hist[cache[curVolume].voxelData[vox] + cache[curVolume].gradData[vox]*256] += 1; } } } float max = 0; for(i = 0; i< H2D_DIM; ++i){ hist[i] = (float)log(hist[i]); max = MAX(hist[i], max); } for(i=0; i< H2D_DIM; ++i){ normHist[i] = (unsigned char)(hist[i]/(float)max*255); } delete[] hist; return 1; } int vVolume::hist1D(unsigned char *normHist) { float *hist = new float[H2D_DIM]; int i; for(i=0; i<H2D_DIM; ++i){ hist[i] = 0; } for(i=0; i<dimZ; ++i){ for(int j=0; j<dimY; ++j){ for(int k=0; k<dimX; ++k){ int vox = i*dimX*dimY + j*dimX + k; for (int row = 0;row<256;row++) hist[cache[curVolume].voxelData[vox]+row*256] += 1; } } } float max = 0; for(i = 0; i< H2D_DIM; ++i){ // hist[i] = (float)log(hist[i]); max = MAX(hist[i], max); } for(i=0; i< H2D_DIM; ++i){ normHist[i] = (unsigned char)(hist[i]/(float)max*255); } delete[] hist; return 1; } void vVolume::saveVolume(const char* prefix) { FILE* fp; char filename[256]; sprintf(filename,"%s%dx%dx%d.raw",prefix,dimX,dimY,dimZ); if( (fp = fopen(filename, "wb" )) != NULL ) { int numwritten = fwrite(cache[curVolume].voxelData, sizeof(GLubyte), dimY*dimX*dimZ, fp ); printf( "vVolume::saveVolume: Wrote %d bytes to file %s\n", numwritten, filename); fclose( fp ); } else printf( "vVolume::saveVolume: Problem opening the file\n" ); } void vVolume::saveGradient(const char* prefix) { FILE* fp; char filename[256]; sprintf(filename,"%s%dx%dx%d.raw",prefix,dimX,dimY,dimZ); if( (fp = fopen(filename, "wb" )) != NULL ) { int numwritten = fwrite(cache[curVolume].gradData, sizeof(unsigned char), dimY*dimX*dimZ, fp ); printf( "saveGradient: Wrote %d bytes to file %s\n", numwritten, filename); fclose( fp ); } else printf( "saveGradient: Problem opening the file\n" ); }
[ "evl@6450851e-b1f2-11de-a73b-b36ed9d36964" ]
evl@6450851e-b1f2-11de-a73b-b36ed9d36964
6d3c6ac4b3beb88b5e475a198af1463751403f20
af58a70013f7dbd0003ea325b65074dd7425f2ac
/Tp_1_STL/Affichage.h
201985d74bab6207b3fe3bd43653c507535bfa4b
[]
no_license
kakeAbdoulaye/Tp_1_STL
b577e397227f4357369c8284a9c820f43dc44c28
895187956c6d6ced1eb02efcf8d0f6f9db5338d1
refs/heads/master
2021-01-24T00:41:56.714691
2018-02-24T19:26:46
2018-02-24T19:26:46
122,771,803
0
0
null
null
null
null
UTF-8
C++
false
false
464
h
#pragma once #ifndef GestionPatient_H #define GestionPatient_H #include "Client.h" #include <algorithm> class Affichage { private: double sommePriorite; double sommeTotalConsul; ostream & fluxOs; public: Affichage(ostream & out):fluxOs(out),sommePriorite(0.0),sommeTotalConsul(0.0){} ~Affichage(); void operator()(Client & p); double getSommePriorite() { return sommePriorite; } double getSommeTotalConsul() { return sommeTotalConsul; } }; #endif
[ "kakeabdoulaye759@gmail.com" ]
kakeabdoulaye759@gmail.com
b1493342e12cd5fa4b49dddd404f3c9702b63073
2442bf3f201bf7e2ce000640c0523546f4c1219e
/Solutions/Simplify Path/main.cpp
8c154bcd3d5a7b0d50ebf8c91ad5ba81b0a4f321
[ "MIT" ]
permissive
Crayzero/LeetCodeProgramming
aeefd2cf00705334d031b35a2b98f4ddef44730d
b10ebe22c0de1501722f0f5c934c0c1902a26789
refs/heads/master
2021-01-17T15:12:40.116004
2015-06-17T12:27:57
2015-06-17T12:27:57
33,850,297
1
0
null
null
null
null
UTF-8
C++
false
false
1,238
cpp
#include <iostream> #include <stack> using namespace std; class Solution { public: string simplifyPath(string path) { stack<string > s; string tmp; if (path.size() == 0) { return tmp; } if (path[path.size()-1] != '/') { path.push_back('/'); } for(auto iter = path.begin(); iter != path.end(); iter++) { if (*iter == '/') { if (tmp != "." && tmp != ".." && tmp.size()) { s.push(tmp); } if (tmp == "..") { if(!s.empty()) { s.pop(); } } tmp = ""; } else { tmp.push_back(*iter); } } string res; while(!s.empty()) { tmp = s.top(); s.pop(); res.insert(res.begin(), '/'); res = tmp + res; } res.insert(res.begin(), '/'); if (res != "/") { res.erase(res.end()-1, res.end()); } return res; } }; int main() { Solution s; string path = "/..."; cout<<s.simplifyPath(path)<<endl; return 0; }
[ "chen154556138@163.com" ]
chen154556138@163.com
ee5560fdcd629a2df151f60019fec6f3b30f7ccf
1c12c0e353cea5be72ac959e752d4c5141516718
/src/rpcmining.cpp
12c0818e849974cccec4831f585714ce7a214126
[ "MIT", "LicenseRef-scancode-other-permissive" ]
permissive
TulipManiaCoin/TulipManiaCoin
a45d1c7eca8145bbd63b12498fb26c6c5d332529
9c8cc089f2f18291255b3438e14be8a3697e977b
refs/heads/master
2020-03-28T17:57:42.513999
2018-09-14T20:45:19
2018-09-14T20:45:19
148,840,041
1
0
null
null
null
null
UTF-8
C++
false
false
19,212
cpp
// Copyright (c) 2010 Satoshi Nakamoto // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "main.h" #include "db.h" #include "txdb.h" #include "init.h" #include "miner.h" #include "bitcoinrpc.h" using namespace json_spirit; using namespace std; Value getsubsidy(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getsubsidy [nTarget]\n" "Returns proof-of-work subsidy value for the specified value of target."); return (uint64_t)GetProofOfWorkReward(0); } Value getmininginfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getmininginfo\n" "Returns an object containing mining-related information."); uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0; pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight); Object obj, diff, weight; obj.push_back(Pair("Blocks", (int)nBestHeight)); obj.push_back(Pair("Current Block Size",(uint64_t)nLastBlockSize)); obj.push_back(Pair("Current Block Tx",(uint64_t)nLastBlockTx)); diff.push_back(Pair("Proof of Work", GetDifficulty())); diff.push_back(Pair("Proof of Stake", GetDifficulty(GetLastBlockIndex(pindexBest, true)))); diff.push_back(Pair("Search Interval", (int)nLastCoinStakeSearchInterval)); obj.push_back(Pair("Difficulty", diff)); obj.push_back(Pair("Block Value", (uint64_t)GetProofOfWorkReward(0))); obj.push_back(Pair("Net MH/s", GetPoWMHashPS())); obj.push_back(Pair("Net Stake Weight", GetPoSKernelPS())); obj.push_back(Pair("Errors", GetWarnings("statusbar"))); obj.push_back(Pair("Pooled Tx", (uint64_t)mempool.size())); weight.push_back(Pair("Minimum", (uint64_t)nMinWeight)); weight.push_back(Pair("Maximum", (uint64_t)nMaxWeight)); weight.push_back(Pair("Combined", (uint64_t)nWeight)); obj.push_back(Pair("Stake Weight", weight)); obj.push_back(Pair("Stake Interest", (uint64_t)COIN_YEAR_REWARD)); obj.push_back(Pair("Testnet", fTestNet)); return obj; } Value getstakinginfo(const Array& params, bool fHelp) { if (fHelp || params.size() != 0) throw runtime_error( "getstakinginfo\n" "Returns an object containing staking-related information."); uint64_t nMinWeight = 0, nMaxWeight = 0, nWeight = 0; pwalletMain->GetStakeWeight(*pwalletMain, nMinWeight, nMaxWeight, nWeight); uint64_t nNetworkWeight = GetPoSKernelPS(); bool staking = nLastCoinStakeSearchInterval && nWeight; int nExpectedTime = staking ? (nTargetSpacing * nNetworkWeight / nWeight) : -1; Object obj; obj.push_back(Pair("Enabled", GetBoolArg("-staking", true))); obj.push_back(Pair("Staking", staking)); obj.push_back(Pair("Errors", GetWarnings("statusbar"))); obj.push_back(Pair("Current Block Size", (uint64_t)nLastBlockSize)); obj.push_back(Pair("Current Block Tx", (uint64_t)nLastBlockTx)); obj.push_back(Pair("Pooled Tx", (uint64_t)mempool.size())); obj.push_back(Pair("Difficulty", GetDifficulty(GetLastBlockIndex(pindexBest, true)))); obj.push_back(Pair("Search Interval", (int)nLastCoinStakeSearchInterval)); obj.push_back(Pair("Weight", (uint64_t)nWeight)); obj.push_back(Pair("Net Stake Weight", (uint64_t)nNetworkWeight)); obj.push_back(Pair("Expected Time", nExpectedTime)); return obj; } Value getworkex(const Array& params, bool fHelp) { if (fHelp || params.size() > 2) throw runtime_error( "getworkex [data, coinbase]\n" "If [data, coinbase] is not specified, returns extended work data.\n" ); if (vNodes.empty()) throw JSONRPCError(-9, "TulipMania is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(-10, "TulipMania is downloading blocks..."); if (pindexBest->nHeight >= LAST_POW_BLOCK) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; static mapNewBlock_t mapNewBlock; static vector<CBlock*> vNewBlock; static CReserveKey reservekey(pwalletMain); if (params.size() == 0) { // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)) { if (pindexPrev != pindexBest) { // Deallocate old blocks since they're obsolete now mapNewBlock.clear(); BOOST_FOREACH(CBlock* pblock, vNewBlock) delete pblock; vNewBlock.clear(); } nTransactionsUpdatedLast = nTransactionsUpdated; pindexPrev = pindexBest; nStart = GetTime(); // Create new block pblock = CreateNewBlock(pwalletMain); if (!pblock) throw JSONRPCError(-7, "Out of memory"); vNewBlock.push_back(pblock); } // Update nTime pblock->nTime = max(pindexPrev->GetPastTimeLimit()+1, GetAdjustedTime()); pblock->nNonce = 0; // Update nExtraNonce static unsigned int nExtraNonce = 0; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); // Prebuild hash buffers char pmidstate[32]; char pdata[128]; char phash1[64]; FormatHashBuffers(pblock, pmidstate, pdata, phash1); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); CTransaction coinbaseTx = pblock->vtx[0]; std::vector<uint256> merkle = pblock->GetMerkleBranch(0); Object result; result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata)))); result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget)))); CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << coinbaseTx; result.push_back(Pair("coinbase", HexStr(ssTx.begin(), ssTx.end()))); Array merkle_arr; BOOST_FOREACH(uint256 merkleh, merkle) { merkle_arr.push_back(HexStr(BEGIN(merkleh), END(merkleh))); } result.push_back(Pair("merkle", merkle_arr)); return result; } else { // Parse parameters vector<unsigned char> vchData = ParseHex(params[0].get_str()); vector<unsigned char> coinbase; if(params.size() == 2) coinbase = ParseHex(params[1].get_str()); if (vchData.size() != 128) throw JSONRPCError(-8, "Invalid parameter"); CBlock* pdata = (CBlock*)&vchData[0]; // Byte reverse for (int i = 0; i < 128/4; i++) ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]); // Get saved block if (!mapNewBlock.count(pdata->hashMerkleRoot)) return false; CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first; pblock->nTime = pdata->nTime; pblock->nNonce = pdata->nNonce; if(coinbase.size() == 0) pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second; else CDataStream(coinbase, SER_NETWORK, PROTOCOL_VERSION) >> pblock->vtx[0]; // FIXME - HACK! pblock->hashMerkleRoot = pblock->BuildMerkleTree(); return CheckWork(pblock, *pwalletMain, reservekey); } } Value getwork(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getwork [data]\n" "If [data] is not specified, returns formatted hash data to work on:\n" " \"midstate\" : precomputed hash state after hashing the first half of the data (DEPRECATED)\n" // deprecated " \"data\" : block data\n" " \"hash1\" : formatted hash buffer for second hash (DEPRECATED)\n" // deprecated " \"target\" : little endian hash target\n" "If [data] is specified, tries to solve the block and returns true if it was successful."); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "TulipMania is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "TulipMania is downloading blocks..."); if (pindexBest->nHeight >= LAST_POW_BLOCK) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); typedef map<uint256, pair<CBlock*, CScript> > mapNewBlock_t; static mapNewBlock_t mapNewBlock; // FIXME: thread safety static vector<CBlock*> vNewBlock; static CReserveKey reservekey(pwalletMain); if (params.size() == 0) { // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 60)) { if (pindexPrev != pindexBest) { // Deallocate old blocks since they're obsolete now mapNewBlock.clear(); BOOST_FOREACH(CBlock* pblock, vNewBlock) delete pblock; vNewBlock.clear(); } // Clear pindexPrev so future getworks make a new block, despite any failures from here on pindexPrev = NULL; // Store the pindexBest used before CreateNewBlock, to avoid races nTransactionsUpdatedLast = nTransactionsUpdated; CBlockIndex* pindexPrevNew = pindexBest; nStart = GetTime(); // Create new block pblock = CreateNewBlock(pwalletMain); if (!pblock) throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory"); vNewBlock.push_back(pblock); // Need to update only after we know CreateNewBlock succeeded pindexPrev = pindexPrevNew; } // Update nTime pblock->UpdateTime(pindexPrev); pblock->nNonce = 0; // Update nExtraNonce static unsigned int nExtraNonce = 0; IncrementExtraNonce(pblock, pindexPrev, nExtraNonce); // Save mapNewBlock[pblock->hashMerkleRoot] = make_pair(pblock, pblock->vtx[0].vin[0].scriptSig); // Pre-build hash buffers char pmidstate[32]; char pdata[128]; char phash1[64]; FormatHashBuffers(pblock, pmidstate, pdata, phash1); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); Object result; result.push_back(Pair("midstate", HexStr(BEGIN(pmidstate), END(pmidstate)))); // deprecated result.push_back(Pair("data", HexStr(BEGIN(pdata), END(pdata)))); result.push_back(Pair("hash1", HexStr(BEGIN(phash1), END(phash1)))); // deprecated result.push_back(Pair("target", HexStr(BEGIN(hashTarget), END(hashTarget)))); return result; } else { // Parse parameters vector<unsigned char> vchData = ParseHex(params[0].get_str()); if (vchData.size() != 128) throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter"); CBlock* pdata = (CBlock*)&vchData[0]; // Byte reverse for (int i = 0; i < 128/4; i++) ((unsigned int*)pdata)[i] = ByteReverse(((unsigned int*)pdata)[i]); // Get saved block if (!mapNewBlock.count(pdata->hashMerkleRoot)) return false; CBlock* pblock = mapNewBlock[pdata->hashMerkleRoot].first; pblock->nTime = pdata->nTime; pblock->nNonce = pdata->nNonce; pblock->vtx[0].vin[0].scriptSig = mapNewBlock[pdata->hashMerkleRoot].second; pblock->hashMerkleRoot = pblock->BuildMerkleTree(); return CheckWork(pblock, *pwalletMain, reservekey); } } Value getblocktemplate(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) throw runtime_error( "getblocktemplate [params]\n" "Returns data needed to construct a block to work on:\n" " \"version\" : block version\n" " \"previousblockhash\" : hash of current highest block\n" " \"transactions\" : contents of non-coinbase transactions that should be included in the next block\n" " \"coinbaseaux\" : data that should be included in coinbase\n" " \"coinbasevalue\" : maximum allowable input to coinbase transaction, including the generation award and transaction fees\n" " \"target\" : hash target\n" " \"mintime\" : minimum timestamp appropriate for next block\n" " \"curtime\" : current timestamp\n" " \"mutable\" : list of ways the block template may be changed\n" " \"noncerange\" : range of valid nonces\n" " \"sigoplimit\" : limit of sigops in blocks\n" " \"sizelimit\" : limit of block size\n" " \"bits\" : compressed target of next block\n" " \"height\" : height of the next block\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification."); std::string strMode = "template"; if (params.size() > 0) { const Object& oparam = params[0].get_obj(); const Value& modeval = find_value(oparam, "mode"); if (modeval.type() == str_type) strMode = modeval.get_str(); else if (modeval.type() == null_type) { /* Do nothing */ } else throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); } if (strMode != "template") throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid mode"); if (vNodes.empty()) throw JSONRPCError(RPC_CLIENT_NOT_CONNECTED, "TulipMania is not connected!"); if (IsInitialBlockDownload()) throw JSONRPCError(RPC_CLIENT_IN_INITIAL_DOWNLOAD, "TulipMania is downloading blocks..."); if (pindexBest->nHeight >= LAST_POW_BLOCK) throw JSONRPCError(RPC_MISC_ERROR, "No more PoW blocks"); static CReserveKey reservekey(pwalletMain); // Update block static unsigned int nTransactionsUpdatedLast; static CBlockIndex* pindexPrev; static int64_t nStart; static CBlock* pblock; if (pindexPrev != pindexBest || (nTransactionsUpdated != nTransactionsUpdatedLast && GetTime() - nStart > 5)) { // Clear pindexPrev so future calls make a new block, despite any failures from here on pindexPrev = NULL; // Store the pindexBest used before CreateNewBlock, to avoid races nTransactionsUpdatedLast = nTransactionsUpdated; CBlockIndex* pindexPrevNew = pindexBest; nStart = GetTime(); // Create new block if(pblock) { delete pblock; pblock = NULL; } pblock = CreateNewBlock(pwalletMain); if (!pblock) throw JSONRPCError(RPC_OUT_OF_MEMORY, "Out of memory"); // Need to update only after we know CreateNewBlock succeeded pindexPrev = pindexPrevNew; } // Update nTime pblock->UpdateTime(pindexPrev); pblock->nNonce = 0; Array transactions; map<uint256, int64_t> setTxIndex; int i = 0; CTxDB txdb("r"); BOOST_FOREACH (CTransaction& tx, pblock->vtx) { uint256 txHash = tx.GetHash(); setTxIndex[txHash] = i++; if (tx.IsCoinBase() || tx.IsCoinStake()) continue; Object entry; CDataStream ssTx(SER_NETWORK, PROTOCOL_VERSION); ssTx << tx; entry.push_back(Pair("data", HexStr(ssTx.begin(), ssTx.end()))); entry.push_back(Pair("hash", txHash.GetHex())); MapPrevTx mapInputs; map<uint256, CTxIndex> mapUnused; bool fInvalid = false; if (tx.FetchInputs(txdb, mapUnused, false, false, mapInputs, fInvalid)) { entry.push_back(Pair("fee", (int64_t)(tx.GetValueIn(mapInputs) - tx.GetValueOut()))); Array deps; BOOST_FOREACH (MapPrevTx::value_type& inp, mapInputs) { if (setTxIndex.count(inp.first)) deps.push_back(setTxIndex[inp.first]); } entry.push_back(Pair("depends", deps)); int64_t nSigOps = tx.GetLegacySigOpCount(); nSigOps += tx.GetP2SHSigOpCount(mapInputs); entry.push_back(Pair("sigops", nSigOps)); } transactions.push_back(entry); } Object aux; aux.push_back(Pair("flags", HexStr(COINBASE_FLAGS.begin(), COINBASE_FLAGS.end()))); uint256 hashTarget = CBigNum().SetCompact(pblock->nBits).getuint256(); static Array aMutable; if (aMutable.empty()) { aMutable.push_back("time"); aMutable.push_back("transactions"); aMutable.push_back("prevblock"); } Object result; result.push_back(Pair("version", pblock->nVersion)); result.push_back(Pair("previousblockhash", pblock->hashPrevBlock.GetHex())); result.push_back(Pair("transactions", transactions)); result.push_back(Pair("coinbaseaux", aux)); result.push_back(Pair("coinbasevalue", (int64_t)pblock->vtx[0].vout[0].nValue)); result.push_back(Pair("target", hashTarget.GetHex())); result.push_back(Pair("mintime", (int64_t)pindexPrev->GetPastTimeLimit()+1)); result.push_back(Pair("mutable", aMutable)); result.push_back(Pair("noncerange", "00000000ffffffff")); result.push_back(Pair("sigoplimit", (int64_t)MAX_BLOCK_SIGOPS)); result.push_back(Pair("sizelimit", (int64_t)MAX_BLOCK_SIZE)); result.push_back(Pair("curtime", (int64_t)pblock->nTime)); result.push_back(Pair("bits", HexBits(pblock->nBits))); result.push_back(Pair("height", (int64_t)(pindexPrev->nHeight+1))); return result; } Value submitblock(const Array& params, bool fHelp) { if (fHelp || params.size() < 1 || params.size() > 2) throw runtime_error( "submitblock <hex data> [optional-params-obj]\n" "[optional-params-obj] parameter is currently ignored.\n" "Attempts to submit new block to network.\n" "See https://en.bitcoin.it/wiki/BIP_0022 for full specification."); vector<unsigned char> blockData(ParseHex(params[0].get_str())); CDataStream ssBlock(blockData, SER_NETWORK, PROTOCOL_VERSION); CBlock block; try { ssBlock >> block; } catch (std::exception &e) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed"); } bool fAccepted = ProcessBlock(NULL, &block); if (!fAccepted) return "rejected"; return Value::null; }
[ "tulipmaniacoin2018@outlook.com" ]
tulipmaniacoin2018@outlook.com
618111a5f07d60a3ecfbbbe1e88266caa1b75f59
2bc996010e9312ec8376f3355a8367a8281d85bf
/src/Static.cpp
70c43927878c715084c64be96ecff828851e4ad4
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
frogli-omnis/NVObjTemplate
9ba9a66706c68ba37e2b3874d84d481f33ac90af
1a3816229645d8d1893decf395052fadbc16e8d9
refs/heads/master
2020-03-17T20:36:20.891331
2018-05-18T09:23:42
2018-05-18T09:23:42
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,654
cpp
/* Copyright (c) 2010 David McKeone * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. 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. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* STATIC METHODS (IMPLEMENTATION) * * This file implements all static methods for the external. * * February 18, 2011 David McKeone (Created) */ #include <extcomp.he> #include "OmnisTools.he" #include "Static.he" using namespace OmnisTools; // Define static methods const static qshort cStaticMethodStaticEmpty = 5000; // Parameters for Static Methods // Columns are: // 1) Name of Parameter (Resource #) // 2) Return type (fft value) // 3) Parameter flags of type EXTD_FLAG_xxxx // 4) Extended flags. Documentation states, "Must be 0" ECOparam cStaticMethodsParamsTable[] = { 5900, fftInteger , 0, 0 }; // Table of Methods available for Simple // Columns are: // 1) Unique ID // 2) Name of Method (Resource #) // 3) Return Type // 4) # of Parameters // 5) Array of Parameter Names (Taken from MethodsParamsTable. Increments # of parameters past this pointer) // 6) Enum Start (Not sure what this does, 0 = disabled) // 7) Enum Stop (Not sure what this does, 0 = disabled) ECOmethodEvent cStaticMethodsTable[] = { cStaticMethodStaticEmpty, cStaticMethodStaticEmpty, fftBoolean, 1, &cStaticMethodsParamsTable[0], 0, 0 }; // List of methods in Simple qlong returnStaticMethods(tThreadData* pThreadData) { const qshort cStaticMethodCount = sizeof(cStaticMethodsTable) / sizeof(ECOmethodEvent); return ECOreturnMethods( gInstLib, pThreadData->mEci, &cStaticMethodsTable[0], cStaticMethodCount ); } // Implementation of single static method void methodStaticEmpty(tThreadData* pThreadData, qshort paramCount) { // Build return value EXTfldval valReturn; getEXTFldValFromBool(valReturn, true); // Return it to Omnis ECOaddParam(pThreadData->mEci, &valReturn); return; } // Static method dispatch qlong staticMethodCall( OmnisTools::tThreadData* pThreadData ) { qshort funcId = (qshort)ECOgetId(pThreadData->mEci); qshort paramCount = ECOgetParamCount(pThreadData->mEci); switch( funcId ) { case cStaticMethodStaticEmpty: pThreadData->mCurMethodName = "$staticEmpty"; methodStaticEmpty(pThreadData, paramCount); break; } return 0L; }
[ "davidmckeone@gmail.com" ]
davidmckeone@gmail.com
9a281d485c88c3db713ec12254feb7b112b01555
7a4fbcb5d6ad1598224d150f4e151ec1605a9555
/nsis-ka/protlib/src/fqueue.cpp
2cb0441c9e7a077bda231b6d598d78fb01b1590d
[]
no_license
jurdan21/ReVir-UFPe
49cffbdaaeccf98822a24a19888d2f7ba7ed0d06
7087b43510c8a224c5cd584f0ab9823250fba5c7
refs/heads/master
2020-11-30T05:27:53.903075
2011-08-09T00:23:45
2011-08-09T00:23:45
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,599
cpp
/// ----------------------------------------*- mode: C++; -*-- /// @file fqueue.cpp /// wrapper class for fastqueue /// ---------------------------------------------------------- /// $Id: fqueue.cpp 6277 2011-06-17 07:19:22Z bless $ /// $HeadURL: https://svn.tm.kit.edu/nsis/protlib/trunk/src/fqueue.cpp $ // =========================================================== // // Copyright (C) 2005-2007, all rights reserved by // - Institute of Telematics, Universitaet Karlsruhe (TH) // // More information and contact: // https://projekte.tm.uka.de/trac/NSIS // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; version 2 of the License // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. // // =========================================================== #include "fqueue.h" #include "stdio.h" #include "logfile.h" #include <string> namespace protlib { /** @addtogroup fastqueue Fast Queue * @{ */ using namespace log; /** * Constructor. * * Initialize a FastQueue with a queue name and enable/disable expedited * data. * * @param qname the queue's name, or NULL * @param exp if true, expedited data support is enabled */ FastQueue::FastQueue(const char *qname, bool exp) : queue_name((qname == 0) ? "" : (char*)qname), shutdownflag(false) { if ((queue = create_queue(qname)) == NULL) { Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not create queue " << queue_name); throw FQError(); } else queue_enable_expedited(queue,exp); } /** * Add a message to the queue. * * If exp is true and the queue allows expedited data, the message will * pass all normal messages in the queue and thus will be delivered earlier. * If there are other expedited messages in the queue already, it will be * added after the already existing expedited messages. * * This method may fail (and return false) if the queue is in shutdown mode, * there is a problem aquiring locks, or some other threading problem. * * In case the queue is deleted before this message has been removed, this * message is deleted using the delete operator. Because of this, the same * message may only appear once in a queue. * * @param element a pointer to the message to add * @param exp true if this is expedited data * * @return true if the element was enqueued successfully */ bool FastQueue::enqueue(message *element, bool exp) { if (shutdownflag) return false; if (enqueue_element_expedited_signal(queue, (void*)element, exp) < 0) { Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not enqueue element in queue " << queue_name); return false; } return true; } /** * Wait for a message for a given time. * * If no message arrives in the given time period, NULL is returned. * * @param msec the time to wait in milliseconds * * @return the message, or NULL */ message *FastQueue::dequeue_timedwait(const long int msec) { struct timespec tspec = {0,0}; tspec.tv_sec = msec/1000; tspec.tv_nsec = (msec%1000)*1000000; return (message*)dequeue_element_timedwait(queue, &tspec); } /** * Destructor. * * Destroys the queue. All messages which are still in the queue are deleted * using the delete operator. */ FastQueue::~FastQueue() { if (queue) { cleanup(); if ((destroy_queue(queue)) < 0) { Log(ERROR_LOG, LOG_ALERT, "FastQueue", "Could not destroy queue " << queue_name); } } DLog("FastQueue", "~FastQueue() - done for queue " << queue_name); } /** * Test if the queue is empty. * * @return true if the queue is empty */ bool FastQueue::is_empty() const { if (queue_nr_of_elements(queue)==0) return true; else return false; } /** * Return the number of messages in the queue. * * @return the number of enqueued messages */ unsigned long FastQueue::size() const { return queue_nr_of_elements(queue); } /** * Test if expedited message support is enabled. * * @return true if expedited message support is enabled */ bool FastQueue::is_expedited_enabled() const { if (queue_is_expedited_enabled(queue)) return true; else return false; } /** * Enable or disable expedited messages. * * This also returns the previous value of this flag. * * @return true, if expedited messages were previously enabled, false otherwise */ bool FastQueue::enable_expedited(bool exp) { if (queue_enable_expedited(queue,exp)) return true; else return false; } /** * Disable enqueueing of new messages. * * A queue in shutdown mode does not accept messages any more. */ void FastQueue::shutdown() { shutdownflag = true; } /** * Put queue into shutdown mode and delete all stored messages.. * * @return the number of messages that were in the queue */ unsigned long FastQueue::cleanup() { unsigned long count = 0; message* m = NULL; shutdownflag = true; while (!is_empty()) if ((m = dequeue(false))) { delete m; m = NULL; count++; } return count; } void FastQueue::signal_queue() { signal_cond(queue); } //@} } // end namespace protlib
[ "allanborgespontes@yahoo.com.br" ]
allanborgespontes@yahoo.com.br
b532c97bb3cf48c0eb5c34cbde936a771686f393
200cc322c9e14819f5c494c03ee66bc4770f1942
/PAT/1018/1018/1018.cpp
82041f052dca469d02e48a5e9abb3771bc99f08a
[]
no_license
DeftHaHa/ACM
405965d8da104edae69f46545c301848c88df382
462de76d49c1ca10cb834ed03df2ae7ea046359e
refs/heads/master
2020-04-27T20:12:59.513127
2019-03-09T04:51:54
2019-03-09T04:51:54
174,649,510
1
0
null
null
null
null
UTF-8
C++
false
false
2,099
cpp
#include<cstring> #include<cstdio> #include<vector> #include<algorithm> #include<iostream> using namespace std; const int inf=0x3f3f3f3f; struct edge { int next,v,w; }e[250005]; int eid,p[250005]; void addedge(int u,int v,int w) { e[eid].v=v; e[eid].w=w; e[eid].next=p[u]; p[u]=eid++; } int cmax,N,sp,M; int dist[505],path[505]; bool vis[505]; int tot=0; vector<int> PATH[1005]; void dijkstra(int s) { memset(vis,false,sizeof(vis)); memset(dist,0x3f,sizeof(dist)); dist[s]=0; for(int i=0;i<=N;i++) { int u=0,min_w=inf; for(int j=0;j<=N;j++) { if(!vis[j]&&dist[j]<min_w) { u=j; min_w=dist[j]; } } vis[u]=true; for(int j=p[u];j!=-1;j=e[j].next) { int v=e[j].v; int newd=dist[u]+e[j].w; if(!vis[v]&&newd<=dist[v]) { path[v]=u; if(v==sp) { if(newd<dist[sp]) { for(int i=0;i<tot;i++) { if(!PATH[i].empty()) PATH[i].clear(); } tot=0; } int temp=v; while(temp!=0) { PATH[tot].push_back(temp); temp=path[temp]; } tot++; } dist[v]=newd; } } } } int main() { int s[505]; while(cin>>cmax>>N>>sp>>M) { for(int i=1;i<=N;i++) cin>>s[i]; eid=0; memset(p,-1,sizeof(p)); while(M--) { int u,v,w; cin>>u>>v>>w; addedge(u,v,w); addedge(v,u,w); } dijkstra(0); int per=cmax/2; vector<int>::reverse_iterator it; int mintake=inf,tag,a1,a2; int take,back; for(int i=0;i<tot;i++) { take=back=0; for(it=PATH[i].rbegin();it!=PATH[i].rend();it++) { if(s[*it]<per) { if(back>=per-s[*it]) { back-=per-s[*it]; } else { take+=per-s[*it]-back; back=0; } } else { back+=s[*it]-per; } } if(back<mintake) { tag=i; mintake=back; a1=take; a2=back; } } cout<<a1<<' '<<0; for(it=PATH[tag].rbegin();it!=PATH[tag].rend();it++) { cout<<"->"<<*it; } cout<<' '<<a2<<endl; for(int i=0;i<tot;i++) { if(!PATH[i].empty()) PATH[i].clear(); } } return 0; }
[ "2431416414@qq.com" ]
2431416414@qq.com
15bc29dfc752a4c2b59d76aab7312db029b85e23
df01e3a1587dd0346035aa37b49bf74e43c94b68
/VideoConsumer/ReceivedVideo.cpp
74d1b17c211872487e3ef4730bf5a6951d76e472
[]
no_license
jyahina/VideoCapture
cc9b35f3423a1d14dc197122543ddfae0eaec534
6e7a4864391bc4801c363788922b32c33db3b537
refs/heads/master
2020-11-24T19:40:34.807755
2019-12-16T06:28:25
2019-12-16T06:28:25
228,316,446
0
0
null
null
null
null
UTF-8
C++
false
false
967
cpp
#include "ReceivedVideo.h" using namespace cv; void ReceivedVideo::run() { int fd1; unsigned char* buf; Mat frame; mkfifo(myfifo, 0666); while (1) { readBuf(fd1, frame); checkFrame(frame); showFrame(frame); auto stopFrame = static_cast<char>(cvWaitKey(33)); if (stopFrame == 27) { break; } } } void ReceivedVideo::showFrame(const Mat &frame) { namedWindow("Display window", WINDOW_AUTOSIZE ); imshow( "Display window", frame ); } void ReceivedVideo::readBuf(int &fd1, cv::Mat &frame) { fd1 = open(myfifo, O_RDONLY); int row,column; read(fd1,&row,sizeof(int)); read(fd1,&column,sizeof(int)); const int size = row*column*3; frame = Mat(row, column, CV_8UC3); read(fd1, frame.data, size); close(fd1); } void ReceivedVideo::checkFrame(const cv::Mat &frame) { if (frame.empty()) { throw std::runtime_error("Cannot read a frame."); } }
[ "vib-210@mail.ru" ]
vib-210@mail.ru
15c786cd2f88808d02ede821cca79e74d91731e5
c4e93e5e88b9a38fb1b5e4a398810c9e165df80f
/discovery/include/aws/discovery/DiscoverResponse.h
131253e0c21d7a86b2e9563a31305b6032b2759d
[ "Apache-2.0" ]
permissive
aws/aws-iot-device-sdk-cpp-v2
c7c441024e19a24d3ebf4cc9f05c2ed15a4c2b89
1ddf4ab749155abe195acab9f9505791a93b9b45
refs/heads/main
2023-09-03T15:05:45.057875
2023-09-01T20:33:54
2023-09-01T20:33:54
157,451,948
148
108
Apache-2.0
2023-09-01T20:33:56
2018-11-13T21:51:08
C++
UTF-8
C++
false
false
699
h
#pragma once /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/discovery/GGGroup.h> namespace Aws { namespace Discovery { class AWS_DISCOVERY_API DiscoverResponse final { public: DiscoverResponse() = default; DiscoverResponse(const Crt::JsonView &doc); DiscoverResponse &operator=(const Crt::JsonView &doc); Aws::Crt::Optional<Aws::Crt::Vector<GGGroup>> GGGroups; private: static void LoadFromObject(DiscoverResponse &obj, const Crt::JsonView &doc); }; } // namespace Discovery } // namespace Aws
[ "noreply@github.com" ]
noreply@github.com
92811b67abc07a681ce3ee6ea00da5ff6ead3cfc
48826c72677c82952795f95baba2a809d4c9a12b
/trt_pose/parse/utils/CoverTable.hpp
1daa3b95cc58513c65ead79f693094d040319086
[ "MIT" ]
permissive
tokk-nv/trt_pose
304b3980eefc32779432bb5370a6a51c0dabd9b6
a52422579ad167ee34ad5112f186e8144a5685b4
refs/heads/master
2023-03-10T23:43:19.522480
2021-02-27T00:54:42
2021-02-27T00:54:42
318,009,618
3
0
MIT
2021-02-23T00:27:19
2020-12-02T22:35:10
Python
UTF-8
C++
false
false
1,080
hpp
#pragma once #include <memory> #include <vector> namespace trt_pose { namespace parse { namespace utils { class CoverTable { public: CoverTable(int nrows, int ncols) : nrows(nrows), ncols(ncols) { rows.resize(nrows); cols.resize(ncols); } inline void coverRow(int row) { rows[row] = 1; } inline void coverCol(int col) { cols[col] = 1; } inline void uncoverRow(int row) { rows[row] = 0; } inline void uncoverCol(int col) { cols[col] = 0; } inline bool isCovered(int row, int col) const { return rows[row] || cols[col]; } inline bool isRowCovered(int row) const { return rows[row]; } inline bool isColCovered(int col) const { return cols[col]; } inline void clear() { for (int i = 0; i < nrows; i++) { uncoverRow(i); } for (int j = 0; j < ncols; j++) { uncoverCol(j); } } const int nrows; const int ncols; private: std::vector<bool> rows; std::vector<bool> cols; }; } // namespace utils } // namespace parse } // namespace trt_pose
[ "jwelsh@nvidia.com" ]
jwelsh@nvidia.com
305faf08e95f213bbbf1aae26c5ed8543eefac2b
060591cee2eca06aaef4e05dd8476d3692160d54
/src/xrLua/luabind/luabind/weak_ref.hpp
afa5e9b3f7a94f6decf39c2dc28da73e6073f3e1
[ "LicenseRef-scancode-warranty-disclaimer", "BSD-2-Clause" ]
permissive
Georgiy-Timoshin/X-Ray
7c96c494803edbe4c9e03d4e3b8ebb46c02ff35e
51dc8ddcfdde3167f3a025022d8420a94c5c1c43
refs/heads/main
2023-04-29T18:35:06.229863
2021-05-14T02:13:00
2021-05-14T02:13:00
367,538,251
0
2
NOASSERTION
2021-05-15T04:48:44
2021-05-15T04:23:35
null
UTF-8
C++
false
false
1,765
hpp
// Copyright (c) 2004 Daniel Wallin and Arvid Norberg // 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 WEAK_REF_040402_HPP #define WEAK_REF_040402_HPP #include "config.hpp" struct lua_State; namespace luabind { class LUABIND_API weak_ref { public: weak_ref(); weak_ref(lua_State*, int); weak_ref(weak_ref const&); ~weak_ref(); weak_ref& operator=(weak_ref const&); void swap(weak_ref&); // returns a unique id that no // other weak ref will return int id() const; lua_State* state() const; void get(lua_State* L) const; private: struct impl; impl* m_impl; }; } // namespace luabind #endif // WEAK_REF_040402_HPP
[ "53347567+xrModder@users.noreply.github.com" ]
53347567+xrModder@users.noreply.github.com
c0db1b28a4ccdfcee4edf292897b8952082ac05f
90047daeb462598a924d76ddf4288e832e86417c
/net/spdy/chromium/spdy_read_queue_unittest.cc
0e77d131ffd181551b2a476b5cf57f7d05dc73c9
[ "BSD-3-Clause" ]
permissive
massbrowser/android
99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080
a9c4371682c9443d6e1d66005d4db61a24a9617c
refs/heads/master
2022-11-04T21:15:50.656802
2017-06-08T12:31:39
2017-06-08T12:31:39
93,747,579
2
2
BSD-3-Clause
2022-10-31T10:34:25
2017-06-08T12:36:07
null
UTF-8
C++
false
false
4,487
cc
// Copyright (c) 2013 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "net/spdy/chromium/spdy_read_queue.h" #include <algorithm> #include <cstddef> #include <memory> #include <utility> #include "base/bind.h" #include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "net/spdy/chromium/spdy_buffer.h" #include "net/spdy/platform/api/spdy_string.h" #include "testing/gtest/include/gtest/gtest.h" namespace net { namespace test { namespace { const char kData[] = "SPDY read queue test data.\0Some more data."; const size_t kDataSize = arraysize(kData); // Enqueues |data| onto |queue| in chunks of at most |max_buffer_size| // bytes. void EnqueueString(const SpdyString& data, size_t max_buffer_size, SpdyReadQueue* queue) { ASSERT_GT(data.size(), 0u); ASSERT_GT(max_buffer_size, 0u); size_t old_total_size = queue->GetTotalSize(); for (size_t i = 0; i < data.size();) { size_t buffer_size = std::min(data.size() - i, max_buffer_size); queue->Enqueue(std::unique_ptr<SpdyBuffer>( new SpdyBuffer(data.data() + i, buffer_size))); i += buffer_size; EXPECT_FALSE(queue->IsEmpty()); EXPECT_EQ(old_total_size + i, queue->GetTotalSize()); } } // Dequeues all bytes in |queue| in chunks of at most // |max_buffer_size| bytes and returns the data as a string. SpdyString DrainToString(size_t max_buffer_size, SpdyReadQueue* queue) { SpdyString data; // Pad the buffer so we can detect out-of-bound writes. size_t padding = std::max(static_cast<size_t>(4096), queue->GetTotalSize()); size_t buffer_size_with_padding = padding + max_buffer_size + padding; std::unique_ptr<char[]> buffer(new char[buffer_size_with_padding]); std::memset(buffer.get(), 0, buffer_size_with_padding); char* buffer_data = buffer.get() + padding; while (!queue->IsEmpty()) { size_t old_total_size = queue->GetTotalSize(); EXPECT_GT(old_total_size, 0u); size_t dequeued_bytes = queue->Dequeue(buffer_data, max_buffer_size); // Make sure |queue| doesn't write past either end of its given // boundaries. for (int i = 1; i <= static_cast<int>(padding); ++i) { EXPECT_EQ('\0', buffer_data[-i]) << -i; } for (size_t i = 0; i < padding; ++i) { EXPECT_EQ('\0', buffer_data[max_buffer_size + i]) << i; } data.append(buffer_data, dequeued_bytes); EXPECT_EQ(dequeued_bytes, std::min(max_buffer_size, dequeued_bytes)); EXPECT_EQ(queue->GetTotalSize(), old_total_size - dequeued_bytes); } EXPECT_TRUE(queue->IsEmpty()); return data; } // Enqueue a test string with the given enqueue/dequeue max buffer // sizes. void RunEnqueueDequeueTest(size_t enqueue_max_buffer_size, size_t dequeue_max_buffer_size) { SpdyString data(kData, kDataSize); SpdyReadQueue read_queue; EnqueueString(data, enqueue_max_buffer_size, &read_queue); const SpdyString& drained_data = DrainToString(dequeue_max_buffer_size, &read_queue); EXPECT_EQ(data, drained_data); } void OnBufferDiscarded(bool* discarded, size_t* discarded_bytes, size_t delta, SpdyBuffer::ConsumeSource consume_source) { EXPECT_EQ(SpdyBuffer::DISCARD, consume_source); *discarded = true; *discarded_bytes = delta; } } // namespace class SpdyReadQueueTest : public ::testing::Test {}; // Call RunEnqueueDequeueTest() with various buffer size combinatinos. TEST_F(SpdyReadQueueTest, LargeEnqueueAndDequeueBuffers) { RunEnqueueDequeueTest(2 * kDataSize, 2 * kDataSize); } TEST_F(SpdyReadQueueTest, OneByteEnqueueAndDequeueBuffers) { RunEnqueueDequeueTest(1, 1); } TEST_F(SpdyReadQueueTest, CoprimeBufferSizes) { RunEnqueueDequeueTest(2, 3); RunEnqueueDequeueTest(3, 2); } TEST_F(SpdyReadQueueTest, Clear) { auto buffer = base::MakeUnique<SpdyBuffer>(kData, kDataSize); bool discarded = false; size_t discarded_bytes = 0; buffer->AddConsumeCallback( base::Bind(&OnBufferDiscarded, &discarded, &discarded_bytes)); SpdyReadQueue read_queue; read_queue.Enqueue(std::move(buffer)); EXPECT_FALSE(discarded); EXPECT_EQ(0u, discarded_bytes); EXPECT_FALSE(read_queue.IsEmpty()); read_queue.Clear(); EXPECT_TRUE(discarded); EXPECT_EQ(kDataSize, discarded_bytes); EXPECT_TRUE(read_queue.IsEmpty()); } } // namespace test } // namespace net
[ "xElvis89x@gmail.com" ]
xElvis89x@gmail.com
adba9ce1cdda45f1cefadc0795914f61b3901927
1d9b1b78887bdff6dd5342807c4ee20f504a2a75
/lib/libcxx/include/__algorithm/make_projected.h
6c1d1567766751bd718aca8bc4cbfc0755c98cf7
[ "MIT", "LicenseRef-scancode-other-permissive", "NCSA", "LLVM-exception", "Apache-2.0" ]
permissive
mikdusan/zig
86831722d86f518d1734ee5a1ca89d3ffe9555e8
b2ffe113d3fd2835b25ddf2de1cc8dd49f5de722
refs/heads/master
2023-08-31T21:29:04.425401
2022-11-13T15:43:29
2022-11-13T15:43:29
173,955,807
1
0
MIT
2021-11-02T03:19:36
2019-03-05T13:52:53
Zig
UTF-8
C++
false
false
4,395
h
//===----------------------------------------------------------------------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef _LIBCPP___ALGORITHM_MAKE_PROJECTED_H #define _LIBCPP___ALGORITHM_MAKE_PROJECTED_H #include <__concepts/same_as.h> #include <__config> #include <__functional/identity.h> #include <__functional/invoke.h> #include <__type_traits/decay.h> #include <__type_traits/enable_if.h> #include <__type_traits/integral_constant.h> #include <__type_traits/is_member_pointer.h> #include <__type_traits/is_same.h> #include <__utility/declval.h> #include <__utility/forward.h> #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header #endif _LIBCPP_BEGIN_NAMESPACE_STD template <class _Pred, class _Proj> struct _ProjectedPred { _Pred& __pred; // Can be a unary or a binary predicate. _Proj& __proj; _LIBCPP_CONSTEXPR _ProjectedPred(_Pred& __pred_arg, _Proj& __proj_arg) : __pred(__pred_arg), __proj(__proj_arg) {} template <class _Tp> typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_Tp>())) >::type _LIBCPP_CONSTEXPR operator()(_Tp&& __v) const { return std::__invoke(__pred, std::__invoke(__proj, std::forward<_Tp>(__v))); } template <class _T1, class _T2> typename __invoke_of<_Pred&, decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T1>())), decltype(std::__invoke(std::declval<_Proj&>(), std::declval<_T2>())) >::type _LIBCPP_CONSTEXPR operator()(_T1&& __lhs, _T2&& __rhs) const { return std::__invoke(__pred, std::__invoke(__proj, std::forward<_T1>(__lhs)), std::__invoke(__proj, std::forward<_T2>(__rhs))); } }; template <class _Pred, class _Proj, class = void> struct __can_use_pristine_comp : false_type {}; template <class _Pred, class _Proj> struct __can_use_pristine_comp<_Pred, _Proj, __enable_if_t< !is_member_pointer<typename decay<_Pred>::type>::value && ( #if _LIBCPP_STD_VER > 17 is_same<typename decay<_Proj>::type, identity>::value || #endif is_same<typename decay<_Proj>::type, __identity>::value ) > > : true_type {}; template <class _Pred, class _Proj> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static __enable_if_t< !__can_use_pristine_comp<_Pred, _Proj>::value, _ProjectedPred<_Pred, _Proj> > __make_projected(_Pred& __pred, _Proj& __proj) { return _ProjectedPred<_Pred, _Proj>(__pred, __proj); } // Avoid creating the functor and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. Additionally, this results in less layers of indirection in // the call stack when the comparator is invoked, even in an unoptimized build. template <class _Pred, class _Proj> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR static __enable_if_t< __can_use_pristine_comp<_Pred, _Proj>::value, _Pred& > __make_projected(_Pred& __pred, _Proj&) { return __pred; } _LIBCPP_END_NAMESPACE_STD #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) _LIBCPP_BEGIN_NAMESPACE_STD namespace ranges { template <class _Comp, class _Proj1, class _Proj2> _LIBCPP_HIDE_FROM_ABI constexpr static decltype(auto) __make_projected_comp(_Comp& __comp, _Proj1& __proj1, _Proj2& __proj2) { if constexpr (same_as<decay_t<_Proj1>, identity> && same_as<decay_t<_Proj2>, identity> && !is_member_pointer_v<decay_t<_Comp>>) { // Avoid creating the lambda and just use the pristine comparator -- for certain algorithms, this would enable // optimizations that rely on the type of the comparator. return __comp; } else { return [&](auto&& __lhs, auto&& __rhs) { return std::invoke(__comp, std::invoke(__proj1, std::forward<decltype(__lhs)>(__lhs)), std::invoke(__proj2, std::forward<decltype(__rhs)>(__rhs))); }; } } } // namespace ranges _LIBCPP_END_NAMESPACE_STD #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES) #endif // _LIBCPP___ALGORITHM_MAKE_PROJECTED_H
[ "andrew@ziglang.org" ]
andrew@ziglang.org
c5dd97542bdee1b2859807f53c6dd4e4cb14427e
77861deda8b3046bdda221d3cb80b77e84b14523
/lookup-in-string-set/generated/pext_c.cpp
652a5cf51239797f60f0a2418043d660eb6aeec1
[ "BSD-2-Clause" ]
permissive
WojciechMula/toys
b73f09212ca19f1e76bbf2afaa5ad2efcea95175
6110b59de45dc1ce44388b21c6437eff49a7655c
refs/heads/master
2023-08-18T12:54:25.919406
2023-08-05T09:20:14
2023-08-05T09:20:14
14,905,115
302
44
BSD-2-Clause
2020-04-17T17:10:42
2013-12-03T20:35:37
C++
UTF-8
C++
false
false
7,089
cpp
//lookup: name=lookup_c_pext, type=pext, dataset=c int lookup_c_pext(std::string_view s) { switch (s.size()) { case 2: { if (s == "if") { return 0; } if (s == "do") { return 1; } } break; case 3: { if (s == "int") { return 2; } if (s == "for") { return 3; } } break; case 4: { static constexpr const char lookup[16][4] = { {}, // no match {'v', 'o', 'i', 'd'}, {'c', 'a', 's', 'e'}, {'e', 'l', 's', 'e'}, {}, // no match {'c', 'h', 'a', 'r'}, {}, // no match {'l', 'o', 'n', 'g'}, {}, // no match {}, // no match {}, // no match {'e', 'n', 'u', 'm'}, {}, // no match {}, // no match {'a', 'u', 't', 'o'}, {'g', 'o', 't', 'o'}, }; static constexpr const int value[16] = { -1, 10, 4, 8, -1, 5, -1, 9, -1, -1, -1, 11, -1, -1, 6, 7, }; uint32_t w0 = 0; memcpy(&w0, &s[0], 4); const uint64_t idx = _pext_u64(w0, 0xb000800); if (memcmp(lookup[idx], s.data(), sizeof(lookup[0])) == 0) { return value[idx]; } } break; case 5: { static constexpr const char lookup[16][5] = { {}, // no match {'b', 'r', 'e', 'a', 'k'}, {}, // no match {}, // no match {'w', 'h', 'i', 'l', 'e'}, {'u', 'n', 'i', 'o', 'n'}, {}, // no match {}, // no match {}, // no match {}, // no match {}, // no match {}, // no match {}, // no match {'f', 'l', 'o', 'a', 't'}, {'s', 'h', 'o', 'r', 't'}, {'c', 'o', 'n', 's', 't'}, }; static constexpr const int value[16] = { -1, 15, -1, -1, 16, 14, -1, -1, -1, -1, -1, -1, -1, 12, 13, 17, }; uint16_t w1 = 0; memcpy(&w1, &s[3], 2); const uint64_t idx = _pext_u64(w1, 0x1411); if (memcmp(lookup[idx], s.data(), sizeof(lookup[0])) == 0) { return value[idx]; } } break; case 6: { static constexpr const char lookup[16][6] = { {'s', 'i', 'g', 'n', 'e', 'd'}, {'s', 't', 'r', 'u', 'c', 't'}, {'d', 'o', 'u', 'b', 'l', 'e'}, {}, // no match {'s', 'i', 'z', 'e', 'o', 'f'}, {}, // no match {}, // no match {'s', 't', 'a', 't', 'i', 'c'}, {}, // no match {'s', 'w', 'i', 't', 'c', 'h'}, {}, // no match {}, // no match {'e', 'x', 't', 'e', 'r', 'n'}, {'r', 'e', 't', 'u', 'r', 'n'}, {}, // no match {}, // no match }; static constexpr const int value[16] = { 25, 21, 18, -1, 23, -1, -1, 19, -1, 24, -1, -1, 20, 22, -1, -1, }; uint32_t w2 = 0; memcpy(&w2, &s[2], 4); const uint64_t idx = _pext_u64(w2, 0xb001000); if (memcmp(lookup[idx], s.data(), sizeof(lookup[0])) == 0) { return value[idx]; } } break; case 7: { if (s == "typedef") { return 26; } if (s == "default") { return 27; } } break; case 8: { static constexpr const char lookup[8][8] = { {'u', 'n', 's', 'i', 'g', 'n', 'e', 'd'}, {}, // no match {'v', 'o', 'l', 'a', 't', 'i', 'l', 'e'}, {'c', 'o', 'n', 't', 'i', 'n', 'u', 'e'}, {'r', 'e', 'g', 'i', 's', 't', 'e', 'r'}, {}, // no match {}, // no match {}, // no match }; static constexpr const int value[8] = { 28, -1, 31, 29, 30, -1, -1, -1, }; uint16_t w3 = 0; memcpy(&w3, &s[6], 2); const uint64_t idx = _pext_u64(w3, 0x1110); if (memcmp(lookup[idx], s.data(), sizeof(lookup[0])) == 0) { return value[idx]; } } break; } return -1; } #include <cassert> //check: name=check_c_pext, type=pext, dataset=c void check_c_pext() { assert(lookup_c_pext("if") == 0); assert(lookup_c_pext("do") == 1); assert(lookup_c_pext("int") == 2); assert(lookup_c_pext("for") == 3); assert(lookup_c_pext("case") == 4); assert(lookup_c_pext("char") == 5); assert(lookup_c_pext("auto") == 6); assert(lookup_c_pext("goto") == 7); assert(lookup_c_pext("else") == 8); assert(lookup_c_pext("long") == 9); assert(lookup_c_pext("void") == 10); assert(lookup_c_pext("enum") == 11); assert(lookup_c_pext("float") == 12); assert(lookup_c_pext("short") == 13); assert(lookup_c_pext("union") == 14); assert(lookup_c_pext("break") == 15); assert(lookup_c_pext("while") == 16); assert(lookup_c_pext("const") == 17); assert(lookup_c_pext("double") == 18); assert(lookup_c_pext("static") == 19); assert(lookup_c_pext("extern") == 20); assert(lookup_c_pext("struct") == 21); assert(lookup_c_pext("return") == 22); assert(lookup_c_pext("sizeof") == 23); assert(lookup_c_pext("switch") == 24); assert(lookup_c_pext("signed") == 25); assert(lookup_c_pext("typedef") == 26); assert(lookup_c_pext("default") == 27); assert(lookup_c_pext("unsigned") == 28); assert(lookup_c_pext("continue") == 29); assert(lookup_c_pext("register") == 30); assert(lookup_c_pext("volatile") == 31); }
[ "wojciech_mula@poczta.onet.pl" ]
wojciech_mula@poczta.onet.pl
5362f7963b67dd33e38d933339d9ebec51ed3a5b
e63f3666a9737f971903c9a0f16e59e17e3b633e
/Thin3DTracker4Study/Thin3DTracker.h
e65a70f4d2335d30d5a80ab701555b5d930b605d
[]
no_license
kryssb/SySal2000
185687bf3b3f96ac6206829261e624efe88361c8
caa9764c5f0f9ae92d086535df25b86070120a40
refs/heads/master
2022-07-30T06:29:06.340578
2020-11-13T13:21:45
2020-11-13T13:21:45
312,532,909
0
0
null
null
null
null
UTF-8
C++
false
false
26,906
h
/* this ALWAYS GENERATED file contains the definitions for the interfaces */ /* File created by MIDL compiler version 5.01.0164 */ /* at Sun Mar 31 17:46:04 2002 */ /* Compiler settings for K:\SySal2\Thin3DTracker\Thin3DTracker.idl: Oicf (OptLev=i2), W1, Zp8, env=Win32, ms_ext, c_ext error checks: allocation ref bounds_check enum stub_data */ //@@MIDL_FILE_HEADING( ) /* verify that the <rpcndr.h> version is high enough to compile this file*/ #ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 440 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of <rpcndr.h> #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __Thin3DTracker_h__ #define __Thin3DTracker_h__ #ifdef __cplusplus extern "C"{ #endif /* Forward Declarations */ #ifndef __ISySalObject_FWD_DEFINED__ #define __ISySalObject_FWD_DEFINED__ typedef interface ISySalObject ISySalObject; #endif /* __ISySalObject_FWD_DEFINED__ */ #ifndef __ITracker_FWD_DEFINED__ #define __ITracker_FWD_DEFINED__ typedef interface ITracker ITracker; #endif /* __ITracker_FWD_DEFINED__ */ #ifndef __Thin3DTrk_FWD_DEFINED__ #define __Thin3DTrk_FWD_DEFINED__ #ifdef __cplusplus typedef class Thin3DTrk Thin3DTrk; #else typedef struct Thin3DTrk Thin3DTrk; #endif /* __cplusplus */ #endif /* __Thin3DTrk_FWD_DEFINED__ */ /* header files for imported files */ #include "oaidl.h" #include "ocidl.h" #include "Connection.h" #include "Config.h" #include "GUIdefs.h" #include "Cluster.h" #include "CameraSpec.h" #include "Track.h" void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); void __RPC_USER MIDL_user_free( void __RPC_FAR * ); #ifndef __ISySalObject_INTERFACE_DEFINED__ #define __ISySalObject_INTERFACE_DEFINED__ /* interface ISySalObject */ /* [unique][helpstring][uuid][object] */ EXTERN_C const IID IID_ISySalObject; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("C022EEAD-748A-11D3-A47B-E89C0BCE9720") ISySalObject : public IUnknown { public: virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetName( ConnectionName name) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetName( ConnectionName name) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetConfig( SySalConfig __RPC_FAR *pConfig) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetConfig( SySalConfig __RPC_FAR *pConfig) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EditConfig( SySalConfig __RPC_FAR *pConfig, HSySalHANDLE hWnd) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnableMonitor( boolean bEnable) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetNumberOfConnections( int __RPC_FAR *pNumber) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetConnection( int n, SySalConnection connection) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetConnection( int n, SySalConnection __RPC_FAR *pConnection) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetIcon( int n, HSySalHICON __RPC_FAR *pHICON) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetClassName( ConnectionName name) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SyncExec( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncExec( HSySalHANDLE HNotifyStatusChangeEvent) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncCheckStatus( long __RPC_FAR *pStatus) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncWait( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncPause( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncStop( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE AsyncResume( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE IsReady( long __RPC_FAR *pWrongConn, long __RPC_FAR *pRetCode) = 0; }; #else /* C style interface */ typedef struct ISySalObjectVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( ISySalObject __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( ISySalObject __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetName )( ISySalObject __RPC_FAR * This, ConnectionName name); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetName )( ISySalObject __RPC_FAR * This, ConnectionName name); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetConfig )( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetConfig )( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EditConfig )( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig, HSySalHANDLE hWnd); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnableMonitor )( ISySalObject __RPC_FAR * This, boolean bEnable); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetNumberOfConnections )( ISySalObject __RPC_FAR * This, int __RPC_FAR *pNumber); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetConnection )( ISySalObject __RPC_FAR * This, int n, SySalConnection connection); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetConnection )( ISySalObject __RPC_FAR * This, int n, SySalConnection __RPC_FAR *pConnection); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIcon )( ISySalObject __RPC_FAR * This, int n, HSySalHICON __RPC_FAR *pHICON); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClassName )( ISySalObject __RPC_FAR * This, ConnectionName name); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SyncExec )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncExec )( ISySalObject __RPC_FAR * This, HSySalHANDLE HNotifyStatusChangeEvent); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncCheckStatus )( ISySalObject __RPC_FAR * This, long __RPC_FAR *pStatus); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncWait )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncPause )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncStop )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AsyncResume )( ISySalObject __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *IsReady )( ISySalObject __RPC_FAR * This, long __RPC_FAR *pWrongConn, long __RPC_FAR *pRetCode); END_INTERFACE } ISySalObjectVtbl; interface ISySalObject { CONST_VTBL struct ISySalObjectVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define ISySalObject_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define ISySalObject_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define ISySalObject_Release(This) \ (This)->lpVtbl -> Release(This) #define ISySalObject_SetName(This,name) \ (This)->lpVtbl -> SetName(This,name) #define ISySalObject_GetName(This,name) \ (This)->lpVtbl -> GetName(This,name) #define ISySalObject_SetConfig(This,pConfig) \ (This)->lpVtbl -> SetConfig(This,pConfig) #define ISySalObject_GetConfig(This,pConfig) \ (This)->lpVtbl -> GetConfig(This,pConfig) #define ISySalObject_EditConfig(This,pConfig,hWnd) \ (This)->lpVtbl -> EditConfig(This,pConfig,hWnd) #define ISySalObject_EnableMonitor(This,bEnable) \ (This)->lpVtbl -> EnableMonitor(This,bEnable) #define ISySalObject_GetNumberOfConnections(This,pNumber) \ (This)->lpVtbl -> GetNumberOfConnections(This,pNumber) #define ISySalObject_SetConnection(This,n,connection) \ (This)->lpVtbl -> SetConnection(This,n,connection) #define ISySalObject_GetConnection(This,n,pConnection) \ (This)->lpVtbl -> GetConnection(This,n,pConnection) #define ISySalObject_GetIcon(This,n,pHICON) \ (This)->lpVtbl -> GetIcon(This,n,pHICON) #define ISySalObject_GetClassName(This,name) \ (This)->lpVtbl -> GetClassName(This,name) #define ISySalObject_SyncExec(This) \ (This)->lpVtbl -> SyncExec(This) #define ISySalObject_AsyncExec(This,HNotifyStatusChangeEvent) \ (This)->lpVtbl -> AsyncExec(This,HNotifyStatusChangeEvent) #define ISySalObject_AsyncCheckStatus(This,pStatus) \ (This)->lpVtbl -> AsyncCheckStatus(This,pStatus) #define ISySalObject_AsyncWait(This) \ (This)->lpVtbl -> AsyncWait(This) #define ISySalObject_AsyncPause(This) \ (This)->lpVtbl -> AsyncPause(This) #define ISySalObject_AsyncStop(This) \ (This)->lpVtbl -> AsyncStop(This) #define ISySalObject_AsyncResume(This) \ (This)->lpVtbl -> AsyncResume(This) #define ISySalObject_IsReady(This,pWrongConn,pRetCode) \ (This)->lpVtbl -> IsReady(This,pWrongConn,pRetCode) #endif /* COBJMACROS */ #endif /* C style interface */ /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_SetName_Proxy( ISySalObject __RPC_FAR * This, ConnectionName name); void __RPC_STUB ISySalObject_SetName_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetName_Proxy( ISySalObject __RPC_FAR * This, ConnectionName name); void __RPC_STUB ISySalObject_GetName_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_SetConfig_Proxy( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig); void __RPC_STUB ISySalObject_SetConfig_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetConfig_Proxy( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig); void __RPC_STUB ISySalObject_GetConfig_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_EditConfig_Proxy( ISySalObject __RPC_FAR * This, SySalConfig __RPC_FAR *pConfig, HSySalHANDLE hWnd); void __RPC_STUB ISySalObject_EditConfig_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_EnableMonitor_Proxy( ISySalObject __RPC_FAR * This, boolean bEnable); void __RPC_STUB ISySalObject_EnableMonitor_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetNumberOfConnections_Proxy( ISySalObject __RPC_FAR * This, int __RPC_FAR *pNumber); void __RPC_STUB ISySalObject_GetNumberOfConnections_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_SetConnection_Proxy( ISySalObject __RPC_FAR * This, int n, SySalConnection connection); void __RPC_STUB ISySalObject_SetConnection_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetConnection_Proxy( ISySalObject __RPC_FAR * This, int n, SySalConnection __RPC_FAR *pConnection); void __RPC_STUB ISySalObject_GetConnection_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetIcon_Proxy( ISySalObject __RPC_FAR * This, int n, HSySalHICON __RPC_FAR *pHICON); void __RPC_STUB ISySalObject_GetIcon_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_GetClassName_Proxy( ISySalObject __RPC_FAR * This, ConnectionName name); void __RPC_STUB ISySalObject_GetClassName_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_SyncExec_Proxy( ISySalObject __RPC_FAR * This); void __RPC_STUB ISySalObject_SyncExec_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncExec_Proxy( ISySalObject __RPC_FAR * This, HSySalHANDLE HNotifyStatusChangeEvent); void __RPC_STUB ISySalObject_AsyncExec_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncCheckStatus_Proxy( ISySalObject __RPC_FAR * This, long __RPC_FAR *pStatus); void __RPC_STUB ISySalObject_AsyncCheckStatus_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncWait_Proxy( ISySalObject __RPC_FAR * This); void __RPC_STUB ISySalObject_AsyncWait_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncPause_Proxy( ISySalObject __RPC_FAR * This); void __RPC_STUB ISySalObject_AsyncPause_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncStop_Proxy( ISySalObject __RPC_FAR * This); void __RPC_STUB ISySalObject_AsyncStop_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_AsyncResume_Proxy( ISySalObject __RPC_FAR * This); void __RPC_STUB ISySalObject_AsyncResume_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ISySalObject_IsReady_Proxy( ISySalObject __RPC_FAR * This, long __RPC_FAR *pWrongConn, long __RPC_FAR *pRetCode); void __RPC_STUB ISySalObject_IsReady_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __ISySalObject_INTERFACE_DEFINED__ */ #ifndef __ITracker_INTERFACE_DEFINED__ #define __ITracker_INTERFACE_DEFINED__ /* interface ITracker */ /* [unique][helpstring][uuid][object] */ EXTERN_C const IID IID_ITracker; #if defined(__cplusplus) && !defined(CINTERFACE) MIDL_INTERFACE("E416C46D-7F68-11D3-A47C-FA1E4AFA2721") ITracker : public IUnknown { public: virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE StartFilling( void) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE SetCameraSpec( CameraSpec Spec) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetCameraSpec( CameraSpec __RPC_FAR *pSpec) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE PutClusters( Cluster __RPC_FAR *pClusters, int CountOfClusters, float Z) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetTracks( Track __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, int StartLayer, int EndLayer) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetClusters( int Layer, Cluster __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, float __RPC_FAR *pZ) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE PresetSlope( float SX, float SY, float AccX, float AccY) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE EnableSlopePresetting( boolean SlPresEnable) = 0; virtual /* [helpstring] */ HRESULT STDMETHODCALLTYPE GetSlopePresetStatus( boolean __RPC_FAR *pSlPresEnable) = 0; }; #else /* C style interface */ typedef struct ITrackerVtbl { BEGIN_INTERFACE HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( ITracker __RPC_FAR * This, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject); ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( ITracker __RPC_FAR * This); ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( ITracker __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *StartFilling )( ITracker __RPC_FAR * This); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCameraSpec )( ITracker __RPC_FAR * This, CameraSpec Spec); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCameraSpec )( ITracker __RPC_FAR * This, CameraSpec __RPC_FAR *pSpec); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *PutClusters )( ITracker __RPC_FAR * This, Cluster __RPC_FAR *pClusters, int CountOfClusters, float Z); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetTracks )( ITracker __RPC_FAR * This, Track __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, int StartLayer, int EndLayer); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetClusters )( ITracker __RPC_FAR * This, int Layer, Cluster __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, float __RPC_FAR *pZ); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *PresetSlope )( ITracker __RPC_FAR * This, float SX, float SY, float AccX, float AccY); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnableSlopePresetting )( ITracker __RPC_FAR * This, boolean SlPresEnable); /* [helpstring] */ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSlopePresetStatus )( ITracker __RPC_FAR * This, boolean __RPC_FAR *pSlPresEnable); END_INTERFACE } ITrackerVtbl; interface ITracker { CONST_VTBL struct ITrackerVtbl __RPC_FAR *lpVtbl; }; #ifdef COBJMACROS #define ITracker_QueryInterface(This,riid,ppvObject) \ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) #define ITracker_AddRef(This) \ (This)->lpVtbl -> AddRef(This) #define ITracker_Release(This) \ (This)->lpVtbl -> Release(This) #define ITracker_StartFilling(This) \ (This)->lpVtbl -> StartFilling(This) #define ITracker_SetCameraSpec(This,Spec) \ (This)->lpVtbl -> SetCameraSpec(This,Spec) #define ITracker_GetCameraSpec(This,pSpec) \ (This)->lpVtbl -> GetCameraSpec(This,pSpec) #define ITracker_PutClusters(This,pClusters,CountOfClusters,Z) \ (This)->lpVtbl -> PutClusters(This,pClusters,CountOfClusters,Z) #define ITracker_GetTracks(This,pSpace,pMaxNumber,StartLayer,EndLayer) \ (This)->lpVtbl -> GetTracks(This,pSpace,pMaxNumber,StartLayer,EndLayer) #define ITracker_GetClusters(This,Layer,pSpace,pMaxNumber,pZ) \ (This)->lpVtbl -> GetClusters(This,Layer,pSpace,pMaxNumber,pZ) #define ITracker_PresetSlope(This,SX,SY,AccX,AccY) \ (This)->lpVtbl -> PresetSlope(This,SX,SY,AccX,AccY) #define ITracker_EnableSlopePresetting(This,SlPresEnable) \ (This)->lpVtbl -> EnableSlopePresetting(This,SlPresEnable) #define ITracker_GetSlopePresetStatus(This,pSlPresEnable) \ (This)->lpVtbl -> GetSlopePresetStatus(This,pSlPresEnable) #endif /* COBJMACROS */ #endif /* C style interface */ /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_StartFilling_Proxy( ITracker __RPC_FAR * This); void __RPC_STUB ITracker_StartFilling_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_SetCameraSpec_Proxy( ITracker __RPC_FAR * This, CameraSpec Spec); void __RPC_STUB ITracker_SetCameraSpec_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_GetCameraSpec_Proxy( ITracker __RPC_FAR * This, CameraSpec __RPC_FAR *pSpec); void __RPC_STUB ITracker_GetCameraSpec_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_PutClusters_Proxy( ITracker __RPC_FAR * This, Cluster __RPC_FAR *pClusters, int CountOfClusters, float Z); void __RPC_STUB ITracker_PutClusters_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_GetTracks_Proxy( ITracker __RPC_FAR * This, Track __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, int StartLayer, int EndLayer); void __RPC_STUB ITracker_GetTracks_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_GetClusters_Proxy( ITracker __RPC_FAR * This, int Layer, Cluster __RPC_FAR *pSpace, int __RPC_FAR *pMaxNumber, float __RPC_FAR *pZ); void __RPC_STUB ITracker_GetClusters_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_PresetSlope_Proxy( ITracker __RPC_FAR * This, float SX, float SY, float AccX, float AccY); void __RPC_STUB ITracker_PresetSlope_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_EnableSlopePresetting_Proxy( ITracker __RPC_FAR * This, boolean SlPresEnable); void __RPC_STUB ITracker_EnableSlopePresetting_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); /* [helpstring] */ HRESULT STDMETHODCALLTYPE ITracker_GetSlopePresetStatus_Proxy( ITracker __RPC_FAR * This, boolean __RPC_FAR *pSlPresEnable); void __RPC_STUB ITracker_GetSlopePresetStatus_Stub( IRpcStubBuffer *This, IRpcChannelBuffer *_pRpcChannelBuffer, PRPC_MESSAGE _pRpcMessage, DWORD *_pdwStubPhase); #endif /* __ITracker_INTERFACE_DEFINED__ */ #ifndef __THIN3DTRACKERLib_LIBRARY_DEFINED__ #define __THIN3DTRACKERLib_LIBRARY_DEFINED__ /* library THIN3DTRACKERLib */ /* [helpstring][version][uuid] */ EXTERN_C const IID LIBID_THIN3DTRACKERLib; EXTERN_C const CLSID CLSID_Thin3DTrk; #ifdef __cplusplus class DECLSPEC_UUID("27d4a7c9-05e8-4691-bb60-cbbc0c397dec") Thin3DTrk; #endif #endif /* __THIN3DTRACKERLib_LIBRARY_DEFINED__ */ /* Additional Prototypes for ALL interfaces */ /* end of Additional Prototypes */ #ifdef __cplusplus } #endif #endif
[ "cbozza@km3net.de" ]
cbozza@km3net.de
7bef4b43f7783e60948fc275517e3dbc490f92e8
94c8615196a08aa8704a56bb650fa1f49903592e
/projects/mandel/20180303-tmc-hls/hls/axi_stream_side_channel_data/proj_axi_stream_side_channel_data/solution1/syn/systemc/example.h
9cc4c8df6d980641864a47373f72b556a7ad9760
[ "MIT" ]
permissive
trevor-crowley/mylab
ee78b4096767567b195a4f31bf21096a33a90ae0
aa5af79c5aae47696697d058a6b906ba875dcd48
refs/heads/master
2021-05-09T02:28:58.804785
2021-04-16T17:12:43
2021-04-16T17:12:43
119,201,767
1
0
null
null
null
null
UTF-8
C++
false
false
17,538
h
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC // Version: 2017.4 // Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved. // // =========================================================== #ifndef _example_HH_ #define _example_HH_ #include "systemc.h" #include "AESL_pkg.h" namespace ap_rtl { struct example : public sc_module { // Port declarations 24 sc_in_clk ap_clk; sc_in< sc_logic > ap_rst_n; sc_in< sc_logic > ap_start; sc_out< sc_logic > ap_done; sc_out< sc_logic > ap_idle; sc_out< sc_logic > ap_ready; sc_in< sc_lv<32> > A_TDATA; sc_in< sc_logic > A_TVALID; sc_out< sc_logic > A_TREADY; sc_in< sc_lv<4> > A_TKEEP; sc_in< sc_lv<4> > A_TSTRB; sc_in< sc_lv<2> > A_TUSER; sc_in< sc_lv<1> > A_TLAST; sc_in< sc_lv<5> > A_TID; sc_in< sc_lv<6> > A_TDEST; sc_out< sc_lv<32> > B_TDATA; sc_out< sc_logic > B_TVALID; sc_in< sc_logic > B_TREADY; sc_out< sc_lv<4> > B_TKEEP; sc_out< sc_lv<4> > B_TSTRB; sc_out< sc_lv<2> > B_TUSER; sc_out< sc_lv<1> > B_TLAST; sc_out< sc_lv<5> > B_TID; sc_out< sc_lv<6> > B_TDEST; // Module declarations example(sc_module_name name); SC_HAS_PROCESS(example); ~example(); sc_trace_file* mVcdFile; ofstream mHdltvinHandle; ofstream mHdltvoutHandle; sc_signal< sc_logic > ap_rst_n_inv; sc_signal< sc_lv<4> > ap_CS_fsm; sc_signal< sc_logic > ap_CS_fsm_state1; sc_signal< sc_lv<32> > A_data_V_0_data_out; sc_signal< sc_logic > A_data_V_0_vld_in; sc_signal< sc_logic > A_data_V_0_vld_out; sc_signal< sc_logic > A_data_V_0_ack_in; sc_signal< sc_logic > A_data_V_0_ack_out; sc_signal< sc_lv<32> > A_data_V_0_payload_A; sc_signal< sc_lv<32> > A_data_V_0_payload_B; sc_signal< sc_logic > A_data_V_0_sel_rd; sc_signal< sc_logic > A_data_V_0_sel_wr; sc_signal< sc_logic > A_data_V_0_sel; sc_signal< sc_logic > A_data_V_0_load_A; sc_signal< sc_logic > A_data_V_0_load_B; sc_signal< sc_lv<2> > A_data_V_0_state; sc_signal< sc_logic > A_data_V_0_state_cmp_full; sc_signal< sc_lv<4> > A_keep_V_0_data_out; sc_signal< sc_logic > A_keep_V_0_vld_in; sc_signal< sc_logic > A_keep_V_0_vld_out; sc_signal< sc_logic > A_keep_V_0_ack_in; sc_signal< sc_logic > A_keep_V_0_ack_out; sc_signal< sc_lv<4> > A_keep_V_0_payload_A; sc_signal< sc_lv<4> > A_keep_V_0_payload_B; sc_signal< sc_logic > A_keep_V_0_sel_rd; sc_signal< sc_logic > A_keep_V_0_sel_wr; sc_signal< sc_logic > A_keep_V_0_sel; sc_signal< sc_logic > A_keep_V_0_load_A; sc_signal< sc_logic > A_keep_V_0_load_B; sc_signal< sc_lv<2> > A_keep_V_0_state; sc_signal< sc_logic > A_keep_V_0_state_cmp_full; sc_signal< sc_lv<4> > A_strb_V_0_data_out; sc_signal< sc_logic > A_strb_V_0_vld_in; sc_signal< sc_logic > A_strb_V_0_vld_out; sc_signal< sc_logic > A_strb_V_0_ack_in; sc_signal< sc_logic > A_strb_V_0_ack_out; sc_signal< sc_lv<4> > A_strb_V_0_payload_A; sc_signal< sc_lv<4> > A_strb_V_0_payload_B; sc_signal< sc_logic > A_strb_V_0_sel_rd; sc_signal< sc_logic > A_strb_V_0_sel_wr; sc_signal< sc_logic > A_strb_V_0_sel; sc_signal< sc_logic > A_strb_V_0_load_A; sc_signal< sc_logic > A_strb_V_0_load_B; sc_signal< sc_lv<2> > A_strb_V_0_state; sc_signal< sc_logic > A_strb_V_0_state_cmp_full; sc_signal< sc_lv<2> > A_user_V_0_data_out; sc_signal< sc_logic > A_user_V_0_vld_in; sc_signal< sc_logic > A_user_V_0_vld_out; sc_signal< sc_logic > A_user_V_0_ack_in; sc_signal< sc_logic > A_user_V_0_ack_out; sc_signal< sc_lv<2> > A_user_V_0_payload_A; sc_signal< sc_lv<2> > A_user_V_0_payload_B; sc_signal< sc_logic > A_user_V_0_sel_rd; sc_signal< sc_logic > A_user_V_0_sel_wr; sc_signal< sc_logic > A_user_V_0_sel; sc_signal< sc_logic > A_user_V_0_load_A; sc_signal< sc_logic > A_user_V_0_load_B; sc_signal< sc_lv<2> > A_user_V_0_state; sc_signal< sc_logic > A_user_V_0_state_cmp_full; sc_signal< sc_lv<1> > A_last_V_0_data_out; sc_signal< sc_logic > A_last_V_0_vld_in; sc_signal< sc_logic > A_last_V_0_vld_out; sc_signal< sc_logic > A_last_V_0_ack_in; sc_signal< sc_logic > A_last_V_0_ack_out; sc_signal< sc_lv<1> > A_last_V_0_payload_A; sc_signal< sc_lv<1> > A_last_V_0_payload_B; sc_signal< sc_logic > A_last_V_0_sel_rd; sc_signal< sc_logic > A_last_V_0_sel_wr; sc_signal< sc_logic > A_last_V_0_sel; sc_signal< sc_logic > A_last_V_0_load_A; sc_signal< sc_logic > A_last_V_0_load_B; sc_signal< sc_lv<2> > A_last_V_0_state; sc_signal< sc_logic > A_last_V_0_state_cmp_full; sc_signal< sc_lv<5> > A_id_V_0_data_out; sc_signal< sc_logic > A_id_V_0_vld_in; sc_signal< sc_logic > A_id_V_0_vld_out; sc_signal< sc_logic > A_id_V_0_ack_in; sc_signal< sc_logic > A_id_V_0_ack_out; sc_signal< sc_lv<5> > A_id_V_0_payload_A; sc_signal< sc_lv<5> > A_id_V_0_payload_B; sc_signal< sc_logic > A_id_V_0_sel_rd; sc_signal< sc_logic > A_id_V_0_sel_wr; sc_signal< sc_logic > A_id_V_0_sel; sc_signal< sc_logic > A_id_V_0_load_A; sc_signal< sc_logic > A_id_V_0_load_B; sc_signal< sc_lv<2> > A_id_V_0_state; sc_signal< sc_logic > A_id_V_0_state_cmp_full; sc_signal< sc_lv<6> > A_dest_V_0_data_out; sc_signal< sc_logic > A_dest_V_0_vld_in; sc_signal< sc_logic > A_dest_V_0_vld_out; sc_signal< sc_logic > A_dest_V_0_ack_in; sc_signal< sc_logic > A_dest_V_0_ack_out; sc_signal< sc_lv<6> > A_dest_V_0_payload_A; sc_signal< sc_lv<6> > A_dest_V_0_payload_B; sc_signal< sc_logic > A_dest_V_0_sel_rd; sc_signal< sc_logic > A_dest_V_0_sel_wr; sc_signal< sc_logic > A_dest_V_0_sel; sc_signal< sc_logic > A_dest_V_0_load_A; sc_signal< sc_logic > A_dest_V_0_load_B; sc_signal< sc_lv<2> > A_dest_V_0_state; sc_signal< sc_logic > A_dest_V_0_state_cmp_full; sc_signal< sc_lv<32> > B_data_V_1_data_out; sc_signal< sc_logic > B_data_V_1_vld_in; sc_signal< sc_logic > B_data_V_1_vld_out; sc_signal< sc_logic > B_data_V_1_ack_in; sc_signal< sc_logic > B_data_V_1_ack_out; sc_signal< sc_lv<32> > B_data_V_1_payload_A; sc_signal< sc_lv<32> > B_data_V_1_payload_B; sc_signal< sc_logic > B_data_V_1_sel_rd; sc_signal< sc_logic > B_data_V_1_sel_wr; sc_signal< sc_logic > B_data_V_1_sel; sc_signal< sc_logic > B_data_V_1_load_A; sc_signal< sc_logic > B_data_V_1_load_B; sc_signal< sc_lv<2> > B_data_V_1_state; sc_signal< sc_logic > B_data_V_1_state_cmp_full; sc_signal< sc_lv<4> > B_keep_V_1_data_out; sc_signal< sc_logic > B_keep_V_1_vld_in; sc_signal< sc_logic > B_keep_V_1_vld_out; sc_signal< sc_logic > B_keep_V_1_ack_in; sc_signal< sc_logic > B_keep_V_1_ack_out; sc_signal< sc_lv<4> > B_keep_V_1_payload_A; sc_signal< sc_lv<4> > B_keep_V_1_payload_B; sc_signal< sc_logic > B_keep_V_1_sel_rd; sc_signal< sc_logic > B_keep_V_1_sel_wr; sc_signal< sc_logic > B_keep_V_1_sel; sc_signal< sc_logic > B_keep_V_1_load_A; sc_signal< sc_logic > B_keep_V_1_load_B; sc_signal< sc_lv<2> > B_keep_V_1_state; sc_signal< sc_logic > B_keep_V_1_state_cmp_full; sc_signal< sc_lv<4> > B_strb_V_1_data_out; sc_signal< sc_logic > B_strb_V_1_vld_in; sc_signal< sc_logic > B_strb_V_1_vld_out; sc_signal< sc_logic > B_strb_V_1_ack_in; sc_signal< sc_logic > B_strb_V_1_ack_out; sc_signal< sc_lv<4> > B_strb_V_1_payload_A; sc_signal< sc_lv<4> > B_strb_V_1_payload_B; sc_signal< sc_logic > B_strb_V_1_sel_rd; sc_signal< sc_logic > B_strb_V_1_sel_wr; sc_signal< sc_logic > B_strb_V_1_sel; sc_signal< sc_logic > B_strb_V_1_load_A; sc_signal< sc_logic > B_strb_V_1_load_B; sc_signal< sc_lv<2> > B_strb_V_1_state; sc_signal< sc_logic > B_strb_V_1_state_cmp_full; sc_signal< sc_lv<2> > B_user_V_1_data_out; sc_signal< sc_logic > B_user_V_1_vld_in; sc_signal< sc_logic > B_user_V_1_vld_out; sc_signal< sc_logic > B_user_V_1_ack_in; sc_signal< sc_logic > B_user_V_1_ack_out; sc_signal< sc_lv<2> > B_user_V_1_payload_A; sc_signal< sc_lv<2> > B_user_V_1_payload_B; sc_signal< sc_logic > B_user_V_1_sel_rd; sc_signal< sc_logic > B_user_V_1_sel_wr; sc_signal< sc_logic > B_user_V_1_sel; sc_signal< sc_logic > B_user_V_1_load_A; sc_signal< sc_logic > B_user_V_1_load_B; sc_signal< sc_lv<2> > B_user_V_1_state; sc_signal< sc_logic > B_user_V_1_state_cmp_full; sc_signal< sc_lv<1> > B_last_V_1_data_out; sc_signal< sc_logic > B_last_V_1_vld_in; sc_signal< sc_logic > B_last_V_1_vld_out; sc_signal< sc_logic > B_last_V_1_ack_in; sc_signal< sc_logic > B_last_V_1_ack_out; sc_signal< sc_lv<1> > B_last_V_1_payload_A; sc_signal< sc_lv<1> > B_last_V_1_payload_B; sc_signal< sc_logic > B_last_V_1_sel_rd; sc_signal< sc_logic > B_last_V_1_sel_wr; sc_signal< sc_logic > B_last_V_1_sel; sc_signal< sc_logic > B_last_V_1_load_A; sc_signal< sc_logic > B_last_V_1_load_B; sc_signal< sc_lv<2> > B_last_V_1_state; sc_signal< sc_logic > B_last_V_1_state_cmp_full; sc_signal< sc_lv<5> > B_id_V_1_data_out; sc_signal< sc_logic > B_id_V_1_vld_in; sc_signal< sc_logic > B_id_V_1_vld_out; sc_signal< sc_logic > B_id_V_1_ack_in; sc_signal< sc_logic > B_id_V_1_ack_out; sc_signal< sc_lv<5> > B_id_V_1_payload_A; sc_signal< sc_lv<5> > B_id_V_1_payload_B; sc_signal< sc_logic > B_id_V_1_sel_rd; sc_signal< sc_logic > B_id_V_1_sel_wr; sc_signal< sc_logic > B_id_V_1_sel; sc_signal< sc_logic > B_id_V_1_load_A; sc_signal< sc_logic > B_id_V_1_load_B; sc_signal< sc_lv<2> > B_id_V_1_state; sc_signal< sc_logic > B_id_V_1_state_cmp_full; sc_signal< sc_lv<6> > B_dest_V_1_data_out; sc_signal< sc_logic > B_dest_V_1_vld_in; sc_signal< sc_logic > B_dest_V_1_vld_out; sc_signal< sc_logic > B_dest_V_1_ack_in; sc_signal< sc_logic > B_dest_V_1_ack_out; sc_signal< sc_lv<6> > B_dest_V_1_payload_A; sc_signal< sc_lv<6> > B_dest_V_1_payload_B; sc_signal< sc_logic > B_dest_V_1_sel_rd; sc_signal< sc_logic > B_dest_V_1_sel_wr; sc_signal< sc_logic > B_dest_V_1_sel; sc_signal< sc_logic > B_dest_V_1_load_A; sc_signal< sc_logic > B_dest_V_1_load_B; sc_signal< sc_lv<2> > B_dest_V_1_state; sc_signal< sc_logic > B_dest_V_1_state_cmp_full; sc_signal< sc_logic > A_TDATA_blk_n; sc_signal< sc_logic > ap_CS_fsm_state3; sc_signal< sc_logic > B_TDATA_blk_n; sc_signal< sc_logic > ap_CS_fsm_state4; sc_signal< sc_lv<6> > i_1_fu_122_p2; sc_signal< sc_lv<6> > i_1_reg_172; sc_signal< sc_logic > ap_CS_fsm_state2; sc_signal< bool > ap_block_state2; sc_signal< sc_lv<32> > val_assign_fu_162_p2; sc_signal< sc_lv<6> > i_reg_105; sc_signal< sc_lv<1> > exitcond_fu_116_p2; sc_signal< sc_lv<4> > ap_NS_fsm; static const sc_logic ap_const_logic_1; static const sc_logic ap_const_logic_0; static const sc_lv<4> ap_ST_fsm_state1; static const sc_lv<4> ap_ST_fsm_state2; static const sc_lv<4> ap_ST_fsm_state3; static const sc_lv<4> ap_ST_fsm_state4; static const sc_lv<32> ap_const_lv32_0; static const sc_lv<1> ap_const_lv1_0; static const sc_lv<1> ap_const_lv1_1; static const sc_lv<2> ap_const_lv2_0; static const sc_lv<2> ap_const_lv2_2; static const sc_lv<2> ap_const_lv2_3; static const sc_lv<2> ap_const_lv2_1; static const sc_lv<32> ap_const_lv32_2; static const sc_lv<32> ap_const_lv32_3; static const sc_lv<32> ap_const_lv32_1; static const sc_lv<6> ap_const_lv6_0; static const sc_lv<6> ap_const_lv6_32; static const sc_lv<6> ap_const_lv6_1; static const sc_lv<32> ap_const_lv32_5; static const bool ap_const_boolean_1; // Thread declarations void thread_ap_clk_no_reset_(); void thread_A_TDATA_blk_n(); void thread_A_TREADY(); void thread_A_data_V_0_ack_in(); void thread_A_data_V_0_ack_out(); void thread_A_data_V_0_data_out(); void thread_A_data_V_0_load_A(); void thread_A_data_V_0_load_B(); void thread_A_data_V_0_sel(); void thread_A_data_V_0_state_cmp_full(); void thread_A_data_V_0_vld_in(); void thread_A_data_V_0_vld_out(); void thread_A_dest_V_0_ack_in(); void thread_A_dest_V_0_ack_out(); void thread_A_dest_V_0_data_out(); void thread_A_dest_V_0_load_A(); void thread_A_dest_V_0_load_B(); void thread_A_dest_V_0_sel(); void thread_A_dest_V_0_state_cmp_full(); void thread_A_dest_V_0_vld_in(); void thread_A_dest_V_0_vld_out(); void thread_A_id_V_0_ack_in(); void thread_A_id_V_0_ack_out(); void thread_A_id_V_0_data_out(); void thread_A_id_V_0_load_A(); void thread_A_id_V_0_load_B(); void thread_A_id_V_0_sel(); void thread_A_id_V_0_state_cmp_full(); void thread_A_id_V_0_vld_in(); void thread_A_id_V_0_vld_out(); void thread_A_keep_V_0_ack_in(); void thread_A_keep_V_0_ack_out(); void thread_A_keep_V_0_data_out(); void thread_A_keep_V_0_load_A(); void thread_A_keep_V_0_load_B(); void thread_A_keep_V_0_sel(); void thread_A_keep_V_0_state_cmp_full(); void thread_A_keep_V_0_vld_in(); void thread_A_keep_V_0_vld_out(); void thread_A_last_V_0_ack_in(); void thread_A_last_V_0_ack_out(); void thread_A_last_V_0_data_out(); void thread_A_last_V_0_load_A(); void thread_A_last_V_0_load_B(); void thread_A_last_V_0_sel(); void thread_A_last_V_0_state_cmp_full(); void thread_A_last_V_0_vld_in(); void thread_A_last_V_0_vld_out(); void thread_A_strb_V_0_ack_in(); void thread_A_strb_V_0_ack_out(); void thread_A_strb_V_0_data_out(); void thread_A_strb_V_0_load_A(); void thread_A_strb_V_0_load_B(); void thread_A_strb_V_0_sel(); void thread_A_strb_V_0_state_cmp_full(); void thread_A_strb_V_0_vld_in(); void thread_A_strb_V_0_vld_out(); void thread_A_user_V_0_ack_in(); void thread_A_user_V_0_ack_out(); void thread_A_user_V_0_data_out(); void thread_A_user_V_0_load_A(); void thread_A_user_V_0_load_B(); void thread_A_user_V_0_sel(); void thread_A_user_V_0_state_cmp_full(); void thread_A_user_V_0_vld_in(); void thread_A_user_V_0_vld_out(); void thread_B_TDATA(); void thread_B_TDATA_blk_n(); void thread_B_TDEST(); void thread_B_TID(); void thread_B_TKEEP(); void thread_B_TLAST(); void thread_B_TSTRB(); void thread_B_TUSER(); void thread_B_TVALID(); void thread_B_data_V_1_ack_in(); void thread_B_data_V_1_ack_out(); void thread_B_data_V_1_data_out(); void thread_B_data_V_1_load_A(); void thread_B_data_V_1_load_B(); void thread_B_data_V_1_sel(); void thread_B_data_V_1_state_cmp_full(); void thread_B_data_V_1_vld_in(); void thread_B_data_V_1_vld_out(); void thread_B_dest_V_1_ack_in(); void thread_B_dest_V_1_ack_out(); void thread_B_dest_V_1_data_out(); void thread_B_dest_V_1_load_A(); void thread_B_dest_V_1_load_B(); void thread_B_dest_V_1_sel(); void thread_B_dest_V_1_state_cmp_full(); void thread_B_dest_V_1_vld_in(); void thread_B_dest_V_1_vld_out(); void thread_B_id_V_1_ack_in(); void thread_B_id_V_1_ack_out(); void thread_B_id_V_1_data_out(); void thread_B_id_V_1_load_A(); void thread_B_id_V_1_load_B(); void thread_B_id_V_1_sel(); void thread_B_id_V_1_state_cmp_full(); void thread_B_id_V_1_vld_in(); void thread_B_id_V_1_vld_out(); void thread_B_keep_V_1_ack_in(); void thread_B_keep_V_1_ack_out(); void thread_B_keep_V_1_data_out(); void thread_B_keep_V_1_load_A(); void thread_B_keep_V_1_load_B(); void thread_B_keep_V_1_sel(); void thread_B_keep_V_1_state_cmp_full(); void thread_B_keep_V_1_vld_in(); void thread_B_keep_V_1_vld_out(); void thread_B_last_V_1_ack_in(); void thread_B_last_V_1_ack_out(); void thread_B_last_V_1_data_out(); void thread_B_last_V_1_load_A(); void thread_B_last_V_1_load_B(); void thread_B_last_V_1_sel(); void thread_B_last_V_1_state_cmp_full(); void thread_B_last_V_1_vld_in(); void thread_B_last_V_1_vld_out(); void thread_B_strb_V_1_ack_in(); void thread_B_strb_V_1_ack_out(); void thread_B_strb_V_1_data_out(); void thread_B_strb_V_1_load_A(); void thread_B_strb_V_1_load_B(); void thread_B_strb_V_1_sel(); void thread_B_strb_V_1_state_cmp_full(); void thread_B_strb_V_1_vld_in(); void thread_B_strb_V_1_vld_out(); void thread_B_user_V_1_ack_in(); void thread_B_user_V_1_ack_out(); void thread_B_user_V_1_data_out(); void thread_B_user_V_1_load_A(); void thread_B_user_V_1_load_B(); void thread_B_user_V_1_sel(); void thread_B_user_V_1_state_cmp_full(); void thread_B_user_V_1_vld_in(); void thread_B_user_V_1_vld_out(); void thread_ap_CS_fsm_state1(); void thread_ap_CS_fsm_state2(); void thread_ap_CS_fsm_state3(); void thread_ap_CS_fsm_state4(); void thread_ap_block_state2(); void thread_ap_done(); void thread_ap_idle(); void thread_ap_ready(); void thread_ap_rst_n_inv(); void thread_exitcond_fu_116_p2(); void thread_i_1_fu_122_p2(); void thread_val_assign_fu_162_p2(); void thread_ap_NS_fsm(); void thread_hdltv_gen(); }; } using namespace ap_rtl; #endif
[ "trevor@luigilinux.local" ]
trevor@luigilinux.local
a6d067aea9204dd9063262142d074949d88ef7f0
9428509151ba90ce5f9530a4e5fc1f7b1e7a3232
/corrector.cpp
db226fa1c965226e51dd8a72015d0879e748bdb8
[]
no_license
georgejsh/lab
e0a7e3a8850bcb2bb30a368396a43744ea137303
c3c499b6e7f9151bf61497bf8b63338e718c2c4b
refs/heads/master
2021-01-20T21:07:11.261250
2018-01-23T14:09:58
2018-01-23T14:09:58
101,752,113
0
1
null
2017-10-15T16:11:21
2017-08-29T11:07:22
C++
UTF-8
C++
false
false
176
cpp
#include<bits/stdc++.h> using namespace std; int main(){ int a; int j=0; for(j=0;j<1000;j++){ cin>>a; cout<<a<<endl; } return 0; }
[ "georgejsh@gmail.com" ]
georgejsh@gmail.com
24cbd3428b6fb7c46d86e91eac6adf13267d840b
0ed97f1708adc8e77106fa2a900bbe23894a276d
/Homework-10/treeset/spellchecker.hpp
68a2802758a7d540330ddee0cc1d36c1cd41ab44
[]
no_license
Robert-Gonzalez/DataStructuresHWFall2016
f7890f1303ad0b64588903b2039a7da7c1b8cd01
55ec9de3340c8f5ce3afdef3436c8831bc088104
refs/heads/master
2021-01-16T02:47:27.858739
2017-08-11T03:52:24
2017-08-11T03:52:24
99,989,372
0
0
null
null
null
null
UTF-8
C++
false
false
2,179
hpp
/** * \file spellchecker.hpp * * \author hawk & reindeer, make it rein. * * \brief Interface for the spellchecker class * */ #include <string> #include <iostream> #include <list> #include "treeset.hpp" #ifndef SPELLCHECKER_HPP_INCLUDED #define SPELLCHECKER_HPP_INCLUDED 1 /** * \class SpellChecker * \brief allows us to check if words are correctly spelt by formatting them * to a dictionary and comparing to that dictionary * */ class SpellChecker { public: /** * \brief Populate our spell checker's dictionary with words * * * \param dictFile filename for the dictionary * \param debug Boolean to know if we want to be in debug mode * * * \note if debug is true, the function prints stats about the dictionary * */ void populateDict(const std::string& dictFile, bool debug); /** * \brief determine if a word is in dict, if not then it is not spelled correctly * * \param word word to analyze spelling of * * \return true if the word is spelled correctly * */ bool spelledCorrectly(const std::string& word); /** * \brief print suggestions for an incorrectly spelled word * * \param word word to check suggested variations * */ void printSuggestions(const std::string& word); /** * \brief get words from an instream, and print suggestions if they * are mispelled * * \param inputStream the stream to get words from * * */ void spellCheck(istream& inputStream); private: /** * \brief remove exterior symbols from a word * * \param str string to remove symbols from * * \return a string with the outer non-letters removed * */ std::string removeOuterPunct(const std::string& str); /** * \brief take string and make it all lowercase * * \param str string to make lowercase * * \return a string with all letters now lowercase * */ std::string lowercase(const std::string& str); TreeSet<std::string> dictionary; TreeSet<std::string> ignoredWords; }; #endif //* SPELLCHECKER_HPP_INCLUDED
[ "robertgonzalez.me@gmail.com" ]
robertgonzalez.me@gmail.com
c010d787e5022f8e1c84b2625b03283c82143b09
29accac928201357008780958a42ae54ca8299ba
/Potyczki Algorytmiczne/kos.cpp
1a71b98324c8a2093bb47928b67fcec7483c2d71
[]
no_license
xorver/Liceum
4df3cc7716810f06f569abd2a8ed05d9b6fb1854
829fa3765d96d95a0d4fbb65e7c1fab498063509
refs/heads/master
2021-01-10T20:38:40.734041
2014-03-08T16:36:34
2014-03-08T16:36:34
null
0
0
null
null
null
null
UTF-8
C++
false
false
699
cpp
#include<cstdio> #include<cmath> #include<iostream> using namespace std; double tab[2000000]; double Potega(double Podstawa, double Wykladnik) { return (exp(log(Podstawa)*Wykladnik)); } void wypelnij() { tab[0]=0; for(int i=1;i<2000000;i++) tab[i]=log2(i); } main () { int t,n,k; scanf("%d", &t); double wynik=0; wypelnij(); for(int i=0;i<t;i++) { scanf("%d %d", &n, &k); //n-ile razy rzuca , k-ilosc oczek wynik=0; wynik-=n*tab[6]; for(int i=1;i<=n+k-2;i++) { wynik+=tab[i]; if(n-1>=i) wynik-=tab[i]; if(i<=k-1) wynik-=tab[i]; } if((k/6)!=0) printf("%lf", Potega(2,wynik)); cout<<" "<<n<<" "<<k<<" "<<wynik<<endl; cout << log2(x+1)<<" "<<x; } return 0; }
[ "xorver@gmail.com" ]
xorver@gmail.com
56e9016646d5120eb628c874ef07c85ce855472c
df1141ebcb49c4a7384fba1ccc68e248db3414d0
/src/updatenet.cpp
8221f0f9280887e20a13ae9b115e5bd782d98688
[]
no_license
kwt-klure/PartialNetwork
30719156be8c6cb942da2b43667bb89ac5022f87
1267bf309b5e8d4496b27851c36861ce0592a9eb
refs/heads/master
2022-12-06T11:36:41.470001
2020-09-03T18:23:39
2020-09-03T18:23:39
null
0
0
null
null
null
null
UTF-8
C++
false
false
15,180
cpp
// [[Rcpp::depends(RcppArmadillo, RcppEigen)]] #include <RcppArmadillo.h> #include <RcppArmadilloExtensions/sample.h> #define NDEBUG 1 #include <RcppEigen.h> #include "tools.h" using namespace Rcpp; //using namespace arma; using namespace std; //using namespace Eigen; //using namespace Numer; // compute the block of the line arma::vec cBlock( const int& nupmax, const int& NJ, int& NJeff) { arma::vec out = cumsum(Rcpp::RcppArmadillo::sample(arma::linspace(1,nupmax,nupmax), NJ, true)) - 1; out = out.elem(arma::find(out <= (NJ - 1))); out = arma::join_cols(-arma::ones(1), out); NJeff = out.n_elem - 1; if(out(NJeff) != (NJ - 1)){ out = arma::join_cols(out, arma::ones(1)*(NJ - 1)); NJeff += 1; } return out; } // USE A WAY TO QUICLY COMPUTE THE DET AND THE INVERSE // A Structural Model for the Coevolution of Networks and Behavior // Return one G from G|y one step of MCMC void updGnorm (List& Gnorm, const List& prior, const List& ListIndex, const Rcpp::IntegerVector& N, const int& M, const List& y, List& A, List& Ay, const List& Xb, const List& Xgamma, const double& alpha, const double& sigma2) { for(int m(0); m<M; ++m){ int Nm = N(m); Eigen::MatrixXd eyeM = Eigen::MatrixXd::Identity(Nm,Nm); Eigen::VectorXd ym = y[m]; Eigen::VectorXd Xmb = Xb[m]; Eigen::VectorXd Xmgamma = Xgamma[m]; Eigen::MatrixXd priorm = prior(m); //Copy G[m] Eigen::MatrixXd Gmnorm = Gnorm(m); List IndexM = ListIndex[m]; arma::vec IndexMI = IndexM[0]; // index row to update List IndexMIJ = IndexM[1]; // in index tow i, the colums to update int NI = IndexMI.n_elem; if (NI == 0) continue; Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; Eigen::MatrixXd invAm = Am.inverse(); double detAm = Am.determinant(); for(int ci(0); ci<NI; ++ci){ int i = IndexMI(ci); Eigen::RowVectorXd Gmrowi = Gmnorm.row(i).array().ceil(); int ni = Gmrowi.sum(); arma::vec IndexMJ = IndexMIJ[ci]; int NJ = IndexMJ.n_elem; for(int cj(0); cj<NJ; ++cj){ int j = IndexMJ(cj); double l = Am(i, j); int gij1 = (l == 0); // new link int ni1 = ni + gij1 - (gij1 == 0); double Aii1 = 1, Aij1 = -alpha*gij1*1.0; if (ni != 0 && ni1 != 0) { Aii1 = ni1*1.0/ni; Aij1 = -alpha*gij1*1.0/ni; } double eps_1 = Aii1 - 1.0; double eps_2 = Aij1 - l; Eigen::MatrixXd Am1 = Am; Am1(i, i) = Aii1; Am1(i, j) = Aij1; Eigen::MatrixXd invAm1 = invmodijk (invAm, i, i, j, eps_1, eps_2); double detAm1 = detmodijk (detAm, invAm, i, i, j, eps_1, eps_2); // normalization Am1.row(i) /= Aii1; invAm1.col(i) *= Aii1; detAm1 /= Aii1; Eigen::MatrixXd Gmnorm1 = Gmnorm; Gmnorm1(i,j) = gij1; Gmnorm1.row(i) = Gmnorm1.row(i).array().ceil(); double rs = Gmnorm1.row(i).sum(); if(rs>0){ Gmnorm1.row(i) /= rs; } //cout<<ci<<"/"<<NI<<" "<<cj<<"/"<<NJ<<endl; Eigen::Array2d PROB; Eigen::VectorXd tmpxb = Am*ym - Xmb - Gmnorm*Xmgamma; double tmpdot = (double) (0.5/sigma2)*tmpxb.transpose()*tmpxb; PROB(1 - gij1) = -0.5*Nm*log(sigma2) + log(detAm) - tmpdot; tmpxb = Am1*ym - Xmb - Gmnorm1*Xmgamma; tmpdot = (double) (0.5/sigma2)*tmpxb.transpose()*tmpxb; PROB(gij1) = -0.5*Nm*log(sigma2) + log(detAm1) - tmpdot; //Normalization and prior double maxprob = PROB.maxCoeff(); PROB -= maxprob; PROB = PROB.exp(); PROB(0) *= (1-priorm(i,j)); PROB(1) *= priorm(i,j); double sumprob = PROB.sum(); PROB /= sumprob; int gijsel = (unif_rand()<PROB(1));//arma::conv_to<int>::from(Rcpp::RcppArmadillo::sample_main(arma::linspace(0,1,2),1,false,PROB)); if (gijsel == gij1) { Am = Am1; invAm = invAm1; detAm = detAm1; Gmnorm = Gmnorm1; ni = ni1; } } } //Gnorm Gnorm[m] = Gmnorm; // A A[m] = Am; // Ay Eigen::VectorXd Amy = Am*ym; Ay[m] = Amy; } } void updGnormnoc (List& Gnorm, const List& prior, const List& ListIndex, const Rcpp::IntegerVector& N, const int& M, const List& y, List& A, List& Ay, const List& Xb, const double& alpha, const double& sigma2) { for(int m(0); m<M; ++m){ int Nm = N(m); Eigen::MatrixXd eyeM = Eigen::MatrixXd::Identity(Nm,Nm); Eigen::VectorXd ym = y[m]; Eigen::VectorXd Xmb = Xb[m]; Eigen::MatrixXd priorm = prior(m); //Copy G[m] Eigen::MatrixXd Gmnorm = Gnorm(m); List IndexM = ListIndex[m]; arma::vec IndexMI = IndexM[0]; // index row to update List IndexMIJ = IndexM[1]; // in index tow i, the colums to update int NI = IndexMI.n_elem; if (NI == 0) continue; Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; Eigen::MatrixXd invAm = Am.inverse(); double detAm = Am.determinant(); for(int ci(0); ci<NI; ++ci){ int i = IndexMI(ci); Eigen::RowVectorXd Gmrowi = Gmnorm.row(i).array().ceil(); int ni = Gmrowi.sum(); arma::vec IndexMJ = IndexMIJ[ci]; int NJ = IndexMJ.n_elem; for(int cj(0); cj<NJ; ++cj){ int j = IndexMJ(cj); double l = Am(i, j); int gij1 = (l == 0); // new link int ni1 = ni + gij1 - (gij1 == 0); double Aii1 = 1, Aij1 = -alpha*gij1*1.0; if (ni != 0 && ni1 != 0) { Aii1 = ni1*1.0/ni; Aij1 = -alpha*gij1*1.0/ni; } double eps_1 = Aii1 - 1.0; double eps_2 = Aij1 - l; Eigen::MatrixXd Am1 = Am; Am1(i, i) = Aii1; Am1(i, j) = Aij1; Eigen::MatrixXd invAm1 = invmodijk (invAm, i, i, j, eps_1, eps_2); double detAm1 = detmodijk (detAm, invAm, i, i, j, eps_1, eps_2); // normalization Am1.row(i) /= Aii1; invAm1.col(i) *= Aii1; detAm1 /= Aii1; Eigen::MatrixXd Gmnorm1 = Gmnorm; Gmnorm1(i,j) = gij1; Gmnorm1.row(i) = Gmnorm1.row(i).array().ceil(); double rs = Gmnorm1.row(i).sum(); if(rs>0){ Gmnorm1.row(i) /= rs; } //cout<<ci<<"/"<<NI<<" "<<cj<<"/"<<NJ<<endl; Eigen::Array2d PROB; Eigen::VectorXd tmpxb = Am*ym - Xmb; double tmpdot = (double) (0.5/sigma2)*tmpxb.transpose()*tmpxb; PROB(1 - gij1) = -0.5*Nm*log(sigma2) + log(detAm) - tmpdot; tmpxb = Am1*ym - Xmb; tmpdot = (double) (0.5/sigma2)*tmpxb.transpose()*tmpxb; PROB(gij1) = -0.5*Nm*log(sigma2) + log(detAm1) - tmpdot; //Normalization and prior double maxprob = PROB.maxCoeff(); PROB -= maxprob; PROB = PROB.exp(); PROB(0) *= (1-priorm(i,j)); PROB(1) *= priorm(i,j); double sumprob = PROB.sum(); PROB /= sumprob; int gijsel = (unif_rand()<PROB(1));//arma::conv_to<int>::from(Rcpp::RcppArmadillo::sample_main(arma::linspace(0,1,2),1,false,PROB)); if (gijsel == gij1) { Am = Am1; invAm = invAm1; detAm = detAm1; Gmnorm = Gmnorm1; ni = ni1; } } } //Gnorm Gnorm[m] = Gmnorm; // A A[m] = Am; // Ay Eigen::VectorXd Amy = Am*ym; Ay[m] = Amy; } } void updGnormblock (List& Gnorm, const List& prior, const List& ListIndex, const Rcpp::IntegerVector& N, const int& M, const List& y, List& A, List& Ay, const List& Xb, const List& Xgamma, const double& alpha, const double& sigma2, const int& nupmax) { for(int m(0); m<M; ++m){ int Nm = N(m); Eigen::MatrixXd eyeM = Eigen::MatrixXd::Identity(Nm,Nm); Eigen::VectorXd ym = y[m]; Eigen::VectorXd Xmb = Xb[m]; Eigen::VectorXd Xmgamma = Xgamma[m]; Eigen::MatrixXd priorm = prior(m); //Copy G[m] Eigen::MatrixXd Gmnorm = Gnorm(m); List IndexM = ListIndex[m]; arma::vec IndexMI = IndexM[0]; List IndexMIJ = IndexM[1]; int NI = IndexMI.n_elem; for(int ci(0); ci<NI; ++ci){ // line int i = IndexMI(ci); // compute N cofactor for row i Eigen::VectorXd Cofator(N(m)); Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; removeRow(Am,i); arma::vec IndexMJ = IndexMIJ[ci]; int NJ = IndexMJ.n_elem; for(int j(0); j < N(m); ++j) { Eigen::MatrixXd Amtemp = Am; removeColumn(Amtemp,j); Cofator(j) = Amtemp.determinant()*pow(-1,i+j); } // permutations and blocks int NJeff; IndexMJ = Rcpp::RcppArmadillo::sample(IndexMJ, NJ, false); arma::vec Blocks = cBlock(nupmax, NJ, NJeff); for(int cj(0); cj<NJeff; ++cj){ arma::vec index_col = IndexMJ.subvec(Blocks(cj) + 1, Blocks(cj+1)); int nupdate = Blocks(cj+1) - Blocks(cj); int poss = pow(2, nupdate); // number of possibility arma::mat cposs = possentries(nupdate, poss); // the possibility arma::vec PROB(poss), prior_block(poss); for (int l(0); l < poss; ++ l) { double prior_blockl = 1; updselel(Gmnorm, prior_blockl, priorm, i, index_col, cposs.row(l), nupdate); Gmnorm.row(i)=Gmnorm.row(i).array().ceil(); double rs = Gmnorm.row(i).sum(); if(rs>0){ Gmnorm.row(i) /= rs; } Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; Eigen::VectorXd Amy = Am*ym; Eigen::VectorXd GmXmgamma = Gmnorm*Xmgamma; PROB(l) = ((Am.row(i)*Cofator).log() - (0.5/sigma2)*(Amy.transpose()*(Amy - 2*Xmb - 2*GmXmgamma) + GmXmgamma.transpose()*(2*Xmb + GmXmgamma)))(0); prior_block(l) = prior_blockl; } //Normalization and prior PROB = exp(PROB - max(PROB)); PROB = PROB%prior_block; PROB = PROB / sum(PROB); int l = sum(Rcpp::RcppArmadillo::sample_main(arma::linspace(0, poss - 1, poss), 1, true, PROB)); double prior_blockl = 1; updselel(Gmnorm, prior_blockl, priorm, i, index_col, cposs.row(l), nupdate); Gmnorm.row(i)=Gmnorm.row(i).array().ceil(); double rs = Gmnorm.row(i).sum(); if(rs>0){ Gmnorm.row(i) /= rs; } } } //Gnorm Gnorm[m] = Gmnorm; // A Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; A[m] = Am; // Ay Eigen::VectorXd Amy = Am*ym; Ay[m] = Amy; } } void updGnormblocknoc (List& Gnorm, const List& prior, const List& ListIndex, const Rcpp::IntegerVector& N, const int& M, const List& y, List& A, List& Ay, const List& Xb, const double& alpha, const double& sigma2, const int& nupmax) { for(int m(0); m<M; ++m){ int Nm = N(m); Eigen::MatrixXd eyeM = Eigen::MatrixXd::Identity(Nm,Nm); Eigen::VectorXd ym = y[m]; Eigen::VectorXd Xmb = Xb[m]; Eigen::MatrixXd priorm = prior(m); //Copy G[m] Eigen::MatrixXd Gmnorm = Gnorm(m); List IndexM = ListIndex[m]; arma::vec IndexMI = IndexM[0]; List IndexMIJ = IndexM[1]; int NI = IndexMI.n_elem; for(int ci(0); ci<NI; ++ci){ // line int i = IndexMI(ci); // compute N cofactor for row i Eigen::VectorXd Cofator(N(m)); Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; removeRow(Am,i); arma::vec IndexMJ = IndexMIJ[ci]; int NJ = IndexMJ.n_elem; for(int j(0); j < N(m); ++j) { Eigen::MatrixXd Amtemp = Am; removeColumn(Amtemp,j); Cofator(j) = Amtemp.determinant()*pow(-1,i+j); } // permutations and blocks int NJeff; IndexMJ = Rcpp::RcppArmadillo::sample(IndexMJ, NJ, false); arma::vec Blocks = cBlock(nupmax, NJ, NJeff); for(int cj(0); cj<NJeff; ++cj){ arma::vec index_col = IndexMJ.subvec(Blocks(cj) + 1, Blocks(cj+1)); int nupdate = Blocks(cj+1) - Blocks(cj); int poss = pow(2, nupdate); // number of possibility arma::mat cposs = possentries(nupdate, poss); // the possibility arma::vec PROB(poss), prior_block(poss); for (int l(0); l < poss; ++ l) { double prior_blockl = 1; updselel(Gmnorm, prior_blockl, priorm, i, index_col, cposs.row(l), nupdate); Gmnorm.row(i)=Gmnorm.row(i).array().ceil(); double rs = Gmnorm.row(i).sum(); if(rs>0){ Gmnorm.row(i) /= rs; } Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; Eigen::VectorXd Amy = Am*ym; PROB(l) = ((Am.row(i)*Cofator).log() - (0.5/sigma2)*(Amy.transpose()*(Amy - 2*Xmb)))(0); prior_block(l) = prior_blockl; } //Normalization and prior PROB = exp(PROB - max(PROB)); PROB = PROB%prior_block; PROB = PROB / sum(PROB); int l = sum(Rcpp::RcppArmadillo::sample_main(arma::linspace(0, poss - 1, poss), 1, true, PROB)); double prior_blockl = 1; updselel(Gmnorm, prior_blockl, priorm, i, index_col, cposs.row(l), nupdate); Gmnorm.row(i)=Gmnorm.row(i).array().ceil(); double rs = Gmnorm.row(i).sum(); if(rs>0){ Gmnorm.row(i) /= rs; } } } //Gnorm Gnorm[m] = Gmnorm; // A Eigen::MatrixXd Am = eyeM-alpha*Gmnorm; A[m] = Am; // Ay Eigen::VectorXd Amy = Am*ym; Ay[m] = Amy; } }
[ "elysee-aristide.houndetoungan.1@ulaval.ca" ]
elysee-aristide.houndetoungan.1@ulaval.ca
604cc220c503b87da8d217d78a6dab292e0acdea
41a5ca401fc78892fce86ccdb2b3ecf97f1e259d
/main.cpp
ee5d80f3a37c7d36b1a2e0c62c50668adc73bc16
[ "MIT" ]
permissive
TheTimmy/CrankNicolson
0bee220cf0c6ce48475751772311f43dd2e0507d
44e2e5e3fa07af17444f1e341e9021c47ab87601
refs/heads/master
2020-03-28T10:42:53.919813
2018-09-10T10:49:54
2018-09-10T10:49:54
148,137,243
0
1
null
null
null
null
UTF-8
C++
false
false
1,603
cpp
#include <iostream> #include <complex> #include <fstream> #include <boost/program_options/options_description.hpp> #include <boost/program_options/parsers.hpp> #include <boost/program_options/variables_map.hpp> #include <boost/tokenizer.hpp> #include <boost/token_functions.hpp> #include "simulationexecutor.h" #include "TridiagonalMatrix.h" using namespace boost; using namespace boost::program_options; int main(int argc, char** argv) { options_description desc( "Crank Nicolson solver for one dimensional waves.\n" "This program solves the timedependent Schroedinger equation\n" "for one dimensional waves.\n" "The only parameter which is nessesary is the simulation file.\n" "This simulation file contains the data and\na path to a script to run a simulation.\n" ); desc.add_options() ("help,h", "Show this help text") ("files,f", value<std::vector<std::string>>(), "Simulation files"); variables_map vm; try { store(command_line_parser(argc, argv).options(desc).run(), vm); notify(vm); } catch (std::exception &e) { std::cout << e.what() << std::endl; std::cout << desc << std::endl; } if (vm.count("help")) { desc.print(std::cout); } if (vm.count("files")) { std::vector<std::string> files = vm["files"].as<std::vector<std::string>>(); for (auto file : files) { std::cout << "process file: " << file << std::endl; SimulationExecutor(file.c_str()); //only call constructor } } return 0; }
[ "Tim-Rolff@web.de" ]
Tim-Rolff@web.de
c71790e62279f833327a6a7fc4a670bc98d83e38
f10a30ac7d297a156c08d54f810e500173f174c3
/pyramideimage.h
0750bb037d83b00b2016d86ba78db62f6c14a336
[]
no_license
Poletayson/ImageProcessing_1
7eede01c1b863e6a8e1f6418d53fc1a8920c565d
a72ebde8d79e9fb3d9727b6aa1de89500f36594d
refs/heads/master
2021-01-07T03:44:21.629404
2020-05-12T15:12:58
2020-05-12T15:12:58
241,569,813
0
0
null
null
null
null
UTF-8
C++
false
false
695
h
#ifndef PYRAMIDEIMAGE_H #define PYRAMIDEIMAGE_H #include "idoubleimage.h"; #include "doubleimagergb.h"; class PyramideImage { int octaveNum; int layerNum; IDoubleImage *image; double sigmaLocal; double sigmaEffective; public: PyramideImage(IDoubleImage *img, int octave, int layer); int getOctaveNum() const; void setOctaveNum(int value); int getLayerNum() const; void setLayerNum(int value); IDoubleImage *getImage() const; void setImage(IDoubleImage *value); double getSigmaLocal() const; void setSigmaLocal(double value); double getSigmaEffective() const; void setSigmaEffective(double value); }; #endif // PYRAMIDEIMAGE_H
[ "dmitriipoletaev_1997@mail.ru" ]
dmitriipoletaev_1997@mail.ru
37afcece661fcf5ed9c5589f25f3d5ce8c0bd56f
be4952850ad6a8b0abe50de671c495c6add9fae7
/hdu/2101.cpp
4bfef3d291584596efeafee772c5d8ae00c00eea
[]
no_license
ss5ssmi/OJ
296cb936ecf7ef292e91f24178c9c08bd2d241b5
267184cef5f1bc1f222950a71fe705bbc5f0bb3e
refs/heads/master
2022-10-29T18:15:14.290028
2022-10-12T04:42:47
2022-10-12T04:42:47
103,818,651
0
0
null
null
null
null
UTF-8
C++
false
false
162
cpp
#include<stdio.h> int main(){ int a,b; while(scanf("%d%d",&a,&b)!=EOF){ if((a+b)%86==0){ printf("yes\n"); }else{ printf("no\n"); } } return 0; }
[ "imss5ss@outlook.com" ]
imss5ss@outlook.com
0ead435a3791aea27f77a065e8a3c7ba3cc59a35
129f39703b10b5684825ce8626d3a4e908970fad
/source/compiler-core/slang-llvm-compiler.h
a05e1fed9b1341abddf4f44fe9a37ddeb067b85e
[ "MIT", "Apache-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain" ]
permissive
shader-slang/slang
80f417524c9e023ff6e4f4b0210964bf46c76278
f94b2f7a328a898c5e3dc1389d08e0b7ce6e092e
refs/heads/master
2023-08-19T03:17:26.436967
2023-08-18T19:48:46
2023-08-18T19:48:46
93,882,897
1,269
117
MIT
2023-09-14T20:57:11
2017-06-09T17:42:49
C++
UTF-8
C++
false
false
345
h
#ifndef SLANG_LLVM_COMPILER_UTIL_H #define SLANG_LLVM_COMPILER_UTIL_H #include "slang-downstream-compiler-util.h" #include "../core/slang-platform.h" namespace Slang { struct LLVMDownstreamCompilerUtil { static SlangResult locateCompilers(const String& path, ISlangSharedLibraryLoader* loader, DownstreamCompilerSet* set); }; } #endif
[ "noreply@github.com" ]
noreply@github.com
9a436531017aea07435bbaeba70a6f3e9ad45561
0744a4c89e609d59d7a3ebf21aa2a60fdb302c12
/include/util.h
2674fb659ebdae817bcca9b00ba23ce93c8e4713
[]
no_license
hui811116/MLDS_HW3
35ab239ce1a500749994e80679f2ab3361e18496
6d8dc80d94f22f5ef98303a3d5ceceaa1543779a
refs/heads/master
2021-03-12T22:33:35.327484
2015-06-10T16:09:17
2015-06-10T16:09:17
35,465,108
0
0
null
null
null
null
UTF-8
C++
false
false
435
h
#ifndef UTIL_H #define UTIL_H #include "mynngen.h" #include "host_matrix.h" using namespace std; typedef host_matrix<float> mat; extern myNnGen gn; extern void rand_init(mat& w,float range=1); extern void rand_norm(mat& w,myNnGen& ran=gn); extern void pushOne(mat& in); extern void parseDim(string str, vector<size_t>& dim); /* extern void getBias(mat& out,const mat& w); extern void replaceBias(mat& w,const mat& bias); */ #endif
[ "hui811116@outlook.com" ]
hui811116@outlook.com
5d4b38511f22c71a02e0eb97802403deada8fff3
1ba9f1e8b37d1aa19fc85acbf08a0da722b111ec
/include/HID.h
98634b2ccac091ba830152f4872ed89690b7ac09
[]
no_license
sebafreeskate/FreezingCore
69071dee453a5c7b43653204a3f465bfeefa4423
9cebca6db8e8339e69c844b219d088e9d506a417
refs/heads/master
2018-11-09T22:35:53.713175
2018-08-21T09:07:19
2018-08-21T09:07:19
104,931,584
1
0
null
null
null
null
UTF-8
C++
false
false
197
h
#pragma once #include <GLFW/glfw3.h> #include "enums.h" class HID { public: HID(GLFWwindow *window); virtual ~HID(); virtual Direction getMovement() = 0; protected: GLFWwindow *window; };
[ "sebafreeskate@gmail.com" ]
sebafreeskate@gmail.com
d2b817fd98468901000bf36d804af7f0de541196
14508f7aa131f53ba7c464e7273867524fe95003
/dir.h
e7ceea5e47151ca9d2a8e90ec369245010ab0a2a
[]
no_license
oneplus1000/slpac
dcc741a63171ef29ec2d5cf958a2b508f3093737
d8a52e497f93d386ce86deeb61d0571953541cdb
refs/heads/master
2020-12-03T01:51:55.585249
2017-06-30T10:17:33
2017-06-30T10:17:33
95,876,650
0
0
null
null
null
null
UTF-8
C++
false
false
160
h
#include "slpac.h" class C_dir { DIR *dirP; public: int dirx(char *); struct dirent *readfromdir(); void end_dir(); bool checkLastname(char *,char *); };
[ "oneplus1000@gmail.com" ]
oneplus1000@gmail.com
2bf251ba1ab3bb5e5f86841fae38958bc185e849
f149d9c88da948f2a5ff22f6a4ed8a40930d841f
/DOTPlan_Quadcopter/include/dotplan_interface_quadrotor/RPSimpleMapServer.h
83d94fb547e289d4547df1a6f976ccb275701bb3
[]
no_license
nogueiravinicius/DOTplan
081ce0724b111f603b3e8026f417295aa9e18295
e7f49b076f0e0bcb723cc60c32a1a016efe92038
refs/heads/master
2022-03-21T00:53:17.643847
2019-11-27T14:23:02
2019-11-27T14:23:02
111,724,329
2
1
null
null
null
null
UTF-8
C++
false
false
1,610
h
#include "ros/ros.h" #include "std_srvs/Empty.h" #include "diagnostic_msgs/KeyValue.h" #include "visualization_msgs/MarkerArray.h" #include "visualization_msgs/Marker.h" #include "geometry_msgs/PoseStamped.h" #include "dotplan_interface_quadrotor/Get_waypoints.h" #include <fstream> #include <sstream> #include <string> #include <ctime> #include <stdlib.h> #ifndef KCL_simple_roadmap #define KCL_simple_roadmap struct Waypoint { Waypoint(const std::string &id, double xCoord, double yCoord, double theta) : wpID(id), real_x(xCoord), real_y(yCoord), real_theta(theta) {} Waypoint() : wpID("wp_err"), real_x(0), real_y(0), real_theta(0){} float getDistance(const Waypoint& other) { return sqrt((real_x - other.real_x) * (real_x - other.real_x) + (real_y - other.real_y) * (real_y - other.real_y)); } std::string wpID; double real_x; double real_y; double real_theta; std::vector<std::string> neighbours; }; class RPSimpleMapServer { private: // Roadmap std::map<std::string, Waypoint*> waypoints; void parsePose(geometry_msgs::PoseStamped &pose, std::string line); // visualisation std::string fixed_frame; ros::Publisher waypoints_pub; void publishWaypointMarkerArray(ros::NodeHandle nh); void clearMarkerArrays(ros::NodeHandle nh); public: /* constructor */ RPSimpleMapServer(ros::NodeHandle &nh); /* service to (re)generate waypoints */ bool setupRoadmap(std::string filename); bool getwaypoints(dotplan_interface_quadrotor::Get_waypoints::Request &req, dotplan_interface_quadrotor::Get_waypoints::Response &res); }; #endif
[ "nogueira.vinicius@hotmail.com" ]
nogueira.vinicius@hotmail.com
9e060b19cc47537ca794037ceaf8045832cbc7fa
90047daeb462598a924d76ddf4288e832e86417c
/base/files/file_path.cc
5b1eb29dd6dbab176fad9aeb36dc994a5405ef5c
[ "BSD-3-Clause" ]
permissive
massbrowser/android
99b8c21fa4552a13c06bbedd0f9c88dd4a4ad080
a9c4371682c9443d6e1d66005d4db61a24a9617c
refs/heads/master
2022-11-04T21:15:50.656802
2017-06-08T12:31:39
2017-06-08T12:31:39
93,747,579
2
2
BSD-3-Clause
2022-10-31T10:34:25
2017-06-08T12:36:07
null
UTF-8
C++
false
false
57,624
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/files/file_path.h" #include <string.h> #include <algorithm> #include "base/logging.h" #include "base/macros.h" #include "base/pickle.h" #include "base/strings/string_piece.h" #include "base/strings/string_util.h" #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #if defined(OS_MACOSX) #include "base/mac/scoped_cftyperef.h" #include "base/third_party/icu/icu_utf.h" #endif #if defined(OS_WIN) #include <windows.h> #elif defined(OS_MACOSX) #include <CoreFoundation/CoreFoundation.h> #endif namespace base { using StringType = FilePath::StringType; using StringPieceType = FilePath::StringPieceType; namespace { const char* const kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" }; const char* const kCommonDoubleExtensions[] = { "user.js" }; const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0'); // If this FilePath contains a drive letter specification, returns the // position of the last character of the drive letter specification, // otherwise returns npos. This can only be true on Windows, when a pathname // begins with a letter followed by a colon. On other platforms, this always // returns npos. StringPieceType::size_type FindDriveLetter(StringPieceType path) { #if defined(FILE_PATH_USES_DRIVE_LETTERS) // This is dependent on an ASCII-based character set, but that's a // reasonable assumption. iswalpha can be too inclusive here. if (path.length() >= 2 && path[1] == L':' && ((path[0] >= L'A' && path[0] <= L'Z') || (path[0] >= L'a' && path[0] <= L'z'))) { return 1; } #endif // FILE_PATH_USES_DRIVE_LETTERS return StringType::npos; } #if defined(FILE_PATH_USES_DRIVE_LETTERS) bool EqualDriveLetterCaseInsensitive(StringPieceType a, StringPieceType b) { size_t a_letter_pos = FindDriveLetter(a); size_t b_letter_pos = FindDriveLetter(b); if (a_letter_pos == StringType::npos || b_letter_pos == StringType::npos) return a == b; StringPieceType a_letter(a.substr(0, a_letter_pos + 1)); StringPieceType b_letter(b.substr(0, b_letter_pos + 1)); if (!StartsWith(a_letter, b_letter, CompareCase::INSENSITIVE_ASCII)) return false; StringPieceType a_rest(a.substr(a_letter_pos + 1)); StringPieceType b_rest(b.substr(b_letter_pos + 1)); return a_rest == b_rest; } #endif // defined(FILE_PATH_USES_DRIVE_LETTERS) bool IsPathAbsolute(StringPieceType path) { #if defined(FILE_PATH_USES_DRIVE_LETTERS) StringType::size_type letter = FindDriveLetter(path); if (letter != StringType::npos) { // Look for a separator right after the drive specification. return path.length() > letter + 1 && FilePath::IsSeparator(path[letter + 1]); } // Look for a pair of leading separators. return path.length() > 1 && FilePath::IsSeparator(path[0]) && FilePath::IsSeparator(path[1]); #else // FILE_PATH_USES_DRIVE_LETTERS // Look for a separator in the first position. return path.length() > 0 && FilePath::IsSeparator(path[0]); #endif // FILE_PATH_USES_DRIVE_LETTERS } bool AreAllSeparators(const StringType& input) { for (StringType::const_iterator it = input.begin(); it != input.end(); ++it) { if (!FilePath::IsSeparator(*it)) return false; } return true; } // Find the position of the '.' that separates the extension from the rest // of the file name. The position is relative to BaseName(), not value(). // Returns npos if it can't find an extension. StringType::size_type FinalExtensionSeparatorPosition(const StringType& path) { // Special case "." and ".." if (path == FilePath::kCurrentDirectory || path == FilePath::kParentDirectory) return StringType::npos; return path.rfind(FilePath::kExtensionSeparator); } // Same as above, but allow a second extension component of up to 4 // characters when the rightmost extension component is a common double // extension (gz, bz2, Z). For example, foo.tar.gz or foo.tar.Z would have // extension components of '.tar.gz' and '.tar.Z' respectively. StringType::size_type ExtensionSeparatorPosition(const StringType& path) { const StringType::size_type last_dot = FinalExtensionSeparatorPosition(path); // No extension, or the extension is the whole filename. if (last_dot == StringType::npos || last_dot == 0U) return last_dot; const StringType::size_type penultimate_dot = path.rfind(FilePath::kExtensionSeparator, last_dot - 1); const StringType::size_type last_separator = path.find_last_of(FilePath::kSeparators, last_dot - 1, FilePath::kSeparatorsLength - 1); if (penultimate_dot == StringType::npos || (last_separator != StringType::npos && penultimate_dot < last_separator)) { return last_dot; } for (size_t i = 0; i < arraysize(kCommonDoubleExtensions); ++i) { StringType extension(path, penultimate_dot + 1); if (LowerCaseEqualsASCII(extension, kCommonDoubleExtensions[i])) return penultimate_dot; } StringType extension(path, last_dot + 1); for (size_t i = 0; i < arraysize(kCommonDoubleExtensionSuffixes); ++i) { if (LowerCaseEqualsASCII(extension, kCommonDoubleExtensionSuffixes[i])) { if ((last_dot - penultimate_dot) <= 5U && (last_dot - penultimate_dot) > 1U) { return penultimate_dot; } } } return last_dot; } // Returns true if path is "", ".", or "..". bool IsEmptyOrSpecialCase(const StringType& path) { // Special cases "", ".", and ".." if (path.empty() || path == FilePath::kCurrentDirectory || path == FilePath::kParentDirectory) { return true; } return false; } } // namespace FilePath::FilePath() { } FilePath::FilePath(const FilePath& that) : path_(that.path_) { } FilePath::FilePath(FilePath&& that) noexcept = default; FilePath::FilePath(StringPieceType path) { path.CopyToString(&path_); StringType::size_type nul_pos = path_.find(kStringTerminator); if (nul_pos != StringType::npos) path_.erase(nul_pos, StringType::npos); } FilePath::~FilePath() { } FilePath& FilePath::operator=(const FilePath& that) { path_ = that.path_; return *this; } FilePath& FilePath::operator=(FilePath&& that) = default; bool FilePath::operator==(const FilePath& that) const { #if defined(FILE_PATH_USES_DRIVE_LETTERS) return EqualDriveLetterCaseInsensitive(this->path_, that.path_); #else // defined(FILE_PATH_USES_DRIVE_LETTERS) return path_ == that.path_; #endif // defined(FILE_PATH_USES_DRIVE_LETTERS) } bool FilePath::operator!=(const FilePath& that) const { #if defined(FILE_PATH_USES_DRIVE_LETTERS) return !EqualDriveLetterCaseInsensitive(this->path_, that.path_); #else // defined(FILE_PATH_USES_DRIVE_LETTERS) return path_ != that.path_; #endif // defined(FILE_PATH_USES_DRIVE_LETTERS) } // static bool FilePath::IsSeparator(CharType character) { for (size_t i = 0; i < kSeparatorsLength - 1; ++i) { if (character == kSeparators[i]) { return true; } } return false; } void FilePath::GetComponents(std::vector<StringType>* components) const { DCHECK(components); if (!components) return; components->clear(); if (value().empty()) return; std::vector<StringType> ret_val; FilePath current = *this; FilePath base; // Capture path components. while (current != current.DirName()) { base = current.BaseName(); if (!AreAllSeparators(base.value())) ret_val.push_back(base.value()); current = current.DirName(); } // Capture root, if any. base = current.BaseName(); if (!base.value().empty() && base.value() != kCurrentDirectory) ret_val.push_back(current.BaseName().value()); // Capture drive letter, if any. FilePath dir = current.DirName(); StringType::size_type letter = FindDriveLetter(dir.value()); if (letter != StringType::npos) { ret_val.push_back(StringType(dir.value(), 0, letter + 1)); } *components = std::vector<StringType>(ret_val.rbegin(), ret_val.rend()); } bool FilePath::IsParent(const FilePath& child) const { return AppendRelativePath(child, NULL); } bool FilePath::AppendRelativePath(const FilePath& child, FilePath* path) const { std::vector<StringType> parent_components; std::vector<StringType> child_components; GetComponents(&parent_components); child.GetComponents(&child_components); if (parent_components.empty() || parent_components.size() >= child_components.size()) return false; std::vector<StringType>::const_iterator parent_comp = parent_components.begin(); std::vector<StringType>::const_iterator child_comp = child_components.begin(); #if defined(FILE_PATH_USES_DRIVE_LETTERS) // Windows can access case sensitive filesystems, so component // comparisions must be case sensitive, but drive letters are // never case sensitive. if ((FindDriveLetter(*parent_comp) != StringType::npos) && (FindDriveLetter(*child_comp) != StringType::npos)) { if (!StartsWith(*parent_comp, *child_comp, CompareCase::INSENSITIVE_ASCII)) return false; ++parent_comp; ++child_comp; } #endif // defined(FILE_PATH_USES_DRIVE_LETTERS) while (parent_comp != parent_components.end()) { if (*parent_comp != *child_comp) return false; ++parent_comp; ++child_comp; } if (path != NULL) { for (; child_comp != child_components.end(); ++child_comp) { *path = path->Append(*child_comp); } } return true; } // libgen's dirname and basename aren't guaranteed to be thread-safe and aren't // guaranteed to not modify their input strings, and in fact are implemented // differently in this regard on different platforms. Don't use them, but // adhere to their behavior. FilePath FilePath::DirName() const { FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); // The drive letter, if any, always needs to remain in the output. If there // is no drive letter, as will always be the case on platforms which do not // support drive letters, letter will be npos, or -1, so the comparisons and // resizes below using letter will still be valid. StringType::size_type letter = FindDriveLetter(new_path.path_); StringType::size_type last_separator = new_path.path_.find_last_of(kSeparators, StringType::npos, kSeparatorsLength - 1); if (last_separator == StringType::npos) { // path_ is in the current directory. new_path.path_.resize(letter + 1); } else if (last_separator == letter + 1) { // path_ is in the root directory. new_path.path_.resize(letter + 2); } else if (last_separator == letter + 2 && IsSeparator(new_path.path_[letter + 1])) { // path_ is in "//" (possibly with a drive letter); leave the double // separator intact indicating alternate root. new_path.path_.resize(letter + 3); } else if (last_separator != 0) { // path_ is somewhere else, trim the basename. new_path.path_.resize(last_separator); } new_path.StripTrailingSeparatorsInternal(); if (!new_path.path_.length()) new_path.path_ = kCurrentDirectory; return new_path; } FilePath FilePath::BaseName() const { FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); // The drive letter, if any, is always stripped. StringType::size_type letter = FindDriveLetter(new_path.path_); if (letter != StringType::npos) { new_path.path_.erase(0, letter + 1); } // Keep everything after the final separator, but if the pathname is only // one character and it's a separator, leave it alone. StringType::size_type last_separator = new_path.path_.find_last_of(kSeparators, StringType::npos, kSeparatorsLength - 1); if (last_separator != StringType::npos && last_separator < new_path.path_.length() - 1) { new_path.path_.erase(0, last_separator + 1); } return new_path; } StringType FilePath::Extension() const { FilePath base(BaseName()); const StringType::size_type dot = ExtensionSeparatorPosition(base.path_); if (dot == StringType::npos) return StringType(); return base.path_.substr(dot, StringType::npos); } StringType FilePath::FinalExtension() const { FilePath base(BaseName()); const StringType::size_type dot = FinalExtensionSeparatorPosition(base.path_); if (dot == StringType::npos) return StringType(); return base.path_.substr(dot, StringType::npos); } FilePath FilePath::RemoveExtension() const { if (Extension().empty()) return *this; const StringType::size_type dot = ExtensionSeparatorPosition(path_); if (dot == StringType::npos) return *this; return FilePath(path_.substr(0, dot)); } FilePath FilePath::RemoveFinalExtension() const { if (FinalExtension().empty()) return *this; const StringType::size_type dot = FinalExtensionSeparatorPosition(path_); if (dot == StringType::npos) return *this; return FilePath(path_.substr(0, dot)); } FilePath FilePath::InsertBeforeExtension(StringPieceType suffix) const { if (suffix.empty()) return FilePath(path_); if (IsEmptyOrSpecialCase(BaseName().value())) return FilePath(); StringType ext = Extension(); StringType ret = RemoveExtension().value(); suffix.AppendToString(&ret); ret.append(ext); return FilePath(ret); } FilePath FilePath::InsertBeforeExtensionASCII(StringPiece suffix) const { DCHECK(IsStringASCII(suffix)); #if defined(OS_WIN) return InsertBeforeExtension(ASCIIToUTF16(suffix)); #elif defined(OS_POSIX) return InsertBeforeExtension(suffix); #endif } FilePath FilePath::AddExtension(StringPieceType extension) const { if (IsEmptyOrSpecialCase(BaseName().value())) return FilePath(); // If the new extension is "" or ".", then just return the current FilePath. if (extension.empty() || (extension.size() == 1 && extension[0] == kExtensionSeparator)) return *this; StringType str = path_; if (extension[0] != kExtensionSeparator && *(str.end() - 1) != kExtensionSeparator) { str.append(1, kExtensionSeparator); } extension.AppendToString(&str); return FilePath(str); } FilePath FilePath::ReplaceExtension(StringPieceType extension) const { if (IsEmptyOrSpecialCase(BaseName().value())) return FilePath(); FilePath no_ext = RemoveExtension(); // If the new extension is "" or ".", then just remove the current extension. if (extension.empty() || (extension.size() == 1 && extension[0] == kExtensionSeparator)) return no_ext; StringType str = no_ext.value(); if (extension[0] != kExtensionSeparator) str.append(1, kExtensionSeparator); extension.AppendToString(&str); return FilePath(str); } bool FilePath::MatchesExtension(StringPieceType extension) const { DCHECK(extension.empty() || extension[0] == kExtensionSeparator); StringType current_extension = Extension(); if (current_extension.length() != extension.length()) return false; return FilePath::CompareEqualIgnoreCase(extension, current_extension); } FilePath FilePath::Append(StringPieceType component) const { StringPieceType appended = component; StringType without_nuls; StringType::size_type nul_pos = component.find(kStringTerminator); if (nul_pos != StringPieceType::npos) { component.substr(0, nul_pos).CopyToString(&without_nuls); appended = StringPieceType(without_nuls); } DCHECK(!IsPathAbsolute(appended)); if (path_.compare(kCurrentDirectory) == 0) { // Append normally doesn't do any normalization, but as a special case, // when appending to kCurrentDirectory, just return a new path for the // component argument. Appending component to kCurrentDirectory would // serve no purpose other than needlessly lengthening the path, and // it's likely in practice to wind up with FilePath objects containing // only kCurrentDirectory when calling DirName on a single relative path // component. return FilePath(appended); } FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); // Don't append a separator if the path is empty (indicating the current // directory) or if the path component is empty (indicating nothing to // append). if (!appended.empty() && !new_path.path_.empty()) { // Don't append a separator if the path still ends with a trailing // separator after stripping (indicating the root directory). if (!IsSeparator(new_path.path_.back())) { // Don't append a separator if the path is just a drive letter. if (FindDriveLetter(new_path.path_) + 1 != new_path.path_.length()) { new_path.path_.append(1, kSeparators[0]); } } } appended.AppendToString(&new_path.path_); return new_path; } FilePath FilePath::Append(const FilePath& component) const { return Append(component.value()); } FilePath FilePath::AppendASCII(StringPiece component) const { DCHECK(base::IsStringASCII(component)); #if defined(OS_WIN) return Append(ASCIIToUTF16(component)); #elif defined(OS_POSIX) return Append(component); #endif } bool FilePath::IsAbsolute() const { return IsPathAbsolute(path_); } bool FilePath::EndsWithSeparator() const { if (empty()) return false; return IsSeparator(path_.back()); } FilePath FilePath::AsEndingWithSeparator() const { if (EndsWithSeparator() || path_.empty()) return *this; StringType path_str; path_str.reserve(path_.length() + 1); // Only allocate string once. path_str = path_; path_str.append(&kSeparators[0], 1); return FilePath(path_str); } FilePath FilePath::StripTrailingSeparators() const { FilePath new_path(path_); new_path.StripTrailingSeparatorsInternal(); return new_path; } bool FilePath::ReferencesParent() const { if (path_.find(kParentDirectory) == StringType::npos) { // GetComponents is quite expensive, so avoid calling it in the majority // of cases where there isn't a kParentDirectory anywhere in the path. return false; } std::vector<StringType> components; GetComponents(&components); std::vector<StringType>::const_iterator it = components.begin(); for (; it != components.end(); ++it) { const StringType& component = *it; // Windows has odd, undocumented behavior with path components containing // only whitespace and . characters. So, if all we see is . and // whitespace, then we treat any .. sequence as referencing parent. // For simplicity we enforce this on all platforms. if (component.find_first_not_of(FILE_PATH_LITERAL(". \n\r\t")) == std::string::npos && component.find(kParentDirectory) != std::string::npos) { return true; } } return false; } #if defined(OS_POSIX) // See file_path.h for a discussion of the encoding of paths on POSIX // platforms. These encoding conversion functions are not quite correct. string16 FilePath::LossyDisplayName() const { return WideToUTF16(SysNativeMBToWide(path_)); } std::string FilePath::MaybeAsASCII() const { if (base::IsStringASCII(path_)) return path_; return std::string(); } std::string FilePath::AsUTF8Unsafe() const { #if defined(SYSTEM_NATIVE_UTF8) return value(); #else return WideToUTF8(SysNativeMBToWide(value())); #endif } string16 FilePath::AsUTF16Unsafe() const { #if defined(SYSTEM_NATIVE_UTF8) return UTF8ToUTF16(value()); #else return WideToUTF16(SysNativeMBToWide(value())); #endif } // static FilePath FilePath::FromUTF8Unsafe(StringPiece utf8) { #if defined(SYSTEM_NATIVE_UTF8) return FilePath(utf8); #else return FilePath(SysWideToNativeMB(UTF8ToWide(utf8))); #endif } // static FilePath FilePath::FromUTF16Unsafe(StringPiece16 utf16) { #if defined(SYSTEM_NATIVE_UTF8) return FilePath(UTF16ToUTF8(utf16)); #else return FilePath(SysWideToNativeMB(UTF16ToWide(utf16.as_string()))); #endif } #elif defined(OS_WIN) string16 FilePath::LossyDisplayName() const { return path_; } std::string FilePath::MaybeAsASCII() const { if (base::IsStringASCII(path_)) return UTF16ToASCII(path_); return std::string(); } std::string FilePath::AsUTF8Unsafe() const { return WideToUTF8(value()); } string16 FilePath::AsUTF16Unsafe() const { return value(); } // static FilePath FilePath::FromUTF8Unsafe(StringPiece utf8) { return FilePath(UTF8ToWide(utf8)); } // static FilePath FilePath::FromUTF16Unsafe(StringPiece16 utf16) { return FilePath(utf16); } #endif void FilePath::GetSizeForPickle(PickleSizer* sizer) const { #if defined(OS_WIN) sizer->AddString16(path_); #else sizer->AddString(path_); #endif } void FilePath::WriteToPickle(Pickle* pickle) const { #if defined(OS_WIN) pickle->WriteString16(path_); #else pickle->WriteString(path_); #endif } bool FilePath::ReadFromPickle(PickleIterator* iter) { #if defined(OS_WIN) if (!iter->ReadString16(&path_)) return false; #else if (!iter->ReadString(&path_)) return false; #endif if (path_.find(kStringTerminator) != StringType::npos) return false; return true; } #if defined(OS_WIN) // Windows specific implementation of file string comparisons. int FilePath::CompareIgnoreCase(StringPieceType string1, StringPieceType string2) { static decltype(::CharUpperW)* const char_upper_api = reinterpret_cast<decltype(::CharUpperW)*>( ::GetProcAddress(::GetModuleHandle(L"user32.dll"), "CharUpperW")); CHECK(char_upper_api); // Perform character-wise upper case comparison rather than using the // fully Unicode-aware CompareString(). For details see: // http://blogs.msdn.com/michkap/archive/2005/10/17/481600.aspx StringPieceType::const_iterator i1 = string1.begin(); StringPieceType::const_iterator i2 = string2.begin(); StringPieceType::const_iterator string1end = string1.end(); StringPieceType::const_iterator string2end = string2.end(); for ( ; i1 != string1end && i2 != string2end; ++i1, ++i2) { wchar_t c1 = (wchar_t)LOWORD(char_upper_api((LPWSTR)(DWORD_PTR)MAKELONG(*i1, 0))); wchar_t c2 = (wchar_t)LOWORD(char_upper_api((LPWSTR)(DWORD_PTR)MAKELONG(*i2, 0))); if (c1 < c2) return -1; if (c1 > c2) return 1; } if (i1 != string1end) return 1; if (i2 != string2end) return -1; return 0; } #elif defined(OS_MACOSX) // Mac OS X specific implementation of file string comparisons. // cf. http://developer.apple.com/mac/library/technotes/tn/tn1150.html#UnicodeSubtleties // // "When using CreateTextEncoding to create a text encoding, you should set // the TextEncodingBase to kTextEncodingUnicodeV2_0, set the // TextEncodingVariant to kUnicodeCanonicalDecompVariant, and set the // TextEncodingFormat to kUnicode16BitFormat. Using these values ensures that // the Unicode will be in the same form as on an HFS Plus volume, even as the // Unicode standard evolves." // // Another technical article for X 10.4 updates this: one should use // the new (unambiguous) kUnicodeHFSPlusDecompVariant. // cf. http://developer.apple.com/mac/library/releasenotes/TextFonts/RN-TEC/index.html // // This implementation uses CFStringGetFileSystemRepresentation() to get the // decomposed form, and an adapted version of the FastUnicodeCompare as // described in the tech note to compare the strings. // Character conversion table for FastUnicodeCompare() // // The lower case table consists of a 256-entry high-byte table followed by // some number of 256-entry subtables. The high-byte table contains either an // offset to the subtable for characters with that high byte or zero, which // means that there are no case mappings or ignored characters in that block. // Ignored characters are mapped to zero. // // cf. downloadable file linked in // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#StringComparisonAlgorithm namespace { const UInt16 lower_case_table[] = { // High-byte indices ( == 0 iff no case mapping and no ignorables ) /* 0 */ 0x0100, 0x0200, 0x0000, 0x0300, 0x0400, 0x0500, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 1 */ 0x0600, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 2 */ 0x0700, 0x0800, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 3 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 4 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 5 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 6 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 8 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 9 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* A */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* B */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* C */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* D */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* E */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* F */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0900, 0x0A00, // Table 1 (for high byte 0x00) /* 0 */ 0xFFFF, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, /* 1 */ 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, 0x0019, 0x001A, 0x001B, 0x001C, 0x001D, 0x001E, 0x001F, /* 2 */ 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, 0x0028, 0x0029, 0x002A, 0x002B, 0x002C, 0x002D, 0x002E, 0x002F, /* 3 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x003A, 0x003B, 0x003C, 0x003D, 0x003E, 0x003F, /* 4 */ 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, /* 5 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x005B, 0x005C, 0x005D, 0x005E, 0x005F, /* 6 */ 0x0060, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x006A, 0x006B, 0x006C, 0x006D, 0x006E, 0x006F, /* 7 */ 0x0070, 0x0071, 0x0072, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007A, 0x007B, 0x007C, 0x007D, 0x007E, 0x007F, /* 8 */ 0x0080, 0x0081, 0x0082, 0x0083, 0x0084, 0x0085, 0x0086, 0x0087, 0x0088, 0x0089, 0x008A, 0x008B, 0x008C, 0x008D, 0x008E, 0x008F, /* 9 */ 0x0090, 0x0091, 0x0092, 0x0093, 0x0094, 0x0095, 0x0096, 0x0097, 0x0098, 0x0099, 0x009A, 0x009B, 0x009C, 0x009D, 0x009E, 0x009F, /* A */ 0x00A0, 0x00A1, 0x00A2, 0x00A3, 0x00A4, 0x00A5, 0x00A6, 0x00A7, 0x00A8, 0x00A9, 0x00AA, 0x00AB, 0x00AC, 0x00AD, 0x00AE, 0x00AF, /* B */ 0x00B0, 0x00B1, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x00B6, 0x00B7, 0x00B8, 0x00B9, 0x00BA, 0x00BB, 0x00BC, 0x00BD, 0x00BE, 0x00BF, /* C */ 0x00C0, 0x00C1, 0x00C2, 0x00C3, 0x00C4, 0x00C5, 0x00E6, 0x00C7, 0x00C8, 0x00C9, 0x00CA, 0x00CB, 0x00CC, 0x00CD, 0x00CE, 0x00CF, /* D */ 0x00F0, 0x00D1, 0x00D2, 0x00D3, 0x00D4, 0x00D5, 0x00D6, 0x00D7, 0x00F8, 0x00D9, 0x00DA, 0x00DB, 0x00DC, 0x00DD, 0x00FE, 0x00DF, /* E */ 0x00E0, 0x00E1, 0x00E2, 0x00E3, 0x00E4, 0x00E5, 0x00E6, 0x00E7, 0x00E8, 0x00E9, 0x00EA, 0x00EB, 0x00EC, 0x00ED, 0x00EE, 0x00EF, /* F */ 0x00F0, 0x00F1, 0x00F2, 0x00F3, 0x00F4, 0x00F5, 0x00F6, 0x00F7, 0x00F8, 0x00F9, 0x00FA, 0x00FB, 0x00FC, 0x00FD, 0x00FE, 0x00FF, // Table 2 (for high byte 0x01) /* 0 */ 0x0100, 0x0101, 0x0102, 0x0103, 0x0104, 0x0105, 0x0106, 0x0107, 0x0108, 0x0109, 0x010A, 0x010B, 0x010C, 0x010D, 0x010E, 0x010F, /* 1 */ 0x0111, 0x0111, 0x0112, 0x0113, 0x0114, 0x0115, 0x0116, 0x0117, 0x0118, 0x0119, 0x011A, 0x011B, 0x011C, 0x011D, 0x011E, 0x011F, /* 2 */ 0x0120, 0x0121, 0x0122, 0x0123, 0x0124, 0x0125, 0x0127, 0x0127, 0x0128, 0x0129, 0x012A, 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, /* 3 */ 0x0130, 0x0131, 0x0133, 0x0133, 0x0134, 0x0135, 0x0136, 0x0137, 0x0138, 0x0139, 0x013A, 0x013B, 0x013C, 0x013D, 0x013E, 0x0140, /* 4 */ 0x0140, 0x0142, 0x0142, 0x0143, 0x0144, 0x0145, 0x0146, 0x0147, 0x0148, 0x0149, 0x014B, 0x014B, 0x014C, 0x014D, 0x014E, 0x014F, /* 5 */ 0x0150, 0x0151, 0x0153, 0x0153, 0x0154, 0x0155, 0x0156, 0x0157, 0x0158, 0x0159, 0x015A, 0x015B, 0x015C, 0x015D, 0x015E, 0x015F, /* 6 */ 0x0160, 0x0161, 0x0162, 0x0163, 0x0164, 0x0165, 0x0167, 0x0167, 0x0168, 0x0169, 0x016A, 0x016B, 0x016C, 0x016D, 0x016E, 0x016F, /* 7 */ 0x0170, 0x0171, 0x0172, 0x0173, 0x0174, 0x0175, 0x0176, 0x0177, 0x0178, 0x0179, 0x017A, 0x017B, 0x017C, 0x017D, 0x017E, 0x017F, /* 8 */ 0x0180, 0x0253, 0x0183, 0x0183, 0x0185, 0x0185, 0x0254, 0x0188, 0x0188, 0x0256, 0x0257, 0x018C, 0x018C, 0x018D, 0x01DD, 0x0259, /* 9 */ 0x025B, 0x0192, 0x0192, 0x0260, 0x0263, 0x0195, 0x0269, 0x0268, 0x0199, 0x0199, 0x019A, 0x019B, 0x026F, 0x0272, 0x019E, 0x0275, /* A */ 0x01A0, 0x01A1, 0x01A3, 0x01A3, 0x01A5, 0x01A5, 0x01A6, 0x01A8, 0x01A8, 0x0283, 0x01AA, 0x01AB, 0x01AD, 0x01AD, 0x0288, 0x01AF, /* B */ 0x01B0, 0x028A, 0x028B, 0x01B4, 0x01B4, 0x01B6, 0x01B6, 0x0292, 0x01B9, 0x01B9, 0x01BA, 0x01BB, 0x01BD, 0x01BD, 0x01BE, 0x01BF, /* C */ 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9, 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC, 0x01CD, 0x01CE, 0x01CF, /* D */ 0x01D0, 0x01D1, 0x01D2, 0x01D3, 0x01D4, 0x01D5, 0x01D6, 0x01D7, 0x01D8, 0x01D9, 0x01DA, 0x01DB, 0x01DC, 0x01DD, 0x01DE, 0x01DF, /* E */ 0x01E0, 0x01E1, 0x01E2, 0x01E3, 0x01E5, 0x01E5, 0x01E6, 0x01E7, 0x01E8, 0x01E9, 0x01EA, 0x01EB, 0x01EC, 0x01ED, 0x01EE, 0x01EF, /* F */ 0x01F0, 0x01F3, 0x01F3, 0x01F3, 0x01F4, 0x01F5, 0x01F6, 0x01F7, 0x01F8, 0x01F9, 0x01FA, 0x01FB, 0x01FC, 0x01FD, 0x01FE, 0x01FF, // Table 3 (for high byte 0x03) /* 0 */ 0x0300, 0x0301, 0x0302, 0x0303, 0x0304, 0x0305, 0x0306, 0x0307, 0x0308, 0x0309, 0x030A, 0x030B, 0x030C, 0x030D, 0x030E, 0x030F, /* 1 */ 0x0310, 0x0311, 0x0312, 0x0313, 0x0314, 0x0315, 0x0316, 0x0317, 0x0318, 0x0319, 0x031A, 0x031B, 0x031C, 0x031D, 0x031E, 0x031F, /* 2 */ 0x0320, 0x0321, 0x0322, 0x0323, 0x0324, 0x0325, 0x0326, 0x0327, 0x0328, 0x0329, 0x032A, 0x032B, 0x032C, 0x032D, 0x032E, 0x032F, /* 3 */ 0x0330, 0x0331, 0x0332, 0x0333, 0x0334, 0x0335, 0x0336, 0x0337, 0x0338, 0x0339, 0x033A, 0x033B, 0x033C, 0x033D, 0x033E, 0x033F, /* 4 */ 0x0340, 0x0341, 0x0342, 0x0343, 0x0344, 0x0345, 0x0346, 0x0347, 0x0348, 0x0349, 0x034A, 0x034B, 0x034C, 0x034D, 0x034E, 0x034F, /* 5 */ 0x0350, 0x0351, 0x0352, 0x0353, 0x0354, 0x0355, 0x0356, 0x0357, 0x0358, 0x0359, 0x035A, 0x035B, 0x035C, 0x035D, 0x035E, 0x035F, /* 6 */ 0x0360, 0x0361, 0x0362, 0x0363, 0x0364, 0x0365, 0x0366, 0x0367, 0x0368, 0x0369, 0x036A, 0x036B, 0x036C, 0x036D, 0x036E, 0x036F, /* 7 */ 0x0370, 0x0371, 0x0372, 0x0373, 0x0374, 0x0375, 0x0376, 0x0377, 0x0378, 0x0379, 0x037A, 0x037B, 0x037C, 0x037D, 0x037E, 0x037F, /* 8 */ 0x0380, 0x0381, 0x0382, 0x0383, 0x0384, 0x0385, 0x0386, 0x0387, 0x0388, 0x0389, 0x038A, 0x038B, 0x038C, 0x038D, 0x038E, 0x038F, /* 9 */ 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, /* A */ 0x03C0, 0x03C1, 0x03A2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03AA, 0x03AB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, /* B */ 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, /* C */ 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x03CF, /* D */ 0x03D0, 0x03D1, 0x03D2, 0x03D3, 0x03D4, 0x03D5, 0x03D6, 0x03D7, 0x03D8, 0x03D9, 0x03DA, 0x03DB, 0x03DC, 0x03DD, 0x03DE, 0x03DF, /* E */ 0x03E0, 0x03E1, 0x03E3, 0x03E3, 0x03E5, 0x03E5, 0x03E7, 0x03E7, 0x03E9, 0x03E9, 0x03EB, 0x03EB, 0x03ED, 0x03ED, 0x03EF, 0x03EF, /* F */ 0x03F0, 0x03F1, 0x03F2, 0x03F3, 0x03F4, 0x03F5, 0x03F6, 0x03F7, 0x03F8, 0x03F9, 0x03FA, 0x03FB, 0x03FC, 0x03FD, 0x03FE, 0x03FF, // Table 4 (for high byte 0x04) /* 0 */ 0x0400, 0x0401, 0x0452, 0x0403, 0x0454, 0x0455, 0x0456, 0x0407, 0x0458, 0x0459, 0x045A, 0x045B, 0x040C, 0x040D, 0x040E, 0x045F, /* 1 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0419, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, /* 2 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, /* 3 */ 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F, /* 4 */ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F, /* 5 */ 0x0450, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x045D, 0x045E, 0x045F, /* 6 */ 0x0461, 0x0461, 0x0463, 0x0463, 0x0465, 0x0465, 0x0467, 0x0467, 0x0469, 0x0469, 0x046B, 0x046B, 0x046D, 0x046D, 0x046F, 0x046F, /* 7 */ 0x0471, 0x0471, 0x0473, 0x0473, 0x0475, 0x0475, 0x0476, 0x0477, 0x0479, 0x0479, 0x047B, 0x047B, 0x047D, 0x047D, 0x047F, 0x047F, /* 8 */ 0x0481, 0x0481, 0x0482, 0x0483, 0x0484, 0x0485, 0x0486, 0x0487, 0x0488, 0x0489, 0x048A, 0x048B, 0x048C, 0x048D, 0x048E, 0x048F, /* 9 */ 0x0491, 0x0491, 0x0493, 0x0493, 0x0495, 0x0495, 0x0497, 0x0497, 0x0499, 0x0499, 0x049B, 0x049B, 0x049D, 0x049D, 0x049F, 0x049F, /* A */ 0x04A1, 0x04A1, 0x04A3, 0x04A3, 0x04A5, 0x04A5, 0x04A7, 0x04A7, 0x04A9, 0x04A9, 0x04AB, 0x04AB, 0x04AD, 0x04AD, 0x04AF, 0x04AF, /* B */ 0x04B1, 0x04B1, 0x04B3, 0x04B3, 0x04B5, 0x04B5, 0x04B7, 0x04B7, 0x04B9, 0x04B9, 0x04BB, 0x04BB, 0x04BD, 0x04BD, 0x04BF, 0x04BF, /* C */ 0x04C0, 0x04C1, 0x04C2, 0x04C4, 0x04C4, 0x04C5, 0x04C6, 0x04C8, 0x04C8, 0x04C9, 0x04CA, 0x04CC, 0x04CC, 0x04CD, 0x04CE, 0x04CF, /* D */ 0x04D0, 0x04D1, 0x04D2, 0x04D3, 0x04D4, 0x04D5, 0x04D6, 0x04D7, 0x04D8, 0x04D9, 0x04DA, 0x04DB, 0x04DC, 0x04DD, 0x04DE, 0x04DF, /* E */ 0x04E0, 0x04E1, 0x04E2, 0x04E3, 0x04E4, 0x04E5, 0x04E6, 0x04E7, 0x04E8, 0x04E9, 0x04EA, 0x04EB, 0x04EC, 0x04ED, 0x04EE, 0x04EF, /* F */ 0x04F0, 0x04F1, 0x04F2, 0x04F3, 0x04F4, 0x04F5, 0x04F6, 0x04F7, 0x04F8, 0x04F9, 0x04FA, 0x04FB, 0x04FC, 0x04FD, 0x04FE, 0x04FF, // Table 5 (for high byte 0x05) /* 0 */ 0x0500, 0x0501, 0x0502, 0x0503, 0x0504, 0x0505, 0x0506, 0x0507, 0x0508, 0x0509, 0x050A, 0x050B, 0x050C, 0x050D, 0x050E, 0x050F, /* 1 */ 0x0510, 0x0511, 0x0512, 0x0513, 0x0514, 0x0515, 0x0516, 0x0517, 0x0518, 0x0519, 0x051A, 0x051B, 0x051C, 0x051D, 0x051E, 0x051F, /* 2 */ 0x0520, 0x0521, 0x0522, 0x0523, 0x0524, 0x0525, 0x0526, 0x0527, 0x0528, 0x0529, 0x052A, 0x052B, 0x052C, 0x052D, 0x052E, 0x052F, /* 3 */ 0x0530, 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567, 0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F, /* 4 */ 0x0570, 0x0571, 0x0572, 0x0573, 0x0574, 0x0575, 0x0576, 0x0577, 0x0578, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F, /* 5 */ 0x0580, 0x0581, 0x0582, 0x0583, 0x0584, 0x0585, 0x0586, 0x0557, 0x0558, 0x0559, 0x055A, 0x055B, 0x055C, 0x055D, 0x055E, 0x055F, /* 6 */ 0x0560, 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567, 0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F, /* 7 */ 0x0570, 0x0571, 0x0572, 0x0573, 0x0574, 0x0575, 0x0576, 0x0577, 0x0578, 0x0579, 0x057A, 0x057B, 0x057C, 0x057D, 0x057E, 0x057F, /* 8 */ 0x0580, 0x0581, 0x0582, 0x0583, 0x0584, 0x0585, 0x0586, 0x0587, 0x0588, 0x0589, 0x058A, 0x058B, 0x058C, 0x058D, 0x058E, 0x058F, /* 9 */ 0x0590, 0x0591, 0x0592, 0x0593, 0x0594, 0x0595, 0x0596, 0x0597, 0x0598, 0x0599, 0x059A, 0x059B, 0x059C, 0x059D, 0x059E, 0x059F, /* A */ 0x05A0, 0x05A1, 0x05A2, 0x05A3, 0x05A4, 0x05A5, 0x05A6, 0x05A7, 0x05A8, 0x05A9, 0x05AA, 0x05AB, 0x05AC, 0x05AD, 0x05AE, 0x05AF, /* B */ 0x05B0, 0x05B1, 0x05B2, 0x05B3, 0x05B4, 0x05B5, 0x05B6, 0x05B7, 0x05B8, 0x05B9, 0x05BA, 0x05BB, 0x05BC, 0x05BD, 0x05BE, 0x05BF, /* C */ 0x05C0, 0x05C1, 0x05C2, 0x05C3, 0x05C4, 0x05C5, 0x05C6, 0x05C7, 0x05C8, 0x05C9, 0x05CA, 0x05CB, 0x05CC, 0x05CD, 0x05CE, 0x05CF, /* D */ 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF, /* E */ 0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x05EB, 0x05EC, 0x05ED, 0x05EE, 0x05EF, /* F */ 0x05F0, 0x05F1, 0x05F2, 0x05F3, 0x05F4, 0x05F5, 0x05F6, 0x05F7, 0x05F8, 0x05F9, 0x05FA, 0x05FB, 0x05FC, 0x05FD, 0x05FE, 0x05FF, // Table 6 (for high byte 0x10) /* 0 */ 0x1000, 0x1001, 0x1002, 0x1003, 0x1004, 0x1005, 0x1006, 0x1007, 0x1008, 0x1009, 0x100A, 0x100B, 0x100C, 0x100D, 0x100E, 0x100F, /* 1 */ 0x1010, 0x1011, 0x1012, 0x1013, 0x1014, 0x1015, 0x1016, 0x1017, 0x1018, 0x1019, 0x101A, 0x101B, 0x101C, 0x101D, 0x101E, 0x101F, /* 2 */ 0x1020, 0x1021, 0x1022, 0x1023, 0x1024, 0x1025, 0x1026, 0x1027, 0x1028, 0x1029, 0x102A, 0x102B, 0x102C, 0x102D, 0x102E, 0x102F, /* 3 */ 0x1030, 0x1031, 0x1032, 0x1033, 0x1034, 0x1035, 0x1036, 0x1037, 0x1038, 0x1039, 0x103A, 0x103B, 0x103C, 0x103D, 0x103E, 0x103F, /* 4 */ 0x1040, 0x1041, 0x1042, 0x1043, 0x1044, 0x1045, 0x1046, 0x1047, 0x1048, 0x1049, 0x104A, 0x104B, 0x104C, 0x104D, 0x104E, 0x104F, /* 5 */ 0x1050, 0x1051, 0x1052, 0x1053, 0x1054, 0x1055, 0x1056, 0x1057, 0x1058, 0x1059, 0x105A, 0x105B, 0x105C, 0x105D, 0x105E, 0x105F, /* 6 */ 0x1060, 0x1061, 0x1062, 0x1063, 0x1064, 0x1065, 0x1066, 0x1067, 0x1068, 0x1069, 0x106A, 0x106B, 0x106C, 0x106D, 0x106E, 0x106F, /* 7 */ 0x1070, 0x1071, 0x1072, 0x1073, 0x1074, 0x1075, 0x1076, 0x1077, 0x1078, 0x1079, 0x107A, 0x107B, 0x107C, 0x107D, 0x107E, 0x107F, /* 8 */ 0x1080, 0x1081, 0x1082, 0x1083, 0x1084, 0x1085, 0x1086, 0x1087, 0x1088, 0x1089, 0x108A, 0x108B, 0x108C, 0x108D, 0x108E, 0x108F, /* 9 */ 0x1090, 0x1091, 0x1092, 0x1093, 0x1094, 0x1095, 0x1096, 0x1097, 0x1098, 0x1099, 0x109A, 0x109B, 0x109C, 0x109D, 0x109E, 0x109F, /* A */ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10D7, 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10DD, 0x10DE, 0x10DF, /* B */ 0x10E0, 0x10E1, 0x10E2, 0x10E3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8, 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10EF, /* C */ 0x10F0, 0x10F1, 0x10F2, 0x10F3, 0x10F4, 0x10F5, 0x10C6, 0x10C7, 0x10C8, 0x10C9, 0x10CA, 0x10CB, 0x10CC, 0x10CD, 0x10CE, 0x10CF, /* D */ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6, 0x10D7, 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10DD, 0x10DE, 0x10DF, /* E */ 0x10E0, 0x10E1, 0x10E2, 0x10E3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8, 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10EF, /* F */ 0x10F0, 0x10F1, 0x10F2, 0x10F3, 0x10F4, 0x10F5, 0x10F6, 0x10F7, 0x10F8, 0x10F9, 0x10FA, 0x10FB, 0x10FC, 0x10FD, 0x10FE, 0x10FF, // Table 7 (for high byte 0x20) /* 0 */ 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x200B, 0x0000, 0x0000, 0x0000, 0x0000, /* 1 */ 0x2010, 0x2011, 0x2012, 0x2013, 0x2014, 0x2015, 0x2016, 0x2017, 0x2018, 0x2019, 0x201A, 0x201B, 0x201C, 0x201D, 0x201E, 0x201F, /* 2 */ 0x2020, 0x2021, 0x2022, 0x2023, 0x2024, 0x2025, 0x2026, 0x2027, 0x2028, 0x2029, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x202F, /* 3 */ 0x2030, 0x2031, 0x2032, 0x2033, 0x2034, 0x2035, 0x2036, 0x2037, 0x2038, 0x2039, 0x203A, 0x203B, 0x203C, 0x203D, 0x203E, 0x203F, /* 4 */ 0x2040, 0x2041, 0x2042, 0x2043, 0x2044, 0x2045, 0x2046, 0x2047, 0x2048, 0x2049, 0x204A, 0x204B, 0x204C, 0x204D, 0x204E, 0x204F, /* 5 */ 0x2050, 0x2051, 0x2052, 0x2053, 0x2054, 0x2055, 0x2056, 0x2057, 0x2058, 0x2059, 0x205A, 0x205B, 0x205C, 0x205D, 0x205E, 0x205F, /* 6 */ 0x2060, 0x2061, 0x2062, 0x2063, 0x2064, 0x2065, 0x2066, 0x2067, 0x2068, 0x2069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 7 */ 0x2070, 0x2071, 0x2072, 0x2073, 0x2074, 0x2075, 0x2076, 0x2077, 0x2078, 0x2079, 0x207A, 0x207B, 0x207C, 0x207D, 0x207E, 0x207F, /* 8 */ 0x2080, 0x2081, 0x2082, 0x2083, 0x2084, 0x2085, 0x2086, 0x2087, 0x2088, 0x2089, 0x208A, 0x208B, 0x208C, 0x208D, 0x208E, 0x208F, /* 9 */ 0x2090, 0x2091, 0x2092, 0x2093, 0x2094, 0x2095, 0x2096, 0x2097, 0x2098, 0x2099, 0x209A, 0x209B, 0x209C, 0x209D, 0x209E, 0x209F, /* A */ 0x20A0, 0x20A1, 0x20A2, 0x20A3, 0x20A4, 0x20A5, 0x20A6, 0x20A7, 0x20A8, 0x20A9, 0x20AA, 0x20AB, 0x20AC, 0x20AD, 0x20AE, 0x20AF, /* B */ 0x20B0, 0x20B1, 0x20B2, 0x20B3, 0x20B4, 0x20B5, 0x20B6, 0x20B7, 0x20B8, 0x20B9, 0x20BA, 0x20BB, 0x20BC, 0x20BD, 0x20BE, 0x20BF, /* C */ 0x20C0, 0x20C1, 0x20C2, 0x20C3, 0x20C4, 0x20C5, 0x20C6, 0x20C7, 0x20C8, 0x20C9, 0x20CA, 0x20CB, 0x20CC, 0x20CD, 0x20CE, 0x20CF, /* D */ 0x20D0, 0x20D1, 0x20D2, 0x20D3, 0x20D4, 0x20D5, 0x20D6, 0x20D7, 0x20D8, 0x20D9, 0x20DA, 0x20DB, 0x20DC, 0x20DD, 0x20DE, 0x20DF, /* E */ 0x20E0, 0x20E1, 0x20E2, 0x20E3, 0x20E4, 0x20E5, 0x20E6, 0x20E7, 0x20E8, 0x20E9, 0x20EA, 0x20EB, 0x20EC, 0x20ED, 0x20EE, 0x20EF, /* F */ 0x20F0, 0x20F1, 0x20F2, 0x20F3, 0x20F4, 0x20F5, 0x20F6, 0x20F7, 0x20F8, 0x20F9, 0x20FA, 0x20FB, 0x20FC, 0x20FD, 0x20FE, 0x20FF, // Table 8 (for high byte 0x21) /* 0 */ 0x2100, 0x2101, 0x2102, 0x2103, 0x2104, 0x2105, 0x2106, 0x2107, 0x2108, 0x2109, 0x210A, 0x210B, 0x210C, 0x210D, 0x210E, 0x210F, /* 1 */ 0x2110, 0x2111, 0x2112, 0x2113, 0x2114, 0x2115, 0x2116, 0x2117, 0x2118, 0x2119, 0x211A, 0x211B, 0x211C, 0x211D, 0x211E, 0x211F, /* 2 */ 0x2120, 0x2121, 0x2122, 0x2123, 0x2124, 0x2125, 0x2126, 0x2127, 0x2128, 0x2129, 0x212A, 0x212B, 0x212C, 0x212D, 0x212E, 0x212F, /* 3 */ 0x2130, 0x2131, 0x2132, 0x2133, 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213A, 0x213B, 0x213C, 0x213D, 0x213E, 0x213F, /* 4 */ 0x2140, 0x2141, 0x2142, 0x2143, 0x2144, 0x2145, 0x2146, 0x2147, 0x2148, 0x2149, 0x214A, 0x214B, 0x214C, 0x214D, 0x214E, 0x214F, /* 5 */ 0x2150, 0x2151, 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215A, 0x215B, 0x215C, 0x215D, 0x215E, 0x215F, /* 6 */ 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A, 0x217B, 0x217C, 0x217D, 0x217E, 0x217F, /* 7 */ 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x217A, 0x217B, 0x217C, 0x217D, 0x217E, 0x217F, /* 8 */ 0x2180, 0x2181, 0x2182, 0x2183, 0x2184, 0x2185, 0x2186, 0x2187, 0x2188, 0x2189, 0x218A, 0x218B, 0x218C, 0x218D, 0x218E, 0x218F, /* 9 */ 0x2190, 0x2191, 0x2192, 0x2193, 0x2194, 0x2195, 0x2196, 0x2197, 0x2198, 0x2199, 0x219A, 0x219B, 0x219C, 0x219D, 0x219E, 0x219F, /* A */ 0x21A0, 0x21A1, 0x21A2, 0x21A3, 0x21A4, 0x21A5, 0x21A6, 0x21A7, 0x21A8, 0x21A9, 0x21AA, 0x21AB, 0x21AC, 0x21AD, 0x21AE, 0x21AF, /* B */ 0x21B0, 0x21B1, 0x21B2, 0x21B3, 0x21B4, 0x21B5, 0x21B6, 0x21B7, 0x21B8, 0x21B9, 0x21BA, 0x21BB, 0x21BC, 0x21BD, 0x21BE, 0x21BF, /* C */ 0x21C0, 0x21C1, 0x21C2, 0x21C3, 0x21C4, 0x21C5, 0x21C6, 0x21C7, 0x21C8, 0x21C9, 0x21CA, 0x21CB, 0x21CC, 0x21CD, 0x21CE, 0x21CF, /* D */ 0x21D0, 0x21D1, 0x21D2, 0x21D3, 0x21D4, 0x21D5, 0x21D6, 0x21D7, 0x21D8, 0x21D9, 0x21DA, 0x21DB, 0x21DC, 0x21DD, 0x21DE, 0x21DF, /* E */ 0x21E0, 0x21E1, 0x21E2, 0x21E3, 0x21E4, 0x21E5, 0x21E6, 0x21E7, 0x21E8, 0x21E9, 0x21EA, 0x21EB, 0x21EC, 0x21ED, 0x21EE, 0x21EF, /* F */ 0x21F0, 0x21F1, 0x21F2, 0x21F3, 0x21F4, 0x21F5, 0x21F6, 0x21F7, 0x21F8, 0x21F9, 0x21FA, 0x21FB, 0x21FC, 0x21FD, 0x21FE, 0x21FF, // Table 9 (for high byte 0xFE) /* 0 */ 0xFE00, 0xFE01, 0xFE02, 0xFE03, 0xFE04, 0xFE05, 0xFE06, 0xFE07, 0xFE08, 0xFE09, 0xFE0A, 0xFE0B, 0xFE0C, 0xFE0D, 0xFE0E, 0xFE0F, /* 1 */ 0xFE10, 0xFE11, 0xFE12, 0xFE13, 0xFE14, 0xFE15, 0xFE16, 0xFE17, 0xFE18, 0xFE19, 0xFE1A, 0xFE1B, 0xFE1C, 0xFE1D, 0xFE1E, 0xFE1F, /* 2 */ 0xFE20, 0xFE21, 0xFE22, 0xFE23, 0xFE24, 0xFE25, 0xFE26, 0xFE27, 0xFE28, 0xFE29, 0xFE2A, 0xFE2B, 0xFE2C, 0xFE2D, 0xFE2E, 0xFE2F, /* 3 */ 0xFE30, 0xFE31, 0xFE32, 0xFE33, 0xFE34, 0xFE35, 0xFE36, 0xFE37, 0xFE38, 0xFE39, 0xFE3A, 0xFE3B, 0xFE3C, 0xFE3D, 0xFE3E, 0xFE3F, /* 4 */ 0xFE40, 0xFE41, 0xFE42, 0xFE43, 0xFE44, 0xFE45, 0xFE46, 0xFE47, 0xFE48, 0xFE49, 0xFE4A, 0xFE4B, 0xFE4C, 0xFE4D, 0xFE4E, 0xFE4F, /* 5 */ 0xFE50, 0xFE51, 0xFE52, 0xFE53, 0xFE54, 0xFE55, 0xFE56, 0xFE57, 0xFE58, 0xFE59, 0xFE5A, 0xFE5B, 0xFE5C, 0xFE5D, 0xFE5E, 0xFE5F, /* 6 */ 0xFE60, 0xFE61, 0xFE62, 0xFE63, 0xFE64, 0xFE65, 0xFE66, 0xFE67, 0xFE68, 0xFE69, 0xFE6A, 0xFE6B, 0xFE6C, 0xFE6D, 0xFE6E, 0xFE6F, /* 7 */ 0xFE70, 0xFE71, 0xFE72, 0xFE73, 0xFE74, 0xFE75, 0xFE76, 0xFE77, 0xFE78, 0xFE79, 0xFE7A, 0xFE7B, 0xFE7C, 0xFE7D, 0xFE7E, 0xFE7F, /* 8 */ 0xFE80, 0xFE81, 0xFE82, 0xFE83, 0xFE84, 0xFE85, 0xFE86, 0xFE87, 0xFE88, 0xFE89, 0xFE8A, 0xFE8B, 0xFE8C, 0xFE8D, 0xFE8E, 0xFE8F, /* 9 */ 0xFE90, 0xFE91, 0xFE92, 0xFE93, 0xFE94, 0xFE95, 0xFE96, 0xFE97, 0xFE98, 0xFE99, 0xFE9A, 0xFE9B, 0xFE9C, 0xFE9D, 0xFE9E, 0xFE9F, /* A */ 0xFEA0, 0xFEA1, 0xFEA2, 0xFEA3, 0xFEA4, 0xFEA5, 0xFEA6, 0xFEA7, 0xFEA8, 0xFEA9, 0xFEAA, 0xFEAB, 0xFEAC, 0xFEAD, 0xFEAE, 0xFEAF, /* B */ 0xFEB0, 0xFEB1, 0xFEB2, 0xFEB3, 0xFEB4, 0xFEB5, 0xFEB6, 0xFEB7, 0xFEB8, 0xFEB9, 0xFEBA, 0xFEBB, 0xFEBC, 0xFEBD, 0xFEBE, 0xFEBF, /* C */ 0xFEC0, 0xFEC1, 0xFEC2, 0xFEC3, 0xFEC4, 0xFEC5, 0xFEC6, 0xFEC7, 0xFEC8, 0xFEC9, 0xFECA, 0xFECB, 0xFECC, 0xFECD, 0xFECE, 0xFECF, /* D */ 0xFED0, 0xFED1, 0xFED2, 0xFED3, 0xFED4, 0xFED5, 0xFED6, 0xFED7, 0xFED8, 0xFED9, 0xFEDA, 0xFEDB, 0xFEDC, 0xFEDD, 0xFEDE, 0xFEDF, /* E */ 0xFEE0, 0xFEE1, 0xFEE2, 0xFEE3, 0xFEE4, 0xFEE5, 0xFEE6, 0xFEE7, 0xFEE8, 0xFEE9, 0xFEEA, 0xFEEB, 0xFEEC, 0xFEED, 0xFEEE, 0xFEEF, /* F */ 0xFEF0, 0xFEF1, 0xFEF2, 0xFEF3, 0xFEF4, 0xFEF5, 0xFEF6, 0xFEF7, 0xFEF8, 0xFEF9, 0xFEFA, 0xFEFB, 0xFEFC, 0xFEFD, 0xFEFE, 0x0000, // Table 10 (for high byte 0xFF) /* 0 */ 0xFF00, 0xFF01, 0xFF02, 0xFF03, 0xFF04, 0xFF05, 0xFF06, 0xFF07, 0xFF08, 0xFF09, 0xFF0A, 0xFF0B, 0xFF0C, 0xFF0D, 0xFF0E, 0xFF0F, /* 1 */ 0xFF10, 0xFF11, 0xFF12, 0xFF13, 0xFF14, 0xFF15, 0xFF16, 0xFF17, 0xFF18, 0xFF19, 0xFF1A, 0xFF1B, 0xFF1C, 0xFF1D, 0xFF1E, 0xFF1F, /* 2 */ 0xFF20, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, /* 3 */ 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 0xFF58, 0xFF59, 0xFF5A, 0xFF3B, 0xFF3C, 0xFF3D, 0xFF3E, 0xFF3F, /* 4 */ 0xFF40, 0xFF41, 0xFF42, 0xFF43, 0xFF44, 0xFF45, 0xFF46, 0xFF47, 0xFF48, 0xFF49, 0xFF4A, 0xFF4B, 0xFF4C, 0xFF4D, 0xFF4E, 0xFF4F, /* 5 */ 0xFF50, 0xFF51, 0xFF52, 0xFF53, 0xFF54, 0xFF55, 0xFF56, 0xFF57, 0xFF58, 0xFF59, 0xFF5A, 0xFF5B, 0xFF5C, 0xFF5D, 0xFF5E, 0xFF5F, /* 6 */ 0xFF60, 0xFF61, 0xFF62, 0xFF63, 0xFF64, 0xFF65, 0xFF66, 0xFF67, 0xFF68, 0xFF69, 0xFF6A, 0xFF6B, 0xFF6C, 0xFF6D, 0xFF6E, 0xFF6F, /* 7 */ 0xFF70, 0xFF71, 0xFF72, 0xFF73, 0xFF74, 0xFF75, 0xFF76, 0xFF77, 0xFF78, 0xFF79, 0xFF7A, 0xFF7B, 0xFF7C, 0xFF7D, 0xFF7E, 0xFF7F, /* 8 */ 0xFF80, 0xFF81, 0xFF82, 0xFF83, 0xFF84, 0xFF85, 0xFF86, 0xFF87, 0xFF88, 0xFF89, 0xFF8A, 0xFF8B, 0xFF8C, 0xFF8D, 0xFF8E, 0xFF8F, /* 9 */ 0xFF90, 0xFF91, 0xFF92, 0xFF93, 0xFF94, 0xFF95, 0xFF96, 0xFF97, 0xFF98, 0xFF99, 0xFF9A, 0xFF9B, 0xFF9C, 0xFF9D, 0xFF9E, 0xFF9F, /* A */ 0xFFA0, 0xFFA1, 0xFFA2, 0xFFA3, 0xFFA4, 0xFFA5, 0xFFA6, 0xFFA7, 0xFFA8, 0xFFA9, 0xFFAA, 0xFFAB, 0xFFAC, 0xFFAD, 0xFFAE, 0xFFAF, /* B */ 0xFFB0, 0xFFB1, 0xFFB2, 0xFFB3, 0xFFB4, 0xFFB5, 0xFFB6, 0xFFB7, 0xFFB8, 0xFFB9, 0xFFBA, 0xFFBB, 0xFFBC, 0xFFBD, 0xFFBE, 0xFFBF, /* C */ 0xFFC0, 0xFFC1, 0xFFC2, 0xFFC3, 0xFFC4, 0xFFC5, 0xFFC6, 0xFFC7, 0xFFC8, 0xFFC9, 0xFFCA, 0xFFCB, 0xFFCC, 0xFFCD, 0xFFCE, 0xFFCF, /* D */ 0xFFD0, 0xFFD1, 0xFFD2, 0xFFD3, 0xFFD4, 0xFFD5, 0xFFD6, 0xFFD7, 0xFFD8, 0xFFD9, 0xFFDA, 0xFFDB, 0xFFDC, 0xFFDD, 0xFFDE, 0xFFDF, /* E */ 0xFFE0, 0xFFE1, 0xFFE2, 0xFFE3, 0xFFE4, 0xFFE5, 0xFFE6, 0xFFE7, 0xFFE8, 0xFFE9, 0xFFEA, 0xFFEB, 0xFFEC, 0xFFED, 0xFFEE, 0xFFEF, /* F */ 0xFFF0, 0xFFF1, 0xFFF2, 0xFFF3, 0xFFF4, 0xFFF5, 0xFFF6, 0xFFF7, 0xFFF8, 0xFFF9, 0xFFFA, 0xFFFB, 0xFFFC, 0xFFFD, 0xFFFE, 0xFFFF, }; // Returns the next non-ignorable codepoint within string starting from the // position indicated by index, or zero if there are no more. // The passed-in index is automatically advanced as the characters in the input // HFS-decomposed UTF-8 strings are read. inline int HFSReadNextNonIgnorableCodepoint(const char* string, int length, int* index) { int codepoint = 0; while (*index < length && codepoint == 0) { // CBU8_NEXT returns a value < 0 in error cases. For purposes of string // comparison, we just use that value and flag it with DCHECK. CBU8_NEXT(string, *index, length, codepoint); DCHECK_GT(codepoint, 0); if (codepoint > 0) { // Check if there is a subtable for this upper byte. int lookup_offset = lower_case_table[codepoint >> 8]; if (lookup_offset != 0) codepoint = lower_case_table[lookup_offset + (codepoint & 0x00FF)]; // Note: codepoint1 may be again 0 at this point if the character was // an ignorable. } } return codepoint; } } // namespace // Special UTF-8 version of FastUnicodeCompare. Cf: // http://developer.apple.com/mac/library/technotes/tn/tn1150.html#StringComparisonAlgorithm // The input strings must be in the special HFS decomposed form. int FilePath::HFSFastUnicodeCompare(StringPieceType string1, StringPieceType string2) { int length1 = string1.length(); int length2 = string2.length(); int index1 = 0; int index2 = 0; for (;;) { int codepoint1 = HFSReadNextNonIgnorableCodepoint(string1.data(), length1, &index1); int codepoint2 = HFSReadNextNonIgnorableCodepoint(string2.data(), length2, &index2); if (codepoint1 != codepoint2) return (codepoint1 < codepoint2) ? -1 : 1; if (codepoint1 == 0) { DCHECK_EQ(index1, length1); DCHECK_EQ(index2, length2); return 0; } } } StringType FilePath::GetHFSDecomposedForm(StringPieceType string) { StringType result; ScopedCFTypeRef<CFStringRef> cfstring( CFStringCreateWithBytesNoCopy( NULL, reinterpret_cast<const UInt8*>(string.data()), string.length(), kCFStringEncodingUTF8, false, kCFAllocatorNull)); if (cfstring) { // Query the maximum length needed to store the result. In most cases this // will overestimate the required space. The return value also already // includes the space needed for a terminating 0. CFIndex length = CFStringGetMaximumSizeOfFileSystemRepresentation(cfstring); DCHECK_GT(length, 0); // should be at least 1 for the 0-terminator. // Reserve enough space for CFStringGetFileSystemRepresentation to write // into. Also set the length to the maximum so that we can shrink it later. // (Increasing rather than decreasing it would clobber the string contents!) result.reserve(length); result.resize(length - 1); Boolean success = CFStringGetFileSystemRepresentation(cfstring, &result[0], length); if (success) { // Reduce result.length() to actual string length. result.resize(strlen(result.c_str())); } else { // An error occurred -> clear result. result.clear(); } } return result; } int FilePath::CompareIgnoreCase(StringPieceType string1, StringPieceType string2) { // Quick checks for empty strings - these speed things up a bit and make the // following code cleaner. if (string1.empty()) return string2.empty() ? 0 : -1; if (string2.empty()) return 1; StringType hfs1 = GetHFSDecomposedForm(string1); StringType hfs2 = GetHFSDecomposedForm(string2); // GetHFSDecomposedForm() returns an empty string in an error case. if (hfs1.empty() || hfs2.empty()) { NOTREACHED(); ScopedCFTypeRef<CFStringRef> cfstring1( CFStringCreateWithBytesNoCopy( NULL, reinterpret_cast<const UInt8*>(string1.data()), string1.length(), kCFStringEncodingUTF8, false, kCFAllocatorNull)); ScopedCFTypeRef<CFStringRef> cfstring2( CFStringCreateWithBytesNoCopy( NULL, reinterpret_cast<const UInt8*>(string2.data()), string2.length(), kCFStringEncodingUTF8, false, kCFAllocatorNull)); return CFStringCompare(cfstring1, cfstring2, kCFCompareCaseInsensitive); } return HFSFastUnicodeCompare(hfs1, hfs2); } #else // << WIN. MACOSX | other (POSIX) >> // Generic Posix system comparisons. int FilePath::CompareIgnoreCase(StringPieceType string1, StringPieceType string2) { // Specifically need null termianted strings for this API call. int comparison = strcasecmp(string1.as_string().c_str(), string2.as_string().c_str()); if (comparison < 0) return -1; if (comparison > 0) return 1; return 0; } #endif // OS versions of CompareIgnoreCase() void FilePath::StripTrailingSeparatorsInternal() { // If there is no drive letter, start will be 1, which will prevent stripping // the leading separator if there is only one separator. If there is a drive // letter, start will be set appropriately to prevent stripping the first // separator following the drive letter, if a separator immediately follows // the drive letter. StringType::size_type start = FindDriveLetter(path_) + 2; StringType::size_type last_stripped = StringType::npos; for (StringType::size_type pos = path_.length(); pos > start && IsSeparator(path_[pos - 1]); --pos) { // If the string only has two separators and they're at the beginning, // don't strip them, unless the string began with more than two separators. if (pos != start + 1 || last_stripped == start + 2 || !IsSeparator(path_[start - 1])) { path_.resize(pos - 1); last_stripped = pos; } } } FilePath FilePath::NormalizePathSeparators() const { return NormalizePathSeparatorsTo(kSeparators[0]); } FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const { #if defined(FILE_PATH_USES_WIN_SEPARATORS) DCHECK_NE(kSeparators + kSeparatorsLength, std::find(kSeparators, kSeparators + kSeparatorsLength, separator)); StringType copy = path_; for (size_t i = 0; i < kSeparatorsLength; ++i) { std::replace(copy.begin(), copy.end(), kSeparators[i], separator); } return FilePath(copy); #else return *this; #endif } #if defined(OS_ANDROID) bool FilePath::IsContentUri() const { return StartsWith(path_, "content://", base::CompareCase::INSENSITIVE_ASCII); } #endif } // namespace base
[ "xElvis89x@gmail.com" ]
xElvis89x@gmail.com
e6993d7c603c9f87f84e0472d09efe9d8e5da32e
da981ee274ee1ce7db2ae2f7e0bd0dd7e3e730db
/macros/utility.h
ef003c15bb4dff3d7da051489943bdedf8393d43
[]
no_license
cippy/WmassAnalysis
9478482fe0d35972d810fc48f0b0b93ba54a5d69
4de6233ac35e4cd4dcb30a7d6242d19028636f11
refs/heads/master
2020-12-31T06:22:16.672662
2018-03-20T14:39:05
2018-03-20T14:39:05
80,613,619
0
0
null
null
null
null
UTF-8
C++
false
false
131,989
h
#ifndef utility_h #define utility_h #include "../CMS_lumi.h" #include "./centerOfMassEnergy.h" #include <stdio.h> #include <stdlib.h> #include <cstdlib> //as stdlib.h #include <cstdio> #include <cmath> #include <iostream> #include <fstream> #include <sstream> // std::istringstream ; to read array of numbers from a line in a file #include <string> #include <vector> #include <map> #include <iomanip> //for input/output manipulators #include <algorithm> // to use the "reverse" function to reverse the order in the array #include <Rtypes.h> // to use kColor //ROOT header files #include <TROOT.h> #include <TAttFill.h> #include <TAxis.h> #include <TCanvas.h> #include <TChain.h> #include <TColor.h> #include <TF1.h> #include <TFile.h> #include <TFitResult.h> #include <TGraph2D.h> #include <TGraphErrors.h> #include <TGraphAsymmErrors.h> #include <THStack.h> #include <TH1.h> #include <TH1D.h> #include <TH1F.h> #include <TH2.h> #include <TKey.h> #include <TLatex.h> #include <TLegend.h> #include <TLegendEntry.h> #include <TLorentzVector.h> #include <TMath.h> #include <TMatrixDSym.h> #include <TMultiGraph.h> #include <TPad.h> #include <TPaletteAxis.h> #include <TPaveStats.h> #include <TPaveText.h> #include <TProfile.h> #include <TSpline.h> #include <TTreeIndex.h> #include <TTreeReader.h> #include <TTreeReaderArray.h> #include <TTreeReaderValue.h> #include <TStyle.h> #include <TString.h> #include <TVector3.h> #include <TVirtualFitter.h> #include <RooStats/RooStatsUtils.h> #include <RooStats/HLFactory.h> #include <RooRealVar.h> #include <RooArgSet.h> #include <RooDataHist.h> #include <RooFitResult.h> #include <RooWorkspace.h> #include <RooPlot.h> #include <RooHistPdf.h> #include <RooAddPdf.h> #include <RooAbsPdf.h> #include <RooRandom.h> #include <RooBinning.h> #include <RooMinimizer.h> using namespace std; //static string treeLocation = "/store/group/phys_smp/Wmass/perrozzi/ntuples/ntuples_2014_05_23_53X/"; //static string treeLocation = "/u2/emanuele/MCTrees_1LEP_80X_V1/"; static string PhpToCopy = "/afs/cern.ch/user/m/mciprian/www/index.php"; // define sample enum class Sample { data_doubleEG, data_singleEG, data_doubleMu, data_singleMu, wjets, wenujets, wmunujets, wtaunujets, zjets, wjets_LO, wenujets_LO, wmunujets_LO, wtaunujets_LO, zjets_LO, qcd_mu, qcd_ele, qcd_ele_fake, qcd_mu_fake, top, diboson }; enum LepFlavour {electron = 11, muon = 13, tau = 15}; // moved to centerOfMassEnergy.h //static Double_t intLumi = 36.4; //static Double_t intLumi = 19.7; //static Bool_t use8TeVSample = true; /* static Bool_t useTrackMet = true; */ /* static Bool_t useAbsIso = false; // rel iso or abs iso to cut (abs iso is rel iso times lepton pT) */ /* static bool useFakeRateForElectron = false; */ /* static bool useFakeRateForMuon = false; */ // electron ID variable class electronID { public: electronID(const Double_t & dEtaIn, const Double_t & dPhiIn, const Double_t & sigmaIetaIeta, // Sigma ieta-ieta const Double_t & HoE, const Double_t & dxy, const Double_t & dz, const Double_t & invE_minus_invP, const Int_t & vertexFitProb, const Int_t & missingHits ) : dEtaIn(dEtaIn), dPhiIn(dPhiIn), sigmaIetaIeta(sigmaIetaIeta), HoE(HoE), dxy(dxy), dz(dz), invE_minus_invP(invE_minus_invP), vertexFitProb(vertexFitProb), missingHits(missingHits){ }; ~electronID(){}; Double_t dEtaIn; Double_t dPhiIn; Double_t sigmaIetaIeta; Double_t HoE; Double_t dxy; Double_t dz; Double_t invE_minus_invP; Int_t vertexFitProb; Int_t missingHits; }; class electronTriggeringMVAID { public: electronTriggeringMVAID(const Double_t & mva, const Double_t & relPFiso, const Int_t & convVeto, const Int_t & maxMissingHits ) : mva(mva), relPFiso(relPFiso), convVeto(convVeto), maxMissingHits(maxMissingHits) {}; ~electronTriggeringMVAID(){}; Double_t mva; Double_t relPFiso; Int_t convVeto; Int_t maxMissingHits; }; class electronCutThreshold { public: electronCutThreshold(const Double_t & deta, const Double_t & dphi ) : deta(deta), dphi(dphi) {}; ~electronCutThreshold(){}; Double_t deta; Double_t dphi; }; //======================================= class eleIdWorkingPoint { public: eleIdWorkingPoint(const Double_t & dxy, const Double_t & dz, const Double_t & relIso04, const Int_t & convVeto, const Int_t & maxMissingHits, const Int_t & cutBasedId ) { dxy_ = dxy; dz_ = dz; relIso04_ = relIso04; convVeto_ = convVeto; maxMissingHits_ = maxMissingHits; cutBasedId_ = cutBasedId; } ~eleIdWorkingPoint(){}; void setDxy( const Double_t dxy) { dxy_ = dxy; }; void setDz( const Double_t dz) { dz_ = dz; }; void setRelIso04( const Double_t relIso04) { relIso04_ = relIso04; }; void setConvVeto( const Int_t convVeto) { convVeto_ = convVeto; }; void setMaxMissingHits(const Int_t maxMissingHits) { maxMissingHits_ = maxMissingHits; }; void setCutBasedId( const Int_t cutBasedId) { cutBasedId_ = cutBasedId; }; Double_t dxy() const { return dxy_; }; Double_t dz() const { return dz_; }; Double_t relIso04() const { return relIso04_; }; Int_t convVeto() const { return convVeto_; }; Int_t maxMissingHits() const { return maxMissingHits_; }; Int_t cutBasedId() const { return cutBasedId_; }; private: Double_t dxy_; Double_t dz_; Double_t relIso04_; Int_t convVeto_; Int_t maxMissingHits_; Int_t cutBasedId_; }; //============================================= class plotManager { public: plotManager(const string & histName, const string & xAxisName, const string & canvasName, const int & rebinFactor, const int & logy = 0 // 0 for both, 1 for no log, 2 for only log ) { histName_ = histName; xAxisName_ = xAxisName; canvasName_ = canvasName; rebinFactor_ = rebinFactor; logy_ = logy; }; ~plotManager() {}; string getHistName() const { return histName_; }; string getXaxisName() const { return xAxisName_; }; string getCanvasName() const { return canvasName_; }; int getRebinFactor() const { return rebinFactor_; }; int getLogy() const { return logy_; }; void setHistName (const string & histName ) { histName_ = histName; }; void setXaxisName (const string & xAxisName ) { xAxisName_ = xAxisName; }; void setCanvasName (const string & canvasName) { canvasName_ = canvasName; }; void setRebinFactor(const int & rebinFactor) { rebinFactor_ = rebinFactor; }; void setLogy (const int & logy) { logy_ = logy; }; private: string histName_; string xAxisName_; string canvasName_; int rebinFactor_; int logy_; }; //====================================================== string getTexLabel(const string& sampleDir = "wjets") { string label = ""; if (sampleDir == "qcd_ele") label = "QCD"; else if (sampleDir == "qcd_mu") label = "QCD"; else if (sampleDir == "wjets") label = "W(l#nu)+jets (aMC@NLO)"; else if (sampleDir == "wenujets") label = "W(e#nu)+jets (aMC@NLO)"; else if (sampleDir == "wmunujets") label = "W(#mu#nu)+jets (aMC@NLO)"; else if (sampleDir == "wtaunujets") label = "W(#tau#nu)+jets (aMC@NLO)"; else if (sampleDir == "wjets_LO") label = "W(l#nu)+jets (MadGraph)"; else if (sampleDir == "wenujets_LO") label = "W(e#nu)+jets (MadGraph)"; else if (sampleDir == "wmunujets_LO") label = "W(#mu#nu)+jets (MadGraph)"; else if (sampleDir == "wtaunujets_LO") label = "W(#tau#nu)+jets (MadGraph)"; else if (sampleDir == "zjets") label = "Z(ll)+jets (aMC@NLO)"; else if (sampleDir == "zjets_LO") label = "Z(ll)+jets (MadGraph)"; else if (sampleDir == "top") label = "t#bar{t}, single top"; else if (sampleDir == "diboson") label = "WW, WZ"; else if (sampleDir == "data_doubleEG") label = "data DoubleEG"; else if (sampleDir == "data_singleEG") label = "data singleEG"; else if (sampleDir == "data_doubleMu") label = "data DoubleMu"; else if (sampleDir == "data_singleMu") label = "data singleMu"; else if (sampleDir == "qcd_ele_fake") label = "QCD (fake rate)"; else if (sampleDir == "qcd_mu_fake") label = "QCD (fake rate)"; else { cout << "Error in getTexLabel(): directory name " << sampleDir << " unknown, please check. Exit" << endl; exit(EXIT_FAILURE); } return label; } //====================================================== void addOverflowInLastBin(TH1D *h) { // to avoid problems regarding memory leak for not deleting htemp in previous function, I sum directly the content of overflow bin in last bin Int_t lastBinNumber = h->GetNbinsX(); Int_t overflowBinNumber = 1 + lastBinNumber; Double_t lastBinContent = h->GetBinContent(lastBinNumber); Double_t overflowBinContent = h->GetBinContent(overflowBinNumber); Double_t lastBinError = h->GetBinError(lastBinNumber); Double_t overflowBinError = h->GetBinError(overflowBinNumber); // add content of overflow bin in last bin and set error as square root of sum of error squares (with the assumption that they are uncorrelated) h->SetBinContent(lastBinNumber, lastBinContent + overflowBinContent); h->SetBinError(lastBinNumber, sqrt(lastBinError * lastBinError + overflowBinError * overflowBinError)); // deleting content of overflow bin (safer, since I might be using that bin to add it again somewhere and I want it to be empty) h->SetBinContent(overflowBinNumber,0.0); h->SetBinError(overflowBinNumber,0.0); } //====================================================== void addUnderflowInFirstBin(TH1D *h) { // to avoid problems regarding memory leak for not deleting htemp in previous function, I sum directly the content of overflow bin in last bin // Int_t underflowBinNumber = 0; Double_t firstBinContent = h->GetBinContent(1); Double_t underflowBinContent = h->GetBinContent(0); Double_t firstBinError = h->GetBinError(1); Double_t underflowBinError = h->GetBinError(0); // add content of underflow bin in first bin and set error as square root of sum of error squares (with the assumption that they are uncorrelated) h->SetBinContent(1, firstBinContent + underflowBinContent); h->SetBinError(1, sqrt(firstBinError * firstBinError + underflowBinError * underflowBinError)); // deleting content of underflow bin (safer, since I might be using that bin to add it again somewhere and I want it to be empty) h->SetBinContent(0,0.0); h->SetBinError(0,0.0); } //====================================================== void addOutliersInHistoRange(TH1D* h) { addOverflowInLastBin(h); addUnderflowInFirstBin(h); } //====================================================== void checkPoint(const Int_t& nCheck = 1, const Int_t& checkEveryN = 100000, const Int_t& nEvents = -1) { if(nEvents % checkEveryN == 0) { cout << "check "<< nCheck << ": nEvents = " << nEvents << endl; cout << endl; } } //====================================================== void checkPoint(const string& message = "", const Int_t& checkEveryN = 100000, const Int_t& nEvents = -1) { if(nEvents % checkEveryN == 0) { cout << "check "<< message << ": nEvents = " << nEvents << endl; cout << endl; } } //===================================================================== Double_t my2sideCrystalBall(double* x, double* par) { //a priori we allow for different shape of right and left tail, thus two values of alpha and n Double_t xcur = x[0]; Double_t alphaL = par[0]; Double_t nL = par[1]; Double_t mu = par[2]; Double_t sigma = par[3]; Double_t N = par[4]; Double_t alphaR = par[5]; Double_t nR = par[6]; Double_t t = (xcur-mu)/sigma; Double_t absAlphaL = fabs((Double_t)alphaL); Double_t invAbsAlphaL = 1./absAlphaL; Double_t absAlphaR = fabs((Double_t)alphaR); Double_t invAbsAlphaR = 1./absAlphaR; if ( t<-absAlphaL ) { //cout<<"checkpoint dscb left"<<endl; Double_t AL = TMath::Power(nL*invAbsAlphaL,nL)*exp(-0.5*absAlphaL*absAlphaL); Double_t BL = nL*invAbsAlphaL - absAlphaL; return N*AL*TMath::Power(BL-t,-nL); } else if ( t <= absAlphaR ) { //cout<<"checkpoint dscb gaussian"<<endl; return N*exp(-0.5*t*t); } else { //cout<<"checkpoint dscb right"<<endl; Double_t AR = TMath::Power(nR*invAbsAlphaR,nR)*exp(-0.5*absAlphaR*absAlphaR); Double_t BR = nR*invAbsAlphaR - absAlphaR; return N*AR*TMath::Power(BR+t,-nR); } } //====================================================== void createPlotDirAndCopyPhp(const string& outputDIR) { if (outputDIR != "./") { system(("mkdir -p " + outputDIR).c_str()); system(("cp "+ PhpToCopy + " " + outputDIR).c_str()); } } //====================================================== string getStringFromEnumSample(const Sample& sample = Sample::zjets) { if (sample == Sample::data_doubleEG) return "data_doubleEG"; else if (sample == Sample::data_singleEG) return "data_singleEG"; if (sample == Sample::data_doubleMu) return "data_doubleMu"; else if (sample == Sample::data_singleMu) return "data_singleMu"; else if (sample == Sample::zjets) return "zjets"; else if (sample == Sample::zjets_LO) return "zjets_LO"; else if (sample == Sample::wjets) return "wjets"; else if (sample == Sample::wenujets) return "wenujets"; else if (sample == Sample::wmunujets) return "wmunujets"; else if (sample == Sample::wtaunujets) return "wtaunujets"; else if (sample == Sample::wjets_LO) return "wjets_LO"; else if (sample == Sample::wenujets_LO) return "wenujets_LO"; else if (sample == Sample::wmunujets_LO) return "wmunujets_LO"; else if (sample == Sample::wtaunujets_LO) return "wtaunujets_LO"; else if (sample == Sample::qcd_mu) return "qcd_mu"; else if (sample == Sample::qcd_ele) return "qcd_ele"; else if (sample == Sample::top) return "top"; else if (sample == Sample::diboson) return "diboson"; else if (sample == Sample::qcd_ele_fake) return "qcd_ele_fake"; else if (sample == Sample::qcd_mu_fake) return "qcd_mu_fake"; else { cout << "Error in getStringFromEnumSample(): unknown sample, please check. Exit" << endl; exit(EXIT_FAILURE); } } // ============================================ void quantiles(TGraph*gr = NULL, TH1* h = NULL) { const Int_t nq = gr->GetN(); // 20 bins Double_t xq[nq]; // position where to compute the quantiles in [0,1] Double_t yq[nq]; // array to contain the quantiles for (Int_t i=0 ; i<nq ; i++) xq[i] = Float_t(i)/(nq-1); h->GetQuantiles(nq,yq,xq); for (Int_t i=0 ; i<nq ; i++) gr->SetPoint(i,yq[i],xq[i]); // put efficiency on y axis } //============================================= Double_t doSoverB(TGraph* gsob = NULL, TH1* hwjets = NULL, TH1* hqcd = NULL) { const UInt_t npoints = gsob->GetN(); Double_t max = 0.0; Double_t xin = hwjets->GetBinCenter(1); Double_t step = (hwjets->GetBinCenter(hwjets->GetNbinsX()) - xin)/npoints; Double_t sob = 0.0; Double_t x_i = 0.0; Double_t s = 0.0; Double_t b = 0.0; for (UInt_t i = 0; i <npoints; i++ ) { x_i = xin + ((Double_t)i) * step; s = hwjets->Integral(0, hwjets->FindFixBin(x_i)); b = hqcd->Integral(0, hqcd->FindFixBin(x_i)); sob = s / b; //cout << "x: " << x_i << " s: " << s << " b: " << b << " s/b: " << sob << endl; gsob->SetPoint(i,x_i, sob); if (max < sob) max = sob; } return max; } //============================================= void doEfficiencyFromTH2(TH2* h2 = NULL, const TH2* h2orig = NULL, const Bool_t revert = false) { // with revert == true, the efficiency is obtained from the integral from X to end (otherwise from beginning to x) for (Int_t ix = 1; ix <= h2->GetNbinsX(); ix++) { // include underflow and overflow in the integral Double_t yIntegralFixedX = h2orig->Integral(ix, ix, 0, 1 + h2orig->GetNbinsY()); Double_t integralRange = 0.0; for (Int_t iy = 1; iy <= h2->GetNbinsY(); iy++) { integralRange = revert ? h2orig->Integral(ix, ix, iy, 1 + h2orig->GetNbinsY()) : h2orig->Integral(ix, ix, 0, iy); h2->SetBinContent(ix,iy, integralRange/yIntegralFixedX); } } } //============================================= void makeROC(TGraph* gr = NULL, const TH1* hsTmp = NULL, const TH1* hbTmp = NULL) { // clone original histogram // this is only needed if the histogram passed as argument is declared const in this function // because in this case cannot use methods like TH1::FindBin which is not declared const TH1* hs = (TH1*) hsTmp->Clone(); TH1* hb = (TH1*) hbTmp->Clone(); const Int_t nq = gr->GetN(); Double_t xq[nq]; // position where to compute the quantiles in [0,1] Double_t yq[nq]; // array to contain the quantiles for (Int_t i=0 ; i<nq ; i++) xq[i] = Float_t(i)/(nq-1); hs->GetQuantiles(nq,yq,xq); Double_t integralB = hb->Integral(0, hb->GetNbinsX()+1); for (Int_t ipoint = 0; ipoint < nq; ipoint++) { Double_t effB = hb->Integral(0, hb->FindFixBin(yq[ipoint])) / integralB; gr->SetPoint(ipoint, effB, xq[ipoint]); } } //====================================================== void myAddOverflowInLastBin(TH1 *h) { Int_t lastBinNumber = h->GetNbinsX(); Int_t overflowBinNumber = 1 + lastBinNumber; Double_t lastBinContent = h->GetBinContent(lastBinNumber); Double_t overflowBinContent = h->GetBinContent(overflowBinNumber); Double_t lastBinError = h->GetBinError(lastBinNumber); Double_t overflowBinError = h->GetBinError(overflowBinNumber); // add content of overflow bin in last bin and set error as square root of sum of error squares (with the assumption that they are uncorrelated) h->SetBinContent(lastBinNumber, lastBinContent + overflowBinContent); h->SetBinError(lastBinNumber, sqrt(lastBinError * lastBinError + overflowBinError * overflowBinError)); // deleting content of last bin (safer, since I might be using that bin to add it again somewhere and I want it to be empty) h->SetBinContent(overflowBinNumber,0.0); h->SetBinError(overflowBinNumber,0.0); } //====================================================== void myRebinHisto(TH1 *h, const Int_t rebinFactor = 1) { if (rebinFactor != 1) { h->Rebin(rebinFactor); if ( (h->GetNbinsX() % rebinFactor) != 0) myAddOverflowInLastBin(h); } } //====================================================== TH1* getHistCloneFromFile(TFile* inputFile = NULL, const string& hvarName = "", const string& sampleDir = "") { // use sampleDir to select a directory, default is the first one // use sampleDir without "/" at the end TH1* hvar = NULL; if (!inputFile || inputFile == NULL || inputFile->IsZombie()) { cout << "Error in getHistCloneFromFile(): file not opened. Exit" << endl; exit(EXIT_FAILURE); } if (sampleDir == "") hvar = (TH1*) inputFile->Get((hvarName).c_str()); else hvar = (TH1*) inputFile->Get((sampleDir + "/" + hvarName).c_str()); if (!hvar || hvar == NULL) { cout << "Error in getHistCloneFromFile(): histogram '" << hvarName << "' not found in file (directory is " << sampleDir << "). End of programme." << endl; exit(EXIT_FAILURE); } return (TH1*) hvar->Clone(sampleDir.c_str()); } //================================================== TGraph* getGraphCloneFromFile(TFile* inputFile = NULL, const string& graphvarName = "", const string& sampleDir = "", const string &filename = "") { // use sampleDir to select a directory, default is the first one // use sampleDir without "/" at the end TGraph* graphvar = NULL; if (!inputFile || inputFile == NULL || inputFile->IsZombie()) { cout << "Error in getGraphCloneFromFile(): file not opened. Exit" << endl; exit(EXIT_FAILURE); } if (sampleDir == "") graphvar = (TGraph*) inputFile->Get((graphvarName).c_str()); else graphvar = (TGraph*) inputFile->Get((sampleDir + "/" + graphvarName).c_str()); if (!graphvar || graphvar == NULL) { cout << "Error in getGraphCloneFromFile(): graph '" << graphvarName << "' not found in file '" << filename << "' (directory is " << sampleDir << "). End of programme." << endl; exit(EXIT_FAILURE); } return (TGraph*) graphvar->Clone(sampleDir.c_str()); } //====================================================== TH2* getHist2CloneFromFile(TFile* inputFile = NULL, const string& hvarName = "", const string& sampleDir = "") { // use sampleDir to select a directory, default is the first one // use sampleDir without "/" at the end TH2* hvar = NULL; if (!inputFile || inputFile == NULL || inputFile->IsZombie()) { cout << "Error in getHistCloneFromFile(): file not opened. Exit" << endl; exit(EXIT_FAILURE); } if (sampleDir == "") hvar = (TH2*) inputFile->Get((hvarName).c_str()); else hvar = (TH2*) inputFile->Get((sampleDir + "/" + hvarName).c_str()); if (!hvar || hvar == NULL) { cout << "Error in getHistCloneFromFile(): histogram '" << hvarName << "' not found in file (directory is " << sampleDir << "). End of programme." << endl; exit(EXIT_FAILURE); } return (TH2*) hvar->Clone(sampleDir.c_str()); } //====================================================== void checkNotNullPtr(TH1* hptr, const string& ptrName = "hptr") { if ( hptr == NULL) { cout << "Error: pointer " << ptrName << " is NULL. Exit" << endl; exit(EXIT_FAILURE); } } //====================================================== void checkNotNullPtr(TGraph* graphptr, const string& ptrName = "graphptr") { if ( graphptr == NULL) { cout << "Error: pointer " << ptrName << " is NULL. Exit" << endl; exit(EXIT_FAILURE); } } //====================================================== void checkNotNullPtr(TObject* objptr, const string& ptrName = "graphptr") { if ( objptr == NULL) { cout << "Error: pointer " << ptrName << " is NULL. Exit" << endl; exit(EXIT_FAILURE); } } //====================================================== void checkNotNullPtr(TH2* hptr, const string& ptrName = "hptr") { if ( hptr == NULL) { cout << "Error: pointer " << ptrName << " is NULL. Exit" << endl; exit(EXIT_FAILURE); } } //====================================================== string getStringFromDouble(const Double_t& num = 1.0, const Double_t epsilon = 0.00001) { // warning: using up to 3 decimal Int_t i = (Int_t) num; // stringstream ss; // ss<<i; // string numStr = ss.str(); Int_t int_decim = (Int_t) (1000 * (num - (Double_t) i + epsilon)); if (int_decim%1000 == 0) return string(Form("%dp%d",i,int_decim/1000)); else if (int_decim%100 == 0) return string(Form("%dp%d",i,int_decim/100)); else if (int_decim%10 == 0) return string(Form("%dp%d",i,int_decim/10)); else return string(Form("%dp%d",i,int_decim)); } //====================================================== /* string getDoubleFromString(const string& numberStr = "1.0", const Double_t epsilon = 0.00001) { */ /* int */ /* Int_t i = (Int_t) num; */ /* // stringstream ss; */ /* // ss<<i; */ /* // string numStr = ss.str(); */ /* Int_t int_decim = (Int_t) (1000 * (num - (Double_t) i + epsilon)); */ /* if (int_decim%1000 == 0) return string(Form("%dp%d",i,int_decim/1000)); */ /* else if (int_decim%100 == 0) return string(Form("%dp%d",i,int_decim/100)); */ /* else if (int_decim%10 == 0) return string(Form("%dp%d",i,int_decim/10)); */ /* else return string(Form("%dp%d",i,int_decim)); */ /* } */ //====================================================== void fillTH1(TH1* histo, const Double_t val, const Double_t weight = 1.0, const Bool_t useOverflowBin = true) { // embed overflow if useOverflowBin = true (default) if(val < histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1)) histo->Fill(val,weight); else if ( useOverflowBin ) histo->Fill(histo->GetXaxis()->GetBinCenter(histo->GetNbinsX()),weight); else histo->Fill(val,weight); } //====================================================== void fillTH2(TH2* histo, const Double_t valx, const Double_t valy, const Double_t weight = 1.0){ // Embed- the overflow Double_t x = 0; if(valx < histo->GetXaxis()->GetBinLowEdge(histo->GetNbinsX()+1)) x = valx; else x =histo->GetXaxis()->GetBinCenter(histo->GetNbinsX()); double y = 0; if(valy < histo->GetYaxis()->GetBinLowEdge(histo->GetNbinsY()+1)) y = valy; else y = histo->GetYaxis()->GetBinCenter(histo->GetNbinsY()); histo->Fill(x,y,weight); } //====================================================== Double_t getDphi(Double_t phi1, Double_t phi2) { Double_t dphi = phi1 -phi2; if(dphi > TMath::Pi()) dphi -= 2*TMath::Pi(); if(dphi < -TMath::Pi()) dphi += 2*TMath::Pi(); return dphi; } //====================================================== Int_t findGenPartFromWLNu(const Int_t nGenParticles, TTreeReaderArray<Int_t>& particleId, TTreeReaderArray<Int_t>& particleMotherId, const Int_t lepFlavour, Int_t& genPartIndex2, Int_t& genBosonIndex) { // This function looks whether there are a lepton and a neutrino from a W in //the array. It works when using Emanuele's tree. // It also looks for the index of the mother in the list of particles, that is a W // The algorithm looks for a lepton and neutrino (or antineutrino) originating from mother in the list of generated particles. // The function returns 1 if the search is successful, and 0 otherwise genPartIndex2 = -1; genBosonIndex = -1; Int_t genPartIndex = -1; // will become the index of the lepton from W if search is successful. Otherwise it is a negative value Int_t i = 0; // index of the array Int_t Wid = 0; Int_t lepCharge = 0; Bool_t Wfound = false; Bool_t firstLepFound = false; Bool_t secondLepFound = false; //first look for a W (assuming there's only 1) // PGD ID W+(W-) = 24(-24) // PDG ID e-(e+) = 11(-11) // PDG ID mu-(mu+) = 13(-13) // PDG ID tau-(tau+) = 15(-15) while ((not Wfound) && (i < nGenParticles)) { if (fabs(particleId[i]) == 24) { genBosonIndex = i; Wid = particleId[i]; lepCharge = (Wid > 0) ? -1 : 1; Wfound = true; //cout << "Found W" << endl; } i++; } i = 0; if (Wfound) { while ((not firstLepFound) && (i < nGenParticles)) { if ( (particleMotherId[i] == Wid) && (particleId[i] == (lepCharge * lepFlavour)) ) { genPartIndex = i; firstLepFound = true; } i++; } i = 0; // to search for neutrino, reset i and start search from the beginning if (firstLepFound) { Int_t chargedLeptonPdgID = particleId[genPartIndex]; Int_t neutrinoPdgID = 0; if (chargedLeptonPdgID == 11) neutrinoPdgID = -12; else if (chargedLeptonPdgID == -11) neutrinoPdgID = 12; else if (chargedLeptonPdgID == 13) neutrinoPdgID = -14; else if (chargedLeptonPdgID == -13) neutrinoPdgID = 14; while ( (not secondLepFound) && (i < nGenParticles)) { if ( (particleMotherId[i] == Wid) && (particleId[i] == neutrinoPdgID) ) { genPartIndex2 = i; secondLepFound = true; } i++; } } } //if (secondLepFound) cout << particleId[genBosonIndex] << " " << particleId[genPartIndex] << " " << particleId[genPartIndex2] << endl; if (firstLepFound && secondLepFound) return genPartIndex; // return index of first particle else return -1; // if 2 leptons are not found, return -1 as if even the first one was not found } //====================================================== Int_t findGenPartFromZLL(const Int_t nGenParticles, TTreeReaderArray<Int_t>& particleId, TTreeReaderArray<Int_t>& particleMotherId, const Int_t lepFlavour, Int_t& genPartIndex2, Int_t& genBosonIndex) { // This function looks whether there are a lepton and a neutrino from a W in //the array. It works when using Emanuele's tree. // It also looks for the index of the mother in the list of particles, that is a W // The algorithm looks for a lepton and neutrino (or antineutrino) originating from mother in the list of generated particles. // The function returns 1 if the search is successful, and 0 otherwise Int_t genPartIndex = -1; // will become the index of the lepton from W if search is successful. Otherwise it is a negative value Int_t i = 0; // index of the array Int_t Zid = 23; Bool_t Zfound = false; Bool_t firstLepFound = false; Bool_t secondLepFound = false; genPartIndex2 = -1; genBosonIndex = -1; //first look for a Z (assuming there's only 1) // PGD ID Z = 23 // PDG ID e-(e+) = 11(-11) // PDG ID mu-(mu+) = 13(-13) // PDG ID tau-(tau+) = 15(-15) while ((not Zfound) && (i < nGenParticles)) { if (fabs(particleId[i]) == Zid) { Zfound = true; genBosonIndex = i; } i++; } i = 0; if (Zfound) { // search first lepton from Z while ((not firstLepFound) && (i < nGenParticles)) { if ( (particleMotherId[i] == Zid) && (fabs(particleId[i]) == lepFlavour) ) { genPartIndex = i; firstLepFound = true; } i++; } // search for second lepton (start from current i) if (firstLepFound) { while ( (not secondLepFound) && (i < nGenParticles)) { if ( (particleMotherId[i] == Zid) && ( (particleId[i] + particleId[genPartIndex]) == 0) ) { genPartIndex2 = i; secondLepFound = true; } i++; } } } if (firstLepFound && secondLepFound) return genPartIndex; // return index of first particle else return -1; // if 2 leptons are not found, return -1 as if even the first one was not found } //============================================================= Bool_t getAxisRangeFromUser(string& axisName, Double_t& min, Double_t& max, const string& axisNameTmp = "", const string& separator = "::", const string& rangeSeparator = "," ) { Bool_t setXAxisRangeFromUser = false; size_t pos = axisNameTmp.find(separator); if (pos != string::npos) { string xrange = ""; setXAxisRangeFromUser = true; axisName.assign(axisNameTmp, 0, pos); xrange.assign(axisNameTmp, pos + separator.size(), string::npos); pos = xrange.find(rangeSeparator); string numString = ""; numString.assign(xrange,0,pos); min = std::stod(numString); numString.assign(xrange,pos + rangeSeparator.size(), string::npos); max = std::stod(numString); } else { axisName = axisNameTmp; } return setXAxisRangeFromUser; } //============================================= void drawGraph(vector<TGraph*> gr_roc_S_B = {}, const string& xAxisNameTmp = "xAxis", const string& yAxisNameTmp = "yAxis", const string& canvasName = "default", const string& outputDIR = "./", const vector<string>& leg_roc = {""}, const vector<Double_t>& legCoord = {0.5,0.15,0.9,0.35}) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); string yAxisName = ""; Double_t ymin = 0; Double_t ymax = 0; Bool_t setYAxisRangeFromUser = getAxisRangeFromUser(yAxisName, ymin, ymax, yAxisNameTmp); Int_t nGraphs = gr_roc_S_B.size(); TCanvas* canvas = new TCanvas("canvas","",600,600); canvas->cd(); canvas->SetFillColor(0); canvas->SetGrid(); canvas->SetRightMargin(0.06); canvas->cd(); // TLegend leg (0.5,0.15,0.9,0.15+0.05*nGraphs); TLegend leg (legCoord[0],legCoord[1],legCoord[2],legCoord[3]); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); Int_t colorList[] = {kBlack, kBlue, kRed, kGreen+2, kOrange+1, kCyan+2, kGray+2}; for (Int_t ig = 0; ig < nGraphs; ig++) { gr_roc_S_B[ig]->SetMarkerStyle(21); gr_roc_S_B[ig]->SetMarkerColor(colorList[ig]); gr_roc_S_B[ig]->SetLineColor(colorList[ig]); gr_roc_S_B[ig]->SetFillColor(colorList[ig]); if (ig == 0) gr_roc_S_B[ig]->Draw("alp"); else gr_roc_S_B[ig]->Draw("lp same"); leg.AddEntry(gr_roc_S_B[ig],leg_roc[ig].c_str(),"LF"); } leg.Draw("same"); gr_roc_S_B[0]->GetXaxis()->SetTitle(xAxisName.c_str()); gr_roc_S_B[0]->GetYaxis()->SetTitle(yAxisName.c_str()); if (setXAxisRangeFromUser) gr_roc_S_B[0]->GetXaxis()->SetRangeUser(xmin,xmax); if (setYAxisRangeFromUser) gr_roc_S_B[0]->GetYaxis()->SetRangeUser(ymin,ymax); canvas->RedrawAxis("sameaxis"); canvas->SaveAs((outputDIR+canvasName+".png").c_str()); canvas->SaveAs((outputDIR+canvasName+".pdf").c_str()); delete canvas; } //============================================= void drawGraphCMS(vector<TGraph*> grList = {}, const string& xAxisNameTmp = "xAxis", const string& yAxisNameTmp = "yAxis", const string& canvasName = "default", const string& outputDIR = "./", const vector<string>& leg_roc = {""}, const vector<Double_t>& legCoord = {0.5,0.15,0.9,0.35}, const Double_t lumi = -1.0 ) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); string yAxisName = ""; Double_t ymin = 0; Double_t ymax = 0; Bool_t setYAxisRangeFromUser = getAxisRangeFromUser(yAxisName, ymin, ymax, yAxisNameTmp); Int_t nGraphs = grList.size(); TCanvas* canvas = new TCanvas("canvas","",600,600); canvas->cd(); canvas->SetFillColor(0); canvas->SetGrid(); canvas->SetRightMargin(0.06); canvas->cd(); // TLegend leg (0.5,0.15,0.9,0.15+0.05*nGraphs); TLegend leg (legCoord[0],legCoord[1],legCoord[2],legCoord[3]); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); Int_t colorList[] = {kBlack, kRed, kGreen+2, kBlue, kOrange+1, kCyan+2, kGray+2}; for (Int_t ig = 0; ig < nGraphs; ig++) { grList[ig]->SetMarkerStyle(20); grList[ig]->SetMarkerColor(colorList[ig]); grList[ig]->SetLineColor(colorList[ig]); grList[ig]->SetLineWidth(2); grList[ig]->SetFillColor(colorList[ig]); if (ig == 0) grList[ig]->Draw("ap"); else grList[ig]->Draw("p same"); leg.AddEntry(grList[ig],leg_roc[ig].c_str(),"LF"); } leg.Draw("same"); grList[0]->GetXaxis()->SetTitleSize(0.05); grList[0]->GetXaxis()->SetLabelSize(0.04); grList[0]->GetYaxis()->SetTitleOffset(1.1); grList[0]->GetYaxis()->SetTitleSize(0.05); grList[0]->GetYaxis()->SetLabelSize(0.04); grList[0]->GetXaxis()->SetTitle(xAxisName.c_str()); grList[0]->GetYaxis()->SetTitle(yAxisName.c_str()); if (setXAxisRangeFromUser) grList[0]->GetXaxis()->SetRangeUser(xmin,xmax); if (setYAxisRangeFromUser) grList[0]->GetYaxis()->SetRangeUser(ymin,ymax); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",true,false); else CMS_lumi(canvas,Form("%.1f",lumi),true,false); setTDRStyle(); canvas->RedrawAxis("sameaxis"); canvas->SaveAs((outputDIR+canvasName+".png").c_str()); canvas->SaveAs((outputDIR+canvasName+".pdf").c_str()); delete canvas; } //============================================================= void drawTH1pair(TH1* h1, TH1* h2, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const string& legEntry1 = "data", const string& legEntry2 = "MC", const string& ratioPadYaxisName = "data/MC", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t drawPlotLogY = true) { TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; myRebinHisto(h1,rebinFactor); myRebinHisto(h2,rebinFactor); Double_t intNum, intDen, errNum, errDen; intNum = h1->IntegralAndError(1,h1->GetNbinsX(),errNum); intDen = h2->IntegralAndError(1,h2->GetNbinsX(),errDen); Double_t IntegralRatio = intNum/intDen; Double_t ratioError = IntegralRatio * sqrt(errNum*errNum/(intNum*intNum) + errDen*errDen/(intDen*intDen)); if (yAxisName == "a.u.") { h1->Scale(1./h1->Integral()); h2->Scale(1./h2->Integral()); } h1->SetStats(0); h2->SetStats(0); TCanvas* canvas = new TCanvas("canvas","",600,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.3); canvas->SetRightMargin(0.06); TPad *pad2 = new TPad("pad2","pad2",0,0.,1,0.9); pad2->SetTopMargin(0.7); pad2->SetRightMargin(0.06); pad2->SetFillColor(0); pad2->SetGridy(1); pad2->SetFillStyle(0); TH1* frame = (TH1*) h1->Clone("frame"); frame->GetXaxis()->SetLabelSize(0.04); frame->SetStats(0); h1->SetLineColor(kBlack); h1->SetMarkerColor(kBlack); h1->SetMarkerStyle(20); h1->SetMarkerSize(1); h1->GetXaxis()->SetLabelSize(0); h1->GetYaxis()->SetTitle(yAxisName.c_str()); h1->GetYaxis()->SetTitleOffset(1.1); // h1->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size h1->GetYaxis()->SetTitleSize(0.05); //h1->GetYaxis()->SetRangeUser(0.0, max(h1->GetMaximum(),h2->GetMaximum()) * 1.2); h1->GetYaxis()->SetRangeUser(0.0, max(h1->GetBinContent(h1->GetMaximumBin()),h2->GetBinContent(h2->GetMaximumBin())) * 1.2); if (setXAxisRangeFromUser) h1->GetXaxis()->SetRangeUser(xmin,xmax); h1->Draw("EP"); h2->SetLineColor(kRed); h2->SetLineWidth(2); h2->Draw("hist same"); TLegend leg (0.5,0.7,0.9,0.9); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); leg.AddEntry(h1,legEntry1.c_str(),"PLE"); leg.AddEntry(h2,legEntry2.c_str(),"L"); leg.Draw("same"); canvas->RedrawAxis("sameaxis"); TPaveText *pvtxt = NULL; if (yAxisName == "a.u.") { pvtxt = new TPaveText(0.5,0.6,0.90,0.7, "BR NDC"); pvtxt->SetFillColor(0); pvtxt->SetFillStyle(0); pvtxt->SetBorderSize(0); pvtxt->AddText(Form("norm num/den = %.2f +/- %.2f",IntegralRatio,ratioError)); pvtxt->Draw(); } // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",false,false); else CMS_lumi(canvas,Form("%.1f",lumi),false,false); setTDRStyle(); pad2->Draw(); pad2->cd(); frame->Reset("ICES"); frame->GetYaxis()->SetRangeUser(0.5,1.5); frame->GetYaxis()->SetNdivisions(5); frame->GetYaxis()->SetTitle(ratioPadYaxisName.c_str()); frame->GetYaxis()->SetTitleOffset(1.2); // frame->GetYaxis()->SetTitleSize(0.15); frame->GetYaxis()->CenterTitle(); frame->GetXaxis()->SetTitle(xAxisName.c_str()); if (setXAxisRangeFromUser) frame->GetXaxis()->SetRangeUser(xmin,xmax); // frame->GetXaxis()->SetTitleOffset(0.8); frame->GetXaxis()->SetTitleSize(0.05); TH1D* ratio = (TH1D*) h1->Clone("ratio"); TH1D* den_noerr = (TH1D*) h2->Clone("den_noerr"); TH1D* den = (TH1D*) h2->Clone("den"); for(int iBin = 1; iBin < den->GetNbinsX()+1; iBin++) den_noerr->SetBinError(iBin,0.); ratio->Divide(den_noerr); den->Divide(den_noerr); den->SetFillColor(kGray); frame->Draw(); ratio->SetMarkerSize(0.85); ratio->Draw("EPsame"); den->Draw("E2same"); TF1* line = new TF1("horiz_line","1",ratio->GetXaxis()->GetBinLowEdge(1),ratio->GetXaxis()->GetBinLowEdge(ratio->GetNbinsX()+1)); line->SetLineColor(kRed); line->SetLineWidth(2); line->Draw("Lsame"); ratio->Draw("EPsame"); pad2->RedrawAxis("sameaxis"); // Calculate chi2 double chi2 = h1->Chi2Test(h2,"CHI2/NDF WW"); TLegend leg2 (0.14,0.25,0.32,0.28,NULL,"brNDC"); leg2.SetFillColor(0); leg2.SetFillStyle(1); leg2.SetBorderSize(0); leg2.SetLineColor(0); leg2.AddEntry((TObject*)0,Form("#chi^{2}/ndf = %.2f",chi2),""); leg2.Draw("same"); canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); if (drawPlotLogY) { if (yAxisName == "a.u.") h1->GetYaxis()->SetRangeUser(max(0.0001,min(h1->GetMinimum(),h2->GetMinimum())*0.8),max(h1->GetMaximum(),h2->GetMaximum())*100); else h1->GetYaxis()->SetRangeUser(max(0.001,min(h1->GetMinimum(),h2->GetMinimum())*0.8),max(h1->GetMaximum(),h2->GetMaximum())*100); canvas->SetLogy(); /* if (lumi < 0) CMS_lumi(canvas,"",true,false); */ /* else CMS_lumi(canvas,Form("%.1f",lumi),true,false); */ canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); canvas->SetLogy(0); } delete canvas; } //============================================================= void draw_nTH1(vector<TH1*> vecHist1d = {}, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const vector<string>& vecLegEntry = {""}, const string& ratioPadYaxisName = "var/nominal", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t drawPlotLogY = true, const Bool_t drawRatioWithNominal = false // to be implemented ) { // assume the "nominal histogram is the first one TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; for (UInt_t i = 0; i < vecHist1d.size(); i++) { myRebinHisto(vecHist1d[i],rebinFactor); if (yAxisName == "a.u.") vecHist1d[i]->Scale(1./vecHist1d[i]->Integral()); vecHist1d[i]->SetStats(0); } Int_t canvasWidth = 700; Int_t canvasHeight = 600; if (drawRatioWithNominal) { canvasWidth = 600; canvasHeight = 700; } TCanvas* canvas = new TCanvas("canvas","",canvasWidth,canvasHeight); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); if (drawRatioWithNominal) canvas->SetBottomMargin(0.3); canvas->SetRightMargin(0.06); TPad *pad2 = new TPad("pad2","pad2",0,0.,1,0.9); pad2->SetTopMargin(0.7); pad2->SetRightMargin(0.06); pad2->SetFillColor(0); pad2->SetGridy(1); pad2->SetFillStyle(0); TH1* frame = (TH1*) vecHist1d[0]->Clone("frame"); frame->GetXaxis()->SetLabelSize(0.04); frame->SetStats(0); Int_t colorList[] = {kBlack, kBlue, kRed, kGreen+2, kOrange+1, kCyan, kGreen, kCyan+2, kGray+1, kViolet, kYellow+2}; vector<Int_t> histColor; for (UInt_t i = 0; i < vecHist1d.size(); i++) { // now color are assigned in reverse order (the main contribution is the last object in the sample array) vecHist1d[i]->SetLineColor(colorList[i]); vecHist1d[i]->SetLineWidth(2); vecHist1d[i]->SetFillColor(0); } if (drawRatioWithNominal) { vecHist1d[0]->GetXaxis()->SetLabelSize(0); vecHist1d[0]->GetXaxis()->SetTitle(0); } else { vecHist1d[0]->GetXaxis()->SetTitle(xAxisName.c_str()); // vecHist1d[0]->GetXaxis()->SetTitleOffset(0.8); vecHist1d[0]->GetXaxis()->SetLabelSize(0.04); vecHist1d[0]->GetXaxis()->SetTitleSize(0.05); } vecHist1d[0]->GetYaxis()->SetTitle(yAxisName.c_str()); vecHist1d[0]->GetYaxis()->SetTitleOffset(1.1); // vecHist1d[0]->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size vecHist1d[0]->GetYaxis()->SetTitleSize(0.05); //vecHist1d[0]->GetYaxis()->SetRangeUser(0.0, max(vecHist1d[0]->GetMaximum(),h2->GetMaximum()) * 1.2); ////////////////////////////// // set X and Y axis range // search for maximum Y and for minimum > 0 (latter only if using log scale for Y axis Double_t maxY = -999.0; for (UInt_t i = 0; i < vecHist1d.size(); i++) { if ( vecHist1d[i]->GetBinContent(vecHist1d[i]->GetMaximumBin()) > maxY ) maxY = vecHist1d[i]->GetBinContent(vecHist1d[i]->GetMaximumBin()); } Double_t minY = 1e34; if (drawPlotLogY) { // quick check if there are no empty bins for (UInt_t i = 0; i < vecHist1d.size(); i++) { if ( vecHist1d[i]->GetBinContent(vecHist1d[i]->GetMinimumBin()) < minY ) minY = vecHist1d[i]->GetBinContent(vecHist1d[i]->GetMinimumBin()); } if (fabs(minY) < 0.00000001) { minY = 1e34; for (UInt_t ihist = 0; ihist < vecHist1d.size(); ihist++) { for (Int_t ibin = 0; ibin <= vecHist1d[ihist]->GetNbinsX(); ibin++ ) { if (vecHist1d[ihist]->GetBinContent(ibin) > 0.0000001 && minY > vecHist1d[ihist]->GetBinContent(ibin)) minY = vecHist1d[ihist]->GetBinContent(ibin); } } } } vecHist1d[0]->GetYaxis()->SetRangeUser(0.0, maxY * 1.2); if (setXAxisRangeFromUser) vecHist1d[0]->GetXaxis()->SetRangeUser(xmin,xmax); ////////////////////// vecHist1d[0]->Draw("Hist"); vecHist1d[0]->SetFillColor(0); vecHist1d[0]->SetMarkerStyle(0); for (UInt_t i = 1; i < vecHist1d.size(); i++) { vecHist1d[i]->Draw("hist same"); } double legLowY = 0.75; if (vecHist1d.size() > 4) legLowY = max( 0.5, legLowY - 0.4 * (vecHist1d.size() - 4) ); TLegend leg (0.58,0.70,0.95,0.9); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); for (UInt_t i = 0; i < vecHist1d.size(); i++) { leg.AddEntry(vecHist1d[i],vecLegEntry[i].c_str(),"L"); } leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); bool cmsPreliminaryIsUp = false; if (yAxisName == "a.u.") cmsPreliminaryIsUp = true; if (canvasName.find("pi0mass_comparison_E") != string::npos) cmsPreliminaryIsUp = false; if (lumi < 0) CMS_lumi(canvas,"",cmsPreliminaryIsUp,false); else CMS_lumi(canvas,Form("%.1f",lumi),cmsPreliminaryIsUp,false); setTDRStyle(); if (drawRatioWithNominal) { pad2->Draw(); pad2->cd(); frame->Reset("ICES"); if (canvasName.find("comparisonMassVariation") != string::npos) { frame->GetYaxis()->SetRangeUser(0.99, 1.01); /* if (outputDIR.find("/eta_0/") != string::npos) frame->GetYaxis()->SetRangeUser(0.99, 1.01); */ /* else if (outputDIR.find("/eta_1/") != string::npos) frame->GetYaxis()->SetRangeUser(0.98, 1.02); */ /* else if (outputDIR.find("/eta_2/") != string::npos) frame->GetYaxis()->SetRangeUser(0.98, 1.02); */ } else if (canvasName.find("elescale") != string::npos) { frame->GetYaxis()->SetRangeUser(0.99,1.01); } else if (canvasName.find("elescale") != string::npos) { frame->GetYaxis()->SetRangeUser(0.99,1.01); } else frame->GetYaxis()->SetRangeUser(0.9,1.1); frame->GetYaxis()->SetNdivisions(5); frame->GetYaxis()->SetTitle(ratioPadYaxisName.c_str()); frame->GetYaxis()->SetTitleOffset(1.2); // frame->GetYaxis()->SetTitleSize(0.15); frame->GetYaxis()->CenterTitle(); frame->GetXaxis()->SetTitle(xAxisName.c_str()); if (setXAxisRangeFromUser) frame->GetXaxis()->SetRangeUser(xmin,xmax); // frame->GetXaxis()->SetTitleOffset(0.8); frame->GetXaxis()->SetTitleSize(0.05); vector<TH1D*> ratio; for (UInt_t ivar = 1; ivar < vecHist1d.size(); ivar++) ratio.push_back( (TH1D*) vecHist1d[ivar]->Clone(Form("ratio_%d",ivar)) ); TH1D* den_noerr = (TH1D*) vecHist1d[0]->Clone("den_noerr"); TH1D* den = (TH1D*) vecHist1d[0]->Clone("den"); for(int iBin = 1; iBin < den->GetNbinsX()+1; iBin++) den_noerr->SetBinError(iBin,0.); den->Divide(den_noerr); den->SetFillColor(kGray); frame->Draw(); den->Draw("E2same"); for (UInt_t ir = 0; ir < ratio.size(); ir++) { ratio[ir]->Divide(den_noerr); // ratio[ir]->SetMarkerSize(0.65); // ratio[ir]->Draw("EPsame"); ratio[ir]->SetMarkerStyle(0); ratio[ir]->SetLineWidth(2); ratio[ir]->Draw("Hist same"); } TF1* line = new TF1("horiz_line","1",den->GetXaxis()->GetBinLowEdge(1),den->GetXaxis()->GetBinLowEdge(den->GetNbinsX()+1)); line->SetLineColor(kBlack); line->SetLineWidth(2); line->Draw("Lsame"); // for (UInt_t ir = 0; ir < ratio.size(); ir++) // ratio[ir]->Draw("EPsame"); pad2->RedrawAxis("sameaxis"); } // end of ratio plot settings if (canvasName.find("tmpToBeRemoved") == string::npos) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); } if (drawPlotLogY) { if (yAxisName == "a.u.") vecHist1d[0]->GetYaxis()->SetRangeUser(minY*0.05, maxY*100); else vecHist1d[0]->GetYaxis()->SetRangeUser(minY*0.05, maxY*100); canvas->SetLogy(); /* if (lumi < 0) CMS_lumi(canvas,"",true,false); */ /* else CMS_lumi(canvas,Form("%.1f",lumi),true,false); */ if (canvasName.find("tmpToBeRemoved") == string::npos) { canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); } canvas->SetLogy(0); } delete canvas; } //============================================================= void drawTH1dataMCstack(TH1* h1 = NULL, vector<TH1*> vecMC = {}, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const string& legEntry1 = "data", const vector<string>& vecLegEntryMC = {""}, const string& ratioPadYaxisName = "data/MC", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t normalizeMCToData = false, const Int_t draw_both0_noLog1_onlyLog2 = 0 ) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() if (vecMC.size() != vecLegEntryMC.size()) { cout << "Error: legend has different number of entries than stack elements, please check. Exit" << endl; exit(EXIT_FAILURE); } for (UInt_t i = 0; i < vecMC.size(); i++) { vecMC[i]->SetStats(0); } Int_t colorList[] = {kCyan, kViolet, kBlue, kRed, kYellow, kGreen, kOrange+1, kCyan+2, kGreen+2, kGray}; // the first color is for the main object. This array may contain more values than vecMC.size() vector<Int_t> histColor; for (UInt_t i = 0; i < vecMC.size(); i++) { // now color are assigned in reverse order (the main contribution is the last object in the sample array) histColor.push_back(colorList[i]); } Double_t dataNorm = h1->Integral(); Double_t stackNorm = 0.0; if (normalizeMCToData) { for (UInt_t ibin = 0; ibin < vecMC.size(); ibin++) { stackNorm += vecMC[ibin]->Integral(); } } THStack* hMCstack = new THStack("hMCstack",""); for (UInt_t j = 0; j < vecMC.size(); j++) { vecMC[j]->SetFillColor(histColor[j]); vecMC[j]->SetFillStyle(3001); myRebinHisto(vecMC[j],rebinFactor); if (normalizeMCToData) vecMC[j]->Scale(dataNorm/stackNorm); hMCstack->Add(vecMC[(UInt_t) vecMC.size() - j -1]); // add last element as the first one (last element added in stack goes on top) } TH1D* stackCopy = (TH1D*) hMCstack->GetStack()->Last(); // used to make ratioplot without affecting the plot and setting maximum if (h1 == NULL) h1 = (TH1D*) stackCopy->Clone("pseudoData"); else myRebinHisto(h1,rebinFactor); h1->SetStats(0); TCanvas* canvas = new TCanvas("canvas","",600,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.3); canvas->SetRightMargin(0.06); TPad *pad2 = new TPad("pad2","pad2",0,0.,1,0.9); pad2->SetTopMargin(0.7); pad2->SetRightMargin(0.06); pad2->SetFillColor(0); pad2->SetGridy(1); pad2->SetFillStyle(0); TH1* frame = (TH1*) h1->Clone("frame"); frame->GetXaxis()->SetLabelSize(0.04); frame->SetStats(0); h1->SetLineColor(kBlack); h1->SetMarkerColor(kBlack); h1->SetMarkerStyle(20); h1->SetMarkerSize(1); h1->GetXaxis()->SetLabelSize(0); h1->GetYaxis()->SetTitle(yAxisName.c_str()); h1->GetYaxis()->SetTitleOffset(1.1); // h1->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size h1->GetYaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetRangeUser(0.0, max(h1->GetMaximum(),stackCopy->GetMaximum()) * 1.2); if (setXAxisRangeFromUser) h1->GetXaxis()->SetRangeUser(xmin,xmax); h1->Draw("EP"); hMCstack->Draw("HIST SAME"); h1->Draw("EP SAME"); TLegend leg (0.6,0.7,0.9,0.9); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); leg.AddEntry(h1,legEntry1.c_str(),"PLE"); for (UInt_t i = 0; i < vecMC.size(); i++) { leg.AddEntry(vecMC[i],vecLegEntryMC[i].c_str(),"LF"); } leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",false,false); else CMS_lumi(canvas,Form("%.1f",lumi),false,false); setTDRStyle(); pad2->Draw(); pad2->cd(); frame->Reset("ICES"); frame->GetYaxis()->SetRangeUser(0.5,1.5); frame->GetYaxis()->SetNdivisions(5); frame->GetYaxis()->SetTitle(ratioPadYaxisName.c_str()); frame->GetYaxis()->SetTitleOffset(1.2); // frame->GetYaxis()->SetTitleSize(0.15); frame->GetYaxis()->CenterTitle(); if (setXAxisRangeFromUser) frame->GetXaxis()->SetRangeUser(xmin,xmax); frame->GetXaxis()->SetTitle(xAxisName.c_str()); // frame->GetXaxis()->SetTitleOffset(0.8); frame->GetXaxis()->SetTitleSize(0.05); TH1D* ratio = (TH1D*) h1->Clone("ratio"); TH1D* den_noerr = (TH1D*) stackCopy->Clone("den_noerr"); TH1D* den = (TH1D*) stackCopy->Clone("den"); for(int iBin = 1; iBin < den->GetNbinsX()+1; iBin++) den_noerr->SetBinError(iBin,0.); ratio->Divide(den_noerr); den->Divide(den_noerr); den->SetFillColor(kGray); frame->Draw(); ratio->SetMarkerSize(0.85); ratio->Draw("EPsame"); den->Draw("E2same"); TF1* line = new TF1("horiz_line","1",ratio->GetXaxis()->GetBinLowEdge(1),ratio->GetXaxis()->GetBinLowEdge(ratio->GetNbinsX()+1)); line->SetLineColor(kRed); line->SetLineWidth(2); line->Draw("Lsame"); ratio->Draw("EPsame"); pad2->RedrawAxis("sameaxis"); // Calculate chi2 double chi2 = h1->Chi2Test(stackCopy,"CHI2/NDF WW"); TLegend leg2 (0.14,0.25,0.32,0.28,NULL,"brNDC"); leg2.SetFillColor(0); leg2.SetFillStyle(1); leg2.SetBorderSize(0); leg2.SetLineColor(0); leg2.AddEntry((TObject*)0,Form("#chi^{2}/ndf = %.2f",chi2),""); leg2.Draw("same"); if (draw_both0_noLog1_onlyLog2 != 2) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); } /* Double_t minY_log = max(0.001, min(h1->GetBinContent(h1->GetMinimumBin()),stackCopy->GetBinContent(stackCopy->GetMinimumBin())) ) * 0.01; */ /* if ( fabs(minY_log) < 0.00001) minY_log = 0.001; // avoid zero */ /* h1->GetYaxis()->SetRangeUser(minY_log * 0.8, max(h1->GetMaximum(),stackCopy->GetMaximum())*100); */ //Double_t minY_log = max(0.001,min(h1->GetMinimum(),stackCopy->GetMinimum())*0.8); //if (min(h1->GetBinContent(h1->GetMinimumBin()),stackCopy->GetBinContent(stackCopy->GetMinimumBin()) > 0) minY_log = 0.5; /* Double_t minY_log = -1.0; */ /* TH1D* lowerStackObject = (TH1D*) hMCstack->GetStack()->First(); // */ if (draw_both0_noLog1_onlyLog2 != 1) { Double_t minY_log = 1e20; TH1D* lowerStackObject = (TH1D*) hMCstack->GetStack()->First(); /* if (lowerStackObject->GetBinContent(stackCopy->GetMinimumBin()) > 0.000001 ) { */ /* // if no empty bin in stack */ /* minY_log = 0.05 * lowerStackObject->GetBinContent(lowerStackObject->GetMinimumBin()); */ /* } else { */ /* minY_log = 0.01 * stackCopy->GetBinContent(stackCopy->GetMinimumBin()); */ /* } */ for (Int_t ibin = 0; ibin <= lowerStackObject->GetNbinsX(); ibin++ ) { if (lowerStackObject->GetBinContent(ibin) > 0.0000001 && minY_log > lowerStackObject->GetBinContent(ibin)) minY_log = lowerStackObject->GetBinContent(ibin); } if (minY_log < 0.000001) minY_log = 0.1; minY_log = 0.05 * minY_log; h1->GetYaxis()->SetRangeUser(minY_log,max(h1->GetMaximum(),stackCopy->GetMaximum())*100); canvas->SetLogy(); pad2->RedrawAxis("sameaxis"); /* if (lumi < 0) CMS_lumi(canvas,"",true,false); */ /* else CMS_lumi(canvas,Form("%.1f",lumi),true,false); */ canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); canvas->SetLogy(0); } delete hMCstack; delete pad2; delete canvas; } //============================================================= void adjustSettings_CMS_lumi(const string& outputDir = "./") { // tmp plot to be removed to adjust settings in CMS_lumi TH1D* htmp1 = new TH1D("htmp1","",1,0,1); TH1D* htmp2 = new TH1D("htmp2","",1,0,1); htmp1->Fill(0.5); htmp2->Fill(0.5); vector<TH1*> htmpVec; htmpVec.push_back(htmp2); drawTH1dataMCstack(htmp1, htmpVec, "variable", "Events", "tmpToBeRemoved", outputDir); system(("rm " + outputDir + "*tmpToBeRemoved*").c_str()); delete htmp1; delete htmp2; } //============================================================= /* // following function calls the previous one that is more general and takes a vector of TH1* as "data" */ /* // it would be used to have a stack and more than one not stacked histogram */ /* // ratio is made using only first non stacked object, but the others are used for the ratio */ /* void drawTH1dataMCstack(TH1* h1 = NULL, vector<TH1*> vecMC = {}, */ /* const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", */ /* const string& outputDIR = "./", */ /* const string& legEntry1 = "data", const vector<string>& vecLegEntryMC = {""}, */ /* const string& ratioPadYaxisName = "data/MC", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, */ /* const Bool_t normalizeMCToData = false, */ /* const Int_t draw_both0_noLog1_onlyLog2 = 0 */ /* ) */ /* { */ /* vector<TH1*> vecNostack; */ /* vecNostack.push_back(h1); */ /* vector<string> vecLegEntryNostack; */ /* vecLegEntryNostack.push_back(legEntry1); */ /* drawMoreTH1andMCstack(vecNostack, vecMC, xAxisNameTmp, yAxisName, canvasName, outputDIR, vecLegEntryNostack, vecLegEntryMC, ratioPadYaxisName, lumi, rebinFactor, normalizeMCToData, ) */ /* } */ // function to draw data and MC and other not stacked objects void drawTH1dataMCstackAndNoStack(TH1* h1 = NULL, vector<TH1*> vecMC = {}, vector<TH1*> vecMCnostack = {}, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const string& legEntry1 = "data", const vector<string>& vecLegEntryMC = {""}, const vector<string>& vecLegEntryMCnostack = {""}, const string& ratioPadYaxisNameTmp = "data/MC", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t normalizeMCToData = false, // normalize MC stack and non stacked object individually const Int_t draw_both0_noLog1_onlyLog2 = 0, const string& denForRatio = "stack" // stack, TH1nostack ) { // select what to use as denominator in ratio plot // nostack use first TH1 not stacked string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); string ratioPadYaxisName = ""; Double_t yminRatio = 0; Double_t ymaxRatio = 0; Bool_t setRatioYAxisRangeFromUser = getAxisRangeFromUser(ratioPadYaxisName, yminRatio, ymaxRatio, ratioPadYaxisNameTmp); // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() if (vecMC.size() != vecLegEntryMC.size()) { cout << "Error: stack legend has different number of entries than stack elements, please check. Exit" << endl; exit(EXIT_FAILURE); } if (vecMCnostack.size() != vecLegEntryMCnostack.size()) { cout << "Error: non-stack legend has different number of entries than non-stack elements, please check. Exit" << endl; exit(EXIT_FAILURE); } for (UInt_t i = 0; i < vecMC.size(); i++) { vecMC[i]->SetStats(0); } for (UInt_t i = 0; i < vecMCnostack.size(); i++) { vecMCnostack[i]->SetStats(0); } Int_t colorList[] = {kCyan, kViolet, kBlue, kRed, kYellow, kGreen, kOrange+1, kCyan+2, kGreen+2, kGray}; // the first color is for the main object. This array may contain more values than vecMC.size() vector<Int_t> histColor; for (UInt_t i = 0; i < vecMC.size(); i++) { histColor.push_back(colorList[i]); } vector<Int_t> histColorNostack = { kRed+2, kBlue+2, kGreen+2, kGray+2, kMagenta+2, kCyan+1, kOrange+1}; Double_t dataNorm = h1->Integral(); Double_t stackNorm = 0.0; if (normalizeMCToData) { for (UInt_t ibin = 0; ibin < vecMC.size(); ibin++) { stackNorm += vecMC[ibin]->Integral(); } for (UInt_t ibin = 0; ibin < vecMCnostack.size(); ibin++) { vecMCnostack[ibin]->Scale(dataNorm/vecMCnostack[ibin]->Integral()); } } THStack* hMCstack = new THStack("hMCstack",""); for (UInt_t j = 0; j < vecMC.size(); j++) { vecMC[j]->SetFillColor(histColor[j]); vecMC[j]->SetFillStyle(3001); myRebinHisto(vecMC[j],rebinFactor); if (normalizeMCToData) vecMC[j]->Scale(dataNorm/stackNorm); hMCstack->Add(vecMC[(UInt_t) vecMC.size() - j -1]); // add last element as the first one (last element added in stack goes on top) vecMC[j]->GetXaxis()->SetTitle(""); } for (UInt_t j = 0; j < vecMCnostack.size(); j++) { vecMCnostack[j]->SetLineColor(histColorNostack[j]); vecMCnostack[j]->SetFillColor(0); vecMCnostack[j]->SetLineWidth(3); vecMCnostack[j]->SetMarkerStyle(0); myRebinHisto(vecMCnostack[j],rebinFactor); } TH1D* stackCopy = (TH1D*) hMCstack->GetStack()->Last(); // used to make ratioplot without affecting the plot and setting maximum if (h1 == NULL) h1 = (TH1D*) stackCopy->Clone("pseudoData"); else myRebinHisto(h1,rebinFactor); h1->SetStats(0); TCanvas* canvas = new TCanvas("canvas","",600,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.3); canvas->SetRightMargin(0.06); canvas->SetLeftMargin(0.13); TPad *pad2 = new TPad("pad2","pad2",0,0.,1,0.9); pad2->SetTopMargin(0.7); pad2->SetLeftMargin(0.13); pad2->SetRightMargin(0.06); pad2->SetFillColor(0); pad2->SetGridy(1); pad2->SetFillStyle(0); TH1* frame = (TH1*) h1->Clone("frame"); frame->GetXaxis()->SetLabelSize(0.04); frame->SetStats(0); h1->SetLineColor(kBlack); h1->SetMarkerColor(kBlack); h1->SetMarkerStyle(20); h1->SetMarkerSize(1); h1->GetXaxis()->SetLabelSize(0); h1->GetXaxis()->SetTitle(0); h1->GetYaxis()->SetTitle(yAxisName.c_str()); h1->GetYaxis()->SetTitleOffset(1.3); // h1->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size h1->GetYaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetLabelSize(0.04); h1->GetYaxis()->SetRangeUser(0.0, max(h1->GetMaximum(),stackCopy->GetMaximum()) * 1.2); if (setXAxisRangeFromUser) h1->GetXaxis()->SetRangeUser(xmin,xmax); h1->Draw("EP"); hMCstack->Draw("HIST SAME"); TH1D* noStackCopy = NULL; for (UInt_t j = 0; j < vecMCnostack.size(); j++) { /* TH1D* noStackCopy = (TH1D*) vecMCnostack[j]->DrawCopy("hist same"); */ /* vecMCnostack[j]->SetFillColor(vecMCnostack[j]->GetLineColor()); */ /* vecMCnostack[j]->SetFillStyle(3013); */ /* vecMCnostack[j]->Draw("E2 SAME"); */ if (vecMCnostack.size() == 1) { noStackCopy = (TH1D*) vecMCnostack[j]->Clone(Form("%s_clone",vecMCnostack[j]->GetName())); noStackCopy->SetFillColor(vecMCnostack[j]->GetLineColor()); noStackCopy->SetFillStyle(3013); noStackCopy->Draw("E2 SAME"); } vecMCnostack[j]->Draw("HIST SAME"); vecMCnostack[j]->GetXaxis()->SetTitle(""); } h1->Draw("EP SAME"); Double_t legLowY = 0.7; if ((vecMC.size() + vecMCnostack.size()) > 5) legLowY = legLowY - 0.03 * (vecMC.size() + vecMCnostack.size() - 5); TLegend leg (0.6,legLowY,0.9,0.9); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); leg.AddEntry(h1,legEntry1.c_str(),"PLE"); for (UInt_t i = 0; i < vecMC.size(); i++) { leg.AddEntry(vecMC[i],vecLegEntryMC[i].c_str(),"LF"); } for (UInt_t i = 0; i < vecMCnostack.size(); i++) { if (vecMCnostack.size() == 1) leg.AddEntry(noStackCopy,vecLegEntryMCnostack[i].c_str(),"LF"); else leg.AddEntry(vecMCnostack[i],vecLegEntryMCnostack[i].c_str(),"L"); } leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",false,false); else CMS_lumi(canvas,Form("%.1f",lumi),false,false); setTDRStyle(); pad2->Draw(); pad2->cd(); frame->Reset("ICES"); if (setRatioYAxisRangeFromUser) frame->GetYaxis()->SetRangeUser(yminRatio,ymaxRatio); else frame->GetYaxis()->SetRangeUser(0.5,1.5); frame->GetYaxis()->SetNdivisions(5); frame->GetYaxis()->SetTitle(ratioPadYaxisName.c_str()); frame->GetYaxis()->SetTitleOffset(1.2); frame->GetYaxis()->SetTitleSize(0.04); // needed when using histograms in file produced with mcPlots.py frame->GetYaxis()->SetLabelSize(0.04); // needed when using histograms in file produced with mcPlots.py frame->GetYaxis()->CenterTitle(); if (setXAxisRangeFromUser) frame->GetXaxis()->SetRangeUser(xmin,xmax); frame->GetXaxis()->SetTitle(xAxisName.c_str()); // frame->GetXaxis()->SetTitleOffset(0.8); frame->GetXaxis()->SetTitleSize(0.05); TH1D* ratio = NULL; vector<TH1D*> ratio_noStack; TH1D* den_noerr = NULL; TH1D* den = NULL; if (denForRatio == "stack") { ratio = (TH1D*) h1->Clone("ratio"); den_noerr = (TH1D*) stackCopy->Clone("den_noerr"); den = (TH1D*) stackCopy->Clone("den"); } else if (denForRatio == "nostack") { ratio = (TH1D*) h1->Clone("ratio"); den_noerr = (TH1D*) vecMCnostack[0]->Clone("den_noerr"); den = (TH1D*) vecMCnostack[0]->Clone("den"); } else if (denForRatio == "data") { ratio = (TH1D*) stackCopy->Clone(); for (UInt_t i = 0; i < vecMCnostack.size(); i++) ratio_noStack.push_back( (TH1D*) vecMCnostack[i]->Clone()); den_noerr = (TH1D*) h1->Clone("den_noerr"); den = (TH1D*) h1->Clone("den"); } for(int iBin = 1; iBin < den->GetNbinsX()+1; iBin++) den_noerr->SetBinError(iBin,0.); ratio->Divide(den_noerr); if (denForRatio == "data") { ratio->SetMarkerStyle(22); // triangle, use 22 for filled marker ratio->SetMarkerSize(1.1); // triangle, use 22 for filled marker ratio->SetMarkerColor(kBlue); } else { ratio->SetMarkerSize(0.85); } den->Divide(den_noerr); den->SetFillColor(kGray); frame->Draw(); den->SetMarkerStyle(0); den->Draw("E2same"); ratio->Draw("EPsame"); for (UInt_t i = 0; i < ratio_noStack.size(); i++) { ratio_noStack[i]->Divide(den_noerr); ratio_noStack[i]->SetMarkerSize(0.85); //ratio_noStack[i]->SetMarkerColor(); ratio_noStack[i]->Draw("EPsame"); } TF1* line = new TF1("horiz_line","1",ratio->GetXaxis()->GetBinLowEdge(1),ratio->GetXaxis()->GetBinLowEdge(ratio->GetNbinsX()+1)); line->SetLineColor(kRed); line->SetLineWidth(2); line->Draw("Lsame"); ratio->Draw("EPsame"); pad2->RedrawAxis("sameaxis"); TLegend leg2 (0.14,0.24,0.32,0.29,NULL,"brNDC"); leg2.SetFillColor(0); leg2.SetFillStyle(1); leg2.SetBorderSize(0); leg2.SetLineColor(0); if (denForRatio == "data") leg2.AddEntry(ratio,"stack","PLE"); leg2.Draw("same"); // Calculate chi2 /* double chi2 = h1->Chi2Test(stackCopy,"CHI2/NDF WW"); */ /* TLegend leg2 (0.14,0.25,0.32,0.28,NULL,"brNDC"); */ /* leg2.SetFillColor(0); */ /* leg2.SetFillStyle(1); */ /* leg2.SetBorderSize(0); */ /* leg2.SetLineColor(0); */ /* leg2.AddEntry((TObject*)0,Form("#chi^{2}/ndf = %.2f",chi2),""); */ /* leg2.Draw("same"); */ if (draw_both0_noLog1_onlyLog2 != 2) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); } /* Double_t minY_log = max(0.001, min(h1->GetBinContent(h1->GetMinimumBin()),stackCopy->GetBinContent(stackCopy->GetMinimumBin())) ) * 0.01; */ /* if ( fabs(minY_log) < 0.00001) minY_log = 0.001; // avoid zero */ /* h1->GetYaxis()->SetRangeUser(minY_log * 0.8, max(h1->GetMaximum(),stackCopy->GetMaximum())*100); */ //Double_t minY_log = max(0.001,min(h1->GetMinimum(),stackCopy->GetMinimum())*0.8); //if (min(h1->GetBinContent(h1->GetMinimumBin()),stackCopy->GetBinContent(stackCopy->GetMinimumBin()) > 0) minY_log = 0.5; /* Double_t minY_log = -1.0; */ /* TH1D* lowerStackObject = (TH1D*) hMCstack->GetStack()->First(); // */ if (draw_both0_noLog1_onlyLog2 != 1) { Double_t minY_log = 1e20; TH1D* lowerStackObject = (TH1D*) hMCstack->GetStack()->First(); /* if (lowerStackObject->GetBinContent(stackCopy->GetMinimumBin()) > 0.000001 ) { */ /* // if no empty bin in stack */ /* minY_log = 0.05 * lowerStackObject->GetBinContent(lowerStackObject->GetMinimumBin()); */ /* } else { */ /* minY_log = 0.01 * stackCopy->GetBinContent(stackCopy->GetMinimumBin()); */ /* } */ for (Int_t ibin = 0; ibin <= lowerStackObject->GetNbinsX(); ibin++ ) { if (lowerStackObject->GetBinContent(ibin) > 0.0000001 && minY_log > lowerStackObject->GetBinContent(ibin)) minY_log = lowerStackObject->GetBinContent(ibin); } if (minY_log < 0.000001) minY_log = 0.1; minY_log = 0.05 * minY_log; h1->GetYaxis()->SetRangeUser(minY_log,max(h1->GetMaximum(),stackCopy->GetMaximum())*100); canvas->SetLogy(); pad2->RedrawAxis("sameaxis"); /* if (lumi < 0) CMS_lumi(canvas,"",true,false); */ /* else CMS_lumi(canvas,Form("%.1f",lumi),true,false); */ canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); canvas->SetLogy(0); } delete hMCstack; delete pad2; delete canvas; } //============================================================= TFitResultPtr drawTH1(TH1* h1 = NULL, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const string& legEntryTmp = "", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t noStatBox = false, const Bool_t saveCanvas = true ) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); string legEntry = ""; string legHeader = ""; Bool_t setLegendHeader = false; string separator = "::"; size_t pos = legEntryTmp.find(separator); if (pos != string::npos) { setLegendHeader = true; legEntry.assign(legEntryTmp, 0, pos); legHeader.assign(legEntryTmp, pos + separator.size(), string::npos); } else { legEntry = legEntryTmp; } // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() myRebinHisto(h1,rebinFactor); TCanvas* canvas = new TCanvas("canvas","",700,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.12); canvas->SetRightMargin(0.06); h1->Draw("HE"); //Double_t histNorm = h1->Integral(0, h1->GetNbinsX()+1); Double_t histNorm = h1->GetBinContent(h1->GetMaximumBin()); // cout << "histNorm = " << histNorm << endl; Double_t histMean = h1->GetMean(); // cout << "histMean = " << histMean << endl; Double_t histStdDev = h1->GetStdDev(); // cout << "histStdDev = " << histStdDev << endl; /* TF1 *gaussian = new TF1("gaussian","gaus",histMean-4*histStdDev, histMean+4*histStdDev); */ /* gaussian->SetParLimits(0, 0.95 * histNorm, 1.05 * histNorm); */ /* gaussian->SetParLimits(1, histMean - histStdDev, histMean + histStdDev); */ /* gaussian->SetParLimits(2, 0.1 * histStdDev, 2.0 * histStdDev); */ /* gaussian->SetParameter(0, histNorm); */ /* gaussian->SetParameter(1, histMean); */ /* gaussian->SetParameter(2, histStdDev); */ /* gaussian->SetLineColor(kRed); */ /* gaussian->SetLineWidth(2); */ //gaussian->Draw("SAME"); TF1*cb1 = new TF1("cb1",&my2sideCrystalBall,histMean-4*histStdDev, histMean+4*histStdDev,7); cb1->SetParNames("alphaL","nL","Mean(fit)","Sigma","Const","alphaR","nR"); cb1->SetParLimits(cb1->GetParNumber("nL"),0.1,15); cb1->SetParLimits(cb1->GetParNumber("Mean(fit)"), histMean - histStdDev, histMean + histStdDev); cb1->SetParLimits(cb1->GetParNumber("Sigma"),0.1 * histStdDev, 1.1 * histStdDev); cb1->SetParLimits(cb1->GetParNumber("nR"),0.1,15); cb1->SetParLimits(cb1->GetParNumber("alphaL"),-5.0,-0.1); cb1->SetParLimits(cb1->GetParNumber("alphaR"),0.1,5.0); cb1->SetParLimits(cb1->GetParNumber("Const"),0.8*histNorm,1.2*histNorm); cb1->SetParameters(-1.4,5,histMean,histStdDev,histNorm,1.4,5); cb1->SetLineColor(kGreen+2); cb1->SetLineWidth(2); //TFitResultPtr frp1 = h1->Fit(gaussian,"E L I S Q B R","HE", histMean - 1.4 * histStdDev, histMean + 1.4 * histStdDev); /* TF1 *fitFunction = h1->GetFunction("gaussian"); */ /* if (fitFunction) { */ /* fitFunction->SetLineColor(kRed); */ /* fitFunction->SetLineWidth(2); */ /* fitFunction->Draw("SAME"); */ /* } */ TFitResultPtr frp2 = h1->Fit(cb1,"E WL I S Q B R","HE SAMES", histMean - 3.0 * histStdDev, histMean + 3.0 * histStdDev); //cout << "checkpoint" << endl; return 0; if (frp2->Parameter(cb1->GetParNumber("Sigma")) < 0.0 ) { cout << "WARNING: CB sigma is negative!" << endl; } TF1 *gaussCore = new TF1(*(h1->GetFunction("cb1"))); if (gaussCore) { Double_t gaussMean = frp2->Parameter(cb1->GetParNumber("Mean(fit)")); Double_t gaussSigma = frp2->Parameter(cb1->GetParNumber("Sigma")); Double_t alphaL = frp2->Parameter(cb1->GetParNumber("alphaL")); Double_t alphaR = frp2->Parameter(cb1->GetParNumber("alphaR")); gaussCore->DrawF1(gaussMean + fabs(gaussSigma) * -fabs(alphaL), gaussMean + fabs(gaussSigma) * fabs(alphaR),"SAME"); // alphaL < 0, alphaR > 0 gaussCore->SetLineColor(kRed); gaussCore->SetLineWidth(2); } /* gaussian->SetParLimits(0, 0.95 * histNorm, 1.05 * histNorm); */ /* gaussian->SetParLimits(1, histMean - histStdDev, histMean + histStdDev); */ /* gaussian->SetParLimits(2, 0.1 * histStdDev, 2.0 * histStdDev); */ /* gaussian->SetParameter(0, histNorm); */ /* gaussian->SetParameter(1, histMean); */ /* gaussian->SetParameter(2, histStdDev); */ /* gaussian->SetLineColor(kRed); */ /* gaussian->SetLineWidth(2); */ //gaussian->Draw("SAME"); canvas->Update(); TPaveStats *statBox = (TPaveStats*)(h1->FindObject("stats")); if (statBox) { statBox->SetX1NDC(0.62); statBox->SetX2NDC(0.92); statBox->SetY1NDC(0.59); statBox->SetY2NDC(0.91); statBox->SetFillColor(0); statBox->SetFillStyle(0); statBox->SetBorderSize(0); statBox->Draw(); } canvas->Update(); if (setXAxisRangeFromUser) h1->GetXaxis()->SetRangeUser(xmin,xmax); h1->GetXaxis()->SetTitle(xAxisName.c_str()); // h1->GetXaxis()->SetTitleOffset(0.8); h1->GetXaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetTitle(yAxisName.c_str()); h1->GetYaxis()->SetTitleOffset(1.1); // h1->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size h1->GetYaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetRangeUser(0.0, h1->GetMaximum() * 1.5); canvas->RedrawAxis("sameaxis"); canvas->Update(); TLegend leg (0.15,0.7,0.6,0.9); if (setLegendHeader) leg.SetHeader(legHeader.c_str()); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); leg.AddEntry(h1,legEntry.c_str(),"L"); //leg.AddEntry(gaussian,"gauss","l"); if (gaussCore) leg.AddEntry(gaussCore,"gauss core","l"); leg.AddEntry(cb1,"CB","l"); leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",true,false); else CMS_lumi(canvas,Form("%.1f",lumi),true,false); setTDRStyle(); if (noStatBox) { h1->SetStats(0); //cout << "No Statistics box" << endl; } else { //canvas->Update(); gPad->Update(); gStyle->SetOptStat(1110); gStyle->SetOptFit(1102); } //h1->SetStats(0); if (saveCanvas) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); } delete canvas; return frp2; } //============================================================= void drawSingleTH1(TH1* h1 = NULL, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const string& legEntryTmp = "", const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Bool_t noStatBox = false, const Int_t draw_both0_noLog1_onlyLog2 = 0 ) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); string legEntry = ""; string legHeader = ""; Bool_t setLegendHeader = false; string separator = "::"; size_t pos = legEntryTmp.find(separator); if (pos != string::npos) { setLegendHeader = true; legEntry.assign(legEntryTmp, 0, pos); legHeader.assign(legEntryTmp, pos + separator.size(), string::npos); } else { legEntry = legEntryTmp; } // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() myRebinHisto(h1,rebinFactor); TCanvas* canvas = new TCanvas("canvas","",700,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.12); canvas->SetRightMargin(0.06); h1->Draw("HE"); canvas->Update(); TPaveStats *statBox = (TPaveStats*)(h1->FindObject("stats")); if (statBox) { statBox->SetX1NDC(0.62); statBox->SetX2NDC(0.92); statBox->SetY1NDC(0.59); statBox->SetY2NDC(0.91); statBox->SetFillColor(0); statBox->SetFillStyle(0); statBox->SetBorderSize(0); statBox->Draw(); } canvas->Update(); if (setXAxisRangeFromUser) h1->GetXaxis()->SetRangeUser(xmin,xmax); h1->GetXaxis()->SetTitle(xAxisName.c_str()); // h1->GetXaxis()->SetTitleOffset(0.8); h1->GetXaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetTitle(yAxisName.c_str()); h1->GetYaxis()->SetTitleOffset(1.1); // h1->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size h1->GetYaxis()->SetTitleSize(0.05); h1->GetYaxis()->SetRangeUser(0.0, h1->GetMaximum() * 1.5); canvas->RedrawAxis("sameaxis"); canvas->Update(); TLegend leg (0.15,0.7,0.6,0.9); if (setLegendHeader) leg.SetHeader(legHeader.c_str()); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); leg.AddEntry(h1,legEntry.c_str(),"L"); leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",true,false); else CMS_lumi(canvas,Form("%.1f",lumi),true,false); setTDRStyle(); if (noStatBox) { h1->SetStats(0); //cout << "No Statistics box" << endl; } else { //canvas->Update(); gPad->Update(); gStyle->SetOptStat(1110); } //h1->SetStats(0); canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); if (draw_both0_noLog1_onlyLog2 != 1) { if (yAxisName == "a.u.") h1->GetYaxis()->SetRangeUser(max(0.0001,h1->GetMinimum()*0.8),h1->GetMaximum()*100); else h1->GetYaxis()->SetRangeUser(max(0.001,h1->GetMinimum()*0.8),h1->GetMaximum()*100); canvas->SetLogy(); canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); canvas->SetLogy(0); } delete canvas; } //============================================================= void drawTH1MCstack(vector<TH1*> vecMC = {}, const string& xAxisNameTmp = "", const string& yAxisName = "Events", const string& canvasName = "default", const string& outputDIR = "./", const vector<string>& vecLegEntryMC = {""}, const Double_t lumi = -1.0, const Int_t rebinFactor = 1, const Int_t draw_both0_noLog1_onlyLog2 = 0 ) { string xAxisName = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(xAxisName, xmin, xmax, xAxisNameTmp); // cout << "xAxisName = " << xAxisName << " xmin = " << xmin << " xmax = " << xmax << endl; TH1::SetDefaultSumw2(); //all the following histograms will automatically call TH1::Sumw2() if (vecMC.size() != vecLegEntryMC.size()) { cout << "Error: legend has different number of entries than stack elements, please check. Exit" << endl; exit(EXIT_FAILURE); } for (UInt_t i = 0; i < vecMC.size(); i++) { vecMC[i]->SetStats(0); } Int_t colorList[] = {kCyan, kViolet, kBlue, kRed, kYellow, kGreen, kOrange+1, kCyan+2, kGreen+2, kGray}; // the first color is for the main object. This array may contain more values than vecMC.size() vector<Int_t> histColor; for (UInt_t i = 0; i < vecMC.size(); i++) { histColor.push_back(colorList[i]); } Double_t stackNorm = 0.0; THStack* hMCstack = new THStack("hMCstack",""); for (UInt_t j = 0; j < vecMC.size(); j++) { vecMC[j]->SetFillColor(histColor[j]); vecMC[j]->SetFillStyle(3001); myRebinHisto(vecMC[j],rebinFactor); hMCstack->Add(vecMC[(UInt_t) vecMC.size() - j -1]); // add last element as the first one (last element added in stack goes on top) } TH1D* stackCopy = (TH1D*) hMCstack->GetStack()->Last(); // used to make ratioplot without affecting the plot and setting maximum TCanvas* canvas = new TCanvas("canvas","",700,700); canvas->cd(); canvas->SetTickx(1); canvas->SetTicky(1); canvas->cd(); canvas->SetBottomMargin(0.1); canvas->SetRightMargin(0.06); stackCopy->Draw("HIST"); hMCstack->Draw("HIST SAME"); //TH1* stackCopy = hMCstack->GetHistogram(); if (setXAxisRangeFromUser) stackCopy->GetXaxis()->SetRangeUser(xmin,xmax); stackCopy->GetXaxis()->SetTitle(xAxisName.c_str()); // stackCopy->GetXaxis()->SetTitleOffset(0.8); stackCopy->GetXaxis()->SetTitleSize(0.05); stackCopy->GetYaxis()->SetTitle(yAxisName.c_str()); stackCopy->GetYaxis()->SetTitleOffset(1.1); // stackCopy->GetYaxis()->SetTitleOffset(0.8); // was 1.03 without setting also the size stackCopy->GetYaxis()->SetTitleSize(0.05); stackCopy->GetYaxis()->SetRangeUser(0.0, stackCopy->GetMaximum() * 1.5); canvas->RedrawAxis("sameaxis"); canvas->Update(); TLegend leg (0.6,0.7,0.9,0.9); leg.SetFillColor(0); leg.SetFillStyle(0); leg.SetBorderSize(0); for (UInt_t i = 0; i < vecMC.size(); i++) { leg.AddEntry(vecMC[i],vecLegEntryMC[i].c_str(),"LF"); } leg.Draw("same"); canvas->RedrawAxis("sameaxis"); // CMS_lumi(canvas,Form("%.1f",lumi)); if (lumi < 0) CMS_lumi(canvas,"",false,false); else CMS_lumi(canvas,Form("%.1f",lumi),false,false); setTDRStyle(); if (draw_both0_noLog1_onlyLog2 != 2) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str()); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str()); } if (draw_both0_noLog1_onlyLog2 != 1) { Double_t minY_log = 1e10; TH1D* lowerStackObject = (TH1D*) hMCstack->GetStack()->First(); for (Int_t ibin = 0; ibin <= lowerStackObject->GetNbinsX(); ibin++ ) { if (lowerStackObject->GetBinContent(ibin) > 0.0000001 && minY_log > lowerStackObject->GetBinContent(ibin)) minY_log = lowerStackObject->GetBinContent(ibin); } if (minY_log < 0.000001) minY_log = 0.1; minY_log = 0.05 * minY_log; stackCopy->GetYaxis()->SetRangeUser(minY_log,stackCopy->GetMaximum()*100); canvas->SetLogy(); canvas->RedrawAxis("sameaxis"); canvas->SaveAs((outputDIR + canvasName + "_logY.png").c_str()); //canvas->SaveAs((outputDIR + canvasName + "_logY.pdf").c_str()); canvas->SetLogy(0); } delete canvas; } //============================================================= void drawCorrelationPlot(TH2* h2D, const string & labelXtmp = "xaxis", const string & labelYtmp = "yaxis", const string & labelZ = "zaxis", const string& canvasName = "default", const string& plotLabel = "", const string & outputDIR = "./", const Int_t rebinFactorY = 1, const Int_t rebinFactorX = 1, const bool smoothPlot = true, const bool drawProfileX = true, const bool scaleToUnitArea = true, const Int_t draw_both0_noLog1_onlyLog2 = 0) { if (rebinFactorY > 1) h2D->RebinY(rebinFactorY); if (rebinFactorX > 1) h2D->RebinX(rebinFactorX); string labelX = ""; Double_t xmin = 0; Double_t xmax = 0; Bool_t setXAxisRangeFromUser = getAxisRangeFromUser(labelX, xmin, xmax, labelXtmp); string labelY = ""; Double_t ymin = 0; Double_t ymax = 0; Bool_t setYAxisRangeFromUser = getAxisRangeFromUser(labelY, ymin, ymax, labelYtmp); TCanvas* canvas = new TCanvas("canvas","",700,625); canvas->SetLeftMargin(0.16); canvas->SetRightMargin(0.20); canvas->cd(); system(("mkdir -p "+outputDIR).c_str()); // normalize to 1 if (scaleToUnitArea) h2D->Scale(1./h2D->Integral()); TGraph2D* h2DGraph = NULL; TH2* h2DPlot = NULL; if (not smoothPlot) h2DPlot = h2D; else { h2DGraph = new TGraph2D(); h2DGraph->SetNpx(300); h2DGraph->SetNpy(300); int nPoint = 0; for(int iBinX = 0; iBinX < h2D->GetNbinsX() ; iBinX++){ for(int iBinY = 0; iBinY < h2D->GetNbinsY() ; iBinY++){ h2DGraph->SetPoint(nPoint,h2D->GetXaxis()->GetBinCenter(iBinX+1),h2D->GetYaxis()->GetBinCenter(iBinY+1),h2D->GetBinContent(iBinX+1,iBinY+1)); nPoint++; } } h2DPlot = h2DGraph->GetHistogram(); } h2DPlot->GetXaxis()->SetTitle(labelX.c_str()); h2DPlot->GetYaxis()->SetTitle(labelY.c_str()); if (scaleToUnitArea) h2DPlot->GetZaxis()->SetTitle("a.u"); else h2DPlot->GetZaxis()->SetTitle(labelZ.c_str()); h2DPlot->Draw("colz"); if (setXAxisRangeFromUser) h2DPlot->GetXaxis()->SetRangeUser(xmin,xmax); if (setYAxisRangeFromUser) h2DPlot->GetYaxis()->SetRangeUser(ymin,ymax); TProfile* h2DProfile = NULL; if (drawProfileX) { h2DProfile = h2D->ProfileX(Form("%s_pfx",h2D->GetName())); h2DProfile->SetMarkerColor(kBlack); h2DProfile->SetMarkerStyle(20); h2DProfile->SetMarkerSize(1); h2DProfile->Draw("EPsame"); } CMS_lumi(canvas,"",true,false); setTDRStyle(); TLegend leg(0.39,0.75,0.89,0.95); leg.SetFillStyle(0); leg.SetFillColor(0); leg.SetBorderSize(0); leg.SetTextFont(62); if (plotLabel != "") leg.AddEntry((TObject*)0,plotLabel.c_str(),""); if (drawProfileX) leg.AddEntry((TObject*)0,Form("Correlation = %.2f",h2DPlot->GetCorrelationFactor()),""); leg.Draw("same"); if (draw_both0_noLog1_onlyLog2 == 0 || draw_both0_noLog1_onlyLog2 == 1) { canvas->SaveAs((outputDIR + canvasName + ".png").c_str(),"png"); canvas->SaveAs((outputDIR + canvasName + ".pdf").c_str(),"pdf"); } if (draw_both0_noLog1_onlyLog2 == 0 || draw_both0_noLog1_onlyLog2 == 2) { canvas->SetLogz(); canvas->SaveAs((outputDIR + canvasName + "_logZ.png").c_str(),"png"); canvas->SaveAs((outputDIR + canvasName + "_logZ.pdf").c_str(),"pdf"); canvas->SetLogz(0); } delete canvas; } //====================================================== /* void buildChain(TChain* chain, TChain* chFriend, const string& treePath = "", const Sample& sample = Sample::data_doubleEG) { */ /* cout << "Creating chain ..." << endl; */ /* vector<string> subSampleNameVector; */ /* if (sample == Sample::wjets) { */ /* subSampleNameVector.push_back("WJetsToLNu_reHLT"); */ /* } else if (sample == Sample::zjets) { */ /* subSampleNameVector.push_back("DYJetsToLL_M50_reHLT"); */ /* } else if (sample == Sample::data_doubleEG) { */ /* subSampleNameVector.push_back("DoubleEG_Run2016B_23Sep2016_v3_runs_273150_275376"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016C_23Sep2016_v1_runs_271036_284044"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016D_23Sep2016_v1_runs_271036_284044"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016E_23Sep2016_v1_runs_271036_284044"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016F_23Sep2016_v1_runs_271036_284044"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016G_23Sep2016_v1_runs_271036_284044"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016H_PromptReco_v1_runs_281085_281201"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016H_PromptReco_v2_runs_281207_284035"); */ /* subSampleNameVector.push_back("DoubleEG_Run2016H_PromptReco_v3_runs_284036_284044"); */ /* } else if (sample == Sample::qcd_mu) { */ /* subSampleNameVector.push_back("QCD_Pt120to170_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt15to20_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt1000toInf_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt20to30_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt300to470_Mu5"); */ /* //subSampleNameVector.push_back("QCD_Pt300to470_Mu5_ext"); */ /* subSampleNameVector.push_back("QCD_Pt30to50_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt470to600_Mu5"); */ /* //subSampleNameVector.push_back("QCD_Pt470to600_Mu5_ext"); */ /* subSampleNameVector.push_back("QCD_Pt170to300_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt50to80_Mu5"); */ /* subSampleNameVector.push_back("QCD_Pt600to800_Mu5"); */ /* //subSampleNameVector.push_back("QCD_Pt600to800_Mu5_ext"); */ /* subSampleNameVector.push_back("QCD_Pt800to1000_Mu5"); */ /* //subSampleNameVector.push_back("QCD_Pt800to1000_Mu5_ext"); */ /* subSampleNameVector.push_back("QCD_Pt80to120_Mu5"); */ /* } else if (sample == Sample::qcd_ele) { */ /* subSampleNameVector.push_back("QCD_Pt20to30_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt30to50_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt50to80_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt80to120_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt120to170_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt170to300_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt300toInf_EMEnriched"); */ /* subSampleNameVector.push_back("QCD_Pt_30to80_bcToE"); */ /* subSampleNameVector.push_back("QCD_Pt_170to250_bcToE"); */ /* subSampleNameVector.push_back("QCD_Pt_250toInf_bcToE"); */ /* } else { */ /* cout << "#### Error in buildChain() function: sample name not available, please check. Exit ..." << endl; */ /* exit(EXIT_FAILURE); */ /* } */ /* for(UInt_t i = 0; i < subSampleNameVector.size(); i++) { */ /* string treeRootFile = treePath + subSampleNameVector[i] + "/treeProducerDarkMatterMonoJet/tree.root"; */ /* string friend_treeRootFile = treePath + "friends/evVarFriend_" + subSampleNameVector[i]+ ".root"; */ /* chain->Add(TString(treeRootFile.c_str())); */ /* chFriend->Add(TString(friend_treeRootFile.c_str())); */ /* } */ /* if(!chain ) { */ /* cout << "#### Error in buildChain() function: chain not created. End of programme" << endl; */ /* exit(EXIT_FAILURE); */ /* } */ /* if(!chFriend ) { */ /* cout << "#### Error in buildChain() function: chFriend not created. End of programme" << endl; */ /* exit(EXIT_FAILURE); */ /* } */ /* cout << "Adding friend to chain ..." << endl; */ /* chain->AddFriend(chFriend); //adding whole friend chain as friend */ /* cout << "entries in chain = " << chain-> GetEntries() << endl; */ /* cout << "entries in chFriend = " << chFriend->GetEntries() << endl; */ /* if (chain->GetEntries() != chFriend->GetEntries()) { */ /* cout << "#### Error in buildChain() function: chain and chFriend have different number of events. End of programme" << endl; */ /* exit(EXIT_FAILURE); */ /* } */ /* } */ //=========================================================== Double_t getXsecOverNgen(const string& sample) { // xsec in pb map<string, Double_t> events_ntot; map<string, Double_t> cross_section; //////////////////// // ZJets //////////////////// events_ntot["DYJetsM50"] = 30429578; cross_section["DYJetsM50"] = 3503.7; //////////////////// //WJets //////////////////// events_ntot["WJets"] = 57093619; cross_section["WJets"] = 37509.0; //////////////////// // top //////////////////// events_ntot["TTJets"] = 6923750; cross_section["TTJets"] = 245.59; events_ntot["Tsch"] = 259961; cross_section["Tsch"] = 3.79; events_ntot["Tbarsch"] = 139974; cross_section["Tbarsch"] = 1.76; events_ntot["Ttch"] = 3753227; cross_section["Ttch"] = 56.4; events_ntot["Tbartch"] = 1935072; cross_section["Tbartch"] = 30.7; events_ntot["TtW"] = 497658; cross_section["TtW"] = 11.73; events_ntot["TbartW"] = 493460; cross_section["TbartW"] = 11.73; //////////////////// // diboson //////////////////// events_ntot["WWJets"] = 1898738; cross_section["WWJets"] = 5.995; events_ntot["WZJets"] = 2007120; cross_section["WZJets"] = 1.057 * 1.10; //////////////////// //QCD mu enriched //////////////////// events_ntot["QCDMuPt15"] = 21328956; cross_section["QCDMuPt15"] = 134680; // 364000000 * 0.00037 * 0.6 // without 0.6 factor it is 134680, otherwise it is 80808 // 0.00037 is the filter efficiency, error on efficiency is 0.000038 // 0.6 is an hardcoded value that should make QCD MC normalization be consistent with data // return xsec in fb if (sample.find("data") != string::npos) return 1.0; else return cross_section[sample] * 1000.0/ events_ntot[sample] ; } //========================================================= Double_t getXsec8TeV(const string& sample) { // xsec in pb map<string, Double_t> cross_section; //////////////////// // ZJets //////////////////// cross_section["DYJetsM50"] = 3503.7; //////////////////// //WJets //////////////////// cross_section["WJets"] = 37509.0; //////////////////// // top //////////////////// cross_section["TTJets"] = 245.59; cross_section["Tsch"] = 3.79; cross_section["Tbarsch"] = 1.76; cross_section["Ttch"] = 56.4; cross_section["Tbartch"] = 30.7; cross_section["TtW"] = 11.73; cross_section["TbartW"] = 11.73; //////////////////// // diboson //////////////////// cross_section["WWJets"] = 5.81; cross_section["WZJets"] = 1.057 * 1.10; //////////////////// //QCD mu enriched //////////////////// cross_section["QCDMuPt15"] = 134680; // 364000000 * 0.00037 * 0.6 // without 0.6 factor it is 134680, otherwise it is 80808 // 0.00037 is the filter efficiency, error on efficiency is 0.000038 // 0.6 is an hardcoded value that should make QCD MC normalization be consistent with data // return xsec in fb if (sample.find("data") != string::npos || sample.find("fake") != string::npos) return 1.0; else return cross_section[sample] * 1000.0 ; // return xsec in fb } //========================================================= Double_t getXsec13TeV(const string& sample) { // xsec in pb map<string, Double_t> cross_section; //////////////////// // ZJets //////////////////// cross_section["DYJetsM50"] = 3.0 * 2008.0; //////////////////// //WJets //////////////////// cross_section["WJets"] = 3.0 * 20508.9; //////////////////// // top //////////////////// cross_section["TBar_tWch"] = 35.6; cross_section["TTJets_SingleLeptonFromT"] = 831.76*(3*0.108)*(1-3*0.108); cross_section["TTJets_SingleLeptonFromTbar"] = 831.76*(3*0.108)*(1-3*0.108); cross_section["TToLeptons_sch"] = (7.20+4.16)*0.108*3; cross_section["TToLeptons_tch_amcatnlo"] = (136.05+80.97)*0.108*3; cross_section["T_tWch"] = 35.6; //////////////////// // diboson5B //////////////////// cross_section["WWJets"] = 63.21 * 1.82; cross_section["WZJets"] = 47.13; cross_section["ZZJets"] = 16.523; //////////////////// //QCD mu enriched //////////////////// cross_section["QCD_Mu15"] = 720.65e6*0.00042; cross_section["QCD_Pt1000toInf_Mu5"] = 10.4305*0.15544; cross_section["QCD_Pt120to170_Mu5"] = 469797*0.05362; cross_section["QCD_Pt15to20_Mu5"] = 1273190000*0.003; cross_section["QCD_Pt170to300_Mu5"] = 117989*0.07335; cross_section["QCD_Pt20to30_Mu5"] = 558528000*0.0053; cross_section["QCD_Pt300to470_Mu5_ext"] = 7820.25*0.10196; cross_section["QCD_Pt300to470_Mu5"] = 7820.25*0.10196; cross_section["QCD_Pt30to50_Mu5"] = 139803000*0.01182; cross_section["QCD_Pt470to600_Mu5_ext"] = 645.528*0.12242; cross_section["QCD_Pt470to600_Mu5"] = 645.528*0.12242; cross_section["QCD_Pt50to80_Mu5"] = 19222500*0.02276; cross_section["QCD_Pt600to800_Mu5_ext"] = 187.109*0.13412; cross_section["QCD_Pt600to800_Mu5"] = 187.109*0.13412; cross_section["QCD_Pt800to1000_Mu5_ext"] = 32.3486*0.14552; cross_section["QCD_Pt800to1000_Mu5"] = 32.3486*0.14552; cross_section["QCD_Pt80to120_Mu5"] = 2758420*0.03844; //////////////////// //QCD ele enriched //////////////////// cross_section["QCD_Pt120to170_EMEnriched"] = 477000*0.132; cross_section["QCD_Pt170to300_EMEnriched"] = 114000*0.165; cross_section["QCD_Pt20to30_EMEnriched"] = 557600000*0.0096; cross_section["QCD_Pt300toInf_EMEnriched"] = 9000*0.15; cross_section["QCD_Pt30to50_EMEnriched"] = 136000000*0.073; cross_section["QCD_Pt50to80_EMEnriched"] = 19800000*0.146; cross_section["QCD_Pt80to120_EMEnriched"] = 2800000*0.125; cross_section["QCD_Pt_170to250_bcToE"] = 105771*0.02492; cross_section["QCD_Pt_250toInf_bcToE"] = 21094.1*0.03375; cross_section["QCD_Pt_30to80_bcToE"] = 159068000*0.00255; // return xsec in fb if (sample.find("data") != string::npos || sample.find("fake") != string::npos) return 1.0; else return cross_section[sample] * 1000.0 ; // return xsec in fb } //========================================================= Double_t getSumGenWeightFromSampleName(const string& sample) { if (sample.find("data") != string::npos || sample.find("fake") != string::npos) return 1.0; // xsec in pb map<string, Double_t> map_sampleName_sumGenWgt; // map created with script getSumWeightPerSample.py map_sampleName_sumGenWgt["DYJetsToLL_M50_part1"] = 4.4113015039e+11; map_sampleName_sumGenWgt["DYJetsToLL_M50_part2"] = 4.4113015039e+11; map_sampleName_sumGenWgt["QCD_Pt20to30_EMEnriched"] = 38966443.5421; map_sampleName_sumGenWgt["QCD_Pt30to50_EMEnriched"] = 38966443.5421; map_sampleName_sumGenWgt["QCD_Pt30to50_EMEnriched_ext"] = 38966443.5421; map_sampleName_sumGenWgt["QCD_Pt50to80_EMEnriched_ext"] = 38966443.5421; map_sampleName_sumGenWgt["QCD_Pt80to120_EMEnriched_ext"] = 38966443.5421; map_sampleName_sumGenWgt["QCD_Pt_170to250_bcToE"] = 57429713.852; map_sampleName_sumGenWgt["QCD_Pt_20to30_bcToE"] = 57429713.852; map_sampleName_sumGenWgt["QCD_Pt_250toInf_bcToE"] = 57429713.852; map_sampleName_sumGenWgt["QCD_Pt_30to80_bcToE"] = 57429713.852; map_sampleName_sumGenWgt["QCD_Pt_80to170_bcToE"] = 57429713.852; map_sampleName_sumGenWgt["TBar_tWch_ext"] = 6481480.0; map_sampleName_sumGenWgt["TBar_tch_powheg_part1"] = 37659712.0; map_sampleName_sumGenWgt["TBar_tch_powheg_part2"] = 37659712.0; map_sampleName_sumGenWgt["TBar_tch_powheg_part3"] = 37659712.0; map_sampleName_sumGenWgt["TTJets_SingleLeptonFromT_part1"] = 9949110.0; map_sampleName_sumGenWgt["TTJets_SingleLeptonFromT_part2"] = 9949110.0; map_sampleName_sumGenWgt["TTJets_SingleLeptonFromTbar_part1"] = 8929457.0; map_sampleName_sumGenWgt["TTJets_SingleLeptonFromTbar_part2"] = 8929457.0; map_sampleName_sumGenWgt["TToLeptons_sch_amcatnlo"] = 3370668.5184; map_sampleName_sumGenWgt["T_tWch_ext"] = 6332490.0; map_sampleName_sumGenWgt["T_tch_powheg_part1"] = 61947468.0; map_sampleName_sumGenWgt["T_tch_powheg_part2"] = 61947468.0; map_sampleName_sumGenWgt["WJetsToLNu_NoSkim"] = 3.69928427394e+12; map_sampleName_sumGenWgt["WW"] = 6248191.83067; map_sampleName_sumGenWgt["WW_ext"] = 6248191.83067; map_sampleName_sumGenWgt["WZ"] = 3995828.0; map_sampleName_sumGenWgt["WZ_ext"] = 3995828.0; map_sampleName_sumGenWgt["ZZ"] = 1988098.0; map_sampleName_sumGenWgt["ZZ_ext"] = 1988098.0; return map_sampleName_sumGenWgt[sample]; } //========================================================= void buildChain(TChain* chain, vector<Double_t>& genwgtVec, const bool use8TeVSample = true, const string& treePath = "", const Sample& sample = Sample::data_doubleEG, TChain* chFriend = NULL, TChain* chSfFriend = NULL ) { cout << "Creating chain ..." << endl; vector<string> subSampleNameVector; if (use8TeVSample) { if (sample == Sample::wjets || sample == Sample::wenujets || sample == Sample::wmunujets || sample == Sample::wtaunujets) { subSampleNameVector.push_back("WJets"); } else if (sample == Sample::zjets) { subSampleNameVector.push_back("DYJetsM50"); } else if (sample == Sample::data_doubleEG) { subSampleNameVector.push_back("DoubleElectronAB"); subSampleNameVector.push_back("DoubleElectronC"); subSampleNameVector.push_back("DoubleElectronD"); } else if (sample == Sample::data_singleEG || sample == Sample::qcd_ele_fake) { subSampleNameVector.push_back("SingleElectronAB"); subSampleNameVector.push_back("SingleElectronC"); subSampleNameVector.push_back("SingleElectronD"); } else if (sample == Sample::data_doubleMu) { subSampleNameVector.push_back("DoubleMuAB"); subSampleNameVector.push_back("DoubleMuC"); subSampleNameVector.push_back("DoubleMuD"); } else if (sample == Sample::data_singleMu || sample == Sample::qcd_mu_fake) { subSampleNameVector.push_back("SingleMuAB"); subSampleNameVector.push_back("SingleMuC"); subSampleNameVector.push_back("SingleMuD"); } else if (sample == Sample::top) { subSampleNameVector.push_back("TTJets"); subSampleNameVector.push_back("Tbarsch"); subSampleNameVector.push_back("TbartW"); subSampleNameVector.push_back("Tbartch"); subSampleNameVector.push_back("Tsch"); subSampleNameVector.push_back("TtW"); subSampleNameVector.push_back("Ttch"); } else if (sample == Sample::diboson) { subSampleNameVector.push_back("WWJets"); subSampleNameVector.push_back("WZJets"); } else if (sample == Sample::qcd_mu) { subSampleNameVector.push_back("QCDMuPt15"); } else if (sample == Sample::qcd_ele) { cout << "#### Error in buildChain() function: qcd_ele not available at the moment, please check. Exit ..." << endl; exit(EXIT_FAILURE); //subSampleNameVector.push_back(""); } else { cout << "#### Error in buildChain() function: sample name not available, please check. Exit ..." << endl; exit(EXIT_FAILURE); } } else { /* vector<string> sampleRoots = {"DYJetsToLL_M50_part", */ /* # "DYJetsToLL_M50_LO", */ /* "WW", */ /* "WZ", */ /* "ZZ", */ /* "TBar_tWch_ext", */ /* "T_tWch_ext", */ /* "TTJets_SingleLeptonFromT_", */ /* "TTJets_SingleLeptonFromTbar_", */ /* "T_tch_powheg", */ /* "TBar_tch_powheg_", */ /* "TToLeptons_sch_amcatnl", */ /* "WJetsToLNu_NoSkim", */ /* "_bcTo", */ /* "_EMEnriched", */ /* # "_Mu5", */ /* # "_Mu15"} */ if (sample == Sample::wjets || sample == Sample::wenujets || sample == Sample::wmunujets || sample == Sample::wtaunujets) { subSampleNameVector.push_back("WJetsToLNu_NoSkim"); /* } else if (sample == Sample::wjets_LO || sample == Sample::wenujets_LO || sample == Sample::wmunujets_LO || sample == Sample::wtaunujets_LO) { */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part1"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part10"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part2"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part3"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part4"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part5"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part6"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part7"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part8"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_ext_part9"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part1"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part2"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part3"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part4"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part5"); */ /* subSampleNameVector.push_back("WJetsToLNu_LO_part6"); */ } else if (sample == Sample::zjets) { subSampleNameVector.push_back("DYJetsToLL_M50_part1"); subSampleNameVector.push_back("DYJetsToLL_M50_part2"); /* } else if (sample == Sample::zjets_LO) { */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part1"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part10"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part11"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part2"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part3"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part4"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part5"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part6"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part7"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part8"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext2_part9"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part1"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part2"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part3"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part4"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part5"); */ /* subSampleNameVector.push_back("DYJetsToLL_M50_LO_ext_part6"); */ /* } else if (sample == Sample::data_doubleEG) { */ /* } else if (sample == Sample::data_doubleMu) { */ } else if (sample == Sample::data_singleEG || sample == Sample::qcd_ele_fake) { subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016B_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016B_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016B_part3"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016B_part4"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016C_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016C_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016D_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016D_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016D_part3"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016E_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016E_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016F_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016F_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016G_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016G_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016G_part3"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016G_part4"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016H_part1"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016H_part2"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016H_part3"); subSampleNameVector.push_back("SingleElectron_07Aug17_Run2016H_part4"); /* } else if (sample == Sample::data_singleMu) { */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part11"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part12"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part13"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part14"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part15"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part16"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part17"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part18"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part19"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part20"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part21"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part22"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part23"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016B_part9"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016C_part9"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016D_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part11"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part12"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part13"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part14"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016E_part9"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part11"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016F_part9"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part11"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part12"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part13"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part14"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part15"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part16"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part17"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part18"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part19"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part20"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part21"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part22"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part23"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016G_part9"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part1"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part10"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part11"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part12"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part13"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part14"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part15"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part17"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part18"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part19"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part2"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part20"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part21"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part22"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part23"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part24"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part25"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part26"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part27"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part28"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part29"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part3"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part30"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part31"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part32"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part4"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part5"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part6"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part7"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part8"); */ /* subSampleNameVector.push_back("SingleMuon_Run2016H_part9"); */ } else if (sample == Sample::top) { subSampleNameVector.push_back("TBar_tWch_ext"); subSampleNameVector.push_back("TBar_tch_powheg_part1"); subSampleNameVector.push_back("TBar_tch_powheg_part2"); subSampleNameVector.push_back("TBar_tch_powheg_part3"); /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part1"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part2"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part3"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part4"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part5"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part6"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part7"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part8"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromT_ext_part9"); */ subSampleNameVector.push_back("TTJets_SingleLeptonFromT_part1"); subSampleNameVector.push_back("TTJets_SingleLeptonFromT_part2"); /* subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_ext_part1"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_ext_part2"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_ext_part3"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_ext_part4"); */ /* subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_ext_part5"); */ subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_part1"); subSampleNameVector.push_back("TTJets_SingleLeptonFromTbar_part2"); subSampleNameVector.push_back("TToLeptons_sch_amcatnlo"); subSampleNameVector.push_back("T_tWch_ext"); subSampleNameVector.push_back("T_tch_powheg_part1"); subSampleNameVector.push_back("T_tch_powheg_part2"); } else if (sample == Sample::diboson) { subSampleNameVector.push_back("WW"); subSampleNameVector.push_back("WW_ext"); subSampleNameVector.push_back("WZ"); subSampleNameVector.push_back("WZ_ext"); subSampleNameVector.push_back("ZZ"); subSampleNameVector.push_back("ZZ_ext"); } else if (sample == Sample::qcd_mu) { subSampleNameVector.push_back("QCD_Mu15_part1"); subSampleNameVector.push_back("QCD_Mu15_part2"); subSampleNameVector.push_back("QCD_Pt1000toInf_Mu5"); subSampleNameVector.push_back("QCD_Pt120to170_Mu5"); subSampleNameVector.push_back("QCD_Pt15to20_Mu5"); subSampleNameVector.push_back("QCD_Pt170to300_Mu5"); subSampleNameVector.push_back("QCD_Pt170to300_Mu5_ext"); subSampleNameVector.push_back("QCD_Pt20to30_Mu5"); subSampleNameVector.push_back("QCD_Pt300to470_Mu5"); subSampleNameVector.push_back("QCD_Pt300to470_Mu5_ext"); subSampleNameVector.push_back("QCD_Pt300to470_Mu5_ext2"); subSampleNameVector.push_back("QCD_Pt30to50_Mu5"); subSampleNameVector.push_back("QCD_Pt470to600_Mu5_ext"); subSampleNameVector.push_back("QCD_Pt50to80_Mu5"); subSampleNameVector.push_back("QCD_Pt600to800_Mu5"); subSampleNameVector.push_back("QCD_Pt800to1000_Mu5_ext2"); subSampleNameVector.push_back("QCD_Pt80to120_Mu5"); subSampleNameVector.push_back("QCD_Pt80to120_Mu5_ext"); } else if (sample == Sample::qcd_ele) { subSampleNameVector.push_back("QCD_Pt20to30_EMEnriched"); subSampleNameVector.push_back("QCD_Pt30to50_EMEnriched"); subSampleNameVector.push_back("QCD_Pt30to50_EMEnriched_ext"); subSampleNameVector.push_back("QCD_Pt50to80_EMEnriched_ext"); subSampleNameVector.push_back("QCD_Pt80to120_EMEnriched_ext"); subSampleNameVector.push_back("QCD_Pt_170to250_bcToE"); subSampleNameVector.push_back("QCD_Pt_20to30_bcToE"); subSampleNameVector.push_back("QCD_Pt_250toInf_bcToE"); subSampleNameVector.push_back("QCD_Pt_30to80_bcToE"); subSampleNameVector.push_back("QCD_Pt_80to170_bcToE"); } else { cout << "#### Error in buildChain() function: sample name not available, please check. Exit ..." << endl; exit(EXIT_FAILURE); } } for(UInt_t i = 0; i < subSampleNameVector.size(); i++) { string treeRootFile = ""; if (use8TeVSample) { treeRootFile = treePath + subSampleNameVector[i] + "/treeProducerWMassEle/treeProducerWMassEle_tree.root"; if (treePath.find("WSKIM_V") != string::npos || treePath.find("QCDSKIM_V") != string::npos || treePath.find("ZEESKIM_V") != string::npos) { treeRootFile = treePath + subSampleNameVector[i] + "/treeProducerWMassEle/tree.root"; } } else { if (treePath.find("/eos/cms/") != string::npos) { treeRootFile = treePath + subSampleNameVector[i] + "/treeProducerWMass/tree.root"; } else { cout << "13 TeV trees not available outside eos, or function to read them not implemented yet. Please check. Exit." << endl; exit(EXIT_FAILURE); } } cout << "Tree: " << treeRootFile << endl; chain->Add(TString(treeRootFile.c_str())); // in the following we need the total number of generated events to normalize MC // for 8 TeV there is a histogram in the same file with root tree, named Count // its integral (or number of entries, since it is an integer) gives the total number of generated events // at 13 TeV, depending on MC (LO or NLO) we have a gen weight different from 1, and it is not an integer number in general // we need the sum of gen weights // Moreover, if we have extensions for a MC sample (and in case both versions are used) each of them must be normalized to the sum of the two sum of weights // otherwise we are adding the same MC as a different process // since at 13 TeV, due to lack of space during MC ntuples production, we also have many chunks of the same process, I wrote a script to produce a map // that associates to a given sample its proper sumGenWeights value if (use8TeVSample) { string fileNameToGetTH1 = treeRootFile; // read number of generated events TFile* ftree = new TFile(fileNameToGetTH1.c_str(),"READ"); if (!ftree || ftree->IsZombie()) { cout << "### Error in buildChain(): couldn't open file '" << treeRootFile << "'. Exit" << endl; exit(EXIT_FAILURE); } TH1F* hCount = (TH1F*) getHistCloneFromFile(ftree,"Count",""); checkNotNullPtr(hCount,"hCount"); genwgtVec.push_back(getXsec8TeV(subSampleNameVector[i])/hCount->GetEntries()); delete hCount; ftree->Close(); delete ftree; } else { string sampleDir = getStringFromEnumSample(sample).c_str(); if (sampleDir.find("data") == string::npos && sampleDir.find("fake") == string::npos) { genwgtVec.push_back(1./getSumGenWeightFromSampleName(subSampleNameVector[i])); } } } if(!chain ) { cout << "#### Error in buildChain() function: chain not created. End of programme" << endl; exit(EXIT_FAILURE); } cout << "entries in chain = " << chain-> GetEntries() << endl; // friend if (chFriend != NULL) { for(UInt_t i = 0; i < subSampleNameVector.size(); i++) { string friend_treeRootFile = ""; if (use8TeVSample) friend_treeRootFile = treePath + "friends/evVarFriend_" + subSampleNameVector[i]+ ".root"; else friend_treeRootFile = treePath + "friends/tree_Friend_" + subSampleNameVector[i]+ ".root"; chFriend->Add(TString(friend_treeRootFile.c_str())); } if(!chFriend ) { cout << "#### Error in buildChain() function: chFriend not created. End of programme" << endl; exit(EXIT_FAILURE); } cout << "Adding friend to chain ..." << endl; chain->AddFriend(chFriend); //adding whole friend chain as friend cout << "entries in chFriend = " << chFriend->GetEntries() << endl; if (chain->GetEntries() != chFriend->GetEntries()) { cout << "#### Error in buildChain() function: chain and chFriend have different number of events." << endl; cout << "sample: " << getStringFromEnumSample(sample) << endl; cout << "chain: " << chain->GetEntries() << endl; cout << "chFriend: " << chFriend->GetEntries() << endl; cout << "#### End of programme" << endl; exit(EXIT_FAILURE); } } // SF friend if (chSfFriend != NULL) { for(UInt_t i = 0; i < subSampleNameVector.size(); i++) { string friend_treeRootFile = treePath + "friends/sfFriend_" + subSampleNameVector[i]+ ".root"; chSfFriend->Add(TString(friend_treeRootFile.c_str())); } if(!chSfFriend ) { cout << "#### Error in buildChain() function: chSfFriend not created. End of programme" << endl; exit(EXIT_FAILURE); } cout << "Adding SF friend to chain ..." << endl; chain->AddFriend(chSfFriend); //adding whole friend chain as friend cout << "entries in chSfFriend = " << chSfFriend->GetEntries() << endl; if (chain->GetEntries() != chSfFriend->GetEntries()) { cout << "#### Error in buildChain() function: chain and chSfFriend have different number of events." << endl; cout << "sample: " << getStringFromEnumSample(sample) << endl; cout << "chain: " << chain->GetEntries() << endl; cout << "chSfFriend: " << chSfFriend->GetEntries() << endl; cout << "#### End of programme" << endl; exit(EXIT_FAILURE); } } } //========================================================= Double_t myRayleigh(Double_t* x, Double_t* par) { Double_t xcur = x[0]; Double_t sigma = par[0]; Double_t Norm = par[1]; Double_t t = xcur - par[2]; Double_t invSigma2 = TMath::Power(sigma * sigma, -1); return Norm * xcur * invSigma2 * exp(-1. * xcur * xcur * invSigma2); //return xcur * invSigma2 * exp(-1. * xcur * xcur * invSigma2); } //============================================================ void makeFit(TH1* hist) { TCanvas* canvas = new TCanvas("canvas","",700,700); hist->Draw("HE"); TF1* rayleigh = new TF1("rayleigh",&myRayleigh,20,135,3); //TF1* rayleigh = new TF1("rayleigh",&myRayleigh,20,135,1); rayleigh->SetParNames("sigma","norm","shift"); rayleigh->SetParLimits(rayleigh->GetParNumber("sigma"),50,70); rayleigh->SetParLimits(rayleigh->GetParNumber("norm"),0.1,100); rayleigh->SetParLimits(rayleigh->GetParNumber("shift"),15,25); // mode of rayleigh is sigma rayleigh->SetParameters(hist->GetBinCenter(hist->GetMaximumBin()),hist->GetBinContent(hist->GetMaximumBin()),20); //rayleigh->SetParameter(rayleigh->GetParNumber("sigma"),hist->GetBinCenter(hist->GetMaximumBin())); rayleigh->SetLineColor(kRed); TFitResultPtr frp1 = hist->Fit(rayleigh,"E L I S Q B R","HE",20, 135); canvas->Update(); // box for fit with Crystal Ball TPaveStats *stat = (TPaveStats*)(hist->FindObject("stats")); if(stat) { // stat->SetTextColor(kBlue); // stat1->SetTextColor(kGreen); Double_t width = stat->GetX2NDC() - stat->GetX1NDC(); // make stat box bigger stat->SetX1NDC(stat->GetX1NDC() - 0.25 * width); stat->Draw(); } canvas->SaveAs("/afs/cern.ch/user/m/mciprian/www/test_plot/rayleigh.png"); } #endif
[ "cippy91@gmail.com" ]
cippy91@gmail.com
dd107f819df4671a88fbf34b9356271ad7e69f9b
3e4fd5153015d03f147e0f105db08e4cf6589d36
/Cpp/SDK/MiniMapWidget_parameters.h
ac638a3b4f753f7fad90ef514e05f939da2c48ec
[]
no_license
zH4x-SDK/zTorchlight3-SDK
a96f50b84e6b59ccc351634c5cea48caa0d74075
24135ee60874de5fd3f412e60ddc9018de32a95c
refs/heads/main
2023-07-20T12:17:14.732705
2021-08-27T13:59:21
2021-08-27T13:59:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,737
h
#pragma once // Name: Torchlight3, Version: 4.26.1 /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Parameters //--------------------------------------------------------------------------- // Function MiniMapWidget.MiniMapWidget_C.GetFortNameWidget struct UMiniMapWidget_C_GetFortNameWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDifficultyBadgeSwitcher struct UMiniMapWidget_C_GetDifficultyBadgeSwitcher_Params { class UTLWidgetSwitcher* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetMonsterMoveSpeedScalingTextWidget struct UMiniMapWidget_C_GetMonsterMoveSpeedScalingTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonBenefitsTextWidget struct UMiniMapWidget_C_GetDungeonBenefitsTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonDetrimentsTextWidget struct UMiniMapWidget_C_GetDungeonDetrimentsTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonDetrimentsContainerWidget struct UMiniMapWidget_C_GetDungeonDetrimentsContainerWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonBenefitsContainerWidget struct UMiniMapWidget_C_GetDungeonBenefitsContainerWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDifficultyAndLevelContainerWidget struct UMiniMapWidget_C_GetDifficultyAndLevelContainerWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetMonsterScalingContainerWidget struct UMiniMapWidget_C_GetMonsterScalingContainerWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetAffixesContainerWidget struct UMiniMapWidget_C_GetAffixesContainerWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonDecorativeWidgets struct UMiniMapWidget_C_GetDungeonDecorativeWidgets_Params { TArray<class UWidget*> ReturnValue; // (Parm, OutParm, ReturnParm, ContainsInstancedReference) }; // Function MiniMapWidget.MiniMapWidget_C.GetDungeonChallengeLevelTextWidget struct UMiniMapWidget_C_GetDungeonChallengeLevelTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetMonsterDamageScalingTextWidget struct UMiniMapWidget_C_GetMonsterDamageScalingTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetMonsterHealthScalingTextWidget struct UMiniMapWidget_C_GetMonsterHealthScalingTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetMapWidget struct UMiniMapWidget_C_GetMapWidget_Params { class UWidget* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetDifficultyWidget struct UMiniMapWidget_C_GetDifficultyWidget_Params { class UTLRichTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetAffixTextWidget struct UMiniMapWidget_C_GetAffixTextWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetAreaLevelRangeWidget struct UMiniMapWidget_C_GetAreaLevelRangeWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.GetAreaNameWidget struct UMiniMapWidget_C_GetAreaNameWidget_Params { class UTLTextBlock* ReturnValue; // (Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; // Function MiniMapWidget.MiniMapWidget_C.Construct struct UMiniMapWidget_C_Construct_Params { }; // Function MiniMapWidget.MiniMapWidget_C.ExecuteUbergraph_MiniMapWidget struct UMiniMapWidget_C_ExecuteUbergraph_MiniMapWidget_Params { int EntryPoint; // (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "zp2kshield@gmail.com" ]
zp2kshield@gmail.com
a755e9357a1f0ca7614ea173dd364ab5e260f503
14582f8c74c28d346399f877b9957d0332ba1c3c
/tags/pstade_2007/pstade/pod_constant.hpp
a987bcd9e20a5e159a346577008a2b0f69f27470
[ "BSL-1.0" ]
permissive
svn2github/p-stade
c7b421be9eeb8327ddd04d3cb36822ba1331a43e
909b46567aa203d960fe76055adafc3fdc48e8a5
refs/heads/master
2016-09-05T22:14:09.460711
2014-08-22T08:16:11
2014-08-22T08:16:11
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,262
hpp
#ifndef PSTADE_POD_CONSTANT_HPP #define PSTADE_POD_CONSTANT_HPP #include "./detail/prefix.hpp" // PStade.Wine // // Copyright Shunsuke Sogame 2005-2007. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // Note: // // After all, ODR violation workaround: // http://lists.boost.org/Archives/boost/2007/06/123353.php // was given up. // Even gcc is broken around "address constant expression". #include <boost/config.hpp> #include <boost/preprocessor/cat.hpp> #include <pstade/boost_workaround.hpp> #include <pstade/unevaluated.hpp> #include <pstade/unparenthesize.hpp> namespace pstade { namespace pod_constant_detail { // Some compilers can warn if non-POD passed through ellipsis. inline void must_be_pod(...) { } } } // Do you know the exact condition? #if 0 // defined(BOOST_MSVC) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER >=140050215) // msvc too can't tell the right answer around cv-qualifiers. #include <boost/static_assert.hpp> #include <boost/type_traits/is_pod.hpp> #define PSTADE_POD_CONSTANT_is_pod_available #endif #define PSTADE_POD_CONSTANT(F, O) \ PSTADE_POD_CONSTANT_aux1(PSTADE_UNPARENTHESIZE(F), O) \ /**/ #define PSTADE_POD_CONSTANT_aux1(F, O) \ PSTADE_POD_CONSTANT_pod_check(F, O) \ PSTADE_POD_CONSTANT_aux2(F, O) \ /**/ #define PSTADE_POD_CONSTANT_aux2(F, O) \ F const PSTADE_POD_CONSTANT_unused O \ /**/ #if defined(PSTADE_POD_CONSTANT_is_pod_available) // 'BOOST_MPL_ASSERT' would cause error C2370 under msvc. #define PSTADE_POD_CONSTANT_pod_check(F, O) \ BOOST_STATIC_ASSERT((boost::is_pod< F >::value)); \ /**/ #else #define PSTADE_POD_CONSTANT_pod_check(F, O) \ inline void BOOST_PP_CAT(pstade_pod_constant_check_of_, O)() \ { \ pstade::pod_constant_detail::must_be_pod(pstade::unevaluated<F&>()); \ } \ /**/ #endif #if BOOST_WORKAROUND(__GNUC__, >= 4) #define PSTADE_POD_CONSTANT_unused __attribute__ ((__unused__)) #else #define PSTADE_POD_CONSTANT_unused #endif #endif
[ "mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec" ]
mb2sync@350e9bb6-6311-0410-90c3-be67731b76ec
84c5ae76b0e1e415de7c7177e049598dff8def9a
e138526fe1560db1546fdde3e2ebd1069a44c25c
/isosurfaces_lib/filehandler/hdr/FileReader.h
bf1036ae367fcb103b1495edd5fab54e74bafc3d
[]
no_license
hcp6897/isosurface-analysis
a939c97e9b4724bace296fcf71f430234e5a64b6
34cc8d0417263b64d2ea634499d1b98f69e03d22
refs/heads/master
2021-09-22T20:21:49.136316
2018-09-15T15:47:04
2018-09-15T15:47:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
868
h
// // Created by mimre on 7/27/16. // #ifndef FILEHANDLER_FILEREADER_H #define FILEHANDLER_FILEREADER_H #include <string> #include <vector> #include <bits/ios_base.h> #include "FileHandler.h" namespace filehandler { using namespace std; class FileReader : public FileHandler { public: enum ReadMode { READ, //r READ_WRITE, //r+ BINARY_READ, //rb BINARY_READ_WRITE //r+b }; FileReader(const string &fileName); FileReader(const string &fileName, ReadMode readMode); FileReader(); unsigned char *get_file_contents(); string getFileContentsAsString(); ReadMode getReadMode() const; vector<string> readLines(); void setReadMode(ReadMode readMode); private: ReadMode readMode; protected: void evaluateFileOpenMode(ReadMode mode); }; } #endif //FILEHANDLER_FILEREADER_H
[ "martinimre25@gmail.com" ]
martinimre25@gmail.com
2e4755a2ec43cf1a34254d7329773bcc27881954
eabf5a28d0ca8fd53e97c56cb499dfb453b4580e
/Program85.cpp
85e89ee5c98cc61489122619b9b56aa45e24fa0e
[]
no_license
Ajay-kulkarni951/CPP
f5978ff6324e3f174a70c5f5b54c6c96f9d39da7
d160fff6a8793c0f6b5eeb6bb853973d6782e9b2
refs/heads/main
2023-07-28T13:45:46.055457
2021-09-12T03:31:19
2021-09-12T03:31:19
405,534,594
0
0
null
null
null
null
UTF-8
C++
false
false
1,193
cpp
#include<iostream> using namespace std; class Stack { private: int *Arr; int iSize; int iTop; public: Stack(int); ~Stack(); void Push(int); int Pop(); void Display(); }; Stack :: Stack(int iNo) { iSize = iNo; iTop = -1; Arr = new int[iSize]; } Stack :: ~Stack() { delete []Arr; } void Stack :: Push(int iNo) { if(iTop == iSize - 1) { cout<<"Stack Is Full \n"; } else { iTop++; Arr[iTop] = iNo; } } int Stack :: Pop() { if(iTop == -1) { cout<<"Stack is Empty \n"; return -1; } else { int iNo = Arr[iTop]; iTop--; return iNo; } } void Stack :: Display() { if(iTop == -1) { cout<<"Stack Is Empty \n"; } else { for(int i = 0; i <= iTop; i++) { cout<<Arr[i]<<"\t"; } cout<<"\n"; } } int main() { int iNo = 0, iRet = 0; cout<<"Enter The Size Of Array \n"; cin>>iNo; Stack obj(iNo); obj.Push(11); obj.Push(21); obj.Push(51); obj.Display(); iRet = obj.Pop(); cout<<"Poped Element Is : "<<iRet<<"\n"; obj.Display(); iRet = obj.Pop(); cout<<"Poped Element Is : "<<iRet<<"\n"; obj.Display(); return 0; }
[ "noreply@github.com" ]
noreply@github.com
1085ec949e1fa6183ea37aedd0804ee4423dd31e
613080212a29706ba93d46ffaa198725dd5b8089
/2_moving_points.cpp
f6f8f92c59f0f1a9e9da06bdb3de29206a85ab0d
[]
no_license
mc1017/codeforces_practice
722f85cf5c827800aa55bdfd3c14b4d8f21f1080
36d0606a8bee21a093951c5ce097df3098fa3232
refs/heads/main
2023-06-23T06:07:54.211216
2021-07-15T23:45:20
2021-07-15T23:45:20
384,246,311
0
0
null
null
null
null
UTF-8
C++
false
false
541
cpp
#include <iostream> #include <iostream> #include <cmath> #include <functional> #include <fstream> using namespace std; void solve() { int n,d; std::cin>>n>>d; if (d>n*sqrt(2)/2){std::cout<<"NO"<<std::endl;} else{ std::cout<<"YES"<<std::endl; for (int i; i<n;i++){ } } } int main() { ios::sync_with_stdio(0); cin.tie(0); int t=1; std::cin>>t; for (int j=0; j<t;j++) { //write("Case #", i+1, ": "); solve(); } }
[ "noreply@github.com" ]
noreply@github.com
497f3e452aefd7d90f74ac1f48c34003c4aec65d
7fd11eb839c1b9a4ffaaecf8c5f8500452f58ab5
/AutoBestDlg.cpp
cf18c9cc4669c17b7bdae8cc6f6b0592eece6371
[ "MIT" ]
permissive
wyrover/dipstick
05f23a9c06960182d803e1fd62bb3a641051656e
9c276c74d74ade95556d44b218aca06edb63a02b
refs/heads/master
2021-01-18T20:03:00.993256
2005-08-06T21:38:18
2005-08-06T21:38:18
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,466
cpp
// AutoBestDlg.cpp : implementation file // #include "stdafx.h" #include "Dipstick.h" #include "AutoBestDlg.h" #include "URLSource.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CAutoBestDlg dialog CAutoBestDlg::CAutoBestDlg(CWnd* pParent /*=NULL*/) : CDialog(CAutoBestDlg::IDD, pParent) { //{{AFX_DATA_INIT(CAutoBestDlg) m_PktLoss = _T(""); m_RTT = _T(""); m_URL = _T(""); //}}AFX_DATA_INIT } void CAutoBestDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CAutoBestDlg) DDX_Control(pDX, IDC_DROPSOURCE, m_DropSourceCtl); DDX_Control(pDX, IDC_PREV, m_PrevCtl); DDX_Control(pDX, IDC_NEXT, m_NextCtl); DDX_Text(pDX, IDC_PKTLOSS, m_PktLoss); DDX_Text(pDX, IDC_RTT, m_RTT); DDX_Text(pDX, IDC_URL, m_URL); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CAutoBestDlg, CDialog) //{{AFX_MSG_MAP(CAutoBestDlg) ON_BN_CLICKED(IDC_NEXT, OnNext) ON_BN_CLICKED(IDC_PREV, OnPrev) ON_WM_LBUTTONDOWN() ON_BN_CLICKED(IDC_COPYURL, OnCopyurl) ON_WM_HELPINFO() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CAutoBestDlg message handlers void CAutoBestDlg::OnNext() { EndDialog(IDC_NEXT); } void CAutoBestDlg::OnPrev() { EndDialog(IDC_PREV); } BOOL CAutoBestDlg::OnInitDialog() { CDialog::OnInitDialog(); m_NextCtl.EnableWindow(m_bNext); m_PrevCtl.EnableWindow(m_bPrev); VERIFY(m_DropSourceCtl.Open(IDR_DRAGAVI)); SetWindowPos(&CWnd::wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } CAutoBestDlg::~CAutoBestDlg() { } void CAutoBestDlg::OnLButtonDown(UINT nFlags, CPoint point) { if(ChildWindowFromPoint(point,CWP_ALL)==&m_DropSourceCtl){ TRACE0("Dragging!\n"); CURLSource us(m_URL); m_DropSourceCtl.Stop(); us.DoDragDrop(DROPEFFECT_COPY|DROPEFFECT_LINK); m_DropSourceCtl.Play(0,-1,-1); }else CDialog::OnLButtonDown(nFlags, point); } void CAutoBestDlg::OnCopyurl() { CURLSource *us = new CURLSource(m_URL); us->SetClipboard(); us->FlushClipboard(); } BOOL CAutoBestDlg::OnHelpInfo(HELPINFO* pHelpInfo) { WinHelp(IDD|0x20000l); return TRUE; }
[ "hacker@klever.net" ]
hacker@klever.net
57e026b257eca805968c8fb50eeae5ff16321aa7
f97b9e0eb26b629f811ce0a15fddf29a93641a3c
/src/key_io.cpp
a857abbf4ed8fd316a5bdcd36742a6288e53e93b
[ "MIT" ]
permissive
xiaolin1579/5G
d5c357bea7ed0db6db7979e77ed86ff43c065f82
e70eff1d1c0be2800e887532f83e180ac6d02cdb
refs/heads/master
2022-12-19T01:53:59.234678
2020-09-09T15:35:04
2020-09-09T15:35:04
294,073,794
0
0
MIT
2020-09-09T10:02:50
2020-09-09T10:02:49
null
UTF-8
C++
false
false
9,955
cpp
// Copyright (c) 2014-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include <key_io.h> #include <base58.h> #include <bech32.h> #include <script/script.h> #include <utilstrencodings.h> #include <boost/variant/apply_visitor.hpp> #include <boost/variant/static_visitor.hpp> #include <assert.h> #include <string.h> #include <algorithm> namespace { class DestinationEncoder : public boost::static_visitor<std::string> { private: const CChainParams& m_params; public: DestinationEncoder(const CChainParams& params) : m_params(params) {} std::string operator()(const CKeyID& id) const { std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); data.insert(data.end(), id.begin(), id.end()); return EncodeBase58Check(data); } std::string operator()(const CScriptID& id) const { std::vector<unsigned char> data = m_params.Base58Prefix(CChainParams::SCRIPT_ADDRESS); data.insert(data.end(), id.begin(), id.end()); return EncodeBase58Check(data); } std::string operator()(const WitnessV0KeyHash& id) const { std::vector<unsigned char> data = {0}; data.reserve(33); ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, id.begin(), id.end()); return bech32::Encode(m_params.Bech32HRP(), data); } std::string operator()(const WitnessV0ScriptHash& id) const { std::vector<unsigned char> data = {0}; data.reserve(53); ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, id.begin(), id.end()); return bech32::Encode(m_params.Bech32HRP(), data); } std::string operator()(const WitnessUnknown& id) const { if (id.version < 1 || id.version > 16 || id.length < 2 || id.length > 40) { return {}; } std::vector<unsigned char> data = {(unsigned char)id.version}; data.reserve(1 + (id.length * 8 + 4) / 5); ConvertBits<8, 5, true>([&](unsigned char c) { data.push_back(c); }, id.program, id.program + id.length); return bech32::Encode(m_params.Bech32HRP(), data); } std::string operator()(const CNoDestination& no) const { return {}; } }; CTxDestination DecodeDestination(const std::string& str, const CChainParams& params) { std::vector<unsigned char> data; uint160 hash; if (DecodeBase58Check(str, data)) { // base58-encoded 5G addresses. // Public-key-hash-addresses have version 0 (or 111 testnet). // The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the serialized public key. const std::vector<unsigned char>& pubkey_prefix = params.Base58Prefix(CChainParams::PUBKEY_ADDRESS); if (data.size() == hash.size() + pubkey_prefix.size() && std::equal(pubkey_prefix.begin(), pubkey_prefix.end(), data.begin())) { std::copy(data.begin() + pubkey_prefix.size(), data.end(), hash.begin()); return CKeyID(hash); } // Script-hash-addresses have version 5 (or 196 testnet). // The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the serialized redemption script. const std::vector<unsigned char>& script_prefix = params.Base58Prefix(CChainParams::SCRIPT_ADDRESS); if (data.size() == hash.size() + script_prefix.size() && std::equal(script_prefix.begin(), script_prefix.end(), data.begin())) { std::copy(data.begin() + script_prefix.size(), data.end(), hash.begin()); return CScriptID(hash); } } data.clear(); auto bech = bech32::Decode(str); if (bech.second.size() > 0 && bech.first == params.Bech32HRP()) { // Bech32 decoding int version = bech.second[0]; // The first 5 bit symbol is the witness version (0-16) // The rest of the symbols are converted witness program bytes. data.reserve(((bech.second.size() - 1) * 5) / 8); if (ConvertBits<5, 8, false>([&](unsigned char c) { data.push_back(c); }, bech.second.begin() + 1, bech.second.end())) { if (version == 0) { { WitnessV0KeyHash keyid; if (data.size() == keyid.size()) { std::copy(data.begin(), data.end(), keyid.begin()); return keyid; } } { WitnessV0ScriptHash scriptid; if (data.size() == scriptid.size()) { std::copy(data.begin(), data.end(), scriptid.begin()); return scriptid; } } return CNoDestination(); } if (version > 16 || data.size() < 2 || data.size() > 40) { return CNoDestination(); } WitnessUnknown unk; unk.version = version; std::copy(data.begin(), data.end(), unk.program); unk.length = data.size(); return unk; } } return CNoDestination(); } } // namespace CKey DecodeSecret(const std::string& str) { CKey key; std::vector<unsigned char> data; if (DecodeBase58Check(str, data)) { const std::vector<unsigned char>& privkey_prefix = Params().Base58Prefix(CChainParams::SECRET_KEY); if ((data.size() == 32 + privkey_prefix.size() || (data.size() == 33 + privkey_prefix.size() && data.back() == 1)) && std::equal(privkey_prefix.begin(), privkey_prefix.end(), data.begin())) { bool compressed = data.size() == 33 + privkey_prefix.size(); key.Set(data.begin() + privkey_prefix.size(), data.begin() + privkey_prefix.size() + 32, compressed); } } memory_cleanse(data.data(), data.size()); return key; } std::string EncodeSecret(const CKey& key) { assert(key.IsValid()); std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::SECRET_KEY); data.insert(data.end(), key.begin(), key.end()); if (key.IsCompressed()) { data.push_back(1); } std::string ret = EncodeBase58Check(data); memory_cleanse(data.data(), data.size()); return ret; } CExtPubKey DecodeExtPubKey(const std::string& str) { CExtPubKey key; std::vector<unsigned char> data; if (DecodeBase58Check(str, data)) { const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY); if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) { key.Decode(data.data() + prefix.size()); } } return key; } std::string EncodeExtPubKey(const CExtPubKey& key) { std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_PUBLIC_KEY); size_t size = data.size(); data.resize(size + BIP32_EXTKEY_SIZE); key.Encode(data.data() + size); std::string ret = EncodeBase58Check(data); return ret; } CExtKey DecodeExtKey(const std::string& str) { CExtKey key; std::vector<unsigned char> data; if (DecodeBase58Check(str, data)) { const std::vector<unsigned char>& prefix = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY); if (data.size() == BIP32_EXTKEY_SIZE + prefix.size() && std::equal(prefix.begin(), prefix.end(), data.begin())) { key.Decode(data.data() + prefix.size()); } } return key; } std::string EncodeExtKey(const CExtKey& key) { std::vector<unsigned char> data = Params().Base58Prefix(CChainParams::EXT_SECRET_KEY); size_t size = data.size(); data.resize(size + BIP32_EXTKEY_SIZE); key.Encode(data.data() + size); std::string ret = EncodeBase58Check(data); memory_cleanse(data.data(), data.size()); return ret; } std::string EncodeDestination(const CTxDestination& dest) { return boost::apply_visitor(DestinationEncoder(Params()), dest); } CTxDestination DecodeDestination(const std::string& str) { return DecodeDestination(str, Params()); } bool IsValidDestinationString(const std::string& str, const CChainParams& params) { return IsValidDestination(DecodeDestination(str, params)); } bool IsValidDestinationString(const std::string& str) { return IsValidDestinationString(str, Params()); } C5GAddress::C5GAddress() { Set(CNoDestination()); } C5GAddress::C5GAddress(const CTxDestination &dest) { txDest = dest; } C5GAddress::C5GAddress(const std::string &strAddress) { Set(DecodeDestination(strAddress)); } C5GAddress::C5GAddress(const char *pszAddress) { Set(DecodeDestination(std::string(pszAddress))); } bool C5GAddress::Set(const CKeyID &id) { return Set(CTxDestination(id)); } bool C5GAddress::Set(const CScriptID &id) { return Set(CTxDestination(id)); } bool C5GAddress::Set(const CTxDestination &dest) { txDest = dest; return IsValid(); } bool C5GAddress::IsValid() const { return !boost::get<CNoDestination>(&txDest); } bool C5GAddress::IsValid(const CChainParams &params) const { return IsValidDestinationString(EncodeDestination(txDest), params); } std::string C5GAddress::ToString() const { return EncodeDestination(txDest); } bool C5GAddress::operator==(const C5GAddress &rhs) const { return txDest == rhs.txDest; } bool C5GAddress::operator!=(const C5GAddress &rhs) const { return !(txDest == rhs.txDest); } bool C5GAddress::operator<(const C5GAddress &rhs) const { return txDest < rhs.txDest; } CTxDestination C5GAddress::Get() const { return txDest; } bool C5GAddress::GetKeyID(CKeyID &keyID) const { if(const CKeyID *pKeyID = boost::get<CKeyID>(&txDest)) { keyID = *pKeyID; return true; } return false; } bool C5GAddress::IsScript() const { return boost::get<CScriptID>(&txDest); }
[ "53220766+5G-Cash@users.noreply.github.com" ]
53220766+5G-Cash@users.noreply.github.com
5125b5722793f8e74b2f0af592ab6a23d5b5397d
b4ead92f410e1adbbb34e55b3b88c856a9369066
/trunk/GreenTea/GreenTeaSource/GTGameObjectClassManager.cpp
321219db531eaeb5a109875648df44473738dda5
[]
no_license
BGCX261/zjh-dev-svn-to-git
7c60ce477f9c9ba9d7845a1fde3f17770a677240
41bc4dfef94deac3da49487d788c151d91cb5e80
refs/heads/master
2016-08-04T13:29:41.901731
2015-08-25T15:46:14
2015-08-25T15:46:14
41,489,023
0
0
null
null
null
null
UTF-8
C++
false
false
515
cpp
#include "GTGameObjectClassManager.h" GTGameObjectClassManager::GTGameObjectClassManager() : GTClassAutoInstanceManager<GTGameObject>() { } GTGameObjectClassManager::~GTGameObjectClassManager() { GTClassAutoInstanceManager<GTGameObject>::Release(); } void GTGameObjectClassManager::CreateClassInstanceDefineCallback(GTClassAutoInstanceContainer<GTGameObject>* pWidgetClass) { if(NULL == pWidgetClass) { return; } GTGameObjectClassManager::GetInstance()->AddClass(pWidgetClass); }
[ "you@example.com" ]
you@example.com
c9967c7759dda27a72a09960639e0770f81783b8
153a117a89ba736402faf7cae5ce5526319fbd31
/src/PhoneCommon.h
3fd83920a4877c8f1bbe8780820fa3b687a5dcdb
[ "MIT" ]
permissive
hoathienvu8x/tincanphone
fe57e5a2847512540d416ca57e2f5b9b7ff3e368
fcdfdca99247328ca2907c80e24da0ff0c1579e9
refs/heads/master
2023-03-26T16:02:19.560827
2016-04-23T23:59:13
2016-04-23T23:59:13
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,126
h
/* (C) 2016 Gary Sinitsin. See LICENSE file (MIT license). */ #pragma once // Integer types with specified bit widths #ifdef _MSC_VER namespace tincan { typedef unsigned char byte; typedef unsigned char uint8; typedef signed char int8; typedef unsigned short uint16; typedef signed short int16; typedef unsigned int uint32; typedef signed int int32; } #else #include <stdint.h> namespace tincan { typedef uint8_t byte; typedef uint8_t uint8; typedef int8_t int8; typedef uint16_t uint16; typedef int16_t int16; typedef uint32_t uint32; typedef int32_t int32; } #endif // Common std headers #include <cstddef> #include <cstring> #include <stdexcept> #include <string> #include <vector> #include <sstream> // Shortcuts namespace tincan { typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; using std::string; using std::vector; using std::endl; template <typename T> string toString(const T& x) { std::ostringstream stream; stream << x; return stream.str(); } }
[ "garynull@users.noreply.github.com" ]
garynull@users.noreply.github.com
e1dc04a3ad14ed3873b5893b059fe201663967bd
3b1d92de37ac8f555279386a5722c508cb38dac7
/Project2/quadTree.h
7a1667b139bfafe61ffde04e7bfaf1cfc34b913a
[]
no_license
jrross/csc300-data-structures
e0c701356439c54565c7aff4c239de4ca7ec176c
49ba2e3492b98030d51965175babfb90ae91dba1
refs/heads/master
2020-04-19T07:44:42.248095
2019-01-29T00:11:50
2019-01-29T00:11:50
168,056,104
0
0
null
null
null
null
UTF-8
C++
false
false
2,889
h
/***************************************************************************//** * @file * @brief Header file to be used with quadtree.cpp ******************************************************************************/ #ifndef QUADTREE_H #define QUADTREE_H #include "image.h" using namespace std; /*! * @brief Node structure for the quad Tree */ struct Node { int data; /*!< Color of the node */ int min; /*!< Minimum pixel value */ int max; /*!< Maximum pixel value */ Node* ne{nullptr}; /*!< Pointer to node to the northeast */ Node* nw{nullptr}; /*!< Pointer to node to the northwest */ Node* se{nullptr}; /*!< Pointer to node to the southeast */ Node* sw{nullptr}; /*!< Pointer to node ot the southwest */ bool leaf = false; /*!< Whether this node is a leaf or not */ int xstart; /*!< Starting x coordinate */ int ystart; /*!< Starting y coordinate */ int xend; /*!< Ending x coordinate */ int yend; /*!< Ending y coordinate */ /// Constructor Node(int d, int x1, int y1, int x2, int y2): data(d), xstart(x1), ystart(y1), xend(x2), yend(y2) {} }; /*! * @brief The class for the quadTree */ class QuadTree { Image *originalImage; /*!< Pointer to the original image */ Image *grayImage; /*!< Pointer to the grayscale image */ Image *compressedImage; /*!< Pointer to the compressed image */ Node *root{nullptr}; /*!< Pointer to the quad tree */ int qCF; /*!< Compression factor */ int leafCount; /*!< Number of leaves in the quad tree */ public: bool lines = false; /*!< Whether or not to show lines */ bool color = false; /*!< Whether to show color or grayscale */ bool negate = false;/*!< Whether or not to negate the image */ QuadTree(); QuadTree(Image *img); /*!< Constructor when passed an image */ ~QuadTree(); /*!< Destructor */ void setOriginalImage(Image *); /*!< Sets the original image */ Image* getOriginalImage(); /*!< Returns the original image */ Image* getCompressedImage(); /*!< Returns the compressed image */ void setCompressionFactor(int); /*!< Sets the compression factor */ int getCompressionFactor(); /*!< Returns the compression factor */ int getTotalLeaves();/*!<Returns the number of leaves in the quad tree*/ private: void makeTree(Image *origin, int CF); void recurse(Node *parent, byte *pixels, int x1, int y1, int x2, int y2, int CF); int getAverage(int a, int b, int c, int d); int getCF(int min, int max); int getMax(int a, int b, int c, int d); int getMin(int a, int b, int c, int d); void buildArray(Node* curr); void clearTree(Node* curr); }; #endif
[ "jeffrey.ross@mines.sdsmt.edu" ]
jeffrey.ross@mines.sdsmt.edu
7f0649721e9cc21c70768afed71d9930458fc21d
7e3845226a5186494321bc8147acf19c5af5b577
/src/common_util/src/some_common_util.cpp
c358c1184bf771d25e801694b2173e9062f05087
[]
no_license
Confucius-Mencius/demo_proj
2ef27359933b4af71b138152bd8a6a3131e3b20d
e5ef85b81b68f96d7db52ba4a63055eca9ff05c6
refs/heads/master
2020-04-17T02:32:45.266096
2019-06-08T08:53:03
2019-06-08T08:53:03
159,490,035
0
0
null
null
null
null
UTF-8
C++
false
false
206
cpp
#include "some_common_util.h" #include "log_util.h" SomeCommonUtil::SomeCommonUtil() { } SomeCommonUtil::~SomeCommonUtil() { } int SomeCommonUtil::Func() { LOG_TRACE("hello, world"); return 0; }
[ "guang11cheng@qq.com" ]
guang11cheng@qq.com
9b76573886c0126259266323c1bd5e3afccd398d
7f3e95e825b894a8d015b5905592757a0040220f
/2000/IESDK/INCLUDE/IEF.H
4d36496e5cea71838119c53fc6f55a2919d088c4
[ "MIT" ]
permissive
AliClouds/ObjectARXCore
b06e2d4bb59df2b45e56ec76d3abb843c7131009
ce09e150aa7d87675ca15c9416497c0487e3d4d4
refs/heads/master
2021-05-28T05:19:12.593781
2014-05-08T01:23:33
2014-05-08T01:23:33
null
0
0
null
null
null
null
UTF-8
C++
false
false
19,857
h
// // Copyright (C) 1993-1998 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // // ief.h - IE/API filter class definitions #ifndef _ief_h #define _ief_h //static const char sccsid[] = "@(#)ief.h 2.3 (95/06/02 14:31:35)"; /*** IeBuffer ***/ class IeBuffer; class IeBuffer { public: virtual ~IeBuffer() {} virtual Int numBytes() const = 0; virtual const void *dataPtr() const = 0; //read access for input data virtual IeBuffer& operator=(const IeBuffer& rhs) = 0; // these must be used only by the filter that owns the buffer virtual void *dataPtr() = 0; virtual void setDataPtr(void *dataPtr) = 0; }; IEDLLEXPORT IeBuffer * newIeBuffer(Int numBytes, void *pData=NULL); /*** Ief ***/ class IEDLLEXPORT Ief // because IeFilter is derived from this class { // a warning is produced in an app using the dll public: virtual ~Ief(); virtual const IeSize& size() const = 0; virtual const IePixTyp& pixTyp() const = 0; virtual const CsSpace& colorSpace() const = 0; virtual void setColorSpace(const CsSpace& colorSpace) = 0; virtual Int bytesPerRow() const = 0; virtual const void *getNextRow() = 0; virtual void restore() = 0; virtual Int rowsRemaining() const = 0; virtual AiBoolean isValid() const { return TRUE; } enum Quality { lowQuality=1, normalQuality, highQuality }; enum AlphaOp { alphaAoverB, alphaAinB, alphaAoutB, alphaAatopB, alphaAxorB, alphaAinCoverB, alphaAplusB, alphaDarken=16, alphaDissolve, alphaOpaque }; enum Gradient { lineGradient, ellipseGradient, rectGradient }; enum GradientType { rgbGradient, clockwiseHsvGradient, hsvGradient }; enum BitOp { bitB, bitNotB, bitA, bitNotA, bitAorB, bitAorNotB, bitNotAorB, bitAnandB, bitAandB, bitAandNotB, bitNotAandB, bitAnorB, bitAxorB, bitAequivB }; enum Filter { boxFilter, triangleFilter, cubicFilter, gaussianFilter }; enum Softedge { insideSoftedge, outsideSoftedge, inOutSoftedge }; //private: virtual class IeReadContext *castToReadContext() = 0; }; IEDLLEXPORT void ieExecute(Ief* input); //execute pipeline and discard output /*** IeFilter ***/ class IEDLLEXPORT IeFilter : public Ief { public: const IeSize& size() const; const IePixTyp& pixTyp() const; const CsSpace& colorSpace() const; void setColorSpace(const CsSpace& colorSpace); Int bytesPerRow() const; const void *getNextRow(); void restore(); Int rowsRemaining() const; #if defined(CS_APP) && defined(CS_WIN16) void *operator new(size_t s) { return csNew(s); } void operator delete(void *p) { csDelete(p); } #endif protected: IeFilter(Int numInputs); ~IeFilter(); void init(const IeSize& size, const IePixTyp& pixTyp, const CsSpace& colorSpace); virtual const IeBuffer *processRow() = 0; //must be defined by filter virtual void processRestore() {}; //may be defined by filter //ACCESS TO INPUT DATA Int numInputs() const; Ief *input(Int inputIndex) const; void connectInput(Int inputIndex, Ief *input, const IePixTyp& pixTyp, const CsSpace& colorSpace); Int inputRowsRemaining(Int inputIndex) const; const IeBuffer *getNextInputRow(Int inputIndex); private: friend class IieFilter; friend class IePlaneFilter; class IieFilter *mpImp; class IeReadContext *mpRc; public: //consider private class IeReadContext *castToReadContext(); }; ///////////////////////////////////////////// // Floating point utility functions for use // with IeAnyAffine, etc. ///////////////////////////////////////////// /*** IeSizeReal ***/ class IeSizeReal { public: IeSizeReal() {} //uninitialized IeSizeReal(Real x, Real y) { mX = x; mY = y; } IeSizeReal(const IeSize &intSize) { mX = intSize.x(); mY = intSize.y(); } Real x() const { return mX; } Real y() const { return mY; } Real& x() { return mX; } Real& y() { return mY; } void setX(Real x) { mX = x; } void setY(Real y) { mY = y; } IeSizeReal& operator+=(const IeSizeReal& rhs) { mX += rhs.mX; mY += rhs.mY; return *this; } IeSizeReal& operator-=(const IeSizeReal& rhs) { mX -= rhs.mX; mY -= rhs.mY; return *this; } IeSizeReal& operator*=(const IeSizeReal& rhs) { mX *= rhs.mX; mY *= rhs.mY; return *this; } IeSizeReal& operator/=(const IeSizeReal& rhs) { mX /= rhs.mX; mY /= rhs.mY; return *this; } IeSizeReal operator+(const IeSizeReal& rhs) const { return IeSizeReal(mX + rhs.mX, mY + rhs.mY); } IeSizeReal operator-(const IeSizeReal& rhs) const { return IeSizeReal(mX - rhs.mX, mY - rhs.mY); } IeSizeReal operator*(const IeSizeReal& rhs) const { return IeSizeReal(mX * rhs.mX, mY * rhs.mY); } IeSizeReal operator/(const IeSizeReal& rhs) const { return IeSizeReal(mX / rhs.mX, mY / rhs.mY); } AiBoolean operator==(const IeSizeReal& r) const { return mX == r.mX && mY == r.mY; } AiBoolean operator!=(const IeSizeReal& r) const { return mX != r.mX || mY != r.mY; } AiBoolean operator<(const IeSizeReal& r) const { return mX < r.mX && mY < r.mY; } AiBoolean operator<=(const IeSizeReal& r) const { return mX <= r.mX && mY <= r.mY; } AiBoolean operator>(const IeSizeReal& r) const { return mX > r.mX || mY > r.mY; } AiBoolean operator>=(const IeSizeReal& r) const { return mX >= r.mX || mY >= r.mY; } IeSizeReal& operator+=(const Real r) { mX += r; mY += r; return *this; } IeSizeReal& operator-=(const Real r) { mX -= r; mY -= r; return *this; } IeSizeReal& operator*=(const Real r) { mX *= r; mY *= r; return *this; } IeSizeReal& operator/=(const Real r) { mX /= r; mY /= r; return *this; } IeSizeReal operator+(const Real r) const { return IeSizeReal(mX + r, mY + r); } IeSizeReal operator-(const Real r) const { return IeSizeReal(mX - r, mY - r); } IeSizeReal operator*(const Real r) const { return IeSizeReal(mX * r, mY * r); } IeSizeReal operator/(const Real r) const { return IeSizeReal(mX / r, mY / r); } AiBoolean operator==(const Real r) const { return mX == r && mY == r; } AiBoolean operator!=(const Real r) const { return mX != r || mY != r; } AiBoolean operator<(const Real r) const { return mX < r && mY < r; } AiBoolean operator<=(const Real r) const { return mX <= r && mY <= r; } AiBoolean operator>(const Real r) const { return mX > r || mY > r; } AiBoolean operator>=(const Real r) const { return mX >= r || mY >= r; } operator IeSize() const; // Properly rounds to nearest integer point. private: Real mX, mY; }; typedef IeSizeReal IeOffsetReal; class IEDLLEXPORT Ie2DTransform { public: Ie2DTransform() {} // Initialize to "Xout = scale * Xin + offset.x" etc. Ie2DTransform(Real scale, const IeOffsetReal& offset = ieOffsetOrigin); // "rotation" in radians. "center" is fixed point of scale/rotation. Ie2DTransform(Real scale, Real rotRadians, const IeOffsetReal& center = ieOffsetOrigin); Real operator () (const UInt row, const UInt col) const; Real& operator () (const UInt row, const UInt col); void debugPrint() const; Ie2DTransform inverse() const; AiBoolean isSingular() const; AiBoolean isNonOrthoRotation() const; // True iff ((rotation mod 90 deg) != 0) private: Real mat[3][3]; }; inline Real Ie2DTransform::operator () (const UInt row, const UInt col) const { return mat[row][col]; } inline Real& Ie2DTransform::operator () (const UInt row, const UInt col) { return (Real&)(mat[row][col]); } IEDLLEXPORT Ie2DTransform operator * (const Ie2DTransform& left, const Ie2DTransform& right); IEDLLEXPORT IeOffsetReal operator * (const Ie2DTransform&, const IeOffsetReal&); class IeChunkEncoder { // A Chunk Rank is made of a row of IeVirtualChunkEncoder. // Every IeVirtualChunkEncoder contains a list of all IeActualChunkEncoder one for every codec. public: // Initialization // if input is 1Bpp, ieSizeChunk must be a multiple of 8 virtual ~IeChunkEncoder() {} virtual AiBoolean isValid() const = 0; // operations virtual IeSize getActualChunkSizeUsed() const = 0; // returns the 32 bit aligned chunk size virtual const void* getNextEncodedChunk(const char*& pszCodecName, unsigned long& ulNumBytes) = 0; virtual unsigned long numChunkCols() const = 0; // Number of cols of chunks to produce virtual unsigned long numChunkRows() const = 0; // Number of rows of chunks to produce virtual unsigned long numChunksTotal() const = 0; // Tolal number of chunks virtual unsigned long numChunksRemaining() const = 0; // Chunks remaining to process virtual unsigned long currentChunkIndex() const = 0; // the current chunk index 0 based virtual unsigned long currentChunkIndexX() const = 0; // the current chunk Width index 0 based virtual unsigned long currentChunkIndexY() const = 0; // the current chunk Height index 0 based }; IEDLLEXPORT IeChunkEncoder* newIeChunkEncoder(Ief* piefInput, const IeSize& ieSizeChunkRequested, const char** ppcszEncorderNameList); // The IeColorAdjustTable is used with IefColorAdjust. This object can be built once and // reused to avoid recomputation of the contrast and brightness functions. // class IEDLLEXPORT IeColorAdjustTable { public: virtual ~IeColorAdjustTable() {}; virtual void makeAdjustedColorSpace(const CsSpace& inCs, CsSpace& outCs) const = 0; virtual CsRgb8 adjustColor(const CsRgb8& inColor) const = 0; virtual Real brightness() const = 0; virtual Real contrast() const = 0; virtual Real fade() const = 0; virtual CsRgb8 fadeToColor() const = 0; virtual const UInt8* tablePtr() const = 0; // Parameters defining the valid brightness, contrast and fade control ranges. // static const Real maxControlValue; // zero is min control value static const Real neutralBrightness; static const Real neutralContrast; static const Real neutralFade; }; // Basic constructor IEDLLEXPORT IeColorAdjustTable * newIeColorAdjustTable(Real brightness, Real contrast = IeColorAdjustTable::neutralContrast, Real fade = IeColorAdjustTable::neutralFade, const CsRgb8& fadeToColor = csBlack); // Combines effects to support WYSIWYG editing with contrast and brightness adjustment. IEDLLEXPORT IeColorAdjustTable * newCombinedIeColorAdjustTable(const IeColorAdjustTable& copyFrom, const IeColorAdjustTable& pasteTo); // Palette map table used with newIefColorToAnyPaletteConvert(). Create it // using newIePaletteMapTable() below. // class IePaletteMapTable { public: virtual ~IePaletteMapTable() {}; virtual AiBoolean isValid() const = 0; virtual const CsSpace& getColorSpace() const = 0; virtual UInt8 getClosePaletteIndex(const CsRgb8 targetColor) const = 0; virtual UInt8 getKeyInx() const = 0; virtual AiBoolean isGrayPalette() const = 0; virtual AiBoolean hasGrayValues() const = 0; virtual UInt8 getCloseGrayIndex(const UInt8 targetGray) const = 0; virtual void printTableToFile(char *pSaveFile) = 0; }; IEDLLEXPORT IePaletteMapTable * newIePaletteMapTable(const CsSpace& outCs, const UInt8 nDontUseInx = 255); /*** BUILT-IN FILTERS ***/ IEDLLEXPORT Ief * newIefABCtoXYZ(Ief *input, Real32 *sampleCube, Int *dim, Real32 *aLut, Real32 *bLut, Real32 *cLut, Ief::Quality quality); IEDLLEXPORT Ief * newIefAdaptiveDiffuse(Ief *input, Int numColors, const CsSpace& palette=csNone); #define newIefAffine newIefAnyAffine // temporary construct IEDLLEXPORT Ief * newIefAlphaComposite(Ief::AlphaOp op, Ief *inputA, Ief *inputB, Ief *inputC = NULL); IEDLLEXPORT Ief * newIefAlphaUnary(Ief::AlphaOp op, Ief *input, UInt val); // !!!!!!!!!!!!! // // The following prototype corresponds to a non-existent function. It is // provided to avoid the common error of invoking newIefAnyAffine with an // Ief * rather than a const IeImg&. Without this "dummy" prototype, the // compiler will construct a temporary const IeImg& from an Ief *, which will // result in a run-time exception. // // The effect of this prototype is to generate an "unresolved external symbol" // error when linking if an Ief * is used rather than a const IeImg&. // // !!!!!!!!!!!!! Ief * newIefAnyAffine(Ief *input, const Ie2DTransform& srcToDest, const IeSize& destSize, Ief::Quality quality, const IePixel& clearVal=iePixelZero); // !!!!!!!!!!!!! // // Note that newIefAnyAffine isn't a true pipeline element. It must be // connected directly to the input image. This allows it to use the pixel // access API to efficiently rotate images. // // !!!!!!!!!!!!! IEDLLEXPORT Ief * newIefAnyAffine(const class IeImg& srcImg, const Ie2DTransform& srcToDest, const IeSize& destSize, Ief::Quality quality, const IePixel& clearVal=iePixelZero); IEDLLEXPORT Ief * newIefBitwise(Ief *inputF, Ief *inputB, Ief::BitOp op); IEDLLEXPORT Ief * newIefClipToPolygon(Ief* pInput, const Real *pClipPolygon, Int numVerticies, const IePixel& clearVal=iePixelZero); IEDLLEXPORT Ief * newIefColorAdjust(Ief *input, const IeColorAdjustTable& table); IEDLLEXPORT Ief * newIefColorToAnyPaletteConvert(Ief *pInput, Ief::Quality quality, const IePaletteMapTable *pUserMapTable, AiBoolean bDoKeyColorTransparency=FALSE, UInt8 grayInputTransparentValue=0); IEDLLEXPORT Ief * newIefConst(const IeSize& size, const IePixTyp& pix, const CsSpace& cs, const IePixel& val); IEDLLEXPORT Ief * newIefConstBlend(Ief *input0, Ief *input1, Real factor); IEDLLEXPORT Ief * newIefControlPointWarp(Ief *input, const Real* pSrcColControl, const Real* pSrcRowControl, const Real* pDestColControl, const Real* pDestRowControl, Int numCols, Int numRows, Ief::Quality quality); IEDLLEXPORT Ief * newIefConvert(Ief *input, const CsSpace& colorSpace, const IePixTyp& pixTyp=IePixTyp::none, const IePixel& grayOutputTransparentVal=iePixelNull); IEDLLEXPORT Ief * newIefDiffuse(Ief *input, const CsSpace& colorCube); IEDLLEXPORT Ief * newIefGradient(const IeSize& fillRegion, const IePixTyp& outPixType, Ief::Gradient gradient, Ief::GradientType type, const IeOffset& pt0, const IeOffset& pt1, const CsSpace& colors, const Real *posTable=NULL, IeGradientFunc *pFunc=NULL); IEDLLEXPORT Ief * newIefLowPass(Ief *input, Ief::Filter filter, UInt kernelSize); IEDLLEXPORT Ief * newIefLut32(Ief *input, const CsRgb8 *pTable, UInt numEntries); IEDLLEXPORT Ief * newIefLut8(Ief *input, const UInt8 *pTable, UInt numEntries); IEDLLEXPORT Ief * newIefMatteBlend(Ief *input0, Ief *input1, Ief *matte); IEDLLEXPORT Ief * newIefOrderedDither(Ief *input, const CsSpace& colorCube, Int maskSize=8, const IeOffset& maskOffset=ieOffsetOrigin, const Int *pDitherMask=NULL); IEDLLEXPORT Ief * newIefPerspective(Ief *input, const Real *pVertices, // 4 corner points Ief::Quality quality, const IePixel& clearVal=iePixelZero); IEDLLEXPORT Ief * newIefScale(Ief *input, Real xScale, Real yScale, Ief::Quality quality); IEDLLEXPORT Ief* newIefScale(Ief* input, const IeSize& outSize); IEDLLEXPORT Ief* newIefScale(Ief* input, Real xScale, Real yScale); /*** OBSOLETE ***/ #define IeQuality Ief::Quality #define IEQ_LOW Ief::lowQuality #define IEQ_NORMAL Ief::normalQuality #define IEQ_HIGH Ief::highQuality enum IeSoftType { IE_SOFT_IN, IE_SOFT_OUT, IE_SOFT_INOUT }; #endif /* _ief_h */
[ "kevinzhwl@gmail.com" ]
kevinzhwl@gmail.com