CMS 3D CMS Logo

Public Member Functions | Private Attributes

L1RCTInputProducer Class Reference

#include <L1RCTInputProducer.h>

Inheritance diagram for L1RCTInputProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 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 19 of file L1RCTInputProducer.h.


Constructor & Destructor Documentation

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

Definition at line 30 of file L1RCTInputProducer.cc.

                                                                  : 
  rctLookupTables(new L1RCTLookupTables),
  rct(new L1RCT(rctLookupTables)),
  useEcal(conf.getParameter<bool>("useEcal")),
  useHcal(conf.getParameter<bool>("useHcal")),
  ecalDigisLabel(conf.getParameter<edm::InputTag>("ecalDigisLabel")),
  hcalDigisLabel(conf.getParameter<edm::InputTag>("hcalDigisLabel"))
{
  produces<std::vector<unsigned short> >("rctCrate");
  produces<std::vector<unsigned short> >("rctCard");
  produces<std::vector<unsigned short> >("rctTower");
  produces<std::vector<unsigned int> >("rctEGammaET");
  produces<std::vector<bool> >("rctHoEFGVetoBit");
  produces<std::vector<unsigned int> >("rctJetMETET");
  produces<std::vector<bool> >("rctTowerActivityBit");
  produces<std::vector<bool> >("rctTowerMIPBit");
  produces<std::vector<unsigned short> >("rctHFCrate");
  produces<std::vector<unsigned short> >("rctHFRegion");
  produces<std::vector<unsigned int> >("rctHFET");
  produces<std::vector<bool> >("rctHFFG");
}
L1RCTInputProducer::~L1RCTInputProducer ( ) [virtual]

Definition at line 52 of file L1RCTInputProducer.cc.

References rct, and rctLookupTables.

{
  if(rct != 0) delete rct;
  if(rctLookupTables != 0) delete rctLookupTables;
}

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 60 of file L1RCTInputProducer.cc.

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

