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<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiEvtPlaneFlatProducer (const edm::ParameterSet &)
 
 ~HiEvtPlaneFlatProducer ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 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 (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &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 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::Centrality
centralityToken
 
std::string centralityVariable_
 
HiEvtPlaneFlattenflat [NumEPNames]
 
const int FlatOrder_
 
edm::ESWatcher< HeavyIonRPRcdhirpWatcher
 
edm::ESWatcher< HeavyIonRcdhiWatcher
 
edm::InputTag inputPlanesTag_
 
edm::EDGetTokenT
< reco::EvtPlaneCollection
inputPlanesToken
 
double nCentBins_
 
int Noffmax_
 
int Noffmin_
 
int NumFlatBins_
 
edm::Handle
< reco::TrackCollection
trackCollection_
 
edm::InputTag trackTag_
 
edm::EDGetTokenT
< reco::TrackCollection
trackToken
 
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, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 63 of file HiEvtPlaneFlatProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 122 of file HiEvtPlaneFlatProducer.cc.

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

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

Definition at line 167 of file HiEvtPlaneFlatProducer.cc.

References flat, i, and hi::NumEPNames.

168 {
169 
170  // do anything here that needs to be done at desctruction time
171  // (e.g. close files, deallocate resources etc.)
172  for(int i = 0; i<NumEPNames; i++) {
173  delete flat[i];
174  }
175 
176 }
int i
Definition: DBlmapReader.cc:9
HiEvtPlaneFlatten * flat[NumEPNames]
static const int NumEPNames

Member Function Documentation

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

Implements edm::stream::EDProducerBase.

Definition at line 185 of file HiEvtPlaneFlatProducer.cc.

References reco::EvtPlane::addLevel(), reco::EvtPlane::angle(), newFWLiteAna::bin, EnergyCorrector::c, caloCentRef_, caloCentRefWidth_, CentBinCompression_, centralityBinToken, centralityLabel_, centralityToken, edm::ESWatcher< T >::check(), EcalCondDB::db, hi::EPDet, flat, edm::EventSetup::get(), edm::Event::getByToken(), HiEvtPlaneFlatten::getCoffset(), HiEvtPlaneFlatten::getFlatPsi(), HiEvtPlaneFlatten::getOffsetPsi(), HiEvtPlaneFlatten::getSoffset(), hcaldqm::constants::HF, hirpWatcher, hiWatcher, i, inputPlanesToken, LoadEPDB::IsSuccess(), visualization-live-secondInstance_cfg::m, nCentBins_, Noffmax_, Noffmin_, hi::NumEPNames, or, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, reco::return(), alignCSCRings::s, HiEvtPlaneFlatten::setCaloCentRefBins(), useOffsetPsi_, and vertexToken.

186 {
187  using namespace edm;
188  using namespace std;
189  using namespace reco;
190 
191  //
192  //Get Flattening Parameters
193  //
194  if( hiWatcher.check(iSetup) ) {
195 
196  //
197  //Get Size of Centrality Table
198  //
200  iSetup.get<HeavyIonRcd>().get(centralityLabel_,centDB_);
201  nCentBins_ = centDB_->m_table.size();
202  for(int i = 0; i<NumEPNames; i++) {
203  flat[i]->setCaloCentRefBins(-1,-1);
204  if(caloCentRef_>0) {
205  int minbin = (caloCentRef_-caloCentRefWidth_/2.)*nCentBins_/100.;
206  int maxbin = (caloCentRef_+caloCentRefWidth_/2.)*nCentBins_/100.;
207  minbin/=CentBinCompression_;
208  maxbin/=CentBinCompression_;
209  if(minbin>0 && maxbin>=minbin) {
210  if(EPDet[i]==HF || EPDet[i]==Castor) flat[i]->setCaloCentRefBins(minbin,maxbin);
211  }
212  }
213  }
214  }
215 
216  if( hirpWatcher.check(iSetup) ) {
217  edm::ESHandle<RPFlatParams> flatparmsDB_;
218  iSetup.get<HeavyIonRPRcd>().get(flatparmsDB_);
219  LoadEPDB db(flatparmsDB_,flat);
220  if(!db.IsSuccess()) return;
221  }
222  //
223  //Get Centrality
224  //
225 
226  int bin = 0;
227  edm::Handle<int> cbin_;
228  iEvent.getByToken(centralityBinToken, cbin_);
229  int cbin = *cbin_;
230  bin = cbin/CentBinCompression_;
231 
232  if(Noffmin_>=0) {
233  edm::Handle<reco::Centrality> centrality_;
234  iEvent.getByToken(centralityToken, centrality_);
235  int Noff = centrality_->Ntracks();
236  if ( (Noff < Noffmin_) or (Noff >= Noffmax_) ) {
237  return;
238  }
239  }
240  //
241  //Get Vertex
242  //
243  int vs_sell; // vertex collection size
244  float vzr_sell;
246  iEvent.getByToken(vertexToken,vertex_);
247  const reco::VertexCollection * vertices3 = vertex_.product();
248  vs_sell = vertices3->size();
249  if(vs_sell>0) {
250  vzr_sell = vertices3->begin()->z();
251  } else
252  vzr_sell = -999.9;
253 
254  //
255  //Get Event Planes
256  //
257 
259  iEvent.getByToken(inputPlanesToken,evtPlanes_);
260 
261  if(!evtPlanes_.isValid()){
262  // cout << "Error! Can't get hiEvtPlane product!" << endl;
263  return ;
264  }
265 
266  std::auto_ptr<EvtPlaneCollection> evtplaneOutput(new EvtPlaneCollection);
267  EvtPlane * ep[NumEPNames];
268  for(int i = 0; i<NumEPNames; i++) {
269  ep[i]=0;
270  }
271  int indx = 0;
272  for (EvtPlaneCollection::const_iterator rp = evtPlanes_->begin();rp !=evtPlanes_->end(); rp++) {
273  double psiOffset = rp->angle(0);
274  double s = rp->sumSin(0);
275  double c = rp->sumCos(0);
276  uint m = rp->mult();
277 
278  double soff = s;
279  double coff = c;
280  if(useOffsetPsi_) {
281  soff = flat[indx]->getSoffset(s, vzr_sell, bin);
282  coff = flat[indx]->getCoffset(c, vzr_sell, bin);
283  psiOffset = flat[indx]->getOffsetPsi(soff, coff);
284  }
285  double psiFlat = flat[indx]->getFlatPsi(psiOffset,vzr_sell,bin);
286  ep[indx]= new EvtPlane(indx, 2, psiFlat, soff, coff,rp->sumw(), rp->sumw2(), rp->sumPtOrEt(), rp->sumPtOrEt2(), m);
287  ep[indx]->addLevel(0, rp->angle(0), s, c);
288  ep[indx]->addLevel(3,0., rp->sumSin(3), rp->sumCos(3));
289  if(useOffsetPsi_) ep[indx]->addLevel(1, psiOffset, soff, coff);
290  ++indx;
291  }
292 
293  for(int i = 0; i< NumEPNames; i++) {
294  if(ep[i]!=0) evtplaneOutput->push_back(*ep[i]);
295 
296  }
297  iEvent.put(evtplaneOutput);
298  for(int i = 0; i<indx; i++) delete ep[i];
299 }
void addLevel(int level, double ang, double sumsin, double sumcos)
Definition: EvtPlane.cc:22
int i
Definition: DBlmapReader.cc:9
const int EPDet[]
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::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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
tuple db
Definition: EcalCondDB.py:151
void setCaloCentRefBins(const int caloCentRefMinBin, const int caloCentRefMaxBin)
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
HiEvtPlaneFlatten * flat[NumEPNames]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
edm::EDGetTokenT< std::vector< reco::Vertex > > vertexToken
std::vector< EvtPlane > EvtPlaneCollection
Definition: EvtPlane.h:51
double getCoffset(double c, double vtx, int centbin) const
double getFlatPsi(double psi, double vtx, int centbin) const
float angle(int level=2) const
Definition: EvtPlane.h:25
const T & get() const
Definition: EventSetup.h:56
bool check(const edm::EventSetup &iSetup)
Definition: ESWatcher.h:57
return(e1-e2)*(e1-e2)+dp *dp
edm::ESWatcher< HeavyIonRPRcd > hirpWatcher
edm::EDGetTokenT< int > centralityBinToken
edm::EDGetTokenT< reco::EvtPlaneCollection > inputPlanesToken
static const int NumEPNames

Member Data Documentation

double HiEvtPlaneFlatProducer::caloCentRef_
private

Definition at line 98 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

double HiEvtPlaneFlatProducer::caloCentRefWidth_
private

Definition at line 99 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::CentBinCompression_
private

Definition at line 100 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::centralityBinTag_
private

Definition at line 77 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 78 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityLabel_
private

Definition at line 74 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityMC_
private

Definition at line 75 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

edm::InputTag HiEvtPlaneFlatProducer::centralityTag_
private

Definition at line 80 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 81 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

std::string HiEvtPlaneFlatProducer::centralityVariable_
private

Definition at line 73 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 96 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 94 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

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

Definition at line 93 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::inputPlanesTag_
private

Definition at line 86 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 87 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

double HiEvtPlaneFlatProducer::nCentBins_
private

Definition at line 105 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().

int HiEvtPlaneFlatProducer::Noffmax_
private

Definition at line 102 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::Noffmin_
private

Definition at line 101 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

int HiEvtPlaneFlatProducer::NumFlatBins_
private

Definition at line 97 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 91 of file HiEvtPlaneFlatProducer.cc.

edm::InputTag HiEvtPlaneFlatProducer::trackTag_
private

Definition at line 89 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 90 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

bool HiEvtPlaneFlatProducer::useOffsetPsi_
private

Definition at line 104 of file HiEvtPlaneFlatProducer.cc.

Referenced by produce().

edm::InputTag HiEvtPlaneFlatProducer::vertexTag_
private

Definition at line 83 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer().

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

Definition at line 84 of file HiEvtPlaneFlatProducer.cc.

Referenced by HiEvtPlaneFlatProducer(), and produce().