Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 73087
b: "refs/heads/CMSSW_7_1_X"
c: 0b8bf86
h: "refs/heads/CMSSW_7_1_X"
i:
  73085: 6f62144
  73083: c592305
  73079: 6f0ed47
  73071: da0c879
  73055: 7a0867d
  73023: ad3e338
  72959: 5fb1bbf
v: v3
  • Loading branch information
Dmytro Kovalskyi committed Sep 6, 2009
1 parent 6166e13 commit 196a425
Show file tree
Hide file tree
Showing 8 changed files with 224 additions and 103 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
---
refs/heads/gh-pages: 09c786f70121f131b3715aaf3464996502bbeb7e
"refs/heads/CMSSW_7_1_X": 4d0e5a217f434e1160dcee1b31aa535b0e91a962
"refs/heads/CMSSW_7_1_X": 0b8bf86192fac12280a70d6069d1a33b405abe7c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#ifndef TrackAssociator_PreshowerDetIdAssociator_h
#define TrackAssociator_PreshowerDetIdAssociator_h 1
// -*- C++ -*-
//
// Package: TrackAssociator
// Class: PreshowerDetIdAssociator
//
/*
Description: <one line class summary>
Implementation:
<Notes on implementation>
*/
//
// Original Author: Dmytro Kovalskyi
// $Id: PreshowerDetIdAssociator.h,v 1.1.2.1 2009/07/01 10:04:16 dmytro Exp $
//
//

#include "TrackingTools/TrackAssociator/interface/CaloDetIdAssociator.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"

class PreshowerDetIdAssociator: public CaloDetIdAssociator{
public:
PreshowerDetIdAssociator():CaloDetIdAssociator(30,60,0.1){};

PreshowerDetIdAssociator(const edm::ParameterSet& pSet):CaloDetIdAssociator(pSet){};

protected:

virtual std::set<DetId> getASetOfValidDetIds() const {
std::set<DetId> setOfValidIds;
std::vector<DetId> vectOfValidIds = geometry_->getValidDetIds(DetId::Ecal, EcalPreshower);
for(std::vector<DetId>::const_iterator it = vectOfValidIds.begin(); it != vectOfValidIds.end(); ++it)
setOfValidIds.insert(*it);

return setOfValidIds;
};

};
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//
// Original Author: Dmytro Kovalskyi
// Created: Fri Apr 21 10:59:41 PDT 2006
// $Id: TrackDetectorAssociator.h,v 1.14 2008/08/07 02:06:23 dmytro Exp $
// $Id: TrackDetectorAssociator.h,v 1.15.2.1 2009/07/01 10:04:16 dmytro Exp $
//
//

Expand Down Expand Up @@ -141,6 +141,10 @@ class TrackDetectorAssociator {
TrackDetMatchInfo&,
const AssociatorParameters&);

void fillPreshower( const edm::Event& iEvent,
TrackDetMatchInfo& info,
const AssociatorParameters&);

void fillMuon( const edm::Event&,
TrackDetMatchInfo&,
const AssociatorParameters&);
Expand Down Expand Up @@ -188,6 +192,7 @@ class TrackDetectorAssociator {
edm::ESHandle<DetIdAssociator> hoDetIdAssociator_;
edm::ESHandle<DetIdAssociator> caloDetIdAssociator_;
edm::ESHandle<DetIdAssociator> muonDetIdAssociator_;
edm::ESHandle<DetIdAssociator> preshowerDetIdAssociator_;

edm::ESHandle<CaloGeometry> theCaloGeometry_;
edm::ESHandle<GlobalTrackingGeometry> theTrackingGeometry_;
Expand Down
2 changes: 2 additions & 0 deletions trunk/TrackingTools/TrackAssociator/plugins/modules.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ DEFINE_SEAL_MODULE();
#include "TrackingTools/TrackAssociator/interface/HODetIdAssociator.h"
#include "TrackingTools/TrackAssociator/interface/CaloDetIdAssociator.h"
#include "TrackingTools/TrackAssociator/interface/MuonDetIdAssociator.h"
#include "TrackingTools/TrackAssociator/interface/PreshowerDetIdAssociator.h"

DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, EcalDetIdAssociator, "EcalDetIdAssociator");
DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, HcalDetIdAssociator, "HcalDetIdAssociator");
DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, HODetIdAssociator, "HODetIdAssociator");
DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, CaloDetIdAssociator, "CaloDetIdAssociator");
DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, MuonDetIdAssociator, "MuonDetIdAssociator");
DEFINE_EDM_PLUGIN(DetIdAssociatorFactory, PreshowerDetIdAssociator, "PreshowerDetIdAssociator");
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,11 @@
includeBadChambers = cms.bool(False)
)

