00001 #include "SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.h"
00002 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include<iostream>
00005
00006
00007 HcalDigiAnalyzer::HcalDigiAnalyzer(edm::ParameterSet const& conf)
00008 : hitReadoutName_("HcalHits"),
00009 simParameterMap_(),
00010 hbheFilter_(),
00011 hoFilter_(),
00012 hfFilter_(true),
00013 hbheHitAnalyzer_("HBHEDigi", 1., &simParameterMap_, &hbheFilter_),
00014 hoHitAnalyzer_("HODigi", 1., &simParameterMap_, &hoFilter_),
00015 hfHitAnalyzer_("HFDigi", 1., &simParameterMap_, &hfFilter_),
00016 zdcHitAnalyzer_("ZDCDigi", 1., &simParameterMap_, &zdcFilter_),
00017 hbheDigiStatistics_("HBHEDigi", 4, 10., 6., 0.1, 0.5, hbheHitAnalyzer_),
00018 hoDigiStatistics_("HODigi", 4, 10., 6., 0.1, 0.5, hoHitAnalyzer_),
00019 hfDigiStatistics_("HFDigi", 3, 10., 6., 0.1, 0.5, hfHitAnalyzer_),
00020 zdcDigiStatistics_("ZDCDigi", 3, 10., 6., 0.1, 0.5, zdcHitAnalyzer_),
00021 hbheDigiCollectionTag_(conf.getParameter<edm::InputTag>("hbheDigiCollectionTag")),
00022 hoDigiCollectionTag_(conf.getParameter<edm::InputTag>("hoDigiCollectionTag")),
00023 hfDigiCollectionTag_(conf.getParameter<edm::InputTag>("hfDigiCollectionTag"))
00024 {
00025 }
00026
00027
00028 namespace HcalDigiAnalyzerImpl {
00029 template<class Collection>
00030 void analyze(edm::Event const& e, HcalDigiStatistics & statistics, edm::InputTag& tag) {
00031 edm::Handle<Collection> digis;
00032 e.getByLabel(tag, digis);
00033 for(unsigned i = 0; i < digis->size(); ++i) {
00034 std::cout << (*digis)[i] << std::endl;
00035 statistics.analyze((*digis)[i]);
00036 }
00037 }
00038 }
00039
00040
00041 void HcalDigiAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00042
00043 edm::Handle<CrossingFrame<PCaloHit> > cf, zdccf;
00044 e.getByLabel("mix", "HcalHits",cf);
00045
00046
00047
00048 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
00049
00050 hbheHitAnalyzer_.fillHits(*hits);
00051 hoHitAnalyzer_.fillHits(*hits);
00052 hfHitAnalyzer_.fillHits(*hits);
00053
00054 HcalDigiAnalyzerImpl::analyze<HBHEDigiCollection>(e, hbheDigiStatistics_, hbheDigiCollectionTag_);
00055 HcalDigiAnalyzerImpl::analyze<HODigiCollection>(e, hoDigiStatistics_, hoDigiCollectionTag_);
00056 HcalDigiAnalyzerImpl::analyze<HFDigiCollection>(e, hfDigiStatistics_, hfDigiCollectionTag_);
00057
00058 }