CMS 3D CMS Logo

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

#include <MyPackages/HcalCalibrator/src/HcalCalibrator.cc>

Inheritance diagram for HcalCalibrator:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 HcalCalibrator (const edm::ParameterSet &)
 
 ~HcalCalibrator () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 

Private Attributes

bool allowMissingInputs_
 
bool mApplyPhiSymCorFlag
 
int mCalibAbsIEtaMax
 
int mCalibAbsIEtaMin
 
std::string mCalibMethod
 
std::string mCalibType
 
bool mCombinePhi
 
int mHbClusterSize
 
int mHeClusterSize
 
std::string mHistoFileName
 
std::string mInputFileList
 
double mMaxConeDist
 
double mMaxEOverP
 
double mMaxEtThirdJet
 
double mMaxProbeJetEmFrac
 
double mMaxTagJetAbsEta
 
double mMaxTagJetEmFrac
 
double mMaxTargetE
 
double mMaxTrkEmE
 
double mMinCellE
 
double mMinDPhiDiJets
 
double mMinEOverP
 
double mMinProbeJetAbsEta
 
double mMinTagJetEt
 
double mMinTargetE
 
std::string mOutputCorCoefFileName
 
std::string mOutputFile
 
std::string mPhiSymCorFileName
 
bool mSumDepths
 
bool mSumSmallDepths
 
const CaloGeometrymTheCaloGeometry
 
const HcalTopologymTheHcalTopology
 
bool mUseConeClustering
 

Additional Inherited Members

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

Detailed Description

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

Implementation:

This is an interface to run the the hcal calibration code for isolated tracsk and dijets. It takes tha parameters for the calibration settings from a python file and passes them to the actual calibration code in "endJob()".

Definition at line 22 of file HcalCalibrator.h.

Constructor & Destructor Documentation

HcalCalibrator::HcalCalibrator ( const edm::ParameterSet conf)
explicit

Definition at line 64 of file HcalCalibrator.cc.

65  :
66 
67  mInputFileList(conf.getUntrackedParameter<string>("inputFileList")),
68  // mOutputFile(conf.getUntrackedParameter<string>("outputFile")),
69 
70  mCalibType(conf.getUntrackedParameter<string>("calibType")),
71  mCalibMethod(conf.getUntrackedParameter<string>("calibMethod")),
72  mMinTargetE(conf.getUntrackedParameter<double>("minTargetE")),
73  mMaxTargetE(conf.getUntrackedParameter<double>("maxTargetE")),
74  mMinCellE(conf.getUntrackedParameter<double>("minCellE")),
75  mMinEOverP(conf.getUntrackedParameter<double>("minEOverP")),
76  mMaxEOverP(conf.getUntrackedParameter<double>("maxEOverP")),
77  mMaxTrkEmE(conf.getUntrackedParameter<double>("maxTrkEmE")),
78  mMaxEtThirdJet(conf.getUntrackedParameter<double>("maxEtThirdJet")),
79  mMinDPhiDiJets(conf.getUntrackedParameter<double>("minDPhiDiJets")),
80  mSumDepths(conf.getUntrackedParameter<bool>("sumDepths")),
81  mSumSmallDepths(conf.getUntrackedParameter<bool>("sumSmallDepths")),
82  mCombinePhi(conf.getUntrackedParameter<bool>("combinePhi")),
83  mHbClusterSize(conf.getUntrackedParameter<int>("hbClusterSize")),
84  mHeClusterSize(conf.getUntrackedParameter<int>("heClusterSize")),
85 
86  mUseConeClustering(conf.getUntrackedParameter<bool>("useConeClustering")),
87  mMaxConeDist(conf.getUntrackedParameter<double>("maxConeDist")),
88 
89  mCalibAbsIEtaMax(conf.getUntrackedParameter<int>("calibAbsIEtaMax")),
90  mCalibAbsIEtaMin(conf.getUntrackedParameter<int>("calibAbsIEtaMin")),
91  mMaxProbeJetEmFrac(conf.getUntrackedParameter<double>("maxProbeJetEmFrac")),
92  mMaxTagJetEmFrac(conf.getUntrackedParameter<double>("maxTagJetEmFrac")),
93  mMaxTagJetAbsEta(conf.getUntrackedParameter<double>("maxTagJetAbsEta")),
94  mMinTagJetEt(conf.getUntrackedParameter<double>("minTagJetEt")),
95  mMinProbeJetAbsEta(conf.getUntrackedParameter<double>("minProbeJetAbsEta")),
96  mPhiSymCorFileName(conf.getUntrackedParameter<string>("phiSymCorFileName")),
97  mApplyPhiSymCorFlag(conf.getUntrackedParameter<bool>("applyPhiSymCorFlag")),
98  mOutputCorCoefFileName(conf.getUntrackedParameter<string>("outputCorCoefFileName")),
99  mHistoFileName(conf.getUntrackedParameter<string>("histoFileName"))
100 
101 {}
T getUntrackedParameter(std::string const &, T const &) const
double mMinProbeJetAbsEta
std::string mHistoFileName
double mMaxTagJetAbsEta
double mMaxProbeJetEmFrac
double mMaxTagJetEmFrac
double mMinDPhiDiJets
std::string mInputFileList
std::string mCalibMethod
std::string mPhiSymCorFileName
bool mApplyPhiSymCorFlag
std::string mCalibType
std::string mOutputCorCoefFileName
double mMaxEtThirdJet
HcalCalibrator::~HcalCalibrator ( )
override