preshowerDetIdAssociator = cms.ESProducer("DetIdAssociatorESProducer",
ComponentName = cms.string('PreshowerDetIdAssociator'),
etaBinSize = cms.double(0.1),
nEta = cms.int32(60),
nPhi = cms.int32(30)
)


117 changes: 44 additions & 73 deletions trunk/TrackingTools/TrackAssociator/src/TrackDetectorAssociator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
//
// Original Author: Dmytro Kovalskyi
// Created: Fri Apr 21 10:59:41 PDT 2006
// $Id: TrackDetectorAssociator.cc,v 1.37 2009/03/30 11:59:30 arizzi Exp $
// $Id: TrackDetectorAssociator.cc,v 1.37.2.1 2009/07/01 10:04:17 dmytro Exp $
//
//

Expand Down Expand Up @@ -76,6 +76,7 @@

#include "TrackingTools/TrackAssociator/interface/CaloDetIdAssociator.h"
#include "TrackingTools/TrackAssociator/interface/EcalDetIdAssociator.h"
#include "TrackingTools/TrackAssociator/interface/PreshowerDetIdAssociator.h"
// #include "Utilities/Timing/interface/TimerStack.h"

#include "DataFormats/DTRecHit/interface/DTRecSegment4DCollection.h"
Expand Down Expand Up @@ -150,6 +151,7 @@ void TrackDetectorAssociator::init( const edm::EventSetup& iSetup )
iSetup.get<DetIdAssociatorRecord>().get("HODetIdAssociator", hoDetIdAssociator_);
iSetup.get<DetIdAssociatorRecord>().get("CaloDetIdAssociator", caloDetIdAssociator_);
iSetup.get<DetIdAssociatorRecord>().get("MuonDetIdAssociator", muonDetIdAssociator_);
iSetup.get<DetIdAssociatorRecord>().get("PreshowerDetIdAssociator", preshowerDetIdAssociator_);
}

