CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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
 
std::string centralityLabel_
 
std::string centralityMC_
 
edm::InputTag centralityTag_
 
edm::EDGetTokenT< reco::CentralitycentralityToken
 
std::string centralityVariable_
 
HiEvtPlaneFlattenflat [NumEPNames]
 
const int FlatOrder_
 
edm::ESWatcher< HeavyIonRPRcdhirpWatcher
 
edm::ESWatcher< HeavyIonRcdhiWatcher
 
edm::InputTag inputPlanesTag_
 
edm::EDGetTokenT< reco::EvtPlaneCollectioninputPlanesToken
 
double nCentBins_
 
int Noffmax_
 
int Noffmin_
 
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<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 62 of file HiEvtPlaneFlatProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 120 of file HiEvtPlaneFlatProducer.cc.

References centralityBinTag_, centralityBinToken, centralityLabel_, centralityMC_, centralityTag_, centralityToken, centralityVariable_, hi::EPNames, hi::EPOrder, edm::ParameterSet::exists(), flat, FlatOrder_, edm::ParameterSet::getParameter(), mps_fire::i, HiEvtPlaneFlatten::init(), inputPlanesTag_, inputPlanesToken, nCentBins_, hi::NumEPNames, NumFlatBins_, AlCaHLTBitMon_QueryRunRegistry::string, trackTag_, trackToken, vertexTag_, and vertexToken.

121  : centralityVariable_(iConfig.getParameter<std::string>("centralityVariable")),
122  centralityBinTag_(iConfig.getParameter<edm::InputTag>("centralityBinTag")),
123  centralityTag_(iConfig.getParameter<edm::InputTag>("centralityTag")),
124  vertexTag_(iConfig.getParameter<edm::InputTag>("vertexTag")),
125  inputPlanesTag_(iConfig.getParameter<edm::InputTag>("inputPlanesTag")),
126  trackTag_(iConfig.getParameter<edm::InputTag>("trackTag")),
127  FlatOrder_(iConfig.getParameter<int>("FlatOrder")),
128  NumFlatBins_(iConfig.getParameter<int>("NumFlatBins")),
129  caloCentRef_(iConfig.getParameter<double>("caloCentRef")),
130  caloCentRefWidth_(iConfig.getParameter<double>("caloCentRefWidth")),
131  CentBinCompression_(iConfig.getParameter<int>("CentBinCompression")),
132  Noffmin_(iConfig.getParameter<int>("Noffmin")),
133  Noffmax_(iConfig.getParameter<int>("Noffmax")),
134  useOffsetPsi_(iConfig.getParameter<bool>("useOffsetPsi")) {
135  // UseEtHF = kFALSE;
136  nCentBins_ = 200.;
137 
138  if (iConfig.exists("nonDefaultGlauberModel")) {
139  centralityMC_ = iConfig.getParameter<std::string>("nonDefaultGlauberModel");
140  }
142 
143  centralityBinToken = consumes<int>(centralityBinTag_);
144 
145  centralityToken = consumes<reco::Centrality>(centralityTag_);
146 
147  vertexToken = consumes<std::vector<reco::Vertex>>(vertexTag_);
148 
149  trackToken = consumes<reco::TrackCollection>(trackTag_);
150 
151  inputPlanesToken = consumes<reco::EvtPlaneCollection>(inputPlanesTag_);
152 
153  //register your products
154  produces<reco::EvtPlaneCollection>();
155  //now do what ever other initialization is needed
156  for (int i = 0; i < NumEPNames; i++) {
157  flat[i] = new HiEvtPlaneFlatten();
159  }
160 }
void init(int order, int nbins, std::string tag, int vord)
T getParameter(std::string const &) const
const int EPOrder[]
edm::EDGetTokenT< reco::Centrality > centralityToken
bool exists(std::string const &parameterName) const
checks if a parameter exists
HiEvtPlaneFlatten * flat[NumEPNames]
const std::string EPNames[]
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken
edm::EDGetTokenT< reco::TrackCollection > trackToken
edm::EDGetTokenT< int > centralityBinToken
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanesToken
static const int NumEPNames
HiEvtPlaneFlatProducer::~HiEvtPlaneFlatProducer ( )
override

Definition at line 162 of file HiEvtPlaneFlatProducer.cc.

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

