CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

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
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

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 25 of file HcalCalibrator.h.

Constructor & Destructor Documentation

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

Definition at line 73 of file HcalCalibrator.cc.

73  :
74 
75  mInputFileList(conf.getUntrackedParameter<string>("inputFileList")),
76  // mOutputFile(conf.getUntrackedParameter<string>("outputFile")),
77 
78  mCalibType(conf.getUntrackedParameter<string>("calibType")),
79  mCalibMethod(conf.getUntrackedParameter<string>("calibMethod")),
80  mMinTargetE(conf.getUntrackedParameter<double>("minTargetE")),
81  mMaxTargetE(conf.getUntrackedParameter<double>("maxTargetE")),
82  mMinCellE(conf.getUntrackedParameter<double>("minCellE")),
83  mMinEOverP(conf.getUntrackedParameter<double>("minEOverP")),
84  mMaxEOverP(conf.getUntrackedParameter<double>("maxEOverP")),
85  mMaxTrkEmE(conf.getUntrackedParameter<double>("maxTrkEmE")),
86  mMaxEtThirdJet(conf.getUntrackedParameter<double>("maxEtThirdJet")),
87  mMinDPhiDiJets(conf.getUntrackedParameter<double>("minDPhiDiJets")),
88  mSumDepths(conf.getUntrackedParameter<bool>("sumDepths")),
89  mSumSmallDepths(conf.getUntrackedParameter<bool>("sumSmallDepths")),
90  mCombinePhi (conf.getUntrackedParameter<bool>("combinePhi")),
91  mHbClusterSize(conf.getUntrackedParameter<int>("hbClusterSize")),
92  mHeClusterSize(conf.getUntrackedParameter<int>("heClusterSize")),
93 
94  mUseConeClustering(conf.getUntrackedParameter<bool>("useConeClustering")),
95  mMaxConeDist(conf.getUntrackedParameter<double>("maxConeDist")),
96 
97  mCalibAbsIEtaMax(conf.getUntrackedParameter<int>("calibAbsIEtaMax")),
98  mCalibAbsIEtaMin(conf.getUntrackedParameter<int>("calibAbsIEtaMin")),
99  mMaxProbeJetEmFrac(conf.getUntrackedParameter<double>("maxProbeJetEmFrac")),
100  mMaxTagJetEmFrac(conf.getUntrackedParameter<double>("maxTagJetEmFrac")),
101  mMaxTagJetAbsEta(conf.getUntrackedParameter<double>("maxTagJetAbsEta")),
102  mMinTagJetEt(conf.getUntrackedParameter<double>("minTagJetEt")),
103  mMinProbeJetAbsEta(conf.getUntrackedParameter<double>("minProbeJetAbsEta")),
104  mPhiSymCorFileName(conf.getUntrackedParameter<string>("phiSymCorFileName")),
105  mApplyPhiSymCorFlag(conf.getUntrackedParameter<bool>("applyPhiSymCorFlag")),
106  mOutputCorCoefFileName(conf.getUntrackedParameter<string>("outputCorCoefFileName")),
107  mHistoFileName(conf.getUntrackedParameter<string>("histoFileName"))
108 
109 {
110 }
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 ( )

Definition at line 115 of file HcalCalibrator.cc.

115  {
116 }

Member Function Documentation

void HcalCalibrator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDAnalyzer.

Definition at line 121 of file HcalCalibrator.cc.

References edm::EventSetup::get(), mTheCaloGeometry, mTheHcalTopology, and edm::ESHandle< class >::product().

121  {
123  iSetup.get<CaloGeometryRecord>().get(pG);
124  mTheCaloGeometry = pG.product();
126  iSetup.get<IdealGeometryRecord>().get(pT);
127  mTheHcalTopology = pT.product();
128 }
const CaloGeometry * mTheCaloGeometry
const HcalTopology * mTheHcalTopology
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
void HcalCalibrator::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 133 of file HcalCalibrator.cc.

133  {
134 
135  // ESHandle<CaloGeometry> theGeometry;
136  // ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
137  // evtSetup.get<CaloGeometryRecord>().get( theGeometry );
138 
139 
140  // edm::ESHandle<CaloGeometry> pG;
141  // evtSetup.get<CaloGeometryRecord>().get(pG);
142  // mTheCaloGeometry = pG.product();
143 
144 }
void HcalCalibrator::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 149 of file HcalCalibrator.cc.

References gather_cfg::cout, convertXMLtoSQLite_cfg::fileName, dqmPostProcessing_online::files, diJetCalib::inputFileList, 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().

