CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/SimCalorimetry/CastorSim/plugins/CastorDigiAnalyzer.cc

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 {
00013 }
00014 
00015 
00016 namespace CastorDigiAnalyzerImpl {
00017   template<class Collection>
00018   void analyze(edm::Event const& e, CastorDigiStatistics & statistics) {
00019     edm::Handle<Collection> digis;
00020     e.getByType(digis);
00021     if (!digis.isValid()) {
00022       edm::LogError("CastorDigiAnalyzer") << "Could not find Castor Digi Container ";
00023     } else {
00024       for(unsigned i = 0; i < digis->size(); ++i) {
00025         statistics.analyze((*digis)[i]);
00026       }
00027     }
00028   }
00029 }
00030 
00031 
00032 void CastorDigiAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00033   //  edm::Handle<edm::PCaloHitContainer> hits;
00034 edm::Handle<CrossingFrame<PCaloHit> > castorcf;
00035 
00036 e.getByLabel("mix", "g4SimHitsCastorFI", castorcf);
00037 
00038 
00039 //access to SimHits
00040 std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(castorcf.product()));
00041 //  if (hits.isValid()) {
00042     castorHitAnalyzer_.fillHits(*hits);
00043     CastorDigiAnalyzerImpl::analyze<CastorDigiCollection>(e, castorDigiStatistics_);
00044   }