CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes
L1MuonRecoTreeProducer Class Reference
Inheritance diagram for L1MuonRecoTreeProducer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

TrajectoryStateOnSurface cylExtrapTrkSam (reco::TrackRef track, double rho)
 
void empty_global ()
 
void empty_hlt ()
 
void empty_standalone ()
 
void empty_tracker ()
 
 L1MuonRecoTreeProducer (const edm::ParameterSet &)
 
double match_trigger (std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon &mu)
 
TrajectoryStateOnSurface surfExtrapTrkSam (reco::TrackRef track, double z)
 
 ~L1MuonRecoTreeProducer ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Public Attributes

L1Analysis::L1AnalysisRecoMuonmuon
 
L1Analysis::L1AnalysisRecoMuonDataFormatmuonData
 
L1Analysis::L1AnalysisRecoRpcHitrpcHit
 
L1Analysis::L1AnalysisRecoRpcHitDataFormatrpcHitData
 

Private Types

enum  { GL_MUON = 0, SA_MUON = 1, TR_MUON = 2, TRSA_MUON = 3 }
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob (void)
 
virtual void beginRun (const edm::Run &, const edm::EventSetup &)
 
virtual void endJob ()
 
virtual void endRun (const edm::Run &, const edm::EventSetup &)
 
FreeTrajectoryState freeTrajStateMuon (reco::TrackRef track)
 

Private Attributes

edm::ESHandle< CSCGeometrycscGeom
 
edm::ESHandle< DTGeometrydtGeom
 
edm::Service< TFileServicefs_
 
HLTConfigProvider hltConfig_
 
std::vector< int > isoTriggerIndices_
 
std::vector< std::string > isoTriggerNames_
 
unsigned maxMuon_
 
unsigned maxRpcHit_
 
edm::InputTag muonTag_
 
edm::ESHandle< PropagatorpropagatorAlong
 
edm::ESHandle< PropagatorpropagatorOpposite
 
edm::ESHandle< RPCGeometryrpcGeom
 
edm::InputTag rpcHitTag_
 
bool runOnPostLS1_
 
edm::ESHandle< MagneticFieldtheBField
 
edm::ESHandle
< GlobalTrackingGeometry
theTrackingGeometry
 
TTree * tree_
 
std::vector< int > triggerIndices_
 
bool triggerMatching_
 
double triggerMaxDeltaR_
 
std::vector< std::string > triggerNames_
 
std::string triggerProcessLabel_
 
edm::InputTag triggerSummaryLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 106 of file L1MuonRecoTreeProducer.cc.

Member Enumeration Documentation

anonymous enum
private

Constructor & Destructor Documentation

L1MuonRecoTreeProducer::L1MuonRecoTreeProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 202 of file L1MuonRecoTreeProducer.cc.

References fs_, L1Analysis::L1AnalysisRecoRpcHit::getData(), edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), isoTriggerNames_, TFileService::make(), maxMuon_, maxRpcHit_, muon, muonData, muonTag_, rpcHit, rpcHitData, rpcHitTag_, runOnPostLS1_, AlCaHLTBitMon_QueryRunRegistry::string, tree_, triggerMatching_, triggerMaxDeltaR_, triggerNames_, triggerProcessLabel_, and triggerSummaryLabel_.

