12 #include <boost/regex.hpp>
126 nRun(0), nAll(0), nGood(0), ptL1(0), etaL1(0), phiL1(0) {
128 const double isolationRadius(28.9);
173 edm::LogInfo(
"HcalIsoTrack") <<
"Parameters read from config file \n"
175 <<
"\t theTrackQuality " << theTrackQuality
185 <<
"\t a_coneR " << a_coneR
186 <<
"\t a_charIsoR " << a_charIsoR
188 <<
"\t pTrackMin " << pTrackMin_
189 <<
"\t eEcalMax " << eEcalMax_
191 edm::LogInfo(
"HcalIsoTrack") <<
"Process " << processName <<
" L1Filter:"
192 << l1Filter <<
" L2Filter:" << l2Filter
197 std::vector<int> dummy(trigNames.size(),0);
201 produces<reco::HcalIsolatedTrackCandidateCollection>(
labelIsoTk_);
202 produces<reco::VertexCollection>(labelRecVtx_.
label());
203 produces<EcalRecHitCollection>(labelEB_.
instance());
204 produces<EcalRecHitCollection>(labelEE_.
instance());
205 produces<HBHERecHitCollection>(labelHBHE_.
label());
207 edm::LogInfo(
"HcalIsoTrack") <<
" Expected to produce the collections:\n"
208 <<
"reco::HcalIsolatedTrackCandidateCollection "
209 <<
" with label HcalIsolatedTrackCollection\n"
210 <<
"reco::VertexCollection with label " << labelRecVtx_.
label() <<
"\n"
211 <<
"EcalRecHitCollection with label EcalRecHitsEB\n"
212 <<
"EcalRecHitCollection with label EcalRecHitsEE\n"
213 <<
"HBHERecHitCollection with label " << labelHBHE_.
label();
225 << iEvent.
id().
event() <<
" Luminosity "
233 if (!triggerEventHandle.
isValid()) {
239 if (!triggerResults.
isValid()) {
246 if (!trkCollection.
isValid()) {
250 reco::TrackCollection::const_iterator trkItr;
253 if (!trkCollection.
isValid()) {
261 if (recVtxs->size()>0 && !((*recVtxs)[0].isFake())) {
264 }
else if (beamSpotH.
isValid()) {
265 leadPV = beamSpotH->position();
268 edm::LogInfo(
"HcalIsoTrack") <<
"Primary Vertex " << leadPV;
273 if (!barrelRecHitsHandle.
isValid()) {
279 if (!endcapRecHitsHandle.
isValid()) {
295 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1tauobjref;
299 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1jetobjref;
303 std::vector< edm::Ref<l1extra::L1JetParticleCollection> > l1forjetobjref;
308 if (!triggerEventHandle.
isValid()) {
313 if (triggerResults.
isValid()) {
315 const std::vector<std::string> & triggerNames_ = triggerNames.
triggerNames();
318 edm::LogInfo(
"HcalIsoTrack") <<
"AlCaIsoTracksProducer::select returns "
319 << isotk->size() <<
" isolated tracks";
321 std::auto_ptr<reco::HcalIsolatedTrackCandidateCollection> outputHcalIsoTrackColl(isotk);
327 if (isotk->size() > 0) {
328 for (reco::VertexCollection::const_iterator vtx=recVtxs->begin(); vtx!=recVtxs->end(); ++vtx)
329 outputVColl->push_back(*vtx);
332 outputEBColl->push_back(*ehit);
335 outputEEColl->push_back(*ehit);
337 for (std::vector<HBHERecHit>::const_iterator hhit=hbhe->begin(); hhit!=hbhe->end(); ++hhit)
338 outputHBHEColl->push_back(*hhit);
354 <<
nAll <<
" events from " <<
nRun <<
" runs";
381 const std::vector<std::string> & triggerNames_,
391 for (
unsigned int iHLT=0; iHLT<triggerResults->size(); iHLT++) {
392 int hlt = triggerResults->accept(iHLT);
394 if (triggerNames_[iHLT].
find(
trigNames[
i].c_str())!=std::string::npos) {
400 edm::LogInfo(
"HcalIsoTrack") <<
"The trigger we are looking for "
401 << triggerNames_[iHLT] <<
" Flag "
408 std::vector<spr::propagatedTrackDirection> trkCaloDirections;
410 trkCaloDirections,
false);
412 std::vector<spr::propagatedTrackDirection>::const_iterator trkDetItr;
413 unsigned int nTracks(0), nselTracks(0);
414 for (trkDetItr = trkCaloDirections.begin(),nTracks=0;
415 trkDetItr != trkCaloDirections.end(); trkDetItr++,nTracks++) {
416 const reco::Track* pTrack = &(*(trkDetItr->trkItr));
418 pTrack->
pz(), pTrack->
p());
420 edm::LogInfo(
"HcalIsoTrack") <<
"This track : " << nTracks
421 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
422 <<
"|" << pTrack->
eta() <<
"|"
423 << pTrack->
phi() <<
"|" << pTrack->
p();
428 edm::LogInfo(
"HcalIsoTrack") <<
"qltyFlag|okECAL|okHCAL : " << qltyFlag
429 <<
"|" << trkDetItr->okECAL <<
"|"
430 << trkDetItr->okHCAL;
432 if (qltyFlag && trkDetItr->okECAL && trkDetItr->okHCAL) {
433 double t_p = pTrack->
p();
435 int nRH_eMipDR(0), nNearTRKs(0);
438 trkDetItr->pointHCAL,
439 trkDetItr->pointECAL,
a_mipR,
440 trkDetItr->directionECAL,
447 edm::LogInfo(
"HcalIsoTrack") <<
"This track : " << nTracks
448 <<
" (pt|eta|phi|p) :" << pTrack->
pt()
449 <<
"|" << pTrack->
eta() <<
"|"
450 << pTrack->
phi() <<
"|" << t_p
451 <<
" e_MIP " << eMipDR
452 <<
" Chg Isolation " << hmaxNearP;
456 newCandidate.
SetMaxP(hmaxNearP);
460 (trkDetItr->pointECAL).
phi());
463 (trkDetItr->pointHCAL).
phi(),
466 reco::TrackCollection::const_iterator trkItr1;
467 for (trkItr1=trkCollection->begin(); trkItr1 != trkCollection->end(); ++trkItr1,++indx) {
469 if (pTrack1 == pTrack) {
475 trackCollection->push_back(newCandidate);
484 for (
unsigned int p=0;
p<objref.size();
p++) {
486 ptL1 = objref[
p]->pt();
487 phiL1 = objref[
p]->phi();
488 etaL1 = objref[
p]->eta();
double p() const
momentum vector magnitude
virtual void endRun(edm::Run const &, edm::EventSetup const &)
T getParameter(std::string const &) const
EventNumber_t event() const
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
std::vector< spr::propagatedTrackID > propagateCALO(edm::Handle< reco::TrackCollection > &trkCollection, const CaloGeometry *geo, const MagneticField *bField, std::string &theTrackQuality, bool debug=false)
AlCaIsoTracksProducer(const edm::ParameterSet &)
The single EDProduct to be saved for each event (AOD case)
virtual void produce(edm::Event &, const edm::EventSetup &)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
edm::EDGetTokenT< EcalRecHitCollection > tok_EE_
std::vector< T >::const_iterator const_iterator
int bunchCrossing() const
edm::EDGetTokenT< reco::TrackCollection > tok_genTrack_
spr::trackSelectionParameters selectionParameters
edm::LuminosityBlockNumber_t luminosityBlock() const
double phi() const
azimuthal angle of momentum vector
std::vector< Vertex > VertexCollection
collection of Vertex objects
double chargeIsolationCone(unsigned int trkIndex, std::vector< spr::propagatedTrackDirection > &trkDirs, double dR, int &nNearTRKs, bool debug=false)
std::vector< std::string > HLTNames
double px() const
x coordinate of momentum vector
edm::EDGetTokenT< trigger::TriggerFilterObjectWithRefs > tok_hltGT_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Strings const & triggerNames() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
edm::EDGetTokenT< EcalRecHitCollection > tok_EB_
std::vector< std::string > trigNames
edm::EDGetTokenT< reco::BeamSpot > tok_bs_
edm::EDGetTokenT< reco::VertexCollection > tok_recVtx_
double eta() const
pseudorapidity of momentum vector
std::vector< HcalIsolatedTrackCandidate > HcalIsolatedTrackCandidateCollection
collectin of HcalIsolatedTrackCandidate objects
bool goodTrack(const reco::Track *pTrack, math::XYZPoint leadPV, trackSelectionParameters parameters, bool debug=false)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
void SetEtaPhiEcal(double eta, double phi)
eta, phi at ECAL surface
double pt() const
track transverse momentum
void setPtEtaPhi(std::vector< edm::Ref< l1extra::L1JetParticleCollection > > &objref, double &ptL1, double &etaL1, double &phiL1)
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
int ieta() const
get the cell ieta
void SetEnergyEcal(double a)
edm::InputTag labelHltGT_
void SetEtaPhiHcal(double eta, double phi, int ieta, int iphi)
eta, phi at HCAL surface
double eCone_ecal(const CaloGeometry *geo, edm::Handle< T > &barrelhits, edm::Handle< T > &endcaphits, const GlobalPoint &hpoint1, const GlobalPoint &point1, double dR, const GlobalVector &trackMom, int &nRecHits, double ebThr=-100, double eeThr=-100, double tMin=-500, double tMax=500, bool debug=false)
const MagneticField * bField
static std::string const triggerResults
std::vector< int > trigPass
edm::InputTag labelTriggerEvent_
edm::EDGetTokenT< trigger::TriggerEvent > tok_trigEvt_
double pz() const
z coordinate of momentum vector
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
int iphi() const
get the cell iphi
HLTConfigProvider hltConfig_
edm::InputTag labelTriggerResults_
static TrackQuality qualityByName(const std::string &name)
T const * product() const
void setL1(double pt, double eta, double phi)
XYZPointD XYZPoint
point in space with cartesian internal representation
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d'tor
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T const * product() const
reco::HcalIsolatedTrackCandidateCollection * select(edm::Handle< edm::TriggerResults > &triggerResults, const std::vector< std::string > &triggerNames_, edm::Handle< reco::TrackCollection > &trkCollection, math::XYZPoint &leadPV, edm::Handle< EcalRecHitCollection > &barrelRecHitsHandle, edm::Handle< EcalRecHitCollection > &endcapRecHitsHandle, edm::Handle< HBHERecHitCollection > &hbhe)
std::vector< int > trigKount
reco::TrackBase::TrackQuality minQuality
edm::InputTag labelRecVtx_
void setTrack(const reco::TrackRef &tr)
std::string theTrackQuality
edm::InputTag labelGenTrack_
edm::EDGetTokenT< edm::TriggerResults > tok_trigRes_
double py() const
y coordinate of momentum vector