111 consumes<reco::IsolatedPixelTrackCandidateCollection>(
edm::InputTag(
"IsoProd",
"HcalIsolatedTrackCollection"));
135 std::vector<edm::EDGetTokenT<EcalRecHitCollection> > ecalTokens_;
138 else if (ecalInReco) {
142 throw cms::Exception(
"MissingProduct",
"can not find EcalRecHits");
145 for (
const auto&
i : ecalTokens_) {
148 tmpEcalRecHitCollection->push_back(*
recHit);
155 bool pixelInAlca = isoPixelTracks.
isValid();
171 if (isoPixelTracks->empty())
175 bool noChargedTracks =
true;
197 double etaecal =
info.trkGlobPosAtEcal.eta();
198 double phiecal =
info.trkGlobPosAtEcal.phi();
202 for (
const auto& track1 :
tracks) {
203 if (&
track == &track1) {
210 if (etaecal1 == 0 && phiecal1 == 0)
213 double ecDist =
getDistInCM(etaecal, phiecal, etaecal1, phiecal1);
217 if (track1.p() > maxPNearby) {
218 maxPNearby = track1.p();
223 if (track1.p() > 5.) {
224 noChargedTracks =
false;
231 if (noChargedTracks) {
232 for (std::vector<EcalRecHit>::const_iterator ehit = tmpEcalRecHitCollection->begin();
233 ehit != tmpEcalRecHitCollection->end();
238 double phihit = posH.
phi();
239 double etahit = posH.
eta();
241 double dHitCM =
getDistInCM(etaecal, phiecal, etahit, phihit);
244 EnergyIn += ehit->energy();
246 if (dHitCM > 15.0 && dHitCM < 35.0) {
247 EnergyOut += ehit->energy();
254 track.numberOfValidHits(),
255 track.numberOfLostHits(),
257 track.normalizedChi2(),
290 static constexpr float EEBoundary = 1.479;
301 double theta1 = 2 * atan(
exp(-
eta1));
302 double theta2 = 2 * atan(
exp(-
eta2));
304 if (
cos(theta1) == 0)
307 cotantheta1 = 1 /
tan(theta1);
309 if (
cos(theta2) == 0)
312 cotantheta2 = 1 /
tan(theta2);
318 if (fabs(
eta1) < EEBoundary) {
332 desc.setComment(
"Generate tree for Tracker Alignment E/p validation");
static const std::string kSharedResource
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
container to hold data to be written into TTree
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
static void fillPSetDescription(edm::ParameterSetDescription &descriptions)
Geom::Phi< T > phi() const
void useDefaultPropagator()
use the default propagator
void analyze(const edm::Event &, const edm::EventSetup &) override
std::vector< EcalRecHit >::const_iterator const_iterator
~EopTreeWriter() override=default
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::EDGetTokenT< reco::IsolatedPixelTrackCandidateCollection > isoPixelTkToken_
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitTokenEBRecoToken_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Cos< T >::type cos(const T &t)
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
Tan< T >::type tan(const T &t)
TrackAssociatorParameters parameters_
#define DEFINE_FWK_MODULE(type)
edm::Service< TFileService > fs_
void fillVariables(Int_t charge, Int_t innerOk, Double_t outerRadius, Int_t numberOfValidHits, Int_t numberOfLostHits, Double_t chi2, Double_t normalizedChi2, Double_t p, Double_t pt, Double_t ptError, Double_t theta, Double_t eta, Double_t phi, Double_t emc1, Double_t emc3, Double_t emc5, Double_t hac1, Double_t hac3, Double_t hac5, Double_t maxPNearby, Double_t dist, Double_t EnergyIn, Double_t EnergyOut)
fill variables into tree
TrackDetectorAssociator trackAssociator_
static void fillDescriptions(edm::ConfigurationDescriptions &)
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitTokenAlCaToken_
edm::EDGetTokenT< reco::TrackCollection > theTrackCollectionToken_
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
double getDistInCM(double eta1, double phi1, double eta2, double phi2)
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDGetTokenT< EcalRecHitCollection > ecalRecHitTokenEERecoToken_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
T * make(const Args &...args) const
make new ROOT object
math::XYZPoint trkGlobPosAtEcal
Track position at different parts of the calorimeter.
EopVariables * treeMemPtr_
EopTreeWriter(const edm::ParameterSet &)