Go to the documentation of this file.00001 #include "CalibTracker/SiStripCommon/interface/ShallowTracksProducer.h"
00002
00003 #include "FWCore/Framework/interface/Event.h"
00004 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00005 #include "DataFormats/TrackReco/interface/Track.h"
00006 #include "DataFormats/TrackReco/interface/TrackFwd.h"
00007 #include "TrackingTools/PatternTools/interface/Trajectory.h"
00008 #include "boost/foreach.hpp"
00009
00010 ShallowTracksProducer::ShallowTracksProducer(const edm::ParameterSet& iConfig)
00011 : theTracksLabel( iConfig.getParameter<edm::InputTag>("Tracks") ),
00012 Prefix ( iConfig.getParameter<std::string>("Prefix") ),
00013 Suffix ( iConfig.getParameter<std::string>("Suffix") )
00014 {
00015 produces <unsigned int> ( Prefix + "number" + Suffix );
00016 produces <std::vector<double> > ( Prefix + "chi2" + Suffix );
00017 produces <std::vector<double> > ( Prefix + "ndof" + Suffix );
00018 produces <std::vector<double> > ( Prefix + "chi2ndof" + Suffix );
00019 produces <std::vector<float> > ( Prefix + "charge" + Suffix );
00020 produces <std::vector<float> > ( Prefix + "momentum" + Suffix );
00021 produces <std::vector<float> > ( Prefix + "pt" + Suffix );
00022 produces <std::vector<float> > ( Prefix + "pterr" + Suffix );
00023 produces <std::vector<unsigned int> > ( Prefix + "hitsvalid" + Suffix );
00024 produces <std::vector<unsigned int> > ( Prefix + "hitslost" + Suffix );
00025 produces <std::vector<double> > ( Prefix + "theta" + Suffix );
00026 produces <std::vector<double> > ( Prefix + "thetaerr" + Suffix );
00027 produces <std::vector<double> > ( Prefix + "phi" + Suffix );
00028 produces <std::vector<double> > ( Prefix + "phierr" + Suffix );
00029 produces <std::vector<double> > ( Prefix + "eta" + Suffix );
00030 produces <std::vector<double> > ( Prefix + "etaerr" + Suffix );
00031 produces <std::vector<double> > ( Prefix + "dxy" + Suffix );
00032 produces <std::vector<double> > ( Prefix + "dxyerr" + Suffix );
00033 produces <std::vector<double> > ( Prefix + "dsz" + Suffix );
00034 produces <std::vector<double> > ( Prefix + "dszerr" + Suffix );
00035 produces <std::vector<double> > ( Prefix + "qoverp" + Suffix );
00036 produces <std::vector<double> > ( Prefix + "qoverperr" + Suffix );
00037 produces <std::vector<double> > ( Prefix + "vx" + Suffix );
00038 produces <std::vector<double> > ( Prefix + "vy" + Suffix );
00039 produces <std::vector<double> > ( Prefix + "vz" + Suffix );
00040 produces <std::vector<int> > ( Prefix + "algo" + Suffix );
00041 }
00042
00043 void ShallowTracksProducer::
00044 produce(edm::Event& iEvent, const edm::EventSetup& iSetup) {
00045 std::auto_ptr<unsigned int> number ( new unsigned int(0) );
00046 std::auto_ptr<std::vector<double> > chi2 ( new std::vector<double>() );
00047 std::auto_ptr<std::vector<double> > ndof ( new std::vector<double>() );
00048 std::auto_ptr<std::vector<double> > chi2ndof ( new std::vector<double>() );
00049 std::auto_ptr<std::vector<float> > charge ( new std::vector<float>() );
00050 std::auto_ptr<std::vector<float> > momentum ( new std::vector<float>() );
00051 std::auto_ptr<std::vector<float> > pt ( new std::vector<float>() );
00052 std::auto_ptr<std::vector<float> > pterr ( new std::vector<float>() );
00053 std::auto_ptr<std::vector<unsigned int> > hitsvalid ( new std::vector<unsigned int>() );
00054 std::auto_ptr<std::vector<unsigned int> > hitslost ( new std::vector<unsigned int>() );
00055 std::auto_ptr<std::vector<double> > theta ( new std::vector<double>() );
00056 std::auto_ptr<std::vector<double> > thetaerr ( new std::vector<double>() );
00057 std::auto_ptr<std::vector<double> > phi ( new std::vector<double>() );
00058 std::auto_ptr<std::vector<double> > phierr ( new std::vector<double>() );
00059 std::auto_ptr<std::vector<double> > eta ( new std::vector<double>() );
00060 std::auto_ptr<std::vector<double> > etaerr ( new std::vector<double>() );
00061 std::auto_ptr<std::vector<double> > dxy ( new std::vector<double>() );
00062 std::auto_ptr<std::vector<double> > dxyerr ( new std::vector<double>() );
00063 std::auto_ptr<std::vector<double> > dsz ( new std::vector<double>() );
00064 std::auto_ptr<std::vector<double> > dszerr ( new std::vector<double>() );
00065 std::auto_ptr<std::vector<double> > qoverp ( new std::vector<double>() );
00066 std::auto_ptr<std::vector<double> > qoverperr ( new std::vector<double>() );
00067 std::auto_ptr<std::vector<double> > vx ( new std::vector<double>() );
00068 std::auto_ptr<std::vector<double> > vy ( new std::vector<double>() );
00069 std::auto_ptr<std::vector<double> > vz ( new std::vector<double>() );
00070 std::auto_ptr<std::vector<int> > algo ( new std::vector<int>() );
00071
00072 edm::Handle<edm::View<reco::Track> > tracks; iEvent.getByLabel(theTracksLabel, tracks);
00073
00074 *number = tracks->size();
00075 BOOST_FOREACH( const reco::Track track, *tracks) {
00076 chi2->push_back( track.chi2() );
00077 ndof->push_back( track.ndof() );
00078 chi2ndof->push_back( track.chi2()/track.ndof() );
00079 charge->push_back( track.charge() );
00080 momentum->push_back( track.p() );
00081 pt->push_back( track.pt() );
00082 pterr->push_back( track.ptError() );
00083 hitsvalid->push_back( track.numberOfValidHits() );
00084 hitslost->push_back( track.numberOfLostHits() );
00085 theta->push_back( track.theta() );
00086 thetaerr->push_back( track.thetaError() );
00087 phi->push_back( track.phi() );
00088 phierr->push_back( track.phiError() );
00089 eta->push_back( track.eta() );
00090 etaerr->push_back( track.etaError() );
00091 dxy->push_back( track.dxy() );
00092 dxyerr->push_back( track.dxyError() );
00093 dsz->push_back( track.dsz() );
00094 dszerr->push_back( track.dszError() );
00095 qoverp->push_back( track.qoverp() );
00096 qoverperr->push_back( track.qoverpError() );
00097 vx->push_back( track.vx() );
00098 vy->push_back( track.vy() );
00099 vz->push_back( track.vz() );
00100 algo->push_back( (int) track.algo() );
00101 }
00102
00103 iEvent.put(number, Prefix + "number" + Suffix );
00104 iEvent.put(chi2, Prefix + "chi2" + Suffix );
00105 iEvent.put(ndof, Prefix + "ndof" + Suffix );
00106 iEvent.put(chi2ndof, Prefix + "chi2ndof" + Suffix );
00107 iEvent.put(charge, Prefix + "charge" + Suffix );
00108 iEvent.put(momentum, Prefix + "momentum" + Suffix );
00109 iEvent.put(pt, Prefix + "pt" + Suffix );
00110 iEvent.put(pterr, Prefix + "pterr" + Suffix );
00111 iEvent.put(hitsvalid, Prefix + "hitsvalid" + Suffix );
00112 iEvent.put(hitslost, Prefix + "hitslost" + Suffix );
00113 iEvent.put(theta, Prefix + "theta" + Suffix );
00114 iEvent.put(thetaerr, Prefix + "thetaerr" + Suffix );
00115 iEvent.put(phi, Prefix + "phi" + Suffix );
00116 iEvent.put(phierr, Prefix + "phierr" + Suffix );
00117 iEvent.put(eta, Prefix + "eta" + Suffix );
00118 iEvent.put(etaerr, Prefix + "etaerr" + Suffix );
00119 iEvent.put(dxy, Prefix + "dxy" + Suffix );
00120 iEvent.put(dxyerr, Prefix + "dxyerr" + Suffix );
00121 iEvent.put(dsz, Prefix + "dsz" + Suffix );
00122 iEvent.put(dszerr, Prefix + "dszerr" + Suffix );
00123 iEvent.put(qoverp, Prefix + "qoverp" + Suffix );
00124 iEvent.put(qoverperr, Prefix + "qoverperr" + Suffix );
00125 iEvent.put(vx, Prefix + "vx" + Suffix );
00126 iEvent.put(vy, Prefix + "vy" + Suffix );
00127 iEvent.put(vz, Prefix + "vz" + Suffix );
00128 iEvent.put(algo, Prefix + "algo" + Suffix );
00129
00130 }
00131