CMS 3D CMS Logo

Public Member Functions | Private Attributes

RECOVertex Class Reference

#include <RECOVertex.h>

List of all members.

Public Member Functions

void analyze (edm::Handle< reco::VertexCollection > recoVertexs, TTree *tree)
void clear (void)
 RECOVertex ()
void setup (const edm::ParameterSet &pSet, TTree *tree, std::string vertexType)
 ~RECOVertex ()

Private Attributes

bool _Debug
int NVrtx
float * VertexCand_chi2
float * VertexCand_ndof
int * VertexCand_tracks
float * VertexCand_x
float * VertexCand_y
float * VertexCand_z

Detailed Description

$Date: Dec 2009 $Revision:

Definition at line 19 of file RECOVertex.h.


Constructor & Destructor Documentation

RECOVertex::RECOVertex ( )

Definition at line 14 of file RECOVertex.cc.

References _Debug, kMaxVrt, NVrtx, VertexCand_chi2, VertexCand_ndof, VertexCand_tracks, VertexCand_x, VertexCand_y, and VertexCand_z.

                       {

  //set parameter defaults 
  _Debug=false;

  NVrtx                 = 0;
  VertexCand_x          = new float[kMaxVrt];
  VertexCand_y          = new float[kMaxVrt];
  VertexCand_z          = new float[kMaxVrt];
  VertexCand_tracks     = new int[kMaxVrt];
  VertexCand_chi2       = new float[kMaxVrt];
  VertexCand_ndof       = new float[kMaxVrt];
}
RECOVertex::~RECOVertex ( )

Definition at line 28 of file RECOVertex.cc.

References VertexCand_chi2, VertexCand_ndof, VertexCand_tracks, VertexCand_x, VertexCand_y, and VertexCand_z.

                        {
  delete[] VertexCand_x;
  delete[] VertexCand_y;
  delete[] VertexCand_z;
  delete[] VertexCand_tracks;
  delete[] VertexCand_chi2;
  delete[] VertexCand_ndof;
}

Member Function Documentation

void RECOVertex::analyze ( edm::Handle< reco::VertexCollection recoVertexs,
TTree *  tree 
)

Analyze the Data

Definition at line 92 of file RECOVertex.cc.

References _Debug, clear(), gather_cfg::cout, edm::HandleBase::isValid(), kMaxVrt, min, NVrtx, edm::Handle< T >::product(), findQualityFiles::size, VertexCand_chi2, VertexCand_ndof, VertexCand_tracks, VertexCand_x, VertexCand_y, and VertexCand_z.

Referenced by HLTAnalyzer::analyze(), and HLTBitAnalyzer::analyze().

                                                                                    {

  // reset the tree variables
  clear();

  if ( recoVertexs.isValid() ) {
    const reco::VertexCollection* vertexs = recoVertexs.product();
    reco::VertexCollection::const_iterator vertex_i;

    size_t size = std::min(kMaxVrt, size_t(vertexs->size()) ); 
    NVrtx= size;

    int nVertexCand=0;
    if (_Debug)  std::cout << "Found " << vertexs->size() << " vertices" << std::endl;  
    for (vertex_i = vertexs->begin(); vertex_i != vertexs->end(); vertex_i++){
      if (nVertexCand>=NVrtx) break;
      VertexCand_x[nVertexCand] = vertex_i->x();
      VertexCand_y[nVertexCand] = vertex_i->y();
      VertexCand_z[nVertexCand] = vertex_i->z();
      VertexCand_tracks[nVertexCand] = vertex_i->tracksSize();
      VertexCand_chi2[nVertexCand] = vertex_i->chi2();
      VertexCand_ndof[nVertexCand] = vertex_i->ndof();
      if (_Debug) { 
        std::cout << "RECOVertex -- VX, VY VZ   = " 
                  << VertexCand_x[nVertexCand] << " "
                  << VertexCand_y[nVertexCand] << " "
                  << VertexCand_z[nVertexCand]
                  << std::endl;
        std::cout << "RECOVertex -- Ntracks, Chi2/Dof   = " 
                  << VertexCand_tracks[nVertexCand] << " "
                  << VertexCand_chi2[nVertexCand] << " / " << VertexCand_ndof[nVertexCand]
                  << std::endl;
      }
      nVertexCand++;
      
    }
  }
}
void RECOVertex::clear ( void  )

Definition at line 37 of file RECOVertex.cc.

References kMaxVrt, NVrtx, VertexCand_chi2, VertexCand_ndof, VertexCand_tracks, VertexCand_x, VertexCand_y, and VertexCand_z.

Referenced by analyze().

{
  NVrtx          = 0;
  std::memset(VertexCand_x,            '\0', kMaxVrt * sizeof(float));
  std::memset(VertexCand_y,            '\0', kMaxVrt * sizeof(float));
  std::memset(VertexCand_z,            '\0', kMaxVrt * sizeof(float));
  std::memset(VertexCand_tracks,       '\0', kMaxVrt * sizeof(int));
  std::memset(VertexCand_chi2,         '\0', kMaxVrt * sizeof(float));
  std::memset(VertexCand_ndof,         '\0', kMaxVrt * sizeof(float));
}
void RECOVertex::setup ( const edm::ParameterSet pSet,
TTree *  tree,
std::string  vertexType 
)

Definition at line 49 of file RECOVertex.cc.

References _Debug, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNames(), NVrtx, VertexCand_chi2, VertexCand_ndof, VertexCand_tracks, VertexCand_x, VertexCand_y, and VertexCand_z.

Referenced by HLTAnalyzer::HLTAnalyzer(), and HLTBitAnalyzer::HLTBitAnalyzer().

                                                                                        {

  edm::ParameterSet myHltParams = pSet.getParameter<edm::ParameterSet>("RunParameters") ;
  std::vector<std::string> parameterNames = myHltParams.getParameterNames() ;
  
  for ( std::vector<std::string>::iterator iParam = parameterNames.begin();
        iParam != parameterNames.end(); iParam++ ){
    if ( (*iParam) == "Debug" ) _Debug =  myHltParams.getParameter<bool>( *iParam );
  }

  TString br_recoNVrt = "recoNVrt";
  br_recoNVrt.Append(vertexType);
  HltTree->Branch(br_recoNVrt,        & NVrtx,            "NVrtx/I");

  TString br_recoVrtX = "recoVrtX";
  br_recoVrtX.Append(vertexType);
  HltTree->Branch(br_recoVrtX,     VertexCand_x,          "recoVrtX[NVrtx]/F");

  TString br_recoVrtY = "recoVrtY";
  br_recoVrtY.Append(vertexType);
  HltTree->Branch(br_recoVrtY,     VertexCand_y,          "recoVrtY[NVrtx]/F");

  TString br_recoVrtZ = "recoVrtZ";
  br_recoVrtZ.Append(vertexType);
  HltTree->Branch(br_recoVrtZ,     VertexCand_z,          "recoVrtZ[NVrtx]/F");

  TString br_recoVrtNtrk = "recoVrtNtrk";
  br_recoVrtNtrk.Append(vertexType);
  HltTree->Branch(br_recoVrtNtrk,  VertexCand_tracks,     "recoVrtNtrk[NVrtx]/I");

  TString br_recoVrtChi2 = "recoVrtChi2";
  br_recoVrtChi2.Append(vertexType);
  HltTree->Branch(br_recoVrtChi2,  VertexCand_chi2,       "recoVrtChi2[NVrtx]/F");

  TString br_recoVrtNdof = "recoVrtNdof";
  br_recoVrtNdof.Append(vertexType);
  HltTree->Branch(br_recoVrtNdof,  VertexCand_ndof,       "recoVrtNdof[NVrtx]/F");



}

Member Data Documentation

bool RECOVertex::_Debug [private]

Definition at line 40 of file RECOVertex.h.

Referenced by analyze(), RECOVertex(), and setup().

int RECOVertex::NVrtx [private]

Definition at line 33 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), and setup().

float* RECOVertex::VertexCand_chi2 [private]

Definition at line 36 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().

float* RECOVertex::VertexCand_ndof [private]

Definition at line 37 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().

Definition at line 35 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().

float* RECOVertex::VertexCand_x [private]

Definition at line 34 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().

float * RECOVertex::VertexCand_y [private]

Definition at line 34 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().

float * RECOVertex::VertexCand_z [private]

Definition at line 34 of file RECOVertex.h.

Referenced by analyze(), clear(), RECOVertex(), setup(), and ~RECOVertex().