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 Types | Private Member Functions | Private Attributes
EcalRawToRecHitRoI Class Reference

#include <EcalRawToRecHitRoI.h>

Inheritance diagram for EcalRawToRecHitRoI:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

Classes

class  CalUnpackJobPSet
 generic class to drive the job More...
 
class  CandJobPSet
 class to drive the job on Candidate-inheriting object More...
 
class  EmJobPSet
 class to drive the job on L1Em More...
 
class  JetJobPSet
 class to drive the job on L1Jet More...
 
class  MuJobPSet
 class to drive the job on L1Muon More...
 

Public Member Functions

 EcalRawToRecHitRoI (const edm::ParameterSet &pset)
 
void produce (edm::Event &e, const edm::EventSetup &c)
 
virtual ~EcalRawToRecHitRoI ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Types

typedef edm::LazyGetter
< EcalRecHit
EcalRecHitLazyGetter
 
typedef edm::RefGetter
< EcalRecHit
EcalRecHitRefGetter
 

Private Member Functions

void Cand (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
 
std::string dumpFEDs (const std::vector< int > &FEDs)
 
void Egamma (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
 
void Egamma_OneL1EmCollection (const edm::Handle< l1extra::L1EmParticleCollection > emColl, const EmJobPSet &ejpset, const edm::ESHandle< L1CaloGeometry > &l1CaloGeom, std::vector< int > &FEDs)
 process one collection of L1Em More...
 
void Jet (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
 
void Jet_OneL1JetCollection (const edm::Handle< l1extra::L1JetParticleCollection > jetColl, const JetJobPSet &jjpset, std::vector< int > &feds)
 process on collection of L1Jets More...
 
void ListOfFEDS (double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
 actually fill the vector with FED numbers More...
 
void Muon (edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
 
template<typename CollectionType >
void OneCandCollection (const edm::Event &e, const edm::EventSetup &es, const CandJobPSet &cjpset, std::vector< int > &feds)
 process one collection of Candidate-versatile objects More...
 
void unique (std::vector< int > &FEDs)
 remove duplicates More...
 

Private Attributes

bool All_
 if all need to be done More...
 
bool Candidate_
 Candidate-versatile objects part flag. More...
 
std::vector< CandJobPSetCandSource_
 what drives the job from candidate More...
 
bool do_es_
 
bool EGamma_
 Egamma part flag. More...
 
std::vector< EmJobPSetEmSource_
 what drive the job on L1Em collection More...
 
std::string esinstance_
 
bool Jet_
 jet part flag More...
 
std::vector< JetJobPSetJetSource_
 what drive the job on L1Jet collection More...
 
bool Muon_
 Muon part flag. More...
 
MuJobPSet MuonSource_
 what drives the job from ONE L1Muon collection More...
 
edm::InputTag sourceTag_
 input tag for the lazy getter More...
 
edm::InputTag sourceTag_es_
 
const ESElectronicsMapperTheESMapping
 
const EcalElectronicsMappingTheMapping
 tools More...
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
typedef WorkerT< EDProducerWorkerType
 
- 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)
 
- Protected Member Functions inherited from edm::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 39 of file EcalRawToRecHitRoI.h.

Member Typedef Documentation

Definition at line 41 of file EcalRawToRecHitRoI.h.

Definition at line 42 of file EcalRawToRecHitRoI.h.

Constructor & Destructor Documentation

EcalRawToRecHitRoI::EcalRawToRecHitRoI ( const edm::ParameterSet pset)

Definition at line 59 of file EcalRawToRecHitRoI.cc.

References All_, Candidate_, CandSource_, category(), do_es_, edm::ParameterSet::dump(), EGamma_, EmSource_, esinstance_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), Jet_, JetSource_, LogDebug, Muon_, MuonSource_, sourceTag_, and sourceTag_es_.

59  :
60  EGamma_(false), Muon_(false), Jet_(false), Candidate_(false), All_(false){
61  const std::string category = "EcalRawToRecHit|RoI";
62 
63  sourceTag_=pset.getParameter<edm::InputTag>("sourceTag");
64 
65  std::string type = pset.getParameter<std::string>("type");
66 
67  if (type.find("candidate")!=std::string::npos){
68  LogDebug(category)<<"configured for candidate-versatile input.";
69  Candidate_ = true;
70  std::vector<edm::ParameterSet> emPSet = pset.getParameter<std::vector<edm::ParameterSet> >("CandJobPSet");
71  for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
72  CandSource_.push_back(CandJobPSet(*iepset));
73  LogDebug(category)<<iepset->dump();
74  }
75  }
76 
77  if (type.find("muon")!=std::string::npos){
78  LogDebug(category)<<"configured for L1MuonParticleCollection input.";
79  Muon_ = true;
80  edm::ParameterSet ps = pset.getParameter<edm::ParameterSet>("MuJobPSet");
81  MuonSource_ = MuJobPSet(ps);
82  LogDebug(category)<<ps.dump();
83  }
84 
85  if (type.find("egamma")!=std::string::npos){
86  LogDebug(category)<<"configured for L1EMParticleCollection input.";
87  EGamma_ = true;
88  std::vector<edm::ParameterSet> emPSet = pset.getParameter<std::vector<edm::ParameterSet> >("EmJobPSet");
89  for (std::vector<edm::ParameterSet>::iterator iepset = emPSet.begin(); iepset!=emPSet.end();++iepset){
90  EmSource_.push_back(EmJobPSet(*iepset));
91  LogDebug(category)<<iepset->dump();
92  }
93  }
94 
95  if (type.find("jet")!=std::string::npos){
96  LogDebug(category)<<"configured for L1JetParticleCollection input.";
97  Jet_ =true;
98  std::vector<edm::ParameterSet> jetPSet = pset.getParameter<std::vector<edm::ParameterSet> >("JetJobPSet");
99  for (std::vector<edm::ParameterSet>::iterator ijpset = jetPSet.begin(); ijpset!=jetPSet.end();++ijpset){
100  JetSource_.push_back(JetJobPSet(*ijpset));
101  LogDebug(category)<<ijpset->dump();
102  }
103  }
104 
105  if (type.find("all")!=std::string::npos){
106  LogDebug(category)<<"configured for ALL feds unpacking";
107  All_ = true;
108  }
109 
110  if (!All_ && !Muon_ && !EGamma_ && !Jet_ && !Candidate_){
111  edm::LogError("IncorrectConfiguration")<<"I have no specified type of work."
112  <<"\nI will produce empty list of FEDs."
113  <<"\nI will produce an empty EcalRecHitRefGetter."
114  <<"\n I am sure you don't want that.";
115  //throw. this is a typo/omittion in a cfg.
116  }
117 
118  produces<EcalListOfFEDS>();
119  produces<EcalRecHitRefGetter>();
120 
121  if (pset.exists("doES"))
122  do_es_ = pset.getParameter<bool>("doES");
123  else
124  do_es_ = false;
125 
126  if (do_es_) {
127  LogDebug(category)<<"will also make the list of FEDs for the ES.";
128  sourceTag_es_=pset.getParameter<edm::InputTag>("sourceTag_es");
129  esinstance_=pset.getUntrackedParameter<std::string>("esInstance","es");
130  if (esinstance_=="")
131  edm::LogError("IncorrectConfiguration")<<" instance name for ES region and FED list cannot be empty. expect a fwk failure.";
132  produces<ESListOfFEDS>(esinstance_);
133  produces<EcalRecHitRefGetter>(esinstance_);
134  }
135 }
#define LogDebug(id)
bool Candidate_
Candidate-versatile objects part flag.
type
Definition: HCALResponse.h:22
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
MuJobPSet MuonSource_
what drives the job from ONE L1Muon collection
bool exists(std::string const &parameterName) const
checks if a parameter exists
bool Muon_
Muon part flag.
std::vector< JetJobPSet > JetSource_
what drive the job on L1Jet collection
std::vector< EmJobPSet > EmSource_
what drive the job on L1Em collection
edm::InputTag sourceTag_es_
std::vector< CandJobPSet > CandSource_
what drives the job from candidate
edm::InputTag sourceTag_
input tag for the lazy getter
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
bool All_
if all need to be done
bool EGamma_
Egamma part flag.
bool Jet_
jet part flag
std::string dump() const
EcalRawToRecHitRoI::~EcalRawToRecHitRoI ( )
virtual

Definition at line 139 of file EcalRawToRecHitRoI.cc.

139  {
140 }

Member Function Documentation

void EcalRawToRecHitRoI::Cand ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
)
private

Definition at line 275 of file EcalRawToRecHitRoI.cc.

References EcalRawToRecHitRoI::CandJobPSet::candidate, CandSource_, category(), EcalRawToRecHitRoI::CandJobPSet::chargedcandidate, dumpFEDs(), reco_application_2006h2rawdata_ecalLocalReco_cfg::FEDs, EcalRawToRecHitRoI::CandJobPSet::l1jet, EcalRawToRecHitRoI::CandJobPSet::l1muon, LogDebug, unique(), and EcalRawToRecHitRoI::CandJobPSet::view.

Referenced by produce().

275  {
276  const std::string category ="EcalRawToRecHit|Cand";
277 
278  unsigned int nc=CandSource_.size();
279  for (unsigned int ic=0;ic!=nc;++ic){
280  switch (CandSource_[ic].cType){
281  case CandJobPSet::view :
282  OneCandCollection< edm::View<reco::Candidate> >(e, es, CandSource_[ic], FEDs);
283  break;
284 
286  OneCandCollection<reco::CandidateCollection>(e, es, CandSource_[ic], FEDs);
287  break;
288 
290  OneCandCollection<reco::RecoChargedCandidateCollection>(e, es, CandSource_[ic], FEDs);
291  break;
292 
293  case CandJobPSet::l1muon :
294  OneCandCollection<L1MuonParticleCollection>(e, es, CandSource_[ic], FEDs);
295  break;
296 
297  case CandJobPSet::l1jet :
298  OneCandCollection<L1JetParticleCollection>(e, es, CandSource_[ic], FEDs);
299  break;
300 
301  default:
302  edm::LogError("IncorrectRecHit")<<"cType not recognised: "<<CandSource_[ic].cType;
303  }
304  }
305 
306  unique(FEDs);
307  LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
308 }
#define LogDebug(id)
void unique(std::vector< int > &FEDs)
remove duplicates
std::string dumpFEDs(const std::vector< int > &FEDs)
std::vector< CandJobPSet > CandSource_
what drives the job from candidate
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
std::string EcalRawToRecHitRoI::dumpFEDs ( const std::vector< int > &  FEDs)
private

Definition at line 145 of file EcalRawToRecHitRoI.cc.

References i.

Referenced by Cand(), Egamma(), Jet(), ListOfFEDS(), Muon(), and produce().

145  {
146  std::stringstream ss;
147  ss<<"unpack FED: ";
148  for (unsigned int i=0; i < FEDs.size(); i++) {
149  ss<< FEDs[i] << ((i!= FEDs.size()-1)? ", ":"\n");
150  }
151  ss<< "Number of FEDS is " << FEDs.size();
152  return ss.str();
153 }
int i
Definition: DBlmapReader.cc:9
void EcalRawToRecHitRoI::Egamma ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
)
private

