CMS 3D CMS Logo

Public Member Functions | Private Attributes

HcalLutGenerator Class Reference

#include <HcalLutGenerator.h>

Inheritance diagram for HcalLutGenerator:
edm::EDAnalyzer edm::EDConsumerBase

List of all members.

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
void endJob ()
 HcalLutGenerator (const edm::ParameterSet &)
 ~HcalLutGenerator ()

Private Attributes

std::string _lin_file
uint32_t _status_word_to_mask
std::string _tag

Detailed Description

Definition at line 9 of file HcalLutGenerator.h.


Constructor & Destructor Documentation

HcalLutGenerator::HcalLutGenerator ( const edm::ParameterSet iConfig) [explicit]

Definition at line 19 of file HcalLutGenerator.cc.

References _lin_file, _status_word_to_mask, _tag, gather_cfg::cout, edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

{
  std::cout << " --> HcalLutGenerator::HcalLutGenerator()" << std::endl;
  _tag                 = iConfig.getParameter<std::string>("tag");
  _lin_file            = iConfig.getParameter<std::string>("HO_master_file");
  _status_word_to_mask = iConfig.getParameter<uint32_t>("status_word_to_mask");
}
HcalLutGenerator::~HcalLutGenerator ( )

Definition at line 27 of file HcalLutGenerator.cc.

{
}

Member Function Documentation

void HcalLutGenerator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [virtual]

Implements edm::EDAnalyzer.

Definition at line 31 of file HcalLutGenerator.cc.

References _lin_file, _status_word_to_mask, _tag, gather_cfg::cout, edm::EventSetup::get(), CaloTPGTranscoder::HcalTPG, and edm::ESHandleBase::swap().

{
  
  std::cout << " --> HcalLutGenerator::analyze()" << std::endl;
  
  //
  //_____ get the coders from Event Setup _______________________________
  //
  edm::ESHandle<HcalTPGCoder> inputCoder;
  iSetup.get<HcalTPGRecord>().get(inputCoder);

  //
  edm::ESHandle<CaloTPGTranscoder> outTranscoder;
  iSetup.get<CaloTPGRecord>().get(outTranscoder);
  outTranscoder->setup(iSetup,CaloTPGTranscoder::HcalTPG);
  edm::ESHandle<CaloTPGTranscoderULUT> transcoder;
  transcoder.swap(outTranscoder);

  //
  //_____ get EMAP from Event Setup _____________________________________
  //
  edm::ESHandle<HcalElectronicsMap> hEmap;
  iSetup.get<HcalElectronicsMapRcd>().get(hEmap);
  std::vector<HcalGenericDetId> vEmap = hEmap->allPrecisionId();
  std::cout << "EMAP from Event Setup has " << vEmap.size() << " entries" << std::endl;

  //
  //_____ get Channel Quality conditions from Event Setup (example)______
  //
  edm::ESHandle<HcalChannelQuality> hCQ;
  iSetup.get<HcalChannelQualityRcd>().get(hCQ);
  const HcalChannelQuality * _cq = &(*hCQ);
  //
  /*
  // Here's how one gets channel status from the Channel Quality condition.
  // One can use their own loop over channels or get a vector of all
  // channels from the conditions object
  //
  //_____ get list of all channels
  //
  std::vector<DetId> _channels = _cq->getAllChannels();
  std::cout << "Channel Quality available for " << _channels.size() << " channels" << std::endl;
  //
  //_____ loop over channels
  //
  for (std::vector<DetId>::const_iterator _ch = _channels.begin();
       _ch != _channels.end();
       _ch++){
    //
    //_____ select only HBEF logical channels
    //
    HcalGenericDetId _gid( *_ch );
    if ( !(_gid.null()) &&
         (_gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
          _gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
          _gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
          _gid.genericSubdet()==HcalGenericDetId::HcalGenOuter
          )
         ){
      const HcalChannelStatus * _cs = _cq->getValues( *_ch );

      // get the full 32-bit channel status word
      uint32_t status_word = _cs->getValue();
      
      // get the 15th bit (which is supposed to mean hot channel)
      bool is_hot = _cs->isBitSet(15);
      //edm::LogInfo("LUT") << "HCAL channel ID: " << _ch->rawId()
      //std::cout << "HCAL channel ID: " << _ch->rawId()
      //   << ", status word: " << status_word
      //   << ", hot flag: " << is_hot << std::endl;
    }
  }
  */
  //_____end of Channel Quality example_____________________

  //
  //_____ generate LUTs _________________________________________________
  //
  //HcalLutManager * manager = new HcalLutManager(); // old ways
  //HcalLutManager * manager = new HcalLutManager(&(*hEmap));
  HcalLutManager * manager = new HcalLutManager(&(*hEmap), _cq, _status_word_to_mask);
  bool split_by_crate = true;
  std::cout << " tag name: " << _tag << std::endl;
  std::cout << " HO master file: " << _lin_file << std::endl;

  // default
  //manager -> createLutXmlFiles_HBEFFromCoder_HOFromAscii( _tag, *inputCoder, *transcoder, _lin_file, split_by_crate );

  // with ZDC (experimental)
  manager -> createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC( _tag, *inputCoder, *transcoder, _lin_file, split_by_crate );
  delete manager;

  transcoder->releaseSetup();
   
}
void HcalLutGenerator::endJob ( void  ) [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 128 of file HcalLutGenerator.cc.

                              {

}

Member Data Documentation

std::string HcalLutGenerator::_lin_file [private]

Definition at line 18 of file HcalLutGenerator.h.

Referenced by analyze(), and HcalLutGenerator().

Definition at line 19 of file HcalLutGenerator.h.

Referenced by analyze(), and HcalLutGenerator().

std::string HcalLutGenerator::_tag [private]

Definition at line 17 of file HcalLutGenerator.h.

Referenced by analyze(), and HcalLutGenerator().