CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HiEvtPlaneFlatProducer Class Reference
Inheritance diagram for HiEvtPlaneFlatProducer:
edm::stream::EDProducer<>

Public Member Functions

 HiEvtPlaneFlatProducer (const edm::ParameterSet &)
 
 ~HiEvtPlaneFlatProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

double caloCentRef_
 
double caloCentRefWidth_
 
int CentBinCompression_
 
edm::InputTag centralityBinTag_
 
edm::EDGetTokenT< int > centralityBinToken_
 
edm::ESGetToken< CentralityTable, HeavyIonRcdcentralityESToken_
 
std::string centralityMC_
 
edm::InputTag centralityTag_
 
edm::EDGetTokenT< reco::CentralitycentralityToken_
 
std::string centralityVariable_
 
HiEvtPlaneFlattenflat [NumEPNames]
 
double flatdelvtx_
 
double flatminvtx_
 
int flatnvtxbins_
 
const int FlatOrder_
 
edm::ESGetToken< RPFlatParams, HeavyIonRPRcdflatparmsToken_
 
edm::ESWatcher< HeavyIonRPRcdhirpWatcher
 
edm::ESWatcher< HeavyIonRcdhiWatcher
 
edm::InputTag inputPlanesTag_
 
edm::EDGetTokenT< reco::EvtPlaneCollectioninputPlanesToken_
 
double nCentBins_
 
int NumFlatBins_
 
edm::Handle< reco::TrackCollectiontrackCollection_
 
edm::InputTag trackTag_
 
edm::EDGetTokenT< reco::TrackCollectiontrackToken_
 
bool useOffsetPsi_
 
edm::InputTag vertexTag_
 
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 48 of file HiEvtPlaneFlatProducer.cc.

Constructor & Destructor Documentation

◆ HiEvtPlaneFlatProducer()

HiEvtPlaneFlatProducer::HiEvtPlaneFlatProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 97 of file HiEvtPlaneFlatProducer.cc.

References centralityBinTag_, centralityBinToken_, centralityESToken_, centralityMC_, centralityTag_, centralityToken_, centralityVariable_, hi::EPNames, hi::EPOrder, deDxTools::esConsumes(), edm::ParameterSet::exists(), flat, flatdelvtx_, flatminvtx_, flatnvtxbins_, FlatOrder_, flatparmsToken_, edm::ParameterSet::getParameter(), mps_fire::i, HiEvtPlaneFlatten::init(), inputPlanesTag_, inputPlanesToken_, nCentBins_, hi::NumEPNames, NumFlatBins_, AlCaHLTBitMon_QueryRunRegistry::string, trackTag_, trackToken_, vertexTag_, and vertexToken_.

