Index: trunk/Delphes.cpp
===================================================================
--- trunk/Delphes.cpp	(revision 62)
+++ trunk/Delphes.cpp	(revision 63)
@@ -29,4 +29,6 @@
 #include "interface/VeryForward.h"
 #include "interface/JetUtils.h"
+
+#include "Utilities/FROG/Examples/Sim_Delphes/FrogUtil.h"
 
 #include <vector>
@@ -93,7 +95,11 @@
   DET->Logfile(LogName);
 
+
   //Trigger information
-  Trigger *TRIG = new Trigger();
-  TRIG->TriggerReader("data/trigger.dat");
+  TriggerTable *TRIGT = new TriggerTable();
+  TRIGT->TriggerCardReader("data/trigger.dat");
+  TRIGT->PrintTriggerTable(LogName);
+  //outputFile->Close();
+  
 
   //Propagation of tracks in the B field
@@ -227,5 +233,7 @@
             { 
             genMomentum.SetPxPyPzE(particle->Px, particle->Py, particle->Pz, particle->E);
+//cout<<"avant "<<genMomentum.Pt()<<endl;
             TRACP->Propagation(particle,genMomentum);
+//cout<<"apres "<<genMomentum.Pt()<<endl;
             float eta=fabs(genMomentum.Eta());
             switch(pid) {
@@ -234,4 +242,6 @@
               DET->SmearElectron(genMomentum);
 	      electron.push_back(genMomentum);
+  //            cout<<"apres le smearing "<<genMomentum.Pt()<<endl;
+
               elecPID.push_back(particle->PID);
 	      break; // case pE
@@ -267,5 +277,6 @@
 		// back of the input_particles vector
 		input_particles.push_back(fastjet::PseudoJet(genMomentum.Px(),genMomentum.Py(),genMomentum.Pz(), genMomentum.E())); 
-                
+            //   cout<<"on remplie avec "<<pid<<" Pt "<<genMomentum.Pt()<<" Eta "<<genMomentum.Eta()<<" Phi "<<genMomentum.Eta()<<endl;
+  
                 genMomentumCalo.SetPxPyPzE(CaloTower.fourVector.px,CaloTower.fourVector.py,CaloTower.fourVector.pz,CaloTower.fourVector.E);
 		elementCalo = (TRootCalo*) branchCalo->NewEntry();
@@ -300,5 +311,5 @@
 	  
 	} // while
-      
+// cout<<"*************"<<endl;     
       for(unsigned int i=0; i < electron.size(); i++) {
 	if(electron[i].E()!=0 && fabs(electron[i].Eta()) < DET->MAX_TRACKER && electron[i].Pt() > DET->ELEC_pt)
Index: trunk/interface/TriggerUtil.h
===================================================================
--- trunk/interface/TriggerUtil.h	(revision 62)
+++ trunk/interface/TriggerUtil.h	(revision 63)
@@ -12,8 +12,4 @@
 */
 
-/// \file SmearUtil.h
-/// \brief RESOLution class, and some generic definitions
-
-
 #include <vector>
 #include "TLorentzVector.h"
@@ -24,15 +20,74 @@
 using namespace std;
 
-class Trigger
-{
+class TriggerBit {
+
  public:
-  /// Constructor
-  Trigger();
 
-  vector<int> GetCuts(const vector<string> &Sequences);
+  TriggerBit(); 
+  ~TriggerBit() {};
 
-  void getTrigCondition(const std::string& trigger_algorithm);
+  void GetTrigCondition(const std::string& trigger_algorithm);
 
-  void TriggerReader(const string filename="data/trigger.dat");
+  void PrintTrigCondition(string LogName,int i);
+
+  bool GetResult() {
+    if(!has_been_evaluated) Evaluate(event_i);
+    return Result;
+  };
+
+ private:
+  bool Evaluate(int event_i); // <- Ã  la fin, mettre has_been_evaluated=true;
+
+  vector<float> GetCuts(const vector<string> &Sequences);
+  vector<float> ElecValues;
+  vector<float> MuonValues;
+  vector<float> JetValues;
+  vector<float> TauJetValues;
+  vector<float> EtmisValues;
+  vector<float> GammaValues;
+  bool Result;
+  int event_i;
+  bool has_been_evaluated;
+};
+
+
+class TriggerTable {
+
+ public:
+
+  TriggerTable(); 
+  ~TriggerTable() {};
+
+  void TriggerCardReader(const string filename="data/trigger.dat");
+  // avant, Ã§a s'appellait TriggerReader
+  // appelle la mÃ©thode TriggerBit::GetTrigCondition
+
+  
+  void PrintTriggerTable(string LogName);
+  // fait un cout des triggers bits, c'est toujours pratique
+  // appelle la mÃ©thode TriggerBit::PriniTrigCondition
+  
+
+  bool GetGlobalResult() {
+    if (! has_been_evaluated) Evaluate(event_i);
+    return GlobalResult;
+  }
+
+  void WriteResult();
+    // sauve dans le TTree
+    // ce nom est stupide, faut le changer
+  int event_i;
+    
+ private:
+  bool Evaluate( int event_i );
+  // boucle sur list_of_trigger_bits, comme on a dit
+  // appelle la methode TriggerBit::Evaluate ou TriggerBit::GetResult (Ã  voir)
+  // renvoie la rÃ©ponse globale du trigger
+  // Ã  la fin, mettre has_been_evaluated = true;
+  // voir le NB ci-dessous
+  
+  vector<TriggerBit> list_of_trigger_bits;
+  bool has_been_evaluated;
+  bool GlobalResult;
 
 };
Index: trunk/src/TriggerUtil.cc
===================================================================
--- trunk/src/TriggerUtil.cc	(revision 62)
+++ trunk/src/TriggerUtil.cc	(revision 63)
@@ -22,9 +22,140 @@
 using namespace std;
 
-Trigger::Trigger() {}
+TriggerTable::TriggerTable() {
+  has_been_evaluated=false;
+}
 
-vector<int> Trigger::GetCuts(const vector<string> &Sequences)
+void TriggerTable::TriggerCardReader(const string filename){
+   ifstream trigger_file(filename.c_str());
+   if( !trigger_file.good() ) {
+	cout << "ERROR: Trigger input file "<< filename << " not found. Exiting.\n";
+	return;
+   }
+
+   TriggerBit mybit;
+   string temp_string, temp_string_no_comment, trigger_name, trigger_algorithm;
+   while ( getline(trigger_file,temp_string) ) {
+	string temp_string_no_comment = temp_string.substr(0,temp_string.find("#")); //remove comments
+	if(temp_string_no_comment.size()<2) continue;  // avoid empty lines
+ 	istringstream temp_stream(temp_string_no_comment);
+
+	temp_stream >> trigger_name;
+	trigger_algorithm = temp_string_no_comment.substr( temp_string_no_comment.find(">>")+2) ;
+
+        mybit.TriggerBit::GetTrigCondition(trigger_algorithm);
+        list_of_trigger_bits.push_back(mybit);
+   }
+}
+
+
+void TriggerTable::PrintTriggerTable(string LogName) {
+
+  ofstream f_out(LogName.c_str(),ios::app);
+  f_out<<"*                                                                    *"<<"\n";
+  f_out<<"#***********************************************                     *"<<"\n";
+  f_out<<"# Trigger conditions defined in the trigger card                     *"<<"\n";
+  f_out<<"#***********************************************                     *"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+
+  f_out.close();
+ 
+  for(unsigned int i=0; i < list_of_trigger_bits.size(); i++) {
+  list_of_trigger_bits[i].PrintTrigCondition(LogName,i+1);
+ }
+}
+
+//*************************************************************************
+
+TriggerBit::TriggerBit() {
+ has_been_evaluated=false;
+}
+
+void TriggerBit::GetTrigCondition(const string& trigger_algorithm) {
+
+  vector<string> ElecSequences;
+  vector<string> MuonSequences;
+  vector<string> JetSequences;
+  vector<string> TauJetSequences;
+  vector<string> EtmisSequences;
+  vector<string> GammaSequences;
+
+  char *result = NULL;
+  result = strtok( (char*) trigger_algorithm.c_str(),"&");
+  while( result != NULL )
+     {
+       if(strstr (result,"ELEC"))ElecSequences.push_back(result);
+       if(strstr (result,"MUON"))MuonSequences.push_back(result);
+       if(strstr (result,"JET"))JetSequences.push_back(result);
+       if(strstr (result,"TAUJET"))TauJetSequences.push_back(result);
+       if(strstr (result,"ETMIS"))EtmisSequences.push_back(result);
+       if(strstr (result,"GAMMA"))GammaSequences.push_back(result);
+       result = strtok( NULL,"&");
+     }
+
+  ElecValues = GetCuts(ElecSequences);
+  MuonValues = GetCuts(MuonSequences);
+  JetValues = GetCuts(JetSequences);
+  TauJetValues = GetCuts(TauJetSequences);
+  EtmisValues = GetCuts(EtmisSequences);
+  GammaValues = GetCuts(GammaSequences);
+
+}
+void TriggerBit::PrintTrigCondition(string LogName,int i) 
 {
-  vector<int> OrderedValue;
+  int elec_size = TriggerBit::ElecValues.size();
+  int muon_size = TriggerBit::MuonValues.size();
+  int jet_size = TriggerBit::JetValues.size();
+  int taujet_size = TriggerBit::TauJetValues.size();
+  int gamma_size = TriggerBit::GammaValues.size();
+  int etmis_size = TriggerBit::EtmisValues.size();
+  
+  ofstream f_out(LogName.c_str(),ios::app);
+
+  f_out <<"*                                                                    *"<<"\n";
+  f_out << left << setw(25) <<"# Trigger bit number "<<""
+        << left << setw(35) <<i       <<""<< right << setw(10)<<"*"<<"\n";
+  f_out <<"#*************************"<<"\n";
+  f_out << left << setw(45) <<"*   # Number of reconstructed objects required:"<<""<<right << setw(23)<<"*"<<"\n";
+  f_out << left << setw(1) <<"*"
+        << internal << setw(10) << "Electron"<< ""<< internal << setw(10) << "Muon"    << ""
+        << internal << setw(10) << "Jets"    << ""<< internal << setw(10) << "Tau-jets "<< ""
+        << internal << setw(10) << "Photons" << ""<< internal << setw(10) << "ETmis "<< ""<< right    << setw(9)  <<"*"<<"\n";
+  f_out << left << setw(1) <<"*"
+        << internal << setw(10) << elec_size << ""<< internal << setw(10) << muon_size << ""
+        << internal << setw(10) << jet_size  << ""<< internal << setw(10) << taujet_size << ""
+        << internal << setw(10) << gamma_size<< ""<< internal << setw(10) << etmis_size << ""<< right << setw(9)<<"*"<<"\n";
+  f_out << left << setw(45) <<"*   # Values of the related thresholds: "<<""<<right << setw(25)<<"*"<<"\n";
+  if(elec_size!=0){
+  f_out << left << setw(20) <<"*    - Electrons: "<<"";
+  for(int i=0;i<elec_size;i++){f_out << left << setw(5) << TriggerBit::ElecValues[i]<<"";}f_out <<"\n";}
+
+  if(muon_size!=0){
+  f_out << left << setw(20) <<"*    - Muons: "<<"";
+  for(int i=0;i<muon_size;i++){f_out << left << setw(5) << TriggerBit::MuonValues[i]<<"";}f_out <<"\n";}
+
+  if(jet_size!=0){
+  f_out << left << setw(20) <<"*    - Jets: "<<"";
+  for(int i=0;i<jet_size;i++){f_out << left << setw(5) << TriggerBit::JetValues[i]<<"";}f_out <<"\n";}
+
+  if(taujet_size!=0){
+  f_out << left << setw(20) <<"*    - Tau-jets: "<<"";
+  for(int i=0;i<taujet_size;i++){f_out << left << setw(5) << TriggerBit::TauJetValues[i]<<"";}f_out <<"\n";}
+ 
+  if(gamma_size!=0){
+  f_out << left << setw(20) <<"*    - Photons: "<<"";
+  for(int i=0;i<gamma_size;i++){f_out << left << setw(5) << TriggerBit::GammaValues[i]<<"";}f_out <<"\n";}
+ 
+  if(etmis_size!=0){
+  f_out << left << setw(20) <<"*    - ETMIS: "<<"";
+  for(int i=0;i<etmis_size;i++){f_out << left << setw(5) << TriggerBit::EtmisValues[i]<<"";}f_out <<"\n";}
+  f_out <<"*                                                                    *"<<"\n";
+
+
+
+}
+
+vector<float> TriggerBit::GetCuts(const vector<string> &Sequences)
+{
+  vector<float> OrderedValue;
   string ptVal;
   Int_t PtVal=0;
@@ -38,53 +169,3 @@
 }
 
-void Trigger::getTrigCondition(const string& trigger_algorithm) {
-  
-  vector<string> ElecSequences;
-  vector<string> MuonSequences;
-  vector<string> JetSequences;
-  vector<string> TauJetSequences;
-  vector<string> EtmisSequences;
-  vector<string> GammaSequences;
-  
-  char *result = NULL;
-  result = strtok( (char*) trigger_algorithm.c_str(),"&");
-  while( result != NULL ) 
-     {
-       if(strstr (result,"ELEC"))ElecSequences.push_back(result);
-       if(strstr (result,"MUON"))MuonSequences.push_back(result);
-       if(strstr (result,"JET"))JetSequences.push_back(result);
-       if(strstr (result,"TAUJET"))TauJetSequences.push_back(result);
-       if(strstr (result,"ETMIS"))EtmisSequences.push_back(result);
-       if(strstr (result,"GAMMA"))GammaSequences.push_back(result);
-       result = strtok( NULL,"&");
-     }    
-  
-  vector<int> ElecValues = GetCuts(ElecSequences);
-  vector<int> MuonValues = GetCuts(MuonSequences);
-  vector<int> JetValues = GetCuts(JetSequences);
-  vector<int> TauJetValues = GetCuts(TauJetSequences);
-  vector<int> EtmisValues = GetCuts(EtmisSequences);
-  vector<int> GammaValues = GetCuts(GammaSequences);
 
-}
-
-void Trigger::TriggerReader(const string filename) {
-   ifstream trigger_file(filename.c_str());
-   if( !trigger_file.good() ) {
-	cout << "ERROR: Trigger input file "<< filename << " not found. Exiting.\n";
-	return;
-   }
-
-   string temp_string, temp_string_no_comment, trigger_name, trigger_algorithm;
-   while ( getline(trigger_file,temp_string) ) {
-	string temp_string_no_comment = temp_string.substr(0,temp_string.find("#")); //remove comments
-	if(temp_string_no_comment.size()<2) continue;  // avoid empty lines
- 	istringstream temp_stream(temp_string_no_comment);
-
-	temp_stream >> trigger_name;
-	trigger_algorithm = temp_string_no_comment.substr( temp_string_no_comment.find(">>")+2) ;
-
-        getTrigCondition(trigger_algorithm);
-   }
-}
-
