CMS 3D CMS Logo

L1RCTInputProducer Class Reference

#include <L1Trigger/RegionalCaloTrigger/interface/L1RCTInputProducer.h>

Inheritance diagram for L1RCTInputProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void beginJob (const edm::EventSetup &c)
 L1RCTInputProducer (const edm::ParameterSet &ps)
virtual void produce (edm::Event &e, const edm::EventSetup &c)
virtual ~L1RCTInputProducer ()

Private Attributes

edm::InputTag ecalDigisLabel
edm::InputTag hcalDigisLabel
L1RCTrct
L1RCTLookupTablesrctLookupTables
bool useEcal
bool useHcal


Detailed Description

Definition at line 20 of file L1RCTInputProducer.h.


Constructor & Destructor Documentation

L1RCTInputProducer::L1RCTInputProducer ( const edm::ParameterSet ps  )  [explicit]

Definition at line 30 of file L1RCTInputProducer.cc.

00030                                                                   : 
00031   rctLookupTables(new L1RCTLookupTables),
00032   rct(new L1RCT(rctLookupTables)),
00033   useEcal(conf.getParameter<bool>("useEcal")),
00034   useHcal(conf.getParameter<bool>("useHcal")),
00035   ecalDigisLabel(conf.getParameter<edm::InputTag>("ecalDigisLabel")),
00036   hcalDigisLabel(conf.getParameter<edm::InputTag>("hcalDigisLabel"))
00037 {
00038   produces<vector<unsigned short> >("rctCrate");
00039   produces<vector<unsigned short> >("rctCard");
00040   produces<vector<unsigned short> >("rctTower");
00041   produces<vector<unsigned int> >("rctEGammaET");
00042   produces<vector<bool> >("rctHoEFGVetoBit");
00043   produces<vector<unsigned int> >("rctJetMETET");
00044   produces<vector<bool> >("rctTowerActivityBit");
00045   produces<vector<bool> >("rctTowerMIPBit");
00046   produces<vector<unsigned short> >("rctHFCrate");
00047   produces<vector<unsigned short> >("rctHFRegion");
00048   produces<vector<unsigned int> >("rctHFET");
00049   produces<vector<bool> >("rctHFFG");
00050 }

L1RCTInputProducer::~L1RCTInputProducer (  )  [virtual]

Definition at line 52 of file L1RCTInputProducer.cc.

References rct, and rctLookupTables.

00053 {
00054   if(rct != 0) delete rct;
00055   if(rctLookupTables != 0) delete rctLookupTables;
00056 }


Member Function Documentation

void L1RCTInputProducer::beginJob ( const edm::EventSetup c  )  [virtual]

Reimplemented from edm::EDProducer.

Definition at line 58 of file L1RCTInputProducer.cc.

00059 {
00060 }

void L1RCTInputProducer::produce ( edm::Event e,
const edm::EventSetup c 
) [virtual]

Implements edm::EDProducer.

Definition at line 62 of file L1RCTInputProducer.cc.

References c, L1RCT::digiInput(), e, ReconstructionGR_cff::ecal, L1RCT::ecalCompressedET(), ecalDigisLabel, L1RCT::ecalFineGrainBit(), edm::EventSetup::get(), h, ReconstructionGR_cff::hcal, L1RCT::hcalCompressedET(), hcalDigisLabel, L1RCT::hfCompressedET(), edm::Handle< T >::isValid(), L1RCTLookupTables::lookup(), edm::ESHandle< T >::product(), r, rct, rctLookupTables, s, L1RCTLookupTables::setChannelMask(), L1RCTLookupTables::setEcalScale(), L1RCTLookupTables::setHcalScale(), L1RCTLookupTables::setL1CaloEtScale(), L1RCTLookupTables::setRCTParameters(), useEcal, and useHcal.

