60 CaloJetRef myCaloJet=(*myCaloTauTagInfoRef).calojetRef();
61 const std::vector<CaloTowerPtr> myCaloTowers=(*myCaloJet).getCaloConstituents();
62 JetBaseRef jetRef = myCaloTauTagInfoRef->jetRef();
63 CaloTau myCaloTau(std::numeric_limits<int>::quiet_NaN(),jetRef->p4());
72 double myCaloTau_refInnerPosition_x=0.;
73 double myCaloTau_refInnerPosition_y=0.;
74 double myCaloTau_refInnerPosition_z=0.;
76 myCaloTau.setleadTrack(myleadTk);
77 double myleadTkDZ=(*myleadTk).dz(myPV.
position());
81 GlobalVector myCaloJetdir((*myCaloJet).px(),(*myCaloJet).py(),(*myCaloJet).pz());
85 if((*myleadTk).innerOk()){
86 myCaloTau_refInnerPosition_x=(*myleadTk).innerPosition().
x();
87 myCaloTau_refInnerPosition_y=(*myleadTk).innerPosition().y();
88 myCaloTau_refInnerPosition_z=(*myleadTk).innerPosition().z();
93 if(mypropagleadTrackECALSurfContactPoint.R()!=0.){
94 double myleadTrackHCAL3x3hottesthitDEta=0.;
95 double myleadTrackHCAL3x3hottesthitEt=0.;
96 double myleadTrackHCAL3x3hitsEtSum=0.;
102 CaloTowerDetId mypropagleadTrack_closestCaloTowerId((*myCaloSubdetectorGeometry).getClosestCell(
GlobalPoint(mypropagleadTrackECALSurfContactPoint.x(),
103 mypropagleadTrackECALSurfContactPoint.y(),
104 mypropagleadTrackECALSurfContactPoint.z())));
105 std::vector<CaloTowerDetId> mypropagleadTrack_closestCaloTowerNeighbourIds=
getCaloTowerneighbourDetIds(myCaloSubdetectorGeometry, *caloTowerTopology, mypropagleadTrack_closestCaloTowerId);
106 for(std::vector<CaloTowerPtr>::const_iterator iCaloTower=myCaloTowers.begin();iCaloTower!=myCaloTowers.end();iCaloTower++){
108 bool CaloTower_inside3x3matrix=
false;
109 if (iCaloTowerId==mypropagleadTrack_closestCaloTowerId) CaloTower_inside3x3matrix=
true;
110 if (!CaloTower_inside3x3matrix){
111 for(std::vector<CaloTowerDetId>::const_iterator iCaloTowerDetId=mypropagleadTrack_closestCaloTowerNeighbourIds.begin();iCaloTowerDetId!=mypropagleadTrack_closestCaloTowerNeighbourIds.end();iCaloTowerDetId++){
112 if (iCaloTowerId==(*iCaloTowerDetId)){
113 CaloTower_inside3x3matrix=
true;
118 if (!CaloTower_inside3x3matrix)
continue;
119 myleadTrackHCAL3x3hitsEtSum+=(**iCaloTower).hadEt();
120 if((**iCaloTower).hadEt()>=myleadTrackHCAL3x3hottesthitEt ){
121 if ((**iCaloTower).hadEt()!=myleadTrackHCAL3x3hottesthitEt ||
122 ((**iCaloTower).hadEt()==myleadTrackHCAL3x3hottesthitEt && fabs((**iCaloTower).eta()-mypropagleadTrackECALSurfContactPoint.Eta())<myleadTrackHCAL3x3hottesthitDEta)) myleadTrackHCAL3x3hottesthitDEta = fabs((**iCaloTower).eta()-mypropagleadTrackECALSurfContactPoint.Eta());
123 myleadTrackHCAL3x3hottesthitEt=(**iCaloTower).hadEt();
126 myCaloTau.setleadTrackHCAL3x3hitsEtSum(myleadTrackHCAL3x3hitsEtSum);
127 if (myleadTrackHCAL3x3hottesthitEt!=0.) myCaloTau.setleadTrackHCAL3x3hottesthitDEta(myleadTrackHCAL3x3hottesthitDEta);
148 myCaloTau.setsignalTracks(mySignalTks);
152 if((
int)(mySignalTks.
size())!=0){
153 int mySignalTks_qsum=0;
155 mySignalTks_qsum+=mySignalTks[
i]->charge();
157 mySignalTksInvariantMass+=mychargedpicand_fromTk_LorentzVect;
159 myCaloTau.setCharge(mySignalTks_qsum);
161 myCaloTau.setsignalTracksInvariantMass(mySignalTksInvariantMass.mass());
167 myCaloTau.setisolationTracks(myIsolTks);
170 float myIsolTks_Ptsum=0.;
171 for(
int i=0;
i<(
int)myIsolTks.
size();
i++) myIsolTks_Ptsum+=myIsolTks[
i]->
pt();
172 myCaloTau.setisolationTracksPtSum(myIsolTks_Ptsum);
176 std::vector<std::pair<math::XYZPoint,float> > thePositionAndEnergyEcalRecHits;
189 math::XYZPoint myCaloJetdir((*myCaloJet).px(),(*myCaloJet).py(),(*myCaloJet).pz());
196 std::pair<math::XYZPoint,float> thePositionAndEnergyEcalRecHit(theRecHitCell_XYZPoint,theRecHit->energy());
197 thePositionAndEnergyEcalRecHits.push_back(thePositionAndEnergyEcalRecHit);
207 std::pair<math::XYZPoint,float> thePositionAndEnergyEcalRecHit(theRecHitCell_XYZPoint,theRecHit->energy());
208 thePositionAndEnergyEcalRecHits.push_back(thePositionAndEnergyEcalRecHit);
217 std::pair<math::XYZPoint,float> thePositionAndEnergyEcalRecHit(theRecHitCell_XYZPoint,theRecHit->energy());
218 thePositionAndEnergyEcalRecHits.push_back(thePositionAndEnergyEcalRecHit);
264 float myIsolEcalRecHits_EtSum=0.;
267 for(std::vector< std::pair<math::XYZPoint,float> >::const_iterator iEcalRecHit=myIsolPositionAndEnergyEcalRecHits.begin();iEcalRecHit!=myIsolPositionAndEnergyEcalRecHits.end();iEcalRecHit++){
268 myIsolEcalRecHits_EtSum+=(*iEcalRecHit).second*fabs(
sin((*iEcalRecHit).first.theta()));
270 myCaloTau.setisolationECALhitsEtSum(myIsolEcalRecHits_EtSum);
278 myTks_XYZTLorentzVect+=iChargedPionCand_XYZTLorentzVect;
279 alternatLorentzVect+=iChargedPionCand_XYZTLorentzVect;
281 myCaloTau.setTracksInvariantMass(myTks_XYZTLorentzVect.mass());
283 std::vector<BasicClusterRef> myneutralECALBasicClusters=(*myCaloTauTagInfoRef).neutralECALBasicClusters();
284 for(std::vector<BasicClusterRef>::const_iterator iBasicCluster=myneutralECALBasicClusters.begin();iBasicCluster!=myneutralECALBasicClusters.end();iBasicCluster++) {
286 double iGammaCand_px=(**iBasicCluster).energy()*
sin((**iBasicCluster).position().theta())*
cos((**iBasicCluster).position().phi());
287 double iGammaCand_py=(**iBasicCluster).energy()*
sin((**iBasicCluster).position().theta())*
sin((**iBasicCluster).position().phi());
288 double iGammaCand_pz=(**iBasicCluster).energy()*
cos((**iBasicCluster).position().theta());
289 math::XYZTLorentzVector iGammaCand_XYZTLorentzVect(iGammaCand_px,iGammaCand_py,iGammaCand_pz,(**iBasicCluster).energy());
290 alternatLorentzVect+=iGammaCand_XYZTLorentzVect;
292 myCaloTau.setalternatLorentzVect(alternatLorentzVect);
295 myCaloTau.setVertex(
math::XYZPoint(myCaloTau_refInnerPosition_x,myCaloTau_refInnerPosition_y,myCaloTau_refInnerPosition_z));
298 double mymaxEtHCALtower_Et=0.;
299 for(
unsigned int iTower=0;iTower<myCaloTowers.size();iTower++){
300 if((*myCaloTowers[iTower]).hadEt()>=mymaxEtHCALtower_Et) mymaxEtHCALtower_Et=(*myCaloTowers[iTower]).hadEt();
302 myCaloTau.setmaximumHCALhitEt(mymaxEtHCALtower_Et);
308 std::vector<CaloTowerDetId> myCaloTowerneighbourDetIds;
309 std::vector<DetId> northDetIds=myCaloTowerTopology.
north(myCaloTowerDetId);
310 std::vector<DetId> westDetIds=myCaloTowerTopology.
west(myCaloTowerDetId);
311 std::vector<DetId> northwestDetIds,southwestDetIds;
312 if (westDetIds.size()>0){
313 northwestDetIds=myCaloTowerTopology.
north(westDetIds[0]);
314 southwestDetIds=myCaloTowerTopology.
south(westDetIds[(
int)westDetIds.size()-1]);
316 std::vector<DetId> southDetIds=myCaloTowerTopology.
south(myCaloTowerDetId);
317 std::vector<DetId> eastDetIds=myCaloTowerTopology.
east(myCaloTowerDetId);
318 std::vector<DetId> northeastDetIds,southeastDetIds;
319 if (eastDetIds.size()>0){
320 northeastDetIds=myCaloTowerTopology.
north(eastDetIds[0]);
321 southeastDetIds=myCaloTowerTopology.
south(eastDetIds[(
int)eastDetIds.size()-1]);
323 std::vector<DetId> myneighbourDetIds=northDetIds;
324 myneighbourDetIds.insert(myneighbourDetIds.end(),westDetIds.begin(),westDetIds.end());
325 myneighbourDetIds.insert(myneighbourDetIds.end(),northwestDetIds.begin(),northwestDetIds.end());
326 myneighbourDetIds.insert(myneighbourDetIds.end(),southwestDetIds.begin(),southwestDetIds.end());
327 myneighbourDetIds.insert(myneighbourDetIds.end(),southDetIds.begin(),southDetIds.end());
328 myneighbourDetIds.insert(myneighbourDetIds.end(),eastDetIds.begin(),eastDetIds.end());
329 myneighbourDetIds.insert(myneighbourDetIds.end(),northeastDetIds.begin(),northeastDetIds.end());
330 myneighbourDetIds.insert(myneighbourDetIds.end(),southeastDetIds.begin(),southeastDetIds.end());
331 for(std::vector<DetId>::const_iterator iDetId=myneighbourDetIds.begin();iDetId!=myneighbourDetIds.end();iDetId++){
333 myCaloTowerneighbourDetIds.push_back(iCaloTowerId);
335 return myCaloTowerneighbourDetIds;
double computeConeSize(const TFormula &ConeSizeTFormula, double ConeSizeMin, double ConeSizeMax)
edm::InputTag ESRecHitsLabel_
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
bool isNonnull() const
Checks for non-null.
double TrackerIsolConeSize_min_
std::vector< DetId > north(const DetId &id) const override
std::vector< DetId > mySelectedDetId_
double TrackLeadTrack_maxDZ_
const reco::TrackRef leadTk(std::string matchingConeMetric, double matchingConeSize, double ptTrackMin) const
virtual const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
Sin< T >::type sin(const T &t)
edm::InputTag EERecHitsLabel_
std::vector< EcalRecHit >::const_iterator const_iterator
reco::TransientTrack build(const reco::Track *p) const
std::string TrackerSignalConeMetric_
double AreaMetric_recoElements_maxabsEta_
bool UseTrackLeadTrackDZconstraint_
double IsolationTrack_minPt_
edm::InputTag EBRecHitsLabel_
const_iterator end() const
Termination of iteration.
double MatchingConeSize_min_
double ECALSignalConeSize_max_
const Point & position() const
position
std::string ECALIsolConeSizeFormula_
const_iterator begin() const
Initialize an iterator over the RefVector.
virtual const CaloCellGeometry * getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
std::string ECALSignalConeMetric_
double MatchingConeSize_max_
std::string TrackerSignalConeSizeFormula_
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TFormula myTrackerIsolConeSizeTFormula
const reco::TrackRefVector tracksInCone(const math::XYZVector &coneAxis, const std::string coneMetric, const double coneSize, const double ptTrackMin) const
std::string ECALIsolConeMetric_
reco::CaloTau buildCaloTau(edm::Event &, const edm::EventSetup &, const reco::CaloTauTagInfoRef &, const reco::Vertex &)
std::string TrackerIsolConeMetric_
static const int SubdetId
Cos< T >::type cos(const T &t)
const MagneticField * MagneticField_
TFormula myTrackerSignalConeSizeTFormula
std::string TrackerIsolConeSizeFormula_
std::string ECALSignalConeSizeFormula_
std::vector< CaloTowerDetId > getCaloTowerneighbourDetIds(const CaloSubdetectorGeometry *, const CaloTowerTopology &, CaloTowerDetId)
double ECALIsolConeSize_max_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
const_iterator end() const
double ECALIsolConeSize_min_
double ECALSignalConeSize_min_
std::vector< DetId > east(const DetId &id) const override
void setMagneticField(const MagneticField *)
std::string MatchingConeSizeFormula_
TFormula myECALSignalConeSizeTFormula
XYZPointD XYZPoint
point in space with cartesian internal representation
double TrackerSignalConeSize_max_
TFormula myECALIsolConeSizeTFormula
TFormula myMatchingConeSizeTFormula
const double chargedpi_mass_
std::vector< std::pair< math::XYZPoint, float > > EcalRecHitsInAnnulus(const math::XYZVector &coneAxis, const std::string innerconeMetric, const double innerconeSize, const std::string outerconeMetric, const double outerconeSize, const double EcalRecHit_minEt, const std::vector< std::pair< math::XYZPoint, float > > &myEcalRecHits) const
unsigned int IsolationTrack_minHits_
void setcaloTauTagInfoRef(const CaloTauTagInfoRef)
std::vector< DetId > west(const DetId &id) const override
double TrackerIsolConeSize_max_
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
size_type size() const
Size of the RefVector.
std::string MatchingConeMetric_
double TrackerSignalConeSize_min_
std::vector< DetId > south(const DetId &id) const override
const reco::TrackRefVector tracksInAnnulus(const math::XYZVector &coneAxis, const std::string innerconeMetric, const double innerconeSize, const std::string outerconeMetric, const double outerconeSize, const double ptTrackMin) const
Power< A, B >::type pow(const A &a, const B &b)
const_iterator begin() const
const TransientTrackBuilder * TransientTrackBuilder_
void setTransientTrackBuilder(const TransientTrackBuilder *)