CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch13/src/L1TriggerOffline/L1Analyzer/src/GtToGctCands.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    GtToGctCands
00004 // Class:      GtToGctCands
00005 // 
00011 //
00012 // Original Author:  Alex Tapper
00013 //         Created:  Mon Mar 30 17:31:03 CEST 2009
00014 // $Id: GtToGctCands.cc,v 1.6 2009/04/05 22:54:18 tapper Exp $
00015 //
00016 //
00017 
00018 #include "L1TriggerOffline/L1Analyzer/interface/GtToGctCands.h"
00019 #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h"
00020 
00021 GtToGctCands::GtToGctCands(const edm::ParameterSet& iConfig) :
00022   m_GTInputTag(iConfig.getParameter<edm::InputTag>("inputLabel"))
00023 {
00024   // For now I am making one collection from all 3 BXs.
00025   // This is the easiest format to analyse for CRAFT data.
00026   // In the future I should treat the mutiple BXs properly, and add energy sums.
00027 
00028   // list of products
00029   produces<L1GctEmCandCollection>("isoEm");
00030   produces<L1GctEmCandCollection>("nonIsoEm");
00031   produces<L1GctJetCandCollection>("cenJets");
00032   produces<L1GctJetCandCollection>("forJets");
00033   produces<L1GctJetCandCollection>("tauJets");
00034   produces<L1GctEtTotalCollection>();
00035   produces<L1GctEtHadCollection>();
00036   produces<L1GctEtMissCollection>();
00037   //  produces<L1GctHtMissCollection>();
00038   produces<L1GctHFBitCountsCollection>();
00039   produces<L1GctHFRingEtSumsCollection>();
00040 }
00041 
00042 GtToGctCands::~GtToGctCands(){}
00043 
00044 void GtToGctCands::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00045 {
00046   // create the em and jet collections
00047   std::auto_ptr<L1GctEmCandCollection>  isoEm    (new L1GctEmCandCollection);
00048   std::auto_ptr<L1GctEmCandCollection>  nonIsoEm (new L1GctEmCandCollection);
00049   std::auto_ptr<L1GctJetCandCollection> cenJet   (new L1GctJetCandCollection);
00050   std::auto_ptr<L1GctJetCandCollection> forJet   (new L1GctJetCandCollection);
00051   std::auto_ptr<L1GctJetCandCollection> tauJet   (new L1GctJetCandCollection);
00052 
00053   // create the energy sum digis
00054   std::auto_ptr<L1GctEtTotalCollection> etTot  (new L1GctEtTotalCollection);
00055   std::auto_ptr<L1GctEtHadCollection>   etHad  (new L1GctEtHadCollection);
00056   std::auto_ptr<L1GctEtMissCollection>  etMiss (new L1GctEtMissCollection);
00057 //  std::auto_ptr<L1GctHtMissCollection>  htMiss (new L1GctHtMissCollection));
00058 
00059   // create the Hf sums digis
00060   std::auto_ptr<L1GctHFBitCountsCollection>  hfBitCount  (new L1GctHFBitCountsCollection);
00061   std::auto_ptr<L1GctHFRingEtSumsCollection> hfRingEtSum (new L1GctHFRingEtSumsCollection);
00062 
00063   // Get GT data
00064   edm::Handle<L1GlobalTriggerReadoutRecord> gtrr_handle;
00065   iEvent.getByLabel(m_GTInputTag,gtrr_handle);
00066   L1GlobalTriggerReadoutRecord const* gtrr = gtrr_handle.product();
00067 
00068   // Loop over 3BXs (shouldn't be hard coded really) and get GT cands
00069   for (int ibx=-1; ibx<=1; ibx++) {
00070     const L1GtPsbWord psb1 = gtrr->gtPsbWord(0xbb0d, ibx); 
00071     const L1GtPsbWord psb2 = gtrr->gtPsbWord(0xbb0e, ibx); 
00072     
00073     // Isolated electrons
00074     std::vector<int> psbisoel;
00075     psbisoel.push_back(psb1.aData(6));
00076     psbisoel.push_back(psb1.aData(7));
00077     psbisoel.push_back(psb1.bData(6));
00078     psbisoel.push_back(psb1.bData(7));
00079     for(std::vector<int>::const_iterator ipsbisoel=psbisoel.begin(); ipsbisoel!=psbisoel.end(); ipsbisoel++) {
00080       isoEm->push_back(L1GctEmCand((*ipsbisoel),true)); 
00081     }
00082 
00083     // Non-isolated electrons
00084     std::vector<int> psbel;
00085     psbel.push_back(psb1.aData(4));
00086     psbel.push_back(psb1.aData(5));
00087     psbel.push_back(psb1.bData(4));
00088     psbel.push_back(psb1.bData(5));
00089     for(std::vector<int>::const_iterator ipsbel=psbel.begin(); ipsbel!=psbel.end(); ipsbel++) {
00090       nonIsoEm->push_back(L1GctEmCand((*ipsbel),false)); 
00091     }
00092 
00093     // Central jets
00094     std::vector<int> psbjet;
00095     psbjet.push_back(psb1.aData(2));
00096     psbjet.push_back(psb1.aData(3));
00097     psbjet.push_back(psb1.bData(2));
00098     psbjet.push_back(psb1.bData(3));
00099     for(std::vector<int>::const_iterator ipsbjet=psbjet.begin(); ipsbjet!=psbjet.end(); ipsbjet++) {
00100       cenJet->push_back(L1GctJetCand((*ipsbjet),false,false));
00101     }
00102 
00103     // Forward jets
00104     std::vector<int> psbfjet;
00105     psbfjet.push_back(psb1.aData(6));
00106     psbfjet.push_back(psb1.aData(7));
00107     psbfjet.push_back(psb1.bData(6));
00108     psbfjet.push_back(psb1.bData(7));
00109     for(std::vector<int>::const_iterator ipsbfjet=psbfjet.begin(); ipsbfjet!=psbfjet.end(); ipsbfjet++) {
00110       forJet->push_back(L1GctJetCand((*ipsbfjet),false,true));
00111     }
00112 
00113     // Tau jets
00114     std::vector<int> psbtjet;
00115     psbtjet.push_back(psb2.aData(6));
00116     psbtjet.push_back(psb2.aData(7));
00117     psbtjet.push_back(psb2.bData(6));
00118     psbtjet.push_back(psb2.bData(7));
00119     for(std::vector<int>::const_iterator ipsbtjet=psbtjet.begin(); ipsbtjet!=psbtjet.end(); ipsbtjet++) {
00120       tauJet->push_back(L1GctJetCand((*ipsbtjet),true,false));
00121     }
00122 
00123   }
00124   
00125   // put the collections into the event
00126   iEvent.put(isoEm,"isoEm");
00127   iEvent.put(nonIsoEm,"nonIsoEm");
00128   iEvent.put(cenJet,"cenJets");
00129   iEvent.put(forJet,"forJets");
00130   iEvent.put(tauJet,"tauJets");
00131   iEvent.put(etTot);
00132   iEvent.put(etHad);
00133   iEvent.put(etMiss);
00134 //  iEvent.put(htMiss);
00135   iEvent.put(hfBitCount);
00136   iEvent.put(hfRingEtSum);
00137 }