CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
AlCaHOCalibProducer Class Reference

#include <Calibration/AlCaHOCalibProducer/src/AlCaHOCalibProducer.cc>

Inheritance diagram for AlCaHOCalibProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef Basic3DVector< float > DirectionType
 
typedef Basic3DVector< float > PositionType
 
typedef Basic3DVector< float > RotationType
 
- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 AlCaHOCalibProducer (const edm::ParameterSet &)
 
 ~AlCaHOCalibProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Types

typedef math::Error< 5 >::type CovarianceMatrix
 

Private Member Functions

void beginJob () override
 
void beginRun (edm::Run const &, edm::EventSetup const &) override
 
void endJob () override
 
void fillHOStore (const reco::TrackRef &ncosm, HOCalibVariables &tmpHOCalib, std::unique_ptr< HOCalibVariableCollection > &hostore, int Noccu_old, int indx, edm::Handle< reco::TrackCollection > cosmicmuon, edm::View< reco::Muon >::const_iterator muon1, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
void findHOEtaPhi (int iphsect, int &ietaho, int &iphiho)
 
FreeTrajectoryState getFreeTrajectoryState (const reco::Track &tk, const MagneticField *field, int itag, bool dir)
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::map< std::string, bool > fired
 
edm::ESHandle< HcalSeverityLevelComputerhcalSevLvlComputerHndl
 
TH2F * ho_occupency [5]
 
int iring
 
float localxhor0
 
float localxhor1
 
float localyhor0
 
float localyhor1
 
bool m_cosmic
 
int m_endTS
 
bool m_hbinfo
 
bool m_occupancy
 
double m_sigma
 
int m_startTS
 
edm::InputTag muonTags_
 
const int ncidmx = 5
 
const int netabin = 16
 
const int netamx = 32
 
int Nevents
 
int Noccu
 
const int nphimx = 72
 
int nRuns
 
unsigned int Ntp
 
const double rHOL0 = 382.0
 
const double rHOL1 = 407.0
 
const HcalChannelQualitytheHcalChStatus
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
edm::EDGetTokenT< LumiScalersCollectiontok_lumi_
 
edm::EDGetTokenT< edm::View< reco::Muon > > tok_muons_
 
edm::EDGetTokenT< reco::TrackCollectiontok_muonsCosmic_
 
edm::EDGetTokenT< CaloTowerCollectiontok_tower_
 
edm::EDGetTokenT< reco::VertexCollectiontok_vertex_
 
float xhor0
 
float xhor1
 
float yhor0
 
float yhor1
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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

change magnetic field inside ../data/HOCosmicCalib_RecoLocalMuon.cff ../data/HOCosmicCalib_RecoLocalTracker.cff

Description: <one line="" class="" summary>="">

Implementation: <Notes on="" implementation>=""> Missing towers : eta=5, phi=18-19 : eta = -5, phi =11-14

HO tile sizes Ring +-2 : width Tray 6:404.6, 5&4:347.6, 3:352.6, 2:364.6, 1:315.6 (phi ordering is opposite) lenght Tile 1:420.1, 2:545.1, 3:583.3, 4:626.0, 5:335.5

    (five tiles, 1 is close to Ring 1 and 5 is towardslc endcap)

Ring +-1 : width Tray 6:404.6, 5&4:347.6, 3:352.6, 2:364.6, 1:315.6 (same as Ring+-2) lenght Tile 1:391.5, 2:394.2, 3:411.0, 4:430.9, 5:454.0, 6:426.0 (1: near R0 and 6 near R2)

Ring 0 L1 : Width Tray (6:290.6, 5&4:345.6, 3:350.6, 2:362.6, 1:298.6 lenght 1:351.2, 2:353.8, 3:359.2, 4:189.1 (4 is towards Ring1)

Ring 0 L0 : Width Tray 6:266.6, 5&4:325.6, 3:330.6, 2:341.6, 1:272.6 length 1:331.5, 2:334.0, 3:339.0, 4:248.8 (4 is towards Ring1)

Definition at line 154 of file AlCaHOCalibProducer.cc.

Member Typedef Documentation

Definition at line 219 of file AlCaHOCalibProducer.cc.

Definition at line 160 of file AlCaHOCalibProducer.cc.

Definition at line 159 of file AlCaHOCalibProducer.cc.

Definition at line 161 of file AlCaHOCalibProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 247 of file AlCaHOCalibProducer.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ho_occupency, m_cosmic, m_hbinfo, m_occupancy, m_sigma, TFileService::make(), muonTags_, netamx, nphimx, fftjetcommon_cfi::title, tok_hbhe_, tok_ho_, tok_lumi_, tok_muons_, tok_muonsCosmic_, tok_tower_, and tok_vertex_.

247  {
248  //register your products
249 
250  m_hbinfo = iConfig.getUntrackedParameter<bool>("hbinfo", false);
251  m_sigma = iConfig.getUntrackedParameter<double>("sigma", 0.05);
252  m_occupancy = iConfig.getUntrackedParameter<bool>("plotOccupancy", false);
253  m_cosmic = iConfig.getUntrackedParameter<bool>("CosmicData", false);
254 
255  // keep InputTag muonTags_ since it is used below. - cowden
256  muonTags_ = iConfig.getUntrackedParameter<edm::InputTag>("muons");
257  tok_muonsCosmic_ = consumes<reco::TrackCollection>(muonTags_);
258  tok_muons_ = consumes<edm::View<reco::Muon> >(muonTags_);
259  tok_vertex_ = consumes<reco::VertexCollection >(iConfig.getParameter<edm::InputTag>("vertexTags"));
260  // tok_lumi_ = consumes<LumiDetails ,edm::InLumi>(iConfig.getParameter<edm::InputTag>("lumiTags"));
261  tok_lumi_ = consumes<LumiScalersCollection>(iConfig.getParameter<edm::InputTag>("lumiTags"));
262  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
263  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
264  tok_tower_ = consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("towerInput"));
265 
266  produces<HOCalibVariableCollection>("HOCalibVariableCollection").setBranchAlias("HOCalibVariableCollection");
267 
268  if (m_occupancy) {
270 
271  char title[200];
272 
273  for (int ij=0; ij<5; ij++) {
274  sprintf(title, "ho_occupency (>%i #sigma)", ij+2);
275  ho_occupency[ij] = fs->make<TH2F>(title, title, netamx+1, -netamx-0.5, netamx/2+0.5, nphimx, 0.5, nphimx+0.5);
276  }
277  }
278 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
T * make(const Args &...args) const
make new ROOT object
Definition: TFileService.h:64
edm::EDGetTokenT< reco::TrackCollection > tok_muonsCosmic_
edm::EDGetTokenT< LumiScalersCollection > tok_lumi_
edm::EDGetTokenT< reco::VertexCollection > tok_vertex_
edm::EDGetTokenT< edm::View< reco::Muon > > tok_muons_
edm::EDGetTokenT< HORecHitCollection > tok_ho_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
AlCaHOCalibProducer::~AlCaHOCalibProducer ( )
override

Definition at line 281 of file AlCaHOCalibProducer.cc.

282 {
283 
284  // do anything here that needs to be done at desctruction time
285  // (e.g. close files, deallocate resources etc.)
286 }

Member Function Documentation

void AlCaHOCalibProducer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 372 of file AlCaHOCalibProducer.cc.

References Nevents, Noccu, and nRuns.

373 {
374  Nevents = 0;
375  nRuns = 0;
376  Noccu = 0;
377 }
void AlCaHOCalibProducer::beginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 394 of file AlCaHOCalibProducer.cc.

References edm::EventSetup::get(), edm::ESHandle< T >::product(), and theHcalChStatus.

395  {
396 
397  // HCAL channel status map ****************************************
398  edm::ESHandle<HcalChannelQuality> hcalChStatus;
399  es.get<HcalChannelQualityRcd>().get("withTopo", hcalChStatus );
400  theHcalChStatus = hcalChStatus.product();
401 }
const HcalChannelQuality * theHcalChStatus
T const * product() const
Definition: ESHandle.h:86
void AlCaHOCalibProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 380 of file AlCaHOCalibProducer.cc.

References ho_occupency, m_occupancy, SiStripPI::max, Nevents, and Noccu.

Referenced by o2olib.O2ORunMgr::executeJob().

380  {
381  if (m_occupancy) {
382  for (int ij=0; ij<5; ij++) {
383  ho_occupency[ij]->Scale(1./std::max(1,Noccu));
384  }
385  }
386  edm::LogInfo("HOCalib") <<" AlCaHOCalibProducer processed event "<< Nevents;
387 }
void AlCaHOCalibProducer::fillHOStore ( const reco::TrackRef ncosm,
HOCalibVariables tmpHOCalib,
std::unique_ptr< HOCalibVariableCollection > &  hostore,
int  Noccu_old,
int  indx,
edm::Handle< reco::TrackCollection cosmicmuon,
edm::View< reco::Muon >::const_iterator  muon1,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)
private

Definition at line 404 of file AlCaHOCalibProducer.cc.

References funct::abs(), angle(), anyDirection, SteppingHelixPropagator::applyRadX0Correction(), edm::SortedCollection< T, SORT >::begin(), HOCalibVariables::caloen, ALCARECOTkAlJpsiMuMu_cff::charge, HOCalibVariables::chisq, funct::cos(), Vector3DBase< T, FrameTag >::cross(), dot(), HOCalibVariables::ecal03, edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), findHOEtaPhi(), edm::EventSetup::get(), edm::Event::getByToken(), CaloSubdetectorGeometry::getClosestCell(), getFreeTrajectoryState(), HcalSeverityLevelComputer::getSeverityLevel(), CaloGeometry::getSubdetectorGeometry(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), reco::MuonEnergy::had, reco::MuonIsolation::hadEt, HOCalibVariables::hbhesig, DetId::Hcal, HOCalibVariables::hcal03, HcalOuter, hcalSevLvlComputerHndl, ho_occupency, HOCalibVariables::hoang, HOCalibVariables::hocorsig, HOCalibVariables::hocro, HOCalibVariables::hodx, HOCalibVariables::hody, HOCalibVariables::hoflag, HOCalibVariables::hosig, HOCalibVariables::htime, HORecHit::id(), HcalDetId::ieta(), createfilelist::int, HcalDetId::iphi(), iring, HOCalibVariables::isect, HOCalibVariables::isect2, SteppingHelixStateInfo::isValid(), localxhor0, localxhor1, localyhor0, localyhor1, m_cosmic, m_hbinfo, m_occupancy, m_sigma, HOCalibVariables::momatho, SteppingHelixStateInfo::momentum(), HOCalibVariables::ndof, netabin, HOCalibVariables::nmuon, Noccu, nphimx, HOCalibVariables::pherr, Basic3DVector< T >::phi(), pi, PlaneBuilder::plane(), SteppingHelixStateInfo::position(), edm::ESHandle< T >::product(), SteppingHelixPropagator::propagate(), rHOL0, rHOL1, makeMuonMisalignmentScenario::rot, SteppingHelixPropagator::setMaterialMode(), funct::sin(), mathSSE::sqrt(), reco::MuonIsolation::sumPt, theHcalChStatus, HOCalibVariables::therr, Basic3DVector< T >::theta(), HOCalibVariables::tkpt03, tok_hbhe_, tok_ho_, tok_tower_, HOCalibVariables::trkdr, HOCalibVariables::trkdz, HOCalibVariables::trkmm, HOCalibVariables::trkph, HOCalibVariables::trkth, HOCalibVariables::trkvx, HOCalibVariables::trkvy, HOCalibVariables::trkvz, PV3DBase< T, PVType, FrameType >::x(), xhor0, xhor1, geometryCSVtoXML::xx, PV3DBase< T, PVType, FrameType >::y(), yhor0, yhor1, geometryCSVtoXML::yy, and PV3DBase< T, PVType, FrameType >::z().

Referenced by produce().

411  {
412 
414  iSetup.get<CaloGeometryRecord>().get(pG);
415  const CaloGeometry* geo = pG.product();
416  const CaloSubdetectorGeometry* gHO =
418 
419  // Get Hcal Severity Level Computer, so that the severity of each rechit flag/status may be determined
420  // edm::ESHandle<HcalSeverityLevelComputer> hcalSevLvlComputerHndl;
422  const HcalSeverityLevelComputer* hcalSevLvlComputer = hcalSevLvlComputerHndl.product();
423 
424  int charge = ncosm->charge();
425 
426  double innerr = (*ncosm).innerPosition().Perp2();
427  double outerr = (*ncosm).outerPosition().Perp2();
428  int iiner = (innerr <outerr) ? 1 : 0;
429 
430  //---------------------------------------------------
431  // in_to_out Dir in_to_out Dir
432  // StandAlone ^ ^ Cosmic ^ |
433  // | | | v
434  //---------------------------------------------------Y=0
435  // StandAlone | | Cosmic ^ |
436  // v v | v
437  //----------------------------------------------------
438 
439  double posx, posy, posz;
440  double momx, momy, momz;
441 
442  if (iiner==1) {
443  posx = (*ncosm).innerPosition().X();
444  posy = (*ncosm).innerPosition().Y();
445  posz = (*ncosm).innerPosition().Z();
446 
447  momx = (*ncosm).innerMomentum().X();
448  momy = (*ncosm).innerMomentum().Y();
449  momz = (*ncosm).innerMomentum().Z();
450 
451  } else {
452  posx = (*ncosm).outerPosition().X();
453  posy = (*ncosm).outerPosition().Y();
454  posz = (*ncosm).outerPosition().Z();
455 
456  momx = (*ncosm).outerMomentum().X();
457  momy = (*ncosm).outerMomentum().Y();
458  momz = (*ncosm).outerMomentum().Z();
459  }
460 
461 
462  PositionType trkpos(posx, posy, posz);
463 
464  CLHEP::Hep3Vector tmpmuon3v(posx, posy, posz);
465  CLHEP::Hep3Vector tmpmuondir(momx, momy, momz);
466 
467  bool samedir = (tmpmuon3v.dot(tmpmuondir) >0) ? true : false;
468  for (int ij=0; ij<3; ij++) {tmpHOCalib.caloen[ij] = 0.0;}
469  int inearbymuon = 0;
470  localxhor0 = localyhor0 = 20000; //GM for 22OCT07 data
471 
472  if (m_cosmic) {
473  int ind(0);
474  for(reco::TrackCollection::const_iterator ncosmcor=cosmicmuon->begin();
475  ncosmcor != cosmicmuon->end(); ++ncosmcor,++ind) {
476  if (indx==ind) continue;
477  CLHEP::Hep3Vector tmpmuon3vcor;
478  CLHEP::Hep3Vector tmpmom3v;
479  if (iiner==1) {
480  tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).innerPosition().X(),(*ncosmcor).innerPosition().Y(),(*ncosmcor).innerPosition().Z());
481  tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).innerMomentum().X(),(*ncosmcor).innerMomentum().Y(),(*ncosmcor).innerMomentum().Z());
482  } else {
483  tmpmuon3vcor = CLHEP::Hep3Vector((*ncosmcor).outerPosition().X(),(*ncosmcor).outerPosition().Y(),(*ncosmcor).outerPosition().Z());
484  tmpmom3v = CLHEP::Hep3Vector((*ncosmcor).outerMomentum().X(),(*ncosmcor).outerMomentum().Y(),(*ncosmcor).outerMomentum().Z());
485 
486  }
487 
488  if (tmpmom3v.mag()<0.2 || (*ncosmcor).ndof()<5) continue;
489 
490  double angle = tmpmuon3v.angle(tmpmuon3vcor);
491  if (angle < 7.5*CLHEP::deg) {inearbymuon=1;} // break;}
492 
493  // if (muonTagsi_.label() =="cosmicMuons") {
494  if (angle <7.5*CLHEP::deg) { tmpHOCalib.caloen[0] +=1.;}
495  if (angle <15.0*CLHEP::deg) { tmpHOCalib.caloen[1] +=1.;}
496  if (angle <35.0*CLHEP::deg) { tmpHOCalib.caloen[2] +=1.;}
497  }
498  } else {
499  // if (muonTags_.label() =="muons") {
501  iEvent.getByToken(tok_tower_, calotower);
502 
503  for (CaloTowerCollection::const_iterator calt = calotower->begin();
504  calt !=calotower->end(); calt++) {
505  //CMSSW_2_1_x const math::XYZVector towermom = (*calt).momentum();
506  double ith = (*calt).momentum().theta();
507  double iph = (*calt).momentum().phi();
508 
509  CLHEP::Hep3Vector calo3v(sin(ith)*cos(iph), sin(ith)*sin(iph), cos(ith));
510 
511  double angle = tmpmuon3v.angle(calo3v);
512 
513  if (angle < 7.5*CLHEP::deg) {tmpHOCalib.caloen[0] += calt->emEnergy()+calt->hadEnergy();}
514  if (angle < 15*CLHEP::deg) {tmpHOCalib.caloen[1] += calt->emEnergy()+calt->hadEnergy();}
515  if (angle < 35*CLHEP::deg) {tmpHOCalib.caloen[2] += calt->emEnergy()+calt->hadEnergy();}
516  }
517  }
518  if ((m_cosmic) || (tmpHOCalib.caloen[0] <=10.0)) {
519 
520  GlobalPoint glbpt(posx, posy, posz);
521 
522  double mom = sqrt(momx*momx + momy*momy +momz*momz);
523 
524  momx /= mom;
525  momy /= mom;
526  momz /= mom;
527 
528  DirectionType trkdir(momx, momy, momz);
529 
530  tmpHOCalib.trkdr = (*ncosm).d0();
531  tmpHOCalib.trkdz = (*ncosm).dz();
532  tmpHOCalib.nmuon = (m_cosmic) ? cosmicmuon->size() : 1;
533  tmpHOCalib.trkvx = glbpt.x();
534  tmpHOCalib.trkvy = glbpt.y();
535  tmpHOCalib.trkvz = glbpt.z();
536  tmpHOCalib.trkmm = mom*charge;
537  tmpHOCalib.trkth = trkdir.theta();
538  tmpHOCalib.trkph = trkdir.phi();
539  tmpHOCalib.isect2 = -2;
540  tmpHOCalib.isect = -2;
541  tmpHOCalib.hodx = -100;
542  tmpHOCalib.hody = -100;
543  tmpHOCalib.hoang = -2.0;
544  tmpHOCalib.momatho = -2;
545  tmpHOCalib.ndof = (inearbymuon ==0) ? (int)(*ncosm).ndof() : -(int)(*ncosm).ndof();
546  tmpHOCalib.chisq = (*ncosm).normalizedChi2(); // max(1.,tmpHOCalib.ndof);
547  if (!m_cosmic) {
548  reco::MuonEnergy muonenr = muon1->calEnergy();
549  reco::MuonIsolation iso03 = muon1->isolationR03();
550  reco::MuonIsolation iso05 = muon1->isolationR05();
551 
552  tmpHOCalib.tkpt03 = iso03.sumPt;
553  tmpHOCalib.ecal03 = iso05.sumPt; // iso03.emEt+muonenr.em;
554  tmpHOCalib.hcal03 = iso03.hadEt+muonenr.had;
555  }
556  tmpHOCalib.therr = 0.;
557  tmpHOCalib.pherr = 0.;
558  if (iiner==1) {
559  reco::TrackBase::CovarianceMatrix innercov = (*ncosm).innerStateCovariance();
560  tmpHOCalib.therr = innercov(1,1); //thetaError();
561  tmpHOCalib.pherr = innercov(2,2); //phi0Error();
562  } else {
563  reco::TrackBase::CovarianceMatrix outercov = (*ncosm).outerStateCovariance();
564  tmpHOCalib.therr = outercov(1,1); //thetaError();
565  tmpHOCalib.pherr = outercov(2,2); //phi0Error();
566  }
567  edm::ESHandle<MagneticField> theMagField;
568  iSetup.get<IdealMagneticFieldRecord>().get(theMagField );
569 
570  SteppingHelixPropagator myHelix(&*theMagField,anyDirection);
571  myHelix.setMaterialMode(false);
572  myHelix.applyRadX0Correction(true);
573  double phiho = trkpos.phi();
574  if (phiho<0) phiho +=CLHEP::twopi;
575 
576  int iphisect_dt=int(6*(phiho+10.0*CLHEP::deg)/CLHEP::pi); //for u 18/12/06
577  if (iphisect_dt>=12) iphisect_dt=0;
578 
579  int iphisect = -1;
580  bool ipath = false;
581  for (int kl = 0; kl<=2; kl++) {
582 
583  int iphisecttmp = (kl<2) ? iphisect_dt + kl : iphisect_dt - 1;
584  if (iphisecttmp <0) iphisecttmp = 11;
585  if (iphisecttmp >=12) iphisecttmp = 0;
586 
587  double phipos = iphisecttmp*CLHEP::pi/6.;
588  double phirot = phipos;
589 
590  GlobalVector xLocal(-sin(phirot), cos(phirot), 0.);
591  GlobalVector yLocal(0., 0., 1.);
592  GlobalVector zLocal = xLocal.cross(yLocal).unit();
593  // GlobalVector zLocal(cos(phirot), sin(phirot), 0.0);
594 
595 
596  FreeTrajectoryState freetrajectorystate_ = getFreeTrajectoryState(*ncosm,&(*theMagField), iiner, samedir);
597 
598  Surface::RotationType rot(xLocal, yLocal, zLocal);
599 
600  for (int ik=1; ik>=0; ik--) { //propagate track in two HO layers
601 
602  double radial = rHOL1;
603  if (ik==0) radial = rHOL0;
604 
605  Surface::PositionType pos(radial*cos(phipos), radial*sin(phipos), 0.);
607 
608  auto aPlane2 = new Plane(pos,rot);
609 
610  SteppingHelixStateInfo steppingHelixstateinfo_;
611  myHelix.propagate(SteppingHelixStateInfo(freetrajectorystate_), (*aPlane2), steppingHelixstateinfo_);
612 
613  if (steppingHelixstateinfo_.isValid()) {
614 
615  GlobalPoint hotrkpos2xx(steppingHelixstateinfo_.position().x(), steppingHelixstateinfo_.position().y(), steppingHelixstateinfo_.position().z());
616 
617  if (ik==1) {
618  HcalDetId ClosestCell = (HcalDetId) gHO->getClosestCell(hotrkpos2xx);
619  int ixeta = ClosestCell.ieta();
620  int ixphi = ClosestCell.iphi();
621  tmpHOCalib.isect2 = 100*std::abs(ixeta+50)+std::abs(ixphi);
622  }
623 
624 
625  GlobalVector hotrkpos2(steppingHelixstateinfo_.position().x(), steppingHelixstateinfo_.position().y(), steppingHelixstateinfo_.position().z());
626  CLHEP::Hep3Vector hotrkdir2(steppingHelixstateinfo_.momentum().x(), steppingHelixstateinfo_.momentum().y(),steppingHelixstateinfo_.momentum().z());
627 
628  LocalVector lclvt0 = (*aPlane).toLocal(hotrkpos2);
629 
630  double xx = lclvt0.x();
631  double yy = lclvt0.y();
632 
633  if (ik ==1) {
634  if ((std::abs(yy) < 130 && xx >-64.7 && xx <138.2) //Ring-0
635  ||(std::abs(yy) > 130 && std::abs(yy) <700 && xx >-76.3 && xx <140.5)) { //Ring +-1,2
636  ipath = true; //Only look for tracks which as hits in layer 1
637  iphisect = iphisecttmp;
638  }
639  }
640 
641  if (iphisect != iphisecttmp) continue; //Look for ring-0 only when ring1 is accepted for that sector
642 
643  switch (ik)
644  {
645  case 0 :
646  xhor0 = xx; //lclvt0.x();
647  yhor0 = yy; //lclvt0.y();
648  break;
649  case 1 :
650  xhor1 = xx; //lclvt0.x();
651  yhor1 = yy; //lclvt0.y();
652  tmpHOCalib.momatho = hotrkdir2.mag();
653  tmpHOCalib.hoang = CLHEP::Hep3Vector(zLocal.x(),zLocal.y(),zLocal.z()).dot(hotrkdir2.unit());
654  break;
655  default : break;
656  }
657  } else {
658  break;
659  }
660  }
661  if (ipath) break;
662  }
663  if (ipath) { //If muon crossed HO laeyrs
664 
665  int ietaho = 50;
666  int iphiho = -1;
667 
668  for (int ij=0; ij<9; ij++) {tmpHOCalib.hosig[ij]=-100.0;}
669  for (int ij=0; ij<18; ij++) {tmpHOCalib.hocorsig[ij]=-100.0;}
670  for (int ij=0; ij<9; ij++) {tmpHOCalib.hbhesig[ij]=-100.0;}
671  tmpHOCalib.hocro = -100;
672  tmpHOCalib.htime = -1000;
673 
674  int isect = 0;
675 
676  findHOEtaPhi(iphisect, ietaho, iphiho);
677 
678  if (ietaho !=0 && iphiho !=0 && std::abs(iring)<=2) { //Muon passed through a tower
679  isect = 100*std::abs(ietaho+50)+std::abs(iphiho);
680  if (std::abs(ietaho) >=netabin || iphiho<0) isect *=-1; //Not extrapolated to any tower
681  if (std::abs(ietaho) >=netabin) isect -=1000000; //not matched with eta
682  if (iphiho<0) isect -=2000000; //not matched with phi
683  tmpHOCalib.isect = isect;
684 
685  tmpHOCalib.hodx = localxhor1;
686  tmpHOCalib.hody = localyhor1;
687 
688  if (iring==0) {
689  tmpHOCalib.hocorsig[8] = localxhor0;
690  tmpHOCalib.hocorsig[9] = localyhor0;
691  }
692 
693  int etamn=-4;
694  int etamx=4;
695  if (iring==1) {etamn=5; etamx = 10;}
696  if (iring==2) {etamn=11; etamx = 16;}
697  if (iring==-1){etamn=-10; etamx = -5;}
698  if (iring==-2){etamn=-16; etamx = -11;}
699 
700  int phimn = 1;
701  int phimx = 2;
702  if (iring ==0) {
703  phimx =2*int((iphiho+1)/2.);
704  phimn = phimx - 1;
705  } else {
706  phimn = 3*int((iphiho+1)/3.) - 1;
707  phimx = phimn + 2;
708  }
709 
710  if (phimn <1) phimn += nphimx;
711  if (phimx >72) phimx -= nphimx;
712 
713  if (m_hbinfo) {
714  for (int ij=0; ij<9; ij++) {tmpHOCalib.hbhesig[ij]=-100.0;}
715 
716  edm::Handle<HBHERecHitCollection> hbheht;// iEvent.getByType(hbheht);
717  iEvent.getByToken(tok_hbhe_,hbheht);
718 
719  if (!(*hbheht).empty()) {
720  if((*hbheht).empty()) throw (int)(*hbheht).size();
721 
722  for (HBHERecHitCollection::const_iterator jk=(*hbheht).begin(); jk!=(*hbheht).end(); jk++){
723  HcalDetId id =(*jk).id();
724  int tmpeta= id.ieta();
725  int tmpphi= id.iphi();
726 
727  int deta = tmpeta-ietaho;
728  if (tmpeta<0 && ietaho>0) deta += 1;
729  if (tmpeta>0 && ietaho<0) deta -= 1;
730 
731  // if (tmpeta==-1 && ietaho== 1) deta = -1;
732  // if (tmpeta== 1 && ietaho==-1) deta = 1;
733 
734  int dphi = tmpphi-iphiho;
735  if (dphi>nphimx/2) { dphi -=nphimx;}
736  if (dphi<-nphimx/2) { dphi +=nphimx;}
737 
738  // if (phimn >phimx) {
739  // if (dphi==71) dphi=-1;
740  // if (dphi==-71) dphi=1;
741  // }
742 
743  if (m_occupancy) {
744  float signal = (*jk).energy();
745  // int tmpeta1 = (tmpeta>0) ? tmpeta -1 : -tmpeta +14;
746  if (signal >-100 && Noccu == Noccu_old) {
747  for (int ij=0; ij<5; ij++) {
748  if (signal >(ij+2)*m_sigma) {
749  ho_occupency[ij]->Fill(tmpeta, tmpphi);
750  }
751  }
752  }
753  }
754 
755  int ipass2 = (std::abs(deta) <=1 && std::abs(dphi)<=1) ? 1 : 0; //NEED correction in full CMS detector
756  if ( ipass2 ==0 ) continue;
757 
758  float signal = (*jk).energy();
759 
760  if (3*(deta+1)+dphi+1<9) tmpHOCalib.hbhesig[3*(deta+1)+dphi+1] = signal;
761  }
762  }
763  } //m_hbinfo #endif
764 
766  iEvent.getByToken(tok_ho_,hoht);
767 
768  if (!(*hoht).empty()) {
769  for (HORecHitCollection::const_iterator jk=(*hoht).begin(); jk!=(*hoht).end(); jk++){
770  HcalDetId id =(*jk).id();
771  int tmpeta= id.ieta();
772  int tmpphi= id.iphi();
773 
774  int ipass1 =0;
775  if (tmpeta >=etamn && tmpeta <=etamx) {
776  if (phimn < phimx) {
777  ipass1 = (tmpphi >=phimn && tmpphi <=phimx ) ? 1 : 0;
778  } else {
779  ipass1 = (tmpphi==71 || tmpphi ==72 || tmpphi==1) ? 1 : 0;
780  }
781  }
782 
783  int deta = tmpeta-ietaho;
784  int dphi = tmpphi -iphiho;
785 
786  if (tmpeta<0 && ietaho>0) deta += 1;
787  if (tmpeta>0 && ietaho<0) deta -= 1;
788  // if (tmpeta==-1 && ietaho== 1) deta = -1;
789  // if (tmpeta== 1 && ietaho==-1) deta = 1;
790 
791  if (dphi>nphimx/2) { dphi -=nphimx;}
792  if (dphi<-nphimx/2) { dphi +=nphimx;}
793  // if (phimn>phimx) {
794  // if (dphi==71) dphi=-1;
795  // if (dphi==-71) dphi=1;
796  // }
797 
798  float signal = (*jk).energy();
799 
800  int ipass2 = (std::abs(deta) <=1 && std::abs(dphi)<=1) ? 1 : 0;
801 
802  if (ipass1 ==0 && ipass2 ==0 ) continue;
803 
804  if (ipass1 ==1) {
805  int tmpdph = tmpphi-phimn;
806  if (tmpdph<0) tmpdph = 2; //only case of iphi==1, where phimn=71
807 
808  int ilog = 2*(tmpeta-etamn)+tmpdph;
809  if (iring !=0) {
810  if (iring >0) {
811  ilog = 3*(tmpeta-etamn)+tmpdph; //Again CMS correction
812  } else {
813  ilog = 3*(etamx-tmpeta)+tmpdph; //Again CMS correction
814  }
815  }
816  if (ilog>-1 && ilog<18) {
817  tmpHOCalib.hocorsig[ilog] = signal;
818  }
819  }
820 
821  if (ipass2 ==1) {
822 
823  if (3*(deta+1)+dphi+1<9) {
824  tmpHOCalib.hosig[3*(deta+1)+dphi+1] = signal; //Again CMS azimuthal near phi 1&72
825  }
826  }
827 
828  if (deta==0 && dphi ==0) {
829  tmpHOCalib.htime = (*jk).time();
830  tmpHOCalib.hoflag = (*jk).flags();
831 
832  // Get Channel Quality information for the given detID
833  unsigned theStatusValue = theHcalChStatus->getValues(id)->getValue();
834  // Now get severity of problems for the given detID, based on the rechit flag word and the channel quality status value
835  int hitSeverity=hcalSevLvlComputer->getSeverityLevel(id, (*jk).flags(),theStatusValue);
836  tmpHOCalib.hoflag = hitSeverity;
837  int crphi = tmpphi + 6;
838  if (crphi >72) crphi -=72;
839 
840  for (HORecHitCollection::const_iterator jcr=(*hoht).begin(); jcr!=(*hoht).end(); jcr++){
841  const HORecHit reccr = (const HORecHit)(*jcr);
842  HcalDetId idcr =reccr.id();
843  int etacr= idcr.ieta();
844  int phicr= idcr.iphi();
845  if (tmpeta==etacr && crphi ==phicr) {
846 
847  tmpHOCalib.hocro = reccr.energy();
848 
849  }
850  }
851  }
852  }
853  }
854  }
855 
856  //GMA Npass++;
857  if (Noccu == Noccu_old) Noccu++;
858  hostore->push_back(tmpHOCalib);
859  } // if (ipath)
860  } // Cut on calo energy
861 }
constexpr float energy() const
Definition: CaloRecHit.h:31
float hadEt
hcal sum-Et
Definition: MuonIsolation.h:9
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
Basic3DVector< float > DirectionType
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
FreeTrajectoryState getFreeTrajectoryState(const reco::Track &tk, const MagneticField *field, int itag, bool dir)
float sumPt
sum-pt of tracks
Definition: MuonIsolation.h:7
const HcalChannelQuality * theHcalChStatus
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
ReturnType plane(const PositionType &pos, const RotationType &rot) const
Definition: PlaneBuilder.h:22
std::vector< CaloTower >::const_iterator const_iterator
T y() const
Definition: PV3DBase.h:63
const Item * getValues(DetId fId, bool throwOnFail=true) const
GlobalVector momentum() const
void findHOEtaPhi(int iphsect, int &ietaho, int &iphiho)
Definition: Plane.h:17
unsigned int hoflag
const Double_t pi
GlobalPoint position() const
T sqrt(T t)
Definition: SSEVec.h:18
Vector3DBase< typename PreciseFloatType< T, U >::Type, FrameTag > cross(const Vector3DBase< U, FrameTag > &v) const
Definition: Vector3DBase.h:119
T z() const
Definition: PV3DBase.h:64
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
int ieta() const
get the cell ieta
Definition: HcalDetId.h:155
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Basic3DVector< float > PositionType
const_iterator end() const
virtual DetId getClosestCell(const GlobalPoint &r) const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:157
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
edm::EDGetTokenT< HORecHitCollection > tok_ho_
T dot(const Basic3DVector &v) const
Scalar product, or "dot" product, with a vector of same type.
T get() const
Definition: EventSetup.h:63
uint32_t getValue() const
T x() const
Definition: PV3DBase.h:62
T const * product() const
Definition: ESHandle.h:86
edm::ESHandle< HcalSeverityLevelComputer > hcalSevLvlComputerHndl
HcalDetId id() const
get the id
Definition: HORecHit.h:21
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_
const_iterator begin() const
math::Error< dimension >::type CovarianceMatrix
5 parameter covariance matrix
Definition: TrackBase.h:77
T angle(T x1, T y1, T z1, T x2, T y2, T z2)
Definition: angle.h:11
void AlCaHOCalibProducer::findHOEtaPhi ( int  iphsect,
int &  ietaho,
int &  iphiho 
)
private