162  {
163  // do anything here that needs to be done at desctruction time
164  // (e.g. close files, deallocate resources etc.)
165  for (int i = 0; i < NumEPNames; i++) {
166  delete flat[i];
167  }
168 }
HiEvtPlaneFlatten * flat[NumEPNames]
static const int NumEPNames

Member Function Documentation

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

Definition at line 175 of file HiEvtPlaneFlatProducer.cc.

References reco::EvtPlane::addLevel(), newFWLiteAna::bin, HltBtagPostValidation_cff::c, caloCentRef_, caloCentRefWidth_, CentBinCompression_, centralityBinToken, centralityLabel_, centralityToken, edm::ESWatcher< T >::check(), dqmiodatasetharvest::db, DEFINE_FWK_MODULE, SiStripBadComponentsDQMServiceTemplate_cfg::ep, hi::EPDet, flat, edm::EventSetup::get(), edm::Event::getByToken(), HiEvtPlaneFlatten::getCoffset(), HiEvtPlaneFlatten::getFlatPsi(), HiEvtPlaneFlatten::getOffsetPsi(), HiEvtPlaneFlatten::getSoffset(), CaloTPGTranscoder_cfi::HF, hirpWatcher, hiWatcher, mps_fire::i, inputPlanesToken, LoadEPDB::IsSuccess(), edm::HandleBase::isValid(), visualization-live-secondInstance_cfg::m, CentralityTable::m_table, eostools::move(), nCentBins_, Noffmax_, Noffmin_, reco::Centrality::Ntracks(), hi::NumEPNames, or, edm::Handle< T >::product(), edm::Event::put(), alignCSCRings::s, HiEvtPlaneFlatten::setCaloCentRefBins(), parallelization::uint, useOffsetPsi_, and vertexToken.

