Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-19 23:20:33

0001 #ifndef helper_h
0002 #define helper_h
0003 
0004 #include "LSTEff.h"
0005 #include "cxxopts.h"
0006 #include "rooutil.h"
0007 
0008 class AnalysisConfig {
0009 public:
0010   // TString that holds the input file list (comma separated)
0011   TString input_file_list_tstring;
0012 
0013   // TString that holds the name of the TTree to open for each input files
0014   TString input_tree_name;
0015 
0016   // Output TFile
0017   TFile* output_tfile;
0018 
0019   // Number of events to loop over
0020   int n_events;
0021 
0022   // Minimum pt cut
0023   float pt_cut;
0024 
0025   // Max eta cut
0026   float eta_cut;
0027 
0028   // Jobs to split (if this number is positive, then we will skip certain number of events)
0029   // If there are N events, and was asked to split 2 ways, then depending on job_index, it will run over first half or latter half
0030   int nsplit_jobs;
0031 
0032   // Job index (assuming nsplit_jobs is set, the job_index determine where to loop over)
0033   int job_index;
0034 
0035   // Debug boolean
0036   bool debug;
0037 
0038   // TChain that holds the input TTree's
0039   TChain* events_tchain;
0040 
0041   // Custom Looper object to facilitate looping over many files
0042   RooUtil::Looper<LSTEff> looper;
0043 
0044   // Custom Cutflow framework
0045   RooUtil::Cutflow cutflow;
0046 
0047   // Custom Histograms object compatible with RooUtil::Cutflow framework
0048   RooUtil::Histograms histograms;
0049 
0050   // Custom TTree object to hold intermediate variables
0051   RooUtil::TTreeX tx;
0052 
0053   // pt binning options
0054   int ptbound_mode;
0055 
0056   // pdgid
0057   int pdgid;
0058 
0059   // pdgids to filter
0060   std::vector<int> pdgids;
0061 
0062   // do lower level
0063   bool do_lower_level;
0064 
0065   AnalysisConfig();
0066 };
0067 
0068 extern AnalysisConfig ana;
0069 
0070 class SimTrackSetDefinition {
0071 public:
0072   TString set_name;
0073   int pdgid;
0074   int q;
0075   std::function<bool(unsigned int)> pass;
0076   std::function<bool(unsigned int)> sel;  // subset of sim track selection
0077   SimTrackSetDefinition(TString, int, int, std::function<bool(unsigned int)>, std::function<bool(unsigned int)>);
0078 };
0079 
0080 class RecoTrackSetDefinition {
0081 public:
0082   TString set_name;
0083   std::function<bool(unsigned int)> pass;
0084   std::function<bool(unsigned int)> sel;
0085   std::function<const std::vector<float>()> pt;
0086   std::function<const std::vector<float>()> eta;
0087   std::function<const std::vector<float>()> phi;
0088   std::function<const std::vector<int>()> type;
0089   RecoTrackSetDefinition(TString,
0090                          std::function<bool(unsigned int)>,
0091                          std::function<bool(unsigned int)>,  // subsect of reco track selection
0092                          std::function<const std::vector<float>()>,
0093                          std::function<const std::vector<float>()>,
0094                          std::function<const std::vector<float>()>,
0095                          std::function<const std::vector<int>()>);
0096 };
0097 
0098 void parseArguments(int argc, char** argv);
0099 void initializeInputsAndOutputs();
0100 std::vector<float> getPtBounds(int mode);
0101 
0102 #endif