CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
EvtPlaneProducer Class Reference
Inheritance diagram for EvtPlaneProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Classes

class  GenPlane
 

Public Member Functions

 EvtPlaneProducer (const edm::ParameterSet &)
 
 ~EvtPlaneProducer ()
 
- 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 ()
 
virtual void endJob ()
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

edm::EDGetTokenT
< CaloTowerCollection
caloCollection_
 
double chi2_
 
double dzerr_
 
double maxet_
 
double maxpt_
 
double maxvtx_
 
double minet_
 
double minpt_
 
double minvtx_
 
GenPlanerp [NumEPNames]
 
bool storeNames_
 
edm::EDGetTokenT
< reco::TrackCollection
trackCollection_
 
bool useECAL_
 
bool useHCAL_
 
bool useTrack_
 
bool useTrackPtWeight_
 
edm::EDGetTokenT
< reco::VertexCollection
vtxCollection_
 

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 52 of file EvtPlaneProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 152 of file EvtPlaneProducer.cc.

References data, hi::EPEtaMax1, hi::EPEtaMax2, hi::EPEtaMin1, hi::EPEtaMin2, hi::EPNames, hi::EPOrder, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), i, and hi::NumEPNames.

153 {
154 
155 
156  //register your products
157  vtxCollection_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vtxCollection_"));
158  caloCollection_ = consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("caloCollection_"));
159  trackCollection_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("trackCollection_"));
160  useECAL_ = iConfig.getUntrackedParameter<bool>("useECAL_",true);
161  useHCAL_ = iConfig.getUntrackedParameter<bool>("useHCAL_",true);
162  useTrack_ = iConfig.getUntrackedParameter<bool>("useTrack",true);
163  useTrackPtWeight_ = iConfig.getUntrackedParameter<bool>("useTrackPtWeight_",true);
164  minet_ = iConfig.getUntrackedParameter<double>("minet_",0.2);
165  maxet_ = iConfig.getUntrackedParameter<double>("maxet_",500.);
166  minpt_ = iConfig.getUntrackedParameter<double>("minpt_",0.3);
167  maxpt_ = iConfig.getUntrackedParameter<double>("maxpt_",2.5);
168  minvtx_ = iConfig.getUntrackedParameter<double>("minvtx_",-50.);
169  maxvtx_ = iConfig.getUntrackedParameter<double>("maxvtx_",50.);
170  dzerr_ = iConfig.getUntrackedParameter<double>("dzerr_",10.);
171  chi2_ = iConfig.getUntrackedParameter<double>("chi2_",40.);
172 
173  storeNames_ = 1;
174  produces<reco::EvtPlaneCollection>("recoLevel");
175  for(int i = 0; i<NumEPNames; i++ ) {
176  rp[i] = new GenPlane(EPNames[i].data(),EPEtaMin1[i],EPEtaMax1[i],EPEtaMin2[i],EPEtaMax2[i],EPOrder[i]);
177  }
178 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
const int EPOrder[]
int i
Definition: DBlmapReader.cc:9
const double EPEtaMin2[]
edm::EDGetTokenT< reco::VertexCollection > vtxCollection_
const std::string EPNames[]
const double EPEtaMin1[]
GenPlane * rp[NumEPNames]
edm::EDGetTokenT< CaloTowerCollection > caloCollection_
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
const double EPEtaMax2[]
static const int NumEPNames
const double EPEtaMax1[]
EvtPlaneProducer::~EvtPlaneProducer ( )

Definition at line 181 of file EvtPlaneProducer.cc.

182 {
183 
184  // do anything here that needs to be done at desctruction time
185  // (e.g. close files, deallocate resources etc.)
186 
187 }

Member Function Documentation

void EvtPlaneProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 419 of file EvtPlaneProducer.cc.

420 {
421 }
void EvtPlaneProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 425 of file EvtPlaneProducer.cc.

425  {
426 }
void EvtPlaneProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 196 of file EvtPlaneProducer.cc.

