File indexing completed on 2024-04-06 12:22:49
0001 #ifndef _CSCDDUMAPVALUES_H
0002 #define _CSCDDUMAPVALUES_H
0003
0004 #include <memory>
0005 #include "FWCore/Framework/interface/SourceFactory.h"
0006 #include "FWCore/Framework/interface/Frameworkfwd.h"
0007 #include "FWCore/Framework/interface/ESProducer.h"
0008 #include "FWCore/Framework/interface/Event.h"
0009 #include "FWCore/Framework/interface/MakerMacros.h"
0010 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
0011 #include "FWCore/Framework/interface/ESHandle.h"
0012 #include "FWCore/Framework/interface/EventSetup.h"
0013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0014
0015 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
0016 #include "CondFormats/CSCObjects/interface/CSCDDUMap.h"
0017 #include "CondFormats/DataRecord/interface/CSCDDUMapRcd.h"
0018 #include "OnlineDB/CSCCondDB/interface/CSCDDUMapValues.h"
0019 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
0020 #include "OnlineDB/CSCCondDB/interface/CSCMap1.h"
0021
0022 class CSCDDUMapValues : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0023 public:
0024 CSCDDUMapValues(const edm::ParameterSet &);
0025 ~CSCDDUMapValues() override;
0026
0027 typedef std::unique_ptr<CSCDDUMap> ReturnType;
0028
0029 inline static CSCDDUMap *fillDDUMap();
0030
0031 CSCDDUMapValues::ReturnType produceDDUMap(const CSCDDUMapRcd &);
0032
0033 private:
0034
0035 void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &,
0036 const edm::IOVSyncValue &,
0037 edm::ValidityInterval &) override;
0038 };
0039
0040 #include <fstream>
0041 #include <vector>
0042 #include <iostream>
0043
0044
0045 inline CSCDDUMap *CSCDDUMapValues::fillDDUMap() {
0046 CSCDDUMap *mapobj = new CSCDDUMap();
0047 cscmap1 map;
0048 CSCMapItem::MapItem item;
0049
0050 int i, j, k, l;
0051 int r, c;
0052 int count = 0;
0053 int chamberid;
0054 int ddu_ddu_input;
0055
0056
0057 for (i = 1; i <= 2; ++i) {
0058 for (j = 1; j <= 4; ++j) {
0059 if (j == 1)
0060 r = 3;
0061 else
0062 r = 2;
0063 for (k = 1; k <= r; ++k) {
0064 if (j > 1 && k == 1)
0065 c = 18;
0066 else
0067 c = 36;
0068 for (l = 1; l <= c; ++l) {
0069 chamberid = i * 100000 + j * 10000 + k * 1000 + l * 10;
0070 map.chamber(chamberid, &item);
0071 ddu_ddu_input = item.ddu * 100 + item.ddu_input;
0072 mapobj->ddu_map[ddu_ddu_input] = item;
0073 count = count + 1;
0074 }
0075 }
0076 }
0077 }
0078 return mapobj;
0079 }
0080
0081 #endif