CMS 3D CMS Logo

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

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

const bool doEvtPlane_
 
const bool doFreePlaneFit_
 
const bool doJettyExclusion_
 
const int evtPlaneLevel_
 
const edm::EDGetTokenT< reco::EvtPlaneCollectionevtPlaneToken_
 
std::unique_ptr< TF1 > flowFit_p_
 
const edm::EDGetTokenT< reco::JetViewjetToken_
 
std::unique_ptr< TF1 > lineFit_p_
 
const edm::EDGetTokenT< reco::PFCandidateCollectionpfCandsToken_
 

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 46 of file HiFJRhoFlowModulationProducer.cc.

Constructor & Destructor Documentation

◆ HiFJRhoFlowModulationProducer()

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

Definition at line 64 of file HiFJRhoFlowModulationProducer.cc.

65  : doEvtPlane_(iConfig.getParameter<bool>("doEvtPlane")),
66  doFreePlaneFit_(iConfig.getParameter<bool>("doFreePlaneFit")),
67  doJettyExclusion_(iConfig.getParameter<bool>("doJettyExclusion")),
68  evtPlaneLevel_(iConfig.getParameter<int>("evtPlaneLevel")),
69  jetToken_(doJettyExclusion_ ? consumes<reco::JetView>(iConfig.getParameter<edm::InputTag>("jetTag"))
71  pfCandsToken_(consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("pfCandSource"))),
72  evtPlaneToken_(consumes<reco::EvtPlaneCollection>(iConfig.getParameter<edm::InputTag>("EvtPlane"))) {
73  produces<std::vector<double>>("rhoFlowFitParams");
74  TMinuitMinimizer::UseStaticMinuit(false);
75  lineFit_p_ = std::unique_ptr<TF1>(new TF1("lineFit", lineFunction, -TMath::Pi(), TMath::Pi()));
76  flowFit_p_ = std::unique_ptr<TF1>(new TF1("flowFit", flowFunction, -TMath::Pi(), TMath::Pi()));
77 }

References flowFit_p_, lineFit_p_, Pi, and tools::TF1.

Member Function Documentation

◆ fillDescriptions()

void HiFJRhoFlowModulationProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 206 of file HiFJRhoFlowModulationProducer.cc.

206  {
208  desc.add<bool>("doEvtPlane", false);
209  desc.add<edm::InputTag>("EvtPlane", edm::InputTag("hiEvtPlane"));
210  desc.add<bool>("doJettyExclusion", false);
211  desc.add<bool>("doFreePlaneFit", false);
212  desc.add<bool>("doFlatTest", false);
213  desc.add<edm::InputTag>("jetTag", edm::InputTag("ak4PFJets"));
214  desc.add<edm::InputTag>("pfCandSource", edm::InputTag("particleFlow"));
215  desc.add<int>("evtPlaneLevel", 0);
216  descriptions.add("hiFJRhoFlowModulationProducer", desc);
217 }

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

◆ produce()

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

Definition at line 80 of file HiFJRhoFlowModulationProducer.cc.

