CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/OnlineDB/CSCCondDB/interface/CSCChamberMapValues.h

Go to the documentation of this file.
00001 #ifndef _CSCCHAMBERMAPVALUES_H
00002 #define _CSCCHAMBERMAPVALUES_H
00003 
00004 #include <memory>
00005 #include "FWCore/Framework/interface/SourceFactory.h"
00006 #include "FWCore/Framework/interface/Frameworkfwd.h"
00007 #include "FWCore/Framework/interface/ESProducer.h"
00008 #include "FWCore/Framework/interface/Event.h"
00009 #include "FWCore/Framework/interface/MakerMacros.h"
00010 #include "FWCore/Framework/interface/EventSetupRecordIntervalFinder.h"
00011 #include "FWCore/Framework/interface/ESHandle.h"
00012 #include "FWCore/Framework/interface/EventSetup.h"
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 
00015 #include <DataFormats/MuonDetId/interface/CSCDetId.h>
00016 #include "CondFormats/CSCObjects/interface/CSCChamberMap.h"
00017 #include "CondFormats/DataRecord/interface/CSCChamberMapRcd.h"
00018 #include "OnlineDB/CSCCondDB/interface/CSCChamberMapValues.h"
00019 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
00020 #include "OnlineDB/CSCCondDB/interface/CSCMap1.h"
00021 
00022 class CSCChamberMapValues: public edm::ESProducer, public edm::EventSetupRecordIntervalFinder  {
00023  public:
00024   CSCChamberMapValues(const edm::ParameterSet&);
00025   ~CSCChamberMapValues();
00026   
00027   inline static CSCChamberMap * fillChamberMap();
00028 
00029   typedef const  CSCChamberMap * ReturnType;
00030   
00031   ReturnType produceChamberMap(const CSCChamberMapRcd&);
00032   
00033  private:
00034   // ----------member data ---------------------------
00035   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue&, edm::ValidityInterval & );
00036   CSCChamberMap *mapObj ;
00037 
00038 };
00039 
00040 #include<fstream>
00041 #include<vector>
00042 #include<iostream>
00043 
00044 // to workaround plugin library
00045 inline CSCChamberMap *  CSCChamberMapValues::fillChamberMap()
00046 {
00047   CSCChamberMap * mapobj = new CSCChamberMap();
00048   cscmap1 *map = new cscmap1 ();
00049   CSCMapItem::MapItem item;
00050   
00051   int i,j,k,l; //i - endcap, j - station, k - ring, l - chamber.
00052   int r,c;     //r - number of rings, c - number of chambers.
00053   int count=0;
00054   int chamberid;
00055   
00056   /* This is version for 540 chambers. */
00057   for(i=1;i<=2;++i){
00058     for(j=1;j<=4;++j){
00059       if(j==1) r=3;
00060       //else if(j==4) r=1;
00061       else r=2;
00062       for(k=1;k<=r;++k){
00063         if(j>1 && k==1) c=18;
00064         else c=36;
00065         for(l=1;l<=c;++l){
00066           chamberid=i*100000+j*10000+k*1000+l*10;
00067           map->chamber(chamberid,&item);
00068           mapobj->ch_map[chamberid]=item;
00069           count=count+1;
00070         }
00071       }
00072     }
00073   }
00074   return mapobj;
00075 }
00076 
00077 #endif