Go to the documentation of this file.00001
00002
00003
00004
00005
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <memory>
00023
00024
00025 #include "FWCore/Framework/interface/Frameworkfwd.h"
00026 #include "FWCore/Framework/interface/EDAnalyzer.h"
00027
00028 #include "FWCore/Framework/interface/Event.h"
00029 #include "FWCore/Framework/interface/MakerMacros.h"
00030
00031 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00032
00033
00034 #include "DataFormats/Provenance/interface/ProductID.h"
00035 #include "DataFormats/Common/interface/Handle.h"
00036
00037 #include "FWCore/Utilities/interface/InputTag.h"
00038
00039 #include "InputAnalyzer.h"
00040
00041 #include "SimDataFormats/Track/interface/SimTrackContainer.h"
00042 #include "SimDataFormats/CrossingFrame/interface/PCrossingFrame.h"
00043
00044
00045
00046
00047 namespace edm
00048 {
00049
00050 InputAnalyzer::InputAnalyzer(const edm::ParameterSet& iConfig)
00051 {
00052
00053 dataStep2_ = iConfig.getParameter<bool>("dataStep2");
00054
00055 if (dataStep2_)
00056
00057 label_ = iConfig.getParameter<edm::InputTag>("collPCF");
00058 else
00059
00060 label_ = iConfig.getParameter<edm::InputTag>("collSimTrack");
00061 }
00062
00063
00064 InputAnalyzer::~InputAnalyzer()
00065 {
00066 }
00067
00068
00069
00070
00071
00072
00073
00074 void
00075 InputAnalyzer::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup)
00076 {
00077 std::cout << " dataStep2_ = " << dataStep2_ << std::endl;
00078
00079 if (!dataStep2_){
00080
00081
00082 double simPt=0;
00083 int i=0;
00084
00085
00086 edm::Handle<SimTrackContainer> simTracks;
00087 bool gotTracks = iEvent.getByLabel(label_,simTracks);
00088
00089 if (!gotTracks)
00090 {
00091 std::cout<<"-> Could not read SimTracks !!!!"<<std::endl;
00092 }
00093 else{
00094 std::cout<<"-> Could read SimTracks !!!!"<<std::endl;
00095
00096 }
00097
00098
00099
00100 SimTrackContainer::const_iterator simTrack;
00101 for (simTrack = simTracks->begin(); simTrack != simTracks->end(); ++simTrack){
00102 i++;
00103
00104 simPt=(*simTrack).momentum().Pt();
00105
00106
00107 }
00108
00109
00110 }
00111 else{
00112
00113
00114 edm::Handle<PCrossingFrame<SimTrack> > cf_simtrack;
00115 bool gotTracks = iEvent.getByLabel("CFWriter","g4SimHits",cf_simtrack);
00116
00117 if (!gotTracks)
00118 {
00119 std::cout<<"-> Could not read PCrossingFrame<SimTracks> !!!!"<<std::endl;
00120 }
00121 else
00122 std::cout<<"-> Could read PCrossingFrame<SimTracks> !!!!"<<std::endl;
00123
00124 }
00125 }
00126
00127
00128
00129 void InputAnalyzer::beginJob()
00130 {
00131 }
00132
00133
00134 void
00135 InputAnalyzer::endJob() {
00136 }
00137
00138 }