CMS 3D CMS Logo

SimTrackSimVertexAnalyzer Class Reference

#include <AnalysisExamples/SimTrackerAnalysis/interface/SimTrackSimVertexAnalyzer.h>

Inheritance diagram for SimTrackSimVertexAnalyzer:

edm::EDAnalyzer

List of all members.

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


Detailed Description

Definition at line 19 of file SimTrackSimVertexAnalyzer.h.


Constructor & Destructor Documentation

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]

Definition at line 22 of file SimTrackSimVertexAnalyzer.h.

00022 {};


Member Function Documentation

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 }

void SimTrackSimVertexAnalyzer::endJob ( void   )  [virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 160 of file SimTrackSimVertexAnalyzer.cc.

References histoPlot.

00160                                  {
00161 
00162   histoPlot->Write() ;
00163   histoPlot->Close() ;
00164   
00165   return ;
00166 }


Member Data Documentation

bool SimTrackSimVertexAnalyzer::associate [private]

Definition at line 32 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze().

std::string SimTrackSimVertexAnalyzer::fOutputFileName [private]

Definition at line 29 of file SimTrackSimVertexAnalyzer.h.

Referenced by beginJob().

TFile* SimTrackSimVertexAnalyzer::histoPlot [private]

Definition at line 49 of file SimTrackSimVertexAnalyzer.h.

Referenced by beginJob(), and endJob().

double SimTrackSimVertexAnalyzer::luminosityR [private]

Definition at line 34 of file SimTrackSimVertexAnalyzer.h.

Referenced by association().

double SimTrackSimVertexAnalyzer::luminosityZ [private]

Definition at line 33 of file SimTrackSimVertexAnalyzer.h.

Referenced by association().

TH1D* SimTrackSimVertexAnalyzer::momentumPERP [private]

Definition at line 41 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::momentumX [private]

Definition at line 38 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::momentumY [private]

Definition at line 39 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::momentumZ [private]

Definition at line 40 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::numbTk [private]

Definition at line 37 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::numbVtx [private]

Definition at line 45 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::parentInd [private]

Definition at line 47 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::positionZ [private]

Definition at line 46 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

std::string SimTrackSimVertexAnalyzer::SimTkLabel [private]

Definition at line 30 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze().

std::string SimTrackSimVertexAnalyzer::SimVtxLabel [private]

Definition at line 31 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze().

TH1D* SimTrackSimVertexAnalyzer::trackID [private]

Definition at line 42 of file SimTrackSimVertexAnalyzer.h.

Referenced by analyze(), and beginJob().

TH1D* SimTrackSimVertexAnalyzer::type [private]

Definition at line 43 of file SimTrackSimVertexAnalyzer.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:31:45 2009 for CMSSW by  doxygen 1.5.4