CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
EcalMappingElectronicsHandler.cc
Go to the documentation of this file.
2 
5 
10 
12 #include<iostream>
13 
15  txtFileSource_(ps.getUntrackedParameter<std::string>("txtFile")),
16  m_name(ps.getUntrackedParameter<std::string>("name","EcalMappingElectronicsHandler")),
17  since_(ps.getUntrackedParameter<long long>("since",1))
18 {
19  std::cout << "EcalMappingElectronics Source handler constructor\n" << std::endl;
20 }
21 
23 {
24 }
25 
26 
28 {
29 
30  std::cout << "------- Ecal - > getNewObjects\n";
32  std::auto_ptr<EcalMappingElectronics> mapping = std::auto_ptr<EcalMappingElectronics>( new EcalMappingElectronics() );
33  //Filling map reading from file
34  edm::LogInfo("EcalMappingElectronicsHandler") << "Reading mapping from file " << edm::FileInPath(txtFileSource_).fullPath().c_str() ;
35 
36  std::ifstream f(edm::FileInPath(txtFileSource_).fullPath().c_str());
37  if (!f.good())
38  {
39  edm::LogError("EcalMappingElectronicsHandler") << "File not found";
40  throw cms::Exception("FileNotFound");
41  }
42 
43  // uint32_t detid, elecid, triggerid;
44 
45  int ix, iy, iz, CL;
46  // int dccid, towerid, stripid, xtalid;
47  // int tccid, tower, ipseudostrip, xtalinps;
48  int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
49  int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
50 
51  while ( ! f.eof())
52  {
53  // f >> detid >> elecid >> triggerid;
54  f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >>
55  pseudostrip_in_TCC >> pseudostrip_in_TT ;
56 
57  // if (!EEDetId::validDetId(ix,iy,iz))
58  // continue;
59 
60  EEDetId detid(ix,iy,iz,EEDetId::XYMODE);
61  // std::cout << " dcc tower ps_in_SC xtal_in_ps " << dccid << " " << towerid << " " << pseudostrip_in_SC << " " << xtal_in_pseudostrip << std::endl;
62  EcalElectronicsId elecid(dccid,towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
63  // std::cout << " tcc tt ps_in_TT xtal_in_ps " << tccid << " " << tower << " " << pseudostrip_in_TT << " " << xtal_in_pseudostrip << std::endl;
64  EcalTriggerElectronicsId triggerid(tccid, tower, pseudostrip_in_TT, xtal_in_pseudostrip);
65  EcalMappingElement aElement;
66  aElement.electronicsid = elecid.rawId();
67  aElement.triggerid = triggerid.rawId();
68  (*payload).setValue(detid, aElement);
69  }
70 
71  f.close();
72  edm::LogInfo("EcalMappingElectronicsHandler") << "Reading completed ready to insert in DB";
73  //Filling completed transferring to DB
74  m_to_transfer.push_back(std::make_pair(payload,since_));
75  // delete payload;
76 }
77 
78 
79 
Ecal readout channel identification [32:20] Unused (so far) [19:13] DCC id [12:6] tower [5:3] strip [...
static const int XYMODE
Definition: EEDetId.h:339
EcalMappingElectronicsMap EcalMappingElectronics
double f[11][100]
EcalMappingElectronicsHandler(edm::ParameterSet const &)
uint32_t rawId() const
tuple cout
Definition: gather_cfg.py:145
std::string fullPath() const
Definition: FileInPath.cc:184
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...