Definition at line 105 of file HcalCalibrator.cc.

105 {}

Member Function Documentation

void HcalCalibrator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate
void HcalCalibrator::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 120 of file HcalCalibrator.cc.

120  {
121  // ESHandle<CaloGeometry> theGeometry;
122  // ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
123  // evtSetup.get<CaloGeometryRecord>().get( theGeometry );
124 
125  // edm::ESHandle<CaloGeometry> pG;
126  // evtSetup.get<CaloGeometryRecord>().get(pG);
127  // mTheCaloGeometry = pG.product();
128 }
void HcalCalibrator::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 132 of file HcalCalibrator.cc.

References gather_cfg::cout, DEFINE_FWK_MODULE, MillePedeFileConverter_cfg::fileName, PatBasicFWLiteAnalyzer::files, merge::inputFiles, mApplyPhiSymCorFlag, mCalibAbsIEtaMax, mCalibAbsIEtaMin, mCalibMethod, mCalibType, mCombinePhi, mHbClusterSize, mHeClusterSize, mHistoFileName, mInputFileList, mMaxConeDist, mMaxEOverP, mMaxEtThirdJet, mMaxProbeJetEmFrac, mMaxTagJetAbsEta, mMaxTagJetEmFrac, mMaxTargetE, mMaxTrkEmE, mMinCellE, mMinDPhiDiJets, mMinEOverP, mMinProbeJetAbsEta, mMinTagJetEt, mMinTargetE, mOutputCorCoefFileName, mPhiSymCorFileName, mSumDepths, mSumSmallDepths, mTheCaloGeometry, mTheHcalTopology, mUseConeClustering, hcalCalib::SetApplyPhiSymCorFlag(), hcalCalib::SetCalibAbsIEtaMax(), hcalCalib::SetCalibAbsIEtaMin(), hcalCalib::SetCalibMethod(), hcalCalib::SetCalibType(), hcalCalib::SetCaloGeometry(), hcalCalib::SetCombinePhiFlag(), hcalCalib::SetConeMaxDist(), hcalCalib::SetHbClusterSize(), hcalCalib::SetHeClusterSize(), hcalCalib::SetHistoFileName(), hcalCalib::SetMaxEOverP(), hcalCalib::SetMaxEtThirdJet(), hcalCalib::SetMaxProbeJetEmFrac(), hcalCalib::SetMaxTagJetAbsEta(), hcalCalib::SetMaxTagJetEmFrac(), hcalCalib::SetMaxTargetE(), hcalCalib::SetMaxTrkEmE(), hcalCalib::SetMinCellE(), hcalCalib::SetMinDPhiDiJets(), hcalCalib::SetMinEOverP(), hcalCalib::SetMinProbeJetAbsEta(), hcalCalib::SetMinTagJetEt(), hcalCalib::SetMinTargetE(), hcalCalib::SetOutputCorCoefFileName(), hcalCalib::SetPhiSymCorFileName(), hcalCalib::SetSumDepthsFlag(), hcalCalib::SetSumSmallDepthsFlag(), and hcalCalib::SetUseConeClustering().

Referenced by o2olib.O2ORunMgr::executeJob().