98  : centralityVariable_(iConfig.getParameter<std::string>("centralityVariable")),
99  centralityBinTag_(iConfig.getParameter<edm::InputTag>("centralityBinTag")),
100  centralityTag_(iConfig.getParameter<edm::InputTag>("centralityTag")),
101  vertexTag_(iConfig.getParameter<edm::InputTag>("vertexTag")),
102  inputPlanesTag_(iConfig.getParameter<edm::InputTag>("inputPlanesTag")),
103  trackTag_(iConfig.getParameter<edm::InputTag>("trackTag")),
104  FlatOrder_(iConfig.getParameter<int>("FlatOrder")),
105  NumFlatBins_(iConfig.getParameter<int>("NumFlatBins")),
106  flatnvtxbins_(iConfig.getParameter<int>("flatnvtxbins")),
107  flatminvtx_(iConfig.getParameter<double>("flatminvtx")),
108  flatdelvtx_(iConfig.getParameter<double>("flatdelvtx")),
109  caloCentRef_(iConfig.getParameter<double>("caloCentRef")),
110  caloCentRefWidth_(iConfig.getParameter<double>("caloCentRefWidth")),
111  CentBinCompression_(iConfig.getParameter<int>("CentBinCompression")),
112  useOffsetPsi_(iConfig.getParameter<bool>("useOffsetPsi")) {
113  nCentBins_ = 200.;
114 
115  if (iConfig.exists("nonDefaultGlauberModel")) {
116  centralityMC_ = iConfig.getParameter<std::string>("nonDefaultGlauberModel");
117  }
120 
121  centralityBinToken_ = consumes<int>(centralityBinTag_);
122 
123  centralityToken_ = consumes<reco::Centrality>(centralityTag_);
124 
125  vertexToken_ = consumes<std::vector<reco::Vertex>>(vertexTag_);
126 
127  trackToken_ = consumes<reco::TrackCollection>(trackTag_);
128 
129  inputPlanesToken_ = consumes<reco::EvtPlaneCollection>(inputPlanesTag_);
130 
131  //register your products
132  produces<reco::EvtPlaneCollection>();
133  //now do what ever other initialization is needed
134  for (int i = 0; i < NumEPNames; i++) {
135  flat[i] = new HiEvtPlaneFlatten();
137  }
138 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< int > centralityBinToken_
edm::ESGetToken< RPFlatParams, HeavyIonRPRcd > flatparmsToken_
edm::EDGetTokenT< reco::Centrality > centralityToken_
edm::EDGetTokenT< reco::TrackCollection > trackToken_
bool exists(std::string const &parameterName) const
checks if a parameter exists
edm::ESGetToken< CentralityTable, HeavyIonRcd > centralityESToken_
HiEvtPlaneFlatten * flat[NumEPNames]
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken_
void init(int order, int nbins, int nvtxbins=10, double minvtx=-25, double delvtx=5, std::string tag="", int vord=2)
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanesToken_
const std::array< int, NumEPNames > EPOrder
const std::array< std::string, NumEPNames > EPNames
static const int NumEPNames

◆ ~HiEvtPlaneFlatProducer()

HiEvtPlaneFlatProducer::~HiEvtPlaneFlatProducer ( )
override

Definition at line 140 of file HiEvtPlaneFlatProducer.cc.

References flat, mps_fire::i, and hi::NumEPNames.

140  {
141  // do anything here that needs to be done at desctruction time
142  // (e.g. close files, deallocate resources etc.)
143  for (int i = 0; i < NumEPNames; i++) {
144  delete flat[i];
145  }
146 }
HiEvtPlaneFlatten * flat[NumEPNames]
static const int NumEPNames

Member Function Documentation

◆ produce()

void HiEvtPlaneFlatProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 153 of file HiEvtPlaneFlatProducer.cc.

References newFWLiteAna::bin, HltBtagPostValidation_cff::c, caloCentRef_, caloCentRefWidth_, CentBinCompression_, centralityBinToken_, centralityESToken_, edm::ESWatcher< T >::check(), HiEvtPlaneFlatten::coffset(), dqmiodatasetharvest::db, SiStripBadComponentsDQMServiceTemplate_cfg::ep, hi::EPDet, flat, flatparmsToken_, edm::EventSetup::getData(), HiEvtPlaneFlatten::getFlatPsi(), tpScales_cff::HF, hirpWatcher, hiWatcher, mps_fire::i, iEvent, inputPlanesToken_, visualization-live-secondInstance_cfg::m, eostools::move(), nCentBins_, hi::NumEPNames, HiEvtPlaneFlatten::offsetPsi(), alignCSCRings::s, HiEvtPlaneFlatten::setCaloCentRefBins(), HiEvtPlaneFlatten::soffset(), parallelization::uint, useOffsetPsi_, vertexToken_, and L1BJetProducer_cff::vtx.

153  {
154  using namespace edm;
155  using namespace std;
156  using namespace reco;
157 
158  if (hiWatcher.check(iSetup)) {
159  //
160  //Get Size of Centrality Table
161  //
162  auto const& centDB = iSetup.getData(centralityESToken_);
163  nCentBins_ = centDB.m_table.size();
164  for (int i = 0; i < NumEPNames; i++) {
165  if (caloCentRef_ > 0) {
166  int minbin = (caloCentRef_ - caloCentRefWidth_ / 2.) * nCentBins_ / 100.;
167  int maxbin = (caloCentRef_ + caloCentRefWidth_ / 2.) * nCentBins_ / 100.;
168  minbin /= CentBinCompression_;
169  maxbin /= CentBinCompression_;
170  if (minbin > 0 && maxbin >= minbin) {
171  if (EPDet[i] == HF || EPDet[i] == Castor)
172  flat[i]->setCaloCentRefBins(minbin, maxbin);
173  }
174  }
175  }
176  }
177  //
178  //Get flattening parameter file.
179  //
180  if (hirpWatcher.check(iSetup)) {
182  } //rp record change
183 
184  //
185  //Get Centrality
186  //
187  int bin = 0;
188  int cbin = 0;
189  cbin = iEvent.get(centralityBinToken_);
190  bin = cbin / CentBinCompression_;
191  //
192  //Get Vertex
193  //
194 
195  //best vertex
196  double bestvz = -999.9;
197  const reco::Vertex& vtx = iEvent.get(vertexToken_)[0];
198  bestvz = vtx.z();
199 
200  //
201  //Get Event Planes
202  //
203 
204  auto const& evtPlanes = iEvent.get(inputPlanesToken_);
205 
206  auto evtplaneOutput = std::make_unique<EvtPlaneCollection>();
208  for (int i = 0; i < NumEPNames; i++) {
209  ep[i] = nullptr;
210  }
211  int indx = 0;
212  for (auto&& rp : (evtPlanes)) {
213  double s = rp.sumSin(0);
214  double c = rp.sumCos(0);
215  uint m = rp.mult();
216  double soff = s;
217  double coff = c;
218  double psiOffset = -10;
219  double psiFlat = -10;
220  if (rp.angle(0) > -5) {
221  if (useOffsetPsi_) {
222  soff = flat[indx]->soffset(s, bestvz, bin);
223  coff = flat[indx]->coffset(c, bestvz, bin);
224  psiOffset = flat[indx]->offsetPsi(soff, coff);
225  }
226  psiFlat = flat[indx]->getFlatPsi(psiOffset, bestvz, bin);
227  }
228  ep[indx] = new EvtPlane(indx, 2, psiFlat, soff, coff, rp.sumw(), rp.sumw2(), rp.sumPtOrEt(), rp.sumPtOrEt2(), m);
229  ep[indx]->addLevel(0, rp.angle(0), s, c);
230  ep[indx]->addLevel(3, 0., rp.sumSin(3), rp.sumCos(3));
231  if (useOffsetPsi_)
232  ep[indx]->addLevel(1, psiOffset, soff, coff);
233  ++indx;
234  }
235 
236  for (int i = 0; i < NumEPNames; i++) {
237  if (ep[i] != nullptr)
238  evtplaneOutput->push_back(*ep[i]);
239  }
240  iEvent.put(std::move(evtplaneOutput));
241  for (int i = 0; i < indx; i++)
242  delete ep[i];
243 }
double offsetPsi(double s, double c) const
edm::EDGetTokenT< int > centralityBinToken_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
edm::ESGetToken< RPFlatParams, HeavyIonRPRcd > flatparmsToken_
edm::ESWatcher< HeavyIonRcd > hiWatcher
edm::ESGetToken< CentralityTable, HeavyIonRcd > centralityESToken_
void setCaloCentRefBins(const int caloCentRefMinBin, const int caloCentRefMaxBin)
HiEvtPlaneFlatten * flat[NumEPNames]
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken_
double getFlatPsi(double psi, double vtx, int centbin) const
const std::array< int, NumEPNames > EPDet
double coffset(double c, double vtx, int centbin) const
double soffset(double s, double vtx, int centbin) const
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanesToken_
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
fixed size matrix
HLT enums.
edm::ESWatcher< HeavyIonRPRcd > hirpWatcher
static const int NumEPNames
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ caloCentRef_

double HiEvtPlaneFlatProducer::caloCentRef_
private

Definition at line 87 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ caloCentRefWidth_

double HiEvtPlaneFlatProducer::caloCentRefWidth_
private

Definition at line 88 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ CentBinCompression_

int HiEvtPlaneFlatProducer::CentBinCompression_
private

Definition at line 89 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ centralityBinTag_

edm::InputTag HiEvtPlaneFlatProducer::centralityBinTag_
private

Definition at line 61 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ centralityBinToken_

edm::EDGetTokenT<int> HiEvtPlaneFlatProducer::centralityBinToken_
private

Definition at line 62 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

◆ centralityESToken_

edm::ESGetToken<CentralityTable, HeavyIonRcd> HiEvtPlaneFlatProducer::centralityESToken_
private

Definition at line 79 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

◆ centralityMC_

std::string HiEvtPlaneFlatProducer::centralityMC_
private

Definition at line 59 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ centralityTag_

edm::InputTag HiEvtPlaneFlatProducer::centralityTag_
private

Definition at line 64 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ centralityToken_

edm::EDGetTokenT<reco::Centrality> HiEvtPlaneFlatProducer::centralityToken_
private

Definition at line 65 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ centralityVariable_

std::string HiEvtPlaneFlatProducer::centralityVariable_
private

Definition at line 58 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ flat

HiEvtPlaneFlatten* HiEvtPlaneFlatProducer::flat[NumEPNames]
private

◆ flatdelvtx_

double HiEvtPlaneFlatProducer::flatdelvtx_
private

Definition at line 86 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ flatminvtx_

double HiEvtPlaneFlatProducer::flatminvtx_
private

Definition at line 85 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ flatnvtxbins_

int HiEvtPlaneFlatProducer::flatnvtxbins_
private

Definition at line 84 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ FlatOrder_

const int HiEvtPlaneFlatProducer::FlatOrder_
private

Definition at line 82 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ flatparmsToken_

edm::ESGetToken<RPFlatParams, HeavyIonRPRcd> HiEvtPlaneFlatProducer::flatparmsToken_
private

Definition at line 80 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

◆ hirpWatcher

edm::ESWatcher<HeavyIonRPRcd> HiEvtPlaneFlatProducer::hirpWatcher
private

Definition at line 78 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ hiWatcher

edm::ESWatcher<HeavyIonRcd> HiEvtPlaneFlatProducer::hiWatcher
private

Definition at line 77 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ inputPlanesTag_

edm::InputTag HiEvtPlaneFlatProducer::inputPlanesTag_
private

Definition at line 70 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ inputPlanesToken_

edm::EDGetTokenT<reco::EvtPlaneCollection> HiEvtPlaneFlatProducer::inputPlanesToken_
private

Definition at line 71 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

◆ nCentBins_

double HiEvtPlaneFlatProducer::nCentBins_
private

Definition at line 92 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

◆ NumFlatBins_

int HiEvtPlaneFlatProducer::NumFlatBins_
private

Definition at line 83 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ trackCollection_

edm::Handle<reco::TrackCollection> HiEvtPlaneFlatProducer::trackCollection_
private

Definition at line 75 of file HiEvtPlaneFlatProducer.cc.

◆ trackTag_

edm::InputTag HiEvtPlaneFlatProducer::trackTag_
private

Definition at line 73 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ trackToken_

edm::EDGetTokenT<reco::TrackCollection> HiEvtPlaneFlatProducer::trackToken_
private

Definition at line 74 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ useOffsetPsi_

bool HiEvtPlaneFlatProducer::useOffsetPsi_
private

Definition at line 91 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

◆ vertexTag_

edm::InputTag HiEvtPlaneFlatProducer::vertexTag_
private

Definition at line 67 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

◆ vertexToken_

edm::EDGetTokenT<std::vector<reco::Vertex> > HiEvtPlaneFlatProducer::vertexToken_
private

Definition at line 68 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().