Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:49

0001 #ifndef _CSCCHAMBERMAPVALUES_H
0002 #define _CSCCHAMBERMAPVALUES_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/CSCChamberMap.h"
0017 #include "CondFormats/DataRecord/interface/CSCChamberMapRcd.h"
0018 #include "OnlineDB/CSCCondDB/interface/CSCChamberMapValues.h"
0019 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
0020 #include "OnlineDB/CSCCondDB/interface/CSCMap1.h"
0021 
0022 class CSCChamberMapValues : public edm::ESProducer, public edm::EventSetupRecordIntervalFinder {
0023 public:
0024   CSCChamberMapValues(const edm::ParameterSet &);
0025   ~CSCChamberMapValues() override;
0026 
0027   typedef std::unique_ptr<CSCChamberMap> ReturnType;
0028 
0029   inline static CSCChamberMap *fillChamberMap();
0030 
0031   ReturnType produceChamberMap(const CSCChamberMapRcd &);
0032 
0033 private:
0034   // ----------member data ---------------------------
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 // to workaround plugin library
0045 inline CSCChamberMap *CSCChamberMapValues::fillChamberMap() {
0046   CSCChamberMap *mapobj = new CSCChamberMap();
0047   cscmap1 map;
0048   CSCMapItem::MapItem item;
0049 
0050   int i, j, k, l;  //i - endcap, j - station, k - ring, l - chamber.
0051   int r, c;        //r - number of rings, c - number of chambers.
0052   int count = 0;
0053   int chamberid;
0054 
0055   /* This is version for 540 chambers. */
0056   for (i = 1; i <= 2; ++i) {
0057     for (j = 1; j <= 4; ++j) {
0058       if (j == 1)
0059         r = 3;
0060       //else if(j==4) r=1;
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           mapobj->ch_map[chamberid] = item;
0072           count = count + 1;
0073         }
0074       }
0075     }
0076   }
0077   return mapobj;
0078 }
0079 
0080 #endif