ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/TreeFiller/src/FillerElectrons.cc
Revision 1.49 - (view) (annotate) - [select for diffs]
Mon Oct 18 01:34:48 2010 UTC (14 years, 6 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_015, Mit_015a, Mit_015b, Mit_016
Changes since 1.48: +32 -6 lines
Diff to previous 1.48
fill corrected expected hits inner, ambiguous gsf tracks

Revision 1.48 - (view) (annotate) - [select for diffs]
Thu Jun 24 13:04:04 2010 UTC (14 years, 10 months ago) by peveraer
Branch: MAIN
CVS Tags: Mit_014b, Mit_014c, Mit_014d, Mit_014e
Changes since 1.47: +2 -2 lines
Diff to previous 1.47
// $Id: FillerElectrons.cc,v 1.47 2010/06/24 13:02:27 peveraer Exp $

#include "MitProd/TreeFiller/interface/FillerElectrons.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/EgammaReco/interface/ClusterShape.h"
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
#include "DataFormats/Common/interface/RefToPtr.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "AnalysisDataFormats/Egamma/interface/ElectronID.h"
#include "AnalysisDataFormats/Egamma/interface/ElectronIDAssociation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaEcalIsolation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
#include "TrackingTools/TransientTrack/plugins/TransientTrackBuilderESProducer.h"
#include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexTrackCompatibilityEstimator.h"
#include "TrackingTools/IPTools/interface/IPTools.h"
#include "RecoEgamma/EgammaTools/interface/ConversionFinder.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "MitAna/DataTree/interface/ElectronCol.h"
#include "MitAna/DataTree/interface/Names.h"
#include "MitAna/DataTree/interface/Track.h"
#include "MitEdm/DataFormats/interface/RefToBaseToPtr.h"
#include "MitProd/ObjectService/interface/ObjectService.h"
#include "MitEdm/DataFormats/interface/DecayPart.h"
#include "MitEdm/ConversionRejection/interface/ConversionMatcher.h"

using namespace std;
using namespace edm;
using namespace mithep;

//--------------------------------------------------------------------------------------------------
FillerElectrons::FillerElectrons(const edm::ParameterSet &cfg, const char *name, bool active) :
  BaseFiller(cfg,name,active),
  edmName_(Conf().getUntrackedParameter<string>("edmName","pixelMatchGsfElectrons")),
  mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkElectronBrn)),
  gsfTrackMapName_(Conf().getUntrackedParameter<string>("gsfTrackMapName","")),
  trackerTrackMapName_(Conf().getUntrackedParameter<string>("trackerTrackMapName","")),
  barrelSuperClusterMapName_(Conf().getUntrackedParameter<string>("barrelSuperClusterMapName","")),
  endcapSuperClusterMapName_(Conf().getUntrackedParameter<string>("endcapSuperClusterMapName","")),
  pfSuperClusterMapName_(Conf().getUntrackedParameter<string>("pfSuperClusterMapName","")),
  eIDCutBasedTightName_(Conf().getUntrackedParameter<string>("eIDCutBasedTightName","eidTight")),
  eIDCutBasedLooseName_(Conf().getUntrackedParameter<string>("eIDCutBasedLooseName","eidLoose")),
  pvEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVertices")),
  pvBSEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVerticesWithBS")),
  electrons_(new mithep::ElectronArr(16)),
  gsfTrackMap_(0),
  trackerTrackMap_(0),
  barrelSuperClusterMap_(0),
  endcapSuperClusterMap_(0)
{
  // Constructor.
}

//--------------------------------------------------------------------------------------------------
FillerElectrons::~FillerElectrons()
{
  // Destructor.

  delete electrons_;
}

//--------------------------------------------------------------------------------------------------
void FillerElectrons::BookDataBlock(TreeWriter &tws)
{
  // Add electron branch to our tree and get our maps.

  tws.AddBranch(mitName_,&electrons_);
  OS()->add<mithep::ElectronArr>(electrons_,mitName_);

  if (!gsfTrackMapName_.empty()) {
    gsfTrackMap_ = OS()->get<TrackMap>(gsfTrackMapName_);
    if (gsfTrackMap_)
      AddBranchDep(mitName_,gsfTrackMap_->GetBrName());
  }
  if (!trackerTrackMapName_.empty()) {
    trackerTrackMap_ = OS()->get<TrackMap>(trackerTrackMapName_);
    if (trackerTrackMap_)
      AddBranchDep(mitName_,trackerTrackMap_->GetBrName());
  }
  if (!barrelSuperClusterMapName_.empty()) {
    barrelSuperClusterMap_ = OS()->get<SuperClusterMap>(barrelSuperClusterMapName_);
    if (barrelSuperClusterMap_)
      AddBranchDep(mitName_,barrelSuperClusterMap_->GetBrName());
  }
  if (!endcapSuperClusterMapName_.empty()) {
    endcapSuperClusterMap_ = OS()->get<SuperClusterMap>(endcapSuperClusterMapName_);
    if (endcapSuperClusterMap_)
      AddBranchDep(mitName_,endcapSuperClusterMap_->GetBrName());
  }
  if (!pfSuperClusterMapName_.empty()) {
    pfSuperClusterMap_ = OS()->get<SuperClusterMap>(pfSuperClusterMapName_);
    if (pfSuperClusterMap_)
      AddBranchDep(mitName_,pfSuperClusterMap_->GetBrName());
  }
}

