CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalTPCondAnalyzer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Class: EcalTPDBAnalyzer
4 //
10 //
11 //
12 // Original Author: Ursula Berthon
13 // Created: Wed Oct 15 11:38:38 CEST 2008
14 // $Id: EcalTPCondAnalyzer.cc,v 1.1 2008/10/15 15:51:15 uberthon Exp $
15 //
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 #include <utility>
23 #include <iostream>
24 
25 // user include files
30 
43 
48 
50 
52 
53 {}
54 
56  // get geometry
57 
58  edm::ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
59  evtSetup.get<EcalEndcapGeometryRecord>().get("EcalEndcap",theEndcapGeometry_handle);
60  evtSetup.get<EcalBarrelGeometryRecord>().get("EcalBarrel",theBarrelGeometry_handle);
61  theEndcapGeometry_ = &(*theEndcapGeometry_handle);
62  theBarrelGeometry_ = &(*theBarrelGeometry_handle);
63 
64  cacheID_=this->getRecords(evtSetup);
65 }
66 
68 {}
69 
70 
72 }
73 
75  //
76  // get Eventsetup records and print them
77  //
78  printComment();
79 
80  edm::ESHandle<EcalTPGPhysicsConst> theEcalTPGPhysConst_handle;
81  setup.get<EcalTPGPhysicsConstRcd>().get(theEcalTPGPhysConst_handle);
82  const EcalTPGPhysicsConst * ecaltpPhysConst = theEcalTPGPhysConst_handle.product();
83  printEcalTPGPhysicsConst(ecaltpPhysConst);
84  // for EcalFenixStrip...
85 
86  // get parameter records for xtals
87  edm::ESHandle<EcalTPGLinearizationConst> theEcalTPGLinearization_handle;
88  setup.get<EcalTPGLinearizationConstRcd>().get(theEcalTPGLinearization_handle);
89  const EcalTPGLinearizationConst * ecaltpLin = theEcalTPGLinearization_handle.product();
90 
91  edm::ESHandle<EcalTPGPedestals> theEcalTPGPedestals_handle;
92  setup.get<EcalTPGPedestalsRcd>().get(theEcalTPGPedestals_handle);
93  const EcalTPGPedestals * ecaltpPed = theEcalTPGPedestals_handle.product();
94  printCRYSTAL(ecaltpPed,ecaltpLin );
95 
96 
97  //weight
98  edm::ESHandle<EcalTPGWeightIdMap> theEcalTPGWEightIdMap_handle;
99  setup.get<EcalTPGWeightIdMapRcd>().get(theEcalTPGWEightIdMap_handle);
100  const EcalTPGWeightIdMap * ecaltpgWeightMap = theEcalTPGWEightIdMap_handle.product();
101  printWEIGHT(ecaltpgWeightMap);
102 
103  // .. and for EcalFenixTcp
104 
105  edm::ESHandle<EcalTPGFineGrainEBIdMap> theEcalTPGFineGrainEBIdMap_handle;
106  setup.get<EcalTPGFineGrainEBIdMapRcd>().get(theEcalTPGFineGrainEBIdMap_handle);
107  const EcalTPGFineGrainEBIdMap * ecaltpgFineGrainEB = theEcalTPGFineGrainEBIdMap_handle.product();
108  printEcalTPGFineGrainEBIdMap(ecaltpgFineGrainEB);
109 
110 
111  edm::ESHandle<EcalTPGLutIdMap> theEcalTPGLutIdMap_handle;
112  setup.get<EcalTPGLutIdMapRcd>().get(theEcalTPGLutIdMap_handle);
113  const EcalTPGLutIdMap * ecaltpgLut = theEcalTPGLutIdMap_handle.product();
114  printEcalTPGLutIdMap(ecaltpgLut);
115 
116  //for strips
117  edm::ESHandle<EcalTPGSlidingWindow> theEcalTPGSlidingWindow_handle;
118  setup.get<EcalTPGSlidingWindowRcd>().get(theEcalTPGSlidingWindow_handle);
119  const EcalTPGSlidingWindow * ecaltpgSlidW = theEcalTPGSlidingWindow_handle.product();
120  edm::ESHandle<EcalTPGFineGrainStripEE> theEcalTPGFineGrainStripEE_handle;
121  setup.get<EcalTPGFineGrainStripEERcd>().get(theEcalTPGFineGrainStripEE_handle);
122  const EcalTPGFineGrainStripEE * ecaltpgFgStripEE = theEcalTPGFineGrainStripEE_handle.product();
123  edm::ESHandle<EcalTPGWeightGroup> theEcalTPGWEightGroup_handle;
124  setup.get<EcalTPGWeightGroupRcd>().get(theEcalTPGWEightGroup_handle);
125  const EcalTPGWeightGroup * ecaltpgWeightGroup = theEcalTPGWEightGroup_handle.product();
126  printSTRIP(ecaltpgSlidW,ecaltpgWeightGroup,ecaltpgFgStripEE);
127 
128  // get parameter records for towers
129  edm::ESHandle<EcalTPGLutGroup> theEcalTPGLutGroup_handle;
130  setup.get<EcalTPGLutGroupRcd>().get(theEcalTPGLutGroup_handle);
131  const EcalTPGLutGroup * ecaltpgLutGroup = theEcalTPGLutGroup_handle.product();
132 
133  edm::ESHandle<EcalTPGFineGrainEBGroup> theEcalTPGFineGrainEBGroup_handle;
134  setup.get<EcalTPGFineGrainEBGroupRcd>().get(theEcalTPGFineGrainEBGroup_handle);
135  const EcalTPGFineGrainEBGroup * ecaltpgFgEBGroup = theEcalTPGFineGrainEBGroup_handle.product();
136  printTOWEREB(ecaltpgFgEBGroup,ecaltpgLutGroup);
137  edm::ESHandle<EcalTPGFineGrainTowerEE> theEcalTPGFineGrainTowerEE_handle;
138  setup.get<EcalTPGFineGrainTowerEERcd>().get(theEcalTPGFineGrainTowerEE_handle);
139  const EcalTPGFineGrainTowerEE * ecaltpgFineGrainTowerEE = theEcalTPGFineGrainTowerEE_handle.product();
140  printTOWEREE(ecaltpgFineGrainTowerEE,ecaltpgLutGroup);
141 
142  std::cout<<"EOF"<<std::endl;
143 
144  return setup.get<EcalTPGFineGrainTowerEERcd>().cacheIdentifier();
145 }
146 
147 // ------------ method called to analyze the data ------------
148 void
150 }
151 
152 void
154 }
155 
158  const EcalTPGPhysicsConstMap mymap=ecaltpgPhysConst->getMap();
159  for (it=mymap.begin();it!=mymap.end();++it) {
160  if (it==mymap.begin()) {
161  std::cout<<"\nPHYSICS_EB "<<(*it).first<<std::endl;
162  } else {
163  std::cout<<"\nPHYSICS_EE "<<(*it).first<<std::endl;
164  }
165  std::cout<<(*it).second.EtSat<<" "<<(*it).second.ttf_threshold_Low<<" "<<(*it).second.ttf_threshold_High<<std::endl;
166  std::cout<<(*it).second.FG_lowThreshold<<" "<<(*it).second.FG_highThreshold<<" "<<(*it).second.FG_lowRatio<<" "<<(*it).second.FG_highRatio<<std::endl;
167  }
168 }
169 
170 void EcalTPCondAnalyzer::printSTRIP(const EcalTPGSlidingWindow *slWin,const EcalTPGWeightGroup *ecaltpgWeightGroup,const EcalTPGFineGrainStripEE * ecaltpgFgStripEE) const {
171  // print STRIP information
172  const EcalTPGSlidingWindowMap &slwinmap = slWin -> getMap();
173  const EcalTPGFineGrainStripEEMap &fgstripEEmap= ecaltpgFgStripEE->getMap();
175  const EcalTPGGroups::EcalTPGGroupsMap &gMap=ecaltpgWeightGroup->getMap();
177 
178  std::cout<<std::endl;
179  for (int mysub=1;mysub<=2;++mysub) {
180  std::cout<<std::endl;
181  for (it=slwinmap.begin();it!=slwinmap.end();++it) {
182  EcalTriggerElectronicsId elid((*it).first);
183  groupId=gMap.find((*it).first);
184  int subdet =elid.subdet();
185  if (subdet==mysub) {
186  if (subdet==1) {
187  std::cout<<"STRIP_EB "<<std::dec<<(*it).first<<std::endl;
188  std::cout << std::hex << "0x" <<(*it).second<<std::endl ;
189  std::cout <<" " <<(*groupId).second<< std::endl ; //weightgroupid
190  }else if (subdet==2) {
191  std::cout<<"STRIP_EE "<<std::dec<<(*it).first<<std::endl;
192  std::cout << std::hex << "0x" <<(*it).second<<std::endl ;
193  std::cout <<" " <<(*groupId).second<<std::endl ;//weightgroupid
194  EcalTPGFineGrainStripEEMapIterator it2=fgstripEEmap.find((*it).first);
195  if (it2==fgstripEEmap.end()) {
196  edm::LogWarning("EcalTPGCondAnalyzer") <<" could not find strip Id "<<(*it).first<<", given in sliding window, inside the EcalTPGFineGranStripEEMap!!!";
197  } else {
198  EcalTPGFineGrainStripEE::Item item=(*it2).second;
199  std::cout<<std::hex<<"0x"<<item.threshold<<" 0x"<<item.lut<<std::endl ;
200  }
201  }
202  }
203  }
204  }
205 }
206 
207 void EcalTPCondAnalyzer::printWEIGHT(const EcalTPGWeightIdMap * ecaltpgWeightIdMap) const {
208 
209  std::cout<<std::endl;
211  uint32_t w0,w1,w2,w3,w4;
212  const EcalTPGWeightIdMap::EcalTPGWeightMap map=ecaltpgWeightIdMap->getMap();
213  for (it=map.begin();it!=map.end();++it) {
214  std::cout <<"WEIGHT "<<(*it).first<<std::endl;
215  (*it).second.getValues(w0,w1,w2,w3,w4);
216  std::cout <<std::hex<<"0x"<<w0<<" 0x"<<w1<<" 0x"<<w2<<" 0x"<<w3<<" 0x"<<w4<<" "<<std::endl;
217  }
218 }
219 
222  const EcalTPGFineGrainEBIdMap::EcalTPGFineGrainEBMap map=ecaltpgFineGrainEB->getMap();
223  uint32_t ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT;
224 
225  std::cout<<std::endl;
226  for (it=map.begin();it!=map.end();++it) {
227  std::cout <<"FG "<<(*it).first<<std::endl;
228  (*it).second.getValues(ThresholdETLow, ThresholdETHigh, RatioLow, RatioHigh, LUT);
229  std::cout <<std::hex<<"0x"<<ThresholdETLow<<" 0x"<<ThresholdETHigh<<" 0x"<<RatioLow<<" 0x"<<RatioHigh<<" 0x"<<LUT<<std::endl;
230  }
231 }
232 
233 
236  const EcalTPGLutIdMap::EcalTPGLutMap map=ecaltpgLut->getMap();
237 
238  std::cout<<std::endl;
239  for (it=map.begin();it!=map.end();++it) {
240  std::cout <<"LUT "<<(*it).first<<std::endl;
241  const unsigned int * lut=(*it).second.getLut();
242  for (unsigned int i=0;i<1024;++i) std::cout <<std::hex<<"0x"<<*lut++<<std::endl;
243  }
244 }
245 
247 
248  std::cout<<std::endl;
249  const EcalTPGPedestalsMap pedMap=ecaltpPed->getMap();
250  const EcalTPGLinearizationConstMap linMap=ecaltpLin->getMap();
251 
252  const std::vector<DetId> & ebCells = theBarrelGeometry_->getValidDetIds(DetId::Ecal, EcalBarrel);
253 
254  std::cout<<"COMMENT ====== barrel crystals ====== "<<std::endl;
255  for (std::vector<DetId>::const_iterator it = ebCells.begin(); it != ebCells.end(); ++it) {
256  EBDetId id(*it) ;
257  std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
258  const EcalTPGPedestal &ped=pedMap[id.rawId()];
259  const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
260  std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
261  std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
262  std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
263  }
264 
265  const std::vector<DetId> & eeCells = theEndcapGeometry_->getValidDetIds(DetId::Ecal, EcalEndcap);
266  std::cout<<"COMMENT ====== endcap crystals ====== "<<std::endl;
267  for (std::vector<DetId>::const_iterator it = eeCells.begin(); it != eeCells.end(); ++it) {
268  EEDetId id(*it) ;
269  std::cout <<"CRYSTAL "<<std::dec<<id.rawId()<<std::endl;
270  const EcalTPGPedestal &ped=pedMap[id.rawId()];
271  const EcalTPGLinearizationConstant &lin=linMap[id.rawId()];
272  std::cout<<std::hex<<" 0x"<<ped.mean_x12<<" 0x"<<lin.mult_x12<<" 0x"<<lin.shift_x12<<std::endl;
273  std::cout<<std::hex<<" 0x"<<ped.mean_x6 <<" 0x"<<lin.mult_x6 <<" 0x"<<lin.shift_x6<<std::endl;
274  std::cout<<std::hex<<" 0x"<<ped.mean_x1 <<" 0x"<<lin.mult_x1 <<" 0x"<<lin.shift_x1<<std::endl;
275  }
276 }
278  std::cout<<"COMMENT put your comments here\n"<<
279  "COMMENT =================================\n"<<
280  "COMMENT physics EB structure\n"<<
281  "COMMENT\n"<<
282  "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
283  "COMMENT FG_lowThreshold (GeV), FG_highThreshold (GeV), FG_lowRatio, FG_highRatio\n"<<
284  "COMMENT =================================\n"<<
285  "COMMENT\n"<<
286  "COMMENT =================================\n"<<
287  "COMMENT physics EE structure\n"<<
288  "COMMENT\n"<<
289  "COMMENT EtSaturation (GeV), ttf_threshold_Low (GeV), ttf_threshold_High (GeV)\n"<<
290  "COMMENT FG_Threshold (GeV), dummy, dummy, dummy\n"<<
291  "COMMENT =================================\n"<<
292  "COMMENT\n"<<
293  "COMMENT =================================\n"<<
294  "COMMENT crystal structure (same for EB and EE)\n"<<
295  "COMMENT\n"<<
296  "COMMENT ped, mult, shift [gain12]\n"<<
297  "COMMENT ped, mult, shift [gain6]\n"<<
298  "COMMENT ped, mult, shift [gain1]\n"<<
299  "COMMENT =================================\n"<<
300  "COMMENT\n"<<
301  "COMMENT =================================\n"<<
302  "COMMENT strip EB structure\n"<<
303  "COMMENT\n"<<
304  "COMMENT sliding_window\n"<<
305  "COMMENT weightGroupId\n"<<
306  "COMMENT =================================\n"<<
307  "COMMENT\n"<<
308  "COMMENT =================================\n"<<
309  "COMMENT strip EE structure\n"<<
310  "COMMENT\n"<<
311  "COMMENT sliding_window\n"<<
312  "COMMENT weightGroupId\n"<<
313  "COMMENT threshold_fg strip_lut_fg\n"<<
314  "COMMENT =================================\n"<<
315  "COMMENT\n"<<
316  "COMMENT =================================\n"<<
317  "COMMENT tower EB structure\n"<<
318  "COMMENT\n"<<
319  "COMMENT LUTGroupId\n"<<
320  "COMMENT FgGroupId\n"<<
321  "COMMENT =================================\n"<<
322  "COMMENT\n"<<
323  "COMMENT =================================\n"<<
324  "COMMENT tower EE structure\n"<<
325  "COMMENT\n"<<
326  "COMMENT LUTGroupId\n"<<
327  "COMMENT tower_lut_fg\n"<<
328  "COMMENT =================================\n"<<
329  "COMMENT\n"<<
330  "COMMENT =================================\n"<<
331  "COMMENT Weight structure\n"<<
332  "COMMENT\n"<<
333  "COMMENT weightGroupId\n"<<
334  "COMMENT w0, w1, w2, w3, w4\n"<<
335  "COMMENT =================================\n"<<
336  "COMMENT\n"<<
337  "COMMENT =================================\n"<<
338  "COMMENT lut structure\n"<<
339  "COMMENT\n"<<
340  "COMMENT LUTGroupId\n"<<
341  "COMMENT LUT[1-1024]\n"<<
342  "COMMENT =================================\n"<<
343  "COMMENT\n"<<
344  "COMMENT =================================\n"<<
345  "COMMENT fg EB structure\n"<<
346  "COMMENT\n"<<
347  "COMMENT FgGroupId\n"<<
348  "COMMENT el, eh, tl, th, lut_fg\n"<<
349  "COMMENT =================================\n"<<
350  "COMMENT"<<std::endl;
351 }
352 
353 void EcalTPCondAnalyzer::printTOWEREB(const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup,const EcalTPGLutGroup *ecaltpgLutGroup) const {
354 
355  const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
357  const EcalTPGGroups::EcalTPGGroupsMap &fgMap=ecaltpgFgEBGroup->getMap();
359 
360  std::cout<<std::endl;
361  for (it=fgMap.begin();it!=fgMap.end();++it) {
362  std::cout <<"TOWER_EB "<<std::dec<<(*it).first<<std::endl;
363  lutGroupId=lutMap.find((*it).first);
364  std::cout <<" "<<(*it).second<<std::endl;
365  std::cout <<" "<<(*lutGroupId).second<<std::endl;
366  }
367 }
368 
369 void EcalTPCondAnalyzer::printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE,const EcalTPGLutGroup *ecaltpgLutGroup) const {
370 
372  const EcalTPGFineGrainTowerEEMap map=ecaltpgFineGrainTowerEE->getMap();
373  const EcalTPGGroups::EcalTPGGroupsMap &lutMap=ecaltpgLutGroup->getMap();
375 
376  std::cout<<std::endl;
377  for (it=map.begin();it!=map.end();++it) {
378  std::cout <<"TOWER_EE "<<std::dec<<(*it).first<<std::endl;
379  lutGroupId=lutMap.find((*it).first);
380  std::cout <<" "<<(*lutGroupId).second<<std::endl;
381  std::cout <<std::hex<<"0x"<<(*it).second<<std::endl;
382  }
383 }
std::map< uint32_t, EcalTPGWeights >::const_iterator EcalTPGWeightMapItr
int i
Definition: DBlmapReader.cc:9
const EcalTPGGroupsMap & getMap() const
Definition: EcalTPGGroups.h:26
std::map< uint32_t, EcalTPGFineGrainStripEE::Item > EcalTPGFineGrainStripEEMap
void printEcalTPGLutIdMap(const EcalTPGLutIdMap *ecaltpgLut) const
std::map< uint32_t, uint32_t >::const_iterator EcalTPGFineGrainTowerEEMapIterator
key_type id() const
Definition: EBDataFrame.h:32
const CaloSubdetectorGeometry * theBarrelGeometry_
common ppss p3p6s2 common epss epspn46 common const1 w2
Definition: inclppp.h:1
const CaloSubdetectorGeometry * theEndcapGeometry_
const self & getMap() const
std::map< uint32_t, uint32_t >::const_iterator EcalTPGGroupsMapItr
Definition: EcalTPGGroups.h:21
unsigned long long cacheID_
void printTOWEREB(const EcalTPGFineGrainEBGroup *ecaltpgFgEBGroup, const EcalTPGLutGroup *ecaltpgLutGroup) const
virtual void beginJob()
std::map< uint32_t, uint32_t > EcalTPGSlidingWindowMap
unsigned long long getRecords(edm::EventSetup const &setup)
virtual const std::vector< DetId > & getValidDetIds(DetId::Detector det=DetId::Detector(0), int subdet=0) const
Get a list of valid detector ids (for the given subdetector)
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void printSTRIP(const EcalTPGSlidingWindow *ecaltpgSlidW, const EcalTPGWeightGroup *ecaltpgWeightGroup, const EcalTPGFineGrainStripEE *ecaltpgFgStripEE) const
EcalTPCondAnalyzer(const edm::ParameterSet &)
common ppss p3p6s2 common epss epspn46 common const1 w4
Definition: inclppp.h:1
int iEvent
Definition: GenABIO.cc:243
const EcalTPGLutMap & getMap() const
std::map< uint32_t, EcalTPGFineGrainStripEE::Item >::const_iterator EcalTPGFineGrainStripEEMapIterator
void printWEIGHT(const EcalTPGWeightIdMap *ecaltpgWeightMap) const
const std::map< uint32_t, Item > & getMap() const
const EcalTPGFineGrainEBMap & getMap() const
const EcalTPGWeightMap & getMap() const
std::map< uint32_t, EcalTPGWeights > EcalTPGWeightMap
const std::map< uint32_t, uint32_t > & getMap() const
void printEcalTPGFineGrainEBIdMap(const EcalTPGFineGrainEBIdMap *ecaltpgFineGrainEB) const
void printComment() const
std::map< uint32_t, uint32_t > EcalTPGFineGrainTowerEEMap
const std::map< uint32_t, Item > & getMap() const
void printTOWEREE(const EcalTPGFineGrainTowerEE *ecaltpgFineGrainTowerEE, const EcalTPGLutGroup *ecaltpgLutGroup) const
std::map< uint32_t, EcalTPGFineGrainConstEB >::const_iterator EcalTPGFineGrainEBMapItr
const T & get() const
Definition: EventSetup.h:55
void printCRYSTAL(const EcalTPGPedestals *ecaltpPed, const EcalTPGLinearizationConst *ecaltpLin)
T const * product() const
Definition: ESHandle.h:62
std::map< uint32_t, EcalTPGLut > EcalTPGLutMap
common ppss p3p6s2 common epss epspn46 common const1 w3
Definition: inclppp.h:1
void beginRun(const edm::Run &run, const edm::EventSetup &es)
std::map< uint32_t, EcalTPGFineGrainConstEB > EcalTPGFineGrainEBMap
void printEcalTPGPhysicsConst(const EcalTPGPhysicsConst *) const
tuple cout
Definition: gather_cfg.py:41
std::map< uint32_t, EcalTPGPhysicsConst::Item > EcalTPGPhysicsConstMap
std::vector< unsigned short int > LUT
Definition: DTTracoLUTs.h:34
std::map< uint32_t, EcalTPGPhysicsConst::Item >::const_iterator EcalTPGPhysicsConstMapIterator
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...
std::map< uint32_t, uint32_t >::const_iterator EcalTPGSlidingWindowMapIterator
std::map< uint32_t, uint32_t > EcalTPGGroupsMap
Definition: EcalTPGGroups.h:20
std::map< uint32_t, EcalTPGLut >::const_iterator EcalTPGLutMapItr
Definition: Run.h:32
EcalSubdetector subdet() const
get the subdet