CMS 3D CMS Logo

EcalMappingElectronicsHandler.cc
Go to the documentation of this file.
2 
5 
10 
12 #include <iostream>
13 #include <memory>
14 
16  : txtFileSource_(ps.getUntrackedParameter<std::string>("txtFile")),
17  m_name(ps.getUntrackedParameter<std::string>("name", "EcalMappingElectronicsHandler")),
18  since_(ps.getUntrackedParameter<long long>("since", 1)) {
19  std::cout << "EcalMappingElectronics Source handler constructor\n" << std::endl;
20 }
21 
23 
25  std::cout << "------- Ecal - > getNewObjects\n";
27  std::unique_ptr<EcalMappingElectronics> mapping = std::make_unique<EcalMappingElectronics>();
28  //Filling map reading from file
29  edm::LogInfo("EcalMappingElectronicsHandler")
30  << "Reading mapping from file " << edm::FileInPath(txtFileSource_).fullPath().c_str();
31 
32  std::ifstream f(edm::FileInPath(txtFileSource_).fullPath().c_str());
33  if (!f.good()) {
34  edm::LogError("EcalMappingElectronicsHandler") << "File not found";
35  throw cms::Exception("FileNotFound");
36  }
37 
38  // uint32_t detid, elecid, triggerid;
39 
40  int ix, iy, iz, CL;
41  // int dccid, towerid, stripid, xtalid;
42  // int tccid, tower, ipseudostrip, xtalinps;
43  int dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip;
44  int tccid, tower, pseudostrip_in_TCC, pseudostrip_in_TT;
45 
46  while (!f.eof()) {
47  // f >> detid >> elecid >> triggerid;
48  f >> ix >> iy >> iz >> CL >> dccid >> towerid >> pseudostrip_in_SC >> xtal_in_pseudostrip >> tccid >> tower >>
49  pseudostrip_in_TCC >> pseudostrip_in_TT;
50 
51  // if (!EEDetId::validDetId(ix,iy,iz))
52  // continue;
53 
54  EEDetId detid(ix, iy, iz, EEDetId::XYMODE);
55  // std::cout << " dcc tower ps_in_SC xtal_in_ps " << dccid << " " << towerid << " " << pseudostrip_in_SC << " " << xtal_in_pseudostrip << std::endl;
56  EcalElectronicsId elecid(dccid, towerid, pseudostrip_in_SC, xtal_in_pseudostrip);
57  // std::cout << " tcc tt ps_in_TT xtal_in_ps " << tccid << " " << tower << " " << pseudostrip_in_TT << " " << xtal_in_pseudostrip << std::endl;
58  EcalTriggerElectronicsId triggerid(tccid, tower, pseudostrip_in_TT, xtal_in_pseudostrip);
59  EcalMappingElement aElement;
60  aElement.electronicsid = elecid.rawId();
61  aElement.triggerid = triggerid.rawId();
62  (*payload).setValue(detid, aElement);
63  }
64 
65  f.close();
66  edm::LogInfo("EcalMappingElectronicsHandler") << "Reading completed ready to insert in DB";
67  //Filling completed transferring to DB
68  m_to_transfer.push_back(std::make_pair(payload, since_));
69  // delete payload;
70 }
std::string fullPath() const
Definition: FileInPath.cc:161
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:335
Log< level::Error, false > LogError
EcalMappingElectronicsMap EcalMappingElectronics
std::vector< std::pair< EcalMappingElectronics *, Time_t > > m_to_transfer
double f[11][100]
EcalMappingElectronicsHandler(edm::ParameterSet const &)
Log< level::Info, false > LogInfo
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t ix(uint32_t id)
uint32_t rawId() const
ALPAKA_FN_ACC ALPAKA_FN_INLINE uint32_t iy(uint32_t id)
Ecal trigger electronics identification [32:20] Unused (so far) [19:13] TCC id [12:6] TT id [5:3] pse...