CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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::ESProxyFactoryProducer edm::EDLooperBase edm::eventsetup::DataProxyProvider 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::EventSetupRecordKey
modifyingRecords () const override
 
const ESProducerLooperoperator= (const ESProducerLooper &)=delete
 
- Public Member Functions inherited from edm::ESProducer
 ESProducer ()
 
 ESProducer (const ESProducer &)=delete
 
ESProxyIndex const * getTokenIndices (unsigned int iIndex) const
 
ESRecordIndex const * getTokenRecordIndices (unsigned int iIndex) const
 
bool hasMayConsumes () const noexcept
 
size_t numberOfTokenIndices (unsigned int iIndex) const
 
ESProducer const & operator= (const ESProducer &)=delete
 
SerialTaskQueueChainqueue ()
 
template<typename Record >
std::optional< std::vector
< ESProxyIndex > > 
updateFromMayConsumes (unsigned int iIndex, const Record &iRecord) const
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &) final
 
 ~ESProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::ESProxyFactoryProducer
 ESProxyFactoryProducer ()
 
 ESProxyFactoryProducer (const ESProxyFactoryProducer &)=delete
 
const ESProxyFactoryProduceroperator= (const ESProxyFactoryProducer &)=delete
 
 ~ESProxyFactoryProducer () noexcept(false) override
 
