//*************************************************************** // Ian Connelly // 14/03/12 // Code to create TFile with appropriate TTree to train a BDT on // Based on code of: // 09-02-2012 // Analysis program for running over HW->lnubb MC sample //*************************************************************** // physics.h and physics.c were made by the MakeClass() function // root; TChain chain ("physics") // chain.Add(files) // chain.MakeClass() //*************************************************************** // New addition based on Ricardo's suggestion on 14 May 2012 // What if there is a possibility that in treating the vectors in // the detector frame, I will be affected from the fact that we // use pseudorapidity because it is Lorentz invariant when adding // whereas the angular analysis might not be, which could lead to // ambiguities (?). // I will also use this as an opportunity to update the selection // criteria so that I select the following: // MV1 at 70% efficiency // Only 2 bjets // Reject if any other antiKt jets with pt>20 are found // Bjets have to be in eta < 2.4 and pt > 25GeV // I will then calculate the boost required to move to the frame // where the pz of the 2 bjet system is zero. // Upon finding this, I will boost all hadron tracks to this frame // and then apply the same angular analysis as previously //*************************************************************** #include "TFile.h" #include "TTree.h" #include "TChain.h" #include "TString.h" #include #include #include #include "sys/stat.h" #include #include #include using std::cout; using std::endl; #include "physics.h" //In physics.h, I had to include a using std::vector and std::string as otherwise c++ compiling is not possible int main(int argc, char ** argv) { //USAGE : argument 1 - physics (name of the tree we want) // : argument 2 - directory to the rootfiles which can now read multiples //Having difficulty getting the program to load the root file name and read the tree properly into the physics class as it has not been initializing correctly. Therefore I will be doing it with the root and tree names explicitly defined in the code. // Will need to tweak this to accept multiple root files // Maybe use arg 1 sa physics // and remaining arguments will be the files // Will see. TString treeClass(argv[1]); TString rootFile(argv[2]); TChain* chain = new TChain(treeClass.Data()); cout<<"Loading files:"<d_name; if (stat( filePath, &filestat )) continue; if (S_ISDIR( filestat.st_mode )) continue; cout << filePath << endl; chain->Add(filePath); } closedir(dp); //TChain* dataChain = new TChain(treeClass.Data()); //This has the same name as the //dataChain->Add(rootFile.Data()); physics newPhys(chain); //physics checkPhys; //cout << "Loop over checkPhys" << endl; //checkPhys.Loop(); //newPhys.Show(12); //checkPhys.Show(12); cout << "Number of events loaded in the TChain is : " << chain->GetEntries() << endl; std::cerr << "Number of events loaded in the TChain is : " << chain->GetEntries() << endl; cout << "Initialising preselection method." << endl; //newPhys.Loop(); //newPhys.Preselection(); newPhys.Newselection(); return 0; }