Problem

I have evrim.C macro and ı am looking for dijet channel. My code is;

[code]void evrim()
{
TH1D* h1 = new TH1D(“Pt”,“histogram”,100,0,1000);
TH1D* h2 = new TH1D(“Eta”,“histogram”,100,4,4);
TH1D* h3 = new TH1D(“Eta”,“histogram”,100,0,6);
TFile file(“foo.root”);
TTree *etree = (TTree *)file.Get(“Event”);

   Trigger *trigger = new Trigger();
   Jet     *jet     = new Jet();
   Electron *electron =new Electron();
   Muon *muon = new Muon();
   Tau *tau = new Tau();
   Photon *photon = new Photon();

   etree->GetBranch("trigger")->SetAddress(&trigger);
   etree->GetBranch("jet")->SetAddress(&jet);
   etree->GetBranch("electron")->SetAddress(&electron);
   etree->GetBranch("muon")->SetAddress(&muon);
   etree->GetBranch("tau")->SetAddress(&tau);
   etree->GetBranch("photon")->SetAddress(&photon);

int n_event = etree->GetEntries ();
for (int index = 0; index < n_event; ++index){
etree->GetEntry(index);
cout << "# jet : " <n_jet << endl;
vector myJets;
for(int ijet = 0; ijet< jet->n_jet;++ijet){

                           if(jet->pt[ijet] >50){
                               cout << "pt: " << jet->pt[ijet] << "

eta: " << jet->eta[ijet] << " phi: " << jet->phi[ijet] << " mass "<<
jet->mass[ijet] <<endl;
TLorentzVector theJet;
theJet.SetPtEtaPhiM(jet->pt[ijet],
jet->eta[ijet], jet->phi[ijet], jet->mass[ijet]);
myJets.push_back(theJet);
}

                      }

       }
       file.Close();

}[/code]

when i run this code, i found error as follow;

root [0] .x evrim.C
Warning in TROOT::Append: Replacing existing TH1: Eta (Potential memory
leak).

jet : 12

pt: 451.27 eta: -0.437 phi: -2.38919 mass 39.85
pt: 357.83 eta: -1.988 phi: 0.955 mass 24.22
pt: 231.31 eta: 0.211 phi: 1.22 mass 25.18
pt: 249.26 eta: -1.592 phi: 1.516 mass 22.8
pt: 179.36 eta: 0.96 phi: -0.100185 mass 32.62
pt: 124.38 eta: 0.743 phi: -1.18319 mass 9.39
pt: 54.07 eta: -0.625 phi: -1.65519 mass 10.36

*** Break *** segmentation violation
Attaching to program: /proc/9462/exe, process 9462
[Thread debugging using libthread_db enabled]
0xffffe410 in __kernel_vsyscall ()
#1 0x009f0713 in __waitpid_nocancel () from /lib/libc.so.6
#2 0x0099507b in do_system () from /lib/libc.so.6
#3 0x00b07ead in system () from /lib/libpthread.so.0
#4 0xf7a47b0d in TUnixSystem::Exec(char const*) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCore.so
#5 0xf7a4cfab in TUnixSystem::StackTrace() () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCore.so
#6 0xf7a4dd7d in TUnixSystem::DispatchSignals(ESignals) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCore.so
#7 0xf7a4de7d in SigHandler(ESignals) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCore.so
#8 0xf7a44782 in sighandler(int) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCore.so
#9
#10 0xf705000d in G__get_ifunc_ref () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#11 0xf6fe8591 in G__exec_bytecode () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#12 0xf6fc12b6 in Cint::G__ExceptionWrapper(int ()(G__value, char const*,
G__param*, int), G__value*, char*, G__param*, int) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#13 0xf6fe4307 in G__exec_asm () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#14 0xf6fe8e07 in G__exec_bytecode () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#15 0xf6fc12b6 in Cint::G__ExceptionWrapper(int ()(G__value, char const*,
G__param*, int), G__value*, char*, G__param*, int) () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so
#16 0xf6fe4307 in G__exec_asm () from
/afs/cern.ch/cms/slc5_ia32_gcc434/lcg/root/5.22.00d-cms18/lib/libCint.so

is there any solution for me…?

Hi,

To avoid:

[quote]Warning in TROOT::Append: Replacing existing TH1: Eta (Potential memory
leak).[/quote]use

TH1D* h1 = new TH1D("Pt","histogram",100,0,1000); TH1D* h2 = new TH1D("Eta","histogram",100,4,4); TH1D* h3 = new TH1D("EtaPos","histogram",100,0,6);

Instead of: Trigger *trigger = new Trigger(); ... etree->GetBranch("trigger")->SetAddress(&trigger);it is recommended to use: Trigger *trigger = 0; ... etree->SetBranchAddress("trigger",&trigger);SetBranchAddress works for both TTree and TChain and contains additional protections.

The segmentation is likely to be caused by either the simple use of vector without a dictionary or by some issue with the use of local variable that are vector inside loops in CINT.

You can solve both problem by adding the necessary #include to your script and doing:root [0] .x evrim.C+