- Public Member Functions inherited from edm::eventsetup::DataProxyProvider
void createKeyedProxies (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
 DataProxyProvider ()
 
 DataProxyProvider (const DataProxyProvider &)=delete
 
const ComponentDescriptiondescription () const
 
void fillRecordsNotAllowingConcurrentIOVs (std::set< EventSetupRecordKey > &recordsNotAllowingConcurrentIOVs) const
 
virtual void initConcurrentIOVs (EventSetupRecordKey const &key, unsigned int nConcurrentIOVs)
 
bool isUsingRecord (const EventSetupRecordKey &key) const
 
KeyedProxieskeyedProxies (const EventSetupRecordKey &iRecordKey, unsigned int iovIndex=0)
 
const DataProxyProvideroperator= (const DataProxyProvider &)=delete
 
void setAppendToDataLabel (const edm::ParameterSet &)
 
void setDescription (const ComponentDescription &iDescription)
 
std::set< EventSetupRecordKeyusingRecords () const
 
virtual ~DataProxyProvider () noexcept(false)
 
- Public Member Functions inherited from edm::EventSetupRecordIntervalFinder
bool concurrentFinder () const
 
const
eventsetup::ComponentDescription
descriptionForFinder () const
 
 EventSetupRecordIntervalFinder ()
 
 EventSetupRecordIntervalFinder (const EventSetupRecordIntervalFinder &)=delete
 
std::set
< eventsetup::EventSetupRecordKey
findingForRecords () const
 
const ValidityIntervalfindIntervalFor (const eventsetup::EventSetupRecordKey &, const IOVSyncValue &)
 
bool nonconcurrentAndIOVNeedsUpdate (const eventsetup::EventSetupRecordKey &key, const IOVSyncValue &syncValue) const
 
const
EventSetupRecordIntervalFinder
operator= (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
 
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::eventsetup::DataProxyProvider
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,
CaloGeometryRecord
geometryToken_
 
const edm::ESGetToken
< EcalIntercalibConstants,
EcalIntercalibConstantsRcd
intercalibConstantsToken_
 
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
< EcalRecHitCollection
recHitToken_
 
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::ESProxyFactoryProducer
using EventSetupRecordKey = eventsetup::EventSetupRecordKey
 
- Protected Types inherited from edm::eventsetup::DataProxyProvider
using KeyedProxiesVector = std::vector< std::pair< DataKey, std::shared_ptr< DataProxy >>>
 
- Protected Member Functions inherited from edm::ESProducerLooper
void registerFactoryWithKey (const eventsetup::EventSetupRecordKey &iRecord, std::unique_ptr< eventsetup::ProxyFactoryBase > 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
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 TArg >
ESConsumesCollectorT< TRecord > setWhatProduced (T *iThis, TReturn(T::*iMethod)(const TRecord &), const TArg &iDec, const es::Label &iLabel={})
 
void usesResources (std::vector< std::string > const &)
 
- Protected Member Functions inherited from edm::ESProxyFactoryProducer
template<class TFactory >
void registerFactory (std::unique_ptr< TFactory > iFactory, const std::string &iLabel=std::string())
 
KeyedProxiesVector registerProxies (const EventSetupRecordKey &, unsigned int iovIndex) override
 
- Protected Member Functions inherited from edm::eventsetup::DataProxyProvider
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 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

Definition at line 41 of file Pi0FixedMassWindowCalibration.h.

Constructor & Destructor Documentation

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(), iConfig, island_p, IslandClusterAlgo::pDEBUG, IslandClusterAlgo::pERROR, IslandClusterAlgo::pINFO, HLT_FULL_cff::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");
79  posCalculator_ = PositionCalc(posCalcParameters);
80  shapeAlgo_ = ClusterShapeAlgo(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,
104  posCalculator_,
105  seedflagsexclEB,
106  seedflagsexclEE,
107  flagsexclEB,
108  flagsexclEE,
109  verbosity);
110 
112 }
T getUntrackedParameter(std::string const &, T const &) const
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > intercalibConstantsToken_
IslandClusterAlgo::VerbosityLevel verbosity
tuple posCalcParameters
const edm::EDGetTokenT< EcalRecHitCollection > recHitToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
tuple cout
Definition: gather_cfg.py:144
Pi0FixedMassWindowCalibration::~Pi0FixedMassWindowCalibration ( )
override

Destructor.

Definition at line 117 of file Pi0FixedMassWindowCalibration.cc.

References island_p.

117 { delete island_p; }

Member Function Documentation

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 }
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(), funct::cos(), gather_cfg::cout, DetId::Ecal, EcalBarrel, EcalPreshower, ecalRecHitBarrelCollection, edm::SortedCollection< T, SORT >::end(), funct::exp(), relativeConstraints::geometry, geometryToken_, edm::EventSetup::getData(), mps_fire::i, EBDetId::ieta(), intercalibConstantsToken_, EBDetId::iphi(), isfirstcall_, island_p, dqmiolumiharvest::j, isotrackApplyRegressor::k, edm::EDLooperBase::kContinue, GetRecoTauVFromDQM_MC_cff::kk, log, IslandClusterAlgo::makeClusters(), mwxtals, nevent, newCalibs_barl, oldCalibs_barl, DetId::rawId(), recalibEcalRecHitCollection, recHitsEB_map, recHitToken_, selePi0DetaBelt_, selePi0DRBelt_, selePi0EtBeltIsoRatioMax_, selePi0MinvMeanFixed_, selePi0MinvSigmaFixed_, selePi0PtGammaOneMin_, selePi0PtPi0Min_, selePi0S4S9GammaOneMin_, selePi0S4S9GammaTwoMin_, selePi0S9S25GammaOneMin_, selePi0S9S25GammaTwoMin_, shapeAlgo_, jetcorrextractor::sign(), funct::sin(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), AlCaHLTBitMon_QueryRunRegistry::string, funct::tan(), 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  int nRecHitsEB = 0;
331  Handle<EcalRecHitCollection> pEcalRecHitBarrelCollection;
332  event.getByToken(recHitToken_, pEcalRecHitBarrelCollection);
333  const EcalRecHitCollection* ecalRecHitBarrelCollection = pEcalRecHitBarrelCollection.product();
334  cout << " ECAL Barrel RecHits # " << ecalRecHitBarrelCollection->size() << endl;
336  aRecHitEB != ecalRecHitBarrelCollection->end();
337  aRecHitEB++) {
338  //cout << " ECAL Barrel RecHit #,E,time,det,subdetid: "<<nRecHitsEB<<" "<<aRecHitEB->energy()<<" "<<aRecHitEB->time()<<" "<<aRecHitEB->detid().det()<<" "<<aRecHitEB->detid().subdetId()<<endl;
339 
340  EBDetId ebrhdetid = aRecHitEB->detid();
341  //cout << " EBDETID: z,ieta,iphi "<<ebrhdetid.zside()<<" "<<ebrhdetid.ieta()<<" "<<ebrhdetid.iphi()<<endl;
342  //cout << " EBDETID: tower_ieta,tower_iphi "<<ebrhdetid.tower_ieta()<<" "<<ebrhdetid.tower_iphi()<<endl;
343  //cout << " EBDETID: iSM, ic "<<ebrhdetid.ism()<<" "<<ebrhdetid.ic()<<endl;
344 
345  int sign = ebrhdetid.zside() > 0 ? 1 : 0;
346  EcalRecHit aHit(aRecHitEB->id(),
347  aRecHitEB->energy() * oldCalibs_barl[abs(ebrhdetid.ieta()) - 1][ebrhdetid.iphi() - 1][sign],
348  aRecHitEB->time());
350 
351  nRecHitsEB++;
352  }
353 
354  // cout<<" Recalib size: "<<recalibEcalRecHitCollection->size()<<endl;
355  int irecalib = 0;
357  aRecHitEB != recalibEcalRecHitCollection->end();
358  aRecHitEB++) {
359  //cout << " [recalibrated] ECAL Barrel RecHit #,E,time,det,subdetid: "<<irecalib<<" "<<aRecHitEB->energy()<<" "<<aRecHitEB->time()<<" "<<aRecHitEB->detid().det()<<" "<<aRecHitEB->detid().subdetId()<<endl;
360 
361  // EBDetId ebrhdetid = aRecHitEB->detid();
362  //cout << " [recalibrated] EBDETID: z,ieta,iphi "<<ebrhdetid.zside()<<" "<<ebrhdetid.ieta()<<" "<<ebrhdetid.iphi()<<endl;
363  //cout << " [recalibrated] EBDETID: tower_ieta,tower_iphi "<<ebrhdetid.tower_ieta()<<" "<<ebrhdetid.tower_iphi()<<endl;
364  //cout << " [recalibrated] EBDETID: iSM, ic "<<ebrhdetid.ism()<<" "<<ebrhdetid.ic()<<endl;
365 
366  std::pair<DetId, EcalRecHit> map_entry(aRecHitEB->id(), *aRecHitEB);
367  recHitsEB_map->insert(map_entry);
368 
369  irecalib++;
370  }
371 
372  const CaloSubdetectorGeometry* geometry_p;
373 
374  std::string clustershapetag;
375  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
376  EcalBarrelTopology topology{geometry};
377 
378  const CaloSubdetectorGeometry* geometryES_p;
379  geometryES_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
380 
381  /*
382  reco::BasicClusterCollection clusters;
383  clusters = island_p->makeClusters(ecalRecHitBarrelCollection,geometry_p,&topology,geometryES_p,IslandClusterAlgo::barrel);
384 
385  //Create associated ClusterShape objects.
386  std::vector <reco::ClusterShape> ClusVec;
387  for (int erg=0;erg<int(clusters.size());++erg){
388  reco::ClusterShape TestShape = shapeAlgo_.Calculate(clusters[erg],ecalRecHitBarrelCollection,geometry_p,&topology);
389  ClusVec.push_back(TestShape);
390  }
391 
392  //Put clustershapes in event, but retain a Handle on them.
393  std::unique_ptr<reco::ClusterShapeCollection> clustersshapes_p(new reco::ClusterShapeCollection);
394  clustersshapes_p->assign(ClusVec.begin(), ClusVec.end());
395 
396  cout<<"[Pi0Calibration] Basic Cluster collection size: "<<clusters.size()<<endl;
397  cout<<"[Pi0Calibration] Basic Cluster Shape Collection size: "<<clustersshapes_p->size()<<endl;
398 
399  int iClus=0;
400  for(reco::BasicClusterCollection::const_iterator aClus = clusters.begin(); aClus != clusters.end(); aClus++) {
401  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;
402  iClus++;
403  }
404  */
405 
406  // recalibrated clusters
407  reco::BasicClusterCollection clusters_recalib;
408  clusters_recalib = island_p->makeClusters(
409  recalibEcalRecHitCollection, geometry_p, &topology, geometryES_p, IslandClusterAlgo::barrel);
410 
411  //Create associated ClusterShape objects.
412  std::vector<reco::ClusterShape> ClusVec_recalib;
413  for (int erg = 0; erg < int(clusters_recalib.size()); ++erg) {
414  reco::ClusterShape TestShape_recalib =
415  shapeAlgo_.Calculate(clusters_recalib[erg], recalibEcalRecHitCollection, geometry_p, &topology);
416  ClusVec_recalib.push_back(TestShape_recalib);
417  }
418 
419  //Put clustershapes in event, but retain a Handle on them.
420  std::unique_ptr<reco::ClusterShapeCollection> clustersshapes_p_recalib(new reco::ClusterShapeCollection);
421  clustersshapes_p_recalib->assign(ClusVec_recalib.begin(), ClusVec_recalib.end());
422 
423  cout << "[Pi0FixedMassWindowCalibration][recalibration] Basic Cluster collection size: " << clusters_recalib.size()
424  << endl;
425  cout << "[Pi0FixedMassWindowCalibration][recalibration] Basic Cluster Shape Collection size: "
426  << clustersshapes_p_recalib->size() << endl;
427 
428  // pizero selection
429 
430  // Get ECAL Barrel Island Basic Clusters collection
431  // ECAL Barrel Island Basic Clusters
432  static const int MAXBCEB = 200;
433  static const int MAXBCEBRH = 200;
434  int nIslandBCEB;
435  float eIslandBCEB[MAXBCEB];
436  float etIslandBCEB[MAXBCEB];
437  float etaIslandBCEB[MAXBCEB];
438  float phiIslandBCEB[MAXBCEB];
439  float e2x2IslandBCEB[MAXBCEB];
440  float e3x3IslandBCEB[MAXBCEB];
441  float e5x5IslandBCEB[MAXBCEB];
442  // indexes to the RecHits assiciated with
443  // ECAL Barrel Island Basic Clusters
444  int nIslandBCEBRecHits[MAXBCEB];
445  // int indexIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
446  int ietaIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
447  int iphiIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
448  int zsideIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
449  float eIslandBCEBRecHits[MAXBCEB][MAXBCEBRH];
450 
451  nIslandBCEB = 0;
452  for (int i = 0; i < MAXBCEB; i++) {
453  eIslandBCEB[i] = 0;
454  etIslandBCEB[i] = 0;
455  etaIslandBCEB[i] = 0;
456  phiIslandBCEB[i] = 0;
457  e2x2IslandBCEB[i] = 0;
458  e3x3IslandBCEB[i] = 0;
459  e5x5IslandBCEB[i] = 0;
460  nIslandBCEBRecHits[i] = 0;
461  for (int j = 0; j < MAXBCEBRH; j++) {
462  // indexIslandBCEBRecHits[i][j] = 0;
463  ietaIslandBCEBRecHits[i][j] = 0;
464  iphiIslandBCEBRecHits[i][j] = 0;
465  zsideIslandBCEBRecHits[i][j] = 0;
466  eIslandBCEBRecHits[i][j] = 0;
467  }
468  }
469 
470  int iClus_recalib = 0;
471  for (reco::BasicClusterCollection::const_iterator aClus = clusters_recalib.begin(); aClus != clusters_recalib.end();
472  aClus++) {
473  cout << " CLUSTER [recalibration] : #,NHits,e,et,eta,phi,e2x2,e3x3,e5x5: " << iClus_recalib << " " << aClus->size()
474  << " " << aClus->energy() << " " << aClus->energy() * sin(aClus->position().theta()) << " "
475  << aClus->position().eta() << " " << aClus->position().phi() << " "
476  << (*clustersshapes_p_recalib)[iClus_recalib].e2x2() << " "
477  << (*clustersshapes_p_recalib)[iClus_recalib].e3x3() << " "
478  << (*clustersshapes_p_recalib)[iClus_recalib].e5x5() << endl;
479 
480  eIslandBCEB[nIslandBCEB] = aClus->energy();
481  etIslandBCEB[nIslandBCEB] = aClus->energy() * sin(aClus->position().theta());
482  etaIslandBCEB[nIslandBCEB] = aClus->position().eta();
483  phiIslandBCEB[nIslandBCEB] = aClus->position().phi();
484 
485  e2x2IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e2x2();
486  e3x3IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e3x3();
487  e5x5IslandBCEB[nIslandBCEB] = (*clustersshapes_p_recalib)[nIslandBCEB].e5x5();
488 
489  nIslandBCEBRecHits[nIslandBCEB] = aClus->size();
490 
491  std::vector<std::pair<DetId, float>> hits = aClus->hitsAndFractions();
492  std::vector<std::pair<DetId, float>>::iterator hit;
493  std::map<DetId, EcalRecHit>::iterator aHit;
494 
495  int irhcount = 0;
496  for (hit = hits.begin(); hit != hits.end(); hit++) {
497  // need to get hit by DetID in order to get energy
498  aHit = recHitsEB_map->find((*hit).first);
499  //cout << " RecHit #: "<<irhcount<<" from Basic Cluster with Energy: "<<aHit->second.energy()<<endl;
500 
501  EBDetId sel_rh = aHit->second.detid();
502  //cout << " RecHit: z,ieta,iphi "<<sel_rh.zside()<<" "<<sel_rh.ieta()<<" "<<sel_rh.iphi()<<endl;
503  //cout << " RecHit: tower_ieta,tower_iphi "<<sel_rh.tower_ieta()<<" "<<sel_rh.tower_iphi()<<endl;
504  //cout << " RecHit: iSM, ic "<<sel_rh.ism()<<" "<<sel_rh.ic()<<endl;
505 
506  ietaIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.ieta();
507  iphiIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.iphi();
508  zsideIslandBCEBRecHits[nIslandBCEB][irhcount] = sel_rh.zside();
509  eIslandBCEBRecHits[nIslandBCEB][irhcount] = aHit->second.energy();
510 
511  irhcount++;
512  }
513  nIslandBCEB++;
514  iClus_recalib++;
515  }
516 
517  // Selection, based on ECAL Barrel Basic Clusters
518 
519  if (nIslandBCEB > 1) {
520  for (int i = 0; i < nIslandBCEB; i++) {
521  for (int j = i + 1; j < nIslandBCEB; j++) {
522  if (etIslandBCEB[i] > selePi0PtGammaOneMin_ && etIslandBCEB[j] > selePi0PtGammaOneMin_) {
523  float theta_0 = 2. * atan(exp(-etaIslandBCEB[i]));
524  float theta_1 = 2. * atan(exp(-etaIslandBCEB[j]));
525 
526  float p0x = eIslandBCEB[i] * sin(theta_0) * cos(phiIslandBCEB[i]);
527  float p1x = eIslandBCEB[j] * sin(theta_1) * cos(phiIslandBCEB[j]);
528 
529  float p0y = eIslandBCEB[i] * sin(theta_0) * sin(phiIslandBCEB[i]);
530  float p1y = eIslandBCEB[j] * sin(theta_1) * sin(phiIslandBCEB[j]);
531 
532  float p0z = eIslandBCEB[i] * cos(theta_0);
533  float p1z = eIslandBCEB[j] * cos(theta_1);
534 
535  float pi0_px = p0x + p1x;
536  float pi0_py = p0y + p1y;
537  float pi0_pz = p0z + p1z;
538 
539  float pi0_ptot = sqrt(pi0_px * pi0_px + pi0_py * pi0_py + pi0_pz * pi0_pz);
540 
541  float pi0_theta = acos(pi0_pz / pi0_ptot);
542  float pi0_eta = -log(tan(pi0_theta / 2));
543  float pi0_phi = atan(pi0_py / pi0_px);
544  //cout << " pi0_theta, pi0_eta, pi0_phi "<<pi0_theta<<" "<<pi0_eta<<" "<<pi0_phi<<endl;
545 
546  // belt isolation
547 
548  float et_belt = 0;
549  for (Int_t k = 0; k < nIslandBCEB; k++) {
550  if ((k != i) && (k != j)) {
551  float dr_pi0_k = sqrt((etaIslandBCEB[k] - pi0_eta) * (etaIslandBCEB[k] - pi0_eta) +
552  (phiIslandBCEB[k] - pi0_phi) * (phiIslandBCEB[k] - pi0_phi));
553  float deta_pi0_k = fabs(etaIslandBCEB[k] - pi0_eta);
554  if ((dr_pi0_k < selePi0DRBelt_) && (deta_pi0_k < selePi0DetaBelt_))
555  et_belt = et_belt + etIslandBCEB[k];
556  }
557  }
558 
559  float pt_pi0 = sqrt((p0x + p1x) * (p0x + p1x) + (p0y + p1y) * (p0y + p1y));
560  //float dr_pi0 = sqrt ( (etaIslandBCEB[i]-etaIslandBCEB[j])*(etaIslandBCEB[i]-etaIslandBCEB[j]) + (phiIslandBCEB[i]-phiIslandBCEB[j])*(phiIslandBCEB[i]-phiIslandBCEB[j]) );
561 
562  //cout <<" pi0 pt,dr: "<<pt_pi0<<" "<<dr_pi0<<endl;
563  if (pt_pi0 > selePi0PtPi0Min_) {
564  float m_inv = sqrt((eIslandBCEB[i] + eIslandBCEB[j]) * (eIslandBCEB[i] + eIslandBCEB[j]) -
565  (p0x + p1x) * (p0x + p1x) - (p0y + p1y) * (p0y + p1y) - (p0z + p1z) * (p0z + p1z));
566  cout << " pi0 (pt>2.5 GeV) m_inv = " << m_inv << endl;
567 
568  float s4s9_1 = e2x2IslandBCEB[i] / e3x3IslandBCEB[i];
569  float s4s9_2 = e2x2IslandBCEB[j] / e3x3IslandBCEB[j];
570 
571  float s9s25_1 = e3x3IslandBCEB[i] / e5x5IslandBCEB[i];
572  float s9s25_2 = e3x3IslandBCEB[j] / e5x5IslandBCEB[j];
573 
574  //float s9Esc_1 = e3x3IslandBCEB[i]/eIslandBCEB[i];
575  //float s9Esc_2 = e3x3IslandBCEB[j]/eIslandBCEB[j];
576 
577  if (s4s9_1 > selePi0S4S9GammaOneMin_ && s4s9_2 > selePi0S4S9GammaTwoMin_ &&
578  s9s25_1 > selePi0S9S25GammaOneMin_ && s9s25_2 > selePi0S9S25GammaTwoMin_ &&
579  (et_belt / pt_pi0 < selePi0EtBeltIsoRatioMax_)) {
580  //good pizero candidate
581  if (m_inv > (selePi0MinvMeanFixed_ - 2 * selePi0MinvSigmaFixed_) &&
583  //fill wxtals and mwxtals weights
584  cout << " Pi0 Good candidate : minv = " << m_inv << endl;
585  for (int kk = 0; kk < nIslandBCEBRecHits[i]; kk++) {
586  int ieta_xtal = ietaIslandBCEBRecHits[i][kk];
587  int iphi_xtal = iphiIslandBCEBRecHits[i][kk];
588  int sign = zsideIslandBCEBRecHits[i][kk] > 0 ? 1 : 0;
589  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
590  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] + eIslandBCEBRecHits[i][kk] / e3x3IslandBCEB[i];
591  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
592  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] +
593  (selePi0MinvMeanFixed_ / m_inv) * (selePi0MinvMeanFixed_ / m_inv) *
594  (eIslandBCEBRecHits[i][kk] / e3x3IslandBCEB[i]);
595  cout << "[Pi0FixedMassWindowCalibration] eta, phi, sign, e, e3x3, wxtals and mwxtals: " << ieta_xtal
596  << " " << iphi_xtal << " " << sign << " " << eIslandBCEBRecHits[i][kk] << " "
597  << e3x3IslandBCEB[i] << " " << wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << " "
598  << mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << endl;
599  }
600 
601  for (int kk = 0; kk < nIslandBCEBRecHits[j]; kk++) {
602  int ieta_xtal = ietaIslandBCEBRecHits[j][kk];
603  int iphi_xtal = iphiIslandBCEBRecHits[j][kk];
604  int sign = zsideIslandBCEBRecHits[j][kk] > 0 ? 1 : 0;
605  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
606  wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] + eIslandBCEBRecHits[j][kk] / e3x3IslandBCEB[j];
607  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] =
608  mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] +
609  (selePi0MinvMeanFixed_ / m_inv) * (selePi0MinvMeanFixed_ / m_inv) *
610  (eIslandBCEBRecHits[j][kk] / e3x3IslandBCEB[j]);
611  cout << "[Pi0FixedMassWindowCalibration] eta, phi, sign, e, e3x3, wxtals and mwxtals: " << ieta_xtal
612  << " " << iphi_xtal << " " << sign << " " << eIslandBCEBRecHits[j][kk] << " "
613  << e3x3IslandBCEB[j] << " " << wxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << " "
614  << mwxtals[abs(ieta_xtal) - 1][iphi_xtal - 1][sign] << endl;
615  }
616  }
617  }
618  }
619  }
620 
621  } // End of the "j" loop over BCEB
622  } // End of the "i" loop over BCEB
623 
624  } else {
625  cout << " Not enough ECAL Barrel Basic Clusters: " << nIslandBCEB << endl;
626  }
627 
628  return kContinue;
629 }
static std::vector< std::string > checklist log
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geometryToken_
const edm::ESGetToken< EcalIntercalibConstants, EcalIntercalibConstantsRcd > intercalibConstantsToken_
double sign(double x)
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
std::vector< EcalRecHit >::const_iterator const_iterator
void push_back(T const &t)
std::vector< ClusterShape > ClusterShapeCollection
collection of ClusterShape objects
Exp< T >::type exp(const T &t)
Definition: Exp.h:22
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
bool getData(T &iHolder) const
Definition: EventSetup.h:122
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
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
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
size_type size() const
tuple cout
Definition: gather_cfg.py:144
std::map< DetId, EcalRecHit > * recHitsEB_map
const EcalRecHitCollection * recalibEcalRecHitCollection
const_iterator begin() const
int zside() const
get the z-side of the crystal (1/-1)
Definition: EBDetId.h:45
float EcalIntercalibConstant
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, EBDetId::ieta(), EBDetId::iphi(), newCalibs_barl, jetcorrextractor::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 }
double sign(double x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:144
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, EBDetId::ieta(), EBDetId::iphi(), edm::EDLooperBase::kContinue, edm::EDLooperBase::kStop, mwxtals, newCalibs_barl, oldCalibs_barl, jetcorrextractor::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) {
220  newCalibs_barl[ieta][iphi][sign] = oldCalibs_barl[ieta][iphi][sign];
221  } else {
222  newCalibs_barl[ieta][iphi][sign] =
223  oldCalibs_barl[ieta][iphi][sign] * (mwxtals[ieta][iphi][sign] / wxtals[ieta][iphi][sign]);
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++) {
253  oldCalibs_barl[ieta][iphi][sign] = newCalibs_barl[ieta][iphi][sign];
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 }
double sign(double x)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
tuple cout
Definition: gather_cfg.py:144
void Pi0FixedMassWindowCalibration::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 119 of file Pi0FixedMassWindowCalibration.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), submitPVResolutionJobs::desc, HLT_FULL_cff::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 }
tuple posCalcParameters
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
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 {};
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, mwxtals, jetcorrextractor::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 }
double sign(double x)
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

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

