CMS 3D CMS Logo

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

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

Inheritance diagram for AlCaHOCalibProducer:
edm::one::EDProducer< edm::one::SharedResources > edm::one::EDProducerBase 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::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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=default
 
- Public Member Functions inherited from edm::one::EDProducer< edm::one::SharedResources >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () 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
 
std::vector< bool > const & recordProvenanceList () 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)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~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
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::one::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

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

Private Member Functions

void beginJob () 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 CaloSubdetectorGeometry *, const MagneticField &)
 
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
 
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
 
const HcalSeverityLevelComputertheHcalSevLvlComputer
 
edm::ESGetToken< CaloGeometry, CaloGeometryRecordtok_geom_
 
edm::EDGetTokenT< HBHERecHitCollectiontok_hbhe_
 
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcdtok_hcalChStatus_
 
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcdtok_hcalSevLvlComputer_
 
edm::EDGetTokenT< HORecHitCollectiontok_ho_
 
edm::EDGetTokenT< LumiScalersCollectiontok_lumi_
 
edm::ESGetToken< MagneticField, IdealMagneticFieldRecordtok_magField_
 
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

- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

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 143 of file AlCaHOCalibProducer.cc.

Member Typedef Documentation

◆ CovarianceMatrix

Definition at line 217 of file AlCaHOCalibProducer.cc.

◆ DirectionType

Definition at line 150 of file AlCaHOCalibProducer.cc.

◆ PositionType

Definition at line 149 of file AlCaHOCalibProducer.cc.

◆ RotationType

Definition at line 151 of file AlCaHOCalibProducer.cc.

Constructor & Destructor Documentation

◆ AlCaHOCalibProducer()

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

Definition at line 244 of file AlCaHOCalibProducer.cc.

References compareTotals::fs, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), ho_occupency, TFileService::kSharedResource, m_cosmic, m_hbinfo, m_occupancy, m_sigma, muonTags_, netamx, nphimx, runGCPTkAlMap::title, tok_geom_, tok_hbhe_, tok_hcalChStatus_, tok_hcalSevLvlComputer_, tok_ho_, tok_lumi_, tok_magField_, tok_muons_, tok_muonsCosmic_, tok_tower_, and tok_vertex_.

244  {
245  usesResource(TFileService::kSharedResource);
246  //register your products
247 
248  m_hbinfo = iConfig.getUntrackedParameter<bool>("hbinfo", false);
249  m_sigma = iConfig.getUntrackedParameter<double>("sigma", 0.05);
250  m_occupancy = iConfig.getUntrackedParameter<bool>("plotOccupancy", false);
251  m_cosmic = iConfig.getUntrackedParameter<bool>("CosmicData", false);
252 
253  // keep InputTag muonTags_ since it is used below. - cowden
254  muonTags_ = iConfig.getUntrackedParameter<edm::InputTag>("muons");
255  tok_muonsCosmic_ = consumes<reco::TrackCollection>(muonTags_);
256  tok_muons_ = consumes<edm::View<reco::Muon> >(muonTags_);
257  tok_vertex_ = consumes<reco::VertexCollection>(iConfig.getParameter<edm::InputTag>("vertexTags"));
258  // tok_lumi_ = consumes<LumiDetails ,edm::InLumi>(iConfig.getParameter<edm::InputTag>("lumiTags"));
259  tok_lumi_ = consumes<LumiScalersCollection>(iConfig.getParameter<edm::InputTag>("lumiTags"));
260  tok_ho_ = consumes<HORecHitCollection>(iConfig.getParameter<edm::InputTag>("hoInput"));
261  tok_hbhe_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("hbheInput"));
262  tok_tower_ = consumes<CaloTowerCollection>(iConfig.getParameter<edm::InputTag>("towerInput"));
263 
264  tok_hcalChStatus_ = esConsumes<HcalChannelQuality, HcalChannelQualityRcd>(edm::ESInputTag("", "withTopo"));
265  tok_geom_ = esConsumes<CaloGeometry, CaloGeometryRecord>();
266  tok_hcalSevLvlComputer_ = esConsumes<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd>();
267  tok_magField_ = esConsumes<MagneticField, IdealMagneticFieldRecord>();
268 
269  produces<HOCalibVariableCollection>("HOCalibVariableCollection").setBranchAlias("HOCalibVariableCollection");
270 
271  if (m_occupancy) {
273 
274  char title[200];
275 
276  for (int ij = 0; ij < 5; ij++) {
277  sprintf(title, "ho_occupency (>%i #sigma)", ij + 2);
278  ho_occupency[ij] =
279  fs->make<TH2F>(title, title, netamx + 1, -netamx - 0.5, netamx / 2 + 0.5, nphimx, 0.5, nphimx + 0.5);
280  }
281  }
282 }
static const std::string kSharedResource
Definition: TFileService.h:76
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
edm::EDGetTokenT< CaloTowerCollection > tok_tower_
edm::EDGetTokenT< reco::TrackCollection > tok_muonsCosmic_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
T getUntrackedParameter(std::string const &, T const &) const
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > tok_hcalChStatus_
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::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > tok_hcalSevLvlComputer_
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
edm::EDGetTokenT< HBHERecHitCollection > tok_hbhe_

