45 outputFileName_ ( cfg.getUntrackedParameter<std::string>(
"histoutputFile") ),
46 PropagatorSource_ ( cfg.getParameter<std::string>(
"propagator")),
47 muons_ ( cfg.getParameter<edm::InputTag>(
"muons" ) ),
48 muonsRemake_ ( cfg.getParameter<edm::InputTag>(
"muonsRemake" ) ),
49 muonsNoStation1_ ( cfg.getParameter<edm::InputTag>(
"muonsNoStation1") ),
50 muonsNoStation2_ ( cfg.getParameter<edm::InputTag>(
"muonsNoStation2") ),
51 muonsNoStation3_ ( cfg.getParameter<edm::InputTag>(
"muonsNoStation3") ),
52 muonsNoStation4_ ( cfg.getParameter<edm::InputTag>(
"muonsNoStation4") ),
70 debug_ ( cfg.getUntrackedParameter<bool>(
"doDebug" ) )
82 if(
debug_) printf(
"STARTING EVENT\n");
99 event.getByLabel(
muons_ , muons );
178 if (
debug_) printf(
"Data Dump:: Rebuilt GMR Muon Track With TeV refitter default\n");
180 for ( reco::TrackCollection::const_iterator
muon = muonTracks->begin();
muon!=muonTracks->end();
muon++, iGmrRemake++) {
193 if (
debug_) printf(
"muons Remake");
194 if (
debug_) printf(
"-----------------------------------------\n");
199 printf(
"muons No Station 1");
200 printf(
"-----------------------------------------\n");
205 printf(
"muons No Station 2");
206 printf(
"-----------------------------------------\n");
211 printf(
"muons No Station 3");
212 printf(
"-----------------------------------------\n");
217 printf(
"muons No Station 4");
218 printf(
"-----------------------------------------\n");
236 for (reco::MuonCollection::const_iterator
muon = muons->begin();
muon != muons->end();
muon++, iGmrCyl++) {
250 if (iGmrRemake > 0 || iGmrCyl > 0) {
252 std::cout <<
"FILLING NTUPLE!" << std::endl;
254 }
else std::cout<<
"no tracks -- no fill!\n"<<std::endl<<std::endl;
279 for ( reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon!=trackColl->end();
muon++) {
281 int iTrack =
muon - trackColl->begin();
289 int iRec = rec -
muon->recHitsBegin();
293 if (
debug_) printf(
"Rec Hit not from muon system or tracker... continuing...\n");
309 float gpRecX = gp.x();
310 float gpRecY = gp.y();
311 float gpRecZ = gp.z();
312 float gpRecEta = gp.eta();
313 float gpRecPhi = gp.phi();
323 int superLayer = -999;
328 endcap =
id.endcap();
329 station =
id.station();
331 chamber =
id.chamber();
333 if (
debug_)printf(
"CSC\t[endcap][station][ringN][chamber][layer]:[%d][%d][%d][%d][%d]\t",
334 endcap, station, ring, chamber, layer);
339 station =
id.station();
341 superLayer =
id.superLayer();
343 sector =
id.sector();
344 if (
debug_) printf(
"DT \t[station][layer][superlayer]:[%d][%d][%d]\n", station,layer,superLayer);
349 station =
id.station();
350 if (
debug_) printf(
"RPC\t[station]:[%d]\n", station);
378 if (
debug_) printf(
"Tracker\n");
392 else printf(
"THIS CAN NOT HAPPEN\n");
394 trkExtrap(detid, numTracks, iTrack, iRec, recoStart, lp, trackExtrap);
397 if (
debug_) printf(
"\tLocal Positon: \tx = %2.2f\ty = %2.2f\tz = %2.2f\n",lpX, lpY, lpZ);
398 if (
debug_) printf(
"\tGlobal Position: \tx = %6.2f\ty = %6.2f\tz = %6.2f\teta = %4.2f\tphi = %3.2f\n",
399 gpRecX,gpRecY,gpRecZ,gpRecEta,gpRecPhi);
408 trackExtrap .
n_ = numTracks;
425 for ( reco::TrackCollection::const_iterator
muon = trackColl->begin();
muon!=trackColl->end();
muon++) {
427 int iTrack =
muon - trackColl->begin();
439 bool unbiasedRec =
true;
448 if (!unbiasedRec)
continue;
456 trkExtrap(detid, numTracks, iTrackLink, recCounter, recoStart, (*rec1)->localPosition(), trackExtrap);
463 trackExtrap.
n_ = numTracks;
472 if (
debug_) printf(
"Matching a re-fitted track to the original track.\n");
478 bool foundMatch =
false;
479 for (reco::TrackCollection::const_iterator refIt = ref->begin(); refIt!=ref->end(); refIt++) {
481 int iTrackMatch = refIt - ref->begin();
482 if (foundMatch && TrackMatch !=iTrackMatch)
break;
488 TrackMatch = iTrackMatch;
494 printf(
"SOMETHING WENT WRONG! Could not match Track with original track!");
499 if (
debug_) printf(
"Rec hit match for original track %d\n", TrackMatch);
540 double lpx1 = (*hit1)->localPosition().x();
541 double lpy1 = (*hit1)->localPosition().y();
542 double lpz1 = (*hit1)->localPosition().z();
544 double lpx2 = (*hit2)->localPosition().x();
545 double lpy2 = (*hit2)->localPosition().y();
546 double lpz2 = (*hit2)->localPosition().z();
547 if ( fabs( lpx1 - lpx2) > 1
e-3)
return false;
549 if ( fabs( lpy1 - lpy2) > 1
e-3)
return false;
551 if ( fabs( lpz1 - lpz2) > 1
e-3)
return false;
565 int subdetector = -1;
578 detector = detid.
det();
582 std::cout<<
"OMFG NOT THE TRACKER\n"<<std::endl;
590 ladder =
id.ladder();
591 module =
id.module();
593 <<
"\tlayer = " << layer
594 <<
"\tladder = " << ladder
595 <<
"\tmodule = " <<
module;
604 module =
id.module();
606 <<
"\tside = " << side
607 <<
"\tdisk = " << disk
608 <<
"\tblade = " << blade
609 <<
"\tpanel = " << panel
610 <<
"\tmodule = " <<
module;
616 module =
id.module();
618 <<
"\tlayer = " << layer
619 <<
"\tmodule = "<<
module;
627 <<
"\tside = " << side
628 <<
"\twheel = " << wheel
629 <<
"\tring = " <<
ring;
635 module =
id.module();
637 <<
"\tlayer = " << layer
638 <<
"\tmodule = " <<
module;
644 module =
id.module();
646 <<
"\tring = " << ring
647 <<
"\tmodule = "<<
module;
674 storeMuon.
pt_ [val] = muon->pt();
675 storeMuon.
p_ [val] = muon->p();
676 storeMuon.
eta_[val] = muon->eta();
677 storeMuon.
phi_[val] = muon->phi();
678 storeMuon.
charge_[val] = muon->charge();
679 storeMuon.
numRecHits_[val] = muon->numberOfValidHits();
680 storeMuon.
chiSq_[val] = muon->chi2();
681 storeMuon.
ndf_[val] = muon->ndof();
695 if (dump_)
std::cout<<
"In the trkExtrap function"<<std::endl;
697 float gpExtrapX = -99999;
698 float gpExtrapY = -99999;
699 float gpExtrapZ = -99999;
700 float gpExtrapEta = -99999;
701 float gpExtrapPhi = -99999;
711 float recLpX = recPoint.
x();
712 float recLpY = recPoint.
y();
713 float recLpZ = recPoint.
z();
727 gpExtrapX = globTest.
x();
728 gpExtrapY = globTest.
y();
729 gpExtrapZ = globTest.
z();
730 gpExtrapEta = globTest.
eta();
731 gpExtrapPhi = globTest.
phi();
747 storeTemp.
gpX_ [iTrk] = gpExtrapX ;
748 storeTemp.
gpY_ [iTrk] = gpExtrapY ;
749 storeTemp.
gpZ_ [iTrk] = gpExtrapZ ;
750 storeTemp.
gpEta_ [iTrk] = gpExtrapEta;
751 storeTemp.
gpPhi_ [iTrk] = gpExtrapPhi;
752 storeTemp.
lpX_ [iTrk] = lpX ;
753 storeTemp.
lpY_ [iTrk] = lpY ;
754 storeTemp.
lpZ_ [iTrk] = lpZ ;
755 storeTemp.
resX_ [iTrk] = resX ;
756 storeTemp.
resY_ [iTrk] = resY ;
757 storeTemp.
resZ_ [iTrk] = resZ ;
772 int superLayer = -999;
781 endcap =
id.endcap();
782 station =
id.station();
784 chamber =
id.chamber();
790 station =
id.station();
792 superLayer =
id.superLayer();
794 sector =
id.sector();
799 station =
id.station();
816 int superLayer = -999;
825 endcap =
id.endcap();
826 station =
id.station();
828 chamber =
id.chamber();
834 station =
id.station();
836 superLayer =
id.superLayer();
838 sector =
id.sector();
843 station =
id.station();
869 double phiVal = -9999;
870 double etaVal = -9999;
874 xVal = recoPoint.
x();
875 yVal = recoPoint.
y();
876 zVal = recoPoint.
z();
877 phiVal = recoPoint.
phi();
878 etaVal = recoPoint.
eta();
881 storage.
gpX_ [recNum] = xVal;
882 storage.
gpY_ [recNum] = yVal;
883 storage.
gpZ_ [recNum] = zVal;
884 storage.
gpEta_ [recNum] = etaVal;
885 storage.
gpPhi_ [recNum] = phiVal;
887 float rhoVal =
sqrt( xVal*xVal + yVal*yVal);
889 printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
890 if (
debug_) printf(
"Cylinder: rho = %4.2f\tphi = %4.2f\teta = %4.2f\n", rhoVal, phiVal, etaVal);
902 if (
debug_) printf(
"zero_storage\n");
1007 str->
pt_ [
i] = -9999;
1008 str->
eta_ [
i] = -9999;
1009 str->
p_ [
i] = -9999;
1010 str->
phi_ [
i] = -9999;
1013 str->
ndf_ [
i] = -9999;
1028 str->
gpX_ [
i] = -9999;
1029 str->
gpY_ [
i] = -9999;
1030 str->
gpZ_ [
i] = -9999;
1033 str->
lpX_ [
i] = -9999;
1034 str->
lpY_ [
i] = -9999;
1035 str->
lpZ_ [
i] = -9999;
1051 outputTree_ =
new TTree(
"outputTree",
"outputTree");
1110 "muonLink_[1000]/I:"
1118 "superLayer_[1000]/I:"
1138 "muonLink_[1000]/I:"
1139 "detector_[1000]/I:"
1140 "subdetector_[1000]/I:"
1202 "numRecHits_[10]/I:"
1205 "chiSqOvrNdf_[10]/F"
1217 "muonLink_[1000]/I:"
1253 <<
"\tx = " << innerPos.X()
1254 <<
"\ty = " << innerPos.Y()
1255 <<
"\tz = " << innerPos.Z()
1258 GlobalPoint innerPoint( innerPos.X(), innerPos.Y(), innerPos.Z());
1259 GlobalVector innerVec ( innerMom.X(), innerMom.Y(), innerMom.Z());
1275 for (
unsigned int i = 0;
i < (
unsigned int)track.
n_;
i++) {
1279 printf (
"%d\tmuonLink= %d",
i, (
int)track.
muonLink_[
i]);
1280 printf (
"\trecLink = %d", (
int)track.
recLink_[i] );
1287 printf (
"\t\tLocal\tx = %0.3f" , (
float)track.
lpX_[i] );
1288 printf (
"\ty = %0.3f" , (
float)track.
lpY_[i] );
1289 printf (
"\tz = %0.3f\n" , (
float)track.
lpZ_[i] );
1299 for (
unsigned int i = 0;
i < (
unsigned int)hit.
n_;
i++) {
1303 printf (
"%d\tsubdetector = %d\t superLayer =%d" ,
i, (
int)hit.
system_[
i], (
int)hit.
superLayer_[i] );
1310 printf (
"\t\tLocal\tx = %0.3f" , (
float)hit.
lpX_[i] );
1311 printf (
"\ty = %0.3f" , (
float)hit.
lpY_[i] );
1312 printf (
"\tz = %0.3f\n" , (
float)hit.
lpZ_[i] );
1322 for (
unsigned int i = 0;
i < (
unsigned int)hit.
n_;
i++) {
1327 printf (
"\tlayer = %d" , (
int)hit.
layer_[i] );
1334 printf (
"\t\tLocal\tx = %0.3f" , (
float)hit.
lpX_[i] );
1335 printf (
"\ty = %0.3f" , (
float)hit.
lpY_[i] );
1336 printf (
"\tz = %0.3f\n" , (
float)hit.
lpZ_[i] );
1346 float pt = muon->pt();
1347 float p = muon->p ();
1348 float eta = muon->eta();
1349 float phi = muon->phi();
1350 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 update(const edm::EventSetup &setup)
update the services each event
ResidualRefitting::storage_muon storageGmrNoTIBLayer4
int layer_[N_MAX_STORED_HIT]
T getParameter(std::string const &) const
EventNumber_t event() const
ResidualRefitting::storage_muon storageTrkNoTOBLayer4
void zero_muon(ResidualRefitting::storage_muon *str)
float gpPhi_[N_MAX_STORED_HIT]
float chiSqOvrNdf_[N_MAX_STORED]
static const int N_MAX_STORED
int side_[N_MAX_STORED_HIT]
int ReturnStation(DetId detid)
void dumpTrackRef(reco::TrackRef muon, std::string str)
ResidualRefitting::storage_muon storageGmrNoTOBLayer1
ResidualRefitting::storage_trackExtrap storageTrackNoTEC
float gpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoPXBLayer1
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer1
ResidualRefitting::storage_muon storageGmrNoTID
ResidualRefitting::storage_muon storageTrkNoTOBLayer6
#define DEFINE_FWK_MODULE(type)
int disk_[N_MAX_STORED_HIT]
int superLayer_[N_MAX_STORED_HIT]
LocalPoint localPosition() const
int endcap_[N_MAX_STORED_HIT]
int ReturnSector(DetId detid)
int panel_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTIBLayer1
float lpX_[N_MAX_STORED_HIT]
int ring_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackHit storageTrackHit_
int layer_[N_MAX_STORED_HIT]
std::string PropagatorSource_
const MagneticField * theField
void zero_trackExtrap(ResidualRefitting::storage_trackExtrap *str)
int muonLink_[N_MAX_STORED_HIT]
Geom::Phi< T > phi() const
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt3_
ResidualRefitting::storage_muon storageTrkNoTOBLayer5
int blade_[N_MAX_STORED_HIT]
int detector_[N_MAX_STORED_HIT]
GlobalPoint globalPosition() const
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer2
static const int N_MAX_STORED_HIT
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer4
ResidualRefitting::storage_muon storageTrkNoTIBLayer2
ResidualRefitting::storage_muon storageGmrNoTOBLayer2
float lpZ_[N_MAX_STORED_HIT]
virtual void analyze(const edm::Event &, const edm::EventSetup &)
void NewTrackMeasurements(edm::Handle< reco::TrackCollection > trackCollOrig, edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
ResidualRefitting::storage_muon storageGmrNoSt1_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer6
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt1_
ResidualRefitting::storage_muon storageGmrNoTOBLayer6
int ring_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNew_
float gpZ_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer4
ResidualRefitting::storage_muon storageTrkNoTID
ResidualRefitting::storage_trackExtrap storageTrackExtrapTracker_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRec_
uint32_t rawId() const
get the raw id
ResidualRefitting::storage_muon storageGmrNoTOBLayer4
void dumpTrackHits(ResidualRefitting::storage_trackHit hit)
ResidualRefitting::storage_muon storageGmrNoSt4_
edm::InputTag muonsNoStation2_
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt4_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer2
float gpPhi_[N_MAX_STORED_HIT]
void branchMuon(ResidualRefitting::storage_muon &storageTmp, std::string branchName)
int chamber_[N_MAX_STORED_HIT]
int MatchTrackWithRecHits(reco::TrackCollection::const_iterator trackIt, edm::Handle< reco::TrackCollection > ref)
int charge_[N_MAX_STORED]
ResidualRefitting::storage_muon storageSamNoSt4_
int station_[N_MAX_STORED_HIT]
void muonInfo(ResidualRefitting::storage_muon &storeMuon, reco::TrackRef muon, int val)
ResidualRefitting::storage_trackExtrap storageTrackExtrapRecNoSt2_
int muonLink_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoPXBLayer2
float lpZ_[N_MAX_STORED_HIT]
edm::InputTag muonsNoStation1_
ResidualRefitting::storage_muon storageGmrNoSt2_
ResidualRefitting::storage_muon storageGmrNoSt3_
float gpEta_[N_MAX_STORED_HIT]
MuonServiceProxy * theService
ResidualRefitting::storage_muon storageGmrNoPXBLayer2
ResidualRefitting(const edm::ParameterSet &)
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef muon)
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) ...
ResidualRefitting::storage_muon storageGmrOld_
void dumpMuonRecHits(ResidualRefitting::storage_hit hit)
float lpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoPXF
ResidualRefitting::storage_muon storageGmrNoTEC
ResidualRefitting::storage_trackExtrap trackExtrap120_
float gpX_[N_MAX_STORED_HIT]
edm::InputTag muonsNoStation3_
ResidualRefitting::storage_muon storageGmrNoTIBLayer3
int module_[N_MAX_STORED_HIT]
void dumpTrackExtrap(ResidualRefitting::storage_trackExtrap track)
ResidualRefitting::storage_muon storageGmrNew_
float gpY_[N_MAX_STORED_HIT]
std::string outputFileName_
ResidualRefitting::storage_muon storageGmrNoTIBLayer2
float gpX_[N_MAX_STORED_HIT]
edm::InputTag muonsRemake_
void cylExtrapTrkSam(int recNum, reco::TrackRef track, ResidualRefitting::storage_trackExtrap &storage, double rho)
XYZVectorD XYZVector
spatial vector with cartesian internal representation
XYZPointD XYZPoint
point in space with cartesian internal representation
float gpZ_[N_MAX_STORED_HIT]
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
ResidualRefitting::storage_muon storageTrkNoTIBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTID
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, MediumProperties *mp=0)
void StoreTrackerRecHits(DetId detid, int iTrack, int iRec)
ResidualRefitting::storage_muon storageTrkNoTOBLayer2
bool IsSameHit(trackingRecHit_iterator hit1, trackingRecHit_iterator hit2)
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer5
edm::ESHandle< GlobalTrackingGeometry > trackingGeometry() const
get the tracking geometry
float lpY_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageSamNoSt2_
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer3
int subdetector_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNoTOBLayer1
ResidualRefitting::storage_muon storageGmrNoPXBLayer3
ResidualRefitting::storage_muon storageTrkNoTEC
ResidualRefitting::storage_muon storageSamNoSt3_
float chiSq_[N_MAX_STORED]
ResidualRefitting::storage_muon storageTrkNoPXBLayer1
void CollectTrackHits(edm::Handle< reco::TrackCollection > trackColl, ResidualRefitting::storage_trackExtrap &trackExtrap)
ResidualRefitting::storage_muon storageTrkNoTIBLayer1
ResidualRefitting::storage_muon storageGmrNoTOBLayer3
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer1
ResidualRefitting::storage_event eventInfo_
void trkExtrap(DetId detid, int iTrkLink, int iTrk, int iRec, FreeTrajectoryState freeTrajState, LocalPoint recPoint, storage_trackExtrap &storeTemp)
ResidualRefitting::storage_hit storageRecMuon_
ResidualRefitting::storage_muon storageTrkNoTOBLayer3
edm::ESHandle< Propagator > thePropagator
int ladder_[N_MAX_STORED_HIT]
int system_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageTrkNew_
ResidualRefitting::storage_trackExtrap storageTrackNoPXF
ResidualRefitting::storage_muon storageSamNoSt1_
Detector det() const
get the detector field from this detid
float lpX_[N_MAX_STORED_HIT]
ResidualRefitting::storage_muon storageGmrNoTOBLayer5
ResidualRefitting::storage_trackExtrap storageTrackNoTIBLayer3
int sector_[N_MAX_STORED_HIT]
static MuonRecHitPointer specificBuild(const GeomDet *geom, const TrackingRecHit *rh)
edm::InputTag muonsNoStation4_
int wheel_[N_MAX_STORED_HIT]
virtual const BoundPlane & surface() const
The nominal surface of the GeomDet.
float gpEta_[N_MAX_STORED_HIT]
int wheel_[N_MAX_STORED_HIT]
ResidualRefitting::storage_trackExtrap storageTrackNoTOBLayer1
void branchTrackExtrap(ResidualRefitting::storage_trackExtrap &storageTmp, std::string branchName)
ResidualRefitting::storage_muon storageGmrNoPXF
ResidualRefitting::storage_trackExtrap storageTrackNoPXBLayer2
ResidualRefitting::storage_muon storageTrkNoPXBLayer3
int numRecHits_[N_MAX_STORED]
ResidualRefitting::storage_muon storageTrkNoTIBLayer4
ResidualRefitting::storage_trackExtrap samExtrap120_