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::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
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) 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::EDGetTokenT< int > centrality_
 
Double_t epang [NumEPNames]
 
HiEvtPlaneFlattenflat [NumEPNames]
 
edm::EDGetTokenT
< reco::EvtPlaneCollection
inputPlanes_
 
int nRP
 
RPFlatParamsrpFlat
 
bool storeNames_
 
int vs_sell
 
edm::EDGetTokenT
< reco::VertexCollection
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

Definition at line 71 of file HiEvtPlaneFlatProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 113 of file HiEvtPlaneFlatProducer.cc.

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

114 {
115 
116  vtxCollection_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vtxCollection_"));
117  inputPlanes_ = consumes<reco::EvtPlaneCollection>(iConfig.getParameter<edm::InputTag>("inputPlanes_"));
118  centrality_ = consumes<int>(iConfig.getParameter<edm::InputTag>("centrality_"));
119  storeNames_ = 1;
120  //register your products
121  produces<reco::EvtPlaneCollection>();
122  //now do what ever other initialization is needed
123  Int_t FlatOrder = 21;
124  for(int i = 0; i<NumEPNames; i++) {
125  flat[i] = new HiEvtPlaneFlatten();
126  flat[i]->Init(FlatOrder,11,4,EPNames[i],EPOrder[i]);
127  }
128 
129 }
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)
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanes_
edm::EDGetTokenT< int > centrality_
HiEvtPlaneFlatten * flat[NumEPNames]
const std::string EPNames[]
edm::EDGetTokenT< reco::VertexCollection > vtxCollection_
static const int NumEPNames
HiEvtPlaneFlatProducer::~HiEvtPlaneFlatProducer ( )

Definition at line 132 of file HiEvtPlaneFlatProducer.cc.

133 {
134 
135  // do anything here that needs to be done at desctruction time
136  // (e.g. close files, deallocate resources etc.)
137 
138 }

Member Function Documentation

void HiEvtPlaneFlatProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 233 of file HiEvtPlaneFlatProducer.cc.

234 {
235 }
void HiEvtPlaneFlatProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 239 of file HiEvtPlaneFlatProducer.cc.

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

Implements edm::EDProducer.

Definition at line 147 of file HiEvtPlaneFlatProducer.cc.

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

148 {
149  using namespace edm;
150  using namespace std;
151  using namespace reco;
152 
153  //
154  //Get Centrality
155  //
156 
157  edm::Handle<int> ch;
158  iEvent.getByToken(centrality_,ch);
159  int bin = *(ch.product());
160 
161  // double centval = 2.5*bin+1.25;
162  //
163  //Get Vertex
164  //
165  edm::Handle<reco::VertexCollection> vertexCollection3;
166  iEvent.getByToken(vtxCollection_,vertexCollection3);
167  const reco::VertexCollection * vertices3 = vertexCollection3.product();
168  vs_sell = vertices3->size();
169  if(vs_sell>0) {
170  vzr_sell = vertices3->begin()->z();
171  vzErr_sell = vertices3->begin()->zError();
172  } else
173  vzr_sell = -999.9;
174  //
175  //Get Flattening Parameters
176  //
177  edm::ESHandle<RPFlatParams> flatparmsDB_;
178  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
179  int flatTableSize = flatparmsDB_->m_table.size();
180  for(int i = 0; i<flatTableSize; i++) {
181  const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
182  for(int j = 0; j<NumEPNames; j++) {
183  int indx = thisBin->RPNameIndx[j];
184  if(indx>=0) {
185  flat[indx]->SetXDB(i, thisBin->x[j]);
186  flat[indx]->SetYDB(i, thisBin->y[j]);
187  }
188  }
189  }
190 
191  //
192  //Get Event Planes
193  //
194 
196  iEvent.getByToken(inputPlanes_,evtPlanes);
197 
198  if(!evtPlanes.isValid()){
199  // cout << "Error! Can't get hiEvtPlane product!" << endl;
200  return ;
201  }
202 
203  std::auto_ptr<EvtPlaneCollection> evtplaneOutput(new EvtPlaneCollection);
204  EvtPlane * ep[NumEPNames];
205  for(int i = 0; i<NumEPNames; i++) {
206  ep[i]=0;
207  }
208  for (EvtPlaneCollection::const_iterator rp = evtPlanes->begin();rp !=evtPlanes->end(); rp++) {
209  if(rp->angle() > -5) {
210  string baseName = rp->label();
211  for(int i = 0; i< NumEPNames; i++) {
212  if(EPNames[i].compare(baseName)==0) {
213  double psiFlat = flat[i]->GetFlatPsi(rp->angle(),vzr_sell,bin);
214  epang[i]=psiFlat;
215  if(EPNames[i].compare(rp->label())==0) {
216  if(storeNames_) ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),rp->label().data());
217  else ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),"");
218  }
219  }
220  }
221  }
222  }
223 
224  for(int i = 0; i< NumEPNames; i++) {
225  if(ep[i]!=0) evtplaneOutput->push_back(*ep[i]);
226  }
227  iEvent.put(evtplaneOutput);
228  storeNames_ = 0;
229 }
int i
Definition: DBlmapReader.cc:9
double GetFlatPsi(double psi, double vtx, double cent)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanes_
edm::EDGetTokenT< int > centrality_
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)
return((rh^lh)&mask)
void SetYDB(int indx, double val)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
edm::EDGetTokenT< reco::VertexCollection > vtxCollection_
Double_t epang[NumEPNames]
std::vector< EvtPlane > EvtPlaneCollection
Definition: EvtPlane.h:33
int j
Definition: DBlmapReader.cc:9
const T & get() const
Definition: EventSetup.h:55
int RPNameIndx[50]
Definition: RPFlatParams.h:16
static const int NumEPNames

Member Data Documentation

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

Definition at line 85 of file HiEvtPlaneFlatProducer.cc.

Double_t HiEvtPlaneFlatProducer::epang[NumEPNames]
private

Definition at line 91 of file HiEvtPlaneFlatProducer.cc.

HiEvtPlaneFlatten* HiEvtPlaneFlatProducer::flat[NumEPNames]
private

Definition at line 92 of file HiEvtPlaneFlatProducer.cc.

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

Definition at line 84 of file HiEvtPlaneFlatProducer.cc.

int HiEvtPlaneFlatProducer::nRP
private

Definition at line 94 of file HiEvtPlaneFlatProducer.cc.

RPFlatParams* HiEvtPlaneFlatProducer::rpFlat
private

Definition at line 93 of file HiEvtPlaneFlatProducer.cc.

bool HiEvtPlaneFlatProducer::storeNames_
private

Definition at line 95 of file HiEvtPlaneFlatProducer.cc.

int HiEvtPlaneFlatProducer::vs_sell
private

Definition at line 87 of file HiEvtPlaneFlatProducer.cc.

edm::EDGetTokenT<reco::VertexCollection> HiEvtPlaneFlatProducer::vtxCollection_
private

Definition at line 83 of file HiEvtPlaneFlatProducer.cc.

float HiEvtPlaneFlatProducer::vzErr_sell
private

Definition at line 89 of file HiEvtPlaneFlatProducer.cc.

float HiEvtPlaneFlatProducer::vzr_sell
private

Definition at line 88 of file HiEvtPlaneFlatProducer.cc.