//------------------------------------------------------------------- //------------------------------------------------------------------- //------------------------------------------------------------------- //------------------------------------------------------------------- //------------------------------------------------------------------- Jul 12, 2009 //How to root a file in dCache on the fly: //root [7] TFile *hfile = new TDCacheFile ("dcap://cmsgridftp.fnal.gov:24125/pnfs/fnal.gov/usr/cms/WAX/11/store/mc/Summer08/MinBias/GEN-SIM-RAW/STARTUP_V5_STARTUP_V5_v1/0007/FEE661F6-606E-DD11-887D-001A9243D528.root","READ",0); //------------------------------------------------------------------- April 22, 2009 // How to Read Objects from a File. How to loop over objects (histograms) //on a file TIter nextkey(f.GetListOfKeys()); TKey *key; while (key = (TKey*)nextkey()) { Event *event = (Event*)key->ReadObj(); event->Process(); { //------------------------------------------------------------------- April 30, 2009 //How to load some framework to do some on the fly physics analysis TFile* _file0 = new TFile("HLTFromPureRaw.root","READ"); gSystem->Load("/uscmst1/prod/sw/cms/slc4_ia32_gcc345/cms/cmssw/CMSSW_2_2_6_HLT/lib/slc4_ia32_gcc345/libFWCoreFWLite.so"); AutoLibraryLoader::enable(); TTree* mytree = (TTree*) _file0->Get("Events"); int nevt = mytree->GetEntries(); vector evt; TBranch* cand = mytree->GetBranch("EventAuxiliary"); vector evt; cand->SetAddress(&evt); int myevt= -1; for (int j = 0;jGetEntry(j); myevt = evt[0].event(); cout< root -l 'eraseme.C("hola")' // | // |__ watch that there is no spaces here. // ------------------------------------------------------------------- // May 26, 2008 // To install CERN's ROOT in Ubuntu 8.04 (Heron) I went to: // http://mirror.phy.bnl.gov/debian-root/ubuntu/ // and followed the instructions there. // It was successfully installed despite the error in the signature // verification. // ------------------------------------------------------------------- // July 20, 2006 // Function to calculate Binomial Errors Float_t GetBinomialErr(Float_t Passed,Float_t Failed) { if ((Passed+Failed)>0){ Float_t Total = Passed+Failed; Float_t Eff = Passed/Total; Float_t DeltaPassed = sqrt(Passed); Float_t DeltaFailed = sqrt(Failed); Float_t ErrPass = (((1-Eff)*(1-Eff))/(Total*Total))*DeltaPassed*DeltaPassed; Float_t ErrFail = ((Eff*Eff)/(Total*Total))*DeltaFailed*DeltaFailed; Float_t Err = sqrt(ErrPass+ErrFail); return Err; } else return 0; } // ------------------------------------------------------------------- July 13, 2005 // How to dump the contents of a TTree to an ascii file // ttree->SetScanFiel(0); // tree->Scan("field1:field2","cond1"); > log.txt //spaces are important // ------------------------------------------------------------------- July 13, 2005 // How to run root in batch mode // make a shell script which you will submit to the batch system and // put in this script the following line: // root -b -q run.cc