Definition at line 863 of file AlCaHOCalibProducer.cc.

References funct::abs(), iring, localxhor0, localxhor1, localyhor0, localyhor1, netabin, nphimx, xhor0, xhor1, yhor0, and yhor1.

Referenced by fillHOStore().

863  {
864 
865  //18/12/06 : use only position, not angle phi
866 
867  const double etalow[16]={ 0.025, 35.195, 70.625, 106.595, 141.565, 180.765, 220.235, 261.385, 304.525, 349.975, 410.025, 452.085, 506.645, 565.025, 627.725, 660.25};
868  const double etahgh[16]={ 35.145, 70.575, 106.545, 125.505, 180.715, 220.185, 261.335, 304.475, 349.925, 392.575, 452.035, 506.595, 564.975, 627.675, 661.075, 700.25};
869 
870  const double philow[6]={-76.27, -35.11, 0.35, 35.81, 71.77, 108.93}; //Ring+/-1 & 2
871  const double phihgh[6]={-35.81, -0.35, 35.11, 71.07, 108.23, 140.49};
872 
873  const double philow00[6]={-60.27, -32.91, 0.35, 33.61, 67.37, 102.23}; //Ring0 L0
874  const double phihgh00[6]={-33.61, -0.35, 32.91, 66.67, 101.53, 129.49};
875 
876  const double philow01[6]={-64.67, -34.91, 0.35, 35.61, 71.37, 108.33}; //Ring0 L1
877  const double phihgh01[6]={-35.61, -0.35, 34.91, 70.67, 107.63, 138.19};
878 
879  iring = -10;
880 
881  double tmpdy = std::abs(yhor1);
882  for (int ij=0; ij<netabin; ij++) {
883  if (tmpdy >etalow[ij] && tmpdy <etahgh[ij]) {
884  ietaho = ij+1;
885  float tmp1 = fabs(tmpdy-etalow[ij]);
886  float tmp2 = fabs(tmpdy-etahgh[ij]);
887 
888  localyhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
889  if (yhor1 <0) localyhor1 *=-1.;
890 
891  if (ij<4) iring =0;
892  if (ij>=4 && ij<10) iring=1;
893  if (ij>=10 && ij<netabin) iring=2;
894  break;
895  }
896  }
897 
898  int tmpphi = 0;
899  int tmpphi0 = 0;
900 
901  if (ietaho >4) { //Ring 1 and 2
902  for (int ij=0; ij<6; ij++) {
903  if (xhor1 >philow[ij] && xhor1 <phihgh[ij]) {
904  tmpphi=ij+1;
905  float tmp1 = fabs(xhor1-philow[ij]);
906  float tmp2 = fabs(xhor1-phihgh[ij]);
907  localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
908  break;
909  }
910  }
911  } else { //Ring 0
912  for (int ij=0; ij<6; ij++) {
913  if (xhor1 >philow01[ij] && xhor1 <phihgh01[ij]) {
914  tmpphi=ij+1;
915  float tmp1 = fabs(xhor1-philow01[ij]);
916  float tmp2 = fabs(xhor1-phihgh01[ij]);
917  localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
918  break;
919  }
920  }
921 
922  for (int ij=0; ij<6; ij++) {
923  if (xhor0 >philow00[ij] && xhor0 <phihgh00[ij]) {
924  tmpphi0=ij+1;
925  float tmp1 = fabs(xhor0-philow00[ij]);
926  float tmp2 = fabs(xhor0-phihgh00[ij]);
927  localxhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
928  if (tmpphi !=tmpphi0) localxhor0 +=10000.;
929  break;
930  }
931  }
932 
933  double tmpdy = std::abs(yhor0);
934  for (int ij=0; ij<4; ij++) {
935  if (tmpdy >etalow[ij] && tmpdy <etahgh[ij]) {
936  float tmp1 = fabs(tmpdy-etalow[ij]);
937  float tmp2 = fabs(tmpdy-etahgh[ij]);
938  localyhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
939  if (yhor0 <0) localyhor0 *=-1.;
940  if (ij+1 != ietaho) localyhor0 +=10000.;
941  break;
942  }
943  }
944  }
945 
946  if (tmpphi!=0) {
947  iphiho = 6*iphisect -2 + tmpphi;
948  if (iphiho <=0) iphiho +=nphimx;
949  if (iphiho >nphimx) iphiho -=nphimx;
950  }
951 
952  // isect2 = 15*iring+iphisect+1;
953 
954  if (yhor1 <0) {
955  if (std::abs(ietaho) >netabin) { //Initialised with 50
956  ietaho +=1;
957  } else {
958  ietaho *=-1;
959  }
960  // isect2 *=-1;
961  iring *=-1;
962  }
963 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
FreeTrajectoryState AlCaHOCalibProducer::getFreeTrajectoryState ( const reco::Track tk,
const MagneticField field,
int  itag,
bool  dir 
)
private

Definition at line 965 of file AlCaHOCalibProducer.cc.

References reco::TrackBase::charge(), DEFINE_FWK_MODULE, reco::Track::extra(), reco::Track::innerMomentum(), reco::Track::innerPosition(), reco::Track::outerPx(), reco::Track::outerPy(), reco::Track::outerPz(), reco::Track::outerX(), reco::Track::outerY(), and reco::Track::outerZ().

Referenced by fillHOStore().

966 {
967 
968  if (iiner ==0) {
969  GlobalPoint gpos( tk.outerX(), tk.outerY(), tk.outerZ());
970  GlobalVector gmom( tk.outerPx(), tk.outerPy(), tk.outerPz());
971  if (dir) gmom *=-1.;
972  GlobalTrajectoryParameters par( gpos, gmom, tk.charge(), field);
973  CurvilinearTrajectoryError err( tk.extra()->outerStateCovariance());
974  return FreeTrajectoryState( par, err);
975  } else {
976  GlobalPoint gpos( tk.innerPosition().X(), tk.innerPosition().Y(), tk.innerPosition().Z());
977  GlobalVector gmom( tk.innerMomentum().X(), tk.innerMomentum().Y(), tk.innerMomentum().Z());
978  if (dir) gmom *=-1.;
979  GlobalTrajectoryParameters par( gpos, -gmom, tk.charge(), field);
980  CurvilinearTrajectoryError err( tk.extra()->innerStateCovariance());
981  return FreeTrajectoryState( par, err);
982  }
983 
984 }
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:129
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:149
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:139
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:134
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:144
int charge() const
track electric charge
Definition: TrackBase.h:567
dbl *** dir
Definition: mlp_gen.cc:35
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:124
void AlCaHOCalibProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 295 of file AlCaHOCalibProducer.cc.

References edm::EventID::event(), fillHOStore(), edm::Event::getByToken(), edm::EventBase::id(), HOCalibVariables::inslumi, edm::EventBase::isRealData(), edm::HandleBase::isValid(), m_cosmic, eostools::move(), Nevents, Noccu, HOCalibVariables::nprim, jets_cff::primaryVertices, edm::Event::put(), edm::EventID::run(), tok_lumi_, tok_muons_, tok_muonsCosmic_, and tok_vertex_.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

296 {
297 
298  int irun = iEvent.id().run();
299  // int ilumi = iEvent.luminosityBlock();
300 
301  Nevents++;
302 
303  if (Nevents%5000==1) edm::LogInfo("HOCalib") <<"AlCaHOCalibProducer Processing event # "<<Nevents<<" "<<Noccu<<" "<<irun<<" "<<iEvent.id().event();
304 
305  auto hostore = std::make_unique<HOCalibVariableCollection>();
306 
308  edm::Handle<edm::View<reco::Muon> > collisionmuon;
309 
310  bool muonOK(true);
311  HOCalibVariables tmpHOCalib;
312  tmpHOCalib.nprim = -1;
313  tmpHOCalib.inslumi=-1.;
314 
315  if (m_cosmic) {
316  iEvent.getByToken(tok_muonsCosmic_, cosmicmuon);
317  muonOK = (cosmicmuon.isValid() && !cosmicmuon->empty());
318  } else {
319  iEvent.getByToken(tok_muons_,collisionmuon);
320  muonOK = (collisionmuon.isValid() && !collisionmuon->empty());
321 
322  if (iEvent.isRealData()) {
324  iEvent.getByToken(tok_vertex_, primaryVertices);
325  if (primaryVertices.isValid()) { tmpHOCalib.nprim = primaryVertices->size();}
326 
327  tmpHOCalib.inslumi=0.;
328 
330  iEvent.getByToken(tok_lumi_, lumiScale);
331 
332  if (lumiScale.isValid()) {
333  if ( lumiScale->empty() ) {
334  edm::LogError("HOCalib") << "lumiScale collection is empty";
335  } else {
336  tmpHOCalib.inslumi=lumiScale->begin()->pileup();
337  }
338  }
339  }
340  }
341 
342  if (muonOK) {
343 
344  int Noccu_old = Noccu;
346  if (m_cosmic) {
347  int indx(0);
348  for(reco::TrackCollection::const_iterator ncosm = cosmicmuon->begin();
349  ncosm != cosmicmuon->end(); ++ncosm,++indx) {
350  if ((*ncosm).ndof() < 15) continue;
351  if ((*ncosm).normalizedChi2() >30.0) continue;
352  reco::TrackRef tRef = reco::TrackRef(cosmicmuon,indx);
353  fillHOStore(tRef,tmpHOCalib,hostore,Noccu_old,indx,cosmicmuon,muon1,
354  iEvent, iSetup);
355  }
356  } else {
357  for( muon1 = collisionmuon->begin(); muon1 < collisionmuon->end(); muon1++ ) {
358  if ((!muon1->isGlobalMuon()) || (!muon1->isTrackerMuon())) continue;
359  reco::TrackRef ncosm = muon1->innerTrack();
360  fillHOStore(ncosm,tmpHOCalib,hostore,Noccu_old,0,cosmicmuon,muon1,
361  iEvent, iSetup);
362  }
363  }
364  }
365 
366  iEvent.put(std::move(hostore), "HOCalibVariableCollection");
367 
368 }
RunNumber_t run() const
Definition: EventID.h:39
EventNumber_t event() const
Definition: EventID.h:41
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void fillHOStore(const reco::TrackRef &ncosm, HOCalibVariables &tmpHOCalib, std::unique_ptr< HOCalibVariableCollection > &hostore, int Noccu_old, int indx, edm::Handle< reco::TrackCollection > cosmicmuon, edm::View< reco::Muon >::const_iterator muon1, const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< reco::TrackCollection > tok_muonsCosmic_
bool isRealData() const
Definition: EventBase.h:64
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< LumiScalersCollection > tok_lumi_
primaryVertices
Definition: jets_cff.py:26
edm::EDGetTokenT< reco::VertexCollection > tok_vertex_
edm::EDGetTokenT< edm::View< reco::Muon > > tok_muons_
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:21
edm::EventID id() const
Definition: EventBase.h:60
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

std::map<std::string, bool> AlCaHOCalibProducer::fired
private

Definition at line 227 of file AlCaHOCalibProducer.cc.

edm::ESHandle<HcalSeverityLevelComputer> AlCaHOCalibProducer::hcalSevLvlComputerHndl
private

Definition at line 232 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore().

TH2F* AlCaHOCalibProducer::ho_occupency[5]
private

Definition at line 191 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), endJob(), and fillHOStore().

int AlCaHOCalibProducer::iring
private

Definition at line 184 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::localxhor0
private

Definition at line 186 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::localxhor1
private

Definition at line 188 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::localyhor0
private

Definition at line 187 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::localyhor1
private

Definition at line 189 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

bool AlCaHOCalibProducer::m_cosmic
private

Definition at line 193 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), fillHOStore(), and produce().