203 {
204 
205  maxMuon_ = iConfig.getParameter<unsigned int>("maxMuon");
206  maxRpcHit_ = iConfig.getParameter<unsigned int>("maxMuon");
207 
208  muonTag_ = iConfig.getParameter<edm::InputTag>("muonTag");
209  rpcHitTag_ = iConfig.getParameter<edm::InputTag>("rpcHitTag");
210 
211  runOnPostLS1_ = iConfig.getParameter<bool>("runOnPostLS1");
212 
214  muonData = muon->getData();
215 
218 
219  // set up output
220  tree_=fs_->make<TTree>("MuonRecoTree", "MuonRecoTree");
221  tree_->Branch("Muon", "L1Analysis::L1AnalysisRecoMuonDataFormat", &muonData, 32000, 3);
222  tree_->Branch("RpcHit", "L1Analysis::L1AnalysisRecoRpcHitDataFormat", &rpcHitData, 32000, 3);
223 
224  //---------------------------------------------------------------------------
225  // TRIGGER MATCHING
226  // member variables needed for matching, if using reco muons instead of PAT
227  //---------------------------------------------------------------------------
228  triggerMatching_ = iConfig.getUntrackedParameter<bool>("triggerMatching");
229  triggerSummaryLabel_ = iConfig.getParameter<edm::InputTag>("triggerSummaryLabel");
230  triggerProcessLabel_ = iConfig.getUntrackedParameter<std::string>("triggerProcessLabel");
231  triggerNames_ = iConfig.getParameter<std::vector<std::string> > ("triggerNames");
232  isoTriggerNames_ = iConfig.getParameter<std::vector<std::string> > ("isoTriggerNames");
233  triggerMaxDeltaR_ = iConfig.getParameter<double> ("triggerMaxDeltaR");
234 
235 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
L1Analysis::L1AnalysisRecoMuonDataFormat * muonData
edm::Service< TFileService > fs_
L1Analysis::L1AnalysisRecoRpcHitDataFormat * rpcHitData
std::vector< std::string > triggerNames_
std::vector< std::string > isoTriggerNames_
L1AnalysisRecoRpcHitDataFormat * getData()
L1Analysis::L1AnalysisRecoRpcHit * rpcHit
L1Analysis::L1AnalysisRecoMuon * muon
L1MuonRecoTreeProducer::~L1MuonRecoTreeProducer ( )

Definition at line 238 of file L1MuonRecoTreeProducer.cc.

239 {
240 
241 }

Member Function Documentation

void L1MuonRecoTreeProducer::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 426 of file L1MuonRecoTreeProducer.cc.

References SiPixelRawToDigiRegional_cfi::beamSpot, L1Analysis::L1AnalysisRecoRpcHitDataFormat::bx, L1Analysis::L1AnalysisRecoMuonDataFormat::calo_energy, L1Analysis::L1AnalysisRecoMuonDataFormat::calo_energy3x3, L1Analysis::L1AnalysisRecoMuonDataFormat::ch, L1Analysis::L1AnalysisRecoRpcHitDataFormat::clusterSize, MuonSubdetId::CSC, cscGeom, cylExtrapTrkSam(), DetId::det(), reco::MuonTime::direction(), dtGeom, L1Analysis::L1AnalysisRecoMuonDataFormat::ecal_terr, reco::MuonEnergy::ecal_time, L1Analysis::L1AnalysisRecoMuonDataFormat::ecal_time, reco::MuonEnergy::ecal_timeError, empty_global(), empty_hlt(), empty_standalone(), empty_tracker(), PV3DBase< T, PVType, FrameType >::eta(), L1Analysis::L1AnalysisRecoMuonDataFormat::eta, edm::EventSetup::get(), edm::Event::getByLabel(), GL_MUON, TrajectoryStateOnSurface::globalPosition(), L1Analysis::L1AnalysisRecoMuonDataFormat::hcal_terr, reco::MuonEnergy::hcal_time, L1Analysis::L1AnalysisRecoMuonDataFormat::hcal_time, reco::MuonEnergy::hcal_timeError, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_deltaR, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_isoDeltaR, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_isomu, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_mu, L1Analysis::L1AnalysisRecoMuonDataFormat::howmanytypes, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_z, reco::TransientTrack::impactPointTSCP(), isoTriggerIndices_, TrajectoryStateOnSurface::isValid(), edm::HandleBase::isValid(), TrajectoryStateClosestToPoint::isValid(), edm::InputTag::label(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::layer, RPCDetId::layer(), CSCSegment::localPosition(), dqm-mbProfile::log, PV3DBase< T, PVType, FrameType >::mag(), match_trigger(), maxMuon_, maxRpcHit_, DetId::Muon, muon, muonData, L1Analysis::L1AnalysisRecoRpcHitDataFormat::muonId, muonTag_, L1Analysis::L1AnalysisRecoMuonDataFormat::nMuons, L1Analysis::L1AnalysisRecoMuonDataFormat::normchi2, L1Analysis::L1AnalysisRecoRpcHitDataFormat::nRpcHits, NULL, L1Analysis::L1AnalysisRecoMuonDataFormat::numberOfMatchedStations, L1Analysis::L1AnalysisRecoMuonDataFormat::numberOfValidMuonHits, L1Analysis::L1AnalysisRecoMuonDataFormat::p, PV3DBase< T, PVType, FrameType >::perp2(), PV3DBase< T, PVType, FrameType >::phi(), L1Analysis::L1AnalysisRecoMuonDataFormat::phi, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_he_p, L1Analysis::L1AnalysisRecoRpcHitDataFormat::phiGlob, Pi, TrajectoryStateClosestToPoint::position(), propagatorAlong, propagatorOpposite, L1Analysis::L1AnalysisRecoMuonDataFormat::pt, L1Analysis::L1AnalysisRecoMuonDataFormat::r_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::r_he_p, DetId::rawId(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::region, RPCDetId::region(), HLT_25ns10e33_v2_cff::region, L1Analysis::L1AnalysisRecoRpcHit::Reset(), L1Analysis::L1AnalysisRecoMuon::Reset(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::ring, relativeConstraints::ring, RPCDetId::ring(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::roll, RPCDetId::roll(), MuonSubdetId::RPC, RPCDetId, rpcGeom, rpcHit, rpcHitData, rpcHitTag_, HLT_25ns10e33_v2_cff::rpcRecHits, findQualityFiles::rr, runOnPostLS1_, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_ch, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_z, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_z, SA_MUON, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_nChambers, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_nMatches, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_normchi2, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_z, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_mb2, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_pseta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_validhits, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_mb2, L1Analysis::L1AnalysisRecoRpcHitDataFormat::sector, RPCDetId::sector(), mathSSE::sqrt(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::station, relativeConstraints::station, RPCDetId::station(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::strip, DetId::subdetId(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::subsector, RPCDetId::subsector(), surfExtrapTrkSam(), funct::tan(), theBField, theTrackingGeometry, L1Analysis::L1AnalysisRecoMuonDataFormat::time_dir, L1Analysis::L1AnalysisRecoMuonDataFormat::time_inout, L1Analysis::L1AnalysisRecoMuonDataFormat::time_inout_err, L1Analysis::L1AnalysisRecoMuonDataFormat::time_outin, L1Analysis::L1AnalysisRecoMuonDataFormat::time_outin_err, reco::MuonTime::timeAtIpInOut, reco::MuonTime::timeAtIpInOutErr, reco::MuonTime::timeAtIpOutIn, reco::MuonTime::timeAtIpOutInErr, GeomDet::toGlobal(), reco::MuonEnergy::tower, reco::MuonEnergy::towerS9, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_ch, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_d0, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_z, TR_MUON, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_normchi2, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_mb2, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_validhits, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_validpixhits, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_z_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_z_mb2, tree_, triggerIndices_, triggerMatching_, triggerMaxDeltaR_, triggerProcessLabel_, triggerResults, triggerSummaryLabel_, TRSA_MUON, L1Analysis::L1AnalysisRecoMuonDataFormat::type, L1Analysis::L1AnalysisRecoMuonDataFormat::validhits, PV3DBase< T, PVType, FrameType >::x(), L1Analysis::L1AnalysisRecoRpcHitDataFormat::xLoc, PV3DBase< T, PVType, FrameType >::y(), PV3DBase< T, PVType, FrameType >::z(), and L1Analysis::L1AnalysisRecoMuonDataFormat::z_hb.

427 {
428 
429  float pig=TMath::Pi();
430 
431  muon->Reset();
432  rpcHit->Reset();
433 
434  //GP start
435  // Get the CSC Geometry
436  iSetup.get<MuonGeometryRecord>().get(cscGeom);
437  //GP end
438 
439  // Get the DT Geometry from the setup
440  iSetup.get<MuonGeometryRecord>().get(dtGeom);
441 
442  // Get the RPC Geometry from the setup
443  iSetup.get<MuonGeometryRecord>().get(rpcGeom);
444 
445  //Get the Magnetic field from the setup
446  iSetup.get<IdealMagneticFieldRecord>().get(theBField);
447 
448  // Get the GlobalTrackingGeometry from the setup
450 
452 
453  iEvent.getByLabel(rpcHitTag_,rpcRecHits);
454  if (!rpcRecHits.isValid()) {
455  edm::LogInfo("L1Prompt") << "can't find RPCRecHitCollection with label " << rpcHitTag_.label() ;
456  }
457  else {
458 
459  RPCRecHitCollection::const_iterator recHitIt = rpcRecHits->begin();
460  RPCRecHitCollection::const_iterator recHitEnd = rpcRecHits->end();
461 
462  int iRpcRecHits=0;
463 
464  for(; recHitIt != recHitEnd; ++recHitIt){
465 
466  if((unsigned int) iRpcRecHits>maxRpcHit_-1) continue;
467 
468  int cls = recHitIt->clusterSize();
469  int firststrip = recHitIt->firstClusterStrip();
470  int bx = recHitIt->BunchX();
471 
472  RPCDetId rpcId = recHitIt->rpcId();
473  int region = rpcId.region();
474  int stat = rpcId.station();
475  int sect = rpcId.sector();
476  int layer = rpcId.layer();
477  int subsector = rpcId.subsector();
478  int roll = rpcId.roll();
479  int ring = rpcId.ring();
480 
481  LocalPoint recHitPosLoc = recHitIt->localPosition();
482  const BoundPlane & RPCSurface = rpcGeom->roll(rpcId)->surface();
483  GlobalPoint recHitPosGlob = RPCSurface.toGlobal(recHitPosLoc);
484 
485  float xLoc = recHitPosLoc.x();
486  float phiGlob = recHitPosGlob.phi();
487 
488  rpcHitData->region.push_back(region);
489  rpcHitData->clusterSize.push_back(cls);
490  rpcHitData->strip.push_back(firststrip);
491  rpcHitData->bx.push_back(bx);
492  rpcHitData->xLoc.push_back(xLoc);
493  rpcHitData->phiGlob.push_back(phiGlob);
494  rpcHitData->station.push_back(stat);
495  rpcHitData->sector.push_back(sect);
496  rpcHitData->layer.push_back(layer);
497  rpcHitData->subsector.push_back(subsector);
498  rpcHitData->roll.push_back(roll);
499  rpcHitData->ring.push_back(ring);
500  rpcHitData->muonId.push_back(-999); // CB set to invalid now, updated when looking at muon info
501 
502  iRpcRecHits++;
503 
504  }
505 
506  rpcHitData->nRpcHits = iRpcRecHits;
507 
508  }
509 
510  // Get the muon candidates
512  iEvent.getByLabel(muonTag_,mucand);
513  if (!mucand.isValid()) {
514  edm::LogInfo("L1Prompt") << "can't find Muon Collection with label " << muonTag_.label() ;
515  return;
516  }
517 
518  // Get the beamspot
520  iEvent.getByLabel("offlineBeamSpot", beamSpot);
521 
522  // Get the primary vertices
524  iEvent.getByLabel(edm::InputTag("offlinePrimaryVertices"), vertex);
525 
526  // Get the propagators
527  iSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAny", propagatorAlong );
528  iSetup.get<TrackingComponentsRecord>().get("SmartPropagatorAnyOpposite", propagatorOpposite);
529 
530  for(reco::MuonCollection::const_iterator imu = mucand->begin();
531  // for(pat::MuonCollection::const_iterator imu = mucand->begin();
532  imu != mucand->end() && (unsigned) muonData->nMuons < maxMuon_; imu++) {
533 
534  int type=0;
535  if (imu->isGlobalMuon()) type=type+1;
536  if (imu->isStandAloneMuon()) type=type+2;
537  if (imu->isTrackerMuon()) type=type+4;
538  if (imu->isCaloMuon()) type=type+8;
539 
540  bool isTIGHT = (vertex->size() > 0 &&
541  imu->isGlobalMuon() && imu->globalTrack()->normalizedChi2() < 10. &&
542  imu->globalTrack()->hitPattern().numberOfValidMuonHits() > 0 &&
543  imu->numberOfMatchedStations() > 1 &&
544  fabs(imu->innerTrack()->dxy(vertex->at(0).position())) < 0.2 &&
545  fabs(imu->innerTrack()->dz(vertex->at(0).position())) < 0.5 &&
546  imu->innerTrack()->hitPattern().numberOfValidPixelHits() > 0 &&
547  imu->innerTrack()->hitPattern().trackerLayersWithMeasurement() > 5);
548 
549  if (isTIGHT) type=type+16;
550  if (imu->isPFMuon()) type=type+32;
551 
552  muonData->howmanytypes.push_back(type); // muon type is counting calo muons and multiple assignments
553 
554  // bool type identifiers are exclusive. is this correct? CB to check
555  bool isSA = (!imu->isGlobalMuon() && imu->isStandAloneMuon() && !imu->isTrackerMuon());
556  bool isTR = (!imu->isGlobalMuon() && imu->isTrackerMuon() && !imu->isStandAloneMuon());
557  bool isGL = (imu->isGlobalMuon());//&&!(imu->isStandAloneMuon())&&!(imu->isTrackerMuon()));
558  bool isTRSA = (!imu->isGlobalMuon() && imu->isStandAloneMuon()&&imu->isTrackerMuon());
559 
560 
561  // How we fill this. We have 3 blocks of variables: muons_; muons_sa_; muons_tr_
562  // GL SA TR Description muon_type Bool id Filled Vars Variables to -99999
563  // 0 0 0 Muon does not exist / / / /
564  // 0 0 1 It is a Tracker muon TR_MUON isTR muons_tr_ muons_sa_,muons_
565  // 0 1 0 It is a SA muon SA_MUON isSA muons_sa muons_tr,muons_
566  // 0 1 1 It is a SA+Tracker muon TRSA_MUON isTRSA muons_sa,muons_tr muons_
567  // 1 0 0 It is a Global only muon GL_MUON isGL muons_,muons_sa,muons_tr /
568  // 1 0 1 Gl w/out SA cannot exist / / / /
569  // 1 1 0 Gl+SA (no trk-mu match) GL_MUON isGL muons_,muons_sa,muons_tr none
570  // 1 1 1 GL+SA+Tr (all matched) GL_MUON isGL muons_,muons_sa,muons_tr none
571 
572 
573  //---------------------------------------------------------------------
574  // TRIGGER MATCHING:
575  // if specified the reconstructed muons are matched to a trigger
576  //---------------------------------------------------------------------
577  if (triggerMatching_) {
578  double isoMatchDeltaR = 9999.;
579  double matchDeltaR = 9999.;
580  int hasIsoTriggered = 0;
581  int hasTriggered = 0;
582 
583  // first check if the trigger results are valid:
585  iEvent.getByLabel(edm::InputTag("TriggerResults", "", triggerProcessLabel_), triggerResults);
586 
587  if (triggerResults.isValid()) {
589  iEvent.getByLabel(triggerSummaryLabel_, triggerEvent);
590  if (triggerEvent.isValid()) {
591  // get trigger objects:
592  const trigger::TriggerObjectCollection triggerObjects = triggerEvent->getObjects();
593 
594  matchDeltaR = match_trigger(triggerIndices_, triggerObjects, triggerEvent, (*imu));
595  if (matchDeltaR < triggerMaxDeltaR_)
596  hasTriggered = 1;
597 
598  isoMatchDeltaR = match_trigger(isoTriggerIndices_, triggerObjects, triggerEvent, (*imu));
599  if (isoMatchDeltaR < triggerMaxDeltaR_)
600  hasIsoTriggered = 1;
601  } // end if (triggerEvent.isValid())
602  } // end if (triggerResults.isValid())
603 
604  // fill trigger matching variables:
605  muonData->hlt_isomu.push_back(hasIsoTriggered);
606  muonData->hlt_mu.push_back(hasTriggered);
607  muonData->hlt_isoDeltaR.push_back(isoMatchDeltaR);
608  muonData->hlt_deltaR.push_back(matchDeltaR);
609  } else {
610  empty_hlt();
611  } // end if (triggerMatching_)
612 
613  if (isGL || isTR || isSA || isTRSA){
614  muonData->nMuons = muonData->nMuons + 1;
615  if (isTR) muonData->type.push_back(TR_MUON);
616  if (isGL) muonData->type.push_back(GL_MUON);
617  if (isSA) muonData->type.push_back(SA_MUON);
618  if (isTRSA) muonData->type.push_back(TRSA_MUON);
619  if (!isGL) empty_global();
620  if (!isTR && !isGL && !isTRSA) empty_tracker();
621  if (!isSA && !isGL && !isTRSA) empty_standalone();
622 
623  // begin GP
624  //---------------------------------------------------------------------
625  // RECHIT information in CSC: only for standalone/global muons!
626  //---------------------------------------------------------------------
627  // An artificial rank to sort RecHits
628  // the closer RecHit to key station/layer -> the smaller the rank
629  // KK's original idea
630  const int lutCSC[4][6] = { {26,24,22,21,23,25} ,
631  { 6, 4, 2, 1, 3, 5} ,
632  {16,14,12,11,13,15} ,
633  {36,34,32,31,33,35} };
634 
635  int globalTypeRCH = -999999;
636  // float localEtaRCH = -999999;
637  // float localPhiRCH = -999999;
638  float globalEtaRCH = -999999;
639  float globalPhiRCH = -999999;
640 
641  if(isSA || isGL){
642 
643  trackingRecHit_iterator hit = imu->outerTrack()->recHitsBegin();
644  trackingRecHit_iterator hitEnd = imu->outerTrack()->recHitsEnd();
645 
646  for(; hit != hitEnd; ++hit) {
647 
648  if ( !((*hit)->isValid()) ) continue;
649 
650  // Hardware ID of the RecHit (in terms of wire/strips/chambers)
651  DetId detid = (*hit)->geographicalId();
652 
653  // Interested in muon systems only
654  // Look only at CSC Hits (CSC id is 2)
655  if ( detid.det() != DetId::Muon ) continue;
656  if (detid.subdetId() != MuonSubdetId::CSC) continue;
657 
658  CSCDetId id(detid.rawId());
659  //std::cout << "before Lut id.station = " <<id.station()
660  // << " id.layer() = " << id.layer() << " globalTypeRCH = "
661  // << globalTypeRCH << std::endl;
662  // another sanity check
663  if (id.station() < 1) continue;
664 
665  // Look up some stuff specific to CSCRecHit2D
666  // std::cout << " typeid().name() " << typeid(**hit).name() << std::endl;
667  // const CSCRecHit2D* CSChit =dynamic_cast<const CSCRecHit2D*>(&**hit);
668 
669  const CSCSegment* cscSegment =dynamic_cast<const CSCSegment*>(&**hit);
670  //std::cout << "cscSegment = " << cscSegment << std::endl;
671  if (cscSegment == NULL) continue;
672  // const CSCRecHit2D* CSChit =(CSCRecHit2D*)(&**hit);
673 
674  // std::cout << " after CSCRecHit2D, CSChit = " << CSChit << std::endl;
675  // LocalPoint rhitlocal = CSChit->localPosition();
676  LocalPoint rhitlocal = cscSegment->localPosition();
677 
678  // for debugging purpouses
679  //if (printLevel > 0) {
680  //std::cout << "!!!!rhitlocal.phi = "<<rhitlocal.phi() << std::endl;
681  //std::cout << "rhitlocal.y="<<rhitlocal.y();
682  //std::cout << "rhitlocal.z="<<rhitlocal.z();
683  //}
684 
685  GlobalPoint gp = GlobalPoint(0.0, 0.0, 0.0);
686 
687  const CSCChamber* cscchamber = cscGeom->chamber(id);
688 
689  if (!cscchamber) continue;
690 
691  gp = cscchamber->toGlobal(rhitlocal);
692 
693  // identify the rechit position
694  //int pos = ( ((id.station()-1)*6) + (id.layer()-1) ) + (MAX_CSC_RECHIT*whichMuon);
695 
696  // --------------------------------------------------
697  // this part has to be deprecated once we are sure of
698  // the TMatrixF usage ;)
699  // fill the rechits array
700  //rchEtaList[pos] = gp.eta();
701  //rchPhiList[pos] = gp.phi();
702  //float phi02PI = gp.phi();
703  //if (gp.phi() < 0) phi02PI += (2*PI);
704 
705  //rchPhiList_02PI[pos] = phi02PI;
706  // --------------------------------------------------
707 
708  // --------------------------------------------------
709  // See if this hit is closer to the "key" position
710  //if( lutCSC[id.station()-1][id.layer()-1]<globalTypeRCH || globalTypeRCH<0 ){
711  if( lutCSC[id.station()-1][3-1]<globalTypeRCH || globalTypeRCH<0 ){
712  //globalTypeRCH = lutCSC[id.station()-1][id.layer()-1];
713  globalTypeRCH = lutCSC[id.station()-1][3-1];
714  // localEtaRCH = rhitlocal.eta();
715  // localPhiRCH = rhitlocal.phi();
716  globalEtaRCH = gp.eta();
717  globalPhiRCH = gp.phi();// phi from -pi to pi
718  //std::cout << "globalEtaRCH = " <<globalEtaRCH
719  // << " globalPhiRCH = " << globalPhiRCH << std::endl;
720  if(globalPhiRCH < 0) globalPhiRCH = globalPhiRCH + 2*pig;// convert to [0; 2pi]
721  }
722  // --------------------------------------------------
723  }
724 
725  hit = imu->outerTrack()->recHitsBegin();
726 
727  for(; hit != hitEnd; hit++) {
728 
729  if ( !((*hit)->isValid()) ) continue;
730 
731  DetId detId = (*hit)->geographicalId();
732 
733  if (detId.det() != DetId::Muon ) continue;
734  if (detId.subdetId() != MuonSubdetId::RPC) continue;
735 
736  RPCDetId rpcId = (RPCDetId)(*hit)->geographicalId();
737 
738  int region = rpcId.region();
739  int stat = rpcId.station();
740  int sect = rpcId.sector();
741  int layer = rpcId.layer();
742  int subsector = rpcId.subsector();
743  int roll = rpcId.roll();
744  int ring = rpcId.ring();
745 
746  float xLoc = (*hit)->localPosition().x();
747 
748  for (int iRpcHit = 0; iRpcHit < rpcHitData->nRpcHits; ++ iRpcHit) {
749 
750  if ( region == rpcHitData->region.at(iRpcHit) &&
751  stat == rpcHitData->station.at(iRpcHit) &&
752  sect == rpcHitData->sector.at(iRpcHit) &&
753  layer == rpcHitData->layer.at(iRpcHit) &&
754  subsector == rpcHitData->subsector.at(iRpcHit) &&
755  roll == rpcHitData->roll.at(iRpcHit) &&
756  ring == rpcHitData->ring.at(iRpcHit) &&
757  fabs(xLoc - rpcHitData->xLoc.at(iRpcHit)) < 0.01
758  )
759 
760  rpcHitData->muonId.at(iRpcHit) = muonData->nMuons; // CB rpc hit belongs to mu imu
761  // due to cleaning as in 2012 1 rpc hit belogns to 1 mu
762 
763  }
764 
765  }
766 
767  }
768  // at the end of the loop, write only the best rechit
769  // if(globalPhiRCH > -100.) std::cout << "globalPhiRCH = " << globalPhiRCH
770  // << "globalEtaRCH = " << globalEtaRCH << std::endl;
771  muonData -> rchCSCtype.push_back(globalTypeRCH);
772  muonData -> rchPhi.push_back(globalPhiRCH);
773  muonData -> rchEta.push_back(globalEtaRCH);
774  // end GP
775 
776  if (isGL){
777  // Filling calo energies and calo times
778  if (imu->isEnergyValid()){
779  reco::MuonEnergy muon_energy;
780  muon_energy = imu->calEnergy();
781  muonData->calo_energy.push_back(muon_energy.tower);
782  muonData->calo_energy3x3.push_back(muon_energy.towerS9);
783  muonData->ecal_time.push_back(muon_energy.ecal_time);
784  muonData->ecal_terr.push_back(muon_energy.ecal_timeError);
785  muonData->hcal_time.push_back(muon_energy.hcal_time);
786  muonData->hcal_terr.push_back(muon_energy.hcal_timeError);
787  } else {
788  muonData->calo_energy.push_back(-999999);
789  muonData->calo_energy3x3.push_back(-999999);
790  muonData->ecal_time.push_back(-999999);
791  muonData->ecal_terr.push_back(-999999);
792  muonData->hcal_time.push_back(-999999);
793  muonData->hcal_terr.push_back(-999999);
794  }
795 
796  // Filling muon time data
797  if (imu->isTimeValid()){
798  reco::MuonTime muon_time;
799  muon_time = imu->time();
800  muonData->time_dir.push_back(muon_time.direction());
801  muonData->time_inout.push_back(muon_time.timeAtIpInOut);
802  muonData->time_inout_err.push_back(muon_time.timeAtIpInOutErr);
803  muonData->time_outin.push_back(muon_time.timeAtIpOutIn);
804  muonData->time_outin_err.push_back(muon_time.timeAtIpOutInErr);
805  } else {
806  muonData->time_dir.push_back(-999999);
807  muonData->time_inout.push_back(-999999);
808  muonData->time_inout_err.push_back(-999999);
809  muonData->time_outin.push_back(-999999);
810  muonData->time_outin_err.push_back(-999999);
811  }
812 
813  // Use the track now, and make a transient track out of it (for extrapolations)
814  reco::TrackRef glb_mu = imu->globalTrack();
816 
817  // Track quantities
818  muonData->ch.push_back(glb_mu->charge());
819  muonData->pt.push_back(glb_mu->pt());
820  muonData->p.push_back(glb_mu->p());
821  muonData->eta.push_back(glb_mu->eta());
822  muonData->phi.push_back(glb_mu->phi());
823  muonData->normchi2.push_back(glb_mu->normalizedChi2());
824  muonData->validhits.push_back(glb_mu->numberOfValidHits());
825  muonData->numberOfMatchedStations.push_back(imu->numberOfMatchedStations());
826  muonData->numberOfValidMuonHits.push_back(glb_mu->hitPattern().numberOfValidMuonHits());
827 
828  // Extrapolation to IP
829  if (ttrack.impactPointTSCP().isValid()){
830  muonData->imp_point_x.push_back(ttrack.impactPointTSCP().position().x());
831  muonData->imp_point_y.push_back(ttrack.impactPointTSCP().position().y());
832  muonData->imp_point_z.push_back(ttrack.impactPointTSCP().position().z());
833  muonData->imp_point_p.push_back(sqrt(ttrack.impactPointTSCP().position().mag()));
834  muonData->imp_point_pt.push_back(sqrt(ttrack.impactPointTSCP().position().perp2()));
835  }else{
836  muonData->imp_point_x.push_back(-999999);
837  muonData->imp_point_y.push_back(-999999);
838  muonData->imp_point_z.push_back(-999999);
839  muonData->imp_point_p.push_back(-999999);
840  muonData->imp_point_pt.push_back(-999999);
841  }
842 
843  if (!runOnPostLS1_) {
844  //Extrapolation to HB
846  tsos = cylExtrapTrkSam(glb_mu, 235);
847  if (tsos.isValid()) {
848  double xx = tsos.globalPosition().x();
849  double yy = tsos.globalPosition().y();
850  double zz = tsos.globalPosition().z();
851  muonData->z_hb.push_back(zz);
852  double rr = sqrt(xx*xx + yy*yy);
853  double cosphi = xx/rr;
854  if (yy>=0)
855  muonData->phi_hb.push_back(acos(cosphi));
856  else
857  muonData->phi_hb.push_back(2*pig-acos(cosphi));
858  }
859  else{
860  muonData->phi_hb.push_back(-999999);
861  muonData->z_hb.push_back(-999999);
862  }
863 
864  //Extrapolation to HE+
865  tsos = surfExtrapTrkSam(glb_mu, 479);
866  if (tsos.isValid()) {
867  double xx = tsos.globalPosition().x();
868  double yy = tsos.globalPosition().y();
869  double rr = sqrt(xx*xx + yy*yy);
870  muonData->r_he_p.push_back(rr);
871  double cosphi = xx/rr;
872  if (yy>=0)
873  muonData->phi_he_p.push_back(acos(cosphi));
874  else
875  muonData->phi_he_p.push_back(2*pig-acos(cosphi));
876  }
877  else{
878  muonData->r_he_p.push_back(-999999);
879  muonData->phi_he_p.push_back(-999999);
880  }
881 
882  //Extrapolation to HE-
883  tsos = surfExtrapTrkSam(glb_mu, -479);
884  if (tsos.isValid()) {
885  double xx = tsos.globalPosition().x();
886  double yy = tsos.globalPosition().y();
887  double rr = sqrt(xx*xx + yy*yy);
888  muonData->r_he_n.push_back(rr);
889  double cosphi = xx/rr;
890  if (yy>=0)
891  muonData->phi_he_n.push_back(acos(cosphi));
892  else
893  muonData->phi_he_n.push_back(2*pig-acos(cosphi));
894  }
895  else{
896  muonData->r_he_n.push_back(-999999);
897  muonData->phi_he_n.push_back(-999999);
898  }
899  }
900  else {
901  muonData->phi_hb.push_back(-999999);
902  muonData->z_hb.push_back(-999999);
903  muonData->r_he_p.push_back(-999999);
904  muonData->phi_he_p.push_back(-999999);
905  muonData->r_he_n.push_back(-999999);
906  muonData->phi_he_n.push_back(-999999);
907  }
908  } // end of IF IS GLOBAL
909 
910  // If global muon or tracker muon, fill the tracker track quantities
911  if (isTR || isGL || isTRSA){
912 
913  // Take the tracker track and build a transient track out of it
914  reco::TrackRef tr_mu = imu->innerTrack();
916  // Fill track quantities
917  muonData->tr_ch.push_back(tr_mu->charge());
918  muonData->tr_pt.push_back(tr_mu->pt());
919  muonData->tr_p.push_back(tr_mu->p());
920  muonData->tr_eta.push_back(tr_mu->eta());
921  muonData->tr_phi.push_back(tr_mu->phi());
922  muonData->tr_normchi2.push_back(tr_mu->normalizedChi2());
923  muonData->tr_validhits.push_back(tr_mu->numberOfValidHits());
924  muonData->tr_validpixhits.push_back(tr_mu->hitPattern().numberOfValidPixelHits());
925  // find d0 from vertex position
928  iEvent.getByLabel("offlineBeamSpot", beamSpot);
929  muonData->tr_d0.push_back(tr_mu->dxy(beamSpot->position()));
930 
931  // Extrapolation to the IP
932  if (ttrack.impactPointTSCP().isValid()){
933  muonData->tr_imp_point_x.push_back(ttrack.impactPointTSCP().position().x());
934  muonData->tr_imp_point_y.push_back(ttrack.impactPointTSCP().position().y());
935  muonData->tr_imp_point_z.push_back(ttrack.impactPointTSCP().position().z());
936  muonData->tr_imp_point_p.push_back(sqrt(ttrack.impactPointTSCP().position().mag()));
937  muonData->tr_imp_point_pt.push_back(sqrt(ttrack.impactPointTSCP().position().perp2()));
938  }
939  else{
940  muonData->tr_imp_point_x.push_back(-999999);
941  muonData->tr_imp_point_y.push_back(-999999);
942  muonData->tr_imp_point_z.push_back(-999999);
943  muonData->tr_imp_point_p.push_back(-999999);
944  muonData->tr_imp_point_pt.push_back(-999999);
945  }
946 
947  if(!runOnPostLS1_) {
948 
950  tsos = cylExtrapTrkSam(tr_mu, 410); // track at MB1 radius - extrapolation
951  if (tsos.isValid()) {
952  double xx = tsos.globalPosition().x();
953  double yy = tsos.globalPosition().y();
954  double zz = tsos.globalPosition().z();
955  muonData->tr_z_mb1.push_back(zz);
956  double rr = sqrt(xx*xx + yy*yy);
957  double cosphi = xx/rr;
958  if (yy>=0)
959  muonData->tr_phi_mb1.push_back(acos(cosphi));
960  else
961  muonData->tr_phi_mb1.push_back(2*pig-acos(cosphi));
962  }
963  else{
964  muonData->tr_z_mb1.push_back(-999999);
965  muonData->tr_phi_mb1.push_back(-999999);
966  }
967 
968  tsos = cylExtrapTrkSam(tr_mu, 500); // track at MB2 radius - extrapolation
969  if (tsos.isValid()) {
970  double xx = tsos.globalPosition().x();
971  double yy = tsos.globalPosition().y();
972  double zz = tsos.globalPosition().z();
973  muonData->tr_z_mb2.push_back(zz);
974  double rr = sqrt(xx*xx + yy*yy);
975  double cosphi = xx/rr;
976  if (yy>=0)
977  muonData->tr_phi_mb2.push_back(acos(cosphi));
978  else
979  muonData->tr_phi_mb2.push_back(2*pig-acos(cosphi));
980  }
981  else{
982  muonData->tr_z_mb2.push_back(-999999);
983  muonData->tr_phi_mb2.push_back(-999999);
984  }
985 
986  tsos = surfExtrapTrkSam(tr_mu, 630); // track at ME1+ plane - extrapolation
987  if (tsos.isValid()) {
988  double xx = tsos.globalPosition().x();
989  double yy = tsos.globalPosition().y();
990  double rr = sqrt(xx*xx + yy*yy);
991  muonData->tr_r_me1_p.push_back(rr);
992  double cosphi = xx/rr;
993  if (yy>=0)
994  muonData->tr_phi_me1_p.push_back(acos(cosphi));
995  else
996  muonData->tr_phi_me1_p.push_back(2*pig-acos(cosphi));
997  }
998  else{
999  muonData->tr_r_me1_p.push_back(-999999);
1000  muonData->tr_phi_me1_p.push_back(-999999);
1001  }
1002 
1003  tsos = surfExtrapTrkSam(tr_mu, 790); // track at ME2+ plane - extrapolation
1004  if (tsos.isValid()) {
1005  double xx = tsos.globalPosition().x();
1006  double yy = tsos.globalPosition().y();
1007  double rr = sqrt(xx*xx + yy*yy);
1008  muonData->tr_r_me2_p.push_back(rr);
1009  double cosphi = xx/rr;
1010  if (yy>=0)
1011  muonData->tr_phi_me2_p.push_back(acos(cosphi));
1012  else
1013  muonData->tr_phi_me2_p.push_back(2*pig-acos(cosphi));
1014  }
1015  else{
1016  muonData->tr_r_me2_p.push_back(-999999);
1017  muonData->tr_phi_me2_p.push_back(-999999);
1018  }
1019 
1020  tsos = surfExtrapTrkSam(tr_mu, -630); // track at ME1- plane - extrapolation
1021  if (tsos.isValid()) {
1022  double xx = tsos.globalPosition().x();
1023  double yy = tsos.globalPosition().y();
1024  double rr = sqrt(xx*xx + yy*yy);
1025  muonData->tr_r_me1_n.push_back(rr);
1026  double cosphi = xx/rr;
1027  if (yy>=0)
1028  muonData->tr_phi_me1_n.push_back(acos(cosphi));
1029  else
1030  muonData->tr_phi_me1_n.push_back(2*pig-acos(cosphi));
1031  }
1032  else{
1033  muonData->tr_r_me1_n.push_back(-999999);
1034  muonData->tr_phi_me1_n.push_back(-999999);
1035  }
1036 
1037  tsos = surfExtrapTrkSam(tr_mu, -790); // track at ME2- plane - extrapolation
1038  if (tsos.isValid()) {
1039  double xx = tsos.globalPosition().x();
1040  double yy = tsos.globalPosition().y();
1041  double rr = sqrt(xx*xx + yy*yy);
1042  muonData->tr_r_me2_n.push_back(rr);
1043  double cosphi = xx/rr;
1044  if (yy>=0)
1045  muonData->tr_phi_me2_n.push_back(acos(cosphi));
1046  else
1047  muonData->tr_phi_me2_n.push_back(2*pig-acos(cosphi));
1048  }
1049  else{
1050  muonData->tr_r_me2_n.push_back(-999999);
1051  muonData->tr_phi_me2_n.push_back(-999999);
1052  }
1053  }
1054  else {
1055  muonData->tr_z_mb1.push_back(-999999);
1056  muonData->tr_phi_mb1.push_back(-999999);
1057  muonData->tr_z_mb2.push_back(-999999);
1058  muonData->tr_phi_mb2.push_back(-999999);
1059  muonData->tr_r_me1_p.push_back(-999999);
1060  muonData->tr_phi_me1_p.push_back(-999999);
1061  muonData->tr_r_me2_p.push_back(-999999);
1062  muonData->tr_phi_me2_p.push_back(-999999);
1063  muonData->tr_r_me1_n.push_back(-999999);
1064  muonData->tr_phi_me1_n.push_back(-999999);
1065  muonData->tr_r_me2_n.push_back(-999999);
1066  muonData->tr_phi_me2_n.push_back(-999999);
1067  }
1068 
1069  } // end of IF IS TRACKER
1070 
1071  // If global muon or sa muon, fill the sa track quantities
1072  if (isGL || isSA || isTRSA){
1073  muonData->sa_nChambers.push_back(imu->numberOfChambers());
1074  muonData->sa_nMatches.push_back(imu->numberOfMatches());
1075 
1076 
1077  // Take the SA track and build a transient track out of it
1078  reco::TrackRef sa_mu = imu->outerTrack();
1080 
1081  // Extrapolation to IP
1082  if (ttrack.impactPointTSCP().isValid()){
1083  muonData->sa_imp_point_x.push_back(ttrack.impactPointTSCP().position().x());
1084  muonData->sa_imp_point_y.push_back(ttrack.impactPointTSCP().position().y());
1085  muonData->sa_imp_point_z.push_back(ttrack.impactPointTSCP().position().z());
1086  muonData->sa_imp_point_p.push_back(sqrt(ttrack.impactPointTSCP().position().mag()));
1087  muonData->sa_imp_point_pt.push_back(sqrt(ttrack.impactPointTSCP().position().perp2()));
1088  } else {
1089  muonData->sa_imp_point_x.push_back(-999999);
1090  muonData->sa_imp_point_y.push_back(-999999);
1091  muonData->sa_imp_point_z.push_back(-999999);
1092  muonData->sa_imp_point_p.push_back(-999999);
1093  muonData->sa_imp_point_pt.push_back(-999999);
1094  }
1095 
1096  // Extrapolation to MB2
1097 
1098 
1100  tsos = cylExtrapTrkSam(sa_mu, 410); // track at MB1 radius - extrapolation
1101  if (tsos.isValid()) {
1102  double xx = tsos.globalPosition().x();
1103  double yy = tsos.globalPosition().y();
1104  double zz = tsos.globalPosition().z();
1105  muonData->sa_z_mb1.push_back(zz);
1106  double rr = sqrt(xx*xx + yy*yy);
1107  double cosphi = xx/rr;
1108  if (yy>=0)
1109  muonData->sa_phi_mb1.push_back(acos(cosphi));
1110  else
1111  muonData->sa_phi_mb1.push_back(2*pig-acos(cosphi));
1112  }
1113  else{
1114  muonData->sa_z_mb1.push_back(-999999);
1115  muonData->sa_phi_mb1.push_back(-999999);
1116  }
1117 
1118  tsos = cylExtrapTrkSam(sa_mu, 500); // track at MB2 radius - extrapolation
1119  if (tsos.isValid()) {
1120  double xx = tsos.globalPosition().x();
1121  double yy = tsos.globalPosition().y();
1122  double zz = tsos.globalPosition().z();
1123  muonData->sa_z_mb2.push_back(zz);
1124  double rr = sqrt(xx*xx + yy*yy);
1125  double cosphi = xx/rr;
1126  if (yy>=0)
1127  muonData->sa_phi_mb2.push_back(acos(cosphi));
1128  else
1129  muonData->sa_phi_mb2.push_back(2*pig-acos(cosphi));
1130  double abspseta = -log( tan( atan(fabs(rr/zz))/2.0 ) );
1131  if (zz>=0)
1132  muonData->sa_pseta.push_back(abspseta);
1133  else
1134  muonData->sa_pseta.push_back(-abspseta);
1135  }
1136  else{
1137  muonData->sa_z_mb2.push_back(-999999);
1138  muonData->sa_phi_mb2.push_back(-999999);
1139  muonData->sa_pseta.push_back(-999999);
1140  }
1141 
1142  tsos = surfExtrapTrkSam(sa_mu, 630); // track at ME1+ plane - extrapolation
1143  if (tsos.isValid()) {
1144  double xx = tsos.globalPosition().x();
1145  double yy = tsos.globalPosition().y();
1146  double rr = sqrt(xx*xx + yy*yy);
1147  muonData->sa_r_me1_p.push_back(rr);
1148  double cosphi = xx/rr;
1149  if (yy>=0)
1150  muonData->sa_phi_me1_p.push_back(acos(cosphi));
1151  else
1152  muonData->sa_phi_me1_p.push_back(2*pig-acos(cosphi));
1153  }
1154  else{
1155  muonData->sa_r_me1_p.push_back(-999999);
1156  muonData->sa_phi_me1_p.push_back(-999999);
1157  }
1158 
1159  // Extrapolation to ME2+
1160  tsos = surfExtrapTrkSam(sa_mu, 790);
1161  if (tsos.isValid()) {
1162  double xx = tsos.globalPosition().x();
1163  double yy = tsos.globalPosition().y();
1164  double rr = sqrt(xx*xx + yy*yy);
1165  muonData->sa_r_me2_p.push_back(rr);
1166  double cosphi = xx/rr;
1167  if (yy>=0)
1168  muonData->sa_phi_me2_p.push_back(acos(cosphi));
1169  else
1170  muonData->sa_phi_me2_p.push_back(2*pig-acos(cosphi));
1171  }
1172  else{
1173  muonData->sa_r_me2_p.push_back(-999999);
1174  muonData->sa_phi_me2_p.push_back(-999999);
1175  }
1176 
1177  tsos = surfExtrapTrkSam(sa_mu, -630); // track at ME1- plane - extrapolation
1178  if (tsos.isValid()) {
1179  double xx = tsos.globalPosition().x();
1180  double yy = tsos.globalPosition().y();
1181  double rr = sqrt(xx*xx + yy*yy);
1182  muonData->sa_r_me1_n.push_back(rr);
1183  double cosphi = xx/rr;
1184  if (yy>=0)
1185  muonData->sa_phi_me1_n.push_back(acos(cosphi));
1186  else
1187  muonData->sa_phi_me1_n.push_back(2*pig-acos(cosphi));
1188  }
1189  else{
1190  muonData->sa_r_me1_n.push_back(-999999);
1191  muonData->sa_phi_me1_n.push_back(-999999);
1192  }
1193 
1194  // Extrapolation to ME2-
1195  tsos = surfExtrapTrkSam(sa_mu, -790); // track at ME2- disk - extrapolation
1196  if (tsos.isValid()) {
1197  double xx = tsos.globalPosition().x();
1198  double yy = tsos.globalPosition().y();
1199  double rr = sqrt(xx*xx + yy*yy);
1200  muonData->sa_r_me2_n.push_back(rr);
1201  double cosphi = xx/rr;
1202  if (yy>=0)
1203  muonData->sa_phi_me2_n.push_back(acos(cosphi));
1204  else
1205  muonData->sa_phi_me2_n.push_back(2*pig-acos(cosphi));
1206  }
1207  else{
1208  muonData->sa_r_me2_n.push_back(-999999);
1209  muonData->sa_phi_me2_n.push_back(-999999);
1210  }
1211 
1212  // Extrapolation to HB
1213  tsos = cylExtrapTrkSam(sa_mu, 235); // track at HB radius - extrapolation
1214  if (tsos.isValid()) {
1215  double xx = tsos.globalPosition().x();
1216  double yy = tsos.globalPosition().y();
1217  double zz = tsos.globalPosition().z();
1218  muonData->sa_z_hb.push_back(zz);
1219  double rr = sqrt(xx*xx + yy*yy);
1220  double cosphi = xx/rr;
1221  if (yy>=0)
1222  muonData->sa_phi_hb.push_back(acos(cosphi));
1223  else
1224  muonData->sa_phi_hb.push_back(2*pig-acos(cosphi));
1225  }
1226  else{
1227  muonData->sa_z_hb.push_back(-999999);
1228  muonData->sa_phi_hb.push_back(-999999);
1229  }
1230 
1231  // Extrapolation to HE+
1232  tsos = surfExtrapTrkSam(sa_mu, 479);
1233  if (tsos.isValid()) {
1234  double xx = tsos.globalPosition().x();
1235  double yy = tsos.globalPosition().y();
1236  double rr = sqrt(xx*xx + yy*yy);
1237  muonData->sa_r_he_p.push_back(rr);
1238  double cosphi = xx/rr;
1239  if (yy>=0)
1240  muonData->sa_phi_he_p.push_back(acos(cosphi));
1241  else
1242  muonData->sa_phi_he_p.push_back(2*pig-acos(cosphi));
1243  }
1244  else{
1245  muonData->sa_r_he_p.push_back(-999999);
1246  muonData->sa_phi_he_p.push_back(-999999);
1247  }
1248 
1249  // Extrapolation to HE-
1250  tsos = surfExtrapTrkSam(sa_mu, -479);
1251  if (tsos.isValid()) {
1252  double xx = tsos.globalPosition().x();
1253  double yy = tsos.globalPosition().y();
1254  double rr = sqrt(xx*xx + yy*yy);
1255  muonData->sa_r_he_n.push_back(rr);
1256  double cosphi = xx/rr;
1257  if (yy>=0)
1258  muonData->sa_phi_he_n.push_back(acos(cosphi));
1259  else
1260  muonData->sa_phi_he_n.push_back(2*pig-acos(cosphi));
1261  }
1262  else{
1263  muonData->sa_r_he_n.push_back(-999999);
1264  muonData->sa_phi_he_n.push_back(-999999);
1265  }
1266 
1267  // Several track quantities
1268  muonData->sa_normchi2.push_back(sa_mu->normalizedChi2());
1269  muonData->sa_validhits.push_back(sa_mu->numberOfValidHits());
1270  muonData->sa_ch.push_back(sa_mu->charge());
1271  muonData->sa_pt.push_back(sa_mu->pt());
1272  muonData->sa_p.push_back(sa_mu->p());
1273  muonData->sa_eta.push_back(sa_mu->eta());
1274  muonData->sa_phi.push_back(sa_mu->phi());
1275  muonData->sa_outer_pt.push_back( sqrt(sa_mu->outerMomentum().Perp2()));
1276  muonData->sa_inner_pt.push_back( sqrt(sa_mu->innerMomentum().Perp2()));
1277  muonData->sa_outer_eta.push_back(sa_mu->outerMomentum().Eta());
1278  muonData->sa_inner_eta.push_back(sa_mu->innerMomentum().Eta());
1279  muonData->sa_outer_phi.push_back(sa_mu->outerMomentum().Phi());
1280  muonData->sa_inner_phi.push_back(sa_mu->innerMomentum().Phi());
1281  muonData->sa_outer_x.push_back(sa_mu->outerPosition().x());
1282  muonData->sa_outer_y.push_back(sa_mu->outerPosition().y());
1283  muonData->sa_outer_z.push_back(sa_mu->outerPosition().z());
1284  muonData->sa_inner_x.push_back(sa_mu->innerPosition().x());
1285  muonData->sa_inner_y.push_back(sa_mu->innerPosition().y());
1286  muonData->sa_inner_z.push_back(sa_mu->innerPosition().z());
1287 
1288  } // end of IF IS STANDALONE
1289 
1290  } // end of if type 012 found
1291  } // end of muon loop
1292 
1293  tree_->Fill();
1294 
1295 }
const double Pi
type
Definition: HCALResponse.h:21
float ecal_timeError
Definition: MuonEnergy.h:38
edm::ESHandle< DTGeometry > dtGeom
edm::ESHandle< CSCGeometry > cscGeom
TrajectoryStateOnSurface surfExtrapTrkSam(reco::TrackRef track, double z)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:52
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
GlobalPoint globalPosition() const
TrajectoryStateOnSurface cylExtrapTrkSam(reco::TrackRef track, double rho)
#define NULL
Definition: scimark2.h:8
float timeAtIpOutInErr
Definition: MuonTime.h:18
float towerS9
total energy in 3x3 tower shape
Definition: MuonEnergy.h:12
float ecal_time
Calorimeter timing.
Definition: MuonEnergy.h:37
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
LocalPoint localPosition() const
Definition: CSCSegment.h:38
Direction direction() const
direction estimation based on time dispersion
Definition: MuonTime.h:21
static const int CSC
Definition: MuonSubdetId.h:13
int roll() const
Definition: RPCDetId.h:120
edm::ESHandle< RPCGeometry > rpcGeom
int ring() const
Definition: RPCDetId.h:72
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
L1Analysis::L1AnalysisRecoMuonDataFormat * muonData
float timeAtIpInOutErr
Definition: MuonTime.h:15
float timeAtIpOutIn
b) particle is moving from outside in
Definition: MuonTime.h:17
double match_trigger(std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &triggerEvent, const reco::Muon &mu)
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
edm::ESHandle< MagneticField > theBField
L1Analysis::L1AnalysisRecoRpcHitDataFormat * rpcHitData
static std::string const triggerResults
Definition: EdmProvDump.cc:41
bool isValid() const
Definition: HandleBase.h:75
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:418
std::vector< TriggerObject > TriggerObjectCollection
collection of trigger physics objects (e.g., all isolated muons)
Definition: TriggerObject.h:81
Definition: DetId.h:18
int layer() const
Definition: RPCDetId.h:108
std::vector< int > triggerIndices_
edm::ESHandle< Propagator > propagatorOpposite
edm::ESHandle< Propagator > propagatorAlong
const T & get() const
Definition: EventSetup.h:56
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
std::string const & label() const
Definition: InputTag.h:36
T eta() const
Definition: PV3DBase.h:76
int subsector() const
SubSector id : some sectors are divided along the phi direction in subsectors (from 1 to 4 in Barrel...
Definition: RPCDetId.h:114
static const int RPC
Definition: MuonSubdetId.h:14
std::vector< int > isoTriggerIndices_
L1Analysis::L1AnalysisRecoRpcHit * rpcHit
float hcal_timeError
Definition: MuonEnergy.h:40
Detector det() const
get the detector field from this detid
Definition: DetId.h:35
T x() const
Definition: PV3DBase.h:62
float timeAtIpInOut
Definition: MuonTime.h:14
edm::ESHandle< GlobalTrackingGeometry > theTrackingGeometry
L1Analysis::L1AnalysisRecoMuon * muon
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
void L1MuonRecoTreeProducer::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1400 of file L1MuonRecoTreeProducer.cc.

1400  {
1401 }
void L1MuonRecoTreeProducer::beginRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1343 of file L1MuonRecoTreeProducer.cc.

References assert(), gather_cfg::cout, hltConfig_, HLTConfigProvider::init(), isoTriggerIndices_, isoTriggerNames_, HLTConfigProvider::size(), triggerIndices_, triggerMatching_, HLTConfigProvider::triggerName(), triggerNames_, and triggerProcessLabel_.

1343  {
1344  // Prepare for trigger matching for each new run:
1345  // Look up triggetIndices in the HLT config for the different paths
1346  if (triggerMatching_) {
1347  bool changed = true;
1348  if (!hltConfig_.init(run, eventSetup, triggerProcessLabel_, changed)) {
1349  // if you can't initialize hlt configuration, crash!
1350  std::cout << "Error: didn't find process" << triggerProcessLabel_ << std::endl;
1351  assert(false);
1352  }
1353 
1354  bool enableWildcard = true;
1355  for (size_t iTrig = 0; iTrig < triggerNames_.size(); ++iTrig) {
1356  // prepare for regular expression (with wildcards) functionality:
1357  TString tNameTmp = TString(triggerNames_[iTrig]);
1358  TRegexp tNamePattern = TRegexp(tNameTmp, enableWildcard);
1359  int tIndex = -1;
1360  // find the trigger index:
1361  for (unsigned ipath = 0; ipath < hltConfig_.size(); ++ipath) {
1362  // use TString since it provides reg exp functionality:
1363  TString tmpName = TString(hltConfig_.triggerName(ipath));
1364  if (tmpName.Contains(tNamePattern)) {
1365  tIndex = int(ipath);
1366  triggerIndices_.push_back(tIndex);
1367  }
1368  }
1369  if (tIndex < 0) { // if can't find trigger path at all, give warning:
1370  std::cout << "Warning: Could not find trigger" << triggerNames_[iTrig] << std::endl;
1371  //assert(false);
1372  }
1373  } // end for triggerNames
1374  for (size_t iTrig = 0; iTrig < isoTriggerNames_.size(); ++iTrig) {
1375  // prepare for regular expression functionality:
1376  TString tNameTmp = TString(isoTriggerNames_[iTrig]);
1377  TRegexp tNamePattern = TRegexp(tNameTmp, enableWildcard);
1378  int tIndex = -1;
1379  // find the trigger index:
1380  for (unsigned ipath = 0; ipath < hltConfig_.size(); ++ipath) {
1381  // use TString since it provides reg exp functionality:
1382  TString tmpName = TString(hltConfig_.triggerName(ipath));
1383  if (tmpName.Contains(tNamePattern)) {
1384  tIndex = int(ipath);
1385  isoTriggerIndices_.push_back(tIndex);
1386  }
1387  }
1388  if (tIndex < 0) { // if can't find trigger path at all, give warning:
1389  std::cout << "Warning: Could not find trigger" << isoTriggerNames_[iTrig] << std::endl;
1390  //assert(false);
1391  }
1392  } // end for isoTriggerNames
1393  } // end if (triggerMatching_)
1394 }
unsigned int size() const
number of trigger paths in trigger table
const std::string & triggerName(unsigned int triggerIndex) const
assert(m_qm.get())
std::vector< std::string > triggerNames_
std::vector< int > triggerIndices_
bool init(const edm::Run &iRun, const edm::EventSetup &iSetup, const std::string &processName, bool &changed)
d&#39;tor
std::vector< std::string > isoTriggerNames_
std::vector< int > isoTriggerIndices_
tuple cout
Definition: gather_cfg.py:145
TrajectoryStateOnSurface L1MuonRecoTreeProducer::cylExtrapTrkSam ( reco::TrackRef  track,
double  rho 
)

Definition at line 1299 of file L1MuonRecoTreeProducer.cc.

References Cylinder::build(), freeTrajStateMuon(), TrajectoryStateOnSurface::isValid(), propagatorAlong, propagatorOpposite, and makeMuonMisalignmentScenario::rot.

Referenced by analyze().

1300 {
1301  Cylinder::PositionType pos(0, 0, 0);
1303  Cylinder::CylinderPointer myCylinder = Cylinder::build(pos, rot, rho);
1304 
1305  FreeTrajectoryState recoStart = freeTrajStateMuon(track);
1306  TrajectoryStateOnSurface recoProp;
1307  recoProp = propagatorAlong->propagate(recoStart, *myCylinder);
1308  if (!recoProp.isValid()) {
1309  recoProp = propagatorOpposite->propagate(recoStart, *myCylinder);
1310  }
1311  return recoProp;
1312 }
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef track)
static CylinderPointer build(const PositionType &pos, const RotationType &rot, Scalar radius, Bounds *bounds=0)
Definition: Cylinder.h:51
edm::ESHandle< Propagator > propagatorOpposite
edm::ESHandle< Propagator > propagatorAlong
void L1MuonRecoTreeProducer::empty_global ( )

Definition at line 285 of file L1MuonRecoTreeProducer.cc.

References L1Analysis::L1AnalysisRecoMuonDataFormat::calo_energy, L1Analysis::L1AnalysisRecoMuonDataFormat::calo_energy3x3, L1Analysis::L1AnalysisRecoMuonDataFormat::ch, L1Analysis::L1AnalysisRecoMuonDataFormat::ecal_terr, L1Analysis::L1AnalysisRecoMuonDataFormat::ecal_time, L1Analysis::L1AnalysisRecoMuonDataFormat::eta, L1Analysis::L1AnalysisRecoMuonDataFormat::hcal_terr, L1Analysis::L1AnalysisRecoMuonDataFormat::hcal_time, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_deltaR, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_isoDeltaR, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_isomu, L1Analysis::L1AnalysisRecoMuonDataFormat::hlt_mu, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::imp_point_z, muonData, L1Analysis::L1AnalysisRecoMuonDataFormat::normchi2, L1Analysis::L1AnalysisRecoMuonDataFormat::numberOfMatchedStations, L1Analysis::L1AnalysisRecoMuonDataFormat::numberOfValidMuonHits, L1Analysis::L1AnalysisRecoMuonDataFormat::p, L1Analysis::L1AnalysisRecoMuonDataFormat::phi, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::phi_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::pt, L1Analysis::L1AnalysisRecoMuonDataFormat::r_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::r_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::time_dir, L1Analysis::L1AnalysisRecoMuonDataFormat::time_inout, L1Analysis::L1AnalysisRecoMuonDataFormat::time_inout_err, L1Analysis::L1AnalysisRecoMuonDataFormat::time_outin, L1Analysis::L1AnalysisRecoMuonDataFormat::time_outin_err, L1Analysis::L1AnalysisRecoMuonDataFormat::validhits, and L1Analysis::L1AnalysisRecoMuonDataFormat::z_hb.

Referenced by analyze().

285  {
286  muonData->ch.push_back(-999999);
287  muonData->pt.push_back(-999999);
288  muonData->p.push_back(-999999);
289  muonData->eta.push_back(-999999);
290  muonData->phi.push_back(-999999);
291  muonData->normchi2.push_back(-999999);
292  muonData->validhits.push_back(-999999);
293  muonData->numberOfMatchedStations.push_back(-999999);
294  muonData->numberOfValidMuonHits.push_back(-999999);
295  muonData->imp_point_x.push_back(-999999);
296  muonData->imp_point_y.push_back(-999999);
297  muonData->imp_point_z.push_back(-999999);
298  muonData->imp_point_p.push_back(-999999);
299  muonData->imp_point_pt.push_back(-999999);
300  muonData->phi_hb.push_back(-999999);
301  muonData->z_hb.push_back(-999999);
302  muonData->r_he_p.push_back(-999999);
303  muonData->phi_he_p.push_back(-999999);
304  muonData->r_he_n.push_back(-999999);
305  muonData->phi_he_n.push_back(-999999);
306  muonData->calo_energy.push_back(-999999);
307  muonData->calo_energy3x3.push_back(-999999);
308  muonData->ecal_time.push_back(-999999);
309  muonData->ecal_terr.push_back(-999999);
310  muonData->hcal_time.push_back(-999999);
311  muonData->hcal_terr.push_back(-999999);
312  muonData->time_dir.push_back(-999999);
313  muonData->time_inout.push_back(-999999);
314  muonData->time_inout_err.push_back(-999999);
315  muonData->time_outin.push_back(-999999);
316  muonData->time_outin_err.push_back(-999999);
317 
318  muonData->hlt_isomu.push_back(-999999);
319  muonData->hlt_mu.push_back(-999999);
320  muonData->hlt_isoDeltaR.push_back(-999999);
321  muonData->hlt_deltaR.push_back(-999999);
322 }
L1Analysis::L1AnalysisRecoMuonDataFormat * muonData
void L1MuonRecoTreeProducer::empty_hlt ( )
void L1MuonRecoTreeProducer::empty_standalone ( )

Definition at line 356 of file L1MuonRecoTreeProducer.cc.

References muonData, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_ch, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_imp_point_z, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_inner_z, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_nChambers, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_nMatches, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_normchi2, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_x, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_y, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_outer_z, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_mb2, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_phi_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_pseta, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_he_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_he_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_r_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_validhits, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_hb, L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_mb1, and L1Analysis::L1AnalysisRecoMuonDataFormat::sa_z_mb2.

Referenced by analyze().

356  {
357  muonData->sa_imp_point_x.push_back(-999999);
358  muonData->sa_imp_point_y.push_back(-999999);
359  muonData->sa_imp_point_z.push_back(-999999);
360  muonData->sa_imp_point_p.push_back(-999999);
361  muonData->sa_imp_point_pt.push_back(-999999);
362  muonData->sa_z_mb2.push_back(-999999);
363  muonData->sa_phi_mb2.push_back(-999999);
364  muonData->sa_pseta.push_back(-999999);
365 
366  muonData->sa_z_hb.push_back(-999999);
367  muonData->sa_phi_hb.push_back(-999999);
368 
369  muonData->sa_r_he_p.push_back(-999999);
370  muonData->sa_phi_he_p.push_back(-999999);
371  muonData->sa_r_he_n.push_back(-999999);
372  muonData->sa_phi_he_n.push_back(-999999);
373 
374  muonData->sa_normchi2.push_back(-999999);
375  muonData->sa_validhits.push_back(-999999);
376  muonData->sa_ch.push_back(-999999);
377  muonData->sa_pt.push_back(-999999);
378  muonData->sa_p.push_back(-999999);
379  muonData->sa_eta.push_back(-999999);
380  muonData->sa_phi.push_back(-999999);
381  muonData->sa_outer_pt.push_back(-999999);
382  muonData->sa_inner_pt.push_back(-999999);
383  muonData->sa_outer_eta.push_back(-999999);
384  muonData->sa_inner_eta.push_back(-999999);
385  muonData->sa_outer_phi.push_back(-999999);
386  muonData->sa_inner_phi.push_back(-999999);
387  muonData->sa_outer_x.push_back(-999999);
388  muonData->sa_outer_y.push_back(-999999);
389  muonData->sa_outer_z.push_back(-999999);
390  muonData->sa_inner_x.push_back(-999999);
391  muonData->sa_inner_y.push_back(-999999);
392  muonData->sa_inner_z.push_back(-999999);
393 
394  muonData->sa_r_me2_p.push_back(-999999);
395  muonData->sa_phi_me2_p.push_back(-999999);
396 
397  muonData->sa_r_me2_n.push_back(-999999);
398  muonData->sa_phi_me2_n.push_back(-999999);
399 
400  muonData->sa_z_mb1.push_back(-999999);
401  muonData->sa_phi_mb1.push_back(-999999);
402  muonData->sa_r_me1_p.push_back(-999999);
403  muonData->sa_phi_me1_p.push_back(-999999);
404  muonData->sa_r_me1_n.push_back(-999999);
405  muonData->sa_phi_me1_n.push_back(-999999);
406 
407  muonData->sa_nChambers.push_back(-999);
408  muonData->sa_nMatches.push_back(-999);
409 
410 }
L1Analysis::L1AnalysisRecoMuonDataFormat * muonData
void L1MuonRecoTreeProducer::empty_tracker ( )

Definition at line 324 of file L1MuonRecoTreeProducer.cc.

References muonData, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_ch, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_d0, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_eta, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_x, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_y, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_imp_point_z, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_normchi2, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_mb1, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_mb2, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_phi_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_pt, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me1_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me1_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me2_n, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_r_me2_p, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_validhits, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_validpixhits, L1Analysis::L1AnalysisRecoMuonDataFormat::tr_z_mb1, and L1Analysis::L1AnalysisRecoMuonDataFormat::tr_z_mb2.

Referenced by analyze().

324  {
325  muonData->tr_ch.push_back(-999999);
326  muonData->tr_pt.push_back(-999999);
327  muonData->tr_p.push_back(-999999);
328  muonData->tr_eta.push_back(-999999);
329  muonData->tr_phi.push_back(-999999);
330  muonData->tr_normchi2.push_back(-999999);
331  muonData->tr_validhits.push_back(-999999);
332  muonData->tr_validpixhits.push_back(-999999);
333  muonData->tr_d0.push_back(-999999);
334  muonData->tr_imp_point_x.push_back(-999999);
335  muonData->tr_imp_point_y.push_back(-999999);
336  muonData->tr_imp_point_z.push_back(-999999);
337  muonData->tr_imp_point_p.push_back(-999999);
338  muonData->tr_imp_point_pt.push_back(-999999);
339 
340  muonData->tr_z_mb2.push_back(-999999);
341  muonData->tr_phi_mb2.push_back(-999999);
342  muonData->tr_r_me2_p.push_back(-999999);
343  muonData->tr_phi_me2_p.push_back(-999999);
344  muonData->tr_r_me2_n.push_back(-999999);
345  muonData->tr_phi_me2_n.push_back(-999999);
346 
347  muonData->tr_z_mb1.push_back(-999999);
348  muonData->tr_phi_mb1.push_back(-999999);
349  muonData->tr_r_me1_p.push_back(-999999);
350  muonData->tr_phi_me1_p.push_back(-999999);
351  muonData->tr_r_me1_n.push_back(-999999);
352  muonData->tr_phi_me1_n.push_back(-999999);
353 
354 }
L1Analysis::L1AnalysisRecoMuonDataFormat * muonData
void L1MuonRecoTreeProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1405 of file L1MuonRecoTreeProducer.cc.

References muon.

1406 {
1407  delete muon;
1408 }
L1Analysis::L1AnalysisRecoMuon * muon
void L1MuonRecoTreeProducer::endRun ( const edm::Run run,
const edm::EventSetup eventSetup 
)
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1396 of file L1MuonRecoTreeProducer.cc.

1396  {
1397 }
FreeTrajectoryState L1MuonRecoTreeProducer::freeTrajStateMuon ( reco::TrackRef  track)
private

Definition at line 1333 of file L1MuonRecoTreeProducer.cc.

References theBField.

Referenced by cylExtrapTrkSam(), and surfExtrapTrkSam().

1334 {
1335  GlobalPoint innerPoint(track->innerPosition().x(), track->innerPosition().y(), track->innerPosition().z());
1336  GlobalVector innerVec (track->innerMomentum().x(), track->innerMomentum().y(), track->innerMomentum().z());
1337 
1338  FreeTrajectoryState recoStart(innerPoint, innerVec, track->charge(), &*theBField);
1339 
1340  return recoStart;
1341 }
edm::ESHandle< MagneticField > theBField
double L1MuonRecoTreeProducer::match_trigger ( std::vector< int > &  trigIndices,
const trigger::TriggerObjectCollection trigObjs,
edm::Handle< trigger::TriggerEvent > &  triggerEvent,
const reco::Muon mu 
)

Definition at line 248 of file L1MuonRecoTreeProducer.cc.

References deltaR(), hltConfig_, HLTConfigProvider::moduleLabels(), HLTConfigProvider::size(), and triggerProcessLabel_.

Referenced by analyze().

252 {
253  double matchDeltaR = 9999;
254 
255  for(size_t iTrigIndex = 0; iTrigIndex < trigIndices.size(); ++iTrigIndex) {
256  int triggerIndex = trigIndices[iTrigIndex];
257  const std::vector<std::string> moduleLabels(hltConfig_.moduleLabels(triggerIndex));
258  // find index of the last module:
259  const unsigned moduleIndex = hltConfig_.size(triggerIndex)-2;
260  // find index of HLT trigger name:
261  const unsigned hltFilterIndex = triggerEvent->filterIndex( edm::InputTag ( moduleLabels[moduleIndex], "", triggerProcessLabel_ ) );
262 
263  if (hltFilterIndex < triggerEvent->sizeFilters()) {
264  const trigger::Keys triggerKeys(triggerEvent->filterKeys(hltFilterIndex));
265  const trigger::Vids triggerVids(triggerEvent->filterIds(hltFilterIndex));
266 
267  const unsigned nTriggers = triggerVids.size();
268  for (size_t iTrig = 0; iTrig < nTriggers; ++iTrig) {
269  // loop over all trigger objects:
270  const trigger::TriggerObject trigObject = trigObjs[triggerKeys[iTrig]];
271 
272  double dRtmp = deltaR( mu, trigObject );
273 
274  if ( dRtmp < matchDeltaR ) {
275  matchDeltaR = dRtmp;
276  }
277 
278  } // loop over different trigger objects
279  } // if trigger is in event (should apply hltFilter with used trigger...)
280  } // loop over muon candidates
281 
282  return matchDeltaR;
283 }
unsigned int size() const
number of trigger paths in trigger table
Single trigger physics object (e.g., an isolated muon)
Definition: TriggerObject.h:22
const std::vector< std::string > & moduleLabels(unsigned int trigger) const
label(s) of module(s) on a trigger path
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::vector< size_type > Keys
std::vector< int > Vids
TrajectoryStateOnSurface L1MuonRecoTreeProducer::surfExtrapTrkSam ( reco::TrackRef  track,
double  z 
)

Definition at line 1316 of file L1MuonRecoTreeProducer.cc.

References Plane::build(), freeTrajStateMuon(), TrajectoryStateOnSurface::isValid(), propagatorAlong, propagatorOpposite, and makeMuonMisalignmentScenario::rot.

Referenced by analyze().

1317 {
1318  Plane::PositionType pos(0, 0, z);
1320  Plane::PlanePointer myPlane = Plane::build(pos, rot);
1321 
1322  FreeTrajectoryState recoStart = freeTrajStateMuon(track);
1323  TrajectoryStateOnSurface recoProp;
1324  recoProp = propagatorAlong->propagate(recoStart, *myPlane);
1325  if (!recoProp.isValid()) {
1326  recoProp = propagatorOpposite->propagate(recoStart, *myPlane);
1327  }
1328  return recoProp;
1329 }
FreeTrajectoryState freeTrajStateMuon(reco::TrackRef track)
static PlanePointer build(Args &&...args)
Definition: Plane.h:33
edm::ESHandle< Propagator > propagatorOpposite
edm::ESHandle< Propagator > propagatorAlong

Member Data Documentation

edm::ESHandle<CSCGeometry> L1MuonRecoTreeProducer::cscGeom
private

Definition at line 164 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze().

edm::ESHandle<DTGeometry> L1MuonRecoTreeProducer::dtGeom
private

Definition at line 168 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze().

edm::Service<TFileService> L1MuonRecoTreeProducer::fs_
private

Definition at line 187 of file L1MuonRecoTreeProducer.cc.

Referenced by L1MuonRecoTreeProducer().

HLTConfigProvider L1MuonRecoTreeProducer::hltConfig_
private

Definition at line 154 of file L1MuonRecoTreeProducer.cc.

Referenced by beginRun(), and match_trigger().

std::vector<int> L1MuonRecoTreeProducer::isoTriggerIndices_
private

Definition at line 151 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and beginRun().

std::vector<std::string> L1MuonRecoTreeProducer::isoTriggerNames_
private

Definition at line 148 of file L1MuonRecoTreeProducer.cc.

Referenced by beginRun(), and L1MuonRecoTreeProducer().

unsigned L1MuonRecoTreeProducer::maxMuon_
private

Definition at line 138 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

unsigned L1MuonRecoTreeProducer::maxRpcHit_
private

Definition at line 139 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

L1Analysis::L1AnalysisRecoMuon* L1MuonRecoTreeProducer::muon

Definition at line 130 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), endJob(), and L1MuonRecoTreeProducer().

L1Analysis::L1AnalysisRecoMuonDataFormat* L1MuonRecoTreeProducer::muonData
edm::InputTag L1MuonRecoTreeProducer::muonTag_
private

Definition at line 195 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

edm::ESHandle<Propagator> L1MuonRecoTreeProducer::propagatorAlong
private

Definition at line 181 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), cylExtrapTrkSam(), and surfExtrapTrkSam().

edm::ESHandle<Propagator> L1MuonRecoTreeProducer::propagatorOpposite
private

Definition at line 182 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), cylExtrapTrkSam(), and surfExtrapTrkSam().

edm::ESHandle<RPCGeometry> L1MuonRecoTreeProducer::rpcGeom
private

Definition at line 171 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze().

L1Analysis::L1AnalysisRecoRpcHit* L1MuonRecoTreeProducer::rpcHit

Definition at line 133 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

L1Analysis::L1AnalysisRecoRpcHitDataFormat* L1MuonRecoTreeProducer::rpcHitData

Definition at line 134 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

edm::InputTag L1MuonRecoTreeProducer::rpcHitTag_
private

Definition at line 196 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

bool L1MuonRecoTreeProducer::runOnPostLS1_
private

Definition at line 192 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

edm::ESHandle<MagneticField> L1MuonRecoTreeProducer::theBField
private

Definition at line 174 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and freeTrajStateMuon().

edm::ESHandle<GlobalTrackingGeometry> L1MuonRecoTreeProducer::theTrackingGeometry
private

Definition at line 177 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze().

TTree* L1MuonRecoTreeProducer::tree_
private

Definition at line 190 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

std::vector<int> L1MuonRecoTreeProducer::triggerIndices_
private

Definition at line 152 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and beginRun().

bool L1MuonRecoTreeProducer::triggerMatching_
private

Definition at line 145 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), beginRun(), and L1MuonRecoTreeProducer().

double L1MuonRecoTreeProducer::triggerMaxDeltaR_
private

Definition at line 153 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().

std::vector<std::string> L1MuonRecoTreeProducer::triggerNames_
private

Definition at line 149 of file L1MuonRecoTreeProducer.cc.

Referenced by beginRun(), and L1MuonRecoTreeProducer().

std::string L1MuonRecoTreeProducer::triggerProcessLabel_
private
edm::InputTag L1MuonRecoTreeProducer::triggerSummaryLabel_
private

Definition at line 146 of file L1MuonRecoTreeProducer.cc.

Referenced by analyze(), and L1MuonRecoTreeProducer().