#include <Calibration/HcalAlCaRecoProducers/src/ProducerAnalyzer.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
ProducerAnalyzer (const edm::ParameterSet &) | |
~ProducerAnalyzer () | |
Private Attributes | |
std::string | ecalInput_ |
std::string | gammaClus_ |
std::string | hbheInput_ |
std::string | hfInput_ |
std::string | hoInput_ |
std::string | jetCalo_ |
std::string | nameProd_ |
std::string | Tracks_ |
Definition at line 31 of file ProducerAnalyzer.h.
cms::ProducerAnalyzer::ProducerAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 37 of file ProducerAnalyzer.cc.
References ecalInput_, gammaClus_, edm::ParameterSet::getUntrackedParameter(), hbheInput_, hfInput_, hoInput_, jetCalo_, nameProd_, and Tracks_.
00038 { 00039 // get name of output file with histogramms 00040 00041 nameProd_ = iConfig.getUntrackedParameter<std::string>("nameProd"); 00042 jetCalo_ = iConfig.getUntrackedParameter<std::string>("jetCalo","GammaJetJetBackToBackCollection"); 00043 gammaClus_ = iConfig.getUntrackedParameter<std::string>("gammaClus","GammaJetGammaBackToBackCollection"); 00044 ecalInput_=iConfig.getUntrackedParameter<std::string>("ecalInput","GammaJetEcalRecHitCollection"); 00045 hbheInput_ = iConfig.getUntrackedParameter<std::string>("hbheInput"); 00046 hoInput_ = iConfig.getUntrackedParameter<std::string>("hoInput"); 00047 hfInput_ = iConfig.getUntrackedParameter<std::string>("hfInput"); 00048 Tracks_ = iConfig.getUntrackedParameter<std::string>("Tracks","GammaJetTracksCollection"); 00049 00050 }
cms::ProducerAnalyzer::~ProducerAnalyzer | ( | ) |
Definition at line 52 of file ProducerAnalyzer.cc.
00053 { 00054 00055 // do anything here that needs to be done at desctruction time 00056 // (e.g. close files, deallocate resources etc.) 00057 00058 }
void cms::ProducerAnalyzer::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 75 of file ProducerAnalyzer.cc.
References begin, GenMuonPlsPt100GeV_cfg::cout, ReconstructionGR_cff::ecal, ecalInput_, end, lat::endl(), PV3DBase< T, PVType, FrameType >::eta(), gammaClus_, edm::EventSetup::get(), edm::Event::getAllProvenance(), edm::Event::getByLabel(), CaloGeometry::getPosition(), hbheInput_, hfInput_, hoInput_, it, metsig::jet, jetCalo_, pfTauBenchmarkGeneric_cfi::jets, nameProd_, PV3DBase< T, PVType, FrameType >::phi(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), size, track, tracks, and Tracks_.
00076 { 00077 00078 using namespace edm; 00079 00080 const CaloGeometry* geo; 00081 edm::ESHandle<CaloGeometry> pG; 00082 iSetup.get<CaloGeometryRecord>().get(pG); 00083 geo = pG.product(); 00084 00085 00086 std::vector<Provenance const*> theProvenance; 00087 iEvent.getAllProvenance(theProvenance); 00088 for( std::vector<Provenance const*>::const_iterator ip = theProvenance.begin(); 00089 ip != theProvenance.end(); ip++) 00090 { 00091 cout<<" Print all module/label names "<<(**ip).moduleName()<<" "<<(**ip).moduleLabel()<< 00092 " "<<(**ip).productInstanceName()<<endl; 00093 } 00094 00095 bool allowMissingInputs_ = true; 00096 00097 if(nameProd_ == "hoCalibProducer") 00098 { 00099 edm::Handle<HOCalibVariableCollection> ho; 00100 iEvent.getByLabel(nameProd_,hoInput_, ho); 00101 const HOCalibVariableCollection Hitho = *(ho.product()); 00102 std::cout<<" Size of HO "<<(Hitho).size()<<std::endl; 00103 } 00104 00105 if(nameProd_ == "ALCARECOMuAlZMuMu" ) 00106 { 00107 00108 edm::Handle<HORecHitCollection> ho; 00109 iEvent.getByLabel("horeco", ho); 00110 const HORecHitCollection Hitho = *(ho.product()); 00111 std::cout<<" Size of HO "<<(Hitho).size()<<std::endl; 00112 edm::Handle<MuonCollection> mucand; 00113 iEvent.getByLabel(nameProd_,"SelectedMuons", mucand); 00114 std::cout<<" Size of muon collection "<<mucand->size()<<std::endl; 00115 for(MuonCollection::const_iterator it = mucand->begin(); it != mucand->end(); it++) 00116 { 00117 TrackRef mu = (*it).combinedMuon(); 00118 std::cout<<" Pt muon "<<mu->innerMomentum()<<std::endl; 00119 } 00120 00121 } 00122 00123 if(nameProd_ != "IsoProd" && nameProd_ != "ALCARECOMuAlZMuMu" && nameProd_ != "hoCalibProducer") 00124 { 00125 edm::Handle<HBHERecHitCollection> hbhe; 00126 iEvent.getByLabel(nameProd_,hbheInput_, hbhe); 00127 const HBHERecHitCollection Hithbhe = *(hbhe.product()); 00128 std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl; 00129 00130 00131 edm::Handle<HORecHitCollection> ho; 00132 iEvent.getByLabel(nameProd_,hoInput_, ho); 00133 const HORecHitCollection Hitho = *(ho.product()); 00134 std::cout<<" Size of HO "<<(Hitho).size()<<std::endl; 00135 00136 00137 edm::Handle<HFRecHitCollection> hf; 00138 iEvent.getByLabel(nameProd_,hfInput_, hf); 00139 const HFRecHitCollection Hithf = *(hf.product()); 00140 std::cout<<" Size of HF "<<(Hithf).size()<<std::endl; 00141 } 00142 if(nameProd_ == "IsoProd") 00143 { 00144 cout<<" We are here "<<endl; 00145 edm::Handle<reco::TrackCollection> tracks; 00146 iEvent.getByLabel(nameProd_,Tracks_,tracks); 00147 00148 00149 std::cout<<" Tracks size "<<(*tracks).size()<<std::endl; 00150 reco::TrackCollection::const_iterator track = tracks->begin (); 00151 00152 for (; track != tracks->end (); track++) 00153 { 00154 cout<<" P track "<<(*track).p()<<" eta "<<(*track).eta()<<" phi "<<(*track).phi()<<" Outer "<<(*track).outerMomentum()<<" "<< 00155 (*track).outerPosition()<<endl; 00156 TrackExtraRef myextra = (*track).extra(); 00157 cout<<" Track extra "<<myextra->outerMomentum()<<" "<<myextra->outerPosition()<<endl; 00158 } 00159 00160 edm::Handle<EcalRecHitCollection> ecal; 00161 iEvent.getByLabel(nameProd_,ecalInput_,ecal); 00162 const EcalRecHitCollection Hitecal = *(ecal.product()); 00163 std::cout<<" Size of Ecal "<<(Hitecal).size()<<std::endl; 00164 EcalRecHitCollection::const_iterator hite = (ecal.product())->begin (); 00165 00166 double energyECAL = 0.; 00167 double energyHCAL = 0.; 00168 00169 for (; hite != (ecal.product())->end (); hite++) 00170 { 00171 00172 // cout<<" Energy ECAL "<<(*hite).energy()<<endl; 00173 00174 00175 // " eta "<<(*hite).detid()<<" phi "<<(*hite).detid().getPosition().phi()<<endl; 00176 00177 GlobalPoint posE = geo->getPosition((*hite).detid()); 00178 00179 cout<<" Energy ECAL "<<(*hite).energy()<< 00180 " eta "<<posE.eta()<<" phi "<<posE.phi()<<endl; 00181 00182 energyECAL = energyECAL + (*hite).energy(); 00183 00184 } 00185 00186 edm::Handle<HBHERecHitCollection> hbhe; 00187 iEvent.getByLabel(nameProd_,hbheInput_,hbhe); 00188 const HBHERecHitCollection Hithbhe = *(hbhe.product()); 00189 std::cout<<" Size of HBHE "<<(Hithbhe).size()<<std::endl; 00190 HBHERecHitCollection::const_iterator hith = (hbhe.product())->begin (); 00191 00192 for (; hith != (hbhe.product())->end (); hith++) 00193 { 00194 00195 GlobalPoint posH = geo->getPosition((*hith).detid()); 00196 00197 cout<<" Energy HCAL "<<(*hith).energy()<< 00198 " eta "<<posH.eta()<<" phi "<<posH.phi()<<endl; 00199 00200 energyHCAL = energyHCAL + (*hith).energy(); 00201 00202 } 00203 00204 cout<<" Energy ECAL "<< energyECAL<<" Energy HCAL "<< energyHCAL<<endl; 00205 00206 edm::Handle<HORecHitCollection> ho; 00207 iEvent.getByLabel(nameProd_,hoInput_,ho); 00208 const HORecHitCollection Hitho = *(ho.product()); 00209 std::cout<<" Size of HO "<<(Hitho).size()<<std::endl; 00210 HORecHitCollection::const_iterator hito = (ho.product())->begin (); 00211 00212 for (; hito != (ho.product())->end (); hito++) 00213 { 00214 // cout<<" Energy HO "<<(*hito).energy()<<endl; 00215 // " eta "<<(*hite).eta()<<" phi "<<(*hite).phi()<<endl; 00216 } 00217 00218 } 00219 00220 00221 if(nameProd_ == "GammaJetProd" || nameProd_ == "DiJProd") 00222 { 00223 cout<<" we are in GammaJetProd area "<<endl; 00224 edm::Handle<EcalRecHitCollection> ecal; 00225 iEvent.getByLabel(nameProd_,ecalInput_, ecal); 00226 std::cout<<" Size of ECAL "<<(*ecal).size()<<std::endl; 00227 00228 edm::Handle<reco::CaloJetCollection> jets; 00229 iEvent.getByLabel(nameProd_,jetCalo_, jets); 00230 std::cout<<" Jet size "<<(*jets).size()<<std::endl; 00231 reco::CaloJetCollection::const_iterator jet = jets->begin (); 00232 for (; jet != jets->end (); jet++) 00233 { 00234 cout<<" Et jet "<<(*jet).et()<<" eta "<<(*jet).eta()<<" phi "<<(*jet).phi()<<endl; 00235 } 00236 00237 edm::Handle<reco::TrackCollection> tracks; 00238 iEvent.getByLabel(nameProd_,Tracks_, tracks); 00239 std::cout<<" Tracks size "<<(*tracks).size()<<std::endl; 00240 } 00241 if( nameProd_ == "GammaJetProd") 00242 { 00243 edm::Handle<reco::SuperClusterCollection> eclus; 00244 iEvent.getByLabel(nameProd_,gammaClus_, eclus); 00245 std::cout<<" GammaClus size "<<(*eclus).size()<<std::endl; 00246 reco::SuperClusterCollection::const_iterator iclus = eclus->begin (); 00247 for (; iclus != eclus->end (); iclus++) 00248 { 00249 cout<<" Et gamma "<<(*iclus).energy()/cosh((*iclus).eta())<<" eta "<<(*iclus).eta()<<" phi "<<(*iclus).phi()<<endl; 00250 } 00251 } 00252 00253 }
void cms::ProducerAnalyzer::beginJob | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
std::string cms::ProducerAnalyzer::ecalInput_ [private] |
std::string cms::ProducerAnalyzer::gammaClus_ [private] |
std::string cms::ProducerAnalyzer::hbheInput_ [private] |
std::string cms::ProducerAnalyzer::hfInput_ [private] |
std::string cms::ProducerAnalyzer::hoInput_ [private] |
std::string cms::ProducerAnalyzer::jetCalo_ [private] |
std::string cms::ProducerAnalyzer::nameProd_ [private] |
std::string cms::ProducerAnalyzer::Tracks_ [private] |