CMS 3D CMS Logo

CastorHitAnalyzer.cc

Go to the documentation of this file.
00001 #include "SimCalorimetry/CastorSim/plugins/CastorHitAnalyzer.h"
00002 #include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
00003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00004 #include<iostream>
00005 
00006 
00007 CastorHitAnalyzer::CastorHitAnalyzer(edm::ParameterSet const& conf) 
00008   : hitReadoutName_("CASTORHITS"),
00009   simParameterMap_(),
00010   castorFilter_(),
00011   castorAnalyzer_("CASTOR", 1., &simParameterMap_, &castorFilter_)
00012 {
00013 }
00014 
00015 
00016 namespace CastorHitAnalyzerImpl {
00017   template<class Collection>
00018   void analyze(edm::Event const& e, CaloHitAnalyzer & analyzer) {
00019     edm::Handle<Collection> recHits;
00020     e.getByType(recHits);
00021     if (!recHits.isValid()) {
00022       edm::LogError("CastorHitAnalyzer") << "Could not find Castor RecHitContainer ";
00023     } else {
00024       for(unsigned i = 0 ; i < recHits->size(); ++i) {
00025         analyzer.analyze((*recHits)[i].id().rawId(), (*recHits)[i].energy());
00026       }
00027     }
00028   }
00029 }
00030 
00031 
00032 void CastorHitAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00033 edm::Handle<CrossingFrame<PCaloHit> > castorcf;
00034 e.getByLabel("mix", "CastorHits",castorcf);
00035   
00036   // access to SimHits
00037 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(castorcf.product()));
00038     castorAnalyzer_.fillHits(*hits);
00039     CastorHitAnalyzerImpl::analyze<CastorRecHitCollection>(e, castorAnalyzer_);
00040   }
00041 
00042 
00043 

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