diff --git a/analyses/pluginMC/MC_Cent_pPb_Eta.cc b/analyses/pluginMC/MC_Cent_pPb_Eta.cc deleted file mode 100644 --- a/analyses/pluginMC/MC_Cent_pPb_Eta.cc +++ /dev/null @@ -1,78 +0,0 @@ -// -*- C++ -*- -#include "Rivet/Analyses/MC_Cent_pPb.hh" -#include "Rivet/Tools/Percentile.hh" - -namespace Rivet { - - -class MC_Cent_pPb_Eta : public Analysis { - -public: - - DEFAULT_RIVET_ANALYSIS_CTOR(MC_Cent_pPb_Eta); - - /// Book histograms and initialise projections before the run - void init() { - - MSG_INFO("CENT parameter set to " << getOption("cent","REF")); - - // The centrality projection. - declareCentrality(MC_SumETFwdPbCentrality(), - "MC_Cent_pPb_Calib", "SumETPb", "CENT"); - - // The trigger projection. - declare(MC_pPbMinBiasTrigger(), "Trigger"); - - // The particles to be analysed. - declare(ChargedFinalState(Cuts::eta > -2.7 && Cuts::eta < 2.7 && - Cuts::pT > 0.1*GeV), "CFS"); - - // The centrality bins and the corresponding histograms. - std::vector< std::pair > centralityBins = - { {0, 1}, {1, 5}, {5, 10}, {10, 20}, - {20, 30}, {30, 40}, {40, 60}, {60, 90} }; - // std::vector< std::tuple > refData = - // { {2, 1, 8}, {2, 1, 7}, {2, 1, 6}, {2, 1, 5}, - // {2, 1, 4}, {2, 1, 3}, {2, 1, 2}, {2, 1, 1} }; - std::vector< std::tuple > refData; - for ( int i = 8; i > 0; --i ) - refData.push_back(std::tuple(2, 1, i)); - - // The centrality-binned histograms. - _hEta = bookPercentile("CENT", centralityBins, refData); - - } - - /// Perform the per-event analysis - void analyze(const Event& event) { - const double weight = event.weight(); - - if ( !apply(event, "Trigger")() ) vetoEvent; - - _hEta->init(event); - for ( const auto &p : apply(event,"CFS").particles() ) - _hEta->fill(p.eta(), weight); - - } - - /// Finalize - void finalize() { - - // Scale by the inverse sum of event weights in each centrality - // bin. - _hEta->normalizePerEvent(); - - } - -private: - - /// The histograms binned in centrality. - Percentile _hEta; - -}; - - -// The hook for the plugin system -DECLARE_RIVET_PLUGIN(MC_Cent_pPb_Eta); - -} diff --git a/analyses/pluginMC/MC_Cent_pPb_Eta.cc.needspercentile b/analyses/pluginMC/MC_Cent_pPb_Eta.cc.needspercentile new file mode 100644 --- /dev/null +++ b/analyses/pluginMC/MC_Cent_pPb_Eta.cc.needspercentile @@ -0,0 +1,78 @@ +// -*- C++ -*- +#include "Rivet/Analyses/MC_Cent_pPb.hh" +#include "Rivet/Tools/Percentile.hh" + +namespace Rivet { + + +class MC_Cent_pPb_Eta : public Analysis { + +public: + + DEFAULT_RIVET_ANALYSIS_CTOR(MC_Cent_pPb_Eta); + + /// Book histograms and initialise projections before the run + void init() { + + MSG_INFO("CENT parameter set to " << getOption("cent","REF")); + + // The centrality projection. + declareCentrality(MC_SumETFwdPbCentrality(), + "MC_Cent_pPb_Calib", "SumETPb", "CENT"); + + // The trigger projection. + declare(MC_pPbMinBiasTrigger(), "Trigger"); + + // The particles to be analysed. + declare(ChargedFinalState(Cuts::eta > -2.7 && Cuts::eta < 2.7 && + Cuts::pT > 0.1*GeV), "CFS"); + + // The centrality bins and the corresponding histograms. + std::vector< std::pair > centralityBins = + { {0, 1}, {1, 5}, {5, 10}, {10, 20}, + {20, 30}, {30, 40}, {40, 60}, {60, 90} }; + // std::vector< std::tuple > refData = + // { {2, 1, 8}, {2, 1, 7}, {2, 1, 6}, {2, 1, 5}, + // {2, 1, 4}, {2, 1, 3}, {2, 1, 2}, {2, 1, 1} }; + std::vector< std::tuple > refData; + for ( int i = 8; i > 0; --i ) + refData.push_back(std::tuple(2, 1, i)); + + // The centrality-binned histograms. + _hEta = bookPercentile("CENT", centralityBins, refData); + + } + + /// Perform the per-event analysis + void analyze(const Event& event) { + const double weight = event.weight(); + + if ( !apply(event, "Trigger")() ) vetoEvent; + + _hEta->init(event); + for ( const auto &p : apply(event,"CFS").particles() ) + _hEta->fill(p.eta(), weight); + + } + + /// Finalize + void finalize() { + + // Scale by the inverse sum of event weights in each centrality + // bin. + _hEta->normalizePerEvent(); + + } + +private: + + /// The histograms binned in centrality. + Percentile _hEta; + +}; + + +// The hook for the plugin system +DECLARE_RIVET_PLUGIN(MC_Cent_pPb_Eta); + +} diff --git a/analyses/pluginMC/TEST.cc b/analyses/pluginMC/TEST.cc deleted file mode 100644 --- a/analyses/pluginMC/TEST.cc +++ /dev/null @@ -1,83 +0,0 @@ -// -*- C++ -*- -#include "Rivet/Analysis.hh" -#include "Rivet/Projections/ChargedFinalState.hh" -#include "Rivet/Projections/PrimaryParticles.hh" -#include "Rivet/Tools/Correlators.hh" - - -namespace Rivet { - - - class TEST : public CumulantAnalysis { - public: - - /// @name Constructors etc. - //@{ - - /// Constructor - TEST() : CumulantAnalysis("TEST") { - } - //@} - - public: - - /// @name Analysis methods - //@{ - /// Book histograms and initialise projections before the run - void init() { - - ChargedFinalState cfs(-1.0, 1.0); - declare(cfs, "CFS"); - ChargedFinalState pp(Cuts::abseta < 2.0); - declare(pp, "PP"); - h_c22 = bookScatter2D("c22",120,0,120); - h_c23 = bookScatter2D("c23",120,0,120); - h_v22pT = bookScatter2D("v22pT",10,0,10); - ec22 = bookECorrelator<2,2>("ec22",h_c22); - ec23 = bookECorrelator<3,2>("ec32",h_c22); - ec22pT = bookECorrelator<2,2>("ec22pT",h_v22pT); - pair max = getMaxValues(); - // Declare correlator projections. - declare(Correlators(pp, max.first, max.second, h_v22pT),"CRS"); - } - /// Perform the per-event analysis - void analyze(const Event& event) { - const Correlators& c = apply(event,"CRS"); - ec22->fill(apply(event,"CFS").particles().size(), - c, event.weight()); - ec23->fill(apply(event,"CFS").particles().size(), - c, event.weight()); - ec22pT->fill(c, event.weight()); - } - /// Normalise histograms etc., after the run - void finalize() { - stream(); - cnTwoInt(h_c22,ec22); - cnTwoInt(h_c23,ec23); - vnTwoDiff(h_v22pT,ec22pT); - - } - - - //@} - private: - - - /// @name Histograms - //@{ - Scatter2DPtr h_c22; - Scatter2DPtr h_v22pT; - ECorrPtr ec22; - ECorrPtr ec22pT; - Scatter2DPtr h_c23; - ECorrPtr ec23; - //@} - - }; - - - - // The hook for the plugin system - DECLARE_RIVET_PLUGIN(TEST); - -} diff --git a/analyses/pluginMC/TEST.cc.needspercentile b/analyses/pluginMC/TEST.cc.needspercentile new file mode 100644 --- /dev/null +++ b/analyses/pluginMC/TEST.cc.needspercentile @@ -0,0 +1,83 @@ +// -*- C++ -*- +#include "Rivet/Analysis.hh" +#include "Rivet/Projections/ChargedFinalState.hh" +#include "Rivet/Projections/PrimaryParticles.hh" +#include "Rivet/Tools/Correlators.hh" + + +namespace Rivet { + + + class TEST : public CumulantAnalysis { + public: + + /// @name Constructors etc. + //@{ + + /// Constructor + TEST() : CumulantAnalysis("TEST") { + } + //@} + + public: + + /// @name Analysis methods + //@{ + /// Book histograms and initialise projections before the run + void init() { + + ChargedFinalState cfs(Cuts::abseta < 1.0); + declare(cfs, "CFS"); + ChargedFinalState pp(Cuts::abseta < 2.0); + declare(pp, "PP"); + book(h_c22, "c22",120,0,120); + book(h_c23, "c23",120,0,120); + book(h_v22pT, "v22pT",10,0,10); + ec22 = bookECorrelator<2,2>("ec22",h_c22); + ec23 = bookECorrelator<3,2>("ec32",h_c22); + ec22pT = bookECorrelator<2,2>("ec22pT",h_v22pT); + pair max = getMaxValues(); + // Declare correlator projections. + declare(Correlators(pp, max.first, max.second, h_v22pT),"CRS"); + } + /// Perform the per-event analysis + void analyze(const Event& event) { + const Correlators& c = apply(event,"CRS"); + ec22->fill(apply(event,"CFS").particles().size(), + c, event.weight()); + ec23->fill(apply(event,"CFS").particles().size(), + c, event.weight()); + ec22pT->fill(c, event.weight()); + } + /// Normalise histograms etc., after the run + void finalize() { + stream(); + cnTwoInt(h_c22,ec22); + cnTwoInt(h_c23,ec23); + vnTwoDiff(h_v22pT,ec22pT); + + } + + + //@} + private: + + + /// @name Histograms + //@{ + Scatter2DPtr h_c22; + Scatter2DPtr h_v22pT; + ECorrPtr ec22; + ECorrPtr ec22pT; + Scatter2DPtr h_c23; + ECorrPtr ec23; + //@} + + }; + + + + // The hook for the plugin system + DECLARE_RIVET_PLUGIN(TEST); + +}