File indexing completed on 2024-04-06 12:29:07
0001 #include "RecoVertex/ConfigurableVertexReco/test/VertexHisto.h"
0002 #include "Workspace/DataHarvesting/interface/Writer.h"
0003 #include "Workspace/DataHarvesting/interface/SystemWriter.h"
0004 #include "Workspace/DataHarvesting/interface/Tuple.h"
0005
0006 using namespace std;
0007 using namespace reco;
0008 using namespace edm;
0009 using namespace dataharvester;
0010
0011 void VertexHisto::stamp()
0012 {
0013 if ( hasStamped ) return;
0014 SystemWriter ( filename_ ).save ();
0015 hasStamped=true;
0016 }
0017
0018 VertexHisto::VertexHisto ( const string & filename, const string & trackname ) : filename_ ( filename ),
0019 hasStamped(false)
0020 {
0021 stamp();
0022 }
0023
0024 void VertexHisto::saveTracks ( const TransientVertex & trec,
0025 const reco::RecoToSimCollection & p,
0026 const string & name ) const
0027 {
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062
0063 }
0064
0065 void VertexHisto::analyse ( const TrackingVertex & sim, const TransientVertex & rec,
0066 const string & name ) const
0067 {
0068 Tuple t ( name );
0069 float simx=sim.position().x();
0070 float simy=sim.position().y();
0071 float simz=sim.position().z();
0072 float recx=rec.position().x();
0073 float recy=rec.position().y();
0074 float recz=rec.position().z();
0075 float dx=recx-simx;
0076 float dy=recy-simy;
0077 float dz=recz-simz;
0078 t["simx"]=simx;
0079 t["simy"]=simy;
0080 t["simz"]=simz;
0081 t["recx"]=recx;
0082 t["recy"]=recy;
0083 t["recz"]=recz;
0084 t["x"]=dx;
0085 t["y"]=dy;
0086 t["z"]=dz;
0087 t["dx"]=dx;
0088 t["dy"]=dy;
0089 t["dz"]=dz;
0090 float pullx = dx / sqrt ( rec.positionError().cxx() );
0091 float pully = dy / sqrt ( rec.positionError().cyy() );
0092 float pullz = dz / sqrt ( rec.positionError().czz() );
0093 t["stx"]=pullx;
0094 t["sty"]=pully;
0095 t["stz"]=pullz;
0096 t["time"]=0.;
0097
0098 Writer::file ( filename_ ) << t;
0099 }
0100
0101 VertexHisto::~VertexHisto()
0102 {
0103 Writer::close();
0104 }