CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
CaloTowerConstituentsMapBuilder.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: CaloTowerConstituentsMapBuilder
4 // Class: CaloTowerConstituentsMapBuilder
5 //
13 //
14 // Original Author: Jeremiah Mans
15 // Created: Mon Oct 3 11:35:27 CDT 2005
16 // $Id: CaloTowerConstituentsMapBuilder.cc,v 1.4 2010/03/26 19:35:00 sunanda Exp $
17 //
18 //
19 
20 
21 // user include files
23 #include <zlib.h>
24 #include <cstdio>
25 #include <strings.h>
26 
27 //
28 // constructors and destructor
29 //
31  mapFile_(iConfig.getUntrackedParameter<std::string>("MapFile",""))
32  /*
33  doStandardHBHE_(iConfig.getParameter<bool>("standardHBHE","true")),
34  doStandardHF_(iConfig.getParameter<bool>("standardHF","true")),
35  doStandardEB_(iConfig.getParameter<bool>("standardEB","true"))
36  */
37 {
38  //the following line is needed to tell the framework what
39  // data is being produced
40  setWhatProduced(this);
41 
42  //now do what ever other initialization is needed
43 }
44 
45 
47 {
48 }
49 
50 
51 //
52 // member functions
53 //
54 
55 // ------------ method called to produce the data ------------
58 {
59  std::auto_ptr<CaloTowerConstituentsMap> prod(new CaloTowerConstituentsMap());
60  prod->useStandardHB(true);
61  prod->useStandardHE(true);
62  prod->useStandardHF(true);
63  prod->useStandardHO(true);
64  prod->useStandardEB(true);
65 
66  if (!mapFile_.empty()) {
67  parseTextMap(mapFile_,*prod);
68  }
69  prod->sort();
70 
71  return prod;
72 }
73 
75  edm::FileInPath eff(filename);
76 
77  gzFile gzed=gzopen(eff.fullPath().c_str(),"rb");
78 
79  while (!gzeof(gzed)) {
80  char line[1024];
81  int ieta, iphi, rawid;
82  gzgets(gzed,line,1023);
83  if (index(line,'#')!=0) *(index(line,'#'))=0;
84  int ct=sscanf(line,"%i %d %d",&rawid,&ieta,&iphi);
85  if (ct==3) {
86  DetId detid(rawid);
87  CaloTowerDetId tid(ieta,iphi);
88  theMap.assign(detid,tid);
89  }
90  }
91  gzclose(gzed);
92 
93 }
CaloTowerConstituentsMapBuilder(const edm::ParameterSet &)
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::auto_ptr< CaloTowerConstituentsMap > ReturnType
void assign(const DetId &cell, const CaloTowerDetId &tower)
set the association between a DetId and a tower
Definition: DetId.h:20
tuple filename
Definition: lut2db_cfg.py:20
std::string fullPath() const
Definition: FileInPath.cc:171
ReturnType produce(const IdealGeometryRecord &)
void parseTextMap(const std::string &filename, CaloTowerConstituentsMap &theMap)