Skip to content

Commit

Permalink
Merge pull request #21106 from bsunanda/Run2-alca104
Browse files Browse the repository at this point in the history
Run2-alca104 Make changes for Hcal Calibration with MIPS
  • Loading branch information
cmsbuild committed Nov 10, 2017
2 parents 1c136ae + 5df7dfa commit 62cb420
Show file tree
Hide file tree
Showing 6 changed files with 667 additions and 391 deletions.
574 changes: 312 additions & 262 deletions Calibration/HcalCalibAlgos/macros/HBHEMuonOfflineAnalyzer.C

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions Calibration/HcalCalibAlgos/macros/OfflineMain.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#include "HBHEMuonOfflineAnalyzer.C"
#include <TStyle.h>
#include <TCanvas.h>
#include <iostream>
#include <fstream>
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TProfile.h>
#include <TH1D.h>
#include <TH2D.h>
#include <vector>
#include <TTree.h>
#include <string>
#include "TString.h"
using namespace std;

Bool_t FillChain(TChain *chain, const char* inputFileList);

int main(Int_t argc, Char_t *argv[]) {

if (argc<4) {
std::cerr << "Please give 3 arguments \n"
<< "InputFileName" << "\n"
<< "outputFileName" << "\n"
<< "processName" << "\n"
<< std::endl;
return -1;
}

const char *inputFileList = argv[1];
const char *outFileName = argv[2];
const char *processName = argv[3];
std::cout << "Input File List " << inputFileList << std::endl
<< "Output FIle Name " << outFileName << std::endl
<< "Process Name " << processName << std::endl;

int flag(0), mode(4), maxDHB(5), maxDHE(7), runLo(0), runHi(9999999);
if (argc>4) flag = atoi(argv[4]);
if (argc>5) mode = atoi(argv[5]);
if (argc>6) maxDHB = atoi(argv[6]);
if (argc>7) maxDHE = atoi(argv[7]);
if (argc>8) runLo = atoi(argv[8]);
if (argc>9) runHi = atoi(argv[9]);
char treeName[400];
sprintf (treeName, "%s/TREE", processName);
std::cout << "try to create a chain for " << treeName << std::endl;
TChain *chain = new TChain(treeName);

if (FillChain(chain, inputFileList)) {

HBHEMuonOfflineAnalyzer* tree = new HBHEMuonOfflineAnalyzer(chain, outFileName, flag, mode, maxDHB, maxDHE, runLo, runHi);
tree->Loop();

}
return 0;
}

Bool_t FillChain(TChain *chain, const char* inputFileList) {

ifstream infile(inputFileList);
#if 0
std::string buffer;
#endif
if (!infile.is_open()) {
std::cerr << "** ERROR: Can't open '" << inputFileList << "' for input" << std::endl;
return kFALSE;
}

std::cout << "TreeUtilities : FillChain " << std::endl;
char buffer[255];
while (infile) {
infile.getline(buffer, 255); // delim defaults to '\n'
if (!infile.good()) break;
std::cout << "Adding " << buffer << " to chain" << std::endl;
chain->Add(buffer);
}
#if 0
while (1) {
infile >> buffer;
if (!infile.good()) break;
chain->Add(buffer.c_str());
}
#endif
std::cout << "No. of Entries in this tree : " << chain->GetEntries() << std::endl;
infile.close();
return kTRUE;
}

2 changes: 2 additions & 0 deletions Calibration/HcalCalibAlgos/macros/install_OfflineMain.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
g++ -Wall -Wno-deprecated -I./ `root-config --cflags` OfflineMain.C -o OfflineMain.exe `root-config --libs`

Loading

0 comments on commit 62cb420

Please sign in to comment.