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