int AlCaHOCalibProducer::m_endTS
private

Definition at line 216 of file AlCaHOCalibProducer.cc.

bool AlCaHOCalibProducer::m_hbinfo
private

Definition at line 214 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

bool AlCaHOCalibProducer::m_occupancy
private

Definition at line 192 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), endJob(), and fillHOStore().

double AlCaHOCalibProducer::m_sigma
private

Definition at line 217 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

int AlCaHOCalibProducer::m_startTS
private

Definition at line 215 of file AlCaHOCalibProducer.cc.

edm::InputTag AlCaHOCalibProducer::muonTags_
private

Definition at line 202 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer().

const int AlCaHOCalibProducer::ncidmx = 5
private

Definition at line 198 of file AlCaHOCalibProducer.cc.

const int AlCaHOCalibProducer::netabin = 16
private

Definition at line 195 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

const int AlCaHOCalibProducer::netamx = 32
private

Definition at line 197 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer().

int AlCaHOCalibProducer::Nevents
private

Definition at line 233 of file AlCaHOCalibProducer.cc.

Referenced by beginJob(), endJob(), and produce().

int AlCaHOCalibProducer::Noccu
private

Definition at line 220 of file AlCaHOCalibProducer.cc.

Referenced by beginJob(), endJob(), fillHOStore(), and produce().