132  {
133  if (mCalibType != "DI_JET" && mCalibType != "ISO_TRACK") {
134  std::cout << "\n\nUnknown calibration type " << mCalibType << std::endl;
135  std::cout << "Please select ISO_TRACK or DI_JET in the python file." << std::endl;
136  return;
137  }
138 
139  if (mCalibMethod != "L3" && mCalibMethod != "MATRIX_INV_OF_ETA_AVE" && mCalibMethod != "L3_AND_MTRX_INV") {
140  std::cout << "\n\nUnknown calibration method " << mCalibMethod << std::endl;
141  std::cout << "Supported methods for IsoTrack calibration are: L3, MATRIX_INV_OF_ETA_AVE, L3_AND_MTRX_INV"
142  << std::endl;
143  std::cout << "For DiJets the supported method is L3" << std::endl;
144  return;
145  }
146 
147  if (mCalibType == "DI_JET" && mCalibMethod != "L3") {
148  std::cout << "\n\nDiJet calibration can use only the L3 method. Please change the python file." << std::endl;
149  return;
150  }
151 
152  if (mCalibAbsIEtaMin < 1 || mCalibAbsIEtaMax > 41 || mCalibAbsIEtaMin > mCalibAbsIEtaMax) {
153  std::cout
154  << "\n\nInvalid ABS(iEta) calibration range. Check calibAbsIEtaMin and calibAbsIEtaMax in the python file."
155  << std::endl;
156  return;
157  }
158 
159  hcalCalib* calibrator = new hcalCalib();
160 
161  // set the parameters controlling the calibratoration
162 
163  calibrator->SetCalibType(mCalibType);
164  calibrator->SetCalibMethod(mCalibMethod);
165  calibrator->SetMinTargetE(mMinTargetE);
166  calibrator->SetMaxTargetE(mMaxTargetE);
167  calibrator->SetMaxEtThirdJet(mMaxEtThirdJet);
168  calibrator->SetMinDPhiDiJets(mMinDPhiDiJets);
169  calibrator->SetSumDepthsFlag(mSumDepths);
171  calibrator->SetCombinePhiFlag(mCombinePhi);
172  calibrator->SetMinCellE(mMinCellE);
173  calibrator->SetMinEOverP(mMinEOverP);
174  calibrator->SetMaxEOverP(mMaxEOverP);
175  calibrator->SetMaxTrkEmE(mMaxTrkEmE);
176  calibrator->SetHbClusterSize(mHbClusterSize);
177  calibrator->SetHeClusterSize(mHeClusterSize);
178 
180  calibrator->SetConeMaxDist(mMaxConeDist);
181 
187 
188  calibrator->SetMinTagJetEt(mMinTagJetEt);
189 
194 
195  calibrator->SetHistoFileName(mHistoFileName);
196 
198 
199  std::ifstream inputFileList; // contains list of input root files
200 
201  TString files = mInputFileList;
202  inputFileList.open(files.Data());
203 
204  std::vector<TString> inputFiles;
205  while (!inputFileList.eof()) {
206  TString fileName;
207  inputFileList >> fileName;
208  if (!fileName.BeginsWith("#") && !fileName.Contains(" ") && fileName != "")
209  inputFiles.push_back(fileName);
210  }
211  inputFileList.close();
212 
213  std::cout << "\nInput files for processing:" << std::endl;
214  for (std::vector<TString>::iterator it = inputFiles.begin(); it != inputFiles.end(); ++it) {
215  std::cout << "file: " << it->Data() << std::endl;
216  }
217  std::cout << std::endl;
218 
219  TChain* fChain = new TChain("hcalCalibTree");
220 
221  for (std::vector<TString>::iterator f_it = inputFiles.begin(); f_it != inputFiles.end(); ++f_it) {
222  fChain->Add(f_it->Data());
223  }
224 
225  fChain->Process(calibrator);
226 
227  if (fChain)
228  delete fChain;
229  delete calibrator;
230 
231  return;
232 }
void SetMaxTagJetAbsEta(Float_t e)
Definition: hcalCalib.h:174
void SetPhiSymCorFileName(const TString &filename)
Definition: hcalCalib.h:171
void SetHbClusterSize(Int_t i)
Definition: hcalCalib.h:160
void SetOutputCorCoefFileName(const TString &filename)
Definition: hcalCalib.h:177
void SetMinTagJetEt(Float_t e)
Definition: hcalCalib.h:175
void SetMaxEOverP(Float_t e)
Definition: hcalCalib.h:156
double mMinProbeJetAbsEta
void SetMaxProbeJetEmFrac(Float_t f)
Definition: hcalCalib.h:172
void SetSumSmallDepthsFlag(Bool_t b)
Definition: hcalCalib.h:152
void SetConeMaxDist(Float_t d)
Definition: hcalCalib.h:164
void SetApplyPhiSymCorFlag(Bool_t b)
Definition: hcalCalib.h:170
const CaloGeometry * mTheCaloGeometry
void SetCalibType(const TString &s)
Definition: hcalCalib.h:158
void SetMinDPhiDiJets(Float_t dphi)
Definition: hcalCalib.h:169
void SetSumDepthsFlag(Bool_t b)
Definition: hcalCalib.h:151
std::string mHistoFileName
void SetUseConeClustering(Bool_t b)
Definition: hcalCalib.h:163
double mMaxTagJetAbsEta
double mMaxProbeJetEmFrac
const HcalTopology * mTheHcalTopology
double mMaxTagJetEmFrac
void SetMinTargetE(Float_t e)
Definition: hcalCalib.h:149
void SetCalibMethod(const TString &s)
Definition: hcalCalib.h:159
void SetCalibAbsIEtaMax(Int_t i)
Definition: hcalCalib.h:166
double mMinDPhiDiJets
std::string mInputFileList
void SetMaxTargetE(Float_t e)
Definition: hcalCalib.h:150
std::string mCalibMethod
void SetMaxTrkEmE(Float_t e)
Definition: hcalCalib.h:157
std::string mPhiSymCorFileName
void SetCaloGeometry(const CaloGeometry *g, const HcalTopology *topo)
Definition: hcalCalib.h:180
void SetMaxTagJetEmFrac(Float_t f)
Definition: hcalCalib.h:173
bool mApplyPhiSymCorFlag
void SetCalibAbsIEtaMin(Int_t i)
Definition: hcalCalib.h:167
inputFiles
Definition: merge.py:6
std::string mCalibType
std::string mOutputCorCoefFileName
void SetCombinePhiFlag(Bool_t b)
Definition: hcalCalib.h:153
void SetHistoFileName(const TString &filename)
Definition: hcalCalib.h:178
void SetHeClusterSize(Int_t i)
Definition: hcalCalib.h:161
void SetMinCellE(Float_t e)
Definition: hcalCalib.h:154
void SetMaxEtThirdJet(Float_t et)
Definition: hcalCalib.h:168
void SetMinProbeJetAbsEta(Float_t e)
Definition: hcalCalib.h:176
double mMaxEtThirdJet
void SetMinEOverP(Float_t e)
Definition: hcalCalib.h:155

