CMS 3D CMS Logo

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

#include <Pi0FixedMassWindowCalibration.h>

Inheritance diagram for Pi0FixedMassWindowCalibration:
edm::ESProducerLooper edm::ESProducer edm::EventSetupRecordIntervalFinder edm::EDLooper edm::ESProductResolverFactoryProducer edm::EDLooperBase edm::eventsetup::ESProductResolverProvider edm::EDConsumerBase

Public Member Functions

void beginOfJob () override
 Called at beginning of job. More...
 
Status duringLoop (const edm::Event &, const edm::EventSetup &) override
 Called at each event. More...
 
void endOfJob () override
 Called at end of job. More...
 
Status endOfLoop (const edm::EventSetup &, unsigned int iLoop) override
 Called at end of loop. More...
 
 Pi0FixedMassWindowCalibration (const edm::ParameterSet &iConfig)
 Constructor. More...
 
virtual void produce (edm::Event &, const edm::EventSetup &)
 Dummy implementation (job done in duringLoop) More...
 
void startingNewLoop (unsigned int iLoop) override
 Called at beginning of loop. More...
 
 ~Pi0FixedMassWindowCalibration () override
 Destructor. More...
 
- Public Member Functions inherited from edm::ESProducerLooper
 ESProducerLooper ()
 
 ESProducerLooper (const ESProducerLooper &)=delete
 
std::set< eventsetup::EventSetupRecordKeymodifyingRecords () const override
 
const ESProducerLooperoperator= (const ESProducerLooper &)=delete
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
 ESProducer (ESProducer &&)=delete
 
ESResolverIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProduceroperator= (const ESProducer &)=delete
 
ESProduceroperator= (ESProducer &&)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector< ESResolverIndex > > updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProductResolverFactoryProducer
 ESProductResolverFactoryProducer ()
 
 ESProductResolverFactoryProducer (const ESProductResolverFactoryProducer &)=delete
 
const ESProductResolverFactoryProduceroperator= (const ESProductResolverFactoryProducer &)=delete
 
 ~ESProductResolverFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
