00001 #include "CalibTracker/SiStripAPVAnalysis/interface/ApvFactoryService.h" 00002 00003 00004 #include "CondFormats/DataRecord/interface/SiStripPedestalsRcd.h" 00005 #include "CondFormats/SiStripObjects/interface/SiStripPedestals.h" 00006 00007 00008 using namespace edm; 00009 using namespace std; 00010 //using namespace sistrip; 00011 00012 // ----------------------------------------------------------------------------- 00013 // 00014 00015 // ----------------------------------------------------------------------------- 00016 // 00017 00018 ApvFactoryService::ApvFactoryService( const edm::ParameterSet& pset, 00019 edm::ActivityRegistry& activity ) : 00020 apvFactory_() 00021 { 00022 00023 apvFactory_= new ApvAnalysisFactory(pset); 00024 std::cout << " Print pedalgo inside ApvFactoryService constructor " << pset.getParameter<string>("CalculatorAlgorithm") << std::endl; 00025 // activity.watchPostProcessEvent(this, &ApvFactoryService::postProcessEvent); 00026 00027 00028 00029 } 00030 00031 // ----------------------------------------------------------------------------- 00032 // 00033 ApvFactoryService::~ApvFactoryService() { 00034 } 00035 00036 // ----------------------------------------------------------------------------- 00037 00038 00039 void ApvFactoryService::postProcessEvent(const edm::Event& ie, const edm::EventSetup& ies){ 00040 00041 if (gotPed) 00042 return; 00043 00044 /* 00045 std::cout << "ApvFactoryService::post" << std::endl; 00046 00047 edm::ESHandle<SiStripPedestals> ped; 00048 ies.get<SiStripPedestalsRcd>().get(ped); 00049 00050 //apvFactory_->SetPed(ped); 00051 00052 gotPed=true; 00053 00054 00055 std::vector<uint32_t> pdetid; 00056 ped->getDetIds(pdetid); 00057 edm::LogInfo("SiStripO2O") << " Peds Found " << pdetid.size() << " DetIds"; 00058 00059 // pedDB_=ped; 00060 00061 for (size_t id=0;id<pdetid.size();id++){ 00062 SiStripPedestals::Range range=ped->getRange(pdetid[id]); 00063 // SiStripPedestals::Range range=pedDB_.getRange(pdetid[id]); 00064 int strip=0; 00065 00066 edm::LogInfo("SiStripO2O") << "PED detid " << pdetid[id] << " \t" 00067 << " strip " << strip << " \t" 00068 << ped->getPed (strip,range) << " \t" 00069 << ped->getLowTh (strip,range) << " \t" 00070 << ped->getHighTh(strip,range) << " \t" 00071 << std::endl; 00072 00073 } 00074 00075 */ 00076 00077 00078 } 00079 00080 00081 00082 // ----------------------------------------------------------------------------- 00083 // 00084 00085 // ----------------------------------------------------------------------------- 00086 // 00087 00088 int ApvFactoryService::getEventInitNumber() { 00089 return 0; 00090 } 00091 // ----------------------------------------------------------------------------- 00092 00093 // ----------------------------------------------------------------------------- 00094 // 00095 00096 00097 ApvAnalysisFactory* const ApvFactoryService::getApvFactory() const { 00098 00099 return apvFactory_; 00100 00101 } 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113