Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 74602
b: "refs/heads/CMSSW_7_1_X"
c: e5c23c2
h: "refs/heads/CMSSW_7_1_X"
v: v3
  • Loading branch information
Alessio Bonato committed Oct 2, 2009
1 parent 0eb0edf commit 49ac97c
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 4 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": 21c0dbec14e3838de499541f47c619431aadfeb1
"refs/heads/CMSSW_7_1_X": e5c23c20f8f591c417c106e295d101d907840b26
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
#include "FWCore/ParameterSet/interface/InputTag.h"
#include <vector>

#include "DataFormats/Alignment/interface/AlignmentClusterFlag.h"
#include "DataFormats/Alignment/interface/AliClusterValueMap.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
namespace edm {
class Event;
class ParameterSet;
Expand Down Expand Up @@ -43,10 +47,14 @@ class AlignmentTrackSelector
bool isOkCharge(const TrackingRecHit* therechit) const;
bool isOkChargeStripHit(const SiStripRecHit2D *siStripRecHit2D) const;
bool isIsolated(const TrackingRecHit* therechit, const edm::Event& evt) const;
bool isOkTrkQuality(const reco::Track* track) const;

/// filter the n highest pt tracks
Tracks theNHighestPtTracks(const Tracks& tracks) const;

//filter tracks that do not have a min # of hits taken by the Skim&Prescale workflow
Tracks checkTakenHits(const Tracks& tracks, const edm::Event& evt) const;

/// compare two tracks in pt (used by theNHighestPtTracks)
struct ComparePt {
bool operator()( const reco::Track* t1, const reco::Track* t2 ) const {
Expand All @@ -67,6 +75,10 @@ class AlignmentTrackSelector
const unsigned int nHitMin2D_;
const int minHitsinTIB_, minHitsinTOB_, minHitsinTID_, minHitsinTEC_, minHitsinBPIX_, minHitsinFPIX_;

const int minTakenHits_;
const edm::InputTag hitVMTag_; // ValueMap containing associtaion cluster - flag

std::vector<std::string> trkQuality_;
};

#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@
applyChargeFilter = cms.bool(False),
applyAcoplanarityFilter = cms.bool(False),
applyMissingETFilter = cms.bool(False)
)
),
TrackQuality = cms.vstring(''),
#settings for filtering on the hits taken by the Skim&Prescale workflow
HitPrescaleMap = cms.InputTag(''),
minTakenHits = cms.int32(-1)
)


Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ AlignmentTrackSelector::AlignmentTrackSelector(const edm::ParameterSet & cfg) :
minHitsinTID_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTID" ) ),
minHitsinTEC_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTEC" ) ),
minHitsinBPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inBPIX" ) ),
minHitsinFPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIX" ) )
minHitsinFPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIX" ) ),
trkQuality_(cfg.getParameter<std::vector<std::string> >("TrackQuality")),
hitVMTag_(cfg.getParameter<edm::InputTag>("HitPrescaleMap")),
minTakenHits_( cfg.getParameter<int>("minTakenHits"))
{
if (applyBasicCuts_){
edm::LogInfo("AlignmentTrackSelector")
Expand Down Expand Up @@ -133,6 +136,12 @@ AlignmentTrackSelector::select(const Tracks& tracks, const edm::Event& evt) cons
}
}

//check if there is a minimum of prescaled taken hits only if the two
//parameters make sense
if(hitVMTag_.encode().size() && minTakenHits_>0){
result = this->checkTakenHits(result, evt);
}

return result;
}

Expand Down Expand Up @@ -168,7 +177,11 @@ AlignmentTrackSelector::basicCuts(const Tracks& tracks, const edm::Event& evt) c
&& phi>phiMin_ && phi<phiMax_
&& nhit>=nHitMin_ && nhit<=nHitMax_
&& chi2n<chi2nMax_) {
if (this->detailedHitsCheck(trackp, evt)) result.push_back(trackp);
bool trkQualityOk=true;
bool hitsCheckOk=this->detailedHitsCheck(trackp, evt);
if(trkQuality_.size()>0)this->isOkTrkQuality(trackp);

if (trkQualityOk && hitsCheckOk ) result.push_back(trackp);
}
}

Expand Down Expand Up @@ -396,3 +409,72 @@ AlignmentTrackSelector::theNHighestPtTracks(const Tracks& tracks) const
return result;
}

AlignmentTrackSelector::Tracks
AlignmentTrackSelector::checkTakenHits(const Tracks& tracks, const edm::Event& evt) const
{
Tracks result;

//take Cluster-Flag Assomap
edm::Handle<AliClusterValueMap> fMap;
evt.getByLabel( hitVMTag_, fMap);
AliClusterValueMap FlagMap=*fMap;

//for each track loop on hits and count the number of taken hits
for (Tracks::const_iterator ittrk=tracks.begin(); ittrk != tracks.end(); ++ittrk) {
const reco::Track* trackp=*ittrk;
int ntakenhits=0;
// float pt=trackp->pt();

for (trackingRecHit_iterator ith = trackp->recHitsBegin(), edh = trackp->recHitsEnd(); ith != edh; ++ith) {
const TrackingRecHit *hit = ith->get(); // ith is an iterator on edm::Ref to rechit
if(! hit->isValid())continue;
DetId detid = hit->geographicalId();
int subDet = detid.subdetId();
AlignmentClusterFlag flag;

if (subDet>2){
const SiStripRecHit2D* striphit=dynamic_cast<const SiStripRecHit2D*>(hit);
if(striphit!=0){
SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());
flag = FlagMap[stripclust];

}
else{
std::cout<<"ERROR in <AlignmentTrackSelector::checkTakenHits>: Dynamic cast of Strip RecHit failed! "<< std::endl;
}
}//end if hit in Strips
else{
const SiPixelRecHit* pixelhit= dynamic_cast<const SiPixelRecHit*>(hit);
if(pixelhit!=0){
SiPixelClusterRefNew pixclust(pixelhit->cluster());
flag = FlagMap[pixclust];
}
else{
std::cout<<"ERROR in <AlignmentTrackSelector::checkTakenHits>: Dynamic cast of Pixel RecHit failed! "<< std::endl;
}
}//end else hit is in Pixel

if(flag.isTaken())ntakenhits++;

}//end loop on hits
if(ntakenhits >= minTakenHits_)result.push_back(trackp);
}//end loop on tracks


}//end checkTakenHits

//---------
bool AlignmentTrackSelector::isOkTrkQuality(const reco::Track* track) const{

bool quality_ok = false;
std::vector<reco::TrackBase::TrackQuality> TrkQualities;
for (unsigned int i=0;i<trkQuality_.size();i++) TrkQualities.push_back(reco::TrackBase::qualityByName(trkQuality_[i]));

for (unsigned int i = 0; i<TrkQualities.size();++i) {
if (track->quality(TrkQualities[i])){
quality_ok = true;
break;
}
}
return quality_ok;
}//end check on track quality

0 comments on commit 49ac97c

Please sign in to comment.