Definition at line 333 of file EcalRawToRecHitRoI.cc.

References category(), dumpFEDs(), Egamma_OneL1EmCollection(), EmSource_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::HandleBase::isValid(), LogDebug, python.Vispa.Plugins.EdmBrowser.EdmDataAccessor::ne(), popcon_last_value_cfg::Source, and unique().

Referenced by produce().

333  {
334  const std::string category = "EcalRawToRecHit|Egamma";
335 
336  LogDebug(category)<< " enter in EcalRawToRecHitRoI::Egamma";
337 
338  // Get the CaloGeometry
339  edm::ESHandle<L1CaloGeometry> l1CaloGeom ;
340  es.get<L1CaloGeometryRecord>().get(l1CaloGeom) ;
341 
343  unsigned int ne=EmSource_.size();
344  for (unsigned int ie=0;ie!=ne;++ie){
345  e.getByLabel(EmSource_[ie].Source,emColl);
346  if (!emColl.isValid()){edm::LogError("IncorrectConfiguration")<<"L1Em Collection: "<<EmSource_[ie].Source<<" is not valid.";continue;}
347 
348  Egamma_OneL1EmCollection(emColl,EmSource_[ie],l1CaloGeom,FEDs);
349  }
350 
351  unique(FEDs);
352  LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
353  return;
354 }
#define LogDebug(id)
void unique(std::vector< int > &FEDs)
remove duplicates
std::string dumpFEDs(const std::vector< int > &FEDs)
std::vector< EmJobPSet > EmSource_
what drive the job on L1Em collection
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
void Egamma_OneL1EmCollection(const edm::Handle< l1extra::L1EmParticleCollection > emColl, const EmJobPSet &ejpset, const edm::ESHandle< L1CaloGeometry > &l1CaloGeom, std::vector< int > &FEDs)
process one collection of L1Em
const T & get() const
Definition: EventSetup.h:55
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void EcalRawToRecHitRoI::Egamma_OneL1EmCollection ( const edm::Handle< l1extra::L1EmParticleCollection emColl,
const EmJobPSet ejpset,
const edm::ESHandle< L1CaloGeometry > &  l1CaloGeom,
std::vector< int > &  FEDs 
)
private