TrackDetMatchInfo TrackDetectorAssociator::associate( const edm::Event& iEvent,
Expand Down Expand Up @@ -200,7 +202,7 @@ TrackDetMatchInfo TrackDetectorAssociator::associate( const edm::Event& iEvent,
double HOmaxR = hoDetIdAssociator_->volume().maxR();
double HOmaxZ = hoDetIdAssociator_->volume().maxZ();
double minR = ecalDetIdAssociator_->volume().minR();
double minZ = ecalDetIdAssociator_->volume().minZ();
double minZ = preshowerDetIdAssociator_->volume().minZ();
cachedTrajectory_.setMaxHORadius(HOmaxR);
cachedTrajectory_.setMaxHOLength(HOmaxZ*2.);
cachedTrajectory_.setMinDetectorRadius(minR);
Expand Down Expand Up @@ -242,6 +244,7 @@ TrackDetMatchInfo TrackDetectorAssociator::associate( const edm::Event& iEvent,
cachedTrajectory_.findEcalTrajectory( ecalDetIdAssociator_->volume() );
cachedTrajectory_.findHcalTrajectory( hcalDetIdAssociator_->volume() );
cachedTrajectory_.findHOTrajectory( hoDetIdAssociator_->volume() );
cachedTrajectory_.findPreshowerTrajectory( preshowerDetIdAssociator_->volume() );

info.trkGlobPosAtEcal = getPoint( cachedTrajectory_.getStateAtEcal().position() );
info.trkGlobPosAtHcal = getPoint( cachedTrajectory_.getStateAtHcal().position() );
Expand All @@ -253,6 +256,7 @@ TrackDetMatchInfo TrackDetectorAssociator::associate( const edm::Event& iEvent,
if (parameters.useCalo) fillCaloTowers( iEvent, info, parameters);
if (parameters.useHcal) fillHcal( iEvent, info, parameters);
if (parameters.useHO) fillHO( iEvent, info, parameters);
if (parameters.usePreshower) fillPreshower( iEvent, info, parameters);
if (parameters.useMuon) fillMuon( iEvent, info, parameters);
if (parameters.truthMatch) fillCaloTruth( iEvent, info, parameters);

Expand All @@ -274,20 +278,8 @@ void TrackDetectorAssociator::fillEcal( const edm::Event& iEvent,
", " << itr->position().z() << ", " << itr->position().phi();

std::vector<GlobalPoint> coreTrajectory;
std::vector<GlobalPoint> trajectoryWithErrors;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
// timers.push("TrackDetectorAssociator::fillEcal::BuildEllipse");
std::vector<GlobalPoint>* wideTrajectory = cachedTrajectory_.getWideTrajectory(trajectoryStates, CachedTrajectory::Ecal);
trajectoryWithErrors = *wideTrajectory;
for(unsigned int trajit=0; trajit<wideTrajectory->size(); trajit+=5)
coreTrajectory.push_back(trajectoryWithErrors[trajit]);
LogTrace("TrackAssociator") << "Wide trajectory has " << wideTrajectory->size() << " points";
// timers.pop();
} else {
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
trajectoryWithErrors = coreTrajectory;
}
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());

if(coreTrajectory.empty()) {
LogTrace("TrackAssociator") << "ECAL track trajectory is empty; moving on\n";
Expand Down Expand Up @@ -321,16 +313,8 @@ void TrackDetectorAssociator::fillEcal( const edm::Event& iEvent,
if (parameters.dREcalPreselection > parameters.dREcal)
ecalIdsInRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory, parameters.dREcal);
LogTrace("TrackAssociator") << "ECAL hits in the cone: " << ecalIdsInRegion.size();
std::vector<DetId> crossedEcalIds;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
float conesize = .0696;
std::set<DetId> ecalIdsInSubRegion = ecalDetIdAssociator_->getDetIdsInACone(ecalIdsInRegion, coreTrajectory, conesize);
// timers.pop_and_push("TrackDetectorAssociator::fillEcal::matching::crossed");
crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIdsOrdered(ecalIdsInSubRegion, trajectoryWithErrors);
// timers.pop();
} else {
crossedEcalIds = ecalDetIdAssociator_->getCrossedDetIdsOrdered(ecalIdsInRegion, trajectoryWithErrors);
}
std::vector<DetId> crossedEcalIds =
ecalDetIdAssociator_->getCrossedDetIds(ecalIdsInRegion, coreTrajectory);
LogTrace("TrackAssociator") << "ECAL crossed hits " << crossedEcalIds.size();

info.crossedEcalIds = crossedEcalIds;
Expand Down Expand Up @@ -404,7 +388,7 @@ void TrackDetectorAssociator::fillCaloTowers( const edm::Event& iEvent,
LogTrace("TrackAssociator") << "Towers in the region: " << caloTowerIdsInRegion.size();
std::set<DetId> caloTowerIdsInACone = caloDetIdAssociator_->getDetIdsInACone(caloTowerIdsInRegion, trajectory, parameters.dRHcal);
LogTrace("TrackAssociator") << "Towers in the cone: " << caloTowerIdsInACone.size();
std::vector<DetId> crossedCaloTowerIds = caloDetIdAssociator_->getCrossedDetIdsOrdered(caloTowerIdsInRegion, trajectory);
std::vector<DetId> crossedCaloTowerIds = caloDetIdAssociator_->getCrossedDetIds(caloTowerIdsInRegion, trajectory);
LogTrace("TrackAssociator") << "Towers crossed: " << crossedCaloTowerIds.size();

info.crossedTowerIds = crossedCaloTowerIds;
Expand Down Expand Up @@ -432,6 +416,31 @@ void TrackDetectorAssociator::fillCaloTowers( const edm::Event& iEvent,

}

void TrackDetectorAssociator::fillPreshower( const edm::Event& iEvent,
TrackDetMatchInfo& info,
const AssociatorParameters& parameters)
{
std::vector<GlobalPoint> trajectory;
const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getPreshowerTrajectory();
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) trajectory.push_back(itr->position());

if(trajectory.empty()) {
LogTrace("TrackAssociator") << "Preshower trajectory is empty; moving on\n";
return;
}

std::set<DetId> idsInRegion =
preshowerDetIdAssociator_->getDetIdsCloseToAPoint(trajectory[0],
parameters.dRPreshowerPreselection);

LogTrace("TrackAssociator") << "Number of Preshower Ids in the region: " << idsInRegion.size();
std::vector<DetId> crossedIds = preshowerDetIdAssociator_->getCrossedDetIds(idsInRegion, trajectory);
LogTrace("TrackAssociator") << "Number of Preshower Ids in crossed: " << crossedIds.size();
info.crossedPreshowerIds = crossedIds;
}


void TrackDetectorAssociator::fillHcal( const edm::Event& iEvent,
TrackDetMatchInfo& info,
const AssociatorParameters& parameters)
Expand All @@ -442,20 +451,8 @@ void TrackDetectorAssociator::fillHcal( const edm::Event& iEvent,
const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHcalTrajectory();

std::vector<GlobalPoint> coreTrajectory;
std::vector<GlobalPoint> trajectoryWithErrors;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
// timers.push("TrackDetectorAssociator::fillHcal::BuildEllipse");
std::vector<GlobalPoint>* wideTrajectory = cachedTrajectory_.getWideTrajectory(trajectoryStates, CachedTrajectory::Hcal);
trajectoryWithErrors = *wideTrajectory;
for(unsigned int trajit=0; trajit<wideTrajectory->size(); trajit+=5)
coreTrajectory.push_back(trajectoryWithErrors[trajit]);
LogTrace("TrackAssociator") << "Wide trajectory has " << wideTrajectory->size() << " points";
// timers.pop();
} else {
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
trajectoryWithErrors = coreTrajectory;
}
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());

if(coreTrajectory.empty()) {
LogTrace("TrackAssociator") << "HCAL trajectory is empty; moving on\n";
Expand Down Expand Up @@ -483,14 +480,8 @@ void TrackDetectorAssociator::fillHcal( const edm::Event& iEvent,
LogTrace("TrackAssociator") << "HCAL hits in the region: " << idsInRegion.size() << "\n" << DetIdInfo::info(idsInRegion);
std::set<DetId> idsInACone = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.dRHcal);
LogTrace("TrackAssociator") << "HCAL hits in the cone: " << idsInACone.size() << "\n" << DetIdInfo::info(idsInACone);
std::vector<DetId> crossedIds;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
float conesize = 0.348;
std::set<DetId> idsInSubRegion = hcalDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, conesize);
crossedIds = hcalDetIdAssociator_->getCrossedDetIdsOrdered(idsInSubRegion, trajectoryWithErrors);
} else {
crossedIds = hcalDetIdAssociator_->getCrossedDetIdsOrdered(idsInRegion, trajectoryWithErrors);
}
std::vector<DetId> crossedIds =
hcalDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);
LogTrace("TrackAssociator") << "HCAL hits crossed: " << crossedIds.size() << "\n" << DetIdInfo::info(crossedIds);