80  {
81  int nPhiBins = 10;
82  auto const& pfCands = iEvent.get(pfCandsToken_);
83  static constexpr int kMaxEvtPlane = 29;
84  std::array<float, kMaxEvtPlane> hiEvtPlane;
85 
86  if (doEvtPlane_) {
87  auto const& evtPlanes = iEvent.get(evtPlaneToken_);
88  assert(evtPlanes.size() == hi::NumEPNames);
89  std::transform(evtPlanes.begin(), evtPlanes.end(), hiEvtPlane.begin(), [this](auto const& ePlane) -> float {
90  return ePlane.angle(evtPlaneLevel_);
91  });
92  }
93 
96  iEvent.getByToken(jetToken_, jets);
97 
98  int nFill = 0;
99 
100  double eventPlane2 = -100;
101  double eventPlane3 = -100;
102 
103  constexpr int nParamVals = 9;
104  auto rhoFlowFitParamsOut = std::make_unique<std::vector<double>>(nParamVals, 1e-6);
105 
106  rhoFlowFitParamsOut->at(0) = 0;
107  rhoFlowFitParamsOut->at(1) = 0;
108  rhoFlowFitParamsOut->at(2) = 0;
109  rhoFlowFitParamsOut->at(3) = 0;
110  rhoFlowFitParamsOut->at(4) = 0;
111 
112  double eventPlane2Cos = 0;
113  double eventPlane2Sin = 0;
114 
115  double eventPlane3Cos = 0;
116  double eventPlane3Sin = 0;
117 
118  std::vector<bool> pfcuts(pfCands.size(), false);
119  int iCand = -1;
120  for (auto const& pfCandidate : pfCands) {
121  iCand++;
122  if (pfCandidate.particleId() != 1 || std::abs(pfCandidate.eta()) > 1.0 || pfCandidate.pt() < .3 ||
123  pfCandidate.pt() > 3.) {
124  continue;
125  }
126 
127  if (doJettyExclusion_) {
128  bool isGood = true;
129  for (auto const& jet : *jets) {
130  if (deltaR2(jet, pfCandidate) < .16) {
131  isGood = false;
132  break;
133  }
134  }
135  if (!isGood) {
136  continue;
137  }
138  }
139 
140  nFill++;
141  pfcuts[iCand] = true;
142 
143  if (!doEvtPlane_) {
144  eventPlane2Cos += std::cos(2 * pfCandidate.phi());
145  eventPlane2Sin += std::sin(2 * pfCandidate.phi());
146 
147  eventPlane3Cos += std::cos(3 * pfCandidate.phi());
148  eventPlane3Sin += std::sin(3 * pfCandidate.phi());
149  }
150  }
151 
152  if (!doEvtPlane_) {
153  eventPlane2 = std::atan2(eventPlane2Sin, eventPlane2Cos) / 2.;
154  eventPlane3 = std::atan2(eventPlane3Sin, eventPlane3Cos) / 3.;
155  } else {
156  eventPlane2 = hiEvtPlane[hi::HF2];
157  eventPlane3 = hiEvtPlane[hi::HF3];
158  }
159  int pfcuts_count = 0;
160  if (nFill >= 100 && eventPlane2 > -99) {
161  nPhiBins = std::max(10, nFill / 30);
162 
163  std::string name = "phiTestIEta4_" + std::to_string(iEvent.id().event()) + "_h";
164  std::string nameFlat = "phiTestIEta4_Flat_" + std::to_string(iEvent.id().event()) + "_h";
165  std::unique_ptr<TH1F> phi_h = std::make_unique<TH1F>(name.data(), "", nPhiBins, -TMath::Pi(), TMath::Pi());
166  phi_h->SetDirectory(nullptr);
167  for (auto const& pfCandidate : pfCands) {
168  if (pfcuts.at(pfcuts_count))
169  phi_h->Fill(pfCandidate.phi());
170  pfcuts_count++;
171  }
172  flowFit_p_->SetParameter(0, 10);
173  flowFit_p_->SetParameter(1, 0);
174  flowFit_p_->SetParameter(2, eventPlane2);
175  flowFit_p_->SetParameter(3, 0);
176  flowFit_p_->SetParameter(4, eventPlane3);
177  if (!doFreePlaneFit_) {
178  flowFit_p_->FixParameter(2, eventPlane2);
179  flowFit_p_->FixParameter(4, eventPlane3);
180  }
181 
182  lineFit_p_->SetParameter(0, 10);
183 
184  phi_h->Fit(flowFit_p_.get(), "Q SERIAL", "", -TMath::Pi(), TMath::Pi());
185  phi_h->Fit(lineFit_p_.get(), "Q SERIAL", "", -TMath::Pi(), TMath::Pi());
186  rhoFlowFitParamsOut->at(0) = flowFit_p_->GetParameter(0);
187  rhoFlowFitParamsOut->at(1) = flowFit_p_->GetParameter(1);
188  rhoFlowFitParamsOut->at(2) = flowFit_p_->GetParameter(2);
189  rhoFlowFitParamsOut->at(3) = flowFit_p_->GetParameter(3);
190  rhoFlowFitParamsOut->at(4) = flowFit_p_->GetParameter(4);
191 
192  rhoFlowFitParamsOut->at(5) = flowFit_p_->GetChisquare();
193  rhoFlowFitParamsOut->at(6) = flowFit_p_->GetNDF();
194 
195  rhoFlowFitParamsOut->at(7) = lineFit_p_->GetChisquare();
196  rhoFlowFitParamsOut->at(8) = lineFit_p_->GetNDF();
197 
198  phi_h.reset();
199  pfcuts.clear();
200  }
201 
202  iEvent.put(std::move(rhoFlowFitParamsOut), "rhoFlowFitParams");
203 }

References funct::abs(), cms::cuda::assert(), funct::cos(), HLTMuonOfflineAnalyzer_cfi::deltaR2, doEvtPlane_, doFreePlaneFit_, doJettyExclusion_, MillePedeFileConverter_cfg::e, evtPlaneLevel_, evtPlaneToken_, flowFit_p_, hi::HF2, hi::HF3, HiEvtPlane_cfi::hiEvtPlane, iEvent, metsig::jet, singleTopDQM_cfi::jets, jetToken_, lineFit_p_, SiStripPI::max, eostools::move(), Skims_PA_cff::name, ecaldqm::binning::nPhiBins, hi::NumEPNames, pfCandsToken_, Pi, funct::sin(), AlCaHLTBitMon_QueryRunRegistry::string, and HcalDetIdTransform::transform().

