CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HcalCalibrator Class Reference

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

Inheritance diagram for HcalCalibrator:
edm::EDAnalyzer

List of all members.

Public Member Functions

 HcalCalibrator (const edm::ParameterSet &)
 ~HcalCalibrator ()

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
bool mUseConeClustering

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.

                                                          :

  mInputFileList(conf.getUntrackedParameter<string>("inputFileList")),
  //  mOutputFile(conf.getUntrackedParameter<string>("outputFile")),

  mCalibType(conf.getUntrackedParameter<string>("calibType")),
  mCalibMethod(conf.getUntrackedParameter<string>("calibMethod")),
  mMinTargetE(conf.getUntrackedParameter<double>("minTargetE")),
  mMaxTargetE(conf.getUntrackedParameter<double>("maxTargetE")),
  mMinCellE(conf.getUntrackedParameter<double>("minCellE")),
  mMinEOverP(conf.getUntrackedParameter<double>("minEOverP")),
  mMaxEOverP(conf.getUntrackedParameter<double>("maxEOverP")),
  mMaxTrkEmE(conf.getUntrackedParameter<double>("maxTrkEmE")),
  mMaxEtThirdJet(conf.getUntrackedParameter<double>("maxEtThirdJet")),
  mMinDPhiDiJets(conf.getUntrackedParameter<double>("minDPhiDiJets")),
  mSumDepths(conf.getUntrackedParameter<bool>("sumDepths")),
  mSumSmallDepths(conf.getUntrackedParameter<bool>("sumSmallDepths")),
  mCombinePhi (conf.getUntrackedParameter<bool>("combinePhi")),   
  mHbClusterSize(conf.getUntrackedParameter<int>("hbClusterSize")),
  mHeClusterSize(conf.getUntrackedParameter<int>("heClusterSize")), 

  mUseConeClustering(conf.getUntrackedParameter<bool>("useConeClustering")),
  mMaxConeDist(conf.getUntrackedParameter<double>("maxConeDist")),

  mCalibAbsIEtaMax(conf.getUntrackedParameter<int>("calibAbsIEtaMax")),
  mCalibAbsIEtaMin(conf.getUntrackedParameter<int>("calibAbsIEtaMin")),
  mMaxProbeJetEmFrac(conf.getUntrackedParameter<double>("maxProbeJetEmFrac")),
  mMaxTagJetEmFrac(conf.getUntrackedParameter<double>("maxTagJetEmFrac")),
  mMaxTagJetAbsEta(conf.getUntrackedParameter<double>("maxTagJetAbsEta")),
  mMinTagJetEt(conf.getUntrackedParameter<double>("minTagJetEt")),
  mMinProbeJetAbsEta(conf.getUntrackedParameter<double>("minProbeJetAbsEta")),
  mPhiSymCorFileName(conf.getUntrackedParameter<string>("phiSymCorFileName")),
  mApplyPhiSymCorFlag(conf.getUntrackedParameter<bool>("applyPhiSymCorFlag")),
  mOutputCorCoefFileName(conf.getUntrackedParameter<string>("outputCorCoefFileName")),
  mHistoFileName(conf.getUntrackedParameter<string>("histoFileName"))

{
}
HcalCalibrator::~HcalCalibrator ( )

Definition at line 115 of file HcalCalibrator.cc.

                                {
}

Member Function Documentation

void HcalCalibrator::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]
void HcalCalibrator::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 130 of file HcalCalibrator.cc.

                         {

  //  ESHandle<CaloGeometry> theGeometry;
  //  ESHandle<CaloSubdetectorGeometry> theEndcapGeometry_handle, theBarrelGeometry_handle;
  //  evtSetup.get<CaloGeometryRecord>().get( theGeometry );


  // edm::ESHandle<CaloGeometry> pG;
  // evtSetup.get<CaloGeometryRecord>().get(pG);     
  // mTheCaloGeometry = pG.product();

}
void HcalCalibrator::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDAnalyzer.

Definition at line 146 of file HcalCalibrator.cc.