Cheers,
Philippe.

Philippe.

Dear Philippe,

As you said, ı changed my code but when i run it i see pointer error as follows;

Processing evrim.C+…
Info in TUnixSystem::ACLiC: creating shared library /afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim_C.so
In file included from /afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim_C_ACLiC_dict.h:33,
from /afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim_C_ACLiC_dict.cxx:16:
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C: In function ‘void evrim()’:
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:46: error: invalid operands of types ‘const char [8]’ and ‘Trigger*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:47: error: invalid operands of types ‘const char [4]’ and ‘Jet*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:48: error: invalid operands of types ‘const char [9]’ and ‘Electron*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:49: error: invalid operands of types ‘const char [5]’ and ‘Muon*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:50: error: invalid operands of types ‘const char [4]’ and ‘Tau*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:51: error: invalid operands of types ‘const char [7]’ and ‘Photon*’ to binary ‘operator&’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:33: warning: unused variable ‘h1’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:34: warning: unused variable ‘h2’
/afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim.C:35: warning: unused variable 'h3’
g++: /afs/cern.ch/user/k/kangal/scratch0/work/generators/PGS4_ntuplizer/./evrim_C_ACLiC_dict.o: No such file or directory
Error in : Compilation failed!
Error: Function evrim() is not defined in current scope :0:
*** Interpreter error recovered ***

[quote]evrim.C:46: error: invalid operands of types ‘const char [8]’ and ‘Trigger*’ to binary ‘operator&’[/quote]What is the content of line 46?

Philippe.

Dear Philippe,

I made as you said and ı solved the problem but the results is very interesting…the results is given as follows;

jet : 6

pt: 0 eta: 4.2039e-45 phi: 0 mass 2.97776e-41
pt: 434.6 eta: 3.50325e-44 phi: 0 mass 5.2019e-41
pt: 214.6 eta: 3.50325e-44 phi: 0 mass 3.83872e-41
pt: 60.18 eta: 3.50325e-44 phi: 0 mass 6.17048e-41
pt: 30.04 eta: 3.50325e-44 phi: 0 mass 3.04951e-41
pt: 38.72 eta: 3.22299e-44 phi: 0 mass 3.76697e-41

jet : 6

pt: 286.77 eta: 4.2039e-45 phi: 0 mass 2.97776e-41
pt: 272.91 eta: 3.50325e-44 phi: 0 mass 5.2019e-41
pt: 50.12 eta: 3.50325e-44 phi: 0 mass 3.83872e-41
pt: 87.69 eta: 3.50325e-44 phi: 0 mass 6.17048e-41
pt: 34.72 eta: 3.50325e-44 phi: 0 mass 3.04951e-41
pt: 41.54 eta: 3.22299e-44 phi: 0 mass 3.76697e-41

eta, phi and mass is very interesting as you see. do you have any suggestion about this problem…

Hi,

There is still some oddness/mismatch. Do you have a small complete example reproducing the problem?

Philippe.

Dear Philippe,

I am sorry to disturb you…The programs which i used is softsusy-3.1.5, susy-hit, pythia-6.4.23.f PGS, PGS4_ntuplizer. Fisrtly, i put mSugra parametre into slha2Input_mSugraLM1 in softsusy-3.1.5 program then i compile this file. The result of this is given slhaspectrum.in. After that, this file is moved into slhaspectrum.in and it is run here. The result of this is given susyhit_slha.out. Then i adjusted susyhit_slha.out as SUSY case and parton disturibution function in PGS. Then ı compile PGS and ı find “pgs_output.txt” file. Then, in PGS4_ntuplizer program, ı run PGS4_ntuplizer with ntuble. Finally, this is producing foo.root file. Then , i try to make analysis.

Evrim

Hi Evrim,

[quote] Finally, this is producing foo.root file. Then , i try to make analysis.[/quote]And does your analysis code requires all the above? Can you simplify your analysis to be simplier so that you can share it (and so I can try to reproduce the problem)?

Philippe.

Dear Philippe,

I know that my code is too long. According to me, the reason of the problem is that c++ complie is different from root interpreter because eta and phi values are given as ordinary. How can i solve this problem.

Evrim

[quote]According to me, the reason of the problem is that c++ complie is different from root interpreter because eta and phi values are given as ordinary. [/quote]If this is the case, then the problem ought to go away if you compile your interpreted code (via ACLiC for example).

[quote]How can i solve this problem.[/quote]I am not sure … I really don’t know yet what the problem is …

Philippe.

Dear Philippe,

I am looking at some webpage about my code. For extension of root, MakeClass() is not appied for my code.
is it possible that there is any relation between the reason of the problem and MakeClass()?

[quote]For extension of root, MakeClass() is not appied for my code. [/quote]What do you mean?

[quote]is it possible that there is any relation between the reason of the problem and MakeClass()?[/quote]Yes, it is plausible.

Philippe.

Hi,

if you still have that problem, and if you are at CERN, I think that at this point it’s simpler if you come by my office so we can have a look together. Please contact me at axel@cern.ch if you want to come by.

Cheers, Axel.