Member Data Documentation

bool HcalCalibrator::allowMissingInputs_
private

Definition at line 75 of file HcalCalibrator.h.

bool HcalCalibrator::mApplyPhiSymCorFlag
private

Definition at line 67 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mCalibAbsIEtaMax
private

Definition at line 57 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mCalibAbsIEtaMin
private

Definition at line 58 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mCalibMethod
private

Definition at line 38 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mCalibType
private

Definition at line 37 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mCombinePhi
private

Definition at line 50 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mHbClusterSize
private

Definition at line 51 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mHeClusterSize
private

Definition at line 52 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mHistoFileName
private

Definition at line 70 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mInputFileList
private

Definition at line 35 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxConeDist
private

Definition at line 55 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxEOverP
private

Definition at line 43 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxEtThirdJet
private

Definition at line 46 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxProbeJetEmFrac
private

Definition at line 60 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTagJetAbsEta
private

Definition at line 62 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTagJetEmFrac
private

Definition at line 61 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTargetE
private

Definition at line 40 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTrkEmE
private

Definition at line 44 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinCellE
private

Definition at line 41 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinDPhiDiJets
private

Definition at line 47 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinEOverP
private

Definition at line 42 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinProbeJetAbsEta
private

Definition at line 64 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinTagJetEt
private

Definition at line 63 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinTargetE
private

Definition at line 39 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mOutputCorCoefFileName
private

Definition at line 69 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mOutputFile
private

Definition at line 34 of file HcalCalibrator.h.

std::string HcalCalibrator::mPhiSymCorFileName
private

Definition at line 66 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mSumDepths
private

Definition at line 48 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mSumSmallDepths
private

Definition at line 49 of file HcalCalibrator.h.

Referenced by endJob().

const CaloGeometry* HcalCalibrator::mTheCaloGeometry
private

Definition at line 72 of file HcalCalibrator.h.

Referenced by analyze(), and endJob().

const HcalTopology* HcalCalibrator::mTheHcalTopology
private

Definition at line 73 of file HcalCalibrator.h.

Referenced by analyze(), and endJob().

bool HcalCalibrator::mUseConeClustering
private

Definition at line 54 of file HcalCalibrator.h.

Referenced by endJob().