175  {
176  using namespace edm;
177  using namespace std;
178  using namespace reco;
179 
180  //
181  //Get Flattening Parameters
182  //
183  if (hiWatcher.check(iSetup)) {
184  //
185  //Get Size of Centrality Table
186  //
188  iSetup.get<HeavyIonRcd>().get(centralityLabel_, centDB_);
189  nCentBins_ = centDB_->m_table.size();
190  for (int i = 0; i < NumEPNames; i++) {
191  flat[i]->setCaloCentRefBins(-1, -1);
192  if (caloCentRef_ > 0) {
193  int minbin = (caloCentRef_ - caloCentRefWidth_ / 2.) * nCentBins_ / 100.;
194  int maxbin = (caloCentRef_ + caloCentRefWidth_ / 2.) * nCentBins_ / 100.;
195  minbin /= CentBinCompression_;
196  maxbin /= CentBinCompression_;
197  if (minbin > 0 && maxbin >= minbin) {
198  if (EPDet[i] == HF || EPDet[i] == Castor)
199  flat[i]->setCaloCentRefBins(minbin, maxbin);
200  }
201  }
202  }
203  }
204 
205  if (hirpWatcher.check(iSetup)) {
206  edm::ESHandle<RPFlatParams> flatparmsDB_;
207  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
208  LoadEPDB db(flatparmsDB_, flat);
209  if (!db.IsSuccess())
210  return;
211  }
212  //
213  //Get Centrality
214  //
215 
216  int bin = 0;
217  edm::Handle<int> cbin_;
218  iEvent.getByToken(centralityBinToken, cbin_);
219  int cbin = *cbin_;
220  bin = cbin / CentBinCompression_;
221 
222  if (Noffmin_ >= 0) {
223  edm::Handle<reco::Centrality> centrality_;
224  iEvent.getByToken(centralityToken, centrality_);
225  int Noff = centrality_->Ntracks();
226  if ((Noff < Noffmin_) or (Noff >= Noffmax_)) {
227  return;
228  }
229  }
230  //
231  //Get Vertex
232  //
233  int vs_sell; // vertex collection size
234  float vzr_sell;
236  iEvent.getByToken(vertexToken, vertex_);
237  const reco::VertexCollection* vertices3 = vertex_.product();
238  vs_sell = vertices3->size();
239  if (vs_sell > 0) {
240  vzr_sell = vertices3->begin()->z();
241  } else
242  vzr_sell = -999.9;
243 
244  //
245  //Get Event Planes
246  //
247 
249  iEvent.getByToken(inputPlanesToken, evtPlanes_);
250 
251  if (!evtPlanes_.isValid()) {
252  // cout << "Error! Can't get hiEvtPlane product!" << endl;
253  return;
254  }
255 
256  auto evtplaneOutput = std::make_unique<EvtPlaneCollection>();
258  for (int i = 0; i < NumEPNames; i++) {
259  ep[i] = nullptr;
260  }
261  int indx = 0;
262  for (EvtPlaneCollection::const_iterator rp = evtPlanes_->begin(); rp != evtPlanes_->end(); rp++) {
263  double psiOffset = rp->angle(0);
264  double s = rp->sumSin(0);
265  double c = rp->sumCos(0);
266  uint m = rp->mult();
267 
268  double soff = s;
269  double coff = c;
270  if (useOffsetPsi_) {
271  soff = flat[indx]->getSoffset(s, vzr_sell, bin);
272  coff = flat[indx]->getCoffset(c, vzr_sell, bin);
273  psiOffset = flat[indx]->getOffsetPsi(soff, coff);
274  }
275  double psiFlat = flat[indx]->getFlatPsi(psiOffset, vzr_sell, bin);
276  ep[indx] =
277  new EvtPlane(indx, 2, psiFlat, soff, coff, rp->sumw(), rp->sumw2(), rp->sumPtOrEt(), rp->sumPtOrEt2(), m);
278  ep[indx]->addLevel(0, rp->angle(0), s, c);
279  ep[indx]->addLevel(3, 0., rp->sumSin(3), rp->sumCos(3));
280  if (useOffsetPsi_)
281  ep[indx]->addLevel(1, psiOffset, soff, coff);
282  ++indx;
283  }
284 
285  for (int i = 0; i < NumEPNames; i++) {
286  if (ep[i] != nullptr)
287  evtplaneOutput->push_back(*ep[i]);
288  }
289  iEvent.put(std::move(evtplaneOutput));
290  for (int i = 0; i < indx; i++)
291  delete ep[i];
292 }
void addLevel(int level, double ang, double sumsin, double sumcos)
Definition: EvtPlane.cc:24
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
std::vector< CBin > m_table
const int EPDet[]
double Ntracks() const
Definition: Centrality.h:46
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< reco::Centrality > centralityToken
edm::ESWatcher< HeavyIonRcd > hiWatcher
double getSoffset(double s, double vtx, int centbin) const
double getOffsetPsi(double s, double c) const
void setCaloCentRefBins(const int caloCentRefMinBin, const int caloCentRefMaxBin)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HiEvtPlaneFlatten * flat[NumEPNames]
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken
double getCoffset(double c, double vtx, int centbin) const
bool isValid() const
Definition: HandleBase.h:70
double getFlatPsi(double psi, double vtx, int centbin) const
T const * product() const
Definition: Handle.h:69
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:52
fixed size matrix
HLT enums.
edm::ESWatcher< HeavyIonRPRcd > hirpWatcher
T get() const
Definition: EventSetup.h:73
edm::EDGetTokenT< int > centralityBinToken
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanesToken
static const int NumEPNames
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

double HiEvtPlaneFlatProducer::caloCentRef_
private

Definition at line 97 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

double HiEvtPlaneFlatProducer::caloCentRefWidth_
private

Definition at line 98 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::CentBinCompression_
private

Definition at line 99 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::centralityBinTag_
private

Definition at line 76 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 77 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityLabel_
private

Definition at line 73 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityMC_
private

Definition at line 74 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

edm::InputTag HiEvtPlaneFlatProducer::centralityTag_
private

Definition at line 79 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 80 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityVariable_
private

Definition at line 72 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

HiEvtPlaneFlatten* HiEvtPlaneFlatProducer::flat[NumEPNames]
private
const int HiEvtPlaneFlatProducer::FlatOrder_
private

Definition at line 95 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 93 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

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

Definition at line 92 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::inputPlanesTag_
private

Definition at line 85 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 86 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

double HiEvtPlaneFlatProducer::nCentBins_
private

Definition at line 104 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

int HiEvtPlaneFlatProducer::Noffmax_
private

Definition at line 101 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::Noffmin_
private

Definition at line 100 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::NumFlatBins_
private

Definition at line 96 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 90 of file HiEvtPlaneFlatProducer.cc.

edm::InputTag HiEvtPlaneFlatProducer::trackTag_
private

Definition at line 88 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 89 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

bool HiEvtPlaneFlatProducer::useOffsetPsi_
private

Definition at line 103 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::vertexTag_
private

Definition at line 82 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 83 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().