CMS 3D CMS Logo

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::ProductRegistryHelper

List of all members.

Public Member Functions

 HiEvtPlaneFlatProducer (const edm::ParameterSet &)
 ~HiEvtPlaneFlatProducer ()

Private Member Functions

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

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

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 85 of file HiEvtPlaneFlatProducer.cc.


Constructor & Destructor Documentation

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

Definition at line 127 of file HiEvtPlaneFlatProducer.cc.

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

{

  vtxCollection_  = iConfig.getParameter<edm::InputTag>("vtxCollection_");
  inputPlanes_ = iConfig.getParameter<edm::InputTag>("inputPlanes_");
  centrality_ = iConfig.getParameter<edm::InputTag>("centrality_");
  storeNames_ = 1;
   //register your products
  produces<reco::EvtPlaneCollection>();
   //now do what ever other initialization is needed
  Int_t FlatOrder = 21;
  for(int i = 0; i<NumEPNames; i++) {
    flat[i] = new HiEvtPlaneFlatten();
    flat[i]->Init(FlatOrder,11,4,EPNames[i],EPOrder[i]);
  }
  
}
HiEvtPlaneFlatProducer::~HiEvtPlaneFlatProducer ( )

Definition at line 146 of file HiEvtPlaneFlatProducer.cc.

{
 
   // do anything here that needs to be done at desctruction time
   // (e.g. close files, deallocate resources etc.)

}

Member Function Documentation

void HiEvtPlaneFlatProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 247 of file HiEvtPlaneFlatProducer.cc.

{
}
void HiEvtPlaneFlatProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 253 of file HiEvtPlaneFlatProducer.cc.

                               {
}
void HiEvtPlaneFlatProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

Implements edm::EDProducer.

Definition at line 161 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, RPFlatParams::EP::RPNameIndx, RPFlatParams::EP::x, and RPFlatParams::EP::y.

{
  using namespace edm;
  using namespace std;
  using namespace reco;

  //
  //Get Centrality
  //

  edm::Handle<int> ch;
  iEvent.getByLabel(centrality_,ch);
  int bin = *(ch.product());

  //  double centval = 2.5*bin+1.25;
  //
  //Get Vertex
  //
  edm::Handle<reco::VertexCollection> vertexCollection3;
  iEvent.getByLabel(vtxCollection_,vertexCollection3);
  const reco::VertexCollection * vertices3 = vertexCollection3.product();
  vs_sell = vertices3->size();
  if(vs_sell>0) {
    vzr_sell = vertices3->begin()->z();
    vzErr_sell = vertices3->begin()->zError();
  } else
    vzr_sell = -999.9;
  //
  //Get Flattening Parameters
  //
  edm::ESHandle<RPFlatParams> flatparmsDB_;
  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
  int flatTableSize = flatparmsDB_->m_table.size();
  for(int i = 0; i<flatTableSize; i++) {
    const RPFlatParams::EP* thisBin = &(flatparmsDB_->m_table[i]);
    for(int j = 0; j<NumEPNames; j++) {
      int indx = thisBin->RPNameIndx[j];
      if(indx>=0) {
        flat[indx]->SetXDB(i, thisBin->x[j]);
        flat[indx]->SetYDB(i, thisBin->y[j]);
      }
    }
  }
  
  //
  //Get Event Planes
  //
  
  Handle<reco::EvtPlaneCollection> evtPlanes;
  iEvent.getByLabel(inputPlanes_,evtPlanes);
  
  if(!evtPlanes.isValid()){
    //    cout << "Error! Can't get hiEvtPlane product!" << endl;
    return ;
  }

  std::auto_ptr<EvtPlaneCollection> evtplaneOutput(new EvtPlaneCollection);
  EvtPlane * ep[NumEPNames];
  for(int i = 0; i<NumEPNames; i++) {
    ep[i]=0;
  }
  for (EvtPlaneCollection::const_iterator rp = evtPlanes->begin();rp !=evtPlanes->end(); rp++) {
    if(rp->angle() > -5) {
      string baseName = rp->label();
      for(int i = 0; i< NumEPNames; i++) {
        if(EPNames[i].compare(baseName)==0) {
          double psiFlat = flat[i]->GetFlatPsi(rp->angle(),vzr_sell,bin);
          epang[i]=psiFlat;
          if(EPNames[i].compare(rp->label())==0) {          
            if(storeNames_) ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),rp->label().data());
            else ep[i]= new EvtPlane(psiFlat, rp->sumSin(), rp->sumCos(),"");
          } 
        }
      }
    }    
  }
  
  for(int i = 0; i< NumEPNames; i++) {
    if(ep[i]!=0) evtplaneOutput->push_back(*ep[i]);
  }
  iEvent.put(evtplaneOutput);
  storeNames_ = 0;  
}

Member Data Documentation

Definition at line 99 of file HiEvtPlaneFlatProducer.cc.

Double_t HiEvtPlaneFlatProducer::epang[NumEPNames] [private]

Definition at line 105 of file HiEvtPlaneFlatProducer.cc.

Definition at line 106 of file HiEvtPlaneFlatProducer.cc.

Definition at line 98 of file HiEvtPlaneFlatProducer.cc.

Definition at line 108 of file HiEvtPlaneFlatProducer.cc.

Definition at line 107 of file HiEvtPlaneFlatProducer.cc.

Definition at line 109 of file HiEvtPlaneFlatProducer.cc.

Definition at line 101 of file HiEvtPlaneFlatProducer.cc.

Definition at line 97 of file HiEvtPlaneFlatProducer.cc.

Definition at line 103 of file HiEvtPlaneFlatProducer.cc.

Definition at line 102 of file HiEvtPlaneFlatProducer.cc.