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

#include <HiEvtPlaneFlatten/HiEvtPlaneFlatProducer/src/HiEvtPlaneFlatProducer.cc>

Inheritance diagram for HiEvtPlaneFlatProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiEvtPlaneFlatProducer (const edm::ParameterSet &)
 
 ~HiEvtPlaneFlatProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

edm::InputTag centrality_
 
Double_t epang [NumEPNames]
 
HiEvtPlaneFlattenflat [NumEPNames]
 
edm::InputTag inputPlanes_
 
int nRP
 
RPFlatParamsrpFlat
 
bool storeNames_
 
int vs_sell
 
edm::InputTag vtxCollection_
 
float vzErr_sell
 
float vzr_sell
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 84 of file HiEvtPlaneFlatProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 126 of file HiEvtPlaneFlatProducer.cc.

References hi::EPNames, hi::EPOrder, edm::ParameterSet::getParameter(), i, and hi::NumEPNames.

127 {
128 
129  vtxCollection_ = iConfig.getParameter<edm::InputTag>("vtxCollection_");
130  inputPlanes_ = iConfig.getParameter<edm::InputTag>("inputPlanes_");
131  centrality_ = iConfig.getParameter<edm::InputTag>("centrality_");
132  storeNames_ = 1;
133  //register your products
134  produces<reco::EvtPlaneCollection>();
135  //now do what ever other initialization is needed
136  Int_t FlatOrder = 21;
137  for(int i = 0; i<NumEPNames; i++) {
138  flat[i] = new HiEvtPlaneFlatten();
139  flat[i]->Init(FlatOrder,11,4,EPNames[i],EPOrder[i]);
140  }
141 
142 }
T getParameter(std::string const &) const
const int EPOrder[]
int i
Definition: DBlmapReader.cc:9
void Init(int order, int ncentbins, const int centbinCompression, std::string tag, int vord)
HiEvtPlaneFlatten * flat[NumEPNames]
const std::string EPNames[]
static const int NumEPNames
HiEvtPlaneFlatProducer::~HiEvtPlaneFlatProducer ( )

Definition at line 145 of file HiEvtPlaneFlatProducer.cc.

146 {
147 
148  // do anything here that needs to be done at desctruction time
149  // (e.g. close files, deallocate resources etc.)
150 
151 }

Member Function Documentation

void HiEvtPlaneFlatProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 246 of file HiEvtPlaneFlatProducer.cc.

247 {
248 }
void HiEvtPlaneFlatProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 252 of file HiEvtPlaneFlatProducer.cc.

252  {
253 }
void HiEvtPlaneFlatProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 160 of file HiEvtPlaneFlatProducer.cc.

References newFWLiteAna::bin, compare_using_db::compare, hi::EPNames, edm::EventSetup::get(), edm::Event::getByLabel(), i, j, reco::EvtPlane::label(), hi::NumEPNames, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, reco::return(), RPFlatParams::EP::RPNameIndx, RPFlatParams::EP::x, and RPFlatParams::EP::y.