00063 {
00064 
00065   // Refresh configuration information every event
00066   // Hopefully, this does not take too much time
00067   // There should be a call back function in future to
00068   // handle changes in configuration
00069 
00070   edm::ESHandle<L1RCTParameters> rctParameters;
00071   eventSetup.get<L1RCTParametersRcd>().get(rctParameters);
00072   const L1RCTParameters* r = rctParameters.product();
00073   edm::ESHandle<L1RCTChannelMask> channelMask;
00074   eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
00075   const L1RCTChannelMask* c = channelMask.product();
00076   edm::ESHandle<L1CaloEcalScale> ecalScale;
00077   eventSetup.get<L1CaloEcalScaleRcd>().get(ecalScale);
00078   const L1CaloEcalScale* e = ecalScale.product();
00079   edm::ESHandle<L1CaloHcalScale> hcalScale;
00080   eventSetup.get<L1CaloHcalScaleRcd>().get(hcalScale);
00081   const L1CaloHcalScale* h = hcalScale.product();
00082   edm::ESHandle<L1CaloEtScale> emScale;
00083   eventSetup.get<L1EmEtScaleRcd>().get(emScale);
00084   const L1CaloEtScale* s = emScale.product();
00085 
00086   rctLookupTables->setRCTParameters(r);
00087   rctLookupTables->setChannelMask(c);
00088   rctLookupTables->setHcalScale(h);
00089   rctLookupTables->setEcalScale(e);
00090   rctLookupTables->setL1CaloEtScale(s);
00091 
00092   edm::Handle<EcalTrigPrimDigiCollection> ecal;
00093   edm::Handle<HcalTrigPrimDigiCollection> hcal;
00094   
00095   if (useEcal) { event.getByLabel(ecalDigisLabel, ecal); }
00096   if (useHcal) { event.getByLabel(hcalDigisLabel, hcal); }
00097 
00098   EcalTrigPrimDigiCollection ecalColl;
00099   HcalTrigPrimDigiCollection hcalColl;
00100   if (ecal.isValid()) { ecalColl = *ecal; }
00101   if (hcal.isValid()) { hcalColl = *hcal; }
00102 
00103   rct->digiInput(ecalColl, hcalColl);
00104 
00105   // Stuff to create
00106 
00107   std::auto_ptr<std::vector<unsigned short> > 
00108     rctCrate(new vector<unsigned short>);
00109   std::auto_ptr<std::vector<unsigned short> > 
00110     rctCard(new vector<unsigned short>);
00111   std::auto_ptr<std::vector<unsigned short> > 
00112     rctTower(new vector<unsigned short>);
00113   std::auto_ptr<std::vector<unsigned int> > 
00114     rctEGammaET(new vector<unsigned int>);
00115   std::auto_ptr<std::vector<bool> > rctHoEFGVetoBit(new vector<bool>);
00116   std::auto_ptr<std::vector<unsigned int> > 
00117     rctJetMETET(new vector<unsigned int>);
00118   std::auto_ptr<std::vector<bool> > rctTowerActivityBit(new vector<bool>);
00119   std::auto_ptr<std::vector<bool> > rctTowerMIPBit(new vector<bool>);
00120   
00121   for(int crate = 0; crate < 18; crate++) {
00122     for(int card = 0; card < 7; card++) {
00123       for(int tower = 0; tower < 32; tower++) {
00124         unsigned short ecalCompressedET = 
00125           rct->ecalCompressedET(crate, card, tower);
00126         unsigned short ecalFineGrainBit = 
00127           rct->ecalFineGrainBit(crate, card, tower);
00128         unsigned short hcalCompressedET = 
00129           rct->hcalCompressedET(crate, card, tower);
00130         unsigned int lutBits = 
00131           rctLookupTables->lookup(ecalCompressedET, hcalCompressedET, 
00132                                   ecalFineGrainBit, crate, card, tower);
00133         unsigned int eGammaETCode = lutBits & 0x0000007F;
00134         bool hOeFGVetoBit = (lutBits >> 7) & 0x00000001;
00135         unsigned int jetMETETCode = (lutBits >> 8) & 0x000001FF;
00136         bool activityBit = (lutBits >> 17) & 0x00000001;
00137         if(eGammaETCode > 0 || jetMETETCode > 0 || 
00138            hOeFGVetoBit || activityBit) {
00139           rctCrate->push_back(crate);
00140           rctCard->push_back(card);
00141           rctTower->push_back(tower);
00142           rctEGammaET->push_back(eGammaETCode);
00143           rctHoEFGVetoBit->push_back(hOeFGVetoBit);
00144           rctJetMETET->push_back(jetMETETCode);
00145           rctTowerActivityBit->push_back(activityBit);
00146           rctTowerMIPBit->push_back(0); // FIXME: MIP bit is not yet defined
00147         }
00148       }
00149     }
00150   }
00151 
00152   std::auto_ptr<std::vector<unsigned short> > 
00153     rctHFCrate(new vector<unsigned short>);
00154   std::auto_ptr<std::vector<unsigned short> > 
00155     rctHFRegion(new vector<unsigned short>);
00156   std::auto_ptr<std::vector<unsigned int> > rctHFET(new vector<unsigned int>);
00157   std::auto_ptr<std::vector<bool> > rctHFFG(new vector<bool>);
00158   for(int crate = 0; crate < 18; crate++) {
00159     for(int hfRegion = 0; hfRegion < 8; hfRegion++) {
00160       unsigned short hfCompressedET = rct->hfCompressedET(crate, hfRegion);
00161       unsigned int hfETCode = 
00162         rctLookupTables->lookup(hfCompressedET, crate, 999, hfRegion);
00163       if(hfETCode > 0) {
00164         rctHFCrate->push_back(crate);
00165         rctHFRegion->push_back(hfRegion);
00166         rctHFET->push_back(hfETCode);
00167         rctHFFG->push_back(0); // FIXME: HF FG is not yet defined
00168       }
00169     }
00170   }
00171 
00172   //putting stuff back into event
00173   event.put(rctCrate, "rctCrate");
00174   event.put(rctCard, "rctCard");
00175   event.put(rctTower, "rctTower");
00176   event.put(rctEGammaET, "rctEGammaET");
00177   event.put(rctHoEFGVetoBit, "rctHoEFGVetoBit");
00178   event.put(rctJetMETET, "rctJetMETET");
00179   event.put(rctTowerActivityBit, "rctTowerActivityBit");
00180   event.put(rctTowerMIPBit, "rctTowerMIPBit");
00181   event.put(rctHFCrate, "rctHFCrate");
00182   event.put(rctHFRegion, "rctHFRegion");
00183   event.put(rctHFET, "rctHFET");
00184   event.put(rctHFFG, "rctHFFG");
00185 
00186 }


Member Data Documentation

edm::InputTag L1RCTInputProducer::ecalDigisLabel [private]

Definition at line 32 of file L1RCTInputProducer.h.

Referenced by produce().

edm::InputTag L1RCTInputProducer::hcalDigisLabel [private]

Definition at line 33 of file L1RCTInputProducer.h.

Referenced by produce().

L1RCT* L1RCTInputProducer::rct [private]

Definition at line 29 of file L1RCTInputProducer.h.

Referenced by produce(), and ~L1RCTInputProducer().

L1RCTLookupTables* L1RCTInputProducer::rctLookupTables [private]

Definition at line 28 of file L1RCTInputProducer.h.

Referenced by produce(), and ~L1RCTInputProducer().

bool L1RCTInputProducer::useEcal [private]

Definition at line 30 of file L1RCTInputProducer.h.

Referenced by produce().

bool L1RCTInputProducer::useHcal [private]

Definition at line 31 of file L1RCTInputProducer.h.

Referenced by produce().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:57 2009 for CMSSW by  doxygen 1.5.4