41 outputFileName_(cfg.getUntrackedParameter<std::
string>(
"histoutputFile")),
42 muons_(cfg.getParameter<edm::
InputTag>(
"muons")),
43 muonsRemake_(cfg.getParameter<edm::
InputTag>(
"muonsRemake")),
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");
99 event.getByLabel(
muons_, muons);
172 printf(
"Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
174 for (reco::TrackCollection::const_iterator
muon = muonTracks->begin();
muon != muonTracks->end();
175 muon++, iGmrRemake++) {
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;
276 for (reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon != trackColl->end();
muon++) {
277 int iTrack =
muon - trackColl->begin();
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;
323 endcap =
id.endcap();
324 station =
id.station();
326 chamber =
id.chamber();
329 printf(
"CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
338 station =
id.station();
340 superLayer =
id.superLayer();
342 sector =
id.sector();
344 printf(
"DT \t[station][layer][superlayer]:[%d][%d][%d]\n", station, layer, superLayer);
348 station =
id.station();
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;
427 for (reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon != trackColl->end();
muon++) {
428 int iTrack =
muon - trackColl->begin();
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)
568 detector = detid.
det();
572 std::cout <<
"OMFG NOT THE TRACKER\n" << std::endl;
584 <<
"\tlayer = " << layer <<
"\tladder = " << ladder <<
"\tmodule = " <<
module;
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;
646 storeMuon.
pt_[
val] = muon->pt();
647 storeMuon.
p_[
val] = muon->p();
648 storeMuon.
eta_[
val] = muon->eta();
649 storeMuon.
phi_[
val] = muon->phi();
653 storeMuon.
ndf_[
val] = muon->ndof();
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;
742 station =
id.station();
746 station =
id.station();
750 station =
id.station();
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);
929 str->
eta_[
i] = -9999;
931 str->
phi_[
i] = -9999;
934 str->
ndf_[
i] = -9999;
946 str->
gpX_[
i] = -9999;
947 str->
gpY_[
i] = -9999;
948 str->
gpZ_[
i] = -9999;
951 str->
lpX_[
i] = -9999;
952 str->
lpY_[
i] = -9999;
953 str->
lpZ_[
i] = -9999;
967 outputTree_ =
new TTree(
"outputTree",
"outputTree");
969 outputTree_->Branch(
"eventInfo",
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++) {
1188 printf(
"\t\tLocal\tx = %0.3f", (
float)track.
lpX_[i]);
1190 printf(
"\tz = %0.3f\n", (
float)track.
lpZ_[i]);
1198 for (
unsigned int i = 0;
i < (
unsigned int)hit.
n_;
i++) {
1208 printf(
"\t\tLocal\tx = %0.3f", (
float)hit.
lpX_[i]);
1217 std::cout <<
"Tracker Rec Hits Dump:\n";
1218 for (
unsigned int i = 0;
i < (
unsigned int)hit.
n_;
i++) {
1229 printf(
"\t\tLocal\tx = %0.3f", (
float)hit.
lpX_[i]);
1238 float pt = muon->pt();
1239 float p = muon->p();
1240 float eta = muon->eta();
1241 float phi = muon->phi();
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]
EventNumber_t event() const
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
int ring_[N_MAX_STORED_HIT]
void zero_muon(ResidualRefitting::storage_muon *str)
static const int N_MAX_STORED
unsigned int tibLayer(const DetId &id) const
int muonLink_[N_MAX_STORED_HIT]
int ReturnStation(DetId detid)
unsigned int tidRing(const DetId &id) const
void dumpTrackRef(reco::TrackRef muon, std::string str)
ResidualRefitting::storage_muon storageGmrNoTOBLayer1
uint16_t *__restrict__ id
void dumpMuonRecHits(const ResidualRefitting::storage_hit &hit)
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
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
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
LocalPoint localPosition() const
int ReturnSector(DetId detid)
ResidualRefitting::storage_muon storageGmrNoTIBLayer1
unsigned int tecRing(const DetId &id) const
ring id
ResidualRefitting::storage_trackHit storageTrackHit_
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
Geom::Phi< T > phi() const
int disk_[N_MAX_STORED_HIT]
unsigned int pxbLadder(const DetId &id) const
constexpr uint32_t rawId() const
get the raw id
void analyze(const edm::Event &, const edm::EventSetup &) override
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
GlobalPoint globalPosition() const
unsigned int tidWheel(const DetId &id) const
unsigned int pxbModule(const DetId &id) const
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
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_
void trkExtrap(const DetId &detid, int iTrkLink, int iTrk, int iRec, const FreeTrajectoryState &freeTrajState, const LocalPoint &recPoint, storage_trackExtrap &storeTemp)
ResidualRefitting::storage_muon storageGmrNoTOBLayer6
const Plane & surface() const
The nominal surface of the GeomDet.
int module_[N_MAX_STORED_HIT]
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_
bool getData(T &iHolder) const
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
ResidualRefitting::storage_muon storageGmrNoSt4_
edm::InputTag muonsNoStation2_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
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)
unsigned int tidSide(const DetId &id) 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
printf("params %d %f %f %f\n", minT, eps, errmax, chi2max)
edm::InputTag muonsNoStation1_
int subdetector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoSt2_
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
float gpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoSt3_
float gpY_[N_MAX_STORED_HIT]
float lpX_[N_MAX_STORED_HIT]
MuonServiceProxy * theService
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_
unsigned int tibModule(const DetId &id) const
unsigned int pxfModule(const DetId &id) const
unsigned int pxbLayer(const DetId &id) const
unsigned int tecModule(const DetId &id) const
edm::InputTag muonsNoStation3_
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > topoToken_
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
ResidualRefitting::storage_muon storageGmrNew_
float gpX_[N_MAX_STORED_HIT]
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
XYZPointD XYZPoint
point in space with cartesian internal representation
float gpPhi_[N_MAX_STORED_HIT]
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
T getParameter(std::string const &) const
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
int ring_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTID
const edm::ESGetToken< GlobalTrackingGeometry, GlobalTrackingGeometryRecord > trackingGeometryToken_
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
unsigned int tobModule(const DetId &id) const
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
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 pxfSide(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_
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
float chiSq_[N_MAX_STORED]
void StoreTrackerRecHits(DetId detid, const TrackerTopology *tTopo, int iTrack, int iRec)
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) 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]
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
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
unsigned int tobLayer(const DetId &id) const
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
constexpr Detector det() const
get the detector field from this detid
ResidualRefitting::storage_trackExtrap samExtrap120_