#include <AnalysisExamples/SimTrackerAnalysis/interface/SimTrackSimVertexAnalyzer.h>
Public Member Functions | |
virtual void | analyze (const edm::Event &, const edm::EventSetup &) |
void | association (std::vector< SimTrack >, std::vector< SimVertex >) |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
SimTrackSimVertexAnalyzer (const edm::ParameterSet &) | |
virtual | ~SimTrackSimVertexAnalyzer () |
Private Attributes | |
bool | associate |
std::string | fOutputFileName |
TFile * | histoPlot |
double | luminosityR |
double | luminosityZ |
TH1D * | momentumPERP |
TH1D * | momentumX |
TH1D * | momentumY |
TH1D * | momentumZ |
TH1D * | numbTk |
TH1D * | numbVtx |
TH1D * | parentInd |
TH1D * | positionZ |
std::string | SimTkLabel |
std::string | SimVtxLabel |
TH1D * | trackID |
TH1D * | type |
Definition at line 19 of file SimTrackSimVertexAnalyzer.h.
SimTrackSimVertexAnalyzer::SimTrackSimVertexAnalyzer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 48 of file SimTrackSimVertexAnalyzer.cc.
00048 : 00049 fOutputFileName(iConfig.getUntrackedParameter("HistOutFile",std::string("TestHiggsMass.root"))), 00050 SimTkLabel(iConfig.getUntrackedParameter("moduleLabelTk",std::string("g4SimHits"))), 00051 SimVtxLabel(iConfig.getUntrackedParameter("moduleLabelVtx",std::string("g4SimHits"))), 00052 associate(iConfig.getUntrackedParameter("TkVtxAssociation",bool(true))), 00053 luminosityZ(iConfig.getUntrackedParameter("LuminosityZ",double(11))), 00054 luminosityR(iConfig.getUntrackedParameter("LuminosityR",double(0.004))), 00055 numbTk(0),momentumX(0),momentumY(0),momentumZ(0),momentumPERP(0),trackID(0),type(0), 00056 numbVtx(0),positionZ(0),parentInd(0),histoPlot(0) 00057 { 00058 00059 }
virtual SimTrackSimVertexAnalyzer::~SimTrackSimVertexAnalyzer | ( | ) | [inline, virtual] |
void SimTrackSimVertexAnalyzer::analyze | ( | const edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [virtual] |
Implements edm::EDAnalyzer.
Definition at line 88 of file SimTrackSimVertexAnalyzer.cc.
References associate, association(), edm::Event::getByLabel(), momentumPERP, momentumX, momentumY, momentumZ, numbTk, numbVtx, parentInd, positionZ, SimTkLabel, SimVtxLabel, funct::sqrt(), and trackID.
00089 { 00090 using namespace edm; 00091 00092 std::vector<SimTrack> theSimTracks; 00093 std::vector<SimVertex> theSimVertexes; 00094 00095 00096 Handle<SimTrackContainer> SimTk; 00097 Handle<SimVertexContainer> SimVtx; 00098 00099 iEvent.getByLabel(SimTkLabel,SimTk); 00100 iEvent.getByLabel(SimVtxLabel,SimVtx); 00101 00102 theSimTracks.insert(theSimTracks.end(),SimTk->begin(),SimTk->end()); 00103 theSimVertexes.insert(theSimVertexes.end(),SimVtx->begin(),SimVtx->end()); 00104 00105 numbTk->Fill(theSimTracks.size()); 00106 for (std::vector<SimTrack>::iterator isimtk = theSimTracks.begin(); 00107 isimtk != theSimTracks.end(); ++isimtk){ 00108 momentumX->Fill(isimtk->momentum().x()); 00109 momentumY->Fill(isimtk->momentum().y()); 00110 momentumZ->Fill(isimtk->momentum().z()); 00111 momentumPERP->Fill(std::sqrt(isimtk->momentum().perp2())); 00112 trackID->Fill(double(isimtk->trackId())); 00113 type->Fill(isimtk->type()); 00114 } 00115 00116 numbVtx->Fill(theSimVertexes.size()); 00117 for (std::vector<SimVertex>::iterator isimvtx = theSimVertexes.begin(); 00118 isimvtx != theSimVertexes.end(); ++isimvtx){ 00119 positionZ->Fill(isimvtx->position().z()); 00120 parentInd->Fill(isimvtx->parentIndex()); 00121 } 00122 00123 if(associate) association(theSimTracks, theSimVertexes); 00124 00125 return; 00126 00127 }
void SimTrackSimVertexAnalyzer::association | ( | std::vector< SimTrack > | trackContainer, | |
std::vector< SimVertex > | vertexsContainer | |||
) |
Definition at line 129 of file SimTrackSimVertexAnalyzer.cc.
References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), luminosityR, luminosityZ, funct::sqrt(), and z.
Referenced by analyze().
00130 { 00131 00132 for (int isimvtx = 0; isimvtx < vertexsContainer.size();isimvtx++){ 00133 if(vertexsContainer[isimvtx].noParent() && 00134 fabs(vertexsContainer[isimvtx].position().z()) > luminosityZ && 00135 std::sqrt(vertexsContainer[isimvtx].position().perp2()) > luminosityR){ 00136 std::cout<<"SimVertex without a parent tracks it could be 'Primary Vertex'"<<std::endl; 00137 std::cout<<"but position is outside the luminosity region = "<<std::endl; 00138 std::cout<<vertexsContainer[isimvtx]<<std::endl; 00139 for (std::vector<SimTrack>::iterator isimtk = trackContainer.begin(); 00140 isimtk != trackContainer.end(); ++isimtk){ 00141 if(isimtk->vertIndex() == isimvtx){ 00142 std::cout<<"SimTrack that start from this Vertex = "<< *isimtk <<std::endl; 00143 } 00144 } 00145 } 00146 } 00147 00148 for (std::vector<SimTrack>::iterator isimtk = trackContainer.begin(); 00149 isimtk != trackContainer.end(); ++isimtk){ 00150 if(isimtk->noVertex()){ 00151 std::cout<<"SimTrack without an associated Vertex = "<< *isimtk <<std::endl; 00152 } 00153 } 00154 00155 return; 00156 }
void SimTrackSimVertexAnalyzer::beginJob | ( | const edm::EventSetup & | iSetup | ) | [virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 62 of file SimTrackSimVertexAnalyzer.cc.
References fOutputFileName, histoPlot, momentumPERP, momentumX, momentumY, momentumZ, numbTk, numbVtx, parentInd, positionZ, and trackID.
00062 { 00063 00064 histoPlot = new TFile(fOutputFileName.c_str(),"RECREATE"); 00065 00066 numbTk = new TH1D( "NumberOfTrack" , "Number of Tracks" , 100, 0., 100. ) ; 00067 momentumX = new TH1D( "MomentumX" , "Momentum X" , 100, -2., 2. ) ; 00068 momentumY = new TH1D( "MomentumY" , "Momentum Y" , 100, -2., 2. ) ; 00069 momentumZ = new TH1D( "MomentumZ" , "Momentum Z" , 100, -40., 40. ) ; 00070 momentumPERP = new TH1D( "MomentumPerp" , "Momentum Perp" , 100, 0., 5. ) ; 00071 trackID = new TH1D( "TrackID" , "Track ID" , 300, 0., 600. ) ; 00072 type = new TH1D( "Type" , "Hep PDT code" , 200, -400., 400. ) ; 00073 00074 numbVtx = new TH1D( "NumberOfVertex" , "Number of Vertex" , 100, 0., 100. ) ; 00075 positionZ = new TH1D( "PositionZ" , "Position Z" , 200, -300., 300. ) ; 00076 parentInd = new TH1D( "ParentIndex" , "Parent Index" , 100, -10., 500. ) ; 00077 00078 return; 00079 00080 }
Reimplemented from edm::EDAnalyzer.
Definition at line 160 of file SimTrackSimVertexAnalyzer.cc.
References histoPlot.
bool SimTrackSimVertexAnalyzer::associate [private] |
std::string SimTrackSimVertexAnalyzer::fOutputFileName [private] |
TFile* SimTrackSimVertexAnalyzer::histoPlot [private] |
double SimTrackSimVertexAnalyzer::luminosityR [private] |
double SimTrackSimVertexAnalyzer::luminosityZ [private] |
TH1D* SimTrackSimVertexAnalyzer::momentumPERP [private] |
TH1D* SimTrackSimVertexAnalyzer::momentumX [private] |
TH1D* SimTrackSimVertexAnalyzer::momentumY [private] |
TH1D* SimTrackSimVertexAnalyzer::momentumZ [private] |
TH1D* SimTrackSimVertexAnalyzer::numbTk [private] |
TH1D* SimTrackSimVertexAnalyzer::numbVtx [private] |
TH1D* SimTrackSimVertexAnalyzer::parentInd [private] |
TH1D* SimTrackSimVertexAnalyzer::positionZ [private] |
std::string SimTrackSimVertexAnalyzer::SimTkLabel [private] |
std::string SimTrackSimVertexAnalyzer::SimVtxLabel [private] |
TH1D* SimTrackSimVertexAnalyzer::trackID [private] |
TH1D* SimTrackSimVertexAnalyzer::type [private] |
Definition at line 43 of file SimTrackSimVertexAnalyzer.h.