CMS 3D CMS Logo

Functions

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/Calibration/HcalAlCaRecoProducers/src/AlCaIsoTracksProducer.cc File Reference

#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "Calibration/HcalAlCaRecoProducers/interface/AlCaIsoTracksProducer.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "Geometry/Records/interface/CaloGeometryRecord.h"
#include "Geometry/CaloGeometry/interface/CaloGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloSubdetectorGeometry.h"
#include "Geometry/CaloGeometry/interface/CaloCellGeometry.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/GeometrySurface/interface/Cylinder.h"
#include "DataFormats/GeometrySurface/interface/Plane.h"
#include "Geometry/CommonDetUnit/interface/GeomDetUnit.h"
#include "MagneticField/Engine/interface/MagneticField.h"
#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
#include "TrackPropagation/SteppingHelixPropagator/interface/SteppingHelixPropagator.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "Geometry/CaloTopology/interface/EcalPreshowerTopology.h"
#include "DataFormats/TrackReco/interface/TrackExtra.h"
#include "DataFormats/TrackReco/interface/TrackExtraFwd.h"
#include "RecoTracker/TrackProducer/interface/TrackProducerBase.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidate.h"
#include "DataFormats/HcalIsolatedTrack/interface/IsolatedPixelTrackCandidateFwd.h"
#include "DataFormats/HLTReco/interface/TriggerEvent.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "Math/GenVector/VectorUtil.h"
#include "Math/GenVector/PxPyPzE4D.h"
#include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
#include "DataFormats/L1Trigger/interface/L1JetParticle.h"
#include "DataFormats/Provenance/interface/ProductID.h"
#include "Calibration/HcalAlCaRecoProducers/plugins/ConeDefinition.h"
#include <boost/regex.hpp>

Go to the source code of this file.

Functions

bool checkHLTMatch (edm::Event &iEvent, edm::InputTag hltEventTag_, std::vector< std::string > hltFilterTag_, double eta, double phi, double hltMatchingCone_)
double getDist (double eta1, double phi1, double eta2, double phi2)
double getDistInCM (double eta1, double phi1, double eta2, double phi2)
std::pair< double, double > getL1triggerDirection (edm::Event &iEvent, edm::InputTag hltEventTag_, std::string l1FilterTag_)

Function Documentation

bool checkHLTMatch ( edm::Event iEvent,
edm::InputTag  hltEventTag_,
std::vector< std::string >  hltFilterTag_,
double  eta,
double  phi,
double  hltMatchingCone_ 
)

Definition at line 74 of file AlCaIsoTracksProducer.cc.

References eta(), trigger::TriggerObject::eta(), edm::Event::getByLabel(), getDist(), prof2calltree::l, match(), phi, and trigger::TriggerObject::phi().

Referenced by AlCaIsoTracksProducer::produce().

{
  bool match =false;
  double minDDD=1000;
  
  edm::Handle<trigger::TriggerEvent> trEv;
  iEvent.getByLabel(hltEventTag_,trEv);
  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
  
  trigger::Keys KEYS;
  const trigger::size_type nFilt(trEv->sizeFilters());
  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++) 
    {
      for (unsigned l=0; l<hltFilterTag_.size(); l++)
        {
          if ((trEv->filterTag(iFilt).label()).substr(0,27)==hltFilterTag_[l]) 
            {
              KEYS=trEv->filterKeys(iFilt);
            }
        }
    }
  trigger::size_type nReg=KEYS.size();
  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
    {
      const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
      double dHit=getDist(TObj.eta(),TObj.phi(),eta,phi); 
      if (dHit<minDDD) minDDD=dHit;
    }
  if (minDDD>hltMatchingCone_) match=false;
  else match=true;
     
  return match;
}
double getDist ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 66 of file AlCaIsoTracksProducer.cc.

References funct::pow(), and mathSSE::sqrt().

Referenced by checkHLTMatch().

{
  double dphi = fabs(phi1 - phi2); 
  if(dphi>acos(-1)) dphi = 2*acos(-1)-dphi;
  double dr = sqrt(dphi*dphi + std::pow(eta1-eta2,2));
  return dr;
}
double getDistInCM ( double  eta1,
double  phi1,
double  eta2,
double  phi2 
)

Definition at line 48 of file AlCaIsoTracksProducer.cc.

References angle(), funct::cos(), create_public_lumi_plots::exp, funct::sin(), and funct::tan().

{
  double dR, Rec;
  double theta1=2*atan(exp(-eta1));
  double theta2=2*atan(exp(-eta2));
  if (fabs(eta1)<1.479) Rec=129; //radius of ECAL barrel
  else Rec=tan(theta1)*317; //distance from IP to ECAL endcap

  //|vect| times tg of acos(scalar product)
  double angle=acos((sin(theta1)*sin(theta2)*(sin(phi1)*sin(phi2)+cos(phi1)*cos(phi2))+cos(theta1)*cos(theta2)));
  if (angle<acos(-1)/2)
    {
      dR=fabs((Rec/sin(theta1))*tan(angle));
      return dR;
    }
  else return 1000;
}
std::pair<double,double> getL1triggerDirection ( edm::Event iEvent,
edm::InputTag  hltEventTag_,
std::string  l1FilterTag_ 
)

Definition at line 108 of file AlCaIsoTracksProducer.cc.

References trigger::TriggerObject::eta(), edm::Event::getByLabel(), trigger::TriggerObject::phi(), trigger::TriggerObject::pt(), and jptDQMConfig_cff::ptMax.

Referenced by AlCaIsoTracksProducer::produce().

{
  edm::Handle<trigger::TriggerEvent> trEv;
  iEvent.getByLabel(hltEventTag_,trEv);
  const trigger::TriggerObjectCollection& TOCol(trEv->getObjects());
  
  trigger::Keys KEYS;
  const trigger::size_type nFilt(trEv->sizeFilters());
  for (trigger::size_type iFilt=0; iFilt!=nFilt; iFilt++)
    {
      if ((trEv->filterTag(iFilt).label()).substr(0,14)==l1FilterTag_) KEYS=trEv->filterKeys(iFilt); 
    }
  trigger::size_type nReg=KEYS.size();
  double etaTrig=-10000;
  double phiTrig=-10000;
  double ptMax=0;
  for (trigger::size_type iReg=0; iReg<nReg; iReg++)
    {
      const trigger::TriggerObject& TObj(TOCol[KEYS[iReg]]);
      if (TObj.pt()>ptMax)
        {
          etaTrig=TObj.eta();
          phiTrig=TObj.phi();
          ptMax=TObj.pt();
        }
    }
  return std::pair<double,double>(etaTrig,phiTrig);
}