149  {
150 
151 
152  if (mCalibType!="DI_JET" && mCalibType!="ISO_TRACK") {
153  std::cout << "\n\nUnknown calibration type " << mCalibType << std::endl;
154  std::cout << "Please select ISO_TRACK or DI_JET in the python file." << std::endl;
155  return;
156  }
157 
158  if (mCalibMethod != "L3" && mCalibMethod != "MATRIX_INV_OF_ETA_AVE" && mCalibMethod != "L3_AND_MTRX_INV") {
159  std::cout << "\n\nUnknown calibration method " << mCalibMethod << std::endl;
160  std::cout << "Supported methods for IsoTrack calibration are: L3, MATRIX_INV_OF_ETA_AVE, L3_AND_MTRX_INV" << std::endl;
161  std::cout << "For DiJets the supported method is L3" << std::endl;
162  return;
163  }
164 
165  if (mCalibType=="DI_JET" && mCalibMethod!="L3") {
166  std::cout << "\n\nDiJet calibration can use only the L3 method. Please change the python file." << std::endl;
167  return;
168  }
169 
170  if (mCalibAbsIEtaMin<1 || mCalibAbsIEtaMax>41 || mCalibAbsIEtaMin>mCalibAbsIEtaMax) {
171  std::cout << "\n\nInvalid ABS(iEta) calibration range. Check calibAbsIEtaMin and calibAbsIEtaMax in the python file." << std::endl;
172  return;
173  }
174 
175 
176 
177  hcalCalib* calibrator = new hcalCalib();
178 
179  // set the parameters controlling the calibratoration
180 
181  calibrator->SetCalibType(mCalibType);
182  calibrator->SetCalibMethod(mCalibMethod);
183  calibrator->SetMinTargetE(mMinTargetE);
184  calibrator->SetMaxTargetE(mMaxTargetE);
185  calibrator->SetMaxEtThirdJet(mMaxEtThirdJet);
186  calibrator->SetMinDPhiDiJets(mMinDPhiDiJets);
187  calibrator->SetSumDepthsFlag(mSumDepths);
189  calibrator->SetCombinePhiFlag(mCombinePhi);
190  calibrator->SetMinCellE(mMinCellE);
191  calibrator->SetMinEOverP(mMinEOverP);
192  calibrator->SetMaxEOverP(mMaxEOverP);
193  calibrator->SetMaxTrkEmE(mMaxTrkEmE);
194  calibrator->SetHbClusterSize(mHbClusterSize);
195  calibrator->SetHeClusterSize(mHeClusterSize);
196 
198  calibrator->SetConeMaxDist(mMaxConeDist);
199 
205 
206  calibrator->SetMinTagJetEt(mMinTagJetEt);
207 
212 
213  calibrator->SetHistoFileName(mHistoFileName);
214 
216 
217 
218  std::ifstream inputFileList; // contains list of input root files
219 
220  TString files = mInputFileList;
221  inputFileList.open(files.Data());
222 
223  std::vector<TString> inputFiles;
224  while (!inputFileList.eof()) {
225  TString fileName;
226  inputFileList >> fileName;
227  if (!fileName.BeginsWith("#") && !fileName.Contains(" ") && fileName!="")
228  inputFiles.push_back(fileName);
229  }
230  inputFileList.close();
231 
232  std::cout << "\nInput files for processing:" << std::endl;
233  for (std::vector<TString>::iterator it=inputFiles.begin(); it!=inputFiles.end(); ++it) {
234  std::cout << "file: " << it->Data() << std::endl;
235  }
236  std::cout << std::endl;
237 
238 
239  TChain* fChain = new TChain("hcalCalibTree");
240 
241  for (std::vector<TString>::iterator f_it=inputFiles.begin();f_it!=inputFiles.end(); ++f_it) {
242  fChain->Add(f_it->Data());
243  }
244 
245 
246  fChain->Process(calibrator);
247 
248  if (fChain) delete fChain;
249  delete calibrator;
250 
251  return;
252 }
void SetMaxTagJetAbsEta(Float_t e)
Definition: hcalCalib.h:176
void SetPhiSymCorFileName(const TString &filename)
Definition: hcalCalib.h:173
void SetHbClusterSize(Int_t i)
Definition: hcalCalib.h:162
void SetOutputCorCoefFileName(const TString &filename)
Definition: hcalCalib.h:179
void SetMinTagJetEt(Float_t e)
Definition: hcalCalib.h:177
void SetMaxEOverP(Float_t e)
Definition: hcalCalib.h:158
double mMinProbeJetAbsEta
void SetMaxProbeJetEmFrac(Float_t f)
Definition: hcalCalib.h:174
void SetSumSmallDepthsFlag(Bool_t b)
Definition: hcalCalib.h:154
void SetConeMaxDist(Float_t d)
Definition: hcalCalib.h:166
void SetApplyPhiSymCorFlag(Bool_t b)
Definition: hcalCalib.h:172
const CaloGeometry * mTheCaloGeometry
void SetCalibType(const TString &s)
Definition: hcalCalib.h:160
void SetMinDPhiDiJets(Float_t dphi)
Definition: hcalCalib.h:171
void SetSumDepthsFlag(Bool_t b)
Definition: hcalCalib.h:153
std::string mHistoFileName
void SetUseConeClustering(Bool_t b)
Definition: hcalCalib.h:165
double mMaxTagJetAbsEta
double mMaxProbeJetEmFrac
const HcalTopology * mTheHcalTopology
double mMaxTagJetEmFrac
void SetMinTargetE(Float_t e)
Definition: hcalCalib.h:151
void SetCalibMethod(const TString &s)
Definition: hcalCalib.h:161
void SetCalibAbsIEtaMax(Int_t i)
Definition: hcalCalib.h:168
double mMinDPhiDiJets
std::string mInputFileList
tuple inputFileList
Definition: diJetCalib.py:17
void SetMaxTargetE(Float_t e)
Definition: hcalCalib.h:152
std::string mCalibMethod
void SetMaxTrkEmE(Float_t e)
Definition: hcalCalib.h:159
std::string mPhiSymCorFileName
void SetCaloGeometry(const CaloGeometry *g, const HcalTopology *topo)
Definition: hcalCalib.h:183
void SetMaxTagJetEmFrac(Float_t f)
Definition: hcalCalib.h:175
bool mApplyPhiSymCorFlag
void SetCalibAbsIEtaMin(Int_t i)
Definition: hcalCalib.h:169
std::string mCalibType
std::string mOutputCorCoefFileName
void SetCombinePhiFlag(Bool_t b)
Definition: hcalCalib.h:155
void SetHistoFileName(const TString &filename)
Definition: hcalCalib.h:180
tuple inputFiles
Definition: merge.py:5
tuple cout
Definition: gather_cfg.py:121
void SetHeClusterSize(Int_t i)
Definition: hcalCalib.h:163
void SetMinCellE(Float_t e)
Definition: hcalCalib.h:156
void SetMaxEtThirdJet(Float_t et)
Definition: hcalCalib.h:170
void SetMinProbeJetAbsEta(Float_t e)
Definition: hcalCalib.h:178
double mMaxEtThirdJet
void SetMinEOverP(Float_t e)
Definition: hcalCalib.h:157

