CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
HcalLutGenerator.cc
Go to the documentation of this file.
2 
10 //#include "CalibCalorimetry/CaloTPG/src/CaloTPGTranscoderULUT.h"
12 
14 
15 
16 #include <iostream>
17 using std::cerr;
18 using std::cout;
19 using std::endl;
20 
22 {
23  std::cout << " --> HcalLutGenerator::HcalLutGenerator()" << std::endl;
24  _tag = iConfig.getParameter<std::string>("tag");
25  _lin_file = iConfig.getParameter<std::string>("HO_master_file");
26  _status_word_to_mask = iConfig.getParameter<uint32_t>("status_word_to_mask");
27 }
28 
30 {
31 }
32 
33 
35 {
36 
37  std::cout << " --> HcalLutGenerator::analyze()" << std::endl;
38 
39  //
40  //_____ get the coders from Event Setup _______________________________
41  //
42  edm::ESHandle<HcalTPGCoder> inputCoder;
43  iSetup.get<HcalTPGRecord>().get(inputCoder);
44  HcalTopology theTopo;
45  HcalDetId did;
46  //
48  iSetup.get<CaloTPGRecord>().get(outTranscoder);
49  outTranscoder->setup(iSetup,CaloTPGTranscoder::HcalTPG);
51  transcoder.swap(outTranscoder);
52 
53  //
54  //_____ get EMAP from Event Setup _____________________________________
55  //
57  iSetup.get<HcalElectronicsMapRcd>().get(hEmap);
58  std::vector<HcalGenericDetId> vEmap = hEmap->allPrecisionId();
59  std::cout << "EMAP from Event Setup has " << vEmap.size() << " entries" << std::endl;
60 
61  //
62  //_____ get Channel Quality conditions from Event Setup (example)______
63  //
65  iSetup.get<HcalChannelQualityRcd>().get(hCQ);
66  const HcalChannelQuality * _cq = &(*hCQ);
67  //
68  /*
69  // Here's how one gets channel status from the Channel Quality condition.
70  // One can use their own loop over channels or get a vector of all
71  // channels from the conditions object
72  //
73  //_____ get list of all channels
74  //
75  std::vector<DetId> _channels = _cq->getAllChannels();
76  std::cout << "Channel Quality available for " << _channels.size() << " channels" << std::endl;
77  //
78  //_____ loop over channels
79  //
80  for (std::vector<DetId>::const_iterator _ch = _channels.begin();
81  _ch != _channels.end();
82  _ch++){
83  //
84  //_____ select only HBEF logical channels
85  //
86  HcalGenericDetId _gid( *_ch );
87  if ( !(_gid.null()) &&
88  (_gid.genericSubdet()==HcalGenericDetId::HcalGenBarrel ||
89  _gid.genericSubdet()==HcalGenericDetId::HcalGenEndcap ||
90  _gid.genericSubdet()==HcalGenericDetId::HcalGenForward ||
91  _gid.genericSubdet()==HcalGenericDetId::HcalGenOuter
92  )
93  ){
94  const HcalChannelStatus * _cs = _cq->getValues( *_ch );
95 
96  // get the full 32-bit channel status word
97  uint32_t status_word = _cs->getValue();
98 
99  // get the 15th bit (which is supposed to mean hot channel)
100  bool is_hot = _cs->isBitSet(15);
101  //edm::LogInfo("LUT") << "HCAL channel ID: " << _ch->rawId()
102  //std::cout << "HCAL channel ID: " << _ch->rawId()
103  // << ", status word: " << status_word
104  // << ", hot flag: " << is_hot << std::endl;
105  }
106  }
107  */
108  //_____end of Channel Quality example_____________________
109 
110  //
111  //_____ generate LUTs _________________________________________________
112  //
113  //HcalLutManager * manager = new HcalLutManager(); // old ways
114  //HcalLutManager * manager = new HcalLutManager(&(*hEmap));
115  HcalLutManager * manager = new HcalLutManager(&(*hEmap), _cq, _status_word_to_mask);
116  bool split_by_crate = true;
117  std::cout << " tag name: " << _tag << std::endl;
118  std::cout << " HO master file: " << _lin_file << std::endl;
119 
120  // default
121  //manager -> createLutXmlFiles_HBEFFromCoder_HOFromAscii( _tag, *inputCoder, *transcoder, _lin_file, split_by_crate );
122 
123  // with ZDC (experimental)
124  manager -> createLutXmlFiles_HBEFFromCoder_HOFromAscii_ZDC( _tag, *inputCoder, *transcoder, _lin_file, split_by_crate );
125  delete manager;
126 
127  transcoder->releaseSetup();
128 
129 }
130 
131 
133 
134 }
T getParameter(std::string const &) const
Various manipulations with trigger Lookup Tables.
int iEvent
Definition: GenABIO.cc:243
uint32_t _status_word_to_mask
const T & get() const
Definition: EventSetup.h:55
std::string _lin_file
tuple cout
Definition: gather_cfg.py:121
HcalLutGenerator(const edm::ParameterSet &)
void swap(ESHandleBase &iOther)
Definition: ESHandle.h:39
virtual void analyze(const edm::Event &, const edm::EventSetup &)