References EnergyCorrector::c, funct::cos(), cuy::cv, hi::EPNames, hi::EPTracksMid3, hi::EPTracksMid4, hi::EPTracksMid5, hi::EPTracksMid6, hi::EPTracksNeg3, hi::EPTracksNeg4, hi::EPTracksNeg5, hi::EPTracksNeg6, hi::EPTracksPos3, hi::EPTracksPos4, hi::EPTracksPos5, hi::EPTracksPos6, hi::etCaloHFM, hi::etCaloHFP, hi::etEcal, hi::etEcalM, hi::etEcalP, hi::etHcal, hi::etHcalM, hi::etHcalP, hi::etHF, hi::etHF3, hi::etHF4, hi::etHF5, hi::etHF6, hi::etHFm, hi::etHFm3, hi::etHFm4, hi::etHFm5, hi::etHFm6, hi::etHFp, hi::etHFp3, hi::etHFp4, hi::etHFp5, hi::etHFp6, hi::EvtPlaneFromTracksMidEta, hi::EvtPTracksNegEtaGap, hi::EvtPTracksPosEtaGap, edm::Event::getByToken(), i, edm::HandleBase::isValid(), j, hi::NumEPNames, edm::Event::put(), dt_dqm_sourceclient_common_cff::reco, reset(), alignCSCRings::s, indexGen::s2, funct::sin(), mathSSE::sqrt(), testEve_cfg::tracks, and w.