void createKeyedResolvers (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
const ComponentDescriptiondescription () const
 
 ESProductResolverProvider ()
 
 ESProductResolverProvider (const ESProductResolverProvider &)=delete
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedResolverskeyedResolvers (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const ESProductResolverProvideroperator= (const ESProductResolverProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~ESProductResolverProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const eventsetup::ComponentDescriptiondescriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set< eventsetup::EventSetupRecordKeyfindingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const EventSetupRecordIntervalFinderoperator= (const EventSetupRecordIntervalFinder &)=delete
 
void resetInterval (const eventsetup::EventSetupRecordKey &)
 
void setDescriptionForFinder (const eventsetup::ComponentDescription &iDescription)
 
virtual ~EventSetupRecordIntervalFinder () noexcept(false)
 
- Public Member Functions inherited from edm::EDLooper
 EDLooper ()
 
 EDLooper (EDLooper const &)=delete
 
EDLooperoperator= (EDLooper const &)=delete
 
 ~EDLooper () override
 
- Public Member Functions inherited from edm::EDLooperBase
virtual void attachTo (ActivityRegistry &)
 Override this method if you need to monitor the state of the processing. More...
 
void beginOfJob (EventSetupImpl const &)
 
virtual void beginOfJob (EventSetup const &)
 
void copyInfo (ScheduleInfo const &)
 
void doBeginLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doBeginRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doDuringLoop (EventPrincipal &eventPrincipal, EventSetupImpl const &es, ProcessingController &, StreamContext *)
 
void doEndLuminosityBlock (LuminosityBlockPrincipal &, EventSetupImpl const &, ProcessContext *)
 
Status doEndOfLoop (EventSetupImpl const &es)
 
void doEndRun (RunPrincipal &, EventSetupImpl const &, ProcessContext *)
 
void doStartingNewLoop ()
 
 EDLooperBase ()
 
 EDLooperBase (EDLooperBase const &)=delete
 
void esPrefetchAsync (WaitingTaskHolder iTask, EventSetupImpl const &iImpl, Transition iTrans, ServiceToken const &iToken) const
 
EDLooperBaseoperator= (EDLooperBase const &)=delete
 
void prefetchAsync (WaitingTaskHolder iTask, ServiceToken const &token, Transition iTrans, Principal const &iPrincipal, EventSetupImpl const &iImpl) const
 
void prepareForNextLoop (eventsetup::EventSetupProvider *esp)
 
void setActionTable (ExceptionToActionTable const *actionTable)
 
void setModuleChanger (ModuleChanger *)
 
 ~EDLooperBase () 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
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > 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
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::eventsetup::ESProductResolverProvider
static void prevalidate (ConfigurationDescriptions &)
 

Private Attributes

std::vector< DetIdbarrelCells
 
std::string barrelClusterCollection_
 
std::string barrelClusterShapeAssociation_
 
std::string barrelHitCollection_
 
std::string barrelHitProducer_
 
const std::string barrelHits_
 
std::string clustershapecollectionEB_
 
const std::string ecalHitsProducer_
 
const EcalRecHitCollectionecalRecHitBarrelCollection
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordgeometryToken_
 
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcdintercalibConstantsToken_
 
bool isfirstcall_
 
IslandClusterAlgoisland_p
 
double mwxtals [85][360][2]
 
int nevent
 
double newCalibs_barl [85][360][2]
 
double oldCalibs_barl [85][360][2]
 
PositionCalc posCalculator_
 
const EcalRecHitCollectionrecalibEcalRecHitCollection
 
std::map< DetId, EcalRecHit > * recHitsEB_map
 
const edm::EDGetTokenT< EcalRecHitCollectionrecHitToken_
 
double selePi0DetaBelt_
 
double selePi0DRBelt_
 
double selePi0EtBeltIsoRatioMax_
 
double selePi0MinvMeanFixed_
 
double selePi0MinvSigmaFixed_
 
double selePi0PtGammaOneMin_
 
double selePi0PtGammaTwoMin_
 
double selePi0PtPi0Min_
 
double selePi0S4S9GammaOneMin_
 
double selePi0S4S9GammaTwoMin_
 
double selePi0S9S25GammaOneMin_
 
double selePi0S9S25GammaTwoMin_
 
ClusterShapeAlgo shapeAlgo_
 
const unsigned int theMaxLoops
 
edm::ParameterSet theParameterSet
 
IslandClusterAlgo::VerbosityLevel verbosity
 
double wxtals [85][360][2]
 

Additional Inherited Members

- Public Types inherited from edm::EDLooperBase
enum  Status { kContinue, kStop }
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Types inherited from edm::ESProductResolverFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::ESProductResolverProvider
using KeyedResolversVector = std::vector< std::pair< DataKey, std::shared_ptr< ESProductResolver > >>
 
- Protected Member Functions inherited from edm::ESProducerLooper
void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ESProductResolverFactoryBase > iFactory, const std::string &iLabel=std::string()) override
 
void setIntervalFor (const eventsetup::EventSetupRecordKey &iKey, const IOVSyncValue &iTime, ValidityInterval &oInterval) override
 
- Protected Member Functions inherited from edm::ESProducer
ESConsumesInfoconsumesInfoPushBackNew ()
 
unsigned int consumesInfoSize () const
 
template<typename CallbackT , typename TList , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>> iCallback, const TList *, const TRecord *iRecord, const es::Label &iLabel)
 
template<typename CallbackT , typename TRecord >
void registerProducts (std::shared_ptr< std::pair< unsigned int, std::shared_ptr< CallbackT >>>, const eventsetup::produce::Null *, const TRecord *, const es::Label &)
 
template<typename T >
auto setWhatProduced (T *iThis, const es::Label &iLabel={})
 
template<typename T >
auto setWhatProduced (T *iThis, const char *iLabel)
 
template<typename T >
auto setWhatProduced (T *iThis, const std::string &iLabel)
 
template<typename T , typename TDecorator >
auto setWhatProduced (T *iThis, const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord >
auto setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const es::Label &iLabel={})
 
template<typename T , typename TReturn , typename TRecord , typename TDecorator >
auto setWhatProduced (T *iThis, TReturn(T ::*iMethod)(const TRecord &), const TDecorator &iDec, const es::Label &iLabel={})
 
template<typename TFunc >
auto setWhatProduced (TFunc &&func, const es::Label &iLabel={})
 
template<typename TReturn , typename TRecord , typename TFunc , typename TDecorator >
ESConsumesCollectorT< TRecord > setWhatProduced (TFunc &&func, TDecorator &&iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProductResolverFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
KeyedResolversVector registerResolvers (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::ESProductResolverProvider
template<class T >
void usingRecord ()
 
void usingRecordWithKey (const EventSetupRecordKey &key)
 
- Protected Member Functions inherited from edm::EventSetupRecordIntervalFinder
template<class T >
void findingRecord ()
 
void findingRecordWithKey (const eventsetup::EventSetupRecordKey &)
 
- Protected Member Functions inherited from edm::EDLooperBase
ModuleChangermoduleChanger ()
 This only returns a non-zero value during the call to endOfLoop. More...
 
ScheduleInfo const * scheduleInfo () const
 This returns a non-zero value after the constructor has been called. More...
 
- 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 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

Definition at line 41 of file Pi0FixedMassWindowCalibration.h.

Constructor & Destructor Documentation

◆ Pi0FixedMassWindowCalibration()

Pi0FixedMassWindowCalibration::Pi0FixedMassWindowCalibration ( const edm::ParameterSet iConfig)

Constructor.

Definition at line 32 of file Pi0FixedMassWindowCalibration.cc.

References barrelClusterCollection_, barrelClusterShapeAssociation_, clustershapecollectionEB_, gather_cfg::cout, edm::ParameterSet::getParameter(), island_p, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, ecalPiZeroTask_cfi::posCalcParameters, posCalculator_, IslandClusterAlgo::pWARNING, selePi0DetaBelt_, selePi0DRBelt_, selePi0EtBeltIsoRatioMax_, selePi0MinvMeanFixed_, selePi0MinvSigmaFixed_, selePi0PtGammaOneMin_, selePi0PtGammaTwoMin_, selePi0PtPi0Min_, selePi0S4S9GammaOneMin_, selePi0S4S9GammaTwoMin_, selePi0S9S25GammaOneMin_, selePi0S9S25GammaTwoMin_, shapeAlgo_, AlCaHLTBitMon_QueryRunRegistry::string, theParameterSet, and verbosity.

33  : theMaxLoops(iConfig.getUntrackedParameter<unsigned int>("maxLoops", 0)),
34  ecalHitsProducer_(iConfig.getParameter<std::string>("ecalRecHitsProducer")),
35  barrelHits_(iConfig.getParameter<std::string>("barrelHitCollection")),
36  recHitToken_(consumes<EcalRecHitCollection>(edm::InputTag(ecalHitsProducer_, barrelHits_))),
39  std::cout << "[Pi0FixedMassWindowCalibration] Constructor " << std::endl;
40  // The verbosity level
41  std::string verbosityString = iConfig.getParameter<std::string>("VerbosityLevel");
42  if (verbosityString == "DEBUG")
44  else if (verbosityString == "WARNING")
46  else if (verbosityString == "INFO")
48  else
50 
51  // The names of the produced cluster collections
52  barrelClusterCollection_ = iConfig.getParameter<std::string>("barrelClusterCollection");
53 
54  // Island algorithm parameters
55  double barrelSeedThreshold = iConfig.getParameter<double>("IslandBarrelSeedThr");
56  double endcapSeedThreshold = iConfig.getParameter<double>("IslandEndcapSeedThr");
57 
58  // Selection algorithm parameters
59  selePi0PtGammaOneMin_ = iConfig.getParameter<double>("selePi0PtGammaOneMin");
60  selePi0PtGammaTwoMin_ = iConfig.getParameter<double>("selePi0PtGammaTwoMin");
61 
62  selePi0DRBelt_ = iConfig.getParameter<double>("selePi0DRBelt");
63  selePi0DetaBelt_ = iConfig.getParameter<double>("selePi0DetaBelt");
64 
65  selePi0PtPi0Min_ = iConfig.getParameter<double>("selePi0PtPi0Min");
66 
67  selePi0S4S9GammaOneMin_ = iConfig.getParameter<double>("selePi0S4S9GammaOneMin");
68  selePi0S4S9GammaTwoMin_ = iConfig.getParameter<double>("selePi0S4S9GammaTwoMin");
69  selePi0S9S25GammaOneMin_ = iConfig.getParameter<double>("selePi0S9S25GammaOneMin");
70  selePi0S9S25GammaTwoMin_ = iConfig.getParameter<double>("selePi0S9S25GammaTwoMin");
71 
72  selePi0EtBeltIsoRatioMax_ = iConfig.getParameter<double>("selePi0EtBeltIsoRatioMax");
73 
74  selePi0MinvMeanFixed_ = iConfig.getParameter<double>("selePi0MinvMeanFixed");
75  selePi0MinvSigmaFixed_ = iConfig.getParameter<double>("selePi0MinvSigmaFixed");
76 
77  // Parameters for the position calculation:
78  edm::ParameterSet posCalcParameters = iConfig.getParameter<edm::ParameterSet>("posCalcParameters");
81  clustershapecollectionEB_ = iConfig.getParameter<std::string>("clustershapecollectionEB");
82 
83  //AssociationMap
84  barrelClusterShapeAssociation_ = iConfig.getParameter<std::string>("barrelShapeAssociation");
85 
86  const std::vector<std::string> seedflagnamesEB =
87  iConfig.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB");
88  const std::vector<int> seedflagsexclEB = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEB);
89 
90  const std::vector<std::string> seedflagnamesEE =
91  iConfig.getParameter<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE");
92  const std::vector<int> seedflagsexclEE = StringToEnumValue<EcalRecHit::Flags>(seedflagnamesEE);
93 
94  const std::vector<std::string> flagnamesEB =
95  iConfig.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEB");
96  const std::vector<int> flagsexclEB = StringToEnumValue<EcalRecHit::Flags>(flagnamesEB);
97 
98  const std::vector<std::string> flagnamesEE =
99  iConfig.getParameter<std::vector<std::string>>("RecHitFlagToBeExcludedEE");
100  const std::vector<int> flagsexclEE = StringToEnumValue<EcalRecHit::Flags>(flagnamesEE);
101 
102  island_p = new IslandClusterAlgo(barrelSeedThreshold,
103  endcapSeedThreshold,
105  seedflagsexclEB,
106  seedflagsexclEE,
107  flagsexclEB,
108  flagsexclEE,
109  verbosity);
110 
111  theParameterSet = iConfig;
112 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > intercalibConstantsToken_
IslandClusterAlgo::VerbosityLevel verbosity
T getUntrackedParameter(std::string const &, T const &) const
const edm::EDGetTokenT< EcalRecHitCollection > recHitToken_

◆ ~Pi0FixedMassWindowCalibration()

Pi0FixedMassWindowCalibration::~Pi0FixedMassWindowCalibration ( )
override

Destructor.

Definition at line 117 of file Pi0FixedMassWindowCalibration.cc.

References island_p.

117 { delete island_p; }

Member Function Documentation

◆ beginOfJob()

void Pi0FixedMassWindowCalibration::beginOfJob ( )
overridevirtual

Called at beginning of job.

Reimplemented from edm::EDLooperBase.

Definition at line 173 of file Pi0FixedMassWindowCalibration.cc.

References isfirstcall_.

173  {
174  //std::cout << "[Pi0FixedMassWindowCalibration] beginOfJob "<<std::endl;
175 
176  isfirstcall_ = true;
177 }

◆ duringLoop()

edm::EDLooper::Status Pi0FixedMassWindowCalibration::duringLoop ( const edm::Event event,
const edm::EventSetup setup 
)
overridevirtual

Called at each event.

Implements edm::EDLooper.

Definition at line 268 of file Pi0FixedMassWindowCalibration.cc.

References funct::abs(), IslandClusterAlgo::barrel, barrelCells, edm::SortedCollection< T, SORT >::begin(), ClusterShapeAlgo::Calculate(), l1tEGammaCrystalsEmulatorProducer_cfi::calib, funct::cos(), gather_cfg::cout, DetId::Ecal, EcalBarrel, EcalPreshower, ecalRecHitBarrelCollection, edm::SortedCollection< T, SORT >::end(), JetChargeProducer_cfi::exp, geometryToken_, hfClusterShapes_cfi::hits, mps_fire::i, hcalRecHitTable_cff::ieta, EBDetId::ieta(), createfilelist::int, intercalibConstantsToken_, hcalRecHitTable_cff::iphi, EBDetId::iphi(), isfirstcall_, island_p, dqmiolumiharvest::j, dqmdumpme::k, edm::EDLooperBase::kContinue, GetRecoTauVFromDQM_MC_cff::kk, dqm-mbProfile::log, IslandClusterAlgo::makeClusters(), mwxtals, nevent, newCalibs_barl, oldCalibs_barl, edm::Handle< T >::product(), edm::SortedCollection< T, SORT >::push_back(), DetId::rawId(), recalibEcalRecHitCollection, recHitsEB_map, recHitToken_, selePi0DetaBelt_, selePi0DRBelt_, selePi0EtBeltIsoRatioMax_, selePi0MinvMeanFixed_, selePi0MinvSigmaFixed_, selePi0PtGammaOneMin_, selePi0PtPi0Min_, selePi0S4S9GammaOneMin_, selePi0S4S9GammaTwoMin_, selePi0S9S25GammaOneMin_, selePi0S9S25GammaTwoMin_, singleTopDQM_cfi::setup, shapeAlgo_, Validation_hcalonly_cfi::sign, funct::sin(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), HLT_2024v11_cff::topology, wxtals, and EBDetId::zside().

268  {
269  using namespace edm;
270  using namespace std;
271 
272  // this chunk used to belong to beginJob(isetup). Moved here
273  // with the beginJob without arguments migration
274 
275  // get the ecal geometry:
276  const auto& geometry = setup.getData(geometryToken_);
277 
278  if (isfirstcall_) {
279  // initialize arrays
280 
281  for (int sign = 0; sign < 2; sign++) {
282  for (int ieta = 0; ieta < 85; ieta++) {
283  for (int iphi = 0; iphi < 360; iphi++) {
284  oldCalibs_barl[ieta][iphi][sign] = 0.;
285  newCalibs_barl[ieta][iphi][sign] = 0.;
286  wxtals[ieta][iphi][sign] = 0.;
287  mwxtals[ieta][iphi][sign] = 0.;
288  }
289  }
290  }
291 
292  // get initial constants out of DB
293 
294  const auto& pIcal = setup.getData(intercalibConstantsToken_);
295  const auto& imap = pIcal.getMap();
296  std::cout << "imap.size() = " << imap.size() << std::endl;
297 
298  // loop over all barrel crystals
299  barrelCells = geometry.getValidDetIds(DetId::Ecal, EcalBarrel);
300  std::vector<DetId>::const_iterator barrelIt;
301  for (barrelIt = barrelCells.begin(); barrelIt != barrelCells.end(); barrelIt++) {
302  EBDetId eb(*barrelIt);
303 
304  // get the initial calibration constants
305  EcalIntercalibConstantMap::const_iterator itcalib = imap.find(eb.rawId());
306  if (itcalib == imap.end()) {
307  // FIXME -- throw error
308  }
309  EcalIntercalibConstant calib = (*itcalib);
310  int sign = eb.zside() > 0 ? 1 : 0;
311  oldCalibs_barl[abs(eb.ieta()) - 1][eb.iphi() - 1][sign] = calib;
312  if (eb.iphi() == 1)
313  std::cout << "Read old constant for crystal "
314  << " (" << eb.ieta() << "," << eb.iphi() << ") : " << calib << std::endl;
315  }
316  isfirstcall_ = false;
317  }
318 
319  nevent++;
320 
321  if ((nevent < 100 && nevent % 10 == 0) || (nevent < 1000 && nevent % 100 == 0) ||
322  (nevent < 10000 && nevent % 100 == 0) || (nevent < 100000 && nevent % 1000 == 0) ||
323  (nevent < 10000000 && nevent % 1000 == 0))
324  std::cout << "[Pi0FixedMassWindowCalibration] Events processed: " << nevent << std::endl;
325 
326  recHitsEB_map = new std::map<DetId, EcalRecHit>();
327 
329 
330  Handle<EcalRecHitCollection> pEcalRecHitBarrelCollection;
331  event.getByToken(recHitToken_, pEcalRecHitBarrelCollection);
332  const EcalRecHitCollection* ecalRecHitBarrelCollection = pEcalRecHitBarrelCollection.product();
333  cout << " ECAL Barrel RecHits # " << ecalRecHitBarrelCollection->size() << endl;
335  aRecHitEB != ecalRecHitBarrelCollection->end();
336  aRecHitEB++) {
337  EBDetId ebrhdetid = aRecHitEB->detid();
338  //cout << " EBDETID: z,ieta,iphi "<<ebrhdetid.zside()<<" "<<ebrhdetid.ieta()<<" "<<ebrhdetid.iphi()<<endl;
339  //cout << " EBDETID: tower_ieta,tower_iphi "<<ebrhdetid.tower_ieta()<<" "<<ebrhdetid.tower_iphi()<<endl;
340  //cout << " EBDETID: iSM, ic "<<ebrhdetid.ism()<<" "<<ebrhdetid.ic()<<endl;
341 
342  int sign = ebrhdetid.zside() > 0 ? 1 : 0;
343  EcalRecHit aHit(aRecHitEB->id(),
344  aRecHitEB->energy() * oldCalibs_barl[abs(ebrhdetid.ieta()) - 1][ebrhdetid.iphi() - 1][sign],
345  aRecHitEB->time());
347  }
348 
349  // cout<<" Recalib size: "<<recalibEcalRecHitCollection->size()<<endl;
351  aRecHitEB != recalibEcalRecHitCollection->end();
352  aRecHitEB++) {
353  // EBDetId ebrhdetid = aRecHitEB->detid();
354  //cout << " [recalibrated] EBDETID: z,ieta,iphi "<<ebrhdetid.zside()<<" "<<ebrhdetid.ieta()<<" "<<ebrhdetid.iphi()<<endl;
355  //cout << " [recalibrated] EBDETID: tower_ieta,tower_iphi "<<ebrhdetid.tower_ieta()<<" "<<ebrhdetid.tower_iphi()<<endl;
356  //cout << " [recalibrated] EBDETID: iSM, ic "<<ebrhdetid.ism()<<" "<<ebrhdetid.ic()<<endl;
357 
358  std::pair<DetId, EcalRecHit> map_entry(aRecHitEB->id(), *aRecHitEB);
359  recHitsEB_map->insert(map_entry);
360  }
361 
362  const CaloSubdetectorGeometry* geometry_p;
363 
364  std::string clustershapetag;
365  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
367 
368  const CaloSubdetectorGeometry* geometryES_p;
369  geometryES_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
370 
371  /*
372  reco::BasicClusterCollection clusters;
373  clusters = island_p->makeClusters(ecalRecHitBarrelCollection,geometry_p,&topology,geometryES_p,IslandClusterAlgo::barrel);
374 
375  //Create associated ClusterShape objects.
376  std::vector <reco::ClusterShape> ClusVec;
377  for (int erg=0;erg<int(clusters.size());++erg){
378  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],ecalRecHitBarrelCollection,geometry_p,&topology);
379  ClusVec.push_back(TestShape);
380  }
381 
382  //Put clustershapes in event, but retain a Handle on them.
383  std::unique_ptr<reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
384  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
385 
386  cout<<"[Pi0Calibration] Basic Cluster collection size: "<<clusters.size()<<endl;
387  cout<<"[Pi0Calibration] Basic Cluster Shape Collection size: "<<clustersshapes_p->size()<<endl;
388 
389  int iClus=0;
390  for(reco::BasicClusterCollection::const_iterator aClus = clusters.begin(); aClus != clusters.end(); aClus++) {
391  cout<<" CLUSTER : #,NHits,e,et,eta,phi,e2x2,e3x3,e5x5: "<<iClus<<" "<<aClus->getHitsByDetId().size()<<" "<<aClus->energy()<<" "<<aClus->energy()*sin(aClus->position().theta())<<" "<<aClus->position().eta()<<" "<<aClus->position().phi()<<" "<<(*clustersshapes_p)[iClus].e2x2()<<" "<<(*clustersshapes_p)[iClus].e3x3()<<" "<<(*clustersshapes_p)[iClus].e5x5()<<endl;
392  iClus++;
393  }
394  */
395 
396  // recalibrated clusters
397  reco::BasicClusterCollection clusters_recalib;
398  clusters_recalib = island_p->makeClusters(
399  recalibEcalRecHitCollection, geometry_p, &topology, geometryES_p, IslandClusterAlgo::barrel);
400 
401  //Create associated ClusterShape objects.
402  std::vector<reco::ClusterShape> ClusVec_recalib;
403  for (int erg = 0; erg < int(clusters_recalib.size()); ++erg) {
404  reco::ClusterShape TestShape_recalib =
405  shapeAlgo_.Calculate(clusters_recalib[erg], recalibEcalRecHitCollection, geometry_p, &topology);
406  ClusVec_recalib.push_back(TestShape_recalib);
407  }
408 
409  //Put clustershapes in event, but retain a Handle on them.
410  std::unique_ptr<reco::ClusterShapeCollection> clustersshapes_p_recalib(new reco::ClusterShapeCollection);
411  clustersshapes_p_recalib->assign(ClusVec_recalib.begin(), ClusVec_recalib.end());
412 
413  cout << "[Pi0FixedMassWindowCalibration][recalibration] Basic Cluster collection size: " << clusters_recalib.size()
414  << endl;
415  cout << "[Pi0FixedMassWindowCalibration][recalibration] Basic Cluster Shape Collection size: "
416  << clustersshapes_p_recalib->size() << endl;
417 
418  // pizero selection
419 
420  // Get ECAL Barrel Island Basic Clusters collection
421  // ECAL Barrel Island Basic Clusters
422  static const int MAXBCEB = 200;
423  static const int MAXBCEBRH = 200;
424  int nIslandBCEB;
425  float eIslandBCEB[MAXBCEB];
426  float etIslandBCEB[MAXBCEB];
427  float etaIslandBCEB[MAXBCEB];
428  float phiIslandBCEB[MAXBCEB];
429  float e2x2IslandBCEB[MAXBCEB];
430  float e3x3IslandBCEB[MAXBCEB];
431  float e5x5IslandBCEB[MAXBCEB];
432  // indexes to the RecHits assiciated with
433  // ECAL Barrel Island Basic Clusters
434  int nIslandBCEBRecHits[MAXBCEB];
435  // int indexIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
436  int ietaIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
437  int iphiIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
438  int zsideIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
439  float eIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
440 
441  nIslandBCEB = 0;
442  for (int i = 0; i < MAXBCEB; i++) {
443  eIslandBCEB[i] = 0;
444  etIslandBCEB[i] = 0;
445  etaIslandBCEB[i] = 0;
446  phiIslandBCEB[i] = 0;
447  e2x2IslandBCEB[i] = 0;
448  e3x3IslandBCEB[i] = 0;
449  e5x5IslandBCEB[i] = 0;
450  nIslandBCEBRecHits[i] = 0;
451  for (int j = 0; j < MAXBCEBRH; j++) {
452  // indexIslandBCEBRecHits[i][j] = 0;
453  ietaIslandBCEBRecHits[i][j] = 0;
454  iphiIslandBCEBRecHits[i][j] = 0;
455  zsideIslandBCEBRecHits[i][j] = 0;
456  eIslandBCEBRecHits[i][j] = 0;
457  }
458  }
459 
460  int iClus_recalib = 0;
461  for (reco::BasicClusterCollection::const_iterator aClus = clusters_recalib.begin(); aClus != clusters_recalib.end();
462  aClus++) {
463  cout << " CLUSTER [recalibration] : #,NHits,e,et,eta,phi,e2x2,e3x3,e5x5: " << iClus_recalib << " " << aClus->size()
464  << " " << aClus->energy() << " " << aClus->energy() * sin(aClus->position().theta()) << " "
465  << aClus->position().eta() << " " << aClus->position().phi() << " "
466  << (*clustersshapes_p_recalib)[iClus_recalib].e2x2() << " "
467  << (*clustersshapes_p_recalib)[iClus_recalib].e3x3() << " "
468  << (*clustersshapes_p_recalib)[iClus_recalib].e5x5() << endl;
469 
470  eIslandBCEB[nIslandBCEB] = aClus->energy();
471  etIslandBCEB[nIslandBCEB] = aClus->energy() * sin(aClus->position().theta());
472  etaIslandBCEB[nIslandBCEB] = aClus->position().eta();
473  phiIslandBCEB[nIslandBCEB] = aClus->position().phi();
474 
475  e2x2IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e2x2();
476  e3x3IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e3x3();
477  e5x5IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e5x5();
478 
479  nIslandBCEBRecHits[nIslandBCEB] = aClus->size();
480 
481  std::vector<std::pair<DetId, float>> hits = aClus->hitsAndFractions();
482  std::vector<std::pair<DetId, float>>::iterator hit;
483  std::map<DetId, EcalRecHit>::iterator aHit;
484 
485  int irhcount = 0;
486  for (hit = hits.begin(); hit != hits.end(); hit++) {
487  // need to get hit by DetID in order to get energy
488  aHit = recHitsEB_map->find((*hit).first);
489  //cout << " RecHit #: "<<irhcount<<" from Basic Cluster with Energy: "<<aHit->second.energy()<<endl;
490 
491  EBDetId sel_rh = aHit->second.detid();
492  //cout << " RecHit: z,ieta,iphi "<<sel_rh.zside()<<" "<<sel_rh.ieta()<<" "<<sel_rh.iphi()<<endl;
493  //cout << " RecHit: tower_ieta,tower_iphi "<<sel_rh.tower_ieta()<<" "<<sel_rh.tower_iphi()<<endl;
494  //cout << " RecHit: iSM, ic "<<sel_rh.ism()<<" "<<sel_rh.ic()<<endl;
495 
496  ietaIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.ieta();
497  iphiIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.iphi();
498  zsideIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.zside();
499  eIslandBCEBRecHits[nIslandBCEB][irhcount] = aHit->second.energy();
500 
501  irhcount++;
502  }
503  nIslandBCEB++;
504  iClus_recalib++;
505  }
506 
507  // Selection, based on ECAL Barrel Basic Clusters
508 
509  if (nIslandBCEB > 1) {
510  for (int i = 0; i < nIslandBCEB; i++) {
511  for (int j = i + 1; j < nIslandBCEB; j++) {
512  if (etIslandBCEB[i] > selePi0PtGammaOneMin_ && etIslandBCEB[j] > selePi0PtGammaOneMin_) {
513  float theta_0 = 2. * atan(exp(-etaIslandBCEB[i]));
514  float theta_1 = 2. * atan(exp(-etaIslandBCEB[j]));
515 
516  float p0x = eIslandBCEB[i] * sin(theta_0) * cos(phiIslandBCEB[i]);
517  float p1x = eIslandBCEB[j] * sin(theta_1) * cos(phiIslandBCEB[j]);
518 
519  float p0y = eIslandBCEB[i] * sin(theta_0) * sin(phiIslandBCEB[i]);
520  float p1y = eIslandBCEB[j] * sin(theta_1) * sin(phiIslandBCEB[j]);
521 
522  float p0z = eIslandBCEB[i] * cos(theta_0);
523  float p1z = eIslandBCEB[j] * cos(theta_1);
524 
525  float pi0_px = p0x + p1x;
526  float pi0_py = p0y + p1y;
527  float pi0_pz = p0z + p1z;
528 
529  float pi0_ptot = sqrt(pi0_px * pi0_px + pi0_py * pi0_py + pi0_pz * pi0_pz);
530 
531  float pi0_theta = acos(pi0_pz / pi0_ptot);
532  float pi0_eta = -log(tan(pi0_theta / 2));
533  float pi0_phi = atan(pi0_py / pi0_px);
534  //cout << " pi0_theta, pi0_eta, pi0_phi "<<pi0_theta<<" "<<pi0_eta<<" "<<pi0_phi<<endl;
535 
536  // belt isolation
537 
538  float et_belt = 0;
539  for (Int_t k = 0; k < nIslandBCEB; k++) {
540  if ((k != i) && (k != j)) {
541  float dr_pi0_k = sqrt((etaIslandBCEB[k] - pi0_eta) * (etaIslandBCEB[k] - pi0_eta) +
542  (phiIslandBCEB[k] - pi0_phi) * (phiIslandBCEB[k] - pi0_phi));
543  float deta_pi0_k = fabs(etaIslandBCEB[k] - pi0_eta);
544  if ((dr_pi0_k < selePi0DRBelt_) && (deta_pi0_k < selePi0DetaBelt_))
545  et_belt = et_belt + etIslandBCEB[k];
546  }
547  }
548 
549  float pt_pi0 = sqrt((p0x + p1x) * (p0x + p1x) + (p0y + p1y) * (p0y + p1y));
550  //float dr_pi0 = sqrt ( (etaIslandBCEB[i]-etaIslandBCEB[j])*(etaIslandBCEB[i]-etaIslandBCEB[j]) + (phiIslandBCEB[i]-phiIslandBCEB[j])*(phiIslandBCEB[i]-phiIslandBCEB[j]) );
551 
552  //cout <<" pi0 pt,dr: "<<pt_pi0<<" "<<dr_pi0<<endl;
553  if (pt_pi0 > selePi0PtPi0Min_) {
554  float m_inv = sqrt((eIslandBCEB[i] + eIslandBCEB[j]) * (eIslandBCEB[i] + eIslandBCEB[j]) -
555  (p0x + p1x) * (p0x + p1x) - (p0y + p1y) * (p0y + p1y) - (p0z + p1z) * (p0z + p1z));
556  cout << " pi0 (pt>2.5 GeV) m_inv = " << m_inv << endl;
557 
558  float s4s9_1 = e2x2IslandBCEB[i] / e3x3IslandBCEB[i];
559  float s4s9_2 = e2x2IslandBCEB[j] / e3x3IslandBCEB[j];
560 
561  float s9s25_1 = e3x3IslandBCEB[i] / e5x5IslandBCEB[i];
562  float s9s25_2 = e3x3IslandBCEB[j] / e5x5IslandBCEB[j];
563 
564  //float s9Esc_1 = e3x3IslandBCEB[i]/eIslandBCEB[i];
565  //float s9Esc_2 = e3x3IslandBCEB[j]/eIslandBCEB[j];
566 
567  if (s4s9_1 > selePi0S4S9GammaOneMin_ && s4s9_2 > selePi0S4S9GammaTwoMin_ &&
568  s9s25_1 > selePi0S9S25GammaOneMin_ && s9s25_2 > selePi0S9S25GammaTwoMin_ &&
569  (et_belt / pt_pi0 < selePi0EtBeltIsoRatioMax_)) {
570  //good pizero candidate
571  if (m_inv > (selePi0MinvMeanFixed_ - 2 * selePi0MinvSigmaFixed_) &&
573  //fill wxtals and mwxtals weights
574  cout << " Pi0 Good candidate : minv = " << m_inv << endl;
575  for (int kk = 0; kk < nIslandBCEBRecHits[i]; kk++) {
576  int ieta_xtal = ietaIslandBCEBRecHits[i][kk];
577  int iphi_xtal = iphiIslandBCEBRecHits[i][kk];
578  int sign = zsideIslandBCEBRecHits[i][kk] > 0 ? 1 : 0;
579  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
580  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] + eIslandBCEBRecHits[i][kk] / e3x3IslandBCEB[i];
581  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
582  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] +
583  (selePi0MinvMeanFixed_ / m_inv) * (selePi0MinvMeanFixed_ / m_inv) *
584  (eIslandBCEBRecHits[i][kk] / e3x3IslandBCEB[i]);
585  cout << "[Pi0FixedMassWindowCalibration] eta, phi, sign, e, e3x3, wxtals and mwxtals: " << ieta_xtal
586  << " " << iphi_xtal << " " << sign << " " << eIslandBCEBRecHits[i][kk] << " "
587  << e3x3IslandBCEB[i] << " " << wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << " "
588  << mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << endl;
589  }
590 
591  for (int kk = 0; kk < nIslandBCEBRecHits[j]; kk++) {
592  int ieta_xtal = ietaIslandBCEBRecHits[j][kk];
593  int iphi_xtal = iphiIslandBCEBRecHits[j][kk];
594  int sign = zsideIslandBCEBRecHits[j][kk] > 0 ? 1 : 0;
595  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
596  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] + eIslandBCEBRecHits[j][kk] / e3x3IslandBCEB[j];
597  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
598  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] +
599  (selePi0MinvMeanFixed_ / m_inv) * (selePi0MinvMeanFixed_ / m_inv) *
600  (eIslandBCEBRecHits[j][kk] / e3x3IslandBCEB[j]);
601  cout << "[Pi0FixedMassWindowCalibration] eta, phi, sign, e, e3x3, wxtals and mwxtals: " << ieta_xtal
602  << " " << iphi_xtal << " " << sign << " " << eIslandBCEBRecHits[j][kk] << " "
603  << e3x3IslandBCEB[j] << " " << wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << " "
604  << mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << endl;
605  }
606  }
607  }
608  }
609  }
610 
611  } // End of the "j" loop over BCEB
612  } // End of the "i" loop over BCEB
613 
614  } else {
615  cout << " Not enough ECAL Barrel Basic Clusters: " << nIslandBCEB << endl;
616  }
617 
618  return kContinue;
619 }
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > intercalibConstantsToken_
size_type size() const
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T const * product() const
Definition: Handle.h:70
std::vector< EcalRecHit >::const_iterator const_iterator
void push_back(T const &t)
std::vector< ClusterShape > ClusterShapeCollection
collection of ClusterShape objects
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
reco::ClusterShape Calculate(const reco::BasicCluster &passedCluster, const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology)
T sqrt(T t)
Definition: SSEVec.h:19
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
const_iterator begin() const
int zside() const
get the z-side of the crystal (1/-1)
Definition: EBDetId.h:45
const EcalRecHitCollection * ecalRecHitBarrelCollection
const_iterator end() const
const edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
std::vector< reco::BasicCluster > makeClusters(const EcalRecHitCollection *hits, const CaloSubdetectorGeometry *geometry, const CaloSubdetectorTopology *topology_p, const CaloSubdetectorGeometry *geometryES_p, EcalPart ecalPart, bool regional=false, const std::vector< RectangularEtaPhiRegion > &regions=std::vector< RectangularEtaPhiRegion >())
std::vector< Item >::const_iterator const_iterator
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
HLT enums.
std::map< DetId, EcalRecHit > * recHitsEB_map
const EcalRecHitCollection * recalibEcalRecHitCollection
float EcalIntercalibConstant