161 {
162  using namespace edm;
163  using namespace std;
164  using namespace reco;
165 
166  //
167  //Get Centrality
168  //
169 
170  edm::Handle<int> ch;
171  iEvent.getByLabel(centrality_,ch);
172  int bin = *(ch.product());
173 
174  // double centval = 2.5*bin+1.25;
175  //
176  //Get Vertex
177  //
178  edm::Handle<reco::VertexCollection> vertexCollection3;
179  iEvent.getByLabel(vtxCollection_,vertexCollection3);
180  const reco::VertexCollection * vertices3 = vertexCollection3.product();
181  vs_sell = vertices3->size();
182  if(vs_sell>0) {
183  vzr_sell = vertices3->begin()->z();
184  vzErr_sell = vertices3->begin()->zError();
185  } else
186  vzr_sell = -999.9;
187  //
188  //Get Flattening Parameters
189  //
190  edm::ESHandle<RPFlatParams> flatparmsDB_;
191  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
192  int flatTableSize = flatparmsDB_->m_table.size();
193  for(int i = 0; i<flatTableSize; i++) {
194  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
195  for(int j = 0; j<NumEPNames; j++) {
196  int indx = thisBin->RPNameIndx[j];
197  if(indx>=0) {
198  flat[indx]->SetXDB(i, thisBin->x[j]);
199  flat[indx]->SetYDB(i, thisBin->y[j]);
200  }
201  }
202  }
203 
204  //
205  //Get Event Planes
206  //
207 
209  iEvent.getByLabel(inputPlanes_,evtPlanes);
210 
211  if(!evtPlanes.isValid()){
212  // cout << "Error! Can't get hiEvtPlane product!" << endl;
213  return ;
214  }
215 
216  std::auto_ptr<EvtPlaneCollection> evtplaneOutput(new EvtPlaneCollection);
217  EvtPlane * ep[NumEPNames];
218  for(int i = 0; i<NumEPNames; i++) {
219  ep[i]=0;
220  }
221  for (EvtPlaneCollection::const_iterator rp = evtPlanes->begin();rp !=evtPlanes->end(); rp++) {
222  if(rp->angle() > -5) {
223  string baseName = rp->label();
224  for(int i = 0; i< NumEPNames; i++) {
225  if(EPNames[i].compare(baseName)==0) {
226  double psiFlat = flat[i]->GetFlatPsi(rp->angle(),vzr_sell,bin);
227  epang[i]=psiFlat;
228  if(EPNames[i].compare(rp->label())==0) {
229  if(storeNames_) ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),rp->label().data());
230  else ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),"");
231  }
232  }
233  }
234  }
235  }
236 
237  for(int i = 0; i< NumEPNames; i++) {
238  if(ep[i]!=0) evtplaneOutput->push_back(*ep[i]);
239  }
240  iEvent.put(evtplaneOutput);
241  storeNames_ = 0;
242 }
int i
Definition: DBlmapReader.cc:9
double GetFlatPsi(double psi, double vtx, double cent)
std::string label() const
Definition: EvtPlane.h:19
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HiEvtPlaneFlatten * flat[NumEPNames]
const std::string EPNames[]
void SetXDB(int indx, double val)
void SetYDB(int indx, double val)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
std::vector< EvtPlane > EvtPlaneCollection
Definition: EvtPlane.h:33
int j
Definition: DBlmapReader.cc:9
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
const T & get() const
Definition: EventSetup.h:55
return(e1-e2)*(e1-e2)+dp *dp
int RPNameIndx[50]
Definition: RPFlatParams.h:14
static const int NumEPNames

Member Data Documentation

edm::InputTag HiEvtPlaneFlatProducer::centrality_
private

Definition at line 98 of file HiEvtPlaneFlatProducer.cc.

Double_t HiEvtPlaneFlatProducer::epang[NumEPNames]
private

Definition at line 104 of file HiEvtPlaneFlatProducer.cc.

HiEvtPlaneFlatten* HiEvtPlaneFlatProducer::flat[NumEPNames]
private

Definition at line 105 of file HiEvtPlaneFlatProducer.cc.

edm::InputTag HiEvtPlaneFlatProducer::inputPlanes_
private

Definition at line 97 of file HiEvtPlaneFlatProducer.cc.

int HiEvtPlaneFlatProducer::nRP
private

Definition at line 107 of file HiEvtPlaneFlatProducer.cc.

RPFlatParams* HiEvtPlaneFlatProducer::rpFlat
private

Definition at line 106 of file HiEvtPlaneFlatProducer.cc.

bool HiEvtPlaneFlatProducer::storeNames_
private

Definition at line 108 of file HiEvtPlaneFlatProducer.cc.

int HiEvtPlaneFlatProducer::vs_sell
private

Definition at line 100 of file HiEvtPlaneFlatProducer.cc.

edm::InputTag HiEvtPlaneFlatProducer::vtxCollection_
private

Definition at line 96 of file HiEvtPlaneFlatProducer.cc.

float HiEvtPlaneFlatProducer::vzErr_sell
private

Definition at line 102 of file HiEvtPlaneFlatProducer.cc.

float HiEvtPlaneFlatProducer::vzr_sell
private

Definition at line 101 of file HiEvtPlaneFlatProducer.cc.