CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/SimCalorimetry/HcalSimProducers/src/HcalDigiAnalyzer.cc

Go to the documentation of this file.
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 {
00022 }
00023 
00024 
00025 namespace HcalDigiAnalyzerImpl {
00026   template<class Collection>
00027   void analyze(edm::Event const& e, HcalDigiStatistics & statistics) {
00028     edm::Handle<Collection> digis;
00029     e.getByType(digis);
00030     for(unsigned i = 0; i < digis->size(); ++i) {
00031       std::cout << (*digis)[i] << std::endl;
00032       statistics.analyze((*digis)[i]);
00033     }
00034   }
00035 }
00036 
00037 
00038 void HcalDigiAnalyzer::analyze(edm::Event const& e, edm::EventSetup const& c) {
00039   // Step A: Get Inputs
00040   edm::Handle<CrossingFrame<PCaloHit> > cf, zdccf;
00041   e.getByLabel("mix", "HcalHits",cf);
00042   //e.getByLabel("mix", "ZDCHits", zdccf);
00043   
00044   // test access to SimHits for HcalHits and ZDC hits
00045   std::auto_ptr<MixCollection<PCaloHit> > hits(new MixCollection<PCaloHit>(cf.product()));
00046   //std::auto_ptr<MixCollection<PCaloHit> > zdcHits(new MixCollection<PCaloHit>(zdccf.product()));
00047   hbheHitAnalyzer_.fillHits(*hits);
00048   hoHitAnalyzer_.fillHits(*hits);
00049   hfHitAnalyzer_.fillHits(*hits);
00050   //zdcHitAnalyzer_.fillHits(*zdcHits);
00051   HcalDigiAnalyzerImpl::analyze<HBHEDigiCollection>(e, hbheDigiStatistics_);
00052   HcalDigiAnalyzerImpl::analyze<HODigiCollection>(e, hoDigiStatistics_);
00053   HcalDigiAnalyzerImpl::analyze<HFDigiCollection>(e, hfDigiStatistics_);
00054   //HcalDigiAnalyzerImpl::analyze<ZDCDigiCollection>(e, zdcDigiStatistics_);
00055 }
00056 
00057