◆ endOfJob()

void Pi0FixedMassWindowCalibration::endOfJob ( )
overridevirtual

Called at end of job.

Reimplemented from edm::EDLooperBase.

Definition at line 179 of file Pi0FixedMassWindowCalibration.cc.

References funct::abs(), barrelCells, gather_cfg::cout, EcalBarrel, hcalRecHitTable_cff::ieta, EBDetId::ieta(), hcalRecHitTable_cff::iphi, EBDetId::iphi(), newCalibs_barl, Validation_hcalonly_cfi::sign, Pi0CalibXMLwriter::writeLine(), and EBDetId::zside().

179  {
180  std::cout << "[Pi0FixedMassWindowCalibration] endOfJob" << endl;
181 
182  // Write new calibration constants
183 
184  Pi0CalibXMLwriter barrelWriter(EcalBarrel, 99);
185 
186  std::vector<DetId>::const_iterator barrelIt = barrelCells.begin();
187  for (; barrelIt != barrelCells.end(); barrelIt++) {
188  EBDetId eb(*barrelIt);
189  int ieta = eb.ieta();
190  int iphi = eb.iphi();
191  int sign = eb.zside() > 0 ? 1 : 0;
192  barrelWriter.writeLine(eb, newCalibs_barl[abs(ieta) - 1][iphi - 1][sign]);
193  }
194 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ endOfLoop()

edm::EDLooper::Status Pi0FixedMassWindowCalibration::endOfLoop ( const edm::EventSetup iSetup,
unsigned int  iLoop 
)
overridevirtual

Called at end of loop.

Implements edm::EDLooperBase.

Definition at line 213 of file Pi0FixedMassWindowCalibration.cc.

References funct::abs(), barrelCells, gather_cfg::cout, EcalBarrel, hcalRecHitTable_cff::ieta, EBDetId::ieta(), hcalRecHitTable_cff::iphi, EBDetId::iphi(), edm::EDLooperBase::kContinue, edm::EDLooperBase::kStop, mwxtals, newCalibs_barl, oldCalibs_barl, Validation_hcalonly_cfi::sign, theMaxLoops, Pi0CalibXMLwriter::writeLine(), wxtals, and EBDetId::zside().

213  {
214  std::cout << "[Pi0FixedMassWindowCalibration] Ending loop " << iLoop << std::endl;
215 
216  for (int sign = 0; sign < 2; sign++) {
217  for (int ieta = 0; ieta < 85; ieta++) {
218  for (int iphi = 0; iphi < 360; iphi++) {
219  if (wxtals[ieta][iphi][sign] == 0) {
221  } else {
224  }
225  cout << " New calibration constant: ieta iphi sign - old,mwxtals,wxtals,new: " << ieta << " " << iphi << " "
226  << sign << " - " << oldCalibs_barl[ieta][iphi][sign] << " " << mwxtals[ieta][iphi][sign] << " "
227  << wxtals[ieta][iphi][sign] << " " << newCalibs_barl[ieta][iphi][sign] << endl;
228  }
229  }
230  }
231 
232  Pi0CalibXMLwriter barrelWriter(EcalBarrel, iLoop + 1);
233 
234  std::vector<DetId>::const_iterator barrelIt = barrelCells.begin();
235  for (; barrelIt != barrelCells.end(); barrelIt++) {
236  EBDetId eb(*barrelIt);
237  int ieta = eb.ieta();
238  int iphi = eb.iphi();
239  int sign = eb.zside() > 0 ? 1 : 0;
240  barrelWriter.writeLine(eb, newCalibs_barl[abs(ieta) - 1][iphi - 1][sign]);
241  if (iphi == 1) {
242  std::cout << "Calib constant for barrel crystal "
243  << " (" << ieta << "," << iphi << ") changed from " << oldCalibs_barl[abs(ieta) - 1][iphi - 1][sign]
244  << " to " << newCalibs_barl[abs(ieta) - 1][iphi - 1][sign] << std::endl;
245  }
246  }
247 
248  // replace old calibration constants with new one
249 
250  for (int sign = 0; sign < 2; sign++) {
251  for (int ieta = 0; ieta < 85; ieta++) {
252  for (int iphi = 0; iphi < 360; iphi++) {
254  newCalibs_barl[ieta][iphi][sign] = 0;
255  }
256  }
257  }
258 
259  if (iLoop == theMaxLoops - 1 || iLoop >= theMaxLoops)
260  return kStop;
261  else
262  return kContinue;
263 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22

◆ fillDescriptions()

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

Definition at line 119 of file Pi0FixedMassWindowCalibration.cc.

References edm::ConfigurationDescriptions::add(), submitPVResolutionJobs::desc, ecalPiZeroTask_cfi::posCalcParameters, and AlCaHLTBitMon_QueryRunRegistry::string.

119  {
121 
122  desc.add<unsigned int>("maxLoops", 0);
123  desc.add<std::string>("ecalRecHitsProducer", "");
124  desc.add<std::string>("barrelHitCollection", "");
125 
126  desc.add<std::string>("VerbosityLevel", "");
127  desc.add<std::string>("barrelClusterCollection", "");
128 
129  desc.add<double>("IslandBarrelSeedThr", 0);
130  desc.add<double>("IslandEndcapSeedThr", 0);
131 
132  desc.add<double>("selePi0PtGammaOneMin", 0);
133  desc.add<double>("selePi0PtGammaTwoMin", 0);
134 
135  desc.add<double>("selePi0DRBelt", 0);
136  desc.add<double>("selePi0DetaBelt", 0);
137 
138  desc.add<double>("selePi0PtPi0Min", 0);
139 
140  desc.add<double>("selePi0S4S9GammaOneMin", 0);
141  desc.add<double>("selePi0S4S9GammaTwoMin", 0);
142  desc.add<double>("selePi0S9S25GammaOneMin", 0);
143  desc.add<double>("selePi0S9S25GammaTwoMin", 0);
144 
145  desc.add<double>("selePi0EtBeltIsoRatioMax", 0);
146 
147  desc.add<double>("selePi0MinvMeanFixed", 0);
148  desc.add<double>("selePi0MinvSigmaFixed", 0);
149 
151  posCalcParameters.add<bool>("LogWeighted", true);
152  posCalcParameters.add<double>("T0_barl", 7.4);
153  posCalcParameters.add<double>("T0_endc", 3.1);
154  posCalcParameters.add<double>("T0_endcPresh", 1.2);
155  posCalcParameters.add<double>("W0", 4.2);
156  posCalcParameters.add<double>("X0", 0.89);
157  desc.add<edm::ParameterSetDescription>("posCalcParameters", posCalcParameters);
158 
159  desc.add<std::string>("clustershapecollectionEB", "islandBarrelShape");
160  desc.add<std::string>("barrelShapeAssociation", "islandBarrelShapeAssoc");
161 
162  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEB", {});
163  desc.add<std::vector<std::string>>("SeedRecHitFlagToBeExcludedEE", {});
164  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEB", {});
165  desc.add<std::vector<std::string>>("RecHitFlagToBeExcludedEE", {});
166 
167  descriptions.add("Pi0FixedMassWindowCalibration", desc);
168 }
void add(std::string const &label, ParameterSetDescription const &psetDescription)

◆ produce()

virtual void Pi0FixedMassWindowCalibration::produce ( edm::Event ,
const edm::EventSetup  
)
inlinevirtual

Dummy implementation (job done in duringLoop)

Definition at line 52 of file Pi0FixedMassWindowCalibration.h.

52 {};

◆ startingNewLoop()

void Pi0FixedMassWindowCalibration::startingNewLoop ( unsigned int  iLoop)
overridevirtual

Called at beginning of loop.

Implements edm::EDLooperBase.

Definition at line 198 of file Pi0FixedMassWindowCalibration.cc.

References gather_cfg::cout, hcalRecHitTable_cff::ieta, hcalRecHitTable_cff::iphi, mwxtals, Validation_hcalonly_cfi::sign, and wxtals.

198  {
199  for (int sign = 0; sign < 2; sign++) {
200  for (int ieta = 0; ieta < 85; ieta++) {
201  for (int iphi = 0; iphi < 360; iphi++) {
202  wxtals[ieta][iphi][sign] = 0.;
203  mwxtals[ieta][iphi][sign] = 0.;
204  }
205  }
206  }
207  std::cout << "[Pi0FixedMassWindowCalibration] Starting loop number " << iLoop << std::endl;
208 }

Member Data Documentation

◆ barrelCells

std::vector<DetId> Pi0FixedMassWindowCalibration::barrelCells
private

Definition at line 109 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), endOfJob(), and endOfLoop().

◆ barrelClusterCollection_

std::string Pi0FixedMassWindowCalibration::barrelClusterCollection_
private

Definition at line 82 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ barrelClusterShapeAssociation_

std::string Pi0FixedMassWindowCalibration::barrelClusterShapeAssociation_
private

Definition at line 84 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ barrelHitCollection_

std::string Pi0FixedMassWindowCalibration::barrelHitCollection_
private

Definition at line 81 of file Pi0FixedMassWindowCalibration.h.

◆ barrelHitProducer_

std::string Pi0FixedMassWindowCalibration::barrelHitProducer_
private

Definition at line 80 of file Pi0FixedMassWindowCalibration.h.

◆ barrelHits_

const std::string Pi0FixedMassWindowCalibration::barrelHits_
private

Definition at line 76 of file Pi0FixedMassWindowCalibration.h.

◆ clustershapecollectionEB_

std::string Pi0FixedMassWindowCalibration::clustershapecollectionEB_
private

Definition at line 83 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ ecalHitsProducer_

const std::string Pi0FixedMassWindowCalibration::ecalHitsProducer_
private

Definition at line 75 of file Pi0FixedMassWindowCalibration.h.

◆ ecalRecHitBarrelCollection

const EcalRecHitCollection* Pi0FixedMassWindowCalibration::ecalRecHitBarrelCollection
private

Definition at line 124 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ geometryToken_

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> Pi0FixedMassWindowCalibration::geometryToken_
private

Definition at line 129 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ intercalibConstantsToken_

const edm::ESGetToken<EcalIntercalibConstants, EcalIntercalibConstantsRcd> Pi0FixedMassWindowCalibration::intercalibConstantsToken_
private

Definition at line 128 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ isfirstcall_

bool Pi0FixedMassWindowCalibration::isfirstcall_
private

Definition at line 131 of file Pi0FixedMassWindowCalibration.h.

Referenced by beginOfJob(), and duringLoop().

◆ island_p

IslandClusterAlgo* Pi0FixedMassWindowCalibration::island_p
private

◆ mwxtals

double Pi0FixedMassWindowCalibration::mwxtals[85][360][2]
private

Definition at line 115 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), endOfLoop(), and startingNewLoop().

