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")),
65 debug_(
cfg.getUntrackedParameter<
bool>(
"doDebug")),
68 outputBranch_(nullptr),
83 printf(
"STARTING EVENT\n");
172 printf(
"Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
175 muon++, iGmrRemake++) {
188 printf(
"muons Remake");
190 printf(
"-----------------------------------------\n");
194 printf(
"muons No Station 1");
195 printf(
"-----------------------------------------\n");
200 printf(
"muons No Station 2");
201 printf(
"-----------------------------------------\n");
206 printf(
"muons No Station 3");
207 printf(
"-----------------------------------------\n");
212 printf(
"muons No Station 4");
213 printf(
"-----------------------------------------\n");
228 for (reco::MuonCollection::const_iterator
muon =
muons->begin();
muon !=
muons->end();
muon++, iGmrCyl++) {
239 if (iGmrRemake > 0 || iGmrCyl > 0) {
241 std::cout <<
"FILLING NTUPLE!" << std::endl;
246 std::cout <<
"no tracks -- no fill!\n" << std::endl << std::endl;
285 for (
auto const& rec :
muon->recHits()) {
286 DetId detid = rec->geographicalId();
290 printf(
"Rec Hit not from muon system or tracker... continuing...\n");
305 float gpRecX =
gp.x();
306 float gpRecY =
gp.y();
307 float gpRecZ =
gp.z();
308 float gpRecEta =
gp.eta();
309 float gpRecPhi =
gp.phi();
318 int superLayer = -999;
329 printf(
"CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
340 superLayer =
id.superLayer();
342 sector =
id.sector();
344 printf(
"DT \t[station][layer][superlayer]:[%d][%d][%d]\n",
station,
layer, superLayer);
350 printf(
"RPC\t[station]:[%d]\n",
station);
390 printf(
"THIS CAN NOT HAPPEN\n");
392 trkExtrap(detid, numTracks, iTrack, iRec, recoStart, lp, trackExtrap);
396 printf(
"\tLocal Positon: \tx = %2.2f\ty = %2.2f\tz = %2.2f\n", lpX, lpY, lpZ);
398 printf(
"\tGlobal Position: \tx = %6.2f\ty = %6.2f\tz = %6.2f\teta = %4.2f\tphi = %3.2f\n",
411 trackExtrap.
n_ = numTracks;
436 for (
auto const& rec1 : ref->recHits()) {
437 bool unbiasedRec =
true;
439 for (
auto const& rec2 :
muon->recHits()) {
448 DetId detid = rec1->geographicalId();
453 trkExtrap(detid, numTracks, iTrackLink, recCounter, recoStart, rec1->localPosition(), trackExtrap);
458 trackExtrap.
n_ = numTracks;
466 printf(
"Matching a re-fitted track to the original track.\n");
470 for (
auto const& rec : trackIt->recHits()) {
471 bool foundMatch =
false;
472 for (reco::TrackCollection::const_iterator refIt = ref->begin(); refIt != ref->end(); refIt++) {
473 int iTrackMatch = refIt - ref->begin();
474 if (foundMatch && TrackMatch != iTrackMatch)
476 for (
auto const& recRef : refIt->recHits()) {
481 TrackMatch = iTrackMatch;
486 printf(
"SOMETHING WENT WRONG! Could not match Track with original track!");
491 printf(
"Rec hit match for original track %d\n", TrackMatch);
537 if (fabs(lpx1 - lpx2) > 1
e-3)
540 if (fabs(lpy1 - lpy2) > 1
e-3)
543 if (fabs(lpz1 - lpz2) > 1
e-3)
572 std::cout <<
"OMFG NOT THE TRACKER\n" << std::endl;
594 <<
"\tside = " << side <<
"\tdisk = " << disk <<
"\tblade = " << blade <<
"\tpanel = " << panel
595 <<
"\tmodule = " <<
module;
602 <<
"\tlayer = " <<
layer <<
"\tmodule = " <<
module;
609 <<
"\tside = " << side <<
"\twheel = " <<
wheel <<
"\tring = " <<
ring;
616 <<
"\tlayer = " <<
layer <<
"\tmodule = " <<
module;
623 <<
"\tring = " <<
ring <<
"\tmodule = " <<
module;
669 std::cout <<
"In the trkExtrap function" << std::endl;
671 float gpExtrapX = -99999;
672 float gpExtrapY = -99999;
673 float gpExtrapZ = -99999;
674 float gpExtrapEta = -99999;
675 float gpExtrapPhi = -99999;
685 float recLpX = recPoint.
x();
686 float recLpY = recPoint.
y();
687 float recLpZ = recPoint.
z();
700 gpExtrapX = globTest.
x();
701 gpExtrapY = globTest.
y();
702 gpExtrapZ = globTest.
z();
703 gpExtrapEta = globTest.
eta();
704 gpExtrapPhi = globTest.
phi();
718 storeTemp.
gpX_[iTrk] = gpExtrapX;
719 storeTemp.
gpY_[iTrk] = gpExtrapY;
720 storeTemp.
gpZ_[iTrk] = gpExtrapZ;
721 storeTemp.
gpEta_[iTrk] = gpExtrapEta;
722 storeTemp.
gpPhi_[iTrk] = gpExtrapPhi;
723 storeTemp.
lpX_[iTrk] = lpX;
724 storeTemp.
lpY_[iTrk] = lpY;
725 storeTemp.
lpZ_[iTrk] = lpZ;
726 storeTemp.
resX_[iTrk] = resX;
727 storeTemp.
resY_[iTrk] = resY;
728 storeTemp.
resZ_[iTrk] = resZ;
766 sector =
id.sector();
793 double phiVal = -9999;
794 double etaVal = -9999;
798 xVal = recoPoint.
x();
799 yVal = recoPoint.
y();
800 zVal = recoPoint.
z();
801 phiVal = recoPoint.
phi();
802 etaVal = recoPoint.
eta();
805 storage.
gpX_[recNum] = xVal;
806 storage.
gpY_[recNum] = yVal;
807 storage.
gpZ_[recNum] = zVal;
808 storage.
gpEta_[recNum] = etaVal;
809 storage.
gpPhi_[recNum] = phiVal;
811 float rhoVal =
sqrt(xVal * xVal + yVal * yVal);
813 printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
815 printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
826 printf(
"zero_storage\n");
929 str->eta_[
i] = -9999;
931 str->phi_[
i] = -9999;
932 str->numRecHits_[
i] = -9999;
933 str->chiSq_[
i] = -9999;
934 str->ndf_[
i] = -9999;
935 str->chiSqOvrNdf_[
i] = -9999;
944 str->muonLink_[
i] = -9999;
945 str->recLink_[
i] = -9999;
946 str->gpX_[
i] = -9999;
947 str->gpY_[
i] = -9999;
948 str->gpZ_[
i] = -9999;
949 str->gpEta_[
i] = -9999;
950 str->gpPhi_[
i] = -9999;
951 str->lpX_[
i] = -9999;
952 str->lpY_[
i] = -9999;
953 str->lpZ_[
i] = -9999;
954 str->resX_[
i] = -9999;
955 str->resY_[
i] = -9999;
956 str->resZ_[
i] = -9999;
967 outputTree_ =
new TTree(
"outputTree",
"outputTree");
1026 "muonLink_[1000]/I:" 1034 "superLayer_[1000]/I:" 1052 "muonLink_[1000]/I:" 1053 "detector_[1000]/I:" 1054 "subdetector_[1000]/I:" 1113 "numRecHits_[10]/I:" 1116 "chiSqOvrNdf_[10]/F" 1127 "muonLink_[1000]/I:" 1159 <<
"\tx = " << innerPos.X() <<
"\ty = " << innerPos.Y() <<
"\tz = " << innerPos.Z() << std::endl;
1161 GlobalPoint innerPoint(innerPos.X(), innerPos.Y(), innerPos.Z());
1162 GlobalVector innerVec(innerMom.X(), innerMom.Y(), innerMom.Z());
1176 std::cout <<
"\n\nExtrapolation Dump:\n";
1177 for (
unsigned int i = 0;
i < (
unsigned int)
track.n_;
i++) {
1180 printf(
"%d\tmuonLink= %d",
i, (
int)
track.muonLink_[
i]);
1181 printf(
"\trecLink = %d", (
int)
track.recLink_[
i]);
1188 printf(
"\t\tLocal\tx = %0.3f", (
float)
track.lpX_[
i]);
1189 printf(
"\ty = %0.3f", (
float)
track.lpY_[
i]);
1190 printf(
"\tz = %0.3f\n", (
float)
track.lpZ_[
i]);
1198 for (
unsigned int i = 0;
i < (
unsigned int)
hit.n_;
i++) {
1201 printf(
"%d\tsubdetector = %d\t superLayer =%d",
i, (
int)
hit.system_[
i], (
int)
hit.superLayer_[
i]);
1208 printf(
"\t\tLocal\tx = %0.3f", (
float)
hit.lpX_[
i]);
1209 printf(
"\ty = %0.3f", (
float)
hit.lpY_[
i]);
1210 printf(
"\tz = %0.3f\n", (
float)
hit.lpZ_[
i]);
1217 std::cout <<
"Tracker Rec Hits Dump:\n";
1218 for (
unsigned int i = 0;
i < (
unsigned int)
hit.n_;
i++) {
1221 printf(
"%d\tsubdetector = %d",
i, (
int)
hit.subdetector_[
i]);
1222 printf(
"\tlayer = %d", (
int)
hit.layer_[
i]);
1229 printf(
"\t\tLocal\tx = %0.3f", (
float)
hit.lpX_[
i]);
1230 printf(
"\ty = %0.3f", (
float)
hit.lpY_[
i]);
1231 printf(
"\tz = %0.3f\n", (
float)
hit.lpZ_[
i]);
1239 float p =
muon->p();
1242 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]
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
#define DEFINE_FWK_MODULE(type)
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]
void analyze(const edm::Event &, const edm::EventSetup &) override
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer2
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
void NewTrackMeasurements(edm::Handle< reco::TrackCollection > trackCollOrig, edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
ResidualRefitting::storage_muon storageGmrNoSt1_
int layer_[N_MAX_STORED_HIT]
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
constexpr Detector det() const
get the detector field from this detid
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]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
float gpEta_[N_MAX_STORED_HIT]
constexpr std::array< uint8_t, layerIndexSize > layer
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_
edm::InputTag muonsNoStation2_
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
edm::InputTag muonsNoStation1_
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
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
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_
edm::InputTag muonsNoStation3_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
unsigned int pxfPanel(const DetId &id) const
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]
edm::InputTag muonsRemake_
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
constexpr uint32_t rawId() const
get the raw id
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]
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]
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
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_
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)
edm::InputTag muonsNoStation4_
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
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
ResidualRefitting::storage_trackExtrap samExtrap120_