#include <RecoParticleFlow/PFTracking/interface/GoodSeedProducer.h>
Public Member Functions | |
GoodSeedProducer (const edm::ParameterSet &) | |
~GoodSeedProducer () | |
Private Types | |
typedef TrajectoryStateOnSurface | TSOS |
Private Member Functions | |
virtual void | beginJob (const edm::EventSetup &) |
virtual void | endJob () |
int | getBin (float) |
int | getBin (float, float) |
Find the bin in pt and eta. | |
bool | IsIsolated (float charge, float P, math::XYZPointF, const reco::PFClusterCollection &ecalColl, const reco::PFClusterCollection &hcalColl) |
virtual void | produce (edm::Event &, const edm::EventSetup &) |
void | PSforTMVA (math::XYZTLorentzVector mom, math::XYZTLorentzVector pos) |
Private Attributes | |
bool | applyIsolation_ |
ISOLATION REQUEST AS DONE IN THE TAU GROUP. | |
math::XYZVector | B_ |
B field. | |
float | chi |
float | chiRatio |
float | chired |
double | clusThreshold_ |
Cut on the energy of the clusters. | |
edm::ParameterSet | conf_ |
float | dpt |
double | EcalStripSumE_deltaEta_ |
double | EcalStripSumE_deltaPhiOverQ_maxValue_ |
double | EcalStripSumE_deltaPhiOverQ_minValue_ |
double | EcalStripSumE_minClusEnergy_ |
float | eP |
VARIABLES NEEDED FOR TMVA. | |
float | eta |
edm::ESHandle< TrajectoryFitter > | fitter_ |
Fitter. | |
std::string | fitterName_ |
double | HcalIsolWindow_ |
double | maxEp_ |
double | maxEta_ |
double | maxHoverP_ |
double | maxPt_ |
std::string | method_ |
TMVA method. | |
double | minEoverP_ |
double | minEp_ |
Min and MAx allowed values forEoverP. | |
double | minPt_ |
Minimum transverse momentum and maximum pseudorapidity. | |
float | nhit |
int | nHitsInSeed_ |
Number of hits in the seed;. | |
edm::InputTag | pfCLusTagECLabel_ |
edm::InputTag | pfCLusTagHCLabel_ |
edm::InputTag | pfCLusTagPSLabel_ |
PFTrackTransformer * | pfTransformer_ |
PFTrackTransformer. | |
std::string | preidckf_ |
Name of the Seed(Ckf) Collection. | |
std::string | preidgsf_ |
Name of the Seed(Gsf) Collection. | |
bool | produceCkfPFT_ |
Produce the PFtracks for Ckf tracks? | |
bool | produceCkfseed_ |
Produce the Seed for Ckf tracks? | |
std::string | propagatorName_ |
float | ps1chi |
std::vector< reco::PFCluster > | ps1Clus |
Vector of clusters of the PreShower. | |
float | ps1En |
float | ps2chi |
std::vector< reco::PFCluster > | ps2Clus |
float | ps2En |
float | pt |
TMVA::Reader * | reader |
READER FOR TMVA. | |
edm::ESHandle< TrajectorySmoother > | smoother_ |
Smoother. | |
std::string | smootherName_ |
float | thr [150] |
vector of thresholds for different bins of eta and pt | |
float | thrPS [20] |
reco::TrackBase::TrackQuality | trackQuality_ |
std::vector< edm::InputTag > | tracksContainers_ |
bool | usePreshower_ |
Use of Preshower clusters. | |
bool | useQuality_ |
TRACK QUALITY. | |
bool | useTmva_ |
USE OF TMVA. | |
Static Private Attributes | |
static PFResolutionMap * | resMapEtaECAL_ = 0 |
static PFResolutionMap * | resMapPhiECAL_ = 0 |
Definition at line 43 of file GoodSeedProducer.h.
typedef TrajectoryStateOnSurface GoodSeedProducer::TSOS [private] |
Definition at line 44 of file GoodSeedProducer.h.
GoodSeedProducer::GoodSeedProducer | ( | const edm::ParameterSet & | iConfig | ) | [explicit] |
Definition at line 38 of file GoodSeedProducer.cc.
References applyIsolation_, clusThreshold_, EcalStripSumE_deltaEta_, EcalStripSumE_deltaPhiOverQ_maxValue_, EcalStripSumE_deltaPhiOverQ_minValue_, EcalStripSumE_minClusEnergy_, fitterName_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), HcalIsolWindow_, LogDebug, maxEp_, maxEta_, maxHoverP_, maxPt_, minEoverP_, minEp_, minPt_, nHitsInSeed_, pfCLusTagECLabel_, pfCLusTagHCLabel_, pfCLusTagPSLabel_, preidckf_, preidgsf_, produceCkfPFT_, produceCkfseed_, smootherName_, trackQuality_, tracksContainers_, usePreshower_, useQuality_, and useTmva_.
00038 : 00039 pfTransformer_(0), 00040 conf_(iConfig) 00041 { 00042 LogInfo("GoodSeedProducer")<<"Electron PreIdentification started "; 00043 00044 //now do what ever initialization is needed 00045 00046 tracksContainers_ = 00047 iConfig.getParameter< vector < InputTag > >("TkColList"); 00048 00049 minPt_=iConfig.getParameter<double>("MinPt"); 00050 maxPt_=iConfig.getParameter<double>("MaxPt"); 00051 maxEta_=iConfig.getParameter<double>("MaxEta"); 00052 00053 00054 //ISOLATION REQUEST AS DONE IN THE TAU GROUP 00055 applyIsolation_ =iConfig.getParameter<bool>("ApplyIsolation"); 00056 HcalIsolWindow_ =iConfig.getParameter<double>("HcalWindow"); 00057 EcalStripSumE_minClusEnergy_ = iConfig.getParameter<double>("EcalStripSumE_minClusEnergy"); 00058 EcalStripSumE_deltaEta_ = iConfig.getParameter<double>("EcalStripSumE_deltaEta"); 00059 EcalStripSumE_deltaPhiOverQ_minValue_ = iConfig.getParameter<double>("EcalStripSumE_deltaPhiOverQ_minValue"); 00060 EcalStripSumE_deltaPhiOverQ_maxValue_ = iConfig.getParameter<double>("EcalStripSumE_deltaPhiOverQ_maxValue"); 00061 minEoverP_= iConfig.getParameter<double>("EOverPLead_minValue"); 00062 maxHoverP_= iConfig.getParameter<double>("HOverPLead_maxValue"); 00063 00064 // 00065 00066 pfCLusTagECLabel_= 00067 iConfig.getParameter<InputTag>("PFEcalClusterLabel"); 00068 00069 pfCLusTagHCLabel_= 00070 iConfig.getParameter<InputTag>("PFHcalClusterLabel"); 00071 00072 pfCLusTagPSLabel_= 00073 iConfig.getParameter<InputTag>("PFPSClusterLabel"); 00074 00075 preidgsf_=iConfig.getParameter<string>("PreGsfLabel"); 00076 preidckf_=iConfig.getParameter<string>("PreCkfLabel"); 00077 00078 00079 fitterName_ = iConfig.getParameter<string>("Fitter"); 00080 smootherName_ = iConfig.getParameter<string>("Smoother"); 00081 00082 00083 00084 nHitsInSeed_=iConfig.getParameter<int>("NHitsInSeed"); 00085 00086 clusThreshold_=iConfig.getParameter<double>("ClusterThreshold"); 00087 00088 minEp_=iConfig.getParameter<double>("MinEOverP"); 00089 maxEp_=iConfig.getParameter<double>("MaxEOverP"); 00090 00091 //collection to produce 00092 produceCkfseed_ = iConfig.getUntrackedParameter<bool>("ProduceCkfSeed",false); 00093 produceCkfPFT_ = iConfig.getUntrackedParameter<bool>("ProduceCkfPFTracks",true); 00094 00095 LogDebug("GoodSeedProducer")<<"Seeds for GSF will be produced "; 00096 produces<TrajectorySeedCollection>(preidgsf_); 00097 00098 if(produceCkfseed_){ 00099 LogDebug("GoodSeedProducer")<<"Seeds for CKF will be produced "; 00100 produces<TrajectorySeedCollection>(preidckf_); 00101 } 00102 00103 if(produceCkfPFT_){ 00104 LogDebug("GoodSeedProducer")<<"PFTracks from CKF tracks will be produced "; 00105 produces<PFRecTrackCollection>(); 00106 } 00107 00108 00109 useQuality_ = iConfig.getParameter<bool>("UseQuality"); 00110 trackQuality_=TrackBase::qualityByName(iConfig.getParameter<std::string>("TrackQuality")); 00111 00112 useTmva_= iConfig.getUntrackedParameter<bool>("UseTMVA",false); 00113 00114 usePreshower_ = iConfig.getParameter<bool>("UsePreShower"); 00115 }
GoodSeedProducer::~GoodSeedProducer | ( | ) |
Definition at line 118 of file GoodSeedProducer.cc.
References pfTransformer_.
00119 { 00120 00121 // do anything here that needs to be done at desctruction time 00122 // (e.g. close files, deallocate resources etc.) 00123 delete pfTransformer_; 00124 }
void GoodSeedProducer::beginJob | ( | const edm::EventSetup & | es | ) | [private, virtual] |
Reimplemented from edm::EDProducer.
Definition at line 478 of file GoodSeedProducer.cc.
References B_, chi, chiRatio, chired, conf_, dpt, eP, eta, edm::FileInPath::fullPath(), edm::EventSetup::get(), edm::ParameterSet::getParameter(), method_, nhit, pfTransformer_, pt, reader, resMapEtaECAL_, resMapPhiECAL_, thr, thrPS, and useTmva_.
00479 { 00480 //Magnetic Field 00481 ESHandle<MagneticField> magneticField; 00482 es.get<IdealMagneticFieldRecord>().get(magneticField); 00483 B_=magneticField->inTesla(GlobalPoint(0,0,0)); 00484 00485 pfTransformer_= new PFTrackTransformer(B_); 00486 00487 00488 00489 00490 //Resolution maps 00491 FileInPath ecalEtaMap(conf_.getParameter<string>("EtaMap")); 00492 FileInPath ecalPhiMap(conf_.getParameter<string>("PhiMap")); 00493 resMapEtaECAL_ = new PFResolutionMap("ECAL_eta",ecalEtaMap.fullPath().c_str()); 00494 resMapPhiECAL_ = new PFResolutionMap("ECAL_phi",ecalPhiMap.fullPath().c_str()); 00495 00496 if(useTmva_){ 00497 reader = new TMVA::Reader(); 00498 method_ = conf_.getParameter<string>("TMVAMethod"); 00499 00500 reader->AddVariable("eP",&eP); 00501 reader->AddVariable("chi",&chi); 00502 reader->AddVariable("chired",&chired); 00503 reader->AddVariable("chiRatio",&chiRatio); 00504 reader->AddVariable("dpt",&dpt); 00505 reader->AddVariable("nhit",&nhit); 00506 reader->AddVariable("eta",&eta); 00507 reader->AddVariable("pt",&pt); 00508 FileInPath Weigths(conf_.getParameter<string>("Weights")); 00509 reader->BookMVA( method_, Weigths.fullPath().c_str() ); 00510 } 00511 00512 00513 //read threshold 00514 FileInPath parFile(conf_.getParameter<string>("ThresholdFile")); 00515 ifstream ifs(parFile.fullPath().c_str()); 00516 for (int iy=0;iy<72;iy++) ifs >> thr[iy]; 00517 00518 //read PS threshold 00519 FileInPath parPSFile(conf_.getParameter<string>("PSThresholdFile")); 00520 ifstream ifsPS(parPSFile.fullPath().c_str()); 00521 for (int iy=0;iy<12;iy++) ifsPS >> thrPS[iy]; 00522 00523 }
int GoodSeedProducer::getBin | ( | float | pt | ) | [private] |
Definition at line 524 of file GoodSeedProducer.cc.
00524 { 00525 int ip=0; 00526 if (pt<6) ip=0; 00527 else { if (pt<12) ip=1; 00528 else ip=2; 00529 } 00530 return ip; 00531 }
int GoodSeedProducer::getBin | ( | float | eta, | |
float | pt | |||
) | [private] |
Find the bin in pt and eta.
Definition at line 532 of file GoodSeedProducer.cc.
References LogDebug.
Referenced by produce().
00532 { 00533 int ie=0; 00534 int ip=0; 00535 if (fabs(eta)<1.2) ie=0; 00536 else{ if (fabs(eta)<1.68) ie=1; 00537 else ie=2; 00538 } 00539 if (pt<6) ip=0; 00540 else { if (pt<12) ip=1; 00541 else ip=2; 00542 } 00543 int iep= ie*3+ip; 00544 LogDebug("GoodSeedProducer")<<"Track pt ="<<pt<<" eta="<<eta<<" bin="<<iep; 00545 return iep; 00546 }
bool GoodSeedProducer::IsIsolated | ( | float | charge, | |
float | P, | |||
math::XYZPointF | myElecTrkEcalPos, | |||
const reco::PFClusterCollection & | ecalColl, | |||
const reco::PFClusterCollection & | hcalColl | |||
) | [private] |
Definition at line 607 of file GoodSeedProducer.cc.
References funct::abs(), DeltaPhi(), deltaPhi(), deltaR(), EcalStripSumE_deltaPhiOverQ_maxValue_, EcalStripSumE_deltaPhiOverQ_minValue_, EcalStripSumE_minClusEnergy_, HcalIsolWindow_, maxHoverP_, and minEoverP_.
Referenced by produce().
00610 { 00611 00612 00613 double myHCALenergy3x3=0.; 00614 double myStripClusterE=0.; 00615 00616 00617 // reco::TrackRef myElecTrk; 00618 00619 if (fabs(myElecTrkEcalPos.z())<1. && myElecTrkEcalPos.x()<1. && myElecTrkEcalPos.y()<1. ) return false; 00620 00621 00622 00623 PFClusterCollection::const_iterator hc=hcalColl.begin(); 00624 PFClusterCollection::const_iterator hcend=hcalColl.end(); 00625 for (;hc!=hcend;++hc){ 00626 math::XYZPoint clusPos = hc->position(); 00627 double en = hc->energy(); 00628 double deltaR = ROOT::Math::VectorUtil::DeltaR(myElecTrkEcalPos,clusPos); 00629 if (deltaR<HcalIsolWindow_) { 00630 myHCALenergy3x3 += en; 00631 00632 } 00633 } 00634 00635 00636 00637 PFClusterCollection::const_iterator ec=ecalColl.begin(); 00638 PFClusterCollection::const_iterator ecend=ecalColl.end(); 00639 for (;ec!=ecend;++ec){ 00640 math::XYZPoint clusPos = ec->position(); 00641 double en = ec->energy(); 00642 00643 00644 double deltaPhi = ROOT::Math::VectorUtil::DeltaPhi(myElecTrkEcalPos,clusPos); 00645 double deltaEta = abs(myElecTrkEcalPos.eta()-clusPos.eta()); 00646 double deltaPhiOverQ = deltaPhi/charge; 00647 if (en >= EcalStripSumE_minClusEnergy_ && deltaEta<EcalStripSumE_deltaEta_ && deltaPhiOverQ > EcalStripSumE_deltaPhiOverQ_minValue_ && deltaPhiOverQ < EcalStripSumE_deltaPhiOverQ_maxValue_) { 00648 myStripClusterE += en; 00649 } 00650 } 00651 00652 double EoP=myStripClusterE/P; 00653 double HoP=myHCALenergy3x3/P; 00654 00655 00656 return ((EoP>minEoverP_)&&(EoP<2.5) && (HoP<maxHoverP_))?true:false; 00657 }
void GoodSeedProducer::produce | ( | edm::Event & | iEvent, | |
const edm::EventSetup & | iSetup | |||
) | [private, virtual] |
Implements edm::EDProducer.
Definition at line 133 of file GoodSeedProducer.cc.
References PFTrackTransformer::addPoints(), alongMomentum, applyIsolation_, B_, chi, chiRatio, chired, clone(), clusThreshold_, dpt, eP, eta, edm::EventID::event(), PFResolutionMap::FindBin(), fitter_, fitterName_, edm::EventSetup::get(), getBin(), edm::Event::getByLabel(), BaseParticlePropagator::getSuccess(), i, edm::Event::id(), int, IsIsolated(), Trajectory::lastMeasurement(), LogDebug, maxEp_, maxEta_, maxPt_, Trajectory::measurements(), method_, min, minEp_, minPt_, RawParticle::momentum(), nhit, nHitsInSeed_, p, pfCLusTagECLabel_, pfCLusTagHCLabel_, pfCLusTagPSLabel_, pfTransformer_, funct::pow(), preidckf_, preidgsf_, produceCkfPFT_, produceCkfseed_, edm::ESHandle< T >::product(), edm::Handle< T >::product(), BaseParticlePropagator::propagateToEcalEntrance(), ps1chi, ps1Clus, ps1En, ps2chi, ps2Clus, ps2En, PSforTMVA(), pt, Trajectory::push(), edm::OwnVector< T, P >::push_back(), edm::Event::put(), reader, TrajectoryMeasurement::recHit(), resMapEtaECAL_, resMapPhiECAL_, edm::EventID::run(), RawParticle::setCharge(), smoother_, smootherName_, funct::sqrt(), state, thr, thrPS, tmp, HLT_VtxMuL3::TrackCollection, trackQuality_, tracksContainers_, TwoPi, TrajectoryMeasurement::updatedState(), usePreshower_, useQuality_, useTmva_, TrackValidation_HighPurity_cff::valid, RawParticle::vertex(), x, y, and z.
00134 { 00135 00136 LogDebug("GoodSeedProducer")<<"START event: "<<iEvent.id().event() 00137 <<" in run "<<iEvent.id().run(); 00138 00139 //Create empty output collections 00140 auto_ptr<TrajectorySeedCollection> output_preid(new TrajectorySeedCollection); 00141 auto_ptr<TrajectorySeedCollection> output_nopre(new TrajectorySeedCollection); 00142 auto_ptr< PFRecTrackCollection > 00143 pOutputPFRecTrackCollection(new PFRecTrackCollection); 00144 00145 00146 //Tracking Tools 00147 iSetup.get<TrackingComponentsRecord>().get(fitterName_, fitter_); 00148 iSetup.get<TrackingComponentsRecord>().get(smootherName_, smoother_); 00149 00150 //Handle input collections 00151 //ECAL clusters 00152 Handle<PFClusterCollection> theECPfClustCollection; 00153 iEvent.getByLabel(pfCLusTagECLabel_,theECPfClustCollection); 00154 00155 vector<PFCluster> basClus; 00156 vector<PFCluster>::const_iterator iklus; 00157 for (iklus=theECPfClustCollection.product()->begin(); 00158 iklus!=theECPfClustCollection.product()->end(); 00159 iklus++){ 00160 if((*iklus).energy()>clusThreshold_) basClus.push_back(*iklus); 00161 } 00162 00163 //HCAL clusters 00164 Handle<PFClusterCollection> theHCPfClustCollection; 00165 iEvent.getByLabel(pfCLusTagHCLabel_,theHCPfClustCollection); 00166 00167 //PS clusters 00168 Handle<PFClusterCollection> thePSPfClustCollection; 00169 iEvent.getByLabel(pfCLusTagPSLabel_,thePSPfClustCollection); 00170 00171 ps1Clus.clear(); 00172 ps2Clus.clear(); 00173 00174 for (iklus=thePSPfClustCollection.product()->begin(); 00175 iklus!=thePSPfClustCollection.product()->end(); 00176 iklus++){ 00177 //layer==-11 first layer of PS 00178 //layer==-12 secon layer of PS 00179 if ((*iklus).layer()==-11) ps1Clus.push_back(*iklus); 00180 if ((*iklus).layer()==-12) ps2Clus.push_back(*iklus); 00181 } 00182 00183 //Vector of track collections 00184 for (uint istr=0; istr<tracksContainers_.size();istr++){ 00185 00186 //Track collection 00187 Handle<TrackCollection> tkRefCollection; 00188 iEvent.getByLabel(tracksContainers_[istr], tkRefCollection); 00189 TrackCollection Tk=*(tkRefCollection.product()); 00190 00191 //Trajectory collection 00192 Handle<vector<Trajectory> > tjCollection; 00193 iEvent.getByLabel(tracksContainers_[istr], tjCollection); 00194 vector<Trajectory> Tj=*(tjCollection.product()); 00195 00196 00197 LogDebug("GoodSeedProducer")<<"Number of tracks in collection " 00198 <<tracksContainers_[istr] <<" to be analyzed " 00199 <<Tj.size(); 00200 00201 00202 //loop over the track collection 00203 for(uint i=0;i<Tk.size();i++){ 00204 if (useQuality_ && 00205 (!(Tk[i].quality(trackQuality_)))) continue; 00206 int ipteta=getBin(Tk[i].eta(),Tk[i].pt()); 00207 int ibin=ipteta*8; 00208 TrackRef trackRef(tkRefCollection, i); 00209 TrajectorySeed Seed=Tj[i].seed(); 00210 00211 float PTOB=Tj[i].lastMeasurement().updatedState().globalMomentum().mag(); 00212 float chikfred=Tk[i].normalizedChi2(); 00213 int nhitpi=Tj[i].foundHits(); 00214 float EP=0; 00215 00216 00217 //CLUSTERS - TRACK matching 00218 00219 float pfmass= 0.0005; 00220 float pfoutenergy=sqrt((pfmass*pfmass)+Tk[i].outerMomentum().Mag2()); 00221 XYZTLorentzVector mom =XYZTLorentzVector(Tk[i].outerMomentum().x(), 00222 Tk[i].outerMomentum().y(), 00223 Tk[i].outerMomentum().z(), 00224 pfoutenergy); 00225 XYZTLorentzVector pos = XYZTLorentzVector(Tk[i].outerPosition().x(), 00226 Tk[i].outerPosition().y(), 00227 Tk[i].outerPosition().z(), 00228 0.); 00229 00230 BaseParticlePropagator theOutParticle = 00231 BaseParticlePropagator( RawParticle(mom,pos), 00232 0,0,B_.z()); 00233 theOutParticle.setCharge(Tk[i].charge()); 00234 00235 theOutParticle.propagateToEcalEntrance(false); 00236 00237 00238 float toteta=1000; 00239 float totphi=1000; 00240 float dr=1000; 00241 float EE=0; 00242 float feta=0; 00243 math::XYZPointF ElecTrkEcalPos(0,0,0); 00244 if(theOutParticle.getSuccess()!=0){ 00245 ElecTrkEcalPos=math::XYZPointF(theOutParticle.vertex().x(), 00246 theOutParticle.vertex().y(), 00247 theOutParticle.vertex().z()); 00248 bool isBelowPS=(fabs(theOutParticle.vertex().eta())>1.65) ? true :false; 00249 00250 for(vector<PFCluster>::const_iterator aClus = basClus.begin(); 00251 aClus != basClus.end(); aClus++) { 00252 double ecalShowerDepth 00253 = PFCluster::getDepthCorrection(aClus->energy(), 00254 isBelowPS, 00255 false); 00256 00257 math::XYZPoint meanShower=math::XYZPoint(theOutParticle.vertex())+ 00258 math::XYZTLorentzVector(theOutParticle.momentum()).Vect().Unit()*ecalShowerDepth; 00259 00260 float etarec=meanShower.eta(); 00261 float phirec=meanShower.phi(); 00262 float tmp_ep=aClus->energy()/PTOB; 00263 float tmp_phi=fabs(aClus->position().phi()-phirec); 00264 if (tmp_phi>TMath::TwoPi()) tmp_phi-= TMath::TwoPi(); 00265 float tmp_dr=sqrt(pow(tmp_phi,2)+ 00266 pow((aClus->position().eta()-etarec),2)); 00267 00268 if ((tmp_dr<dr)&&(tmp_ep>minEp_)&&(tmp_ep<maxEp_)){ 00269 dr=tmp_dr; 00270 toteta=aClus->position().eta()-etarec; 00271 totphi=tmp_phi; 00272 EP=tmp_ep; 00273 EE=aClus->energy(); 00274 feta= aClus->position().eta(); 00275 } 00276 } 00277 } 00278 00279 //Resolution maps 00280 double ecaletares 00281 = resMapEtaECAL_->GetBinContent(resMapEtaECAL_->FindBin(feta,EE)); 00282 double ecalphires 00283 = resMapPhiECAL_->GetBinContent(resMapPhiECAL_->FindBin(feta,EE)); 00284 00285 //geomatrical compatibility 00286 float chieta=(toteta!=1000)? toteta/ecaletares : toteta; 00287 float chiphi=(totphi!=1000)? totphi/ecalphires : totphi; 00288 float chichi= sqrt(chieta*chieta + chiphi*chiphi); 00289 00290 00291 //Matching criteria 00292 float chi2cut=thr[ibin+0]; 00293 float ep_cutmin=thr[ibin+1]; 00294 bool GoodMatching= ((chichi<chi2cut) &&(EP>ep_cutmin) && (nhitpi>10)); 00295 00296 if (Tk[i].pt()>maxPt_) GoodMatching=true; 00297 if (Tk[i].pt()<minPt_) GoodMatching=false; 00298 00299 //ENDCAP 00300 //USE OF PRESHOWER 00301 if ((fabs(Tk[i].eta())>1.68)&&(usePreshower_)){ 00302 int iptbin =4*getBin(Tk[i].pt()); 00303 ps2En=0;ps1En=0; 00304 ps2chi=100.; ps1chi=100.; 00305 PSforTMVA(mom,pos); 00306 float p1e=thrPS[iptbin]; 00307 float p2e=thrPS[iptbin+1]; 00308 float p1c=thrPS[iptbin+2]; 00309 float p2c=thrPS[iptbin+3]; 00310 bool GoodPSMatching= 00311 ((ps2En>p2e) 00312 &&(ps1En>p1e) 00313 &&(ps1chi<p1c) 00314 &&(ps2chi<p2c)); 00315 GoodMatching = (GoodMatching && GoodPSMatching); 00316 } 00317 00318 if(applyIsolation_){ 00319 if(IsIsolated(float(Tk[i].charge()),Tk[i].p(), 00320 ElecTrkEcalPos,*theECPfClustCollection,*theHCPfClustCollection)) 00321 GoodMatching=true; 00322 } 00323 bool GoodRange= ((fabs(Tk[i].eta())<maxEta_) && 00324 (Tk[i].pt()>minPt_)); 00325 //KF FILTERING FOR UNMATCHED EVENTS 00326 int hit1max=int(thr[ibin+2]); 00327 float chiredmin=thr[ibin+3]; 00328 bool GoodKFFiltering = 00329 ((chikfred>chiredmin) || (nhitpi<hit1max)); 00330 00331 bool GoodTkId= false; 00332 00333 if((!GoodMatching) &&(GoodKFFiltering) &&(GoodRange)){ 00334 chi=chichi; 00335 chired=1000; 00336 chiRatio=1000; 00337 dpt=0; 00338 nhit=nhitpi; 00339 00340 Trajectory::ConstRecHitContainer tmp; 00341 Trajectory::ConstRecHitContainer hits=Tj[i].recHits(); 00342 for (int ih=hits.size()-1; ih>=0; ih--) tmp.push_back(hits[ih]); 00343 vector<Trajectory> FitTjs=(fitter_.product())->fit(Seed,tmp,Tj[i].lastMeasurement().updatedState()); 00344 00345 if(FitTjs.size()>0){ 00346 if(FitTjs[0].isValid()){ 00347 vector<Trajectory> SmooTjs=(smoother_.product())->trajectories(FitTjs[0]); 00348 if(SmooTjs.size()>0){ 00349 if(SmooTjs[0].isValid()){ 00350 00351 //Track refitted with electron hypothesis 00352 00353 float pt_out=SmooTjs[0].firstMeasurement(). 00354 updatedState().globalMomentum().perp(); 00355 float pt_in=SmooTjs[0].lastMeasurement(). 00356 updatedState().globalMomentum().perp(); 00357 dpt=(pt_in>0) ? fabs(pt_out-pt_in)/pt_in : 0.; 00358 chiRatio=SmooTjs[0].chiSquared()/Tj[i].chiSquared(); 00359 chired=chiRatio*chikfred; 00360 } 00361 } 00362 } 00363 } 00364 00365 //TMVA Analysis 00366 if(useTmva_){ 00367 00368 00369 00370 eta=Tk[i].eta(); 00371 pt=Tk[i].pt(); 00372 eP=EP; 00373 00374 00375 00376 float Ytmva=reader->EvaluateMVA( method_ ); 00377 00378 float BDTcut=thr[ibin+4]; 00379 if ( Ytmva>BDTcut) GoodTkId=true; 00380 }else{ 00381 00382 00383 00384 // 00385 float chiratiocut=thr[ibin+5]; 00386 float gschicut=thr[ibin+6]; 00387 float gsptmin=thr[ibin+7]; 00388 00389 GoodTkId=((dpt>gsptmin)&&(chired<gschicut)&&(chiRatio<chiratiocut)); 00390 00391 } 00392 } 00393 00394 bool GoodPreId= (GoodTkId || GoodMatching); 00395 00396 00397 00398 if(GoodPreId) 00399 LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<< 00400 "GeV/c, eta= "<<Tk[i].eta() << 00401 ") preidentified for agreement between track and ECAL cluster"; 00402 if(GoodPreId &&(!GoodMatching)) 00403 LogDebug("GoodSeedProducer")<<"Track (pt= "<<Tk[i].pt()<< 00404 "GeV/c, eta= "<<Tk[i].eta() << 00405 ") preidentified only for track properties"; 00406 00407 00408 00409 if (GoodPreId){ 00410 00411 //NEW SEED with n hits 00412 int nHitsinSeed= min(nHitsInSeed_,Tj[i].foundHits()); 00413 00414 Trajectory seedTraj; 00415 OwnVector<TrackingRecHit> rhits; 00416 00417 vector<TrajectoryMeasurement> tm=Tj[i].measurements(); 00418 00419 for (int ihit=tm.size()-1; ihit>=int(tm.size()-nHitsinSeed);ihit-- ){ 00420 //for the first n measurement put the TM in the trajectory 00421 // and save the corresponding hit 00422 if ((*tm[ihit].recHit()).hit()->isValid()){ 00423 seedTraj.push(tm[ihit]); 00424 rhits.push_back((*tm[ihit].recHit()).hit()->clone()); 00425 } 00426 } 00427 00428 if(!seedTraj.measurements().empty()){ 00429 00430 PTrajectoryStateOnDet* state = TrajectoryStateTransform(). 00431 persistentState(seedTraj.lastMeasurement().updatedState(), 00432 (*seedTraj.lastMeasurement().recHit()).hit()->geographicalId().rawId()); 00433 TrajectorySeed NewSeed(*state,rhits,alongMomentum); 00434 00435 output_preid->push_back(NewSeed); 00436 delete state; 00437 } 00438 else output_preid->push_back(Seed); 00439 if(produceCkfPFT_){ 00440 00441 PFRecTrack pftrack( trackRef->charge(), 00442 PFRecTrack::KF_ELCAND, 00443 i, trackRef ); 00444 bool valid = pfTransformer_->addPoints( pftrack, *trackRef, Tj[i] ); 00445 if(valid) 00446 pOutputPFRecTrackCollection->push_back(pftrack); 00447 } 00448 }else{ 00449 if (produceCkfseed_){ 00450 output_nopre->push_back(Seed); 00451 } 00452 if(produceCkfPFT_){ 00453 00454 PFRecTrack pftrack( trackRef->charge(), 00455 PFRecTrack::KF, 00456 i, trackRef ); 00457 00458 bool valid = pfTransformer_->addPoints( pftrack, *trackRef, Tj[i] ); 00459 00460 if(valid) 00461 pOutputPFRecTrackCollection->push_back(pftrack); 00462 00463 } 00464 } 00465 } //end loop on track collection 00466 } //end loop on the vector of track collections 00467 if(produceCkfPFT_){ 00468 iEvent.put(pOutputPFRecTrackCollection); 00469 } 00470 00471 iEvent.put(output_preid,preidgsf_); 00472 if (produceCkfseed_) 00473 iEvent.put(output_nopre,preidckf_); 00474 00475 }
void GoodSeedProducer::PSforTMVA | ( | math::XYZTLorentzVector | mom, | |
math::XYZTLorentzVector | pos | |||
) | [private] |
Referenced by produce().
bool GoodSeedProducer::applyIsolation_ [private] |
ISOLATION REQUEST AS DONE IN THE TAU GROUP.
Definition at line 93 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
math::XYZVector GoodSeedProducer::B_ [private] |
B field.
Definition at line 152 of file GoodSeedProducer.h.
Referenced by beginJob(), and produce().
float GoodSeedProducer::chi [private] |
float GoodSeedProducer::chiRatio [private] |
float GoodSeedProducer::chired [private] |
double GoodSeedProducer::clusThreshold_ [private] |
Cut on the energy of the clusters.
Definition at line 104 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
edm::ParameterSet GoodSeedProducer::conf_ [private] |
float GoodSeedProducer::dpt [private] |
double GoodSeedProducer::EcalStripSumE_deltaEta_ [private] |
double GoodSeedProducer::EcalStripSumE_deltaPhiOverQ_maxValue_ [private] |
Definition at line 98 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
double GoodSeedProducer::EcalStripSumE_deltaPhiOverQ_minValue_ [private] |
Definition at line 97 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
double GoodSeedProducer::EcalStripSumE_minClusEnergy_ [private] |
Definition at line 95 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
float GoodSeedProducer::eP [private] |
VARIABLES NEEDED FOR TMVA.
Definition at line 143 of file GoodSeedProducer.h.
Referenced by beginJob(), and produce().
float GoodSeedProducer::eta [private] |
std::string GoodSeedProducer::fitterName_ [private] |
double GoodSeedProducer::HcalIsolWindow_ [private] |
Definition at line 94 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
double GoodSeedProducer::maxEp_ [private] |
double GoodSeedProducer::maxEta_ [private] |
double GoodSeedProducer::maxHoverP_ [private] |
Definition at line 100 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
double GoodSeedProducer::maxPt_ [private] |
std::string GoodSeedProducer::method_ [private] |
TMVA method.
Definition at line 149 of file GoodSeedProducer.h.
Referenced by beginJob(), and produce().
double GoodSeedProducer::minEoverP_ [private] |
Definition at line 99 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and IsIsolated().
double GoodSeedProducer::minEp_ [private] |
Min and MAx allowed values forEoverP.
Definition at line 107 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
double GoodSeedProducer::minPt_ [private] |
Minimum transverse momentum and maximum pseudorapidity.
Definition at line 88 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
float GoodSeedProducer::nhit [private] |
int GoodSeedProducer::nHitsInSeed_ [private] |
Number of hits in the seed;.
Definition at line 85 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
Definition at line 82 of file GoodSeedProducer.h.
Referenced by beginJob(), produce(), and ~GoodSeedProducer().
std::string GoodSeedProducer::preidckf_ [private] |
Name of the Seed(Ckf) Collection.
Definition at line 70 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
std::string GoodSeedProducer::preidgsf_ [private] |
Name of the Seed(Gsf) Collection.
Definition at line 73 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
bool GoodSeedProducer::produceCkfPFT_ [private] |
Produce the PFtracks for Ckf tracks?
Definition at line 114 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
bool GoodSeedProducer::produceCkfseed_ [private] |
Produce the Seed for Ckf tracks?
Definition at line 111 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
std::string GoodSeedProducer::propagatorName_ [private] |
Definition at line 130 of file GoodSeedProducer.h.
float GoodSeedProducer::ps1chi [private] |
std::vector<reco::PFCluster> GoodSeedProducer::ps1Clus [private] |
Vector of clusters of the PreShower.
Definition at line 66 of file GoodSeedProducer.h.
Referenced by produce().
float GoodSeedProducer::ps1En [private] |
float GoodSeedProducer::ps2chi [private] |
std::vector<reco::PFCluster> GoodSeedProducer::ps2Clus [private] |
float GoodSeedProducer::ps2En [private] |
float GoodSeedProducer::pt [private] |
TMVA::Reader* GoodSeedProducer::reader [private] |
READER FOR TMVA.
Definition at line 140 of file GoodSeedProducer.h.
Referenced by beginJob(), and produce().
PFResolutionMap * GoodSeedProducer::resMapEtaECAL_ = 0 [static, private] |
PFResolutionMap * GoodSeedProducer::resMapPhiECAL_ = 0 [static, private] |
std::string GoodSeedProducer::smootherName_ [private] |
float GoodSeedProducer::thr[150] [private] |
vector of thresholds for different bins of eta and pt
Definition at line 117 of file GoodSeedProducer.h.
Referenced by beginJob(), and produce().
float GoodSeedProducer::thrPS[20] [private] |
std::vector<edm::InputTag> GoodSeedProducer::tracksContainers_ [private] |
bool GoodSeedProducer::usePreshower_ [private] |
Use of Preshower clusters.
Definition at line 155 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
bool GoodSeedProducer::useQuality_ [private] |
TRACK QUALITY.
Definition at line 136 of file GoodSeedProducer.h.
Referenced by GoodSeedProducer(), and produce().
bool GoodSeedProducer::useTmva_ [private] |
USE OF TMVA.
Definition at line 146 of file GoodSeedProducer.h.
Referenced by beginJob(), GoodSeedProducer(), and produce().