Member Data Documentation

◆ doEvtPlane_

const bool HiFJRhoFlowModulationProducer::doEvtPlane_
private

Definition at line 54 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ doFreePlaneFit_

const bool HiFJRhoFlowModulationProducer::doFreePlaneFit_
private

Definition at line 55 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ doJettyExclusion_

const bool HiFJRhoFlowModulationProducer::doJettyExclusion_
private

Definition at line 56 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ evtPlaneLevel_

const int HiFJRhoFlowModulationProducer::evtPlaneLevel_
private

Definition at line 57 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ evtPlaneToken_

const edm::EDGetTokenT<reco::EvtPlaneCollection> HiFJRhoFlowModulationProducer::evtPlaneToken_
private

Definition at line 60 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ flowFit_p_

std::unique_ptr<TF1> HiFJRhoFlowModulationProducer::flowFit_p_
private

Definition at line 62 of file HiFJRhoFlowModulationProducer.cc.

Referenced by HiFJRhoFlowModulationProducer(), and produce().

◆ jetToken_

const edm::EDGetTokenT<reco::JetView> HiFJRhoFlowModulationProducer::jetToken_
private

Definition at line 58 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

◆ lineFit_p_

std::unique_ptr<TF1> HiFJRhoFlowModulationProducer::lineFit_p_
private

Definition at line 61 of file HiFJRhoFlowModulationProducer.cc.

Referenced by HiFJRhoFlowModulationProducer(), and produce().

◆ pfCandsToken_

const edm::EDGetTokenT<reco::PFCandidateCollection> HiFJRhoFlowModulationProducer::pfCandsToken_
private

Definition at line 59 of file HiFJRhoFlowModulationProducer.cc.

Referenced by produce().

edm::EDGetTokenT
Definition: EDGetToken.h:33
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:85964
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
cms::cuda::assert
assert(be >=bs)
HiFJRhoFlowModulationProducer::doEvtPlane_
const bool doEvtPlane_
Definition: HiFJRhoFlowModulationProducer.cc:54
singleTopDQM_cfi.jets
jets
Definition: singleTopDQM_cfi.py:42
HiFJRhoFlowModulationProducer::doJettyExclusion_
const bool doJettyExclusion_
Definition: HiFJRhoFlowModulationProducer.cc:56
tools.TF1
TF1
Definition: tools.py:23
HiFJRhoFlowModulationProducer::jetToken_
const edm::EDGetTokenT< reco::JetView > jetToken_
Definition: HiFJRhoFlowModulationProducer.cc:58
edm::Handle
Definition: AssociativeIterator.h:50
HiFJRhoFlowModulationProducer::pfCandsToken_
const edm::EDGetTokenT< reco::PFCandidateCollection > pfCandsToken_
Definition: HiFJRhoFlowModulationProducer.cc:59
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
HiFJRhoFlowModulationProducer::doFreePlaneFit_
const bool doFreePlaneFit_
Definition: HiFJRhoFlowModulationProducer.cc:55
HiFJRhoFlowModulationProducer::lineFit_p_
std::unique_ptr< TF1 > lineFit_p_
Definition: HiFJRhoFlowModulationProducer.cc:61
funct::cos
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
hi::HF2
Definition: HiEvtPlaneList.h:23
hi::HF3
Definition: HiEvtPlaneList.h:24
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
HiEvtPlane_cfi.hiEvtPlane
hiEvtPlane
Definition: HiEvtPlane_cfi.py:3
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
HiFJRhoFlowModulationProducer::flowFit_p_
std::unique_ptr< TF1 > flowFit_p_
Definition: HiFJRhoFlowModulationProducer.cc:62
iEvent
int iEvent
Definition: GenABIO.cc:224
HiFJRhoFlowModulationProducer::evtPlaneLevel_
const int evtPlaneLevel_
Definition: HiFJRhoFlowModulationProducer.cc:57
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
eostools.move
def move(src, dest)
Definition: eostools.py:511
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
metsig::jet
Definition: SignAlgoResolutions.h:47
HiFJRhoFlowModulationProducer::evtPlaneToken_
const edm::EDGetTokenT< reco::EvtPlaneCollection > evtPlaneToken_
Definition: HiFJRhoFlowModulationProducer.cc:60
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Pi
const double Pi
Definition: CosmicMuonParameters.h:18
hi::NumEPNames
static const int NumEPNames
Definition: HiEvtPlaneList.h:28
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
ecaldqm::binning::nPhiBins
Definition: MESetBinningUtils.h:69
edm::InputTag
Definition: InputTag.h:15
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37