CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/OnlineDB/CSCCondDB/interface/CSCDDUMapValues.h

Go to the documentation of this file.
00001 #ifndef _CSCDDUMAPVALUES_H
00002 #define _CSCDDUMAPVALUES_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/CSCDDUMap.h"
00017 #include "CondFormats/DataRecord/interface/CSCDDUMapRcd.h"
00018 #include "OnlineDB/CSCCondDB/interface/CSCDDUMapValues.h"
00019 #include "CondFormats/CSCObjects/interface/CSCMapItem.h"
00020 #include "OnlineDB/CSCCondDB/interface/CSCMap1.h"
00021 
00022 class CSCDDUMapValues: public edm::ESProducer, public edm::EventSetupRecordIntervalFinder  {
00023  public:
00024   CSCDDUMapValues(const edm::ParameterSet&);
00025   ~CSCDDUMapValues();
00026   
00027   inline static CSCDDUMap * fillDDUMap();
00028 
00029   typedef const  CSCDDUMap * ReturnType;
00030   
00031   ReturnType produceDDUMap(const CSCDDUMapRcd&);
00032   
00033  private:
00034   // ----------member data ---------------------------
00035   void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue&, edm::ValidityInterval & );
00036   CSCDDUMap *mapObj ;
00037 
00038 };
00039 
00040 #include<fstream>
00041 #include<vector>
00042 #include<iostream>
00043 
00044 // to workaround plugin library
00045 inline CSCDDUMap *  CSCDDUMapValues::fillDDUMap()
00046 {
00047   CSCDDUMap * mapobj = new CSCDDUMap();
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   int ddu_ddu_input;
00056 
00057   /* This is version for 540 chambers. */
00058   for(i=1;i<=2;++i){
00059     for(j=1;j<=4;++j){
00060       if(j==1) r=3;
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          ddu_ddu_input=item.ddu*100+item.ddu_input;
00069          mapobj->ddu_map[ddu_ddu_input]=item;
00070          count=count+1;
00071         }
00072       }
00073     }
00074   }
00075   return mapobj;
00076 }
00077   
00078   
00079 #endif