197 {
198  using namespace edm;
199  using namespace reco;
200 
201  int vs_sell;
202  float vzr_sell;
203  //
204  //Get Vertex
205  //
206  edm::Handle<reco::VertexCollection> vertexCollection3;
207  iEvent.getByToken(vtxCollection_,vertexCollection3);
208  const reco::VertexCollection * vertices3 = vertexCollection3.product();
209  vs_sell = vertices3->size();
210  if(vs_sell>0) {
211  vzr_sell = vertices3->begin()->z();
212  } else
213  vzr_sell = -999.9;
214  //
215  for(int i = 0; i<NumEPNames; i++) rp[i]->reset();
216  if(vzr_sell>minvtx_ && vzr_sell<maxvtx_) {
217  //calorimetry part
218 
219  double tower_eta, tower_phi;
220  double tower_energyet, tower_energyet_e, tower_energyet_h;
221  double s1, s2, s13,s23,s14,s24,s15,s25,s16,s26;
222  Handle<CaloTowerCollection> calotower;
223  iEvent.getByToken(caloCollection_,calotower);
224 
225  if(calotower.isValid()){
226 
227  for (CaloTowerCollection::const_iterator j = calotower->begin();j !=calotower->end(); j++) {
228  tower_eta = j->eta();
229  tower_phi = j->phi();
230  tower_energyet_e = j->emEt();
231  tower_energyet_h = j->hadEt();
232  tower_energyet = tower_energyet_e + tower_energyet_h;
233 
234  s1 = sin(2.*tower_phi);
235  s2 = cos(2.*tower_phi);
236  s13 = sin(3.*tower_phi);
237  s23 = cos(3.*tower_phi);
238  s14 = sin(4.*tower_phi);
239  s24 = cos(4.*tower_phi);
240  s15 = sin(5.*tower_phi);
241  s25 = cos(5.*tower_phi);
242  s16 = sin(6.*tower_phi);
243  s26 = cos(6.*tower_phi);
244 
245  if(tower_energyet<minet_) continue;
246  if(tower_energyet>maxet_) continue;;
247 
248  rp[etEcal ]->addParticle (tower_energyet_e, s1, s2, tower_eta);
249  rp[etEcalP ]->addParticle (tower_energyet_e, s1, s2, tower_eta);
250  rp[etEcalM ]->addParticle (tower_energyet_e, s1, s2, tower_eta);
251  rp[etHcal ]->addParticle (tower_energyet_h, s1, s2, tower_eta);
252  rp[etHcalP ]->addParticle (tower_energyet_h, s1, s2, tower_eta);
253  rp[etHcalM ]->addParticle (tower_energyet_h, s1, s2, tower_eta);
254  rp[etHF ]->addParticle (tower_energyet, s1, s2, tower_eta);
255  rp[etHFp ]->addParticle (tower_energyet, s1, s2, tower_eta);
256  rp[etHFm ]->addParticle (tower_energyet, s1, s2, tower_eta);
257  rp[etCaloHFP ]->addParticle (tower_energyet, s1, s2, tower_eta);
258  rp[etCaloHFM ]->addParticle (tower_energyet, s1, s2, tower_eta);
259 
260  rp[etHF3 ]->addParticle (tower_energyet, s13, s23, tower_eta);
261  rp[etHFp3 ]->addParticle (tower_energyet, s13, s23, tower_eta);
262  rp[etHFm3 ]->addParticle (tower_energyet, s13, s23, tower_eta);
263 
264  rp[etHF4 ]->addParticle (tower_energyet, s14, s24, tower_eta);
265  rp[etHFp4 ]->addParticle (tower_energyet, s14, s24, tower_eta);
266  rp[etHFm4 ]->addParticle (tower_energyet, s14, s24, tower_eta);
267 
268  rp[etHF5 ]->addParticle (tower_energyet, s15, s25, tower_eta);
269  rp[etHFp5 ]->addParticle (tower_energyet, s15, s25, tower_eta);
270  rp[etHFm5 ]->addParticle (tower_energyet, s15, s25, tower_eta);
271 
272  rp[etHF6 ]->addParticle (tower_energyet, s16, s26, tower_eta);
273  rp[etHFp6 ]->addParticle (tower_energyet, s16, s26, tower_eta);
274  rp[etHFm6 ]->addParticle (tower_energyet, s16, s26, tower_eta);
275  }
276  }
277  //Tracking part
278 
279  double track_eta;
280  double track_phi;
281  double track_pt;
282 
284  iEvent.getByToken(trackCollection_, tracks);
285 
286  if(tracks.isValid()){
287  for(reco::TrackCollection::const_iterator j = tracks->begin(); j != tracks->end(); j++){
288 
289  //Find possible collections with command line: edmDumpEventContent *.root
290 
292  iEvent.getByToken(vtxCollection_, vertex);
293 
294  // find the vertex point and error
295 
296  math::XYZPoint vtxPoint(0.0,0.0,0.0);
297  double vzErr =0.0, vxErr=0.0, vyErr=0.0;
298  if(vertex->size()>0) {
299  vtxPoint=vertex->begin()->position();
300  vzErr=vertex->begin()->zError();
301  vxErr=vertex->begin()->xError();
302  vyErr=vertex->begin()->yError();
303  }
304  bool accepted = true;
305  bool isPixel = false;
306  // determine if the track is a pixel track
307  if ( j->numberOfValidHits() < 7 ) isPixel = true;
308 
309  // determine the vertex significance
310  double d0=0.0, dz=0.0, d0sigma=0.0, dzsigma=0.0;
311  d0 = -1.*j->dxy(vtxPoint);
312  dz = j->dz(vtxPoint);
313  d0sigma = sqrt(j->d0Error()*j->d0Error()+vxErr*vyErr);
314  dzsigma = sqrt(j->dzError()*j->dzError()+vzErr*vzErr);
315 
316  // cuts for pixel tracks
317  if( isPixel )
318  {
319  // dz significance cut
320  if ( fabs(dz/dzsigma) > dzerr_ ) accepted = false;
321 
322  // chi2/ndof cut
323  if ( j->normalizedChi2() > chi2_ ) accepted = false;
324  }
325 
326  // cuts for full tracks
327  if ( ! isPixel)
328  {
329  // dz and d0 significance cuts
330  if ( fabs(dz/dzsigma) > 3 ) accepted = false;
331  if ( fabs(d0/d0sigma) > 3 ) accepted = false;
332 
333  // pt resolution cut
334  if ( j->ptError()/j->pt() > 0.05 ) accepted = false;
335 
336  // number of valid hits cut
337  if ( j->numberOfValidHits() < 12 ) accepted = false;
338  }
339  if( accepted ) {
340  track_eta = j->eta();
341  track_phi = j->phi();
342  track_pt = j->pt();
343  double s =sin(2*track_phi);
344  double c =cos(2*track_phi);
345  double s3 =sin(3*track_phi);
346  double c3 =cos(3*track_phi);
347  double s4 =sin(4*track_phi);
348  double c4 =cos(4*track_phi);
349  double s5 =sin(5*track_phi);
350  double c5 =cos(5*track_phi);
351  double s6 =sin(6*track_phi);
352  double c6 =cos(6*track_phi);
353  double w = 1;
354  if(useTrackPtWeight_) {
355  w = track_pt;
356  if(w>2.5) w=2.0; //v2 starts decreasing above ~2.5 GeV/c
357  }
358  if(track_pt<minpt_) continue;
359  if(track_pt>maxpt_) continue;
360  rp[EvtPlaneFromTracksMidEta]->addParticle(w,s,c,track_eta);
361  rp[EvtPTracksPosEtaGap]->addParticle(w,s,c,track_eta);
362  rp[EvtPTracksNegEtaGap]->addParticle(w,s,c,track_eta);
363  rp[EPTracksMid3]->addParticle(w,s3,c3,track_eta);
364  rp[EPTracksPos3]->addParticle(w,s3,c3,track_eta);
365  rp[EPTracksNeg3]->addParticle(w,s3,c3,track_eta);
366  rp[EPTracksMid4]->addParticle(w,s4,c4,track_eta);
367  rp[EPTracksPos4]->addParticle(w,s4,c4,track_eta);
368  rp[EPTracksNeg4]->addParticle(w,s4,c4,track_eta);
369  rp[EPTracksMid5]->addParticle(w,s5,c5,track_eta);
370  rp[EPTracksPos5]->addParticle(w,s5,c5,track_eta);
371  rp[EPTracksNeg5]->addParticle(w,s5,c5,track_eta);
372  rp[EPTracksMid6]->addParticle(w,s6,c6,track_eta);
373  rp[EPTracksPos6]->addParticle(w,s6,c6,track_eta);
374  rp[EPTracksNeg6]->addParticle(w,s6,c6,track_eta);
375 
376  }
377 
378  }
379  }
380  }
381  std::auto_ptr<EvtPlaneCollection> evtplaneOutput(new EvtPlaneCollection);
382 
383  EvtPlane *ep[NumEPNames];
384 
385  double ang=-10;
386  double sv = 0;
387  double cv = 0;
388 
389  for(int i = 0; i<NumEPNames; i++) {
390  rp[i]->getAngle(ang,sv,cv);
391  if(storeNames_) ep[i] = new EvtPlane(ang,sv,cv,EPNames[i]);
392  else ep[i] = new EvtPlane(ang,sv,cv,"");
393  }
394  if(useTrack_) {
395  for(int i = 0; i<9; i++) {
396  evtplaneOutput->push_back(*ep[i]);
397  }
398  }
399  for(int i = 9; i<NumEPNames; i++) {
400  if(useECAL_ && !useHCAL_) {
401  if(EPNames[i].rfind("Ecal")!=string::npos) {
402  evtplaneOutput->push_back(*ep[i]);
403  }
404  } else if (useHCAL_ && !useECAL_) {
405  if(EPNames[i].rfind("Hcal")!=string::npos) {
406  evtplaneOutput->push_back(*ep[i]);
407  }
408  }else if (useECAL_ && useHCAL_) {
409  evtplaneOutput->push_back(*ep[i]);
410  }
411  }
412 
413  iEvent.put(evtplaneOutput, "recoLevel");
414  // storeNames_ = 0;
415 }
double getAngle(double &ang, double &sv, double &cv)
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< reco::VertexCollection > vtxCollection_
const double w
Definition: UKUtility.cc:23
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< CaloTower >::const_iterator const_iterator
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
const std::string EPNames[]
tuple s2
Definition: indexGen.py:106
GenPlane * rp[NumEPNames]
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< EvtPlane > EvtPlaneCollection
Definition: EvtPlane.h:33
int j
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< CaloTowerCollection > caloCollection_
bool isValid() const
Definition: HandleBase.h:75
dictionary cv
Definition: cuy.py:362
edm::EDGetTokenT< reco::TrackCollection > trackCollection_
void addParticle(double w, double s, double c, double eta)
tuple tracks
Definition: testEve_cfg.py:39
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
static const int NumEPNames
void reset(double vett[256])
Definition: TPedValues.cc:11