Definition at line 109 of file Pi0FixedMassWindowCalibration.h.

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

std::string Pi0FixedMassWindowCalibration::barrelClusterCollection_
private

Definition at line 82 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

std::string Pi0FixedMassWindowCalibration::barrelClusterShapeAssociation_
private

Definition at line 84 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

std::string Pi0FixedMassWindowCalibration::barrelHitCollection_
private

Definition at line 81 of file Pi0FixedMassWindowCalibration.h.

std::string Pi0FixedMassWindowCalibration::barrelHitProducer_
private

Definition at line 80 of file Pi0FixedMassWindowCalibration.h.

const std::string Pi0FixedMassWindowCalibration::barrelHits_
private

Definition at line 76 of file Pi0FixedMassWindowCalibration.h.

std::string Pi0FixedMassWindowCalibration::clustershapecollectionEB_
private

Definition at line 83 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

const std::string Pi0FixedMassWindowCalibration::ecalHitsProducer_
private

Definition at line 75 of file Pi0FixedMassWindowCalibration.h.

const EcalRecHitCollection* Pi0FixedMassWindowCalibration::ecalRecHitBarrelCollection
private

Definition at line 124 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

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

Definition at line 129 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

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

Definition at line 128 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

bool Pi0FixedMassWindowCalibration::isfirstcall_
private