Member Data Documentation

bool HcalCalibrator::allowMissingInputs_
private

Definition at line 83 of file HcalCalibrator.h.

bool HcalCalibrator::mApplyPhiSymCorFlag
private

Definition at line 73 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mCalibAbsIEtaMax
private

Definition at line 62 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mCalibAbsIEtaMin
private

Definition at line 63 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mCalibMethod
private

Definition at line 43 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mCalibType
private

Definition at line 42 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mCombinePhi
private

Definition at line 55 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mHbClusterSize
private

Definition at line 56 of file HcalCalibrator.h.

Referenced by endJob().

int HcalCalibrator::mHeClusterSize
private

Definition at line 57 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mHistoFileName
private

Definition at line 76 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mInputFileList
private

Definition at line 40 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxConeDist
private

Definition at line 60 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxEOverP
private

Definition at line 48 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxEtThirdJet
private

Definition at line 51 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxProbeJetEmFrac
private

Definition at line 65 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTagJetAbsEta
private

Definition at line 67 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTagJetEmFrac
private

Definition at line 66 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTargetE
private

Definition at line 45 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMaxTrkEmE
private

Definition at line 49 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinCellE
private

Definition at line 46 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinDPhiDiJets
private

Definition at line 52 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinEOverP
private

Definition at line 47 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinProbeJetAbsEta
private

Definition at line 69 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinTagJetEt
private

Definition at line 68 of file HcalCalibrator.h.

Referenced by endJob().

double HcalCalibrator::mMinTargetE
private

Definition at line 44 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mOutputCorCoefFileName
private

Definition at line 75 of file HcalCalibrator.h.

Referenced by endJob().

std::string HcalCalibrator::mOutputFile
private

Definition at line 39 of file HcalCalibrator.h.

std::string HcalCalibrator::mPhiSymCorFileName
private

Definition at line 72 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mSumDepths
private

Definition at line 53 of file HcalCalibrator.h.

Referenced by endJob().

bool HcalCalibrator::mSumSmallDepths
private

Definition at line 54 of file HcalCalibrator.h.

Referenced by endJob().

const CaloGeometry* HcalCalibrator::mTheCaloGeometry
private

Definition at line 79 of file HcalCalibrator.h.

Referenced by analyze(), and endJob().

const HcalTopology* HcalCalibrator::mTheHcalTopology
private

Definition at line 80 of file HcalCalibrator.h.

Referenced by analyze(), and endJob().

bool HcalCalibrator::mUseConeClustering
private

Definition at line 59 of file HcalCalibrator.h.

Referenced by endJob().