41 outputFileName_(
cfg.getUntrackedParameter<
std::
string>(
"histoutputFile")),
44 muonsNoStation1_(
cfg.getParameter<
edm::
InputTag>(
"muonsNoStation1")),
45 muonsNoStation2_(
cfg.getParameter<
edm::
InputTag>(
"muonsNoStation2")),
46 muonsNoStation3_(
cfg.getParameter<
edm::
InputTag>(
"muonsNoStation3")),
47 muonsNoStation4_(
cfg.getParameter<
edm::
InputTag>(
"muonsNoStation4")),
48 debug_(
cfg.getUntrackedParameter<
bool>(
"doDebug")),
57 outputBranch_(nullptr),
78 desc.addUntracked<
bool>(
"doDebug",
false);
79 descriptions.
add(
"residualRefitting",
desc);
84 printf(
"STARTING EVENT\n");
112 printf(
"Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
115 muon++, iGmrRemake++) {
128 printf(
"muons Remake");
130 printf(
"-----------------------------------------\n");
134 printf(
"muons No Station 1");
135 printf(
"-----------------------------------------\n");
140 printf(
"muons No Station 2");
141 printf(
"-----------------------------------------\n");
146 printf(
"muons No Station 3");
147 printf(
"-----------------------------------------\n");
152 printf(
"muons No Station 4");
153 printf(
"-----------------------------------------\n");
168 for (reco::MuonCollection::const_iterator
muon =
muons->begin();
muon !=
muons->end();
muon++, iGmrCyl++) {
179 if (iGmrRemake > 0 || iGmrCyl > 0) {
215 for (reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon != trackColl->end();
muon++) {
216 int iTrack =
muon - trackColl->begin();
224 for (
auto const& rec :
muon->recHits()) {
229 printf(
"Rec Hit not from muon system or tracker... continuing...\n");
244 float gpRecX =
gp.x();
245 float gpRecY =
gp.y();
246 float gpRecZ =
gp.z();
247 float gpRecEta =
gp.eta();
248 float gpRecPhi =
gp.phi();
251 int systemMuon =
detid.subdetId();
268 printf(
"CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
289 printf(
"RPC\t[station]:[%d]\n",
station);
329 printf(
"THIS CAN NOT HAPPEN\n");
331 trkExtrap(
detid, numTracks, iTrack, iRec, recoStart, lp, trackExtrap);
335 printf(
"\tLocal Positon: \tx = %2.2f\ty = %2.2f\tz = %2.2f\n", lpX, lpY, lpZ);
337 printf(
"\tGlobal Position: \tx = %6.2f\ty = %6.2f\tz = %6.2f\teta = %4.2f\tphi = %3.2f\n",
350 trackExtrap.
n_ = numTracks;
366 for (reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon != trackColl->end();
muon++) {
367 int iTrack =
muon - trackColl->begin();
375 for (
auto const& rec1 : ref->recHits()) {
376 bool unbiasedRec =
true;
378 for (
auto const& rec2 :
muon->recHits()) {
392 trkExtrap(
detid, numTracks, iTrackLink, recCounter, recoStart, rec1->localPosition(), trackExtrap);
397 trackExtrap.
n_ = numTracks;
405 printf(
"Matching a re-fitted track to the original track.\n");
409 for (
auto const& rec : trackIt->recHits()) {
410 bool foundMatch =
false;
411 for (reco::TrackCollection::const_iterator refIt = ref->begin(); refIt != ref->end(); refIt++) {
412 int iTrackMatch = refIt - ref->begin();
413 if (foundMatch && TrackMatch != iTrackMatch)
415 for (
auto const& recRef : refIt->recHits()) {
420 TrackMatch = iTrackMatch;
425 printf(
"SOMETHING WENT WRONG! Could not match Track with original track!");
430 printf(
"Rec hit match for original track %d\n", TrackMatch);
476 if (fabs(lpx1 - lpx2) > 1
e-3)
479 if (fabs(lpy1 - lpy2) > 1
e-3)
482 if (fabs(lpz1 - lpz2) > 1
e-3)
534 <<
"\tside = " <<
side <<
"\tdisk = " << disk <<
"\tblade = " << blade
535 <<
"\tpanel = " << panel <<
"\tmodule = " <<
module;
542 <<
"\tlayer = " <<
layer <<
"\tmodule = " <<
module;
549 <<
"\tside = " <<
side <<
"\twheel = " <<
wheel <<
"\tring = " <<
ring;
556 <<
"\tlayer = " <<
layer <<
"\tmodule = " <<
module;
563 <<
"\tring = " <<
ring <<
"\tmodule = " <<
module;
611 float gpExtrapX = -99999;
612 float gpExtrapY = -99999;
613 float gpExtrapZ = -99999;
614 float gpExtrapEta = -99999;
615 float gpExtrapPhi = -99999;
625 float recLpX = recPoint.
x();
626 float recLpY = recPoint.
y();
627 float recLpZ = recPoint.
z();
640 gpExtrapX = globTest.
x();
641 gpExtrapY = globTest.
y();
642 gpExtrapZ = globTest.
z();
643 gpExtrapEta = globTest.
eta();
644 gpExtrapPhi = globTest.
phi();
658 storeTemp.
gpX_[iTrk] = gpExtrapX;
659 storeTemp.
gpY_[iTrk] = gpExtrapY;
660 storeTemp.
gpZ_[iTrk] = gpExtrapZ;
661 storeTemp.
gpEta_[iTrk] = gpExtrapEta;
662 storeTemp.
gpPhi_[iTrk] = gpExtrapPhi;
663 storeTemp.
lpX_[iTrk] = lpX;
664 storeTemp.
lpY_[iTrk] = lpY;
665 storeTemp.
lpZ_[iTrk] = lpZ;
666 storeTemp.
resX_[iTrk] = resX;
667 storeTemp.
resY_[iTrk] = resY;
668 storeTemp.
resZ_[iTrk] = resZ;
679 int systemMuon =
detid.subdetId();
703 int systemMuon =
detid.subdetId();
733 double phiVal = -9999;
734 double etaVal = -9999;
738 xVal = recoPoint.
x();
739 yVal = recoPoint.
y();
740 zVal = recoPoint.
z();
741 phiVal = recoPoint.
phi();
742 etaVal = recoPoint.
eta();
745 storage.
gpX_[recNum] = xVal;
746 storage.
gpY_[recNum] = yVal;
747 storage.
gpZ_[recNum] = zVal;
748 storage.
gpEta_[recNum] = etaVal;
749 storage.
gpPhi_[recNum] = phiVal;
751 float rhoVal =
sqrt(xVal * xVal + yVal * yVal);
753 printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
755 printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
766 printf(
"zero_storage\n");
869 str->eta_[
i] = -9999;
871 str->phi_[
i] = -9999;
872 str->numRecHits_[
i] = -9999;
873 str->chiSq_[
i] = -9999;
874 str->ndf_[
i] = -9999;
875 str->chiSqOvrNdf_[
i] = -9999;
884 str->muonLink_[
i] = -9999;
885 str->recLink_[
i] = -9999;
886 str->gpX_[
i] = -9999;
887 str->gpY_[
i] = -9999;
888 str->gpZ_[
i] = -9999;
889 str->gpEta_[
i] = -9999;
890 str->gpPhi_[
i] = -9999;
891 str->lpX_[
i] = -9999;
892 str->lpY_[
i] = -9999;
893 str->lpZ_[
i] = -9999;
894 str->resX_[
i] = -9999;
895 str->resY_[
i] = -9999;
896 str->resZ_[
i] = -9999;
907 outputTree_ =
new TTree(
"outputTree",
"outputTree");
974 "superLayer_[1000]/I:" 994 "subdetector_[1000]/I:" 1053 "numRecHits_[10]/I:" 1056 "chiSqOvrNdf_[10]/F" 1067 "muonLink_[1000]/I:" 1100 <<
"\tx = " << innerPos.X() <<
"\ty = " << innerPos.Y() <<
"\tz = " << innerPos.Z();
1102 GlobalPoint innerPoint(innerPos.X(), innerPos.Y(), innerPos.Z());
1103 GlobalVector innerVec(innerMom.X(), innerMom.Y(), innerMom.Z());
1118 for (
unsigned int i = 0;
i < (
unsigned int)
track.n_;
i++) {
1121 printf(
"%d\tmuonLink= %d",
i, (
int)
track.muonLink_[
i]);
1122 printf(
"\trecLink = %d", (
int)
track.recLink_[
i]);
1129 printf(
"\t\tLocal\tx = %0.3f", (
float)
track.lpX_[
i]);
1130 printf(
"\ty = %0.3f", (
float)
track.lpY_[
i]);
1131 printf(
"\tz = %0.3f\n", (
float)
track.lpZ_[
i]);
1139 for (
unsigned int i = 0;
i < (
unsigned int)
hit.n_;
i++) {
1142 printf(
"%d\tsubdetector = %d\t superLayer =%d",
i, (
int)
hit.system_[
i], (
int)
hit.superLayer_[
i]);
1149 printf(
"\t\tLocal\tx = %0.3f", (
float)
hit.lpX_[
i]);
1150 printf(
"\ty = %0.3f", (
float)
hit.lpY_[
i]);
1151 printf(
"\tz = %0.3f\n", (
float)
hit.lpZ_[
i]);
1159 for (
unsigned int i = 0;
i < (
unsigned int)
hit.n_;
i++) {
1162 printf(
"%d\tsubdetector = %d",
i, (
int)
hit.subdetector_[
i]);
1163 printf(
"\tlayer = %d", (
int)
hit.layer_[
i]);
1170 printf(
"\t\tLocal\tx = %0.3f", (
float)
hit.lpX_[
i]);
1171 printf(
"\ty = %0.3f", (
float)
hit.lpY_[
i]);
1172 printf(
"\tz = %0.3f\n", (
float)
hit.lpZ_[
i]);
1180 float p =
muon->p();
1183 printf(
"\t%s: \tp = %4.2f \t pt = %4.2f \t eta = %4.2f \t phi = %4.2f\n",
str.c_str(),
p,
pt,
eta,
phi);
void CollectTrackHits(edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap, const edm::EventSetup &eventSetup)
int numRecHits_[N_MAX_STORED]
ResidualRefitting::storage_muon storageGmrNoTIBLayer4
int endcap_[N_MAX_STORED_HIT]
Log< level::Info, true > LogVerbatim
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
int ring_[N_MAX_STORED_HIT]
unsigned int tobLayer(const DetId &id) const
void zero_muon(ResidualRefitting::storage_muon *str)
unsigned int pxbLayer(const DetId &id) const
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
static const int N_MAX_STORED
int muonLink_[N_MAX_STORED_HIT]
int ReturnStation(DetId detid)
void dumpTrackRef(reco::TrackRef muon, std::string str)
ResidualRefitting::storage_muon storageGmrNoTOBLayer1
void dumpMuonRecHits(const ResidualRefitting::storage_hit &hit)
LocalPoint localPosition() const
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
unsigned int pxfBlade(const DetId &id) const
ResidualRefitting::storage_muon storageGmrNoPXBLayer1
float lpZ_[N_MAX_STORED_HIT]
bool IsSameHit(TrackingRecHit const &hit1, TrackingRecHit const &hit2)
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer1
int detector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer6
unsigned int tibModule(const DetId &id) const
unsigned int tidSide(const DetId &id) const
Geom::Phi< T > phi() const
int ReturnSector(DetId detid)
unsigned int pxfModule(const DetId &id) const
ResidualRefitting::storage_muon storageGmrNoTIBLayer1
ResidualRefitting::storage_trackHit storageTrackHit_
unsigned int tidWheel(const DetId &id) const
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
int disk_[N_MAX_STORED_HIT]
std::vector< Track > TrackCollection
collection of Tracks
void analyze(const edm::Event &, const edm::EventSetup &) override
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ALPAKA_FN_ACC int side(int ieta, int iphi)
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer2
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt4Token_
static const int N_MAX_STORED_HIT
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer4
int layer_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTIBLayer2
int sector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTOBLayer2
unsigned int pxbLadder(const DetId &id) const
ResidualRefitting::storage_muon storageGmrNoSt1_
int layer_[N_MAX_STORED_HIT]
muons
the two sets of parameters below are mutually exclusive, depending if RECO or ALCARECO is used the us...
int chamber_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer6
float lpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt1_
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
const GeomDet * idToDet(DetId) const override
void trkExtrap(const DetId &detid, int iTrkLink, int iTrk, int iRec, const FreeTrajectoryState &freeTrajState, const LocalPoint &recPoint, storage_trackExtrap &storeTemp)
ResidualRefitting::storage_muon storageGmrNoTOBLayer6
int module_[N_MAX_STORED_HIT]
unsigned int tecRing(const DetId &id) const
ring id
int muonLink_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNew_
int charge_[N_MAX_STORED]
std::vector< Muon > MuonCollection
collection of Muon objects
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
float gpEta_[N_MAX_STORED_HIT]
float gpPhi_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
float gpZ_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
unsigned int tecModule(const DetId &id) const
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer2
const edm::ESGetToken< Propagator, TrackingComponentsRecord > propagatorToken_
void branchMuon(ResidualRefitting::storage_muon &storageTmp, std::string branchName)
int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle< reco::TrackCollection > ref)
GlobalPoint globalPosition() const
float lpX_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNoSt4_
int wheel_[N_MAX_STORED_HIT]
void muonInfo(ResidualRefitting::storage_muon &storeMuon, reco::TrackRef muon, int val)
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt2_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
int subdetector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoSt2_
float gpY_[N_MAX_STORED_HIT]
unsigned int pxfDisk(const DetId &id) const
ResidualRefitting::storage_muon storageGmrNoSt3_
float gpY_[N_MAX_STORED_HIT]
float lpX_[N_MAX_STORED_HIT]
MuonServiceProxy * theService
#define DEFINE_FWK_MODULE(type)
ResidualRefitting::storage_muon storageGmrNoPXBLayer2
void dumpTrackExtrap(const ResidualRefitting::storage_trackExtrap &track)
ResidualRefitting(const edm::ParameterSet &)
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon)
~ResidualRefitting() override
ResidualRefitting::storage_muon storageGmrOld_
int side_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoPXF
ResidualRefitting::storage_muon storageGmrNoTEC
ResidualRefitting::storage_trackExtrap trackExtrap120_
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt1Token_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
unsigned int pxfPanel(const DetId &id) const
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt2Token_
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
ResidualRefitting::storage_muon storageGmrNew_
unsigned int pxfSide(const DetId &id) const
float gpX_[N_MAX_STORED_HIT]
const Plane & surface() const
The nominal surface of the GeomDet.
std::string outputFileName_
int panel_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTIBLayer2
int station_[N_MAX_STORED_HIT]
void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap &storage, double rho)
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=nullptr)
float lpY_[N_MAX_STORED_HIT]
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
float gpPhi_[N_MAX_STORED_HIT]
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
int ring_[N_MAX_STORED_HIT]
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ResidualRefitting::storage_trackExtrap storageTrackNoTID
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
ResidualRefitting::storage_muon storageSamNoSt2_
void dumpTrackHits(const ResidualRefitting::storage_trackHit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer3
int wheel_[N_MAX_STORED_HIT]
float lpZ_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTOBLayer1
float chiSqOvrNdf_[N_MAX_STORED]
ResidualRefitting::storage_muon storageGmrNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTEC
ResidualRefitting::storage_muon storageSamNoSt3_
ResidualRefitting::storage_muon storageTrkNoPXBLayer1
float gpZ_[N_MAX_STORED_HIT]
const edm::EDGetTokenT< reco::TrackCollection > muonsNoSt3Token_
ResidualRefitting::storage_muon storageTrkNoTIBLayer1
ResidualRefitting::storage_muon storageGmrNoTOBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer1
unsigned int tidRing(const DetId &id) const
int superLayer_[N_MAX_STORED_HIT]
ResidualRefitting::storage_event eventInfo_
ResidualRefitting::storage_hit storageRecMuon_
void update(const edm::EventSetup &setup, bool duringEvent=true)
update the services each event
int blade_[N_MAX_STORED_HIT]
const edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > magFieldToken_
unsigned int tibLayer(const DetId &id) const
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
unsigned int tobModule(const DetId &id) const
void NewTrackMeasurements(const edm::Handle< reco::TrackCollection > &trackCollOrig, const edm::Handle< reco::TrackCollection > &trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
float chiSq_[N_MAX_STORED]
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
unsigned int pxbModule(const DetId &id) const
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
float gpEta_[N_MAX_STORED_HIT]
virtual LocalPoint localPosition() const =0
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
int system_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer1
int ladder_[N_MAX_STORED_HIT]
float gpX_[N_MAX_STORED_HIT]
void branchTrackExtrap(ResidualRefitting::storage_trackExtrap &storageTmp, std::string branchName)
ResidualRefitting::storage_muon storageGmrNoPXF
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer2
const edm::EDGetTokenT< reco::TrackCollection > muonTracksToken_
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
const edm::EDGetTokenT< reco::MuonCollection > muonsToken_
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
ResidualRefitting::storage_trackExtrap samExtrap120_