process one collection of L1Em

Definition at line 310 of file EcalRawToRecHitRoI.cc.

References category(), ListOfFEDS(), LogDebug, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin.

Referenced by Egamma().

313  {
314  const std::string category = "EcalRawToRecHit|Egamma";
315  for( l1extra::L1EmParticleCollection::const_iterator emItr = emColl->begin();
316  emItr != emColl->end() ;++emItr ){
317  float pt = emItr -> pt();
318  if (pt < ejpset.Ptmin ) continue;
319  LogDebug(category)<<" Here is an L1 isoEM candidate of pt " << pt;
320  // Access the GCT hardware object corresponding to the L1Extra EM object.
321  int etaIndex = emItr->gctEmCand()->etaIndex() ;
322  int phiIndex = emItr->gctEmCand()->phiIndex() ;
323  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
324  double etaLow = l1CaloGeom->etaBinLowEdge( etaIndex ) ;
325  double etaHigh = l1CaloGeom->etaBinHighEdge( etaIndex ) ;
326  double phiLow = l1CaloGeom->emJetPhiBinLowEdge( phiIndex ) ;
327  double phiHigh = l1CaloGeom->emJetPhiBinHighEdge( phiIndex ) ;
328 
329  ListOfFEDS(etaLow, etaHigh, phiLow, phiHigh, ejpset.regionEtaMargin, ejpset.regionPhiMargin,FEDs);
330  }
331 }
#define LogDebug(id)
void ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
actually fill the vector with FED numbers
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void EcalRawToRecHitRoI::Jet ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
)
private