◆ ~AlCaHOCalibProducer()

AlCaHOCalibProducer::~AlCaHOCalibProducer ( )
overridedefault

Member Function Documentation

◆ beginJob()

void AlCaHOCalibProducer::beginJob ( )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 393 of file AlCaHOCalibProducer.cc.

References Nevents, Noccu, and nRuns.

393  {
394  Nevents = 0;
395  nRuns = 0;
396  Noccu = 0;
397 }

◆ endJob()

void AlCaHOCalibProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::one::EDProducerBase.

Definition at line 400 of file AlCaHOCalibProducer.cc.

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

Referenced by o2olib.O2ORunMgr::executeJob().

400  {
401  if (m_occupancy) {
402  for (int ij = 0; ij < 5; ij++) {
403  ho_occupency[ij]->Scale(1. / std::max(1, Noccu));
404  }
405  }
406  edm::LogInfo("HOCalib") << " AlCaHOCalibProducer processed event " << Nevents;
407 }
Log< level::Info, false > LogInfo

◆ fillDescriptions()

void AlCaHOCalibProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 288 of file AlCaHOCalibProducer.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, HLT_2022v15_cff::InputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

288  {
290  desc.add<edm::InputTag>("hbheInput", edm::InputTag("hbhereco"));
291  desc.addUntracked<bool>("hotime", false);
292  desc.addUntracked<bool>("hbinfo", false);
293  desc.addUntracked<double>("sigma", 1.0);
294  desc.addUntracked<bool>("plotOccupancy", false);
295  desc.addUntracked<bool>("CosmicData", false);
296  desc.add<edm::InputTag>("hoInput", edm::InputTag("horeco"));
297  desc.add<edm::InputTag>("towerInput", edm::InputTag("towerMaker"));
298  desc.addUntracked<std::string>("RootFileName", "test.root");
299  desc.addUntracked<double>("m_scale", 4.0);
300  desc.addUntracked<bool>("debug", false);
301  desc.addUntracked<edm::InputTag>("muons", edm::InputTag("muons"));
302  desc.add<edm::InputTag>("vertexTags", edm::InputTag("offlinePrimaryVertices"));
303  desc.add<edm::InputTag>("lumiTags", edm::InputTag("scalersRawToDigi"));
304  descriptions.add("alcaHOCalibProducer", desc);
305 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ fillHOStore()

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 CaloSubdetectorGeometry gHO,
const MagneticField magField 
)
private

Definition at line 409 of file AlCaHOCalibProducer.cc.

References funct::abs(), angle(), anyDirection, SteppingHelixPropagator::applyRadX0Correction(), HOCalibVariables::caloen, ewkMuLumiMonitorDQM_cfi::calotower, ALCARECOTkAlJpsiMuMu_cff::charge, HOCalibVariables::chisq, funct::cos(), Vector3DBase< T, FrameTag >::cross(), dot(), HOCalibVariables::ecal03, CaloRecHit::energy(), findHOEtaPhi(), CaloSubdetectorGeometry::getClosestCell(), getFreeTrajectoryState(), HcalSeverityLevelComputer::getSeverityLevel(), HcalChannelStatus::getValue(), HcalCondObjectContainer< Item >::getValues(), reco::MuonEnergy::had, reco::MuonIsolation::hadEt, HOCalibVariables::hbhesig, HOCalibVariables::hcal03, ho_occupency, HOCalibVariables::hoang, HOCalibVariables::hocorsig, HOCalibVariables::hocro, HOCalibVariables::hodx, HOCalibVariables::hody, HOCalibVariables::hoflag, HOCalibVariables::hosig, HOCalibVariables::htime, HORecHit::id(), HcalDetId::ieta(), iEvent, 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(), SteppingHelixPropagator::propagate(), rHOL0, rHOL1, makeMuonMisalignmentScenario::rot, SteppingHelixPropagator::setMaterialMode(), funct::sin(), mathSSE::sqrt(), reco::MuonIsolation::sumPt, theHcalChStatus, theHcalSevLvlComputer, 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().

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

