10 #include "Math/VectorUtil.h"
11 using namespace ROOT::Math;
32 trackAssociator->useDefaultPropagator();
37 algoComponentUsed = 0;
42 etCaloOverTrackMin = iConfig.
getParameter<
double>(
"EtCaloOverTrackMin");
43 etCaloOverTrackMax = iConfig.
getParameter<
double>(
"EtCaloOverTrackMax");
44 etHcalOverTrackMin = iConfig.
getParameter<
double>(
"EtHcalOverTrackMin");
45 etHcalOverTrackMax = iConfig.
getParameter<
double>(
"EtHcalOverTrackMax");
47 signalCone = iConfig.
getParameter<
double>(
"SignalConeSize");
57 trackAssociatorParameters.loadParameters( pset );
65 return double(passed)/
all;
77 return algoComponentUsed;
87 transientTrackBuilder = builder.
product();
106 iEvent.
getByLabel( HORecHits_input, HORecHits );
121 return recalculateEnergy(caloJet,leadTk,associatedTracks);
129 algoComponentUsed = TCAlgoUndetermined;
134 if(leadTk.
isNull())
return p4;
137 int prongCounter = 0;
139 for(iTrack = associatedTracks.
begin(); iTrack!= associatedTracks.
end(); ++iTrack){
140 double DR = ROOT::Math::VectorUtil::DeltaR(leadTk->momentum(),(*iTrack)->momentum());
141 if(DR < signalCone) {
142 momentum+=(*iTrack)->momentum();
146 if(momentum.Rho() == 0)
return p4;
148 XYZVector ltrackEcalHitPoint = trackEcalHitPoint(*leadTk);
150 if(! (ltrackEcalHitPoint.Rho() > 0 && ltrackEcalHitPoint.Rho() < 9999) )
return p4;
152 std::pair<XYZVector,XYZVector> caloClusters = getClusterEnergy(caloJet,ltrackEcalHitPoint,signalCone);
153 XYZVector EcalCluster = caloClusters.first;
154 XYZVector HcalCluster = caloClusters.second;
156 double eCaloOverTrack = (EcalCluster.R()+HcalCluster.R()-momentum.R())/momentum.R();
158 std::pair<XYZVector,XYZVector> caloClustersPhoton = getClusterEnergy(caloJet,ltrackEcalHitPoint,ecalCone);
159 XYZVector EcalClusterPhoton = caloClustersPhoton.first;
163 if( eCaloOverTrack > etCaloOverTrackMin && eCaloOverTrack < etCaloOverTrackMax ) {
165 double eHcalOverTrack = (HcalCluster.R()-momentum.R())/momentum.R();
167 if ( eHcalOverTrack > etHcalOverTrackMin && eHcalOverTrack < etHcalOverTrackMax ) {
168 p4.SetXYZT(EcalCluster.X() + momentum.X(),
169 EcalCluster.Y() + momentum.Y(),
170 EcalCluster.Z() + momentum.Z(),
171 EcalCluster.R() + momentum.R());
173 algoComponentUsed = TCAlgoMomentumECAL;
175 p4.SetXYZT(momentum.X(),
179 algoComponentUsed = TCAlgoMomentum;
182 if( eCaloOverTrack > etCaloOverTrackMax ) {
183 double eHcalOverTrack = (HcalCluster.R()-momentum.R())/momentum.R();
185 if ( eHcalOverTrack > etHcalOverTrackMin && eHcalOverTrack < etHcalOverTrackMax ) {
186 p4.SetXYZT(EcalCluster.X() + momentum.X(),
187 EcalCluster.Y() + momentum.Y(),
188 EcalCluster.Z() + momentum.Z(),
189 EcalCluster.R() + momentum.R());
191 algoComponentUsed = TCAlgoMomentumECAL;
193 if ( eHcalOverTrack < etHcalOverTrackMin ) {
194 if(!dropCaloJets) p4.SetXYZT(caloJet.
px(),caloJet.
py(),caloJet.
pz(),caloJet.
energy());
195 else p4.SetXYZT(0,0,0,0);
196 algoComponentUsed = TCAlgoCaloJet;
198 if ( eHcalOverTrack > etHcalOverTrackMax ) {
199 algoComponentUsed = TCAlgoHadronicJet;
200 if(!dropRejected) p4.SetXYZT(caloJet.
px(),caloJet.
py(),caloJet.
pz(),caloJet.
energy());
201 else p4.SetXYZT(0,0,0,0);
204 if( eCaloOverTrack < etCaloOverTrackMin ) {
205 algoComponentUsed = TCAlgoTrackProblem;
206 if(!dropRejected) p4.SetXYZT(caloJet.
px(),caloJet.
py(),caloJet.
pz(),caloJet.
energy());
209 if(p4.Et() > 0) passed++;
220 double maxTowerEt = 0;
222 for(std::vector<CaloTowerPtr>::const_iterator iTower = towers.begin();
223 iTower!= towers.end(); ++iTower){
224 if((*iTower)->et() > maxTowerEt){
225 maxTowerEt = (*iTower)->et();
226 ecalHitPosition = (*iTower)->emPosition();
235 ecalHitPoint.SetXYZ(trackEcalHitPoint.
x(),
236 trackEcalHitPoint.
y(),
237 trackEcalHitPoint.
z());
259 for(std::vector<CaloTowerPtr>::const_iterator iTower = towers.begin();
260 iTower!= towers.end(); ++iTower){
261 std::vector<XYZVector> ECALCells;
262 std::vector<XYZVector> HCALCells;
264 size_t numRecHits = (**iTower).constituentsSize();
267 for(
size_t j = 0;
j < numRecHits;
j++) {
268 DetId recHitDetID = (**iTower).constituent(
j);
275 DetId id = theRecHit->detid();
277 double energy = theRecHit->energy();
278 ECALCells.push_back(getCellMomentum(this_cell,energy));
285 DetId id = theRecHit->detid();
287 double energy = theRecHit->energy();
288 ECALCells.push_back(getCellMomentum(this_cell,energy));
299 DetId id = theRecHit->detid();
301 double energy = theRecHit->energy();
302 HCALCells.push_back(getCellMomentum(this_cell,energy));
311 DetId id = theRecHit->detid();
313 double energy = theRecHit->energy();
314 HCALCells.push_back(getCellMomentum(this_cell,energy));
320 if(theRecHit != HORecHits->end()){
321 DetId id = theRecHit->detid();
323 double energy = theRecHit->energy();
324 HCALCells.push_back(getCellMomentum(this_cell,energy));
330 DetId id = theRecHit->detid();
332 double energy = theRecHit->energy();
333 HCALCells.push_back(getCellMomentum(this_cell,energy));
339 std::vector<XYZVector>::const_iterator
i;
340 for(i = ECALCells.begin(); i != ECALCells.end(); ++
i) {
341 double DR = ROOT::Math::VectorUtil::DeltaR(trackEcalHitPoint,*i);
342 if( DR < cone ) ecalCluster += *
i;
344 for(i = HCALCells.begin(); i != HCALCells.end(); ++
i) {
345 double DR = ROOT::Math::VectorUtil::DeltaR(trackEcalHitPoint,*i);
346 if( DR < cone ) hcalCluster += *
i;
349 return std::pair<XYZVector,XYZVector> (ecalCluster,hcalCluster);
357 double phi = hitPosition.
phi();
359 if(theta > 3.14159) theta = 2*3.14159 -
theta;
360 double px = energy *
sin(theta)*
cos(phi);
361 double py = energy *
sin(theta)*
sin(phi);
362 double pz = energy *
cos(theta);
virtual double energy() const GCC11_FINAL
energy
T getParameter(std::string const &) const
void eventSetup(const edm::Event &, const edm::EventSetup &)
T getUntrackedParameter(std::string const &, T const &) const
virtual reco::TrackRef leadTrack() const
Jets made from CaloTowers.
virtual const LorentzVector & p4() const GCC11_FINAL
four-momentum Lorentz vector
Sin< T >::type sin(const T &t)
Geom::Phi< T > phi() const
void inputConfig(const edm::ParameterSet &iConfig)
std::vector< EcalRecHit >::const_iterator const_iterator
Geom::Theta< T > theta() const
GlobalPoint globalPosition() const
const_iterator end() const
Termination of iteration.
virtual std::vector< CaloTowerPtr > getCaloConstituents() const
get all constituents
virtual double pz() const GCC11_FINAL
z coordinate of momentum vector
virtual double py() const GCC11_FINAL
y coordinate of momentum vector
const_iterator begin() const
Initialize an iterator over the RefVector.
math::XYZVector trackEcalHitPoint(const reco::TransientTrack &, const reco::CaloJet &)
Geom::Theta< T > theta() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::pair< math::XYZVector, math::XYZVector > getClusterEnergy(const reco::CaloJet &, math::XYZVector &, double)
bool isNull() const
Checks for null.
Cos< T >::type cos(const T &t)
math::XYZTLorentzVector recalculateEnergy(const reco::CaloTau &)
virtual double px() const GCC11_FINAL
x coordinate of momentum vector
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
math::XYZVector getCellMomentum(const CaloCellGeometry *, double &)
Transform3DPJ::Vector XYZVector
const CaloTauTagInfoRef & caloTauTagInfoRef() const
T const * product() const
ESHandle< TrackerGeometry > geometry
TrajectoryStateOnSurface stateOnSurface(const GlobalPoint &point) const
virtual void setP4(const LorentzVector &p4) GCC11_FINAL
set 4-momentum
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
T const * get() const
Returns C++ pointer to the item.
Detector det() const
get the detector field from this detid
const GlobalPoint & getPosition() const
Returns the position of reference for this cell.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")