const int AlCaHOCalibProducer::nphimx = 72
private

Definition at line 196 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), fillHOStore(), and findHOEtaPhi().

int AlCaHOCalibProducer::nRuns
private

Definition at line 221 of file AlCaHOCalibProducer.cc.

Referenced by beginJob().

unsigned int AlCaHOCalibProducer::Ntp
private

Definition at line 226 of file AlCaHOCalibProducer.cc.

const double AlCaHOCalibProducer::rHOL0 = 382.0
private

Definition at line 199 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore().

const double AlCaHOCalibProducer::rHOL1 = 407.0
private

Definition at line 200 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore().

const HcalChannelQuality* AlCaHOCalibProducer::theHcalChStatus
private

Definition at line 230 of file AlCaHOCalibProducer.cc.

Referenced by beginRun(), and fillHOStore().

edm::EDGetTokenT<HBHERecHitCollection> AlCaHOCalibProducer::tok_hbhe_
private

Definition at line 210 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

edm::EDGetTokenT<HORecHitCollection> AlCaHOCalibProducer::tok_ho_
private

Definition at line 211 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

edm::EDGetTokenT<LumiScalersCollection> AlCaHOCalibProducer::tok_lumi_
private

Definition at line 208 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

edm::EDGetTokenT<edm::View<reco::Muon> > AlCaHOCalibProducer::tok_muons_
private

Definition at line 205 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

edm::EDGetTokenT<reco::TrackCollection> AlCaHOCalibProducer::tok_muonsCosmic_
private

Definition at line 204 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

edm::EDGetTokenT<CaloTowerCollection> AlCaHOCalibProducer::tok_tower_
private

Definition at line 212 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

edm::EDGetTokenT<reco::VertexCollection> AlCaHOCalibProducer::tok_vertex_
private

Definition at line 206 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

float AlCaHOCalibProducer::xhor0
private

Definition at line 180 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::xhor1
private

Definition at line 182 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::yhor0
private

Definition at line 181 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

float AlCaHOCalibProducer::yhor1
private

Definition at line 183 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().