◆ nevent

int Pi0FixedMassWindowCalibration::nevent
private

Definition at line 72 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ newCalibs_barl

double Pi0FixedMassWindowCalibration::newCalibs_barl[85][360][2]
private

Definition at line 113 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), endOfJob(), and endOfLoop().

◆ oldCalibs_barl

double Pi0FixedMassWindowCalibration::oldCalibs_barl[85][360][2]
private

Definition at line 112 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and endOfLoop().

◆ posCalculator_

PositionCalc Pi0FixedMassWindowCalibration::posCalculator_
private

Definition at line 86 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ recalibEcalRecHitCollection

const EcalRecHitCollection* Pi0FixedMassWindowCalibration::recalibEcalRecHitCollection
private

Definition at line 125 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ recHitsEB_map

std::map<DetId, EcalRecHit>* Pi0FixedMassWindowCalibration::recHitsEB_map
private

Definition at line 122 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ recHitToken_

const edm::EDGetTokenT<EcalRecHitCollection> Pi0FixedMassWindowCalibration::recHitToken_
private

Definition at line 127 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

◆ selePi0DetaBelt_

double Pi0FixedMassWindowCalibration::selePi0DetaBelt_
private

Definition at line 95 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0DRBelt_

double Pi0FixedMassWindowCalibration::selePi0DRBelt_
private