References gather_cfg::cout, convertXMLtoSQLite_cfg::fileName, electronDbsDiscovery::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, 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().

                       {
 

  if (mCalibType!="DI_JET" && mCalibType!="ISO_TRACK") {
    cout << "\n\nUnknown calibration type " << mCalibType << endl;
    cout << "Please select ISO_TRACK or DI_JET in the python file." << endl;
    return;
  }

  if (mCalibMethod != "L3" && mCalibMethod != "MATRIX_INV_OF_ETA_AVE" && mCalibMethod != "L3_AND_MTRX_INV") {
    cout << "\n\nUnknown calibration method " << mCalibMethod << endl;
    cout << "Supported methods for IsoTrack calibration are: L3, MATRIX_INV_OF_ETA_AVE, L3_AND_MTRX_INV" << endl;
    cout << "For DiJets the supported method is L3" << endl;
    return;
  }

  if (mCalibType=="DI_JET" && mCalibMethod!="L3") {
    cout << "\n\nDiJet calibration can use only the L3 method. Please change the python file." << endl;
    return;
  }

  if (mCalibAbsIEtaMin<1 || mCalibAbsIEtaMax>41 || mCalibAbsIEtaMin>mCalibAbsIEtaMax) {
    cout << "\n\nInvalid ABS(iEta) calibration range. Check calibAbsIEtaMin and calibAbsIEtaMax in the python file." << endl;
    return;
  }



  hcalCalib* calibrator = new hcalCalib();

  // set the parameters controlling the calibratoration

  calibrator->SetCalibType(mCalibType); 
  calibrator->SetCalibMethod(mCalibMethod);
  calibrator->SetMinTargetE(mMinTargetE);
  calibrator->SetMaxTargetE(mMaxTargetE);
  calibrator->SetMaxEtThirdJet(mMaxEtThirdJet);
  calibrator->SetMinDPhiDiJets(mMinDPhiDiJets);
  calibrator->SetSumDepthsFlag(mSumDepths);
  calibrator->SetSumSmallDepthsFlag(mSumSmallDepths);
  calibrator->SetCombinePhiFlag(mCombinePhi);
  calibrator->SetMinCellE(mMinCellE);
  calibrator->SetMinEOverP(mMinEOverP);
  calibrator->SetMaxEOverP(mMaxEOverP);
  calibrator->SetMaxTrkEmE(mMaxTrkEmE);
  calibrator->SetHbClusterSize(mHbClusterSize);
  calibrator->SetHeClusterSize(mHeClusterSize);

  calibrator->SetUseConeClustering(mUseConeClustering);
  calibrator->SetConeMaxDist(mMaxConeDist); 

  calibrator->SetCalibAbsIEtaMax(mCalibAbsIEtaMax);
  calibrator->SetCalibAbsIEtaMin(mCalibAbsIEtaMin);
  calibrator->SetMaxProbeJetEmFrac(mMaxProbeJetEmFrac);
  calibrator->SetMaxTagJetEmFrac(mMaxTagJetEmFrac);
  calibrator->SetMaxTagJetAbsEta(mMaxTagJetAbsEta);

  calibrator->SetMinTagJetEt(mMinTagJetEt);

  calibrator->SetMinProbeJetAbsEta(mMinProbeJetAbsEta);
  calibrator->SetApplyPhiSymCorFlag(mApplyPhiSymCorFlag);
  calibrator->SetPhiSymCorFileName(mPhiSymCorFileName);
  calibrator->SetOutputCorCoefFileName(mOutputCorCoefFileName);

  calibrator->SetHistoFileName(mHistoFileName); 

  calibrator->SetCaloGeometry(mTheCaloGeometry);

 
  ifstream inputFileList;  // contains list of input root files

  TString files = mInputFileList;
  inputFileList.open(files.Data());

  std::vector<TString> inputFiles;
  while (!inputFileList.eof()) {
    TString fileName;
    inputFileList >> fileName;
    if (!fileName.BeginsWith("#") && !fileName.Contains(" ") && fileName!="") 
      inputFiles.push_back(fileName);
  }
  inputFileList.close();

  std::cout << "\nInput files for processing:" << std::endl;
  for (std::vector<TString>::iterator it=inputFiles.begin(); it!=inputFiles.end(); ++it) {
    std::cout << "file: " <<  it->Data() << std::endl;
  }
  std::cout << std::endl;


  TChain* fChain = new TChain("hcalCalibTree");

  for (std::vector<TString>::iterator f_it=inputFiles.begin();f_it!=inputFiles.end(); ++f_it) {
    fChain->Add(f_it->Data());
  }


  fChain->Process(calibrator);

  if (fChain) delete fChain;
  delete calibrator;

  return;
}

Member Data Documentation

Definition at line 82 of file HcalCalibrator.h.

Definition at line 73 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 62 of file HcalCalibrator.h.

Referenced by endJob().

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().

Definition at line 55 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 56 of file HcalCalibrator.h.

Referenced by endJob().

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().

Definition at line 51 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 65 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 67 of file HcalCalibrator.h.

Referenced by endJob().

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().

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().

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().

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().

Definition at line 53 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 54 of file HcalCalibrator.h.

Referenced by endJob().

Definition at line 79 of file HcalCalibrator.h.

Referenced by analyze(), and endJob().

Definition at line 59 of file HcalCalibrator.h.

Referenced by endJob().