File is not supported- Expert Mode

Asked by daniel camargo

Dear Experts,

I tried to reproduce the example of arxiv/1405.3982 for the muon isolation with my own muons.lhco file. So, I write the user.cpp as follows,

#include "SampleAnalyzer/User/Analyzer/Higgs.h"
using namespace MA5;
using namespace std;

  -----------------------------------------------------------------------
// Initialize
// function called one time at the beginning of the analysis
// -----------------------------------------------------------------------------
bool Higgs::Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters)
{
 // Initializing PhysicsService for MC
 // PHYSICS->mcConfig().Reset();

   // Initializing PhysicsService for RECO
  PHYSICS->recConfig().Reset();

  cout << "BEGIN Initialization" << endl;
  // initialize variables, histos

  // Manager()->AddHisto("ptep",30,50,500.0);
  // Manager()->FillHisto("ptep",Muon)

  cout << "END Initialization" << endl;
  return true;
}

// -----------------------------------------------------------------------------
// Finalize
// function called one time at the end of the analysis
// -----------------------------------------------------------------------------
void Higgs::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
{
  cout << "BEGIN Finalization" << endl;
  // saving histos
  cout << "END Finalization" << endl;
}

// -----------------------------------------------------------------------------
// Execute
// function called each time one event is read
// -----------------------------------------------------------------------------
bool Higgs::Execute(SampleFormat& sample, const EventFormat& event)
{

 // ***************************************************************************
  // Example of analysis with reconstructed objects
  // Concerned samples :
  // - LHCO samples
  // - LHE/STDHEP/HEPMC samples after applying jet-clustering algorithm
  // ***************************************************************************

  if (event.rec()!=0)
  {

    std::vector<const RecLeptonFormat*> MyMuons;
    for(unsigned int i=0;i<event.rec()->muons().size();i++)
      {
 const RecLeptonFormat *Muon = &event.rec()->muons()[i];
 for(unsigned int j=0; j<Muon->isolCones().size(); j++)
   {
     const IsolationConeType *cone = &Muon->isolCones()[j];
     if(std::fabs(cone->deltaR()-0.4)<1e-3)
       {
  if(cone->sumET()/Muon->momentum().Pt()<.20)
    MyMuons.push_back(Muon);
       }
   }
      }
  }

  return true;
}

In the user.h I just write the following,

#ifndef analysis_Higgs_h
#define analysis_Higgs_h

#include "SampleAnalyzer/Process/Analyzer/AnalyzerBase.h"

namespace MA5
{
class Higgs : public AnalyzerBase
{
  INIT_ANALYSIS(Higgs,"Higgs")

 public:
  virtual bool Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters);
  virtual void Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files);
  virtual bool Execute(SampleFormat& sample, const EventFormat& event);

 private:
 // Declaring histogram array
  PlotManager plots_;

  // Declaring cut array
  CounterManager cuts_;

  // Declaring shortcut to histograms
  Histo* ptep;
  std::vector<const RecParticleFormat*> MyMuons;

};
}

#endif

So, when I try to make the run as ./MadAnalysis5job ~/Documents/madanalysis5/HZZ_backs/muons.lhco), a lot of the ERROR messages appear:
.
.
.
ERROR: the format of the input file is not supported. The file is skipped.
    * 41244/41246 1
ERROR: the format of the input file is not supported. The file is skipped.
    * 41245/41246 2
ERROR: the format of the input file is not supported. The file is skipped.
    * 41246/41246 3
ERROR: the format of the input file is not supported. The file is skipped.
.
.
.
    * Finalizing all components ...
    * Total number of processed events: 0.
BEGIN Finalization
END Finalization
    * Goodbye.

I forget to write-modify something?

Thanks in advance for the help!

daniel.

Question information

Language:
English Edit question
Status:
Answered
For:
MadAnalysis 5 Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Benjamin Fuks (fuks) said :
#1

Dear Daniel,

The IsolCone information is not available within the LHCO format. The only way (up to now) to enable it is to use the Ma5Tune of Delphes.

Cheers,

Benjamin

Revision history for this message
daniel camargo (dacamargov) said :
#2

Dear Benjamin,

Thanks for the information about the IsolCone function. Now, I am trying to look for the another example that take the pt>50. So, the program run ok until I intend to fill the histogram. I defined in the usser.h my histogram as follows;

Histo* pte;

And in the usser.cpp I write the following

#include "SampleAnalyzer/User/Analyzer/Higgs.h"
using namespace MA5;
using namespace std;

// -----------------------------------------------------------------------------
// Initialize
// function called one time at the beginning of the analysis
// -----------------------------------------------------------------------------
bool Higgs::Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters)
{
 // Initializing PhysicsService for MC
  PHYSICS->mcConfig().Reset();

   // Initializing PhysicsService for RECO
   PHYSICS->recConfig().Reset();

  cout << "BEGIN Initialization" << endl;
  // initialize variables, histos
  pte = plots.Add_Histo("electrons", 100,0,100.0);

  cout << "END Initialization" << endl;
  return true;
}