info.crossedHcalIds = crossedIds;
Expand Down Expand Up @@ -526,20 +517,8 @@ void TrackDetectorAssociator::fillHO( const edm::Event& iEvent,
const std::vector<SteppingHelixStateInfo>& trajectoryStates = cachedTrajectory_.getHOTrajectory();

std::vector<GlobalPoint> coreTrajectory;
std::vector<GlobalPoint> trajectoryWithErrors;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
// timers.push("TrackDetectorAssociator::fillHO::BuildEllipse");
std::vector<GlobalPoint>* wideTrajectory = cachedTrajectory_.getWideTrajectory(trajectoryStates, CachedTrajectory::Hcal);
trajectoryWithErrors = *wideTrajectory;
for(unsigned int trajit=0; trajit<wideTrajectory->size(); trajit+=5)
coreTrajectory.push_back(trajectoryWithErrors[trajit]);
LogTrace("TrackAssociator") << "Wide trajectory has " << wideTrajectory->size() << " points";
// timers.pop();
} else {
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());
trajectoryWithErrors = coreTrajectory;
}
for(std::vector<SteppingHelixStateInfo>::const_iterator itr = trajectoryStates.begin();
itr != trajectoryStates.end(); itr++) coreTrajectory.push_back(itr->position());

if(coreTrajectory.empty()) {
LogTrace("TrackAssociator") << "HO trajectory is empty; moving on\n";
Expand Down Expand Up @@ -567,15 +546,8 @@ void TrackDetectorAssociator::fillHO( const edm::Event& iEvent,
LogTrace("TrackAssociator") << "idsInRegion.size(): " << idsInRegion.size();
std::set<DetId> idsInACone = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, parameters.dRHcal);
LogTrace("TrackAssociator") << "idsInACone.size(): " << idsInACone.size();
std::vector<DetId> crossedIds;
if ( parameters.crossedEnergyType == TrackAssociatorParameters::FivePointTwoSigmaElipseAlongTrajectory ) {
float conesize=0.348;
std::set<DetId> idsInSubRegion = hoDetIdAssociator_->getDetIdsInACone(idsInRegion, coreTrajectory, conesize);
crossedIds = hoDetIdAssociator_->getCrossedDetIdsOrdered(idsInSubRegion, trajectoryWithErrors);
LogTrace("TrackAssociator") << "crossedIds.size(): " << crossedIds.size();
} else {
crossedIds = hoDetIdAssociator_->getCrossedDetIdsOrdered(idsInRegion, trajectoryWithErrors);
}
std::vector<DetId> crossedIds =
hoDetIdAssociator_->getCrossedDetIds(idsInRegion, coreTrajectory);

info.crossedHOIds = crossedIds;

Expand Down Expand Up @@ -789,7 +761,6 @@ void TrackDetectorAssociator::getTAMuonChamberMatches(std::vector<TAMuonChamberM

}


void TrackDetectorAssociator::fillMuon( const edm::Event& iEvent,
TrackDetMatchInfo& info,
const AssociatorParameters& parameters)
Expand Down
Loading

0 comments on commit 196a425

Please sign in to comment.