Go to the documentation of this file.00001 #include "SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.h"
00002 #include "DataFormats/HcalDigi/interface/HcalDigiCollections.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include<iostream>
00005
00006
00007 CastorDigiAnalyzer::CastorDigiAnalyzer(edm::ParameterSet const& conf)
00008 : hitReadoutName_("CastorHits"),
00009 simParameterMap_(),
00010 castorHitAnalyzer_("CASTORDigi", 1., &simParameterMap_, &castorFilter_),
00011 castorDigiStatistics_("CASTORDigi", 3, 10., 6., 0.1, 0.5, castorHitAnalyzer_),
00012 castorDigiCollectionTag_(conf.getParameter<edm::InputTag>("castorDigiCollectionTag"))
00013 {
00014 }
00015
00016
00017 namespace CastorDigiAnalyzerImpl {
00018 template<class Collection>
00019 void analyze(edm::Event const& e, CastorDigiStatistics & statistics, edm::InputTag& tag) {
00020 edm::Handle<Collection> digis;
00021 e.getByLabel(tag, digis);
00022 if (!digis.isValid()) {
00023 edm::LogError("CastorDigiAnalyzer") << "Could not find Castor Digi Container ";
00024 } else {
00025 for(unsigned i = 0; i < digis->size(); ++i) {
00026 statistics.analyze((*digis)[i]);
00027 }
00028 }
00029 }
00030 }
00031
00032
00033 void CastorDigiAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00034
00035 edm::Handle<CrossingFrame<PCaloHit> > castorcf;
00036
00037 e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
00038
00039
00040
00041 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(castorcf.product()));
00042
00043 castorHitAnalyzer_.fillHits(*hits);
00044 CastorDigiAnalyzerImpl::analyze<CastorDigiCollection>(e, castorDigiStatistics_, castorDigiCollectionTag_);
00045 }