CMS 3D CMS Logo

FastL1CaloSim.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    L1CaloTriggerProducer
00004 // Class:      FastL1CaloSim
00005 // 
00013 //
00014 // Original Author:  Chi Nhan Nguyen
00015 //         Created:  Mon Feb 19 13:25:24 CST 2007
00016 // $Id: FastL1CaloSim.cc,v 1.11 2008/06/16 16:47:51 chinhan Exp $
00017 //
00018 //
00019 
00020 #include "FastSimulation/L1CaloTriggerProducer/interface/FastL1CaloSim.h"
00021 
00022 
00023 //
00024 // constructors and destructor
00025 //
00026 FastL1CaloSim::FastL1CaloSim(const edm::ParameterSet& iConfig)
00027 {
00028   //register your products
00029   /* old labels
00030   produces<l1extra::L1EtMissParticle>("MET");
00031   produces<l1extra::L1JetParticleCollection>("TauJets");
00032   produces<l1extra::L1JetParticleCollection>("CenJets");
00033   produces<l1extra::L1JetParticleCollection>("ForJets");
00034   produces<l1extra::L1EmParticleCollection>("Egammas");
00035   produces<l1extra::L1EmParticleCollection>("isoEgammas");
00036   */
00037 
00038   produces<l1extra::L1EtMissParticle>();
00039   //produces<l1extra::L1EtMissParticleCollection>();
00040   produces<l1extra::L1JetParticleCollection>("Tau");
00041   produces<l1extra::L1JetParticleCollection>("Central");
00042   produces<l1extra::L1JetParticleCollection>("Forward");
00043   produces<l1extra::L1EmParticleCollection>("NonIsolated");
00044   produces<l1extra::L1EmParticleCollection>("Isolated");
00045   produces<l1extra::L1MuonParticleCollection>(); // muon is dummy for L1extraParticleMap!
00046 
00047   m_AlgorithmSource = iConfig.getParameter<std::string>("AlgorithmSource");
00048 
00049   // No BitInfos for release versions
00050   m_DoBitInfo = iConfig.getParameter<bool>("DoBitInfo");
00051   if (m_DoBitInfo)
00052     produces<FastL1BitInfoCollection>("FastL1BitInfos");
00053 
00054   m_L1GlobalAlgo = new FastL1GlobalAlgo(iConfig);
00055 }
00056 
00057 FastL1CaloSim::~FastL1CaloSim()
00058 {
00059   delete m_L1GlobalAlgo;
00060 }
00061 
00062 
00063 //
00064 // member functions
00065 //
00066 
00067 // ------------ method called to produce the data  ------------
00068 void
00069 FastL1CaloSim::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00070 {
00071   //edm::LogInfo("FastL1CaloSim::produce()");
00072 
00073   if (m_AlgorithmSource == "RecHits") {
00074     m_L1GlobalAlgo->FillL1Regions(iEvent, iSetup);
00075     m_L1GlobalAlgo->FillEgammas(iEvent);
00076   } else if (m_AlgorithmSource == "TrigPrims") {
00077     m_L1GlobalAlgo->FillL1RegionsTP(iEvent,iSetup);
00078     m_L1GlobalAlgo->FillEgammasTP(iEvent);
00079   } else {
00080     std::cerr<<"AlgorithmSource not valid: "<<m_AlgorithmSource<<std::endl;
00081     return;
00082   }
00083   //m_L1GlobalAlgo->FillMET(iEvent); // using CaloTowers
00084   m_L1GlobalAlgo->FillMET();     // using Regions
00085   m_L1GlobalAlgo->FillJets(iSetup);
00086   
00087   if (m_DoBitInfo)
00088     m_L1GlobalAlgo->FillBitInfos();
00089 
00090   std::auto_ptr<l1extra::L1EtMissParticle> METResult(new l1extra::L1EtMissParticle);
00091   //std::auto_ptr<l1extra::L1EtMissParticleCollection> METResult(new l1extra::L1EtMissParticleCollection);
00092   std::auto_ptr<l1extra::L1JetParticleCollection> TauJetResult(new l1extra::L1JetParticleCollection);
00093   std::auto_ptr<l1extra::L1JetParticleCollection> CenJetResult(new l1extra::L1JetParticleCollection);
00094   std::auto_ptr<l1extra::L1JetParticleCollection> ForJetResult(new l1extra::L1JetParticleCollection);
00095   std::auto_ptr<l1extra::L1EmParticleCollection> EgammaResult(new l1extra::L1EmParticleCollection);
00096   std::auto_ptr<l1extra::L1EmParticleCollection> isoEgammaResult(new l1extra::L1EmParticleCollection);
00097   // muon is dummy!
00098   std::auto_ptr<l1extra::L1MuonParticleCollection> muonDummy(new l1extra::L1MuonParticleCollection);
00099   //
00100   *METResult = m_L1GlobalAlgo->getMET();
00101   for (int i=0; i<std::min(4,(int)m_L1GlobalAlgo->getTauJets().size()); i++) {
00102     TauJetResult->push_back(m_L1GlobalAlgo->getTauJets().at(i));
00103   }
00104   for (int i=0; i<std::min(4,(int)m_L1GlobalAlgo->getCenJets().size()); i++) {
00105     CenJetResult->push_back(m_L1GlobalAlgo->getCenJets().at(i));
00106   }
00107   for (int i=0; i<std::min(4,(int)m_L1GlobalAlgo->getForJets().size()); i++) {
00108     ForJetResult->push_back(m_L1GlobalAlgo->getForJets().at(i));
00109   }
00110   for (int i=0; i<std::min(4,(int)m_L1GlobalAlgo->getEgammas().size()); i++) {
00111     EgammaResult->push_back(m_L1GlobalAlgo->getEgammas().at(i));
00112   }
00113   for (int i=0; i<std::min(4,(int)m_L1GlobalAlgo->getisoEgammas().size()); i++) {
00114     isoEgammaResult->push_back(m_L1GlobalAlgo->getisoEgammas().at(i));
00115   }
00116 
00117   if (m_DoBitInfo) {
00118   std::auto_ptr<FastL1BitInfoCollection> FastL1BitInfoResult(new FastL1BitInfoCollection);
00119     for (int i=0; i<(int)m_L1GlobalAlgo->getBitInfos().size(); i++) {
00120       FastL1BitInfoResult->push_back(m_L1GlobalAlgo->getBitInfos().at(i));
00121     }
00122     iEvent.put(FastL1BitInfoResult,"FastL1BitInfos");
00123   }
00124 
00125   // put the collections into the event
00126   /* old labels
00127   iEvent.put(METResult,"MET");
00128   iEvent.put(TauJetResult,"TauJets");
00129   iEvent.put(CenJetResult,"CenJets");
00130   iEvent.put(ForJetResult,"ForJets");
00131   iEvent.put(EgammaResult,"Egammas");
00132   iEvent.put(isoEgammaResult,"isoEgammas");
00133   */
00134   iEvent.put(METResult);
00135   iEvent.put(TauJetResult,"Tau");
00136   iEvent.put(CenJetResult,"Central");
00137   iEvent.put(ForJetResult,"Forward");
00138   iEvent.put(EgammaResult,"NonIsolated");
00139   iEvent.put(isoEgammaResult,"Isolated");
00140   iEvent.put(muonDummy);
00141 
00142 }
00143 
00144 
00145 //define this as a plug-in
00146 DEFINE_FWK_MODULE(FastL1CaloSim);

Generated on Tue Jun 9 17:35:09 2009 for CMSSW by  doxygen 1.5.4