◆ findHOEtaPhi()

void AlCaHOCalibProducer::findHOEtaPhi ( int  iphsect,
int &  ietaho,
int &  iphiho 
)
private

Definition at line 922 of file AlCaHOCalibProducer.cc.

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

Referenced by fillHOStore().

922  {
923  //18/12/06 : use only position, not angle phi
924 
925  const double etalow[16] = {0.025,
926  35.195,
927  70.625,
928  106.595,
929  141.565,
930  180.765,
931  220.235,
932  261.385,
933  304.525,
934  349.975,
935  410.025,
936  452.085,
937  506.645,
938  565.025,
939  627.725,
940  660.25};
941  const double etahgh[16] = {35.145,
942  70.575,
943  106.545,
944  125.505,
945  180.715,
946  220.185,
947  261.335,
948  304.475,
949  349.925,
950  392.575,
951  452.035,
952  506.595,
953  564.975,
954  627.675,
955  661.075,
956  700.25};
957 
958  const double philow[6] = {-76.27, -35.11, 0.35, 35.81, 71.77, 108.93}; //Ring+/-1 & 2
959  const double phihgh[6] = {-35.81, -0.35, 35.11, 71.07, 108.23, 140.49};
960 
961  const double philow00[6] = {-60.27, -32.91, 0.35, 33.61, 67.37, 102.23}; //Ring0 L0
962  const double phihgh00[6] = {-33.61, -0.35, 32.91, 66.67, 101.53, 129.49};
963 
964  const double philow01[6] = {-64.67, -34.91, 0.35, 35.61, 71.37, 108.33}; //Ring0 L1
965  const double phihgh01[6] = {-35.61, -0.35, 34.91, 70.67, 107.63, 138.19};
966 
967  iring = -10;
968 
969  double tmpdy = std::abs(yhor1);
970  for (int ij = 0; ij < netabin; ij++) {
971  if (tmpdy > etalow[ij] && tmpdy < etahgh[ij]) {
972  ietaho = ij + 1;
973  float tmp1 = fabs(tmpdy - etalow[ij]);
974  float tmp2 = fabs(tmpdy - etahgh[ij]);
975 
976  localyhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
977  if (yhor1 < 0)
978  localyhor1 *= -1.;
979 
980  if (ij < 4)
981  iring = 0;
982  if (ij >= 4 && ij < 10)
983  iring = 1;
984  if (ij >= 10 && ij < netabin)
985  iring = 2;
986  break;
987  }
988  }
989 
990  int tmpphi = 0;
991  int tmpphi0 = 0;
992 
993  if (ietaho > 4) { //Ring 1 and 2
994  for (int ij = 0; ij < 6; ij++) {
995  if (xhor1 > philow[ij] && xhor1 < phihgh[ij]) {
996  tmpphi = ij + 1;
997  float tmp1 = fabs(xhor1 - philow[ij]);
998  float tmp2 = fabs(xhor1 - phihgh[ij]);
999  localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1000  break;
1001  }
1002  }
1003  } else { //Ring 0
1004  for (int ij = 0; ij < 6; ij++) {
1005  if (xhor1 > philow01[ij] && xhor1 < phihgh01[ij]) {
1006  tmpphi = ij + 1;
1007  float tmp1 = fabs(xhor1 - philow01[ij]);
1008  float tmp2 = fabs(xhor1 - phihgh01[ij]);
1009  localxhor1 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1010  break;
1011  }
1012  }
1013 
1014  for (int ij = 0; ij < 6; ij++) {
1015  if (xhor0 > philow00[ij] && xhor0 < phihgh00[ij]) {
1016  tmpphi0 = ij + 1;
1017  float tmp1 = fabs(xhor0 - philow00[ij]);
1018  float tmp2 = fabs(xhor0 - phihgh00[ij]);
1019  localxhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1020  if (tmpphi != tmpphi0)
1021  localxhor0 += 10000.;
1022  break;
1023  }
1024  }
1025 
1026  double tmpdy = std::abs(yhor0);
1027  for (int ij = 0; ij < 4; ij++) {
1028  if (tmpdy > etalow[ij] && tmpdy < etahgh[ij]) {
1029  float tmp1 = fabs(tmpdy - etalow[ij]);
1030  float tmp2 = fabs(tmpdy - etahgh[ij]);
1031  localyhor0 = (tmp1 < tmp2) ? -tmp1 : tmp2;
1032  if (yhor0 < 0)
1033  localyhor0 *= -1.;
1034  if (ij + 1 != ietaho)
1035  localyhor0 += 10000.;
1036  break;
1037  }
1038  }
1039  }
1040 
1041  if (tmpphi != 0) {
1042  iphiho = 6 * iphisect - 2 + tmpphi;
1043  if (iphiho <= 0)
1044  iphiho += nphimx;
1045  if (iphiho > nphimx)
1046  iphiho -= nphimx;
1047  }
1048 
1049  // isect2 = 15*iring+iphisect+1;
1050 
1051  if (yhor1 < 0) {
1052  if (std::abs(ietaho) > netabin) { //Initialised with 50
1053  ietaho += 1;
1054  } else {
1055  ietaho *= -1;
1056  }
1057  // isect2 *=-1;
1058  iring *= -1;
1059  }
1060 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ getFreeTrajectoryState()

FreeTrajectoryState AlCaHOCalibProducer::getFreeTrajectoryState ( const reco::Track tk,
const MagneticField field,
int  itag,
bool  dir 
)
private

Definition at line 1062 of file AlCaHOCalibProducer.cc.

References reco::TrackBase::charge(), DeadROC_duringRun::dir, submitPVResolutionJobs::err, 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().

1065  {
1066  if (iiner == 0) {
1067  GlobalPoint gpos(tk.outerX(), tk.outerY(), tk.outerZ());
1068  GlobalVector gmom(tk.outerPx(), tk.outerPy(), tk.outerPz());
1069  if (dir)
1070  gmom *= -1.;
1071  GlobalTrajectoryParameters par(gpos, gmom, tk.charge(), field);
1072  CurvilinearTrajectoryError err(tk.extra()->outerStateCovariance());
1073  return FreeTrajectoryState(par, err);
1074  } else {
1075  GlobalPoint gpos(tk.innerPosition().X(), tk.innerPosition().Y(), tk.innerPosition().Z());
1076  GlobalVector gmom(tk.innerMomentum().X(), tk.innerMomentum().Y(), tk.innerMomentum().Z());
1077  if (dir)
1078  gmom *= -1.;
1079  GlobalTrajectoryParameters par(gpos, -gmom, tk.charge(), field);
1080  CurvilinearTrajectoryError err(tk.extra()->innerStateCovariance());
1081  return FreeTrajectoryState(par, err);
1082  }
1083 }
double outerY() const
y coordinate of the outermost hit position
Definition: Track.h:112
double outerX() const
x coordinate of the outermost hit position
Definition: Track.h:109
double outerPy() const
y coordinate of momentum vector at the outermost hit position
Definition: Track.h:103
double outerZ() const
z coordinate of the outermost hit position
Definition: Track.h:115
int charge() const
track electric charge
Definition: TrackBase.h:597
double outerPz() const
z coordinate of momentum vector at the outermost hit position
Definition: Track.h:106
double outerPx() const
x coordinate of momentum vector at the outermost hit position
Definition: Track.h:100
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:59
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:56
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:139

◆ produce()

void AlCaHOCalibProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::one::EDProducerBase.

Definition at line 308 of file AlCaHOCalibProducer.cc.

References fillHOStore(), edm::EventSetup::getData(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, HcalOuter, iEvent, HOCalibVariables::inslumi, edm::HandleBase::isValid(), BXlumiParameters_cfi::lumiScale, m_cosmic, eostools::move(), Nevents, Noccu, HOCalibVariables::nprim, HLT_2022v15_cff::primaryVertices, theHcalChStatus, theHcalSevLvlComputer, tok_geom_, tok_hcalChStatus_, tok_hcalSevLvlComputer_, tok_lumi_, tok_magField_, tok_muons_, tok_muonsCosmic_, and tok_vertex_.

308  {
309  int irun = iEvent.id().run();
310  // int ilumi = iEvent.luminosityBlock();
311 
312  Nevents++;
313 
314  if (Nevents % 5000 == 1)
315  edm::LogInfo("HOCalib") << "AlCaHOCalibProducer Processing event # " << Nevents << " " << Noccu << " " << irun
316  << " " << iEvent.id().event();
317 
319 
320  auto hostore = std::make_unique<HOCalibVariableCollection>();
321 
323  edm::Handle<edm::View<reco::Muon> > collisionmuon;
324 
325  bool muonOK(true);
326  HOCalibVariables tmpHOCalib;
327  tmpHOCalib.nprim = -1;
328  tmpHOCalib.inslumi = -1.;
329 
330  if (m_cosmic) {
331  cosmicmuon = iEvent.getHandle(tok_muonsCosmic_);
332  muonOK = (cosmicmuon.isValid() && !cosmicmuon->empty());
333  } else {
334  collisionmuon = iEvent.getHandle(tok_muons_);
335  muonOK = (collisionmuon.isValid() && !collisionmuon->empty());
336 
337  if (iEvent.isRealData()) {
338  auto const& primaryVertices = iEvent.getHandle(tok_vertex_);
339  if (primaryVertices.isValid()) {
340  tmpHOCalib.nprim = primaryVertices->size();
341  }
342 
343  tmpHOCalib.inslumi = 0.;
344 
345  auto const& lumiScale = iEvent.getHandle(tok_lumi_);
346 
347  if (lumiScale.isValid()) {
348  if (lumiScale->empty()) {
349  edm::LogError("HOCalib") << "lumiScale collection is empty";
350  } else {
351  tmpHOCalib.inslumi = lumiScale->begin()->pileup();
352  }
353  }
354  }
355  }
356 
357  if (muonOK) {
358  int Noccu_old = Noccu;
360 
362 
363  MagneticField const& magField = iSetup.getData(tok_magField_);
364 
365  const CaloGeometry& geo = iSetup.getData(tok_geom_);
367 
368  if (m_cosmic) {
369  int indx(0);
370  for (reco::TrackCollection::const_iterator ncosm = cosmicmuon->begin(); ncosm != cosmicmuon->end();
371  ++ncosm, ++indx) {
372  if ((*ncosm).ndof() < 15)
373  continue;
374  if ((*ncosm).normalizedChi2() > 30.0)
375  continue;
376  reco::TrackRef tRef = reco::TrackRef(cosmicmuon, indx);
377  fillHOStore(tRef, tmpHOCalib, hostore, Noccu_old, indx, cosmicmuon, muon1, iEvent, gHO, magField);
378  }
379  } else {
380  for (muon1 = collisionmuon->begin(); muon1 < collisionmuon->end(); muon1++) {
381  if ((!muon1->isGlobalMuon()) || (!muon1->isTrackerMuon()))
382  continue;
383  reco::TrackRef ncosm = muon1->innerTrack();
384  fillHOStore(ncosm, tmpHOCalib, hostore, Noccu_old, 0, cosmicmuon, muon1, iEvent, gHO, magField);
385  }
386  }
387  }
388 
389  iEvent.put(std::move(hostore), "HOCalibVariableCollection");
390 }
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
const HcalChannelQuality * theHcalChStatus
const HcalSeverityLevelComputer * theHcalSevLvlComputer
edm::EDGetTokenT< reco::TrackCollection > tok_muonsCosmic_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > tok_geom_
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
edm::ESGetToken< HcalChannelQuality, HcalChannelQualityRcd > tok_hcalChStatus_
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 CaloSubdetectorGeometry *, const MagneticField &)
edm::EDGetTokenT< LumiScalersCollection > tok_lumi_
Log< level::Info, false > LogInfo
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:20
bool isValid() const
Definition: HandleBase.h:70
edm::ESGetToken< HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd > tok_hcalSevLvlComputer_
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > tok_magField_
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ fired

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

Definition at line 225 of file AlCaHOCalibProducer.cc.

◆ ho_occupency

TH2F* AlCaHOCalibProducer::ho_occupency[5]
private

Definition at line 184 of file AlCaHOCalibProducer.cc.

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

◆ iring

int AlCaHOCalibProducer::iring
private

Definition at line 177 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ localxhor0

float AlCaHOCalibProducer::localxhor0
private

Definition at line 179 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ localxhor1

float AlCaHOCalibProducer::localxhor1
private

Definition at line 181 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ localyhor0

float AlCaHOCalibProducer::localyhor0
private

Definition at line 180 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ localyhor1

float AlCaHOCalibProducer::localyhor1
private

Definition at line 182 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ m_cosmic

bool AlCaHOCalibProducer::m_cosmic
private

Definition at line 186 of file AlCaHOCalibProducer.cc.

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

◆ m_endTS

int AlCaHOCalibProducer::m_endTS
private

Definition at line 214 of file AlCaHOCalibProducer.cc.

◆ m_hbinfo

bool AlCaHOCalibProducer::m_hbinfo
private

Definition at line 212 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

◆ m_occupancy

bool AlCaHOCalibProducer::m_occupancy
private

Definition at line 185 of file AlCaHOCalibProducer.cc.

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

◆ m_sigma

double AlCaHOCalibProducer::m_sigma
private

Definition at line 215 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

◆ m_startTS

int AlCaHOCalibProducer::m_startTS
private

Definition at line 213 of file AlCaHOCalibProducer.cc.

◆ muonTags_

edm::InputTag AlCaHOCalibProducer::muonTags_
private

Definition at line 195 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer().

◆ ncidmx

const int AlCaHOCalibProducer::ncidmx = 5
private

Definition at line 191 of file AlCaHOCalibProducer.cc.

◆ netabin

const int AlCaHOCalibProducer::netabin = 16
private

Definition at line 188 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ netamx

const int AlCaHOCalibProducer::netamx = 32
private

Definition at line 190 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer().

◆ Nevents

int AlCaHOCalibProducer::Nevents
private

Definition at line 230 of file AlCaHOCalibProducer.cc.

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

◆ Noccu

int AlCaHOCalibProducer::Noccu
private

Definition at line 218 of file AlCaHOCalibProducer.cc.

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

◆ nphimx

const int AlCaHOCalibProducer::nphimx = 72
private

Definition at line 189 of file AlCaHOCalibProducer.cc.

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

◆ nRuns

int AlCaHOCalibProducer::nRuns
private

Definition at line 219 of file AlCaHOCalibProducer.cc.

Referenced by beginJob().

◆ Ntp

unsigned int AlCaHOCalibProducer::Ntp
private

Definition at line 224 of file AlCaHOCalibProducer.cc.

◆ rHOL0

const double AlCaHOCalibProducer::rHOL0 = 382.0
private

Definition at line 192 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore().

◆ rHOL1

const double AlCaHOCalibProducer::rHOL1 = 407.0
private

Definition at line 193 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore().

◆ theHcalChStatus

const HcalChannelQuality* AlCaHOCalibProducer::theHcalChStatus
private

Definition at line 228 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and produce().

◆ theHcalSevLvlComputer

const HcalSeverityLevelComputer* AlCaHOCalibProducer::theHcalSevLvlComputer
private

Definition at line 229 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and produce().

◆ tok_geom_

edm::ESGetToken<CaloGeometry, CaloGeometryRecord> AlCaHOCalibProducer::tok_geom_
private

Definition at line 208 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_hbhe_

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

Definition at line 203 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

◆ tok_hcalChStatus_

edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> AlCaHOCalibProducer::tok_hcalChStatus_
private

Definition at line 207 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_hcalSevLvlComputer_

edm::ESGetToken<HcalSeverityLevelComputer, HcalSeverityLevelComputerRcd> AlCaHOCalibProducer::tok_hcalSevLvlComputer_
private

Definition at line 209 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_ho_

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

Definition at line 204 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

◆ tok_lumi_

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

Definition at line 201 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_magField_

edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> AlCaHOCalibProducer::tok_magField_
private

Definition at line 210 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_muons_

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

Definition at line 198 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_muonsCosmic_

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

Definition at line 197 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ tok_tower_

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

Definition at line 205 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and fillHOStore().

◆ tok_vertex_

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

Definition at line 199 of file AlCaHOCalibProducer.cc.

Referenced by AlCaHOCalibProducer(), and produce().

◆ xhor0

float AlCaHOCalibProducer::xhor0
private

Definition at line 173 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ xhor1

float AlCaHOCalibProducer::xhor1
private

Definition at line 175 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ yhor0

float AlCaHOCalibProducer::yhor0
private

Definition at line 174 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().

◆ yhor1

float AlCaHOCalibProducer::yhor1
private

Definition at line 176 of file AlCaHOCalibProducer.cc.

Referenced by fillHOStore(), and findHOEtaPhi().