//--------------------------------------------------------------------------------------------------
void FillerElectrons::FillDataBlock(const edm::Event &event, const edm::EventSetup &setup)
{
  // Fill electrons from edm collection into our collection.

  electrons_->Delete();

  Handle<reco::GsfElectronCollection> hElectronProduct;
  GetProduct(edmName_, hElectronProduct, event);

  // handles to get the electron ID information
  Handle<edm::ValueMap<float> > eidLooseMap;
  GetProduct(eIDCutBasedLooseName_, eidLooseMap, event);
  Handle<edm::ValueMap<float> > eidTightMap;
  GetProduct(eIDCutBasedTightName_, eidTightMap, event);

  edm::Handle<reco::VertexCollection> hVertex;
  event.getByLabel(pvEdmName_, hVertex);
  const reco::VertexCollection *pvCol = hVertex.product();

  edm::Handle<reco::VertexCollection> hVertexBS;
  event.getByLabel(pvBSEdmName_, hVertexBS);
  const reco::VertexCollection *pvBSCol = hVertexBS.product();

  edm::Handle<reco::TrackCollection> hGeneralTracks;
  event.getByLabel("generalTracks", hGeneralTracks);
  //const reco::VertexCollection *trackCol = hGeneralTracks.product();

  edm::Handle<std::vector<mitedm::DecayPart> > hConversions;
  event.getByLabel("mvfConversionRemoval", hConversions);

  mitedm::ConversionMatcher convMatcher;

  edm::ESHandle<TransientTrackBuilder> hTransientTrackBuilder;
  setup.get<TransientTrackRecord>().get("TransientTrackBuilder",hTransientTrackBuilder);
  const TransientTrackBuilder *transientTrackBuilder = hTransientTrackBuilder.product();

  GsfVertexTrackCompatibilityEstimator gsfEstimator;

  //Get Magnetic Field from event setup, taking value at (0,0,0)
  edm::ESHandle<MagneticField> magneticField;
  setup.get<IdealMagneticFieldRecord>().get(magneticField);
  const double bfield = magneticField->inTesla(GlobalPoint(0.,0.,0.)).z();

  const reco::GsfElectronCollection inElectrons = *(hElectronProduct.product());
  // loop over electrons
  for (reco::GsfElectronCollection::const_iterator iM = inElectrons.begin();
       iM != inElectrons.end(); ++iM) {

    // the index and Ref are needed for the eID association Map
    unsigned int iElectron = iM - inElectrons.begin();
    reco::GsfElectronRef eRef(hElectronProduct, iElectron);

    mithep::Electron *outElectron = electrons_->AddNew();

    outElectron->SetPtEtaPhi(iM->pt(),iM->eta(),iM->phi());

    outElectron->SetCharge(iM->charge());
    outElectron->SetScPixCharge(iM->scPixCharge());

    outElectron->SetESuperClusterOverP(iM->eSuperClusterOverP());
    outElectron->SetESeedClusterOverPout(iM->eSeedClusterOverPout());
    outElectron->SetPIn(iM->trackMomentumAtVtx().R());
    outElectron->SetPOut(iM->trackMomentumOut().R());
    outElectron->SetDeltaEtaSuperClusterTrackAtVtx(iM->deltaEtaSuperClusterTrackAtVtx());
    outElectron->SetDeltaEtaSeedClusterTrackAtCalo(iM->deltaEtaSeedClusterTrackAtCalo());
    outElectron->SetDeltaPhiSuperClusterTrackAtVtx(iM->deltaPhiSuperClusterTrackAtVtx());
    outElectron->SetDeltaPhiSeedClusterTrackAtCalo(iM->deltaPhiSeedClusterTrackAtCalo());
    outElectron->SetIsEnergyScaleCorrected(iM->isEnergyScaleCorrected());
    outElectron->SetIsMomentumCorrected(iM->isMomentumCorrected());
    outElectron->SetNumberOfClusters(iM->basicClustersSize());
    outElectron->SetClassification(iM->classification());
    outElectron->SetFBrem(iM->fbrem());

    // pflow electron stuff
    outElectron->SetIsEcalDriven(iM->ecalDrivenSeed());
    outElectron->SetIsTrackerDriven(iM->trackerDrivenSeed());
    outElectron->SetMva(iM->mva());

    // shower shape variables
    outElectron->SetE15(iM->e1x5());
    outElectron->SetE25Max(iM->e2x5Max());
    outElectron->SetE55(iM->e5x5());
    outElectron->SetCovEtaEta(iM->sigmaEtaEta());
    outElectron->SetCoviEtaiEta(iM->sigmaIetaIeta());
    outElectron->SetHadronicOverEm(iM->hcalOverEcal());
    outElectron->SetHcalDepth1OverEcal(iM->hcalDepth1OverEcal());
    outElectron->SetHcalDepth2OverEcal(iM->hcalDepth2OverEcal());

    // fill isolation variables for both cone sizes
    outElectron->SetEcalRecHitIsoDr04(iM->dr04EcalRecHitSumEt());
    outElectron->SetHcalDepth1TowerSumEtDr04(iM->dr04HcalDepth1TowerSumEt());
    outElectron->SetHcalDepth2TowerSumEtDr04(iM->dr04HcalDepth2TowerSumEt());
    outElectron->SetTrackIsolationDr04(iM->dr04TkSumPt());
    outElectron->SetEcalRecHitIsoDr03(iM->dr03EcalRecHitSumEt());
    outElectron->SetHcalTowerSumEtDr03(iM->dr03HcalTowerSumEt());
    outElectron->SetHcalDepth1TowerSumEtDr03(iM->dr03HcalDepth1TowerSumEt());
    outElectron->SetHcalDepth2TowerSumEtDr03(iM->dr03HcalDepth2TowerSumEt());
    outElectron->SetTrackIsolationDr03(iM->dr03TkSumPt());

    // fiducial flags
    outElectron->SetIsEB(iM->isEB());
    outElectron->SetIsEE(iM->isEE());
    outElectron->SetIsEBEEGap(iM->isEBEEGap());
    outElectron->SetIsEBEtaGap(iM->isEBEtaGap());
    outElectron->SetIsEBPhiGap(iM->isEBPhiGap());
    outElectron->SetIsEEDeeGap(iM->isEEDeeGap());
    outElectron->SetIsEERingGap(iM->isEERingGap());

    // gsf-tracker match quality
    outElectron->SetFracSharedHits(iM->shFracInnerHits());

    // make proper links to Tracks and Super Clusters
    if (gsfTrackMap_ && iM->gsfTrack().isNonnull())
      outElectron->SetGsfTrk(gsfTrackMap_->GetMit(refToPtr(iM->gsfTrack())));
    // make tracker track links, relinking from gsf track associations if configured and
    // link is otherwise absent
    if (trackerTrackMap_ && iM->closestCtfTrackRef().isNonnull()) {
        outElectron->SetTrackerTrk(trackerTrackMap_->GetMit(refToPtr(iM->closestCtfTrackRef())));
    }
    if (barrelSuperClusterMap_ && endcapSuperClusterMap_ &&
        pfSuperClusterMap_ && iM->superCluster().isNonnull()) {
      if(barrelSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(barrelSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else if (endcapSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(endcapSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else if (pfSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(pfSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else throw edm::Exception(edm::errors::Configuration, "FillerElectrons:FillDataBlock()\n")
             << "Error! SuperCluster reference in unmapped collection " << edmName_ << endl;
    }

    //compute impact parameter with respect to PV
    if (iM->gsfTrack().isNonnull()) {
      const reco::TransientTrack &tt = transientTrackBuilder->build(iM->gsfTrack());

      const std::pair<bool,Measurement1D> &d0pv =  IPTools::absoluteTransverseImpactParameter(tt,pvCol->at(0));
      if (d0pv.first) {
        outElectron->SetD0PV(d0pv.second.value());
        outElectron->SetD0PVErr(d0pv.second.error());
      }
      else {
        outElectron->SetD0PV(-99.0);
      }


      const std::pair<bool,Measurement1D> &ip3dpv =  IPTools::absoluteImpactParameter3D(tt,pvCol->at(0));
      if (ip3dpv.first) {
        outElectron->SetIp3dPV(ip3dpv.second.value());
        outElectron->SetIp3dPVErr(ip3dpv.second.error());
      }
      else {
        outElectron->SetIp3dPV(-99.0);
      }

      const std::pair<bool,Measurement1D> &d0pvbs =  IPTools::absoluteTransverseImpactParameter(tt,pvBSCol->at(0));
      if (d0pvbs.first) {
        outElectron->SetD0PVBS(d0pvbs.second.value());
        outElectron->SetD0PVBSErr(d0pvbs.second.error());
      }
      else {
        outElectron->SetD0PVBS(-99.0);
      }

      const std::pair<bool,Measurement1D> &ip3dpvbs =  IPTools::absoluteImpactParameter3D(tt,pvBSCol->at(0));
      if (ip3dpvbs.first) {
        outElectron->SetIp3dPVBS(ip3dpvbs.second.value());
        outElectron->SetIp3dPVBSErr(ip3dpvbs.second.error());
      }
      else {
        outElectron->SetIp3dPVBS(-99.0);
      }

      //compute compatibility with PV using full GSF state mixture (but skip in AOD)
      if (iM->gsfTrack()->gsfExtra().isAvailable()) {

        const std::pair<bool,double> &pvGsfCompat = gsfEstimator.estimate(pvCol->at(0),tt);
        if (pvGsfCompat.first) {
          outElectron->SetGsfPVCompatibility(pvGsfCompat.second);
        }
        else {
          outElectron->SetGsfPVCompatibility(-99.0);
        }


        const std::pair<bool,double> &pvbsGsfCompat = gsfEstimator.estimate(pvBSCol->at(0),tt);
        if (pvbsGsfCompat.first) {
          outElectron->SetGsfPVBSCompatibility(pvbsGsfCompat.second);
        }
        else {
          outElectron->SetGsfPVBSCompatibility(-99.0);
        }

        //compute signal vertex compatibility with full GSF state mixture excluding matching ckf track
        //from vertex
        if (iM->closestCtfTrackRef().isNonnull() && iM->closestCtfTrackRef()->extra().isAvailable()) {
          const reco::TransientTrack &ttCkf = transientTrackBuilder->build(iM->closestCtfTrackRef());

          const std::pair<bool,double> &pvGsfCompatMatched = gsfEstimator.estimate(pvCol->at(0),tt, ttCkf);
          if (pvGsfCompatMatched.first) {
            outElectron->SetGsfPVCompatibilityMatched(pvGsfCompatMatched.second);
          }
          else {
            outElectron->SetGsfPVCompatibilityMatched(-99.0);
          }


          const std::pair<bool,double> &pvbsGsfCompatMatched = gsfEstimator.estimate(pvBSCol->at(0),tt, ttCkf);
          if (pvbsGsfCompatMatched.first) {
            outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompatMatched.second);
          }
          else {
            outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
          }

          if (verbose_>1) {
            printf("gsf compat         = %5f\n", pvGsfCompat.second);
            printf("gsf compat matched = %5f\n", pvGsfCompatMatched.second);
          }
        }
        else {
          //no matching ckf track, so copy existing values
          if (pvGsfCompat.first) {
            outElectron->SetGsfPVCompatibilityMatched(pvGsfCompat.second);
          }
          else {
            outElectron->SetGsfPVCompatibilityMatched(-99.0);
          }

          if (pvbsGsfCompat.first) {
            outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompat.second);
          }
          else {
            outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
          }
        }

      }

      if (verbose_>1) {
        printf("gsf track      pt = %5f\n",iM->gsfTrack()->pt());
        printf("gsf track mode pt = %5f\n",iM->gsfTrack()->ptMode());
        printf("ttrack         pt = %5f\n",tt.initialFreeState().momentum().perp());
        //printf("ttrackgsf      pt = %5f\n",ttgsf.innermostMeasurementState().globalMomentum().perp());
        printf("ip3dpv reduced chisquared = %5f, probability = %5f\n", ip3dpv.second.value()/ip3dpv.second.error(), TMath::Prob(ip3dpv.second.value()/ip3dpv.second.error(),1));
        //printf("gsf    reduced chisquared = %5f, probability = %5f\n", pvGsfCompat.second/2, TMath::Prob(pvGsfCompat.second,2));
      }

    }

    //fill conversion partner track info
    ConversionFinder convFinder;
    ConversionInfo convInfo = convFinder.getConversionInfo(*iM, hGeneralTracks, bfield);
    outElectron->SetConvPartnerDCotTheta(convInfo.dcot());
    outElectron->SetConvPartnerDist(convInfo.dist());
    outElectron->SetConvPartnerRadius(convInfo.radiusOfConversion());
    outElectron->SetConversionXYZ(convInfo.pointOfConversion().x(),convInfo.pointOfConversion().y(),convInfo.pointOfConversion().z());
    reco::TrackRef convTrackRef = convInfo.conversionPartnerTk();
    if (trackerTrackMap_ && convTrackRef.isNonnull()) {
        outElectron->SetConvPartnerTrk(trackerTrackMap_->GetMit(refToPtr(convTrackRef)));
    }

    // fill Electron ID information
    outElectron->SetPassLooseID((*eidLooseMap)[eRef]);
    outElectron->SetPassTightID((*eidTightMap)[eRef]);

    //fill additional conversion flag
    outElectron->SetMatchesVertexConversion(convMatcher.matchesGoodConversion(*iM,hConversions));

    if (verbose_>1) {
      double recomass = sqrt(iM->energy()*iM->energy() - iM->p()*iM->p());
      printf(" mithep::Electron,    pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
             outElectron->Pt(), outElectron->Eta(), outElectron->Phi(),
             outElectron->E(), outElectron->P(), outElectron->Mass());
      printf("reco::GsfElectron   , pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
             iM->pt(), iM->eta(), iM->phi(), iM->energy(), iM->p(), recomass);
    }
  }
  electrons_->Trim();
}

Revision 1.47 - (view) (annotate) - [select for diffs]
Thu Jun 24 13:02:27 2010 UTC (14 years, 10 months ago) by peveraer
Branch: MAIN
Changes since 1.46: +7 -7 lines
Diff to previous 1.46
// $Id: FillerElectrons.cc,v 1.46 2010/06/24 12:59:51 peveraer Exp $

#include "MitProd/TreeFiller/interface/FillerElectrons.h"
#include "DataFormats/TrackReco/interface/Track.h"
#include "DataFormats/GsfTrackReco/interface/GsfTrack.h"
#include "DataFormats/TrackReco/interface/TrackFwd.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectron.h"
#include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
#include "DataFormats/EgammaReco/interface/ClusterShape.h"
#include "DataFormats/EgammaReco/interface/BasicClusterShapeAssociation.h"
#include "DataFormats/Common/interface/RefToPtr.h"
#include "DataFormats/Common/interface/ValueMap.h"
#include "AnalysisDataFormats/Egamma/interface/ElectronID.h"
#include "AnalysisDataFormats/Egamma/interface/ElectronIDAssociation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/ElectronTkIsolation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaEcalIsolation.h"
#include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaTowerIsolation.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "DataFormats/VertexReco/interface/VertexFwd.h"
#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h"
#include "TrackingTools/TransientTrack/plugins/TransientTrackBuilderESProducer.h"
#include "RecoVertex/GaussianSumVertexFit/interface/GsfVertexTrackCompatibilityEstimator.h"
#include "TrackingTools/IPTools/interface/IPTools.h"
#include "RecoEgamma/EgammaTools/interface/ConversionFinder.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "MitAna/DataTree/interface/ElectronCol.h"
#include "MitAna/DataTree/interface/Names.h"
#include "MitAna/DataTree/interface/Track.h"
#include "MitEdm/DataFormats/interface/RefToBaseToPtr.h"
#include "MitProd/ObjectService/interface/ObjectService.h"
#include "MitEdm/DataFormats/interface/DecayPart.h"
#include "MitEdm/ConversionRejection/interface/ConversionMatcher.h"

using namespace std;
using namespace edm;
using namespace mithep;

//--------------------------------------------------------------------------------------------------
FillerElectrons::FillerElectrons(const edm::ParameterSet &cfg, const char *name, bool active) :
  BaseFiller(cfg,name,active),
  edmName_(Conf().getUntrackedParameter<string>("edmName","pixelMatchGsfElectrons")),
  mitName_(Conf().getUntrackedParameter<string>("mitName",Names::gkElectronBrn)),
  gsfTrackMapName_(Conf().getUntrackedParameter<string>("gsfTrackMapName","")),
  trackerTrackMapName_(Conf().getUntrackedParameter<string>("trackerTrackMapName","")),
  barrelSuperClusterMapName_(Conf().getUntrackedParameter<string>("barrelSuperClusterMapName","")),
  endcapSuperClusterMapName_(Conf().getUntrackedParameter<string>("endcapSuperClusterMapName","")),
  pfSuperClusterMapName_(Conf().getUntrackedParameter<string>("pfSuperClusterMapName","")),
  eIDCutBasedTightName_(Conf().getUntrackedParameter<string>("eIDCutBasedTightName","eidTight")),
  eIDCutBasedLooseName_(Conf().getUntrackedParameter<string>("eIDCutBasedLooseName","eidLoose")),
  pvEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVertices")),
  pvBSEdmName_(Conf().getUntrackedParameter<string>("pvEdmName","offlinePrimaryVerticesWithBS")),
  electrons_(new mithep::ElectronArr(16)),
  gsfTrackMap_(0),
  trackerTrackMap_(0),
  barrelSuperClusterMap_(0),
  endcapSuperClusterMap_(0)
{
  // Constructor.
}

//--------------------------------------------------------------------------------------------------
FillerElectrons::~FillerElectrons()
{
  // Destructor.

  delete electrons_;
}

//--------------------------------------------------------------------------------------------------
void FillerElectrons::BookDataBlock(TreeWriter &tws)
{
  // Add electron branch to our tree and get our maps.

  tws.AddBranch(mitName_,&electrons_);
  OS()->add<mithep::ElectronArr>(electrons_,mitName_);

  if (!gsfTrackMapName_.empty()) {
    gsfTrackMap_ = OS()->get<TrackMap>(gsfTrackMapName_);
    if (gsfTrackMap_)
      AddBranchDep(mitName_,gsfTrackMap_->GetBrName());
  }
  if (!trackerTrackMapName_.empty()) {
    trackerTrackMap_ = OS()->get<TrackMap>(trackerTrackMapName_);
    if (trackerTrackMap_)
      AddBranchDep(mitName_,trackerTrackMap_->GetBrName());
  }
  if (!barrelSuperClusterMapName_.empty()) {
    barrelSuperClusterMap_ = OS()->get<SuperClusterMap>(barrelSuperClusterMapName_);
    if (barrelSuperClusterMap_)
      AddBranchDep(mitName_,barrelSuperClusterMap_->GetBrName());
  }
  if (!endcapSuperClusterMapName_.empty()) {
    endcapSuperClusterMap_ = OS()->get<SuperClusterMap>(endcapSuperClusterMapName_);
    if (endcapSuperClusterMap_)
      AddBranchDep(mitName_,endcapSuperClusterMap_->GetBrName());
  }
  if (!pfSuperClusterMapName_.empty()) {
    pfSuperClusterMap_ = OS()->get<SuperClusterMap>(pfSuperClusterMapName_);
    if (pfSuperClusterMap_)
      AddBranchDep(mitName_,pfSuperClusterMap_->GetBrName());
  }
}

//--------------------------------------------------------------------------------------------------
void FillerElectrons::FillDataBlock(const edm::Event &event, const edm::EventSetup &setup)
{
  // Fill electrons from edm collection into our collection.

  electrons_->Delete();

  Handle<reco::GsfElectronCollection> hElectronProduct;
  GetProduct(edmName_, hElectronProduct, event);

  // handles to get the electron ID information
  Handle<edm::ValueMap<float> > eidLooseMap;
  GetProduct(eIDCutBasedLooseName_, eidLooseMap, event);
  Handle<edm::ValueMap<float> > eidTightMap;
  etProduct(eIDCutBasedTightName_, eidTightMap, event);

  edm::Handle<reco::VertexCollection> hVertex;
  event.getByLabel(pvEdmName_, hVertex);
  const reco::VertexCollection *pvCol = hVertex.product();

  edm::Handle<reco::VertexCollection> hVertexBS;
  event.getByLabel(pvBSEdmName_, hVertexBS);
  const reco::VertexCollection *pvBSCol = hVertexBS.product();

  edm::Handle<reco::TrackCollection> hGeneralTracks;
  event.getByLabel("generalTracks", hGeneralTracks);
  //const reco::VertexCollection *trackCol = hGeneralTracks.product();

  edm::Handle<std::vector<mitedm::DecayPart> > hConversions;
  event.getByLabel("mvfConversionRemoval", hConversions);

  mitedm::ConversionMatcher convMatcher;

  edm::ESHandle<TransientTrackBuilder> hTransientTrackBuilder;
  setup.get<TransientTrackRecord>().get("TransientTrackBuilder",hTransientTrackBuilder);
  const TransientTrackBuilder *transientTrackBuilder = hTransientTrackBuilder.product();

  GsfVertexTrackCompatibilityEstimator gsfEstimator;

  //Get Magnetic Field from event setup, taking value at (0,0,0)
  edm::ESHandle<MagneticField> magneticField;
  setup.get<IdealMagneticFieldRecord>().get(magneticField);
  const double bfield = magneticField->inTesla(GlobalPoint(0.,0.,0.)).z();

  const reco::GsfElectronCollection inElectrons = *(hElectronProduct.product());
  // loop over electrons
  for (reco::GsfElectronCollection::const_iterator iM = inElectrons.begin();
       iM != inElectrons.end(); ++iM) {

    // the index and Ref are needed for the eID association Map
    unsigned int iElectron = iM - inElectrons.begin();
    reco::GsfElectronRef eRef(hElectronProduct, iElectron);

    mithep::Electron *outElectron = electrons_->AddNew();

    outElectron->SetPtEtaPhi(iM->pt(),iM->eta(),iM->phi());

    outElectron->SetCharge(iM->charge());
    outElectron->SetScPixCharge(iM->scPixCharge());

    outElectron->SetESuperClusterOverP(iM->eSuperClusterOverP());
    outElectron->SetESeedClusterOverPout(iM->eSeedClusterOverPout());
    outElectron->SetPIn(iM->trackMomentumAtVtx().R());
    outElectron->SetPOut(iM->trackMomentumOut().R());
    outElectron->SetDeltaEtaSuperClusterTrackAtVtx(iM->deltaEtaSuperClusterTrackAtVtx());
    outElectron->SetDeltaEtaSeedClusterTrackAtCalo(iM->deltaEtaSeedClusterTrackAtCalo());
    outElectron->SetDeltaPhiSuperClusterTrackAtVtx(iM->deltaPhiSuperClusterTrackAtVtx());
    outElectron->SetDeltaPhiSeedClusterTrackAtCalo(iM->deltaPhiSeedClusterTrackAtCalo());
    outElectron->SetIsEnergyScaleCorrected(iM->isEnergyScaleCorrected());
    outElectron->SetIsMomentumCorrected(iM->isMomentumCorrected());
    outElectron->SetNumberOfClusters(iM->basicClustersSize());
    outElectron->SetClassification(iM->classification());
    outElectron->SetFBrem(iM->fbrem());

    // pflow electron stuff
    outElectron->SetIsEcalDriven(iM->ecalDrivenSeed());
    outElectron->SetIsTrackerDriven(iM->trackerDrivenSeed());
    outElectron->SetMva(iM->mva());

    // shower shape variables
    outElectron->SetE15(iM->e1x5());
    outElectron->SetE25Max(iM->e2x5Max());
    outElectron->SetE55(iM->e5x5());
    outElectron->SetCovEtaEta(iM->sigmaEtaEta());
    outElectron->SetCoviEtaiEta(iM->sigmaIetaIeta());
    outElectron->SetHadronicOverEm(iM->hcalOverEcal());
    outElectron->SetHcalDepth1OverEcal(iM->hcalDepth1OverEcal());
    outElectron->SetHcalDepth2OverEcal(iM->hcalDepth2OverEcal());

    // fill isolation variables for both cone sizes
    outElectron->SetEcalRecHitIsoDr04(iM->dr04EcalRecHitSumEt());
    outElectron->SetHcalDepth1TowerSumEtDr04(iM->dr04HcalDepth1TowerSumEt());
    outElectron->SetHcalDepth2TowerSumEtDr04(iM->dr04HcalDepth2TowerSumEt());
    outElectron->SetTrackIsolationDr04(iM->dr04TkSumPt());
    outElectron->SetEcalRecHitIsoDr03(iM->dr03EcalRecHitSumEt());
    outElectron->SetHcalTowerSumEtDr03(iM->dr03HcalTowerSumEt());
    outElectron->SetHcalDepth1TowerSumEtDr03(iM->dr03HcalDepth1TowerSumEt());
    outElectron->SetHcalDepth2TowerSumEtDr03(iM->dr03HcalDepth2TowerSumEt());
    outElectron->SetTrackIsolationDr03(iM->dr03TkSumPt());

    // fiducial flags
    outElectron->SetIsEB(iM->isEB());
    outElectron->SetIsEE(iM->isEE());
    outElectron->SetIsEBEEGap(iM->isEBEEGap());
    outElectron->SetIsEBEtaGap(iM->isEBEtaGap());
    outElectron->SetIsEBPhiGap(iM->isEBPhiGap());
    outElectron->SetIsEEDeeGap(iM->isEEDeeGap());
    outElectron->SetIsEERingGap(iM->isEERingGap());

    // gsf-tracker match quality
    outElectron->SetFracSharedHits(iM->shFracInnerHits());

    // make proper links to Tracks and Super Clusters
    if (gsfTrackMap_ && iM->gsfTrack().isNonnull())
      outElectron->SetGsfTrk(gsfTrackMap_->GetMit(refToPtr(iM->gsfTrack())));
    // make tracker track links, relinking from gsf track associations if configured and
    // link is otherwise absent
    if (trackerTrackMap_ && iM->closestCtfTrackRef().isNonnull()) {
        outElectron->SetTrackerTrk(trackerTrackMap_->GetMit(refToPtr(iM->closestCtfTrackRef())));
    }
    if (barrelSuperClusterMap_ && endcapSuperClusterMap_ &&
        pfSuperClusterMap_ && iM->superCluster().isNonnull()) {
      if(barrelSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(barrelSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else if (endcapSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(endcapSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else if (pfSuperClusterMap_->HasMit(iM->superCluster())) {
        outElectron->SetSuperCluster(pfSuperClusterMap_->GetMit(iM->superCluster()));
      }
      else throw edm::Exception(edm::errors::Configuration, "FillerElectrons:FillDataBlock()\n")
             << "Error! SuperCluster reference in unmapped collection " << edmName_ << endl;
    }

    //compute impact parameter with respect to PV
    if (iM->gsfTrack().isNonnull()) {
      const reco::TransientTrack &tt = transientTrackBuilder->build(iM->gsfTrack());

      const std::pair<bool,Measurement1D> &d0pv =  IPTools::absoluteTransverseImpactParameter(tt,pvCol->at(0));
      if (d0pv.first) {
        outElectron->SetD0PV(d0pv.second.value());
        outElectron->SetD0PVErr(d0pv.second.error());
      }
      else {
        outElectron->SetD0PV(-99.0);
      }


      const std::pair<bool,Measurement1D> &ip3dpv =  IPTools::absoluteImpactParameter3D(tt,pvCol->at(0));
      if (ip3dpv.first) {
        outElectron->SetIp3dPV(ip3dpv.second.value());
        outElectron->SetIp3dPVErr(ip3dpv.second.error());
      }
      else {
        outElectron->SetIp3dPV(-99.0);
      }

      const std::pair<bool,Measurement1D> &d0pvbs =  IPTools::absoluteTransverseImpactParameter(tt,pvBSCol->at(0));
      if (d0pvbs.first) {
        outElectron->SetD0PVBS(d0pvbs.second.value());
        outElectron->SetD0PVBSErr(d0pvbs.second.error());
      }
      else {
        outElectron->SetD0PVBS(-99.0);
      }

      const std::pair<bool,Measurement1D> &ip3dpvbs =  IPTools::absoluteImpactParameter3D(tt,pvBSCol->at(0));
      if (ip3dpvbs.first) {
        outElectron->SetIp3dPVBS(ip3dpvbs.second.value());
        outElectron->SetIp3dPVBSErr(ip3dpvbs.second.error());
      }
      else {
        outElectron->SetIp3dPVBS(-99.0);
      }

      //compute compatibility with PV using full GSF state mixture (but skip in AOD)
      if (iM->gsfTrack()->gsfExtra().isAvailable()) {

        const std::pair<bool,double> &pvGsfCompat = gsfEstimator.estimate(pvCol->at(0),tt);
        if (pvGsfCompat.first) {
          outElectron->SetGsfPVCompatibility(pvGsfCompat.second);
        }
        else {
          outElectron->SetGsfPVCompatibility(-99.0);
        }


        const std::pair<bool,double> &pvbsGsfCompat = gsfEstimator.estimate(pvBSCol->at(0),tt);
        if (pvbsGsfCompat.first) {
          outElectron->SetGsfPVBSCompatibility(pvbsGsfCompat.second);
        }
        else {
          outElectron->SetGsfPVBSCompatibility(-99.0);
        }

        //compute signal vertex compatibility with full GSF state mixture excluding matching ckf track
        //from vertex
        if (iM->closestCtfTrackRef().isNonnull() && iM->closestCtfTrackRef()->extra().isAvailable()) {
          const reco::TransientTrack &ttCkf = transientTrackBuilder->build(iM->closestCtfTrackRef());

          const std::pair<bool,double> &pvGsfCompatMatched = gsfEstimator.estimate(pvCol->at(0),tt, ttCkf);
          if (pvGsfCompatMatched.first) {
            outElectron->SetGsfPVCompatibilityMatched(pvGsfCompatMatched.second);
          }
          else {
            outElectron->SetGsfPVCompatibilityMatched(-99.0);
          }


          const std::pair<bool,double> &pvbsGsfCompatMatched = gsfEstimator.estimate(pvBSCol->at(0),tt, ttCkf);
          if (pvbsGsfCompatMatched.first) {
            outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompatMatched.second);
          }
          else {
            outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
          }

          if (verbose_>1) {
            printf("gsf compat         = %5f\n", pvGsfCompat.second);
            printf("gsf compat matched = %5f\n", pvGsfCompatMatched.second);
          }
        }
        else {
          //no matching ckf track, so copy existing values
          if (pvGsfCompat.first) {
            outElectron->SetGsfPVCompatibilityMatched(pvGsfCompat.second);
          }
          else {
            outElectron->SetGsfPVCompatibilityMatched(-99.0);
          }

          if (pvbsGsfCompat.first) {
            outElectron->SetGsfPVBSCompatibilityMatched(pvbsGsfCompat.second);
          }
          else {
            outElectron->SetGsfPVBSCompatibilityMatched(-99.0);
          }
        }

      }

      if (verbose_>1) {
        printf("gsf track      pt = %5f\n",iM->gsfTrack()->pt());
        printf("gsf track mode pt = %5f\n",iM->gsfTrack()->ptMode());
        printf("ttrack         pt = %5f\n",tt.initialFreeState().momentum().perp());
        //printf("ttrackgsf      pt = %5f\n",ttgsf.innermostMeasurementState().globalMomentum().perp());
        printf("ip3dpv reduced chisquared = %5f, probability = %5f\n", ip3dpv.second.value()/ip3dpv.second.error(), TMath::Prob(ip3dpv.second.value()/ip3dpv.second.error(),1));
        //printf("gsf    reduced chisquared = %5f, probability = %5f\n", pvGsfCompat.second/2, TMath::Prob(pvGsfCompat.second,2));
      }

    }

    //fill conversion partner track info
    ConversionFinder convFinder;
    ConversionInfo convInfo = convFinder.getConversionInfo(*iM, hGeneralTracks, bfield);
    outElectron->SetConvPartnerDCotTheta(convInfo.dcot());
    outElectron->SetConvPartnerDist(convInfo.dist());
    outElectron->SetConvPartnerRadius(convInfo.radiusOfConversion());
    outElectron->SetConversionXYZ(convInfo.pointOfConversion().x(),convInfo.pointOfConversion().y(),convInfo.pointOfConversion().z());
    reco::TrackRef convTrackRef = convInfo.conversionPartnerTk();
    if (trackerTrackMap_ && convTrackRef.isNonnull()) {
        outElectron->SetConvPartnerTrk(trackerTrackMap_->GetMit(refToPtr(convTrackRef)));
    }

    // fill Electron ID information
    outElectron->SetPassLooseID((*eidLooseMap)[eRef]);
    outElectron->SetPassTightID((*eidTightMap)[eRef]);

    //fill additional conversion flag
    outElectron->SetMatchesVertexConversion(convMatcher.matchesGoodConversion(*iM,hConversions));

    if (verbose_>1) {
      double recomass = sqrt(iM->energy()*iM->energy() - iM->p()*iM->p());
      printf(" mithep::Electron,    pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
             outElectron->Pt(), outElectron->Eta(), outElectron->Phi(),
             outElectron->E(), outElectron->P(), outElectron->Mass());
      printf("reco::GsfElectron   , pt=%5f, eta=%5f, phi=%5f, energy=%5f, p=%5f, mass=%5f\n",
             iM->pt(), iM->eta(), iM->phi(), iM->energy(), iM->p(), recomass);
    }
  }
  electrons_->Trim();
}

Revision 1.46 - (view) (annotate) - [select for diffs]
Thu Jun 24 12:59:51 2010 UTC (14 years, 10 months ago) by peveraer
Branch: MAIN
Changes since 1.45: +7 -7 lines
Diff to previous 1.45
// $Id: FillerBasicClusters.cc,v 1.11 2010/03/24 15:40:57 sixie Exp $

#include "MitProd/TreeFiller/interface/FillerBasicClusters.h"
#include "DataFormats/CaloRecHit/interface/CaloClusterFwd.h"
#include "DataFormats/CaloRecHit/interface/CaloCluster.h"
#include "MitAna/DataTree/interface/BasicClusterCol.h"
#include "MitAna/DataTree/interface/Names.h"
#include "MitProd/ObjectService/interface/ObjectService.h"
#include "RecoEcal/EgammaCoreTools/interface/EcalClusterLazyTools.h"
#include "RecoLocalCalo/EcalRecAlgos/interface/EcalSeverityLevelAlgo.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"

using namespace std;
using namespace edm;
using namespace mithep;

//--------------------------------------------------------------------------------------------------
FillerBasicClusters::FillerBasicClusters(const ParameterSet &cfg, const char *name, bool active) :
  BaseFiller(cfg,name,active),
  edmName_(Conf().getUntrackedParameter<string>("edmName","hybridSuperClusters")),
  mitName_(Conf().getUntrackedParameter<string>("mitName","BasicClusters")),
  barrelEcalRecHitName_(Conf().getUntrackedParameter<string>("barrelEcalRecHitName","")),
  endcapEcalRecHitName_(Conf().getUntrackedParameter<string>("endcapEcalRecHitName","")),
  basicClusterMapName_(Conf().getUntrackedParameter<string>("basicClusterMapName",
                                                            "BasicClusterMap")),
  basicClusters_(new mithep::BasicClusterArr(100)),
  basicClusterMap_(new mithep::BasicClusterMap)
{
  // Constructor.
}

//--------------------------------------------------------------------------------------------------
FillerBasicClusters::~FillerBasicClusters()
{
  // Destructor.

  delete basicClusters_;
  delete basicClusterMap_;
}

//--------------------------------------------------------------------------------------------------
void FillerBasicClusters::BookDataBlock(TreeWriter &tws)
{
  // Add BasicCluster branch and the BasicClusterMap to tree.

  tws.AddBranch(mitName_,&basicClusters_);
  OS()->add<BasicClusterArr>(basicClusters_,mitName_);

  if (!basicClusterMapName_.empty()) {
    basicClusterMap_->SetBrName(mitName_);
    OS()->add<BasicClusterMap>(basicClusterMap_,basicClusterMapName_);
  }
}

//--------------------------------------------------------------------------------------------------
void FillerBasicClusters::FillDataBlock(const edm::Event      &event,
                                        const edm::EventSetup &setup)
{
  // Fill the BasicCluster information into our structures.

  basicClusters_->Delete();
  basicClusterMap_->Reset();

  Handle<reco::CaloClusterCollection> hBasicClusterProduct;
  GetProduct(edmName_, hBasicClusterProduct, event);
  basicClusterMap_->SetEdmProductId(hBasicClusterProduct.id().id());
  const reco::CaloClusterCollection inBasicClusters = *(hBasicClusterProduct.product());


  EcalClusterLazyTools lazyTools(event, setup, edm::InputTag(barrelEcalRecHitName_),
                                 edm::InputTag(endcapEcalRecHitName_));

  // loop through all basic clusters
  for (reco::CaloClusterCollection::const_iterator inBC = inBasicClusters.begin();
       inBC != inBasicClusters.end(); ++inBC) {

    mithep::BasicCluster *outBasicCluster = basicClusters_->Allocate();
    new (outBasicCluster) mithep::BasicCluster();

    outBasicCluster->SetXYZ(inBC->x(),inBC->y(),inBC->z());
    outBasicCluster->SetEnergy(inBC->energy());
    outBasicCluster->SetNHits(inBC->size());
    outBasicCluster->SetE1x3(lazyTools.e1x3(*inBC));
    outBasicCluster->SetE3x1(lazyTools.e3x1(*inBC));
    outBasicCluster->SetE1x5(lazyTools.e1x5(*inBC));
    outBasicCluster->SetE2x2(lazyTools.e2x2(*inBC));
    outBasicCluster->SetE3x2(lazyTools.e3x2(*inBC));
    outBasicCluster->SetE3x3(lazyTools.e3x3(*inBC));
    outBasicCluster->SetE4x4(lazyTools.e4x4(*inBC));
    outBasicCluster->SetE5x5(lazyTools.e5x5(*inBC));
    outBasicCluster->SetE2x5Right(lazyTools.e2x5Right(*inBC));
    outBasicCluster->SetE2x5Left(lazyTools.e2x5Left(*inBC));
    outBasicCluster->SetE2x5Top(lazyTools.e2x5Top(*inBC));
    outBasicCluster->SetE2x5Bottom(lazyTools.e2x5Bottom(*inBC));
    outBasicCluster->SetE2x5Max(lazyTools.e2x5Max(*inBC));
    outBasicCluster->SetELeft(lazyTools.eLeft(*inBC));
    outBasicCluster->SetERight(lazyTools.eRight(*inBC));
    outBasicCluster->SetETop(lazyTools.eTop(*inBC));
    outBasicCluster->SetEBottom(lazyTools.eBottom(*inBC));
    outBasicCluster->SetEMax(lazyTools.eMax(*inBC));
    outBasicCluster->SetE2nd(lazyTools.e2nd(*inBC));
    outBasicCluster->SetEtaLat(lazyTools.lat(*inBC)[0]);
    outBasicCluster->SetPhiLat(lazyTools.lat(*inBC)[1]);
    outBasicCluster->SetLat(lazyTools.lat(*inBC)[2]);
    outBasicCluster->SetCovEtaEta(lazyTools.covariances(*inBC)[0]);
    outBasicCluster->SetCovEtaPhi(lazyTools.covariances(*inBC)[1]);
    outBasicCluster->SetCovPhiPhi(lazyTools.covariances(*inBC)[2]);
    outBasicCluster->SetCoviEtaiEta(lazyTools.localCovariances(*inBC)[0]);
    outBasicCluster->SetCoviEtaiPhi(lazyTools.localCovariances(*inBC)[1]);
    outBasicCluster->SetCoviPhiiPhi(lazyTools.localCovariances(*inBC)[2]);
    outBasicCluster->SetZernike20(lazyTools.zernike20(*inBC));
    outBasicCluster->SetZernike42(lazyTools.zernike42(*inBC));


    edm::Handle< EcalRecHitCollection > pEBRecHits;
    event.getByLabel(barrelEcalRecHitName_, pEBRecHits );
    const EcalRecHitCollection * ebRecHits_ = pEBRecHits.product();
    edm::Handle< EcalRecHitCollection > pEERecHits;
    event.getByLabel( endcapEcalRecHitName_, pEERecHits );
    const EcalRecHitCollection * eeRecHits_ = pEERecHits.product();

    DetId id = ((*inBC).hitsAndFractions()[0]).first;
    const EcalRecHitCollection *recHits = 0;
    if (  id.subdetId() == EcalBarrel  ) {
                recHits = ebRecHits_;
        } else if ( id.subdetId() == EcalEndcap  ) {
                recHits = eeRecHits_;
        }
    float max = 0;
    DetId idmax(0);
        for ( size_t i = 0; i < (*inBC).hitsAndFractions().size(); ++i ) {
          float energy=0;
          if ((*inBC).hitsAndFractions()[i].first!=DetId(0)) energy= (*(recHits->find( id ))).energy() * (((*inBC).hitsAndFractions())[i].second);
                if ( energy > max ) {
                        max = energy;
                        id = ((*inBC).hitsAndFractions())[i].first;
                }
        }
   outBasicCluster->SetSwissCross(EcalSeverityLevelAlgo::swissCross(idmax,*recHits,0.));

    // add basic clusters to the map
    reco::CaloClusterPtr thePtr(hBasicClusterProduct, inBC-inBasicClusters.begin());
    basicClusterMap_->Add(thePtr, outBasicCluster);

  }
  basicClusters_->Trim();
}

Revision 1.45 - (view) (annotate) - [select for diffs]
Wed Jun 23 09:02:45 2010 UTC (14 years, 10 months ago) by bendavid
Branch: MAIN
Changes since 1.44: +16 -1 lines
Diff to previous 1.44
some extra conversion variables

Revision 1.44 - (view) (annotate) - [select for diffs]
Sat May 29 11:58:28 2010 UTC (14 years, 11 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_014, Mit_014a
Changes since 1.43: +85 -1 lines
Diff to previous 1.43
Fill electron gsf vertex compatibility variables

Revision 1.43 - (view) (annotate) - [select for diffs]
Thu May 6 17:31:24 2010 UTC (14 years, 11 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_014pre1, Mit_014pre2, Mit_014pre3
Changes since 1.42: +76 -2 lines
Diff to previous 1.42
Fill conversion partner and impact parameter signficance variables

Revision 1.42 - (view) (annotate) - [select for diffs]
Thu Mar 18 20:21:00 2010 UTC (15 years, 1 month ago) by bendavid
Branch: MAIN
CVS Tags: Mit_013, Mit_013a, Mit_013b, Mit_013c, Mit_013d
Changes since 1.41: +2 -2 lines
Diff to previous 1.41
Fix beginrun,beginjob mess

Revision 1.41 - (view) (annotate) - [select for diffs]
Sun Jan 24 20:59:47 2010 UTC (15 years, 3 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_013pre1
Changes since 1.40: +3 -3 lines
Diff to previous 1.40
avoid removed accessors

Revision 1.40 - (view) (annotate) - [select for diffs]
Mon Nov 2 22:54:56 2009 UTC (15 years, 6 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_012, Mit_012a, Mit_012b, Mit_012c, Mit_012d, Mit_012e, Mit_012f, Mit_012g, Mit_012h, Mit_012i
Changes since 1.39: +4 -1 lines
Diff to previous 1.39
Fill additional charge info in 33x

Revision 1.39 - (view) (annotate) - [select for diffs]
Fri Sep 25 08:42:50 2009 UTC (15 years, 7 months ago) by loizides
Branch: MAIN
CVS Tags: Mit_011a
Changes since 1.38: +2 -2 lines
Diff to previous 1.38
Extended interface of BookDataBlock to contain event setup.

Revision 1.38 - (view) (annotate) - [select for diffs]
Mon Jul 20 03:19:24 2009 UTC (15 years, 9 months ago) by loizides
Branch: MAIN
CVS Tags: Mit_010, Mit_010a, Mit_011
Changes since 1.37: +7 -6 lines
Diff to previous 1.37
Cleanup

Revision 1.37 - (view) (annotate) - [select for diffs]
Tue Jul 7 08:32:26 2009 UTC (15 years, 9 months ago) by bendavid
Branch: MAIN
Changes since 1.36: +39 -135 lines
Diff to previous 1.36
Update electron isolation, id, shower shape, pf flags for 31x

Revision 1.36 - (view) (annotate) - [select for diffs]
Thu Jun 18 23:01:46 2009 UTC (15 years, 10 months ago) by bendavid
Branch: MAIN
Changes since 1.35: +40 -25 lines
Diff to previous 1.35
First attempt at updated electron id and isolation for 31X, updated supercluster link filling

Revision 1.35 - (view) (annotate) - [select for diffs]
Mon Jun 15 15:00:26 2009 UTC (15 years, 10 months ago) by loizides
Branch: MAIN
CVS Tags: Mit_009b, Mit_009c
Changes since 1.34: +9 -9 lines
Diff to previous 1.34
Added proper fwd defs plus split up complilation of MitAna/DataTree LinkDefs.

Revision 1.34 - (view) (annotate) - [select for diffs]
Tue May 5 13:24:01 2009 UTC (16 years ago) by loizides
Branch: MAIN
CVS Tags: Mit_009a
Changes since 1.33: +3 -4 lines
Diff to previous 1.33
Bugfix for a mem leak.

Revision 1.33 - (view) (annotate) - [select for diffs]
Tue Apr 7 08:07:50 2009 UTC (16 years ago) by loizides
Branch: MAIN
CVS Tags: Mit_009
Changes since 1.32: +2 -2 lines
Diff to previous 1.32
Reintroduced still needed RefToBaseToPtr class.

Revision 1.32 - (view) (annotate) - [select for diffs]
Mon Apr 6 19:37:20 2009 UTC (16 years ago) by loizides
Branch: MAIN
Changes since 1.31: +6 -4 lines
Diff to previous 1.31
Coding conv.

Revision 1.31 - (view) (annotate) - [select for diffs]
Fri Mar 20 18:46:02 2009 UTC (16 years, 1 month ago) by bendavid
Branch: MAIN
CVS Tags: Mit_008
Changes since 1.30: +10 -1 lines
Diff to previous 1.30
Updated for explicit electron momentum vector

Revision 1.30 - (view) (annotate) - [select for diffs]
Wed Mar 18 14:57:58 2009 UTC (16 years, 1 month ago) by loizides
Branch: MAIN
CVS Tags: Mit_008pre2
Changes since 1.29: +17 -17 lines
Diff to previous 1.29
Removed OAK

Revision 1.29 - (view) (annotate) - [select for diffs]
Sun Mar 15 11:20:41 2009 UTC (16 years, 1 month ago) by loizides
Branch: MAIN
Changes since 1.28: +62 -52 lines
Diff to previous 1.28
Introduced BranchTable plus general cleanup.

Revision 1.28 - (view) (annotate) - [select for diffs]
Tue Mar 10 15:56:01 2009 UTC (16 years, 1 month ago) by loizides
Branch: MAIN
Changes since 1.27: +3 -3 lines
Diff to previous 1.27
Introduced more dynamic filling interface.

Revision 1.27 - (view) (annotate) - [select for diffs]
Tue Mar 3 17:04:56 2009 UTC (16 years, 2 months ago) by loizides
Branch: MAIN
CVS Tags: Mit_008pre1
Changes since 1.26: +2 -2 lines
Diff to previous 1.26
Renamed

Revision 1.26 - (view) (annotate) - [select for diffs]
Thu Feb 26 17:04:03 2009 UTC (16 years, 2 months ago) by bendavid
Branch: MAIN
Changes since 1.25: +2 -2 lines
Diff to previous 1.25
Switch from Reset to Delete calls on arrays, since we now use some heap

Revision 1.25 - (view) (annotate) - [select for diffs]
Sun Nov 30 22:43:28 2008 UTC (16 years, 5 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_006a, Mit_006b
Changes since 1.24: +3 -3 lines
Diff to previous 1.24
Revert FillerElectron changes associated with tags no longer being checked out

Revision 1.24 - (view) (annotate) - [select for diffs]
Thu Nov 27 16:16:02 2008 UTC (16 years, 5 months ago) by loizides
Branch: MAIN
Changes since 1.23: +2 -2 lines
Diff to previous 1.23
Adapt to name change in Electron.h

Revision 1.23 - (view) (annotate) - [select for diffs]
Fri Nov 14 13:39:20 2008 UTC (16 years, 5 months ago) by bendavid
Branch: MAIN
CVS Tags: Mit_006
Changes since 1.22: +6 -8 lines
Diff to previous 1.22
Fixed small memory leak

Revision 1.22 - (view) (annotate) - [select for diffs]
Wed Nov 12 18:56:25 2008 UTC (16 years, 5 months ago) by peveraer
Branch: MAIN
Changes since 1.21: +3 -1 lines
Diff to previous 1.21
Added sigmaiEtaiEta

Revision 1.21 - (view) (annotate) - [select for diffs]
Thu Nov 6 13:09:23 2008 UTC (16 years, 5 months ago) by sixie
Branch: MAIN
Changes since 1.20: +3 -2 lines
Diff to previous 1.20
Update tower isolation to work with new tag from Egamma group

Revision 1.20 - (view) (annotate) - [select for diffs]
Wed Nov 5 10:47:34 2008 UTC (16 years, 5 months ago) by bendavid
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19
Fix compile warning

Revision 1.19 - (view) (annotate) - [select for diffs]
Tue Nov 4 19:27:45 2008 UTC (16 years, 5 months ago) by bendavid
Branch: MAIN
Changes since 1.18: +41 -3 lines
Diff to previous 1.18
Allow filling of TrackerTrk links for electrons using TrackToTrackAssociator output

Revision 1.18 - (view) (annotate) - [select for diffs]
Mon Nov 3 18:11:10 2008 UTC (16 years, 6 months ago) by bendavid
Branch: MAIN
Changes since 1.17: +5 -4 lines
Diff to previous 1.17
Changed to base class usage of reco::Track throughout and removed FillerGsfTracks

Revision 1.17 - (view) (annotate) - [select for diffs]
Wed Oct 22 08:55:40 2008 UTC (16 years, 6 months ago) by peveraer
Branch: MAIN
Changes since 1.16: +9 -14 lines
Diff to previous 1.16
*** empty log message ***

Revision 1.16 - (view) (annotate) - [select for diffs]
Wed Sep 10 03:30:23 2008 UTC (16 years, 7 months ago) by loizides
Branch: MAIN
CVS Tags: Mit_004, Mit_005
Changes since 1.15: +38 -43 lines
Diff to previous 1.15
Cleanup

Revision 1.15 - (view) (annotate) - [select for diffs]
Tue Sep 9 12:50:44 2008 UTC (16 years, 7 months ago) by sixie
Branch: MAIN
Changes since 1.14: +17 -4 lines
Diff to previous 1.14
Add jurassic isolation calculation to Electron object.

Revision 1.14 - (view) (annotate) - [select for diffs]
Sat Sep 6 18:11:35 2008 UTC (16 years, 7 months ago) by sixie
Branch: MAIN
Changes since 1.13: +14 -2 lines
Diff to previous 1.13
Add CMSSW CaloTower Isolation calculation to electrons

Revision 1.13 - (view) (annotate) - [select for diffs]
Fri Aug 22 09:57:35 2008 UTC (16 years, 8 months ago) by sixie
Branch: MAIN
Changes since 1.12: +27 -18 lines
Diff to previous 1.12
add pin and pout. add electron ID information.

Revision 1.12 - (view) (annotate) - [select for diffs]
Mon Aug 18 11:34:02 2008 UTC (16 years, 8 months ago) by sixie
Branch: MAIN
Changes since 1.11: +86 -70 lines
Diff to previous 1.11
updated to 2_1_X

Revision 1.11 - (view) (annotate) - [select for diffs]
Fri Aug 8 11:21:08 2008 UTC (16 years, 8 months ago) by sixie
Branch: MAIN
CVS Tags: MITHEP_2_0_x
Changes since 1.10: +126 -12 lines
Diff to previous 1.10
Add SuperCluster links to electron Filler. Add basic cluster and supercluster association maps. Add new electron and Muon ID variables. Add correct default names to the config file. BuildFile had to be modified to include Egamma objects for the electron Fillers.

Revision 1.10 - (view) (annotate) - [select for diffs]
Thu Jul 31 12:34:04 2008 UTC (16 years, 9 months ago) by loizides
Branch: MAIN
Changes since 1.9: +12 -7 lines
Diff to previous 1.9
Consistently introduced ObjectService. Updated comments. Updated .cfg files. Switched off default handling of Stable and DecayParts (for now). ZmmFullReco.cfg shows how to use standard filler with extensions.

Revision 1.9 - (view) (annotate) - [select for diffs]
Mon Jul 14 21:01:00 2008 UTC (16 years, 9 months ago) by loizides
Branch: MAIN
Changes since 1.8: +3 -3 lines
Diff to previous 1.8
Adapt to new getters.

Revision 1.8 - (view) (annotate) - [select for diffs]
Sun Jul 13 08:46:04 2008 UTC (16 years, 9 months ago) by loizides
Branch: MAIN
Changes since 1.7: +5 -5 lines
Diff to previous 1.7
Cleanup. Trim particles that contain a TRefArray only at the end of filling time and not for every call to Add.

Revision 1.7 - (view) (annotate) - [select for diffs]
Tue Jul 8 12:38:20 2008 UTC (16 years, 9 months ago) by loizides
Branch: MAIN
Changes since 1.6: +4 -10 lines
Diff to previous 1.6
Updated Fillers to use GetProduct function in BaseFiller. This function will determine whether a product is valid and otherwise exit.

Revision 1.6 - (view) (annotate) - [select for diffs]
Mon Jul 7 16:14:01 2008 UTC (16 years, 9 months ago) by loizides
Branch: MAIN
Changes since 1.5: +4 -2 lines
Diff to previous 1.5
coding conventions

Revision 1.5 - (view) (annotate) - [select for diffs]
Thu Jul 3 07:56:14 2008 UTC (16 years, 10 months ago) by loizides
Branch: MAIN
Changes since 1.4: +5 -5 lines
Diff to previous 1.4
Coding Conventions

Revision 1.4 - (view) (annotate) - [select for diffs]
Wed Jul 2 16:34:37 2008 UTC (16 years, 10 months ago) by loizides
Branch: MAIN
Changes since 1.3: +1 -3 lines
Diff to previous 1.3
Cosmetics.

Revision 1.3 - (view) (annotate) - [select for diffs]
Wed Jul 2 13:30:09 2008 UTC (16 years, 10 months ago) by bendavid
Branch: MAIN
Changes since 1.2: +3 -2 lines
Diff to previous 1.2
cleaned up scheme for specifying edm names

Revision 1.2 - (view) (annotate) - [select for diffs]
Tue Jul 1 21:11:47 2008 UTC (16 years, 10 months ago) by loizides
Branch: MAIN
Changes since 1.1: +3 -3 lines
Diff to previous 1.1
Updated configs.

Revision 1.1 - (view) (annotate) - [select for diffs]
Tue Jul 1 14:38:33 2008 UTC (16 years, 10 months ago) by loizides
Branch: MAIN
Have most of Josh's fillers.

Convenience Links

Links to HEAD: (view) (annotate) Links to Mit_015b: (view) (annotate)

Compare Revisions

This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, select a symbolic revision name using the selection box, or choose 'Use Text Field' and enter a numeric revision.

  Diffs between and
  Type of Diff should be a