Definition at line 94 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0EtBeltIsoRatioMax_

double Pi0FixedMassWindowCalibration::selePi0EtBeltIsoRatioMax_
private

Definition at line 104 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0MinvMeanFixed_

double Pi0FixedMassWindowCalibration::selePi0MinvMeanFixed_
private

Definition at line 106 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0MinvSigmaFixed_

double Pi0FixedMassWindowCalibration::selePi0MinvSigmaFixed_
private

Definition at line 107 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0PtGammaOneMin_

double Pi0FixedMassWindowCalibration::selePi0PtGammaOneMin_
private

Definition at line 91 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0PtGammaTwoMin_

double Pi0FixedMassWindowCalibration::selePi0PtGammaTwoMin_
private

Definition at line 92 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ selePi0PtPi0Min_

double Pi0FixedMassWindowCalibration::selePi0PtPi0Min_
private

Definition at line 97 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0S4S9GammaOneMin_

double Pi0FixedMassWindowCalibration::selePi0S4S9GammaOneMin_
private

Definition at line 99 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0S4S9GammaTwoMin_

double Pi0FixedMassWindowCalibration::selePi0S4S9GammaTwoMin_
private

Definition at line 100 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0S9S25GammaOneMin_

double Pi0FixedMassWindowCalibration::selePi0S9S25GammaOneMin_
private

Definition at line 101 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ selePi0S9S25GammaTwoMin_

double Pi0FixedMassWindowCalibration::selePi0S9S25GammaTwoMin_
private

Definition at line 102 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ shapeAlgo_

ClusterShapeAlgo Pi0FixedMassWindowCalibration::shapeAlgo_
private

Definition at line 87 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

◆ theMaxLoops

const unsigned int Pi0FixedMassWindowCalibration::theMaxLoops
private

Definition at line 74 of file Pi0FixedMassWindowCalibration.h.

Referenced by endOfLoop().

◆ theParameterSet

edm::ParameterSet Pi0FixedMassWindowCalibration::theParameterSet
private

Definition at line 119 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ verbosity

IslandClusterAlgo::VerbosityLevel Pi0FixedMassWindowCalibration::verbosity
private

Definition at line 78 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

◆ wxtals

double Pi0FixedMassWindowCalibration::wxtals[85][360][2]
private

Definition at line 114 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), endOfLoop(), and startingNewLoop().