Member Data Documentation

edm::EDGetTokenT<CaloTowerCollection> EvtPlaneProducer::caloCollection_
private

Definition at line 122 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::chi2_
private

Definition at line 135 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::dzerr_
private

Definition at line 134 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::maxet_
private

Definition at line 129 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::maxpt_
private

Definition at line 131 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::maxvtx_
private

Definition at line 133 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::minet_
private

Definition at line 128 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::minpt_
private

Definition at line 130 of file EvtPlaneProducer.cc.

double EvtPlaneProducer::minvtx_
private

Definition at line 132 of file EvtPlaneProducer.cc.

GenPlane* EvtPlaneProducer::rp[NumEPNames]
private

Definition at line 114 of file EvtPlaneProducer.cc.

bool EvtPlaneProducer::storeNames_
private

Definition at line 137 of file EvtPlaneProducer.cc.

edm::EDGetTokenT<reco::TrackCollection> EvtPlaneProducer::trackCollection_
private

Definition at line 123 of file EvtPlaneProducer.cc.

bool EvtPlaneProducer::useECAL_
private

Definition at line 124 of file EvtPlaneProducer.cc.

bool EvtPlaneProducer::useHCAL_
private

Definition at line 125 of file EvtPlaneProducer.cc.

bool EvtPlaneProducer::useTrack_
private

Definition at line 126 of file EvtPlaneProducer.cc.

bool EvtPlaneProducer::useTrackPtWeight_
private

Definition at line 127 of file EvtPlaneProducer.cc.

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

Definition at line 121 of file EvtPlaneProducer.cc.