Definition at line 131 of file Pi0FixedMassWindowCalibration.h.

Referenced by beginOfJob(), and duringLoop().

IslandClusterAlgo* Pi0FixedMassWindowCalibration::island_p
private
double Pi0FixedMassWindowCalibration::mwxtals[85][360][2]
private

Definition at line 115 of file Pi0FixedMassWindowCalibration.h.

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

int Pi0FixedMassWindowCalibration::nevent
private

Definition at line 72 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

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

Definition at line 113 of file Pi0FixedMassWindowCalibration.h.

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

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

Definition at line 112 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and endOfLoop().

PositionCalc Pi0FixedMassWindowCalibration::posCalculator_
private

Definition at line 86 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

const EcalRecHitCollection* Pi0FixedMassWindowCalibration::recalibEcalRecHitCollection
private

Definition at line 125 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

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

Definition at line 122 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

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

Definition at line 127 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop().

double Pi0FixedMassWindowCalibration::selePi0DetaBelt_
private

Definition at line 95 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0DRBelt_
private

Definition at line 94 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0EtBeltIsoRatioMax_
private

Definition at line 104 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0MinvMeanFixed_
private

Definition at line 106 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0MinvSigmaFixed_
private

Definition at line 107 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0PtGammaOneMin_
private

Definition at line 91 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0PtGammaTwoMin_
private

Definition at line 92 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0PtPi0Min_
private

Definition at line 97 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0S4S9GammaOneMin_
private

Definition at line 99 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0S4S9GammaTwoMin_
private

Definition at line 100 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0S9S25GammaOneMin_
private

Definition at line 101 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

double Pi0FixedMassWindowCalibration::selePi0S9S25GammaTwoMin_
private

Definition at line 102 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

ClusterShapeAlgo Pi0FixedMassWindowCalibration::shapeAlgo_
private

Definition at line 87 of file Pi0FixedMassWindowCalibration.h.

Referenced by duringLoop(), and Pi0FixedMassWindowCalibration().

const unsigned int Pi0FixedMassWindowCalibration::theMaxLoops
private

Definition at line 74 of file Pi0FixedMassWindowCalibration.h.

Referenced by endOfLoop().

edm::ParameterSet Pi0FixedMassWindowCalibration::theParameterSet
private

Definition at line 119 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

IslandClusterAlgo::VerbosityLevel Pi0FixedMassWindowCalibration::verbosity
private

Definition at line 78 of file Pi0FixedMassWindowCalibration.h.

Referenced by Pi0FixedMassWindowCalibration().

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

Definition at line 114 of file Pi0FixedMassWindowCalibration.h.

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