// -----------------------------------------------------------------------------
// Finalize
// function called one time at the end of the analysis
// -----------------------------------------------------------------------------
void Higgs::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
{
  cout << "BEGIN Finalization" << endl;
  // saving histos
  plots.Write_TextFormat(out());
  plots.Finalize();
  cout << "END Finalization" << endl;
}

// -----------------------------------------------------------------------------
// Execute
// function called each time one event is read
// -----------------------------------------------------------------------------
bool Higgs::Execute(SampleFormat& sample, const EventFormat& event)
{

 // ***************************************************************************
  // Example of analysis with reconstructed objects
  // Concerned samples :
  // - LHCO samples
  // - LHE/STDHEP/HEPMC samples after applying jet-clustering algorithm
  // ***************************************************************************

  if (event.mc()!=0)
  {

    std::vector<const MCParticleFormat*> electrons;
    for(unsigned int i=0;i<event.mc()->particles().size();i++)
      {
 const MCParticleFormat *prt = &event.mc()->particles()[i];
 if(prt->statuscode() !=1) continue;
 if(std::abs(prt->pdgid())==11)
   {
     if(prt->momentum().Pt()>50);
     electrons.push_back(prt);
  }
      }

    for(unsigned int j=0;j<electrons.size();j++)
      {
 pte->Fill(electrons[j]);
      }

  }
  return true;
}

The error when I run it is;

SampleAnalyzer/User/Analyzer/Higgs.cpp: In member function ‘virtual bool MA5::Higgs::Execute(MA5::SampleFormat&, const MA5::EventFormat&)’:
SampleAnalyzer/User/Analyzer/Higgs.cpp:69:24: error: no matching function for call to ‘MA5::Histo::Fill(const MA5::MCParticleFormat*&)’
SampleAnalyzer/User/Analyzer/Higgs.cpp:69:24: note: candidate is:
/home/daniel/Documents/madanalysis5/tools/SampleAnalyzer/Process/Plot/Histo.h:152:8: note: void MA5::Histo::Fill(Double_t, Double_t)
/home/daniel/Documents/madanalysis5/tools/SampleAnalyzer/Process/Plot/Histo.h:152:8: note: no known conversion for argument 1 from ‘const MA5::MCParticleFormat*’ to ‘Double_t {aka double}’
make: *** [SampleAnalyzer/User/Analyzer/Higgs.o] Error 1

And of course is the way in which I use the Histo class, but I don't understad yet. Can you give me some advises!

Thanks in advance for the help,

daniel

Revision history for this message
Benjamin Fuks (fuks) said :
#3

Hi,

You need to fill the histogram with a number (electrons[j]->pt()), not with an electron object (electrons[j]).

Cheers,

Benjamin

On 10 Dec 2014, at 17:46 , daniel camargo <email address hidden> wrote:

> Question #258721 on MadAnalysis 5 changed:
> https://answers.launchpad.net/madanalysis5/+question/258721
>
> Status: Answered => Open
>
> daniel camargo is still having a problem:
> Dear Benjamin,
>
> Thanks for the information about the IsolCone function. Now, I am trying
> to look for the another example that take the pt>50. So, the program run
> ok until I intend to fill the histogram. I defined in the usser.h my
> histogram as follows;
>
> Histo* pte;
>
> And in the usser.cpp I write the following
>
> #include "SampleAnalyzer/User/Analyzer/Higgs.h"
> using namespace MA5;
> using namespace std;
>
> // -----------------------------------------------------------------------------
> // Initialize
> // function called one time at the beginning of the analysis
> // -----------------------------------------------------------------------------
> bool Higgs::Initialize(const MA5::Configuration& cfg, const std::map<std::string,std::string>& parameters)
> {
> // Initializing PhysicsService for MC
> PHYSICS->mcConfig().Reset();
>
> // Initializing PhysicsService for RECO
> PHYSICS->recConfig().Reset();
>
> cout << "BEGIN Initialization" << endl;
> // initialize variables, histos
> pte = plots.Add_Histo("electrons", 100,0,100.0);
>
> cout << "END Initialization" << endl;
> return true;
> }
>
> // -----------------------------------------------------------------------------
> // Finalize
> // function called one time at the end of the analysis
> // -----------------------------------------------------------------------------
> void Higgs::Finalize(const SampleFormat& summary, const std::vector<SampleFormat>& files)
> {
> cout << "BEGIN Finalization" << endl;
> // saving histos
> plots.Write_TextFormat(out());
> plots.Finalize();
> cout << "END Finalization" << endl;
> }
>
> // -----------------------------------------------------------------------------
> // Execute
> // function called each time one event is read
> // -----------------------------------------------------------------------------
> bool Higgs::Execute(SampleFormat& sample, const EventFormat& event)
> {
>
> // ***************************************************************************
> // Example of analysis with reconstructed objects
> // Concerned samples :
> // - LHCO samples
> // - LHE/STDHEP/HEPMC samples after applying jet-clustering algorithm
> // ***************************************************************************
>
> if (event.mc()!=0)
> {
>
> std::vector<const MCParticleFormat*> electrons;
> for(unsigned int i=0;i<event.mc()->particles().size();i++)
> {
> const MCParticleFormat *prt = &event.mc()->particles()[i];
> if(prt->statuscode() !=1) continue;
> if(std::abs(prt->pdgid())==11)
> {
> if(prt->momentum().Pt()>50);
> electrons.push_back(prt);
> }
> }
>
> for(unsigned int j=0;j<electrons.size();j++)
> {
> pte->Fill(electrons[j]);
> }
>
>
> }
> return true;
> }
>
> The error when I run it is;
>
> SampleAnalyzer/User/Analyzer/Higgs.cpp: In member function ‘virtual bool MA5::Higgs::Execute(MA5::SampleFormat&, const MA5::EventFormat&)’:
> SampleAnalyzer/User/Analyzer/Higgs.cpp:69:24: error: no matching function for call to ‘MA5::Histo::Fill(const MA5::MCParticleFormat*&)’
> SampleAnalyzer/User/Analyzer/Higgs.cpp:69:24: note: candidate is:
> /home/daniel/Documents/madanalysis5/tools/SampleAnalyzer/Process/Plot/Histo.h:152:8: note: void MA5::Histo::Fill(Double_t, Double_t)
> /home/daniel/Documents/madanalysis5/tools/SampleAnalyzer/Process/Plot/Histo.h:152:8: note: no known conversion for argument 1 from ‘const MA5::MCParticleFormat*’ to ‘Double_t {aka double}’
> make: *** [SampleAnalyzer/User/Analyzer/Higgs.o] Error 1
>
> And of course is the way in which I use the Histo class, but I don't
> understad yet. Can you give me some advises!
>
> Thanks in advance for the help,
>
> daniel
>
> --
> You received this question notification because you are an answer
> contact for MadAnalysis 5.

Revision history for this message
daniel camargo (dacamargov) said :
#4

Hi Benjamin,

There is not error now using your comment, but when I run my sample (./MadAnalysis5job run.txt) appears a segmentation fault. The implementation of the run is above. Besides I already try with two samples, events.lhe and events.hep but nothing change.

Thanks in advance for the help!

Daniel

Revision history for this message
Benjamin Fuks (fuks) said :
#5

Hi,

Could you please provide me the code so that I could have a look (after new year).

Cheers,

Benjamin

On 17 Dec 2014, at 14:26 , daniel camargo <email address hidden> wrote:

> Question #258721 on MadAnalysis 5 changed:
> https://answers.launchpad.net/madanalysis5/+question/258721
>
> Status: Answered => Open
>
> daniel camargo is still having a problem:
> Hi Benjamin,
>
> There is not error now using your comment, but when I run my sample
> (./MadAnalysis5job run.txt) appears a segmentation fault. The
> implementation of the run is above. Besides I already try with two
> samples, events.lhe and events.hep but nothing change.
>
> Thanks in advance for the help!
>
> Daniel
>
> --
> You received this question notification because you are an answer
> contact for MadAnalysis 5.

Revision history for this message
daniel camargo (dacamargov) said :
#6

Of course!, please give me your email.

Cheers,

daniel

Revision history for this message
Benjamin Fuks (fuks) said :
#7

fuks _at_ cern.ch

Revision history for this message
Benjamin Fuks (fuks) said :
#8

Hi Daniel,

Could you please have a look to the main.cpp program and check line 30. You should see:
  if (!manager.Initialize(argc,argv,"pdg.ma5",true)) return 1;
Please replace this line by
  if (!manager.Initialize(argc,argv,"pdg.ma5")) return 1;

The expert mode is supposed to be used with the new outputting way (using saf files as explained in arXiv:1405.3982), while you are still using the old way. To re-enable the old way, it is sufficient to remove the "true" above from the main program.

Cheers,

Benjamin

On 17 Dec 2014, at 14:41 , daniel camargo <email address hidden> wrote:

> Question #258721 on MadAnalysis 5 changed:
> https://answers.launchpad.net/madanalysis5/+question/258721
>
> daniel camargo posted a new comment:
> Of course!, please give me your email.
>
> Cheers,
>
> daniel
>
> --
> You received this question notification because you are an answer
> contact for MadAnalysis 5.

Can you help with this problem?

Provide an answer of your own, or ask daniel camargo for more information if necessary.

To post a message you must log in.