{

  // Refresh configuration information every event
  // Hopefully, this does not take too much time
  // There should be a call back function in future to
  // handle changes in configuration

  edm::ESHandle<L1RCTParameters> rctParameters;
  eventSetup.get<L1RCTParametersRcd>().get(rctParameters);
  const L1RCTParameters* r = rctParameters.product();
  edm::ESHandle<L1RCTChannelMask> channelMask;
  eventSetup.get<L1RCTChannelMaskRcd>().get(channelMask);
  const L1RCTChannelMask* c = channelMask.product();
  edm::ESHandle<L1CaloEcalScale> ecalScale;
  eventSetup.get<L1CaloEcalScaleRcd>().get(ecalScale);
  const L1CaloEcalScale* e = ecalScale.product();
  edm::ESHandle<L1CaloHcalScale> hcalScale;
  eventSetup.get<L1CaloHcalScaleRcd>().get(hcalScale);
  const L1CaloHcalScale* h = hcalScale.product();
  edm::ESHandle<L1CaloEtScale> emScale;
  eventSetup.get<L1EmEtScaleRcd>().get(emScale);
  const L1CaloEtScale* s = emScale.product();

  rctLookupTables->setRCTParameters(r);
  rctLookupTables->setChannelMask(c);
  rctLookupTables->setHcalScale(h);
  rctLookupTables->setEcalScale(e);
  rctLookupTables->setL1CaloEtScale(s);

  edm::Handle<EcalTrigPrimDigiCollection> ecal;
  edm::Handle<HcalTrigPrimDigiCollection> hcal;
  
  if (useEcal) { event.getByLabel(ecalDigisLabel, ecal); }
  if (useHcal) { event.getByLabel(hcalDigisLabel, hcal); }

  EcalTrigPrimDigiCollection ecalColl;
  HcalTrigPrimDigiCollection hcalColl;
  if (ecal.isValid()) { ecalColl = *ecal; }
  if (hcal.isValid()) { hcalColl = *hcal; }

  rct->digiInput(ecalColl, hcalColl);

  // Stuff to create

  std::auto_ptr<std::vector<unsigned short> > 
    rctCrate(new std::vector<unsigned short>);
  std::auto_ptr<std::vector<unsigned short> > 
    rctCard(new std::vector<unsigned short>);
  std::auto_ptr<std::vector<unsigned short> > 
    rctTower(new std::vector<unsigned short>);
  std::auto_ptr<std::vector<unsigned int> > 
    rctEGammaET(new std::vector<unsigned int>);
  std::auto_ptr<std::vector<bool> > rctHoEFGVetoBit(new std::vector<bool>);
  std::auto_ptr<std::vector<unsigned int> > 
    rctJetMETET(new std::vector<unsigned int>);
  std::auto_ptr<std::vector<bool> > rctTowerActivityBit(new std::vector<bool>);
  std::auto_ptr<std::vector<bool> > rctTowerMIPBit(new std::vector<bool>);
  
  for(int crate = 0; crate < 18; crate++) {
    for(int card = 0; card < 7; card++) {
      for(int tower = 0; tower < 32; tower++) {
        unsigned short ecalCompressedET = 
          rct->ecalCompressedET(crate, card, tower);
        unsigned short ecalFineGrainBit = 
          rct->ecalFineGrainBit(crate, card, tower);
        unsigned short hcalCompressedET = 
          rct->hcalCompressedET(crate, card, tower);
        unsigned int lutBits = 
          rctLookupTables->lookup(ecalCompressedET, hcalCompressedET, 
                                  ecalFineGrainBit, crate, card, tower);
        unsigned int eGammaETCode = lutBits & 0x0000007F;
        bool hOeFGVetoBit = (lutBits >> 7) & 0x00000001;
        unsigned int jetMETETCode = (lutBits >> 8) & 0x000001FF;
        bool activityBit = (lutBits >> 17) & 0x00000001;
        if(eGammaETCode > 0 || jetMETETCode > 0 || 
           hOeFGVetoBit || activityBit) {
          rctCrate->push_back(crate);
          rctCard->push_back(card);
          rctTower->push_back(tower);
          rctEGammaET->push_back(eGammaETCode);
          rctHoEFGVetoBit->push_back(hOeFGVetoBit);
          rctJetMETET->push_back(jetMETETCode);
          rctTowerActivityBit->push_back(activityBit);
          rctTowerMIPBit->push_back(0); // FIXME: MIP bit is not yet defined
        }
      }
    }
  }

  std::auto_ptr<std::vector<unsigned short> > 
    rctHFCrate(new std::vector<unsigned short>);
  std::auto_ptr<std::vector<unsigned short> > 
    rctHFRegion(new std::vector<unsigned short>);
  std::auto_ptr<std::vector<unsigned int> > rctHFET(new std::vector<unsigned int>);
  std::auto_ptr<std::vector<bool> > rctHFFG(new std::vector<bool>);
  for(int crate = 0; crate < 18; crate++) {
    for(int hfRegion = 0; hfRegion < 8; hfRegion++) {
      unsigned short hfCompressedET = rct->hfCompressedET(crate, hfRegion);
      unsigned int hfETCode = 
        rctLookupTables->lookup(hfCompressedET, crate, 999, hfRegion);
      if(hfETCode > 0) {
        rctHFCrate->push_back(crate);
        rctHFRegion->push_back(hfRegion);
        rctHFET->push_back(hfETCode);
        rctHFFG->push_back(0); // FIXME: HF FG is not yet defined
      }
    }
  }

  //putting stuff back into event
  event.put(rctCrate, "rctCrate");
  event.put(rctCard, "rctCard");
  event.put(rctTower, "rctTower");
  event.put(rctEGammaET, "rctEGammaET");
  event.put(rctHoEFGVetoBit, "rctHoEFGVetoBit");
  event.put(rctJetMETET, "rctJetMETET");
  event.put(rctTowerActivityBit, "rctTowerActivityBit");
  event.put(rctTowerMIPBit, "rctTowerMIPBit");
  event.put(rctHFCrate, "rctHFCrate");
  event.put(rctHFRegion, "rctHFRegion");
  event.put(rctHFET, "rctHFET");
  event.put(rctHFFG, "rctHFFG");

}

Member Data Documentation

Definition at line 30 of file L1RCTInputProducer.h.

Referenced by produce().

Definition at line 31 of file L1RCTInputProducer.h.

Referenced by produce().

Definition at line 27 of file L1RCTInputProducer.h.

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

Definition at line 26 of file L1RCTInputProducer.h.

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

Definition at line 28 of file L1RCTInputProducer.h.

Referenced by produce().

Definition at line 29 of file L1RCTInputProducer.h.

Referenced by produce().