Definition at line 408 of file EcalRawToRecHitRoI.cc.

References category(), dumpFEDs(), edm::Event::getByLabel(), edm::HandleBase::isValid(), Jet_OneL1JetCollection(), JetSource_, LogDebug, popcon_last_value_cfg::Source, and unique().

Referenced by produce().

408  {
409  const std::string category = "EcalRawToRecHit|Jet";
410 
412  unsigned int nj=JetSource_.size();
413  for (unsigned int ij=0;ij!=nj;++ij){
414  e.getByLabel(JetSource_[ij].Source,jetColl);
415  if (!jetColl.isValid()) {
416  edm::LogError("IncorrectConfiguration") << "L1Jet collection: " << JetSource_[ij].Source << " is not valid.";
417  continue;
418  }
419 
421  }
422 
423  unique(FEDs);
424  LogDebug(category)<<"unpack FED\n"<<dumpFEDs(FEDs);
425 }
#define LogDebug(id)
void unique(std::vector< int > &FEDs)
remove duplicates
std::vector< JetJobPSet > JetSource_
what drive the job on L1Jet collection
std::string dumpFEDs(const std::vector< int > &FEDs)
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void Jet_OneL1JetCollection(const edm::Handle< l1extra::L1JetParticleCollection > jetColl, const JetJobPSet &jjpset, std::vector< int > &feds)
process on collection of L1Jets
void EcalRawToRecHitRoI::Jet_OneL1JetCollection ( const edm::Handle< l1extra::L1JetParticleCollection jetColl,
const JetJobPSet jjpset,
std::vector< int > &  feds 
)
private

process on collection of L1Jets

Definition at line 390 of file EcalRawToRecHitRoI.cc.

References category(), EcalRawToRecHitRoI::JetJobPSet::epsilon, eta(), ListOfFEDS(), LogDebug, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin.

Referenced by Jet().

392  {
393  const std::string category ="EcalRawToRecHit|Jet";
394  for (L1JetParticleCollection::const_iterator it=jetColl->begin(); it != jetColl->end(); it++) {
395  double pt = it -> pt();
396  double eta = it -> eta();
397  double phi = it -> phi();
398 
399  LogDebug(category) << " here is a L1 CentralJet Seed with (eta,phi) = "
400  << eta << " " << phi << " and pt " << pt;
401 
402  if (pt < jjpset.Ptmin ) continue;
403 
404  ListOfFEDS(eta, eta, phi-jjpset.epsilon, phi+jjpset.epsilon, jjpset.regionEtaMargin, jjpset.regionPhiMargin,feds);
405  }
406 }
#define LogDebug(id)
T eta() const
void ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
actually fill the vector with FED numbers
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
Definition: DDAxes.h:10
void EcalRawToRecHitRoI::ListOfFEDS ( double  etaLow,
double  etaHigh,
double  phiLow,
double  phiHigh,
double  etamargin,
double  phimargin,
std::vector< int > &  FEDs 
)
private

actually fill the vector with FED numbers

Definition at line 430 of file EcalRawToRecHitRoI.cc.

References cond::ecalcond::all, category(), createTree::dd, dumpFEDs(), LogDebug, Geom::pi(), and TheMapping.

Referenced by Egamma_OneL1EmCollection(), Jet_OneL1JetCollection(), Muon(), and OneCandCollection().

433 {
434  const std::string category = "EcalRawToRecHit|ListOfFEDS";
435 
436  if (phimargin > Geom::pi()) phimargin = Geom::pi() ;
437 
438 
439  LogDebug(category)<< " etaLow etaHigh phiLow phiHigh " << etaLow << " "
440  <<etaHigh << " " << phiLow << " " << phiHigh;
441 
442 
443  etaLow -= etamargin;
444  etaHigh += etamargin;
445  double phiMinus = phiLow - phimargin;
446  double phiPlus = phiHigh + phimargin;
447 
448  bool all = false;
449  double dd = fabs(phiPlus-phiMinus);
450  LogDebug(category)<< " dd = " << dd;
451  if (dd > 2.*Geom::pi() ) all = true;
452 
453  while (phiPlus > Geom::pi()) { phiPlus -= 2.*Geom::pi() ; }
454  while (phiMinus < 0) { phiMinus += 2.*Geom::pi() ; }
455  if ( phiMinus > Geom::pi()) phiMinus -= 2.*Geom::pi() ;
456 
457  double dphi = phiPlus - phiMinus;
458  if (dphi < 0) dphi += 2.*Geom::pi() ;
459  LogDebug(category) << "dphi = " << dphi;
460  if (dphi > Geom::pi()) {
461  int fed_low1 = TheMapping -> GetFED(etaLow,phiMinus*180./Geom::pi());
462  int fed_low2 = TheMapping -> GetFED(etaLow,phiPlus*180./Geom::pi());
463  LogDebug(category) << "fed_low1 fed_low2 " << fed_low1 << " " << fed_low2;
464  if (fed_low1 == fed_low2) all = true;
465  int fed_hi1 = TheMapping -> GetFED(etaHigh,phiMinus*180./Geom::pi());
466  int fed_hi2 = TheMapping -> GetFED(etaHigh,phiPlus*180./Geom::pi());
467  LogDebug(category) << "fed_hi1 fed_hi2 " << fed_hi1 << " " << fed_hi2;
468  if (fed_hi1 == fed_hi2) all = true;
469  }
470 
471 
472  if (all) {
473  LogDebug(category)<< " unpack everything in phi ! ";
474  phiMinus = -20 * Geom::pi() / 180.; // -20 deg
475  phiPlus = -40 * Geom::pi() / 180.; // -20 deg
476  }
477 
478  LogDebug(category) << " with margins : " << etaLow << " " << etaHigh << " "
479  << phiMinus << " " << phiPlus;
480 
481 
482  const EcalEtaPhiRegion ecalregion(etaLow,etaHigh,phiMinus,phiPlus);
483 
484  TheMapping -> GetListofFEDs(ecalregion, FEDs);
485  LogDebug(category)<<"unpack fed:\n"<<dumpFEDs(FEDs);
486 
487 }
#define LogDebug(id)
std::string dumpFEDs(const std::vector< int > &FEDs)
const EcalElectronicsMapping * TheMapping
tools
double pi()
Definition: Pi.h:31
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
void EcalRawToRecHitRoI::Muon ( edm::Event e,
const edm::EventSetup es,
std::vector< int > &  FEDs 
)
private

Definition at line 357 of file EcalRawToRecHitRoI.cc.

References category(), dumpFEDs(), EcalRawToRecHitRoI::MuJobPSet::epsilon, eta(), edm::HandleBase::failedToGet(), edm::Event::getByLabel(), ListOfFEDS(), LogDebug, MuonSource_, phi, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::Source, and unique().

Referenced by produce().

357  {
358  const std::string category = "EcalRawToRecHit|Muon";
359 
360  LogDebug(category)<< " enter in EcalRawToRecHitRoI::Muon";
361 
363  e.getByLabel(MuonSource_.Source, muColl);
364  if (muColl.failedToGet())
365  {
366  edm::LogError("IncorrectConfiguration")<<" could not retrieve the l1 muon collection from: "<<MuonSource_.Source;
367  return;
368  }
369 
370  for (L1MuonParticleCollection::const_iterator it=muColl->begin(); it != muColl->end(); it++) {
371 
372  const L1MuGMTExtendedCand muonCand = (*it).gmtMuonCand();
373  double pt = (*it).pt();
374  double eta = (*it).eta();
375  double phi = (*it).phi();
376 
377  LogDebug(category)<<" here is a L1 muon Seed with (eta,phi) = "
378  <<eta << " " << phi << " and pt " << pt;
379  if (pt < MuonSource_.Ptmin) continue;
380 
382  }
383 
384  unique(FEDs);
385  LogDebug(category)<<"end of get list of feds\n"<<dumpFEDs(FEDs);
386 
387  return;
388 }
#define LogDebug(id)
void unique(std::vector< int > &FEDs)
remove duplicates
MuJobPSet MuonSource_
what drives the job from ONE L1Muon collection
std::string dumpFEDs(const std::vector< int > &FEDs)
T eta() const
void ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
actually fill the vector with FED numbers
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
bool failedToGet() const
Definition: HandleBase.h:80
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
Definition: DDAxes.h:10
template<typename CollectionType >
void EcalRawToRecHitRoI::OneCandCollection ( const edm::Event e,
const edm::EventSetup es,
const CandJobPSet cjpset,
std::vector< int > &  feds 
)
private

process one collection of Candidate-versatile objects

Definition at line 167 of file EcalRawToRecHitRoI.h.

References EcalRawToRecHitRoI::CandJobPSet::bePrecise, category(), EcalRawToRecHitRoI::CandJobPSet::cType, end, EcalRawToRecHitRoI::CandJobPSet::epsilon, eta(), edm::HandleBase::failedToGet(), edm::EventSetup::get(), edm::Event::getByLabel(), ListOfFEDS(), LogDebug, dbtoconf::out, phi, point, edm::ESHandle< class >::product(), EcalRawToRecHitRoI::CandJobPSet::propagatorNameToBePrecise, EcalRawToRecHitRoI::CalUnpackJobPSet::Ptmin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionEtaMargin, EcalRawToRecHitRoI::CalUnpackJobPSet::regionPhiMargin, and EcalRawToRecHitRoI::CalUnpackJobPSet::Source.

170  {
171  const std::string category ="EcalRawToRecHit|Cand";
172 
174  e.getByLabel(cjpset.Source, candColl);
175  if (candColl.failedToGet()) {
176  edm::LogError("IncorrectConfiguration")<<"could not get: "<<cjpset.Source<<" of type: "<<cjpset.cType;
177  return;
178  }
179 
180  typename CollectionType::const_iterator it = candColl->begin();
181  typename CollectionType::const_iterator end= candColl->end();
182 
183  StateOnTrackerBound * onBounds=0;
185  if (cjpset.bePrecise){
186  // grab a propagator from ES
187  es.get<TrackingComponentsRecord>().get(cjpset.propagatorNameToBePrecise, propH);
188  // make the extrapolator object
189  onBounds = new StateOnTrackerBound(propH.product());
190  }
191 
192  for (; it!=end;++it){
193  double pt = it->pt();
194  double eta = it->eta();
195  double phi = it->phi();
196  if (cjpset.bePrecise){
197  // starting FTS
198  GlobalPoint point(it->vx(),it->vy(),it->vz());
199  GlobalVector vector(it->px(),it->py(),it->pz());
200 
201  if (point.mag()==0 && vector.mag()==0){
202  edm::LogWarning("IncorrectRecHit")<<" state of candidate is not valid. skipping.";
203  continue;
204  }
205 
206  FreeTrajectoryState fts(point, vector, it->charge(), propH->magneticField());
207  // final TSOS
208  TrajectoryStateOnSurface out = (*onBounds)(fts);
209  if (out.isValid()){
210  vector=out.globalMomentum();
211  point=out.globalPosition();
212  // be more precise
213  pt= vector.perp();
214  eta= point.eta();
215  phi= point.phi();
216  }
217  else{edm::LogWarning("IncorrectRecHit")<<"I tried to be precise, but propagation failed. from:\n"<<fts;
218  continue;}
219  }
220 
221  LogDebug(category)<<" here is a candidate Seed with (eta,phi) = "
222  <<eta << " " << phi << " and pt " << pt;
223  if (pt < cjpset.Ptmin) continue;
224 
225  ListOfFEDS(eta, eta, phi-cjpset.epsilon, phi+cjpset.epsilon, cjpset.regionEtaMargin, cjpset.regionPhiMargin,feds);
226  }
227  if(cjpset.bePrecise){delete onBounds;}
228 }
#define LogDebug(id)
T eta() const
void ListOfFEDS(double etaLow, double etaHigh, double phiLow, double phiHigh, double etamargin, double phimargin, std::vector< int > &FEDs)
actually fill the vector with FED numbers
#define end
Definition: vmac.h:38
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
tuple out
Definition: dbtoconf.py:99
bool failedToGet() const
Definition: HandleBase.h:80
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
Definition: DDAxes.h:10
void EcalRawToRecHitRoI::produce ( edm::Event e,
const edm::EventSetup c 
)
virtual

Implements edm::EDProducer.

Definition at line 155 of file EcalRawToRecHitRoI.cc.

References All_, Cand(), Candidate_, category(), do_es_, dumpFEDs(), Egamma(), EGamma_, esinstance_, edm::HandleBase::failedToGet(), edm::EventSetup::get(), edm::Event::getByLabel(), ESElectronicsMapper::GetListofFEDs(), i, Jet(), Jet_, MyWatcher::lap(), LogDebug, FEDNumbering::MINECALFEDID, Muon(), Muon_, edm::Event::put(), sourceTag_, sourceTag_es_, TheESMapping, and TheMapping.

Referenced by python.JSONExport.JsonExport::export(), and python.HTMLExport.HTMLExport::export().

155  {
156  const std::string category = "EcalRawToRecHit|RoI";
157  MyWatcher watcher("RoI");
158  LogDebug(category)<<watcher.lap();
159 
160  // retreive cabling
162  iSetup.get<EcalRegionCablingRecord>().get(cabling);
163  LogDebug(category)<<"cabling retrieved."
164  <<watcher.lap();
165  TheMapping =cabling->mapping();
166  TheESMapping =cabling->es_mapping();
167 
168  std::auto_ptr<EcalListOfFEDS> productAddress(new EcalListOfFEDS);
169  std::vector<int> feds; // the list of FEDS produced by this module
170 
171  if (EGamma_) { Egamma(e, iSetup, feds); }
172 
173  if (Muon_) { Muon(e, iSetup, feds); }
174 
175  if (Jet_) { Jet(e, iSetup, feds); }
176 
177  if (Candidate_) { Cand(e, iSetup, feds); }
178 
179  if (All_) { for (int i=1; i <= 54; feds.push_back(i++)){} }
180 
181  unsigned int nf = feds.size();
182  for (unsigned int i=0; i <nf; feds[i++]+=FEDNumbering::MINECALFEDID) {}
183 
184  LogDebug(category)<< "Will unpack Ecal FED\n" <<dumpFEDs(feds)
185  <<watcher.lap();
186 
187  // if (nf<1){edm::LogWarning(category)<<"no ECAL FED to unpack for Run " << e.id().run() << " Event " << e.id().event() ;}
188 
189  productAddress->SetList(feds);
190  e.put(productAddress);
191  LogDebug(category)<< "list of ECAL fed put in the event."
192  <<watcher.lap();
193 
194 
195  //now defined the Region of interest to be unpacked. from the feds list
196 
197 
198  //get the lazy gettters
200  e.getByLabel(sourceTag_, lgetter);
201  if (lgetter.failedToGet())
202  {
203  edm::LogError("IncorrectConfiguration")<<" could not retrieve the lazy getter from: "<<sourceTag_;
204  return;
205  }
206 
207  LogDebug(category)<<"Ecal lazy getter retrieved from: "<<sourceTag_
208  <<watcher.lap();
209 
210 
211  //prepare a refgetter
212  std::auto_ptr<EcalRecHitRefGetter> rgetter(new EcalRecHitRefGetter);
213  LogDebug(category)<<"ECal ref getter ready to be updated."
214  <<watcher.lap();
215 
216  for (unsigned int i=0;i!=nf;i++){
217  cabling->updateEcalRefGetterWithFedIndex(*rgetter, lgetter, feds[i]);
218  //cabling->updateEcalRefGetterWithElementIndex(*rgetter, lgetter, cabling->elementIndex(feds[i]));
219  }
220 
221  //put the refgetters in the event
222  LogDebug(category)<<"Ecal refGetter to be put in the event."
223  << watcher.lap();
224  e.put(rgetter);
225  LogDebug(category)<<"Ecal refGetter loaded."
226  << watcher.lap();
227 
228  //further process the ES if required
229  if (do_es_){
230  LogDebug(category)<< "Will make the ES list of FEDs at the same time."
231  <<watcher.lap();
232  std::auto_ptr<ESListOfFEDS> productAddressES(new ESListOfFEDS);
233  std::vector<int> es_feds = TheESMapping->GetListofFEDs(feds);
234 
235  LogDebug(category)<< "Will unpack ES FED\n" <<dumpFEDs(es_feds)
236  <<watcher.lap();
237 
238 
239  productAddressES->SetList(es_feds);
240  e.put(productAddressES,esinstance_);
241 
242 
243  LogDebug(category)<< "list of ES fed put in the event."
244  <<watcher.lap();
245 
247  e.getByLabel(sourceTag_es_, lgetter_es);
248  if (lgetter_es.failedToGet())
249  {
250  edm::LogError("IncorrectConfiguration")<<" could not retrieve the lazy getter from: "<<sourceTag_es_;
251  return;
252  }
253 
254  LogDebug(category)<<"ES lazy getter retrieved from: "<<sourceTag_es_
255  <<watcher.lap();
256 
257  std::auto_ptr<EcalRecHitRefGetter> rgetter_es(new EcalRecHitRefGetter);
258  LogDebug(category)<<"ES ref getter ready to be updated."
259  <<watcher.lap();
260 
261  unsigned int nf_es=es_feds.size();
262  for (unsigned int i=0;i!=nf_es;i++){
263  cabling->updateEcalRefGetterWithElementIndex(*rgetter_es, lgetter_es, cabling->esElementIndex(es_feds[i]));
264  }
265 
266  LogDebug(category)<<"ES refGetter to be put in the event."
267  << watcher.lap();
268  e.put(rgetter_es,esinstance_);
269  LogDebug(category)<<"ES refGetter loaded."
270  << watcher.lap();
271  }
272 
273 }
#define LogDebug(id)
bool Candidate_
Candidate-versatile objects part flag.
void Cand(edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
int i
Definition: DBlmapReader.cc:9
edm::RefGetter< EcalRecHit > EcalRecHitRefGetter
const ESElectronicsMapper * TheESMapping
bool Muon_
Muon part flag.
std::string dumpFEDs(const std::vector< int > &FEDs)
void Jet(edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
void Muon(edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
const EcalElectronicsMapping * TheMapping
tools
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:84
edm::InputTag sourceTag_es_
std::vector< int > GetListofFEDs(const std::vector< int > eeFEDs) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
bool failedToGet() const
Definition: HandleBase.h:80
edm::InputTag sourceTag_
input tag for the lazy getter
static const std::string category("Muon|RecoMuon|L3MuonCandidateProducerFromMuons")
bool All_
if all need to be done
void Egamma(edm::Event &e, const edm::EventSetup &es, std::vector< int > &FEDs)
bool EGamma_
Egamma part flag.
bool Jet_
jet part flag
void EcalRawToRecHitRoI::unique ( std::vector< int > &  FEDs)
inlineprivate

remove duplicates

Definition at line 160 of file EcalRawToRecHitRoI.h.

References python.multivaluedict::sort().

Referenced by Cand(), Egamma(), Jet(), and Muon().

160  {
161  std::sort(FEDs.begin(),FEDs.end());
162  std::vector<int>::iterator n_end = std::unique(FEDs.begin(),FEDs.end());
163  FEDs.erase(n_end,FEDs.end());}

Member Data Documentation

bool EcalRawToRecHitRoI::All_
private

if all need to be done

Definition at line 152 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

bool EcalRawToRecHitRoI::Candidate_
private

Candidate-versatile objects part flag.

Definition at line 130 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< CandJobPSet > EcalRawToRecHitRoI::CandSource_
private

what drives the job from candidate

Definition at line 149 of file EcalRawToRecHitRoI.h.

Referenced by Cand(), and EcalRawToRecHitRoI().

bool EcalRawToRecHitRoI::do_es_
private

Definition at line 60 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

bool EcalRawToRecHitRoI::EGamma_
private

Egamma part flag.

Definition at line 85 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< EmJobPSet > EcalRawToRecHitRoI::EmSource_
private

what drive the job on L1Em collection

Definition at line 98 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Egamma().

std::string EcalRawToRecHitRoI::esinstance_
private

Definition at line 62 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

bool EcalRawToRecHitRoI::Jet_
private

jet part flag

Definition at line 114 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

std::vector< JetJobPSet > EcalRawToRecHitRoI::JetSource_
private

what drive the job on L1Jet collection

Definition at line 127 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Jet().

bool EcalRawToRecHitRoI::Muon_
private

Muon part flag.

Definition at line 101 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

MuJobPSet EcalRawToRecHitRoI::MuonSource_
private

what drives the job from ONE L1Muon collection

Definition at line 111 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and Muon().

edm::InputTag EcalRawToRecHitRoI::sourceTag_
private

input tag for the lazy getter

Definition at line 59 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

edm::InputTag EcalRawToRecHitRoI::sourceTag_es_
private

Definition at line 61 of file EcalRawToRecHitRoI.h.

Referenced by EcalRawToRecHitRoI(), and produce().

const ESElectronicsMapper* EcalRawToRecHitRoI::TheESMapping
private

Definition at line 66 of file EcalRawToRecHitRoI.h.

Referenced by produce().

const EcalElectronicsMapping* EcalRawToRecHitRoI::TheMapping
private

tools

Definition at line 65 of file EcalRawToRecHitRoI.h.

Referenced by ListOfFEDS(), and produce().