Skip to content

Commit

Permalink
avoid a bit of memory churn
Browse files Browse the repository at this point in the history
  • Loading branch information
VinInn committed Jul 31, 2014
1 parent 1f6d6e0 commit 0f681ac
Show file tree
Hide file tree
Showing 2 changed files with 176 additions and 0 deletions.
122 changes: 122 additions & 0 deletions RecoVertex/V0Producer/src/V0Fitter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
// -*- C++ -*-
//
// Package: V0Producer
// Class: V0Fitter
//
/**\class V0Fitter V0Fitter.h RecoVertex/V0Producer/interface/V0Fitter.h
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Brian Drell
// Created: Fri May 18 22:57:40 CEST 2007
//
//

#ifndef RECOVERTEX__V0_FITTER_H
#define RECOVERTEX__V0_FITTER_H

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Utilities/interface/InputTag.h"

#include "DataFormats/Common/interface/Ref.h"

#include "DataFormats/VertexReco/interface/Vertex.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "RecoVertex/VertexPrimitives/interface/TransientVertex.h"
#include "TrackingTools/TransientTrack/interface/TransientTrack.h"
#include "RecoVertex/KalmanVertexFit/interface/KalmanVertexFitter.h"
#include "RecoVertex/AdaptiveVertexFit/interface/AdaptiveVertexFitter.h"

#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/VolumeBasedEngine/interface/VolumeBasedMagneticField.h"

#include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"
#include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h"
#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
#include "Geometry/CommonDetUnit/interface/GeomDet.h"
#include "Geometry/TrackerGeometryBuilder/interface/GluedGeomDet.h"
#include "FWCore/Framework/interface/ConsumesCollector.h"

#include "DataFormats/TrackingRecHit/interface/TrackingRecHit.h"
#include "DataFormats/BeamSpot/interface/BeamSpot.h"

#include <string>
#include <fstream>


class dso_hidden V0Fitter {
public:
V0Fitter(const edm::ParameterSet& theParams,
edm::ConsumesCollector && iC);
~V0Fitter();

// Switching to L. Lista's reco::Candidate infrastructure for V0 storage
void fitAll(const edm::Event& iEvent, const edm::EventSetup& iSetup,
reco::VertexCompositeCandidateCollection & k,
reco::VertexCompositeCandidateCollection & l);

private:

// Tracker geometry for discerning hit positions
const TrackerGeometry* trackerGeom;

const MagneticField* magField;

bool useRefTrax;
// bool storeRefTrax;
bool doKshorts;
bool doLambdas;

/*bool doPostFitCuts;
bool doTkQualCuts;*/

// Cuts
double chi2Cut;
double tkChi2Cut;
int tkNhitsCut;
double rVtxCut;
double vtxSigCut;
// double vtxSigCut3D;
double collinCut;
double kShortMassCut;
double lambdaMassCut;
double impactParameterSigCut;
double mPiPiCut;
double tkDCACut;
double innerHitPosCut;

std::vector<reco::TrackBase::TrackQuality> qualities;

edm::EDGetTokenT<reco::TrackCollection> token_tracks;
edm::EDGetTokenT<reco::BeamSpot> token_beamSpot;
edm::InputTag vtxFitter;

// Helper method that does the actual fitting using the KalmanVertexFitter
double findV0MassError(const GlobalPoint &vtxPos, const std::vector<reco::TransientTrack> &dauTracks);

// Applies cuts to the VertexCompositeCandidates after they are fitted/created.
//void applyPostFitCuts();

// Stuff for debug file output.
std::ofstream mPiPiMassOut;

inline void initFileOutput() {
mPiPiMassOut.open("mPiPi.txt", std::ios::app);
}
inline void cleanupFileOutput() {
mPiPiMassOut.close();
}
};

#endif
54 changes: 54 additions & 0 deletions RecoVertex/V0Producer/src/V0Producer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// -*- C++ -*-
//
// Package: V0Producer
// Class: V0Producer
//
/**\class V0Producer V0Producer.h RecoVertex/V0Producer/interface/V0Producer.h
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Brian Drell
// Created: Fri May 18 22:57:40 CEST 2007
//
//

#ifndef RECOVERTEX__V0_PRODUCER_H
#define RECOVERTEX__V0_PRODUCER_H

// system include files
#include <memory>

// user include files
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/stream/EDProducer.h"

#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/MakerMacros.h"

#include "FWCore/ParameterSet/interface/ParameterSet.h"

#include "FWCore/Framework/interface/ESHandle.h"

#include "DataFormats/VertexReco/interface/Vertex.h"
//#include "DataFormats/V0Candidate/interface/V0Candidate.h"
#include "DataFormats/Candidate/interface/VertexCompositeCandidate.h"

#include "RecoVertex/V0Producer/interface/V0Fitter.h"

class V0Producer : public edm::stream::EDProducer<> {
public:
explicit V0Producer(const edm::ParameterSet&);
~V0Producer();

private:
virtual void produce(edm::Event&, const edm::EventSetup&) override;

edm::ParameterSet theParams;
V0Fitter * theVees;
};

#endif

0 comments on commit 0f681ac

Please sign in to comment.