![]() |
|
|||
File indexing completed on 2024-04-06 11:57:57
0001 // 0002 // Toyoko Orimoto (Caltech), 10 July 2007 0003 // 0004 0005 // system include files 0006 #include <memory> 0007 //#include <time.h> 0008 #include <string> 0009 #include <map> 0010 #include <iostream> 0011 #include <vector> 0012 0013 // user include files 0014 #include "FWCore/Framework/interface/one/EDAnalyzer.h" 0015 0016 #include "FWCore/Framework/interface/Event.h" 0017 #include "FWCore/Framework/interface/MakerMacros.h" 0018 0019 #include "FWCore/Framework/interface/EventSetup.h" 0020 0021 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbService.h" 0022 #include "CalibCalorimetry/EcalLaserCorrection/interface/EcalLaserDbRecord.h" 0023 0024 #include "DataFormats/EcalDetId/interface/EBDetId.h" 0025 #include "DataFormats/EcalDetId/interface/EEDetId.h" 0026 #include "DataFormats/Provenance/interface/Timestamp.h" 0027 0028 using namespace std; 0029 //using namespace oracle::occi; 0030 0031 class EcalLaserTestAnalyzer : public edm::one::EDAnalyzer<> { 0032 public: 0033 explicit EcalLaserTestAnalyzer(const edm::ParameterSet&); 0034 ~EcalLaserTestAnalyzer() override = default; 0035 0036 void analyze(edm::Event const&, edm::EventSetup const&) override; 0037 0038 private: 0039 // std::string m_timetype; 0040 // std::map<std::string, unsigned long long> m_cacheIDs; 0041 // std::map<std::string, std::string> m_records; 0042 // unsigned long m_firstRun ; 0043 // unsigned long m_lastRun ; 0044 0045 // ----------member data --------------------------- 0046 const edm::ESGetToken<EcalLaserDbService, EcalLaserDbRecord> laserDbToken_; 0047 }; 0048 0049 // 0050 // constants, enums and typedefs 0051 // 0052 0053 // 0054 // static data member definitions 0055 // 0056 0057 // 0058 // constructors and destructor 0059 // 0060 EcalLaserTestAnalyzer::EcalLaserTestAnalyzer(const edm::ParameterSet& iConfig) 0061 : laserDbToken_(esConsumes()) 0062 // m_timetype(iConfig.getParameter<std::string>("timetype")), 0063 // m_cacheIDs(), 0064 // m_records() 0065 { 0066 // std::cout << "EcalLaserTestAnalyzer::EcalLaserTestAnalyzer->... construct me!" << std::endl; 0067 //now do what ever initialization is needed 0068 0069 // std::string container; 0070 // std::string tag; 0071 // std::string record; 0072 0073 // // m_firstRun=(unsigned long)atoi( iConfig.getParameter<std::string>("firstRun").c_str()); 0074 // // m_lastRun=(unsigned long)atoi( iConfig.getParameter<std::string>("lastRun").c_str()); 0075 0076 // typedef std::vector< edm::ParameterSet > Parameters; 0077 // Parameters toGet = iConfig.getParameter<Parameters>("toGet"); 0078 // for(Parameters::iterator i = toGet.begin(); i != toGet.end(); ++i) { 0079 // container = i->getParameter<std::string>("container"); 0080 // record = i->getParameter<std::string>("record"); 0081 // m_cacheIDs.insert( std::make_pair(container, 0) ); 0082 // m_records.insert( std::make_pair(container, record) ); 0083 0084 // } 0085 } 0086 0087 // 0088 // member functions 0089 // 0090 0091 // ------------ method called to produce the data ------------ 0092 void EcalLaserTestAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { 0093 // using namespace edm; 0094 0095 // get record from offline DB 0096 const auto& setup = iSetup.getData(laserDbToken_); 0097 std::cout << "EcalLaserTestAnalyzer::analyze-> got EcalLaserDbRecord: " << std::endl; 0098 // setup.setVerbosity(true); 0099 0100 // int ieta = 83; 0101 // int iphi = 168; 0102 // EBDetId testid(ieta,iphi); 0103 // edm::Timestamp testtime(2222); 0104 0105 // edm::ESHandle< EcalElectronicsMapping > ecalmapping; 0106 // iSetup.get< EcalMappingRcd >().get(ecalmapping); 0107 // const EcalElectronicsMapping* TheMapping = ecalmapping.product(); 0108 // // int dccid = TheMapping-> DCCid(testid); 0109 // // int tccid = TheMapping-> TCCid(testid); 0110 0111 // // std::cout << std::endl 0112 // // << "TESTID: " << testid << " " 0113 // // << testid.ietaSM() << " " << testid.iphiSM() << " " 0114 // // << testid.rawId() << " " 0115 // // << dccid << " " << tccid 0116 // // << std::endl; 0117 0118 // float blah = setup.getLaserCorrection(testid, testtime); 0119 // std::cout << " EcalLaserTestAnalyzer: " << blah << std::endl; 0120 0121 std::cout << "---> FIRST ECAL BARREL " << endl; 0122 0123 // ECAL Barrel 0124 for (int ieta = -EBDetId::MAX_IETA; ieta <= EBDetId::MAX_IETA; ++ieta) { 0125 if (ieta == 0) 0126 continue; 0127 for (int iphi = EBDetId::MIN_IPHI; iphi <= EBDetId::MAX_IPHI; ++iphi) { 0128 try { 0129 EBDetId testid(ieta, iphi); 0130 // edm::Timestamp testtime(12000); 0131 0132 // int dccid = TheMapping-> DCCid(testid); 0133 // int tccid = TheMapping-> TCCid(testid); 0134 0135 // EcalElectronicsId myid = TheMapping->getElectronicsId(testid); 0136 // EcalTriggerElectronicsId mytid = TheMapping->getTriggerElectronicsId(testid); 0137 0138 std::cout << std::endl 0139 << "CRYSTAL EB: " << testid 0140 << " " 0141 // << testid.ietaSM() << " " << testid.iphiSM() << " : " 0142 // << testid.rawId() << " : " << myid << " " << myid.rawId() << " : " 0143 // << dccid << " " << tccid 0144 << std::endl; 0145 // std::cout << testid << std::endl; 0146 0147 float blah = setup.getLaserCorrection(testid, iEvent.time()); 0148 std::cout << " EcalLaserTestAnalyzer: " << iEvent.time().value() << " " << blah << std::endl; 0149 0150 } catch (...) { 0151 } 0152 } 0153 } 0154 0155 std::cout << "---> NOW ECAL ENDCAP " << endl; 0156 0157 // ECAL Endcap 0158 for (int iX = EEDetId::IX_MIN; iX <= EEDetId::IX_MAX; ++iX) { 0159 for (int iY = EEDetId::IY_MIN; iY <= EEDetId::IY_MAX; ++iY) { 0160 // make an EEDetId since we need EEDetId::rawId() to be used as the key for the pedestals 0161 // +Z side 0162 EEDetId testidpos(iX, iY, 1); 0163 // edm::Timestamp testtime(12000); 0164 // std::cout << " EcalLaserTestAnalyzer: " << testidpos << " " << testidpos.isc() << endl; 0165 0166 // // test of elec mapping 0167 // EcalElectronicsId myidpos = TheMapping->getElectronicsId(testidpos); 0168 std::cout << std::endl 0169 << "CRYSTAL EE+: " << testidpos << " " << testidpos.isc() 0170 << " " 0171 // << testidpos.rawId() << " : " << myidpos << " " << myidpos.rawId() << " : " 0172 // << myidpos.dccId() 0173 << std::endl; 0174 // // 0175 0176 float blah = setup.getLaserCorrection(testidpos, iEvent.time()); 0177 std::cout << " EcalLaserTestAnalyzer: " << iEvent.time().value() << " " << blah << std::endl; 0178 0179 // -Z side 0180 EEDetId testidneg(iX, iY, -1); 0181 // std::cout << " EcalLaserTestAnalyzer: " << testidneg << " " << testidneg.isc() << endl; 0182 0183 // EcalElectronicsId myidneg = TheMapping->getElectronicsId(testidneg); 0184 std::cout << std::endl 0185 << "CRYSTAL EE-: " << testidneg << " " << testidneg.isc() 0186 << " " 0187 // << testidneg.rawId() << " : " << myidneg << " " << myidneg.rawId() << " : " 0188 // << myidneg.dccId() 0189 << std::endl; 0190 0191 blah = setup.getLaserCorrection(testidneg, iEvent.time()); 0192 std::cout << " EcalLaserTestAnalyzer: " << iEvent.time().value() << " " << blah << std::endl; 0193 } 0194 } 0195 } 0196 0197 //define this as a plug-in 0198 DEFINE_FWK_MODULE(EcalLaserTestAnalyzer);
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.2.1 LXR engine. The LXR team |
![]() ![]() |