CMS 3D CMS Logo

HcalHitAnalyzer.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/HcalSimProducers/src/HcalHitAnalyzer.h"
00002 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include<iostream>
00005 
00006 
00007 HcalHitAnalyzer::HcalHitAnalyzer(edm::ParameterSet const& conf) 
00008   : hitReadoutName_("HcalHits"),
00009   simParameterMap_(),
00010   hbheFilter_(),
00011   hoFilter_(),
00012   hfFilter_(),
00013   zdcFilter_(),
00014   hbheAnalyzer_("HBHE", 1., &simParameterMap_, &hbheFilter_),
00015   hoAnalyzer_("HO", 1., &simParameterMap_, &hoFilter_),
00016   hfAnalyzer_("HF", 1., &simParameterMap_, &hfFilter_),
00017   zdcAnalyzer_("ZDC", 1., &simParameterMap_, &zdcFilter_)
00018 {
00019 }
00020 
00021 
00022 namespace HcalHitAnalyzerImpl {
00023   template<class Collection>
00024   void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer) {
00025     edm::Handle<Collection> recHits;
00026     e.getByType(recHits);
00027     for(unsigned i = 0 ; i < recHits->size(); ++i) {
00028       analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
00029     }
00030   }
00031 }
00032 
00033 
00034 void HcalHitAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00035    // Step A: Get Inputs
00036   edm::Handle<CrossingFrame<PCaloHit> > cf, zdccf;
00037   e.getByLabel("mix", "HcalHits",cf);
00038   //e.getByLabel("mix", "ZDCHits", zdccf);
00039 
00040   // test access to SimHits for HcalHits and ZDC hits
00041   std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
00042   //std::auto_ptr<MixCollection<PCaloHit> > zdcHits(new MixCollection<PCaloHit>(zdccf.product()));
00043  
00044   hoAnalyzer_.fillHits(*hits);
00045   hfAnalyzer_.fillHits(*hits);
00046   //zdcAnalyzer_.fillHits(*hits);
00047   HcalHitAnalyzerImpl::analyze<HBHERecHitCollection>(e, hbheAnalyzer_);
00048   HcalHitAnalyzerImpl::analyze<HORecHitCollection>(e, hoAnalyzer_);
00049   HcalHitAnalyzerImpl::analyze<HFRecHitCollection>(e, hfAnalyzer_);
00050   //HcalHitAnalyzerImpl::analyze<ZDCRecHitCollection>(e, zdcAnalyzer_);
00051 }
00052 
00053 

Generated on Tue Jun 9 17:46:23 2009 for CMSSW by  doxygen 1.5.4