CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FastL1CaloSim.cc
Go to the documentation of this file.
1 
2 // -*- C++ -*-
3 //
4 // Package: L1CaloTriggerProducer
5 // Class: FastL1CaloSim
6 //
14 //
15 // Original Author: Chi Nhan Nguyen
16 // Created: Mon Feb 19 13:25:24 CST 2007
17 // $Id: FastL1CaloSim.cc,v 1.12 2009/03/23 11:41:28 chinhan Exp $
18 //
19 //
20 
22 
23 
24 //
25 // constructors and destructor
26 //
28 {
29  //register your products
30  /* old labels
31  produces<l1extra::L1EtMissParticle>("MET");
32  produces<l1extra::L1JetParticleCollection>("TauJets");
33  produces<l1extra::L1JetParticleCollection>("CenJets");
34  produces<l1extra::L1JetParticleCollection>("ForJets");
35  produces<l1extra::L1EmParticleCollection>("Egammas");
36  produces<l1extra::L1EmParticleCollection>("isoEgammas");
37  */
38 
39  //produces<l1extra::L1EtMissParticle>();
40  produces<l1extra::L1EtMissParticleCollection>("MET");
41  produces<l1extra::L1JetParticleCollection>("Tau");
42  produces<l1extra::L1JetParticleCollection>("Central");
43  produces<l1extra::L1JetParticleCollection>("Forward");
44  produces<l1extra::L1EmParticleCollection>("NonIsolated");
45  produces<l1extra::L1EmParticleCollection>("Isolated");
46  produces<l1extra::L1MuonParticleCollection>(); // muon is dummy for L1extraParticleMap!
47 
48  m_AlgorithmSource = iConfig.getParameter<std::string>("AlgorithmSource");
49 
50  // No BitInfos for release versions
51  m_DoBitInfo = iConfig.getParameter<bool>("DoBitInfo");
52  if (m_DoBitInfo)
53  produces<FastL1BitInfoCollection>("L1BitInfos");
54 
55  m_FastL1GlobalAlgo = new FastL1GlobalAlgo(iConfig);
56 }
57 
59 {
60  delete m_FastL1GlobalAlgo;
61 }
62 
63 
64 //
65 // member functions
66 //
67 
68 // ------------ method called to produce the data ------------
69 void
71 {
72  //edm::LogInfo("FastL1CaloSim::produce()");
73 
74  if (m_AlgorithmSource == "RecHits") {
75  m_FastL1GlobalAlgo->FillL1Regions(iEvent, iSetup);
77  } else if (m_AlgorithmSource == "TrigPrims") {
78  m_FastL1GlobalAlgo->FillL1RegionsTP(iEvent,iSetup);
80  } else {
81  std::cerr<<"AlgorithmSource not valid: "<<m_AlgorithmSource<<std::endl;
82  return;
83  }
84  m_FastL1GlobalAlgo->FillMET(iEvent); // using CaloTowers
85  //m_FastL1GlobalAlgo->FillMET(); // using Regions
87 
88  if (m_DoBitInfo)
90 
91  //std::auto_ptr<l1extra::L1EtMissParticle> METResult(new l1extra::L1EtMissParticle);
92  std::auto_ptr<l1extra::L1EtMissParticleCollection> METResult(new l1extra::L1EtMissParticleCollection);
93  std::auto_ptr<l1extra::L1JetParticleCollection> TauJetResult(new l1extra::L1JetParticleCollection);
94  std::auto_ptr<l1extra::L1JetParticleCollection> CenJetResult(new l1extra::L1JetParticleCollection);
95  std::auto_ptr<l1extra::L1JetParticleCollection> ForJetResult(new l1extra::L1JetParticleCollection);
96  std::auto_ptr<l1extra::L1EmParticleCollection> EgammaResult(new l1extra::L1EmParticleCollection);
97  std::auto_ptr<l1extra::L1EmParticleCollection> isoEgammaResult(new l1extra::L1EmParticleCollection);
98  // muon is dummy!
99  std::auto_ptr<l1extra::L1MuonParticleCollection> muonDummy(new l1extra::L1MuonParticleCollection);
100  //
101  //*METResult = m_FastL1GlobalAlgo->getMET();
102  for (int i=0; i<(int)m_FastL1GlobalAlgo->getMET().size(); i++) {
103  METResult->push_back(m_FastL1GlobalAlgo->getMET().at(i));
104  }
105  for (int i=0; i<std::min(4,(int)m_FastL1GlobalAlgo->getTauJets().size()); i++) {
106  TauJetResult->push_back(m_FastL1GlobalAlgo->getTauJets().at(i));
107  }
108  for (int i=0; i<std::min(4,(int)m_FastL1GlobalAlgo->getCenJets().size()); i++) {
109  CenJetResult->push_back(m_FastL1GlobalAlgo->getCenJets().at(i));
110  }
111  for (int i=0; i<std::min(4,(int)m_FastL1GlobalAlgo->getForJets().size()); i++) {
112  ForJetResult->push_back(m_FastL1GlobalAlgo->getForJets().at(i));
113  }
114  for (int i=0; i<std::min(4,(int)m_FastL1GlobalAlgo->getEgammas().size()); i++) {
115  EgammaResult->push_back(m_FastL1GlobalAlgo->getEgammas().at(i));
116  }
117  for (int i=0; i<std::min(4,(int)m_FastL1GlobalAlgo->getisoEgammas().size()); i++) {
118  isoEgammaResult->push_back(m_FastL1GlobalAlgo->getisoEgammas().at(i));
119  }
120 
121  if (m_DoBitInfo) {
122  std::auto_ptr<FastL1BitInfoCollection> L1BitInfoResult(new FastL1BitInfoCollection);
123  for (int i=0; i<(int)m_FastL1GlobalAlgo->getBitInfos().size(); i++) {
124  L1BitInfoResult->push_back(m_FastL1GlobalAlgo->getBitInfos().at(i));
125  }
126  iEvent.put(L1BitInfoResult,"L1BitInfos");
127  }
128 
129  // put the collections into the event
130  /* old labels
131  iEvent.put(METResult,"MET");
132  iEvent.put(TauJetResult,"TauJets");
133  iEvent.put(CenJetResult,"CenJets");
134  iEvent.put(ForJetResult,"ForJets");
135  iEvent.put(EgammaResult,"Egammas");
136  iEvent.put(isoEgammaResult,"isoEgammas");
137  */
138  iEvent.put(METResult);
139  iEvent.put(TauJetResult,"Tau");
140  iEvent.put(CenJetResult,"Central");
141  iEvent.put(ForJetResult,"Forward");
142  iEvent.put(EgammaResult,"NonIsolated");
143  iEvent.put(isoEgammaResult,"Isolated");
144  iEvent.put(muonDummy);
145 
146 }
147 
148 //define this as a plug-in
T getParameter(std::string const &) const
int i
Definition: DBlmapReader.cc:9
l1extra::L1JetParticleCollection getForJets() const
l1extra::L1JetParticleCollection getCenJets() const
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
l1extra::L1EmParticleCollection getEgammas() const
std::vector< L1JetParticle > L1JetParticleCollection
std::vector< FastL1BitInfo > FastL1BitInfoCollection
Definition: FastL1BitInfo.h:86
std::string m_AlgorithmSource
Definition: FastL1CaloSim.h:51
void FillEgammas(edm::Event const &)
FastL1GlobalAlgo * m_FastL1GlobalAlgo
Definition: FastL1CaloSim.h:48
void FillEgammasTP(edm::Event const &)
l1extra::L1EtMissParticleCollection getMET() const
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
FastL1BitInfoCollection getBitInfos()
virtual void produce(edm::Event &, const edm::EventSetup &)
void FillJets(const edm::EventSetup &e)
void FillL1RegionsTP(edm::Event const &e, const edm::EventSetup &c)
void FillL1Regions(edm::Event const &e, const edm::EventSetup &c)
FastL1CaloSim(const edm::ParameterSet &)
l1extra::L1JetParticleCollection getTauJets() const
l1extra::L1EmParticleCollection getisoEgammas() const
std::vector< L1EtMissParticle > L1EtMissParticleCollection
std::vector< L1EmParticle > L1EmParticleCollection
std::vector< L1MuonParticle > L1MuonParticleCollection