Dear Root experts;
I am running a TSlector that clones the tree and add more branches to it. The problem is that this code works for half of the files and has a *** Break *** segmentation violation for half of them, so I dont understand why this happens to some of the files.
You can find enclosed the code, however I highlight here what I think are the main features of my TSelector (“MetSign”):
In MetSign.C:
#define MetSign_cxx
#include "MetSign.h"
#include <TH2.h>
#include <TStyle.h>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <TCanvas.h>
#include <TLorentzVector.h>
#include <TDirectoryFile.h>
#include "TFile.h"
#include "TTree.h"
using namespace std;
Int_t fNumberOfEvents; // Total number of events
void MetSign::Begin(TTree * /*tree*/)
{
fNumberOfEvents = 0 ;
t_tree = 0;
vesseltree = 0;
}
void MetSign::SlaveBegin(TTree * /*tree*/)
{
TString treefile = "/data/atlas0/dportill/DougNtuples/mc15_13TeV.363379.Sherpa_NNPDF30NNLO_Zmumu_Pt700_1000_CVetoBVeto.merge.DAOD_SUSY5.e4716_s2726_r7725_r7676_p2666.root";
TFile *ftree = new TFile(treefile);
vesseltree = (TTree*)ftree->Get("CollectionTree");
//create the new file
TFile *g = new TFile("./NTuples/test.root", "RECREATE");
t_tree = new TTree("testtree","Ntuples for Met Significance study");
t_tree = vesseltree ->CloneTree(0);
t_tree->Branch("Significance",&MetSig_t);
fOutput->Add(t_tree);
}
Bool_t MetSign::Process(Long64_t entry)
{
vesseltree ->GetEntry(fNumberOfEvents);
MetSig_t = 1; //Some calculation
t_tree->Fill();
return kTRUE;
}
void MetSign::Terminate()
{
TFile f1("./HISTOS/Zmumu_Pt700_1000_CVetoBVeto.root","RECREATE");//
f1.Close();
}
In MetSign.h
#ifndef MetSign_h
#define MetSign_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
#include <TH2.h>
#include <TH3.h>
#include <TLorentzVector.h>
#include <TVector3.h>
#include <set>
#include <tuple>
class MetSign : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Tree Ntuple
TTree *t_tree; //!
TTree *vesseltree; //!
Double_t MetSig_t;
}
The root files I am using in the TSlector are:
[]The one that do not runs: /afs/cern.ch/work/d/dportill/public/NTuples/mc15_13TeV.363377.Sherpa_NNPDF30NNLO_Zmumu_Pt500_700_CFilterBVeto.merge.DAOD_SUSY5.e4716_s2726_r7725_r7676_p2666.root
[ ]The one that runs: /afs/cern.ch/work/d/dportill/public/NTuples/mc15_13TeV.363379.Sherpa_NNPDF30NNLO_Zmumu_Pt700_1000_CVetoBVeto.merge.DAOD_SUSY5.e4716_s2726_r7725_r7676_p2666.root
This is the error message I am obtaining when I run it direct ( CollectionTree->Process(“MetSign.C+”) ):
===========================================================
There was a crash.
This is the entire stack trace of all threads:
#0 0x0000003dfc8ac7be in waitpid () from /lib64/libc.so.6
#1 0x0000003dfc83e5c9 in do_system () from /lib64/libc.so.6
#2 0x00007fcb0365ba0a in Exec (shellcmd=, this=0x79f8e0) at /usr/local/src/root_v6.08.02.src/core/unix/src/TUnixSystem.cxx:2116
#3 TUnixSystem::StackTrace (this=0x79f8e0) at /usr/local/src/root_v6.08.02.src/core/unix/src/TUnixSystem.cxx:2403
#4 0x00007fcb0365e13c in TUnixSystem::DispatchSignals (this=0x79f8e0, sig=kSigSegmentationViolation) at /usr/local/src/root_v6.08.02.src/core/unix/src/TUnixSystem.cxx:3661
#5
#6 TTree::OptimizeBaskets (this=0x424c990, maxMemory=0, minComp=0, option=0x7fcaee639ebd “”) at /usr/local/src/root_v6.08.02.src/tree/tree/src/TTree.cxx:6534
#7 0x00007fcaee6249eb in TTree::Fill (this=0x424c990) at /usr/local/src/root_v6.08.02.src/tree/tree/src/TTree.cxx:4435
#8 0x00007fcaec0a8be4 in MetSign::Process(long long) () from /gpfs/automountdir/t3/atlas/atlas0/dportill/Tree_Significance/MetSign_C.so
#9 0x00007fcaed4fa8d8 in TTreePlayer::Process (this=0x236e560, selector=0x27b4c50, option=, nentries=, firstentry=0) at /usr/local/src/root_v6.08.02.src/tree/treeplayer/src/TTreePlayer.cxx:2293
#10 0x00007fcaed4fe491 in TTreePlayer::Process (this=0x236e560, filename=, option=, nentries=9223372036854775807, firstentry=0) at /usr/local/src/root_v6.08.02.src/tree/treeplayer/src/TTreePlayer.cxx:2195
#11 0x00007fcaff6860aa in ?? ()
#12 0x00000000025cfd02 in ?? ()
#13 0x00000000025fe400 in ?? ()
#14 0x00007fffb1e28950 in ?? ()
#15 0x00007fffb1e28d00 in ?? ()
#16 0x7fffffffffffffff in ?? ()
#17 0x0000000000804480 in ?? ()
#18 0x00000000025fe970 in ?? ()
#19 0x0000000000804480 in ?? ()
#20 0x00007fffb1e28d00 in ?? ()
#21 0x00007fffb1e28d00 in ?? ()
#22 0x0000000000809210 in ?? ()
#23 0x00000000025d2d48 in ?? ()
#24 0x00007fffb1e28950 in ?? ()
#25 0x00007fcb001bdc4c in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/local/root_v6.08.02/lib/libCling.so
#26 0x00007fcb001beccd in cling::Interpreter::EvaluateInternal(std::string const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/local/root_v6.08.02/lib/libCling.so
#27 0x00007fcb001bef0d in cling::Interpreter::process(std::string const&, cling::Value*, cling::Transaction**) () from /usr/local/root_v6.08.02/lib/libCling.so
#28 0x00007fcb0025c2eb in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /usr/local/root_v6.08.02/lib/libCling.so
#29 0x00007fcb00126366 in HandleInterpreterException (metaProcessor=, input_line=, compRes=
0x7fffb1e28bfc: cling::Interpreter::kSuccess, result=result
entry=0x7fffb1e28d00) at /usr/local/src/root_v6.08.02.src/core/meta/src/TCling.cxx:1882
#30 0x00007fcb0013647f in TCling::ProcessLine (this=0x7fd690, line=, error=0x7fffb1e290ec) at /usr/local/src/root_v6.08.02.src/core/meta/src/TCling.cxx:2048
#31 0x00007fcb0354d1f6 in TApplication::ProcessLine (this=this
entry=0x7ecea0, line=, sync=sync
entry=false, err=err
entry=0x7fffb1e290ec) at /usr/local/src/root_v6.08.02.src/core/base/src/TApplication.cxx:1005
#32 0x00007fcb039c299f in TRint::ProcessLineNr (this=this
entry=0x7ecea0, filestem=filestem
entry=0x7fcb039d1288 “ROOT_prompt_”, line=0x25dc7e0 “CollectionTree->Process("MetSign.C+")”, error=0x7fffb1e290ec, error
entry=0x0) at /usr/local/src/root_v6.08.02.src/core/rint/src/TRint.cxx:749
#33 0x00007fcb039c2cfb in TRint::HandleTermInput (this=0x7ecea0) at /usr/local/src/root_v6.08.02.src/core/rint/src/TRint.cxx:610
#34 0x00007fcb0365d73d in TUnixSystem::CheckDescriptors (this=this
entry=0x79f8e0) at /usr/local/src/root_v6.08.02.src/core/unix/src/TUnixSystem.cxx:1321
#35 0x00007fcb0365e9da in TUnixSystem::DispatchOneEvent (this=0x79f8e0, pendingOnly=) at /usr/local/src/root_v6.08.02.src/core/unix/src/TUnixSystem.cxx:1076
#36 0x00007fcb035a83d4 in TSystem::InnerLoop (this=0x79f8e0) at /usr/local/src/root_v6.08.02.src/core/base/src/TSystem.cxx:408
#37 0x00007fcb035a7101 in TSystem::Run (this=0x79f8e0) at /usr/local/src/root_v6.08.02.src/core/base/src/TSystem.cxx:358
#38 0x00007fcb0354a84f in TApplication::Run (this=this
entry=0x7ecea0, retrn=retrn
entry=false) at /usr/local/src/root_v6.08.02.src/core/base/src/TApplication.cxx:1153
#39 0x00007fcb039c42cf in TRint::Run (this=0x7ecea0, retrn=) at /usr/local/src/root_v6.08.02.src/core/rint/src/TRint.cxx:463
#40 0x0000000000401000 in main (argc=1, argv=0x7fffb1e2b538) at /usr/local/src/root_v6.08.02.src/main/src/rmain.cxx:30
The lines below might hint at the cause of the crash.
You may get help by asking at the ROOT forum root.cern.ch/forum .
Only if you are really convinced it is a bug in ROOT then please submit a
report at root.cern.ch/bugs . Please post the ENTIRE stack trace
from above as an attachment in addition to anything else
that might help us fixing this issue.
#6 TTree::OptimizeBaskets (this=0x424c990, maxMemory=0, minComp=0, option=0x7fcaee639ebd “”) at /usr/local/src/root_v6.08.02.src/tree/tree/src/TTree.cxx:6534
#7 0x00007fcaee6249eb in TTree::Fill (this=0x424c990) at /usr/local/src/root_v6.08.02.src/tree/tree/src/TTree.cxx:4435
#8 0x00007fcaec0a8be4 in MetSign::Process(long long) () from /gpfs/automountdir/t3/atlas/atlas0/dportill/Tree_Significance/MetSign_C.so
#9 0x00007fcaed4fa8d8 in TTreePlayer::Process (this=0x236e560, selector=0x27b4c50, option=, nentries=, firstentry=0) at /usr/local/src/root_v6.08.02.src/tree/treeplayer/src/TTreePlayer.cxx:2293
#10 0x00007fcaed4fe491 in TTreePlayer::Process (this=0x236e560, filename=, option=, nentries=9223372036854775807, firstentry=0) at /usr/local/src/root_v6.08.02.src/tree/treeplayer/src/TTreePlayer.cxx:2195
#11 0x00007fcaff6860aa in ?? ()
#12 0x00000000025cfd02 in ?? ()
#13 0x00000000025fe400 in ?? ()
#14 0x00007fffb1e28950 in ?? ()
#15 0x00007fffb1e28d00 in ?? ()
#16 0x7fffffffffffffff in ?? ()
#17 0x0000000000804480 in ?? ()
#18 0x00000000025fe970 in ?? ()
#19 0x0000000000804480 in ?? ()
#20 0x00007fffb1e28d00 in ?? ()
#21 0x00007fffb1e28d00 in ?? ()
#22 0x0000000000809210 in ?? ()
#23 0x00000000025d2d48 in ?? ()
#24 0x00007fffb1e28950 in ?? ()
#25 0x00007fcb001bdc4c in cling::Interpreter::RunFunction(clang::FunctionDecl const*, cling::Value*) () from /usr/local/root_v6.08.02/lib/libCling.so
#26 0x00007fcb001beccd in cling::Interpreter::EvaluateInternal(std::string const&, cling::CompilationOptions, cling::Value*, cling::Transaction**, unsigned long) () from /usr/local/root_v6.08.02/lib/libCling.so
#27 0x00007fcb001bef0d in cling::Interpreter::process(std::string const&, cling::Value*, cling::Transaction**) () from /usr/local/root_v6.08.02/lib/libCling.so
#28 0x00007fcb0025c2eb in cling::MetaProcessor::process(char const*, cling::Interpreter::CompilationResult&, cling::Value*) () from /usr/local/root_v6.08.02/lib/libCling.so
#29 0x00007fcb00126366 in HandleInterpreterException (metaProcessor=, input_line=, compRes=
0x7fffb1e28bfc: cling::Interpreter::kSuccess, result=result
entry=0x7fffb1e28d00) at /usr/local/src/root_v6.08.02.src/core/meta/src/TCling.cxx:1882
And this one when I run it in proof:
I really appreciate if someone can help me to spot the problem.
Thanks!!
MetSign.h (104 KB)
MetSign.C (47.6 KB)
pcanal
January 18, 2017, 8:28pm
2
Hi,
Nothing obvious. Can you send us an example ROOT file so that we can reproduce this problem?
Alternative can you run your failing example with valgrind (i.e. valgrind --suppressions=$ROOTSYS/etc/valgrind-root.supp root.exe … )
Cheers,
Philippe.