Index: trunk/src/SmearUtil.cc
===================================================================
--- trunk/src/SmearUtil.cc	(revision 82)
+++ trunk/src/SmearUtil.cc	(revision 94)
@@ -29,98 +29,120 @@
 RESOLution::RESOLution() {
 
-MAX_TRACKER  = 	2.5;  // tracker coverage
-MAX_CALO_CEN =  3.0;  // central calorimeter coverage
-MAX_CALO_FWD =  5.0;  // forward calorimeter pseudorapidity coverage
-MAX_MU       =  2.4;  // muon chambers pseudorapidity coverage
-MIN_CALO_VFWD=  5.2;  // very forward calorimeter (if any), like CASTOR
-MAX_CALO_VFWD=  6.6;  // very forward calorimeter (if any), like CASTOR
-MIN_ZDC      =  8.3;  // zero-degree calorimeter, coverage
-
-ZDC_S	     =  140.; // ZDC  distance to IP
-RP220_S      =  220;  // distance of the RP to the IP, in meters
-RP220_X      =  0.002;// distance of the RP to the beam, in meters
-FP420_S      =  420;  // distance of the RP to the IP, in meters
-FP420_X      =  0.004;// distance of the RP to the beam, in meters
-
-TRACKING_RADIUS  = 129;                   //radius of the BField coverage
-TRACKING_LENGTH  = 300;                   //length of the BField coverage
-BFIELD_X         = 0.0;
-BFIELD_Y         = 0.0;
-BFIELD_Z         = 3.8;
-
-ELG_Scen =        0.05;                  // S term for central ECAL
-ELG_Ncen =        0.25 ;                 // N term for central ECAL
-ELG_Ccen =        0.0055 ;                // C term for central ECAL
-ELG_Cfwd =        0.107 ;                 // S term for forward ECAL
-ELG_Sfwd =        2.084 ;                 // C term for forward ECAL
-ELG_Nfwd =        0.0   ;                 // N term for central ECAL
-
-HAD_Shcal =       1.5 ;                    // S term for central HCAL // hadronic calorimeter
-HAD_Nhcal  =      0.0   ;                    // N term for central HCAL
-HAD_Chcal  =      0.05 ;                   // C term for central HCAL
-HAD_Shf  =        2.7  ;                    // S term for central HF // forward calorimeter
-HAD_Nhf  =        0.0   ;                    // N term for central HF
-HAD_Chf  =        0.13 ;                    // C term for central HF
-
-MU_SmearPt =      0.01 ;
-
-ELEC_pt =         10.0;
-MUON_pt =         10.0;
-JET_pt =          20.0;
-GAMMA_pt =        10.0;
-TAUJET_pt =       10.0;
-
-
-TAU_CONE_ENERGY = 0.15  ;                  // Delta R = radius of the cone // for "electromagnetic collimation"
-TAU_EM_COLLIMATION = 0.95;
-TAU_CONE_TRACKS=  0.4  ;                   //Delta R for tracker isolation for tau's
-PT_TRACK_TAU =    2.0  ;                   // GeV // 6 GeV ????
-
-
-PT_TRACKS_MIN =   0.9  ;                   // minimal pt needed to reach the calorimeter, in GeV
-PT_QUARKS_MIN =   2.0  ;                   // minimal pt needed by quarks to reach the tracker, in GeV (??????)
-TRACKING_EFF  =   90;
-
-
-TAGGING_B    =    40;
-MISTAGGING_C =    10;
-MISTAGGING_L =    1;
-
-//Trigger flag
-DOTRIGGER    =     1;
-
-CONERADIUS   = 0.7; 	// generic jet radius ; not for tau's !!!
-JETALGO      =   1;     // 1 for Cone algorithm, 2 for MidPoint algorithm, 3 for SIScone algorithm, 4 for kt algorithm
-
-//General jet parameters
-SEEDTHRESHOLD     = 1.0;
-OVERLAPTHRESHOLD = 0.75;
-
-// Define Cone algorithm.
-C_ADJACENCYCUT     = 2;
-C_MAXITERATIONS    = 100;
-C_IRATCH           = 1;
-
-//Define MidPoint algorithm.
-M_CONEAREAFRACTION  =   0.25;
-M_MAXPAIRSIZE       =   2;
-M_MAXITERATIONS     =   100;
-
-// Define Calorimeter Towers
-NTOWERS	= 40;
-
-const float tower_eta_edges[41] = { 
+  // Detector characteristics
+  CEN_max_tracker   = 2.5;                // Maximum tracker coverage          
+  CEN_max_calo_cen  = 3.0;                // central calorimeter coverage
+  CEN_max_calo_fwd  = 5.0;                // forward calorimeter pseudorapidity coverage
+  CEN_max_mu        = 2.4;                // muon chambers pseudorapidity coverage
+  
+  // Energy resolution for electron/photon
+  // \sigma/E = C + N/E + S/\sqrt{E}
+  ELG_Scen          = 0.05;              // S term for central ECAL
+  ELG_Ncen          = 0.25;              // N term for central ECAL
+  ELG_Ccen          = 0.005;             // C term for central ECAL
+  ELG_Cfwd          = 0.107;             // S term for forward ECAL
+  ELG_Sfwd          = 2.084;             // C term for forward ECAL
+  ELG_Nfwd          = 0.0;               // N term for central ECAL
+
+  // Energy resolution for hadrons in ecal/hcal/hf
+  // \sigma/E = C + N/E + S/\sqrt{E}
+  HAD_Shcal         = 1.5;               // S term for central HCAL // hadronic calorimeter
+  HAD_Nhcal         = 0.;                // N term for central HCAL
+  HAD_Chcal         = 0.05;              // C term for central HCAL
+  HAD_Shf           = 2.7;               // S term for HF // forward calorimeter
+  HAD_Nhf           = 0.;                // N term for HF
+  HAD_Chf           = 0.13;              // C term for HF
+
+  // Muon smearing
+  MU_SmearPt        = 0.01;
+
+  // Tracking efficiencies
+  TRACK_ptmin       = 0.9;               // minimal pt needed to reach the calorimeter in GeV
+  TRACK_eff         = 100;               // efficiency associated to the tracking
+
+  // Calorimetric towers
+  TOWER_number      = 40;
+  const float tower_eta_edges[41] = { 
     0., 0.087, 0.174, 0.261, 0.348, 0.435, 0.522, 0.609, 0.696, 0.783, 0.870, 0.957, 1.044, 1.131, 1.218, 1.305, 1.392, 1.479, 1.566,
     1.653, 1.740, 1.830, 1.930, 2.043, 2.172, 2.322, 2.500, 2.650, 2.868, 2.950, 3.125, 3.300, 3.475, 3.650, 3.825, 4.000, 4.175,
     4.350, 4.525,  4.700, 5.000}; // temporary object
-TOWER_ETA_EDGES = new float[NTOWERS+1];
-for(unsigned int i=0; i<NTOWERS+1; i++) TOWER_ETA_EDGES[i] = tower_eta_edges[i];
-
-const float tower_dphi[40] = { 
-     5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  5, 5, 5, 5, 10,
+  TOWER_eta_edges = new float[TOWER_number+1];
+  for(unsigned int i=0; i<TOWER_number +1; i++) TOWER_eta_edges[i] = tower_eta_edges[i];
+  
+  const float tower_dphi[40] = { 
+    5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  5, 5, 5, 5, 5,  5, 5, 5, 5, 10,
     10,10,10,10,10, 10,10,10,10,10, 10,10,10,10,10, 10,10,10,20, 20 }; // temporary object
-TOWER_DPHI = new float[NTOWERS];
-for(unsigned int i=0; i<NTOWERS; i++) TOWER_DPHI[i] = tower_dphi[i];
-
+  TOWER_dphi = new float[TOWER_number];
+  for(unsigned int i=0; i<TOWER_number; i++) TOWER_dphi[i] = tower_dphi[i];
+
+
+  // Thresholds for reconstructed objetcs
+  PTCUT_elec      = 10.0;
+  PTCUT_muon      = 10.0;
+  PTCUT_jet       = 20.0;
+  PTCUT_gamma     = 10.0;
+  PTCUT_taujet    = 10.0;
+
+  // General jet variable
+  JET_coneradius   = 0.7;	     // generic jet radius ; not for tau's !!!
+  JET_jetalgo      = 1;              // 1 for Cone algorithm, 2 for MidPoint algorithm, 3 for SIScone algorithm, 4 for kt algorithm
+  JET_seed         = 1.0;            // minimum seed to start jet reconstruction
+
+  // Tagging definition
+  BTAG_b           = 40;
+  BTAG_mistag_c    = 10;
+  BTAG_mistag_l    = 1;
+
+  // FLAGS
+  FLAG_bfield      = 1;                       //1 to run the bfield propagation else 0
+  FLAG_vfd         = 1;                       //1 to run the very forward detectors else 0
+  FLAG_trigger     = 1;                       //1 to run the trigger selection else 0
+  FLAG_frog        = 1;                       //1 to run the FROG event display
+
+  // In case BField propagation allowed
+  TRACK_radius      = 129;                   //radius of the BField coverage
+  TRACK_length      = 300;                   //length of the BField coverage
+  TRACK_bfield_x    = 0;                     //X composant of the BField
+  TRACK_bfield_y    = 0;                     //Y composant of the BField
+  TRACK_bfield_z    = 3.8;                   //Z composant of the BField
+
+  // In case Very forward detectors allowed
+  VFD_min_calo_vfd  = 5.2;                   // very forward calorimeter (if any) like CASTOR
+  VFD_max_calo_vfd  = 6.6;
+  VFD_min_zdc       = 8.3;
+  VFD_s_zdc         = 140;                   // distance of the Zero Degree Calorimeter, from the Interaction poin, in [m]
+
+  RP_220_s          = 220;                   // distance of the RP to the IP, in meters
+  RP_220_x          = 0.002;                 // distance of the RP to the beam, in meters
+  RP_420_s          = 420;                   // distance of the RP to the IP, in meters
+  RP_420_x          = 0.004;                 // distance of the RP to the beam, in meters
+
+  // In case FROG event display allowed
+  NEvents_Frog      = 10;
+
+  //********************************************
+  //jet stuffs not defined in the input datacard
+  //********************************************
+  
+  JET_overlap     = 0.75;
+  // MidPoint algorithm definition
+  JET_M_coneareafraction = 0.25;
+  JET_M_maxpairsize      = 2;
+  JET_M_maxiterations    = 100;
+  // Define Cone algorithm.
+  JET_C_adjacencycut  =  2;
+  JET_C_maxiterations = 100;
+  JET_C_iratch        =  1;
+  //Define SISCone algorithm.
+  JET_S_npass         = 0;
+  JET_S_protojet_ptmin= 0.0;
+  
+  //For Tau-jet definition
+  TAU_energy_scone = 0.15;  // radius R of the cone for tau definition, based on energy threshold
+  TAU_track_scone  = 0.4;   // radius R of the cone for tau definition, based on track number
+  TAU_track_pt     = 2;     // minimal pt [GeV] for tracks to be considered in tau definition
+  TAU_energy_frac  = 0.95;  // fraction of energy required in the central part of the cone, for tau jets
+  
+  PT_QUARKS_MIN =   2.0  ;                   // minimal pt needed by quarks to do b-tag
+  
 }
 
@@ -133,8 +155,8 @@
   ifstream fichier_a_lire(datacard.c_str());
   if(!fichier_a_lire.good()) {
-	cout << datacard << "Datadard " << datacard << " not found, use default values" << endl;
-	return;
-  }
-
+    cout << datacard << "Datadard " << datacard << " not found, use default values" << endl;
+    return;
+  }
+  
   while (getline(fichier_a_lire,temp_string)) {
     curstring.clear(); // needed when using several times istringstream::str(string)
@@ -144,75 +166,93 @@
     
     if(strstr(temp_string.c_str(),"#")) { }
-    else if(strstr(temp_string.c_str(),"MAX_TRACKER")){curstring >> varname >> value; MAX_TRACKER = value;}
-    else if(strstr(temp_string.c_str(),"MAX_CALO_CEN")){curstring >> varname >> value; MAX_CALO_CEN = value;}
-    else if(strstr(temp_string.c_str(),"MAX_CALO_FWD")){curstring >> varname >> value; MAX_CALO_FWD = value;}
-    else if(strstr(temp_string.c_str(),"MAX_MU")){curstring >> varname >> value; MAX_MU = value;}
-    else if(strstr(temp_string.c_str(),"TRACKING_RADIUS")){curstring >> varname >> ivalue; TRACKING_RADIUS = ivalue;}
-    else if(strstr(temp_string.c_str(),"TRACKING_LENGTH")){curstring >> varname >> ivalue; TRACKING_LENGTH = ivalue;}
-    else if(strstr(temp_string.c_str(),"BFIELD_X")){curstring >> varname >> value; BFIELD_X = value;}
-    else if(strstr(temp_string.c_str(),"BFIELD_Y")){curstring >> varname >> value; BFIELD_Y = value;}
-    else if(strstr(temp_string.c_str(),"BFIELD_Z")){curstring >> varname >> value; BFIELD_Z = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Scen")){curstring >> varname >> value; ELG_Scen = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Ncen")){curstring >> varname >> value; ELG_Ncen = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Ccen")){curstring >> varname >> value; ELG_Ccen = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Sfwd")){curstring >> varname >> value; ELG_Sfwd = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Cfwd")){curstring >> varname >> value; ELG_Cfwd = value;}
-    else if(strstr(temp_string.c_str(),"ELG_Nfwd")){curstring >> varname >> value; ELG_Nfwd = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Shcal")){curstring >> varname >> value; HAD_Shcal = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Nhcal")){curstring >> varname >> value; HAD_Nhcal = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Chcal")){curstring >> varname >> value; HAD_Chcal = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Shf")){curstring >> varname >> value; HAD_Shf = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Nhf")){curstring >> varname >> value; HAD_Nhf = value;}
-    else if(strstr(temp_string.c_str(),"HAD_Chf")){curstring >> varname >> value; HAD_Chf = value;}
-    else if(strstr(temp_string.c_str(),"MU_SmearPt")){curstring >> varname >> value; MU_SmearPt = value;}
-    else if(strstr(temp_string.c_str(),"TAU_CONE_ENERGY")){curstring >> varname >> value; TAU_CONE_ENERGY = value;}
-    else if(strstr(temp_string.c_str(),"TAU_CONE_TRACKS")){curstring >> varname >> value; TAU_CONE_TRACKS = value;}
-    else if(strstr(temp_string.c_str(),"PT_TRACK_TAU")){curstring >> varname >> value; PT_TRACK_TAU = value;}
-    else if(strstr(temp_string.c_str(),"PT_TRACKS_MIN")){curstring >> varname >> value; PT_TRACKS_MIN = value;}
-    else if(strstr(temp_string.c_str(),"TAGGING_B")){curstring >> varname >> ivalue; TAGGING_B = ivalue;}
-    else if(strstr(temp_string.c_str(),"MISTAGGING_C")){curstring >> varname >> ivalue; MISTAGGING_C = ivalue;}
-    else if(strstr(temp_string.c_str(),"MISTAGGING_L")){curstring >> varname >> ivalue; MISTAGGING_L = ivalue;}
-    else if(strstr(temp_string.c_str(),"CONERADIUS")){curstring >> varname >> value; CONERADIUS = value;}
-    else if(strstr(temp_string.c_str(),"JETALGO")){curstring >> varname >> ivalue; JETALGO = ivalue;}
-    else if(strstr(temp_string.c_str(),"TRACKING_EFF")){curstring >> varname >> ivalue; TRACKING_EFF = ivalue;}
-    else if(strstr(temp_string.c_str(),"ELEC_pt")){curstring >> varname >> value; ELEC_pt = value;}
-    else if(strstr(temp_string.c_str(),"MUON_pt")){curstring >> varname >> value; MUON_pt = value;}
-    else if(strstr(temp_string.c_str(),"JET_pt")){curstring >> varname >> value; JET_pt = value;}
-    else if(strstr(temp_string.c_str(),"GAMMA_pt")){curstring >> varname >> value; GAMMA_pt = value;}
-    else if(strstr(temp_string.c_str(),"TAUJET_pt")){curstring >> varname >> value; TAUJET_pt = value;}
-    else if(strstr(temp_string.c_str(),"NTOWERS")){curstring >> varname >> ivalue; NTOWERS = ivalue;}
-    else if(strstr(temp_string.c_str(),"DOTRIGGER")){curstring >> varname >> ivalue; DOTRIGGER = ivalue;}
-    else if(strstr(temp_string.c_str(),"TOWER_ETA_EDGES")){
-	curstring >> varname;	for(unsigned int i=0; i<NTOWERS+1; i++) {curstring >> value; TOWER_ETA_EDGES[i] = value;} }
-    else if(strstr(temp_string.c_str(),"TOWER_DPHI")){
-	curstring >> varname;	for(unsigned int i=0; i<NTOWERS; i++) {curstring >> value; TOWER_DPHI[i] = value;} }
-   
-
-  }
-
-// General jet variables
- SEEDTHRESHOLD     = 1.0;
- OVERLAPTHRESHOLD = 0.75;
-
-// Define Cone algorithm.
- C_ADJACENCYCUT     = 2;
- C_MAXITERATIONS    = 100;
- C_IRATCH           = 1;
-
-//Define MidPoint algorithm.
- M_CONEAREAFRACTION  =   0.25;
- M_MAXPAIRSIZE       =   2;
- M_MAXITERATIONS     =   100;
-
-//Define SISCone algorithm.
- NPASS = 0;               
- PROTOJET_PTMIN = 0.0; 
-
-
+    else if(strstr(temp_string.c_str(),"CEN_max_tracker"))  {curstring >> varname >> value; CEN_max_tracker   = value;}
+    else if(strstr(temp_string.c_str(),"CEN_max_calo_cen")) {curstring >> varname >> value; CEN_max_calo_cen  = value;}
+    else if(strstr(temp_string.c_str(),"CEN_max_calo_fwd")) {curstring >> varname >> value; CEN_max_calo_fwd  = value;}
+    else if(strstr(temp_string.c_str(),"CEN_max_mu"))       {curstring >> varname >> value; CEN_max_mu        = value;}
+    
+    else if(strstr(temp_string.c_str(),"VFD_min_calo_vfd")) {curstring >> varname >> value; VFD_min_calo_vfd  = value;}
+    else if(strstr(temp_string.c_str(),"VFD_max_calo_vfd")) {curstring >> varname >> value; VFD_max_calo_vfd  = value;}
+    else if(strstr(temp_string.c_str(),"VFD_min_zdc"))      {curstring >> varname >> value; VFD_min_zdc       = value;}
+    else if(strstr(temp_string.c_str(),"VFD_s_zdc"))        {curstring >> varname >> value; VFD_s_zdc         = value;}
+    
+    else if(strstr(temp_string.c_str(),"RP_220_s"))         {curstring >> varname >> value; RP_220_s          = value;}
+    else if(strstr(temp_string.c_str(),"RP_220_x"))         {curstring >> varname >> value; RP_220_x          = value;}
+    else if(strstr(temp_string.c_str(),"RP_420_s"))         {curstring >> varname >> value; RP_420_s          = value;}
+    else if(strstr(temp_string.c_str(),"RP_420_x"))         {curstring >> varname >> value; RP_420_x          = value;}
+    
+    else if(strstr(temp_string.c_str(),"ELG_Scen"))         {curstring >> varname >> value; ELG_Scen          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Ncen"))         {curstring >> varname >> value; ELG_Ncen          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Ccen"))         {curstring >> varname >> value; ELG_Ccen          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Sfwd"))         {curstring >> varname >> value; ELG_Sfwd          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Cfwd"))         {curstring >> varname >> value; ELG_Cfwd          = value;}
+    else if(strstr(temp_string.c_str(),"ELG_Nfwd"))         {curstring >> varname >> value; ELG_Nfwd          = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Shcal"))        {curstring >> varname >> value; HAD_Shcal         = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nhcal"))        {curstring >> varname >> value; HAD_Nhcal         = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Chcal"))        {curstring >> varname >> value; HAD_Chcal         = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Shf"))          {curstring >> varname >> value; HAD_Shf           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Nhf"))          {curstring >> varname >> value; HAD_Nhf           = value;}
+    else if(strstr(temp_string.c_str(),"HAD_Chf"))          {curstring >> varname >> value; HAD_Chf           = value;}
+    else if(strstr(temp_string.c_str(),"MU_SmearPt"))       {curstring >> varname >> value; MU_SmearPt        = value;}
+    
+    else if(strstr(temp_string.c_str(),"TRACK_radius"))     {curstring >> varname >> ivalue;TRACK_radius      = ivalue;}
+    else if(strstr(temp_string.c_str(),"TRACK_length"))     {curstring >> varname >> ivalue;TRACK_length      = ivalue;}
+    else if(strstr(temp_string.c_str(),"TRACK_bfield_x"))   {curstring >> varname >> value; TRACK_bfield_x    = value;}
+    else if(strstr(temp_string.c_str(),"TRACK_bfield_y"))   {curstring >> varname >> value; TRACK_bfield_y    = value;}
+    else if(strstr(temp_string.c_str(),"TRACK_bfield_z"))   {curstring >> varname >> value; TRACK_bfield_z    = value;}
+    else if(strstr(temp_string.c_str(),"FLAG_bfield"))      {curstring >> varname >> ivalue; FLAG_bfield      = ivalue;}
+    else if(strstr(temp_string.c_str(),"TRACK_ptmin"))      {curstring >> varname >> value; TRACK_ptmin       = value;}
+    else if(strstr(temp_string.c_str(),"TRACK_eff"))        {curstring >> varname >> ivalue;TRACK_eff         = ivalue;}
+
+    else if(strstr(temp_string.c_str(),"TOWER_number"))     {curstring >> varname >> ivalue;TOWER_number      = ivalue;}
+    else if(strstr(temp_string.c_str(),"TOWER_eta_edges")){
+	curstring >> varname;	for(unsigned int i=0; i<TOWER_number+1; i++) {curstring >> value; TOWER_eta_edges[i] = value;} }
+    else if(strstr(temp_string.c_str(),"TOWER_dphi")){
+	curstring >> varname;	for(unsigned int i=0; i<TOWER_number; i++)   {curstring >> value; TOWER_dphi[i] = value;} }
+
+    else if(strstr(temp_string.c_str(),"PTCUT_elec"))       {curstring >> varname >> value; PTCUT_elec        = value;}
+    else if(strstr(temp_string.c_str(),"PTCUT_muon"))       {curstring >> varname >> value; PTCUT_muon        = value;}
+    else if(strstr(temp_string.c_str(),"PTCUT_jet"))        {curstring >> varname >> value; PTCUT_jet         = value;}
+    else if(strstr(temp_string.c_str(),"PTCUT_gamma"))      {curstring >> varname >> value; PTCUT_gamma       = value;}
+    else if(strstr(temp_string.c_str(),"PTCUT_taujet"))     {curstring >> varname >> value; PTCUT_taujet      = value;}
+
+    else if(strstr(temp_string.c_str(),"JET_coneradius"))   {curstring >> varname >> value; JET_coneradius    = value;}
+    else if(strstr(temp_string.c_str(),"JET_jetalgo"))      {curstring >> varname >> ivalue;JET_jetalgo       = ivalue;}
+    else if(strstr(temp_string.c_str(),"JET_seed"))         {curstring >> varname >> value; JET_seed          = value;}
+ 
+    else if(strstr(temp_string.c_str(),"BTAG_b"))           {curstring >> varname >> ivalue;BTAG_b            = ivalue;}
+    else if(strstr(temp_string.c_str(),"BTAG_mistag_c"))    {curstring >> varname >> ivalue;BTAG_mistag_c     = ivalue;}
+    else if(strstr(temp_string.c_str(),"BTAG_mistag_l"))    {curstring >> varname >> ivalue;BTAG_mistag_l     = ivalue;}
+
+    else if(strstr(temp_string.c_str(),"FLAG_vfd"))         {curstring >> varname >> ivalue; FLAG_vfd         = ivalue;}
+    else if(strstr(temp_string.c_str(),"FLAG_trigger"))     {curstring >> varname >> ivalue; FLAG_trigger     = ivalue;}
+    else if(strstr(temp_string.c_str(),"FLAG_frog"))        {curstring >> varname >> ivalue; FLAG_frog        = ivalue;}
+    else if(strstr(temp_string.c_str(),"NEvents_Frog"))     {curstring >> varname >> ivalue; NEvents_Frog     = ivalue;}
+  }
+  
+  //jet stuffs not defined in the input datacard
+  JET_overlap     = 0.75;
+  // MidPoint algorithm definition
+  JET_M_coneareafraction = 0.25;
+  JET_M_maxpairsize      = 2;
+  JET_M_maxiterations    = 100;
+  // Define Cone algorithm.
+  JET_C_adjacencycut  =  2;
+  JET_C_maxiterations = 100;
+  JET_C_iratch        =  1;
+  //Define SISCone algorithm.
+  JET_S_npass         = 0;
+  JET_S_protojet_ptmin= 0.0;
+  
+  //For Tau-jet definition
+  TAU_energy_scone = 0.15;  // radius R of the cone for tau definition, based on energy threshold
+  TAU_track_scone  = 0.4;   // radius R of the cone for tau definition, based on track number
+  TAU_track_pt     = 2;     // minimal pt [GeV] for tracks to be considered in tau definition
+  TAU_energy_frac  = 0.95;  // fraction of energy required in the central part of the cone, for tau jets
+  
 }
 
 void RESOLution::Logfile(string LogName) { 
-//void RESOLution::Logfile(string outputfilename) { 
-
+  //void RESOLution::Logfile(string outputfilename) { 
+  
   ofstream f_out(LogName.c_str());
   
@@ -251,72 +291,41 @@
   f_out<<"*                                                                    *"<<"\n";
   f_out << left << setw(30) <<"* Maximum tracking system:                   "<<""
-	<< left << setw(10) <<MAX_TRACKER   <<""<< right << setw(15)<<"*"<<"\n";
+	<< left << setw(10) <<CEN_max_tracker   <<""<< right << setw(15)<<"*"<<"\n";
   f_out << left << setw(30) <<"* Maximum central calorimeter:               "<<""
-	<< left << setw(10) <<MAX_CALO_CEN  <<""<< right << setw(15)<<"*"<<"\n";
+	<< left << setw(10) <<CEN_max_calo_cen  <<""<< right << setw(15)<<"*"<<"\n";
   f_out << left << setw(30) <<"* Maximum forward calorimeter:               "<<""
-	<< left << setw(10) <<MAX_CALO_FWD  <<""<< right << setw(15)<<"*"<<"\n";
+	<< left << setw(10) <<CEN_max_calo_fwd  <<""<< right << setw(15)<<"*"<<"\n";
   f_out << left << setw(30) <<"* Muon chambers coverage:                    "<<""
-	<< left << setw(10) <<MAX_MU        <<""<< right << setw(15)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#*************************************                               *"<<"\n";
-  f_out<<"# Very forward detector caracteristics                               *"<<"\n";
-  f_out<<"#*************************************                               *"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out << left << setw(55) <<"* Minimum very forward calorimeter:          "<<""
-	<< left << setw(5) <<MIN_CALO_VFWD <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Maximum very forward calorimeter:          "<<""
-	<< left << setw(5) <<MAX_CALO_VFWD <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Distance of the ZDC to the IP, in meters:  "<<""
-	<< left << setw(5) <<ZDC_S         <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters:   "<<""
-	<< left << setw(5) <<RP220_S       <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
-	<< left << setw(5) <<RP220_X       <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters:   "<<""
-	<< left << setw(5) <<FP420_S       <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
-	<< left << setw(5) <<FP420_X       <<""<< right << setw(10)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#***********************************                                 *"<<"\n";
-  f_out<<"# Magnetic field needed informations                                 *"<<"\n";
-  f_out<<"#***********************************                                 *"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out << left << setw(55) <<"* Radius of the BField coverage:              "<<""
-        << left << setw(5) <<TRACKING_RADIUS <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Length of the BField coverage:              "<<""
-        << left << setw(5) <<TRACKING_LENGTH <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* BField X component:                         "<<""
-        << left << setw(5) <<BFIELD_X <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* BField Y component:                         "<<""
-        << left << setw(5) <<BFIELD_Y <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* BField Z component:                         "<<""
-        << left << setw(5) <<BFIELD_Z <<""<< right << setw(10)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-
-
-  f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#********************                                                *"<<"\n";
-  f_out<<"# Calorimetric Towers                                                *"<<"\n";
-  f_out<<"#********************                                                *"<<"\n";
-  f_out << left << setw(55) <<"* Number of calorimetric towers in eta, for eta>0: "<<""
-        << left << setw(5) << NTOWERS <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n";
-	  f_out << "*   ";
-	  for (unsigned int i=0; i<NTOWERS+1; i++) {
-		f_out << left << setw(7) << TOWER_ETA_EDGES[i];
-		if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "*   ";
-	  }
-	  for (unsigned int i=(NTOWERS+1)%9; i<9; i++) f_out << left << setw(7) << "";
-	  f_out << right << setw(3)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Tower sizes in phi, for eta>0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n";
-	  f_out << "*   ";
-	  for (unsigned int i=0; i<NTOWERS; i++) {
-		f_out << left << setw(7) << TOWER_DPHI[i];
-		if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "*   ";
-	  }
-	  for (unsigned int i=(NTOWERS)%9; i<9; i++) f_out << left << setw(7) << "";
-	  f_out << right << setw(3)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-
+	<< left << setw(10) <<CEN_max_mu        <<""<< right << setw(15)<<"*"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  if(FLAG_vfd==1){
+    f_out<<"#**********************************                                  *"<<"\n";
+    f_out<<"# Very forward detector switches on                                  *"<<"\n";
+    f_out<<"#**********************************                                  *"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+    f_out << left << setw(55) <<"* Minimum very forward calorimeter:          "<<""
+	  << left << setw(5) <<VFD_min_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Maximum very forward calorimeter:          "<<""
+	  << left << setw(5) <<VFD_max_calo_vfd <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Minimum coverage zero_degree calorimeter "<<""
+	  << left << setw(5) <<VFD_min_zdc          <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Distance of the ZDC to the IP, in meters:  "<<""
+	  << left << setw(5) <<VFD_s_zdc            <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters:   "<<""
+	  << left << setw(5) <<RP_220_s             <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
+	  << left << setw(5) <<RP_220_x             <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Distance of the RP to the IP, in meters:   "<<""
+	  << left << setw(5) <<RP_420_s             <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Distance of the RP to the beam, in meters: "<<""
+	  << left << setw(5) <<RP_420_x             <<""<< right << setw(10)<<"*"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+  }
+  else {
+    f_out<<"#***********************************                                 *"<<"\n";
+    f_out<<"# Very forward detector switches off                                 *"<<"\n";
+    f_out<<"#***********************************                                 *"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+  }
   f_out<<"#************************************                                *"<<"\n";
   f_out<<"# Electromagnetic smearing parameters                                *"<<"\n";
@@ -354,31 +363,63 @@
 	<< left << setw(30) <<HAD_Chf         <<""<< right << setw(10)<<"*"<<"\n";
   f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#***************************                                         *"<<"\n";
-  f_out<<"# Tracking system acceptance                                         *"<<"\n";
-  f_out<<"#***************************                                         *"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
-	<< left << setw(10) <<PT_TRACKS_MIN         <<""<< right << setw(5)<<"*"<<"\n";
-  f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
-	<< left << setw(10) <<TRACKING_EFF          <<""<< right << setw(5)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
   f_out<<"#*************************                                           *"<<"\n";
   f_out<<"# Muon smearing parameters                                           *"<<"\n";
   f_out<<"#*************************                                           *"<<"\n";
   f_out<<"*                                                                    *"<<"\n";
-  //MU_SmearPt       0.01
-  f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#******************************                                      *"<<"\n";
-  f_out<<"# Tau-jet definition parameters                                      *"<<"\n";
-  f_out<<"#******************************                                      *"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out << left << setw(45) <<"* Cone radius for calorimeter tagging:  "<<""
-	<< left << setw(5) <<TAU_CONE_ENERGY                           <<""<< right << setw(20)<<"*"<<"\n";
-  f_out << left << setw(45) <<"* Fraction of energy in the small cone: "<<""
-        << left << setw(5) <<TAU_EM_COLLIMATION*100                    <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(45) <<"* Cone radius for tracking tagging:     "<<""
-	<< left << setw(5) <<TAU_CONE_TRACKS                           <<""<< right << setw(20)<<"*"<<"\n";
-  f_out << left << setw(45) <<"* Minimum track pT [GeV]:               "<<""
-	<< left << setw(5) <<PT_TRACK_TAU                              <<""<< right << setw(20)<<"*"<<"\n";
+  f_out << left << setw(55) <<"* PT resolution for muons        :              "<<""
+        << left << setw(5) <<MU_SmearPt            <<""<< right << setw(10)<<"*"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  if(FLAG_bfield==1){
+    f_out<<"#***************************                                         *"<<"\n";
+    f_out<<"# Magnetic field switches on                                         *"<<"\n";
+    f_out<<"#***************************                                         *"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+    f_out << left << setw(55) <<"* Radius of the BField coverage:              "<<""
+	  << left << setw(5) <<TRACK_radius    <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Length of the BField coverage:              "<<""
+	  << left << setw(5) <<TRACK_length    <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* BField X component:                         "<<""
+	  << left << setw(5) <<TRACK_bfield_x  <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* BField Y component:                         "<<""
+	  << left << setw(5) <<TRACK_bfield_y  <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* BField Z component:                         "<<""
+	  << left << setw(5) <<TRACK_bfield_z  <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
+	  << left << setw(10) <<TRACK_ptmin         <<""<< right << setw(5)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
+	  << left << setw(10) <<TRACK_eff          <<""<< right << setw(5)<<"*"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+  }
+  else {
+    f_out<<"#****************************                                        *"<<"\n";
+    f_out<<"# Magnetic field switches off                                        *"<<"\n";
+    f_out<<"#****************************                                        *"<<"\n";
+    f_out << left << setw(55) <<"* Minimal pT needed to reach the calorimeter [GeV]: "<<""
+	  << left << setw(10) <<TRACK_ptmin         <<""<< right << setw(5)<<"*"<<"\n";
+    f_out << left << setw(55) <<"* Efficiency associated to the tracking: "<<""
+	  << left << setw(10) <<TRACK_eff          <<""<< right << setw(5)<<"*"<<"\n";
+    f_out<<"*                                                                    *"<<"\n";
+  }
+  f_out<<"#********************                                                *"<<"\n";
+  f_out<<"# Calorimetric Towers                                                *"<<"\n";
+  f_out<<"#********************                                                *"<<"\n";
+  f_out << left << setw(55) <<"* Number of calorimetric towers in eta, for eta>0: "<<""
+        << left << setw(5)  << TOWER_number <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(55) <<"* Tower edges in eta, for eta>0: "<<"" << right << setw(15)<<"*"<<"\n";
+  f_out << "*   ";
+  for (unsigned int i=0; i<TOWER_number+1; i++) {
+    f_out << left << setw(7) << TOWER_eta_edges[i];
+    if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "*   ";
+  }
+  for (unsigned int i=(TOWER_number+1)%9; i<9; i++) f_out << left << setw(7) << "";
+  f_out << right << setw(3)<<"*"<<"\n";
+  f_out << left << setw(55) <<"* Tower sizes in phi, for eta>0 [degree]:"<<"" << right << setw(15)<<"*"<<"\n";
+  f_out << "*   ";
+  for (unsigned int i=0; i<TOWER_number; i++) {
+    f_out << left << setw(7) << TOWER_dphi[i];
+    if(!( (i+1) %9 )) f_out << right << setw(3) << "*" << "\n" << "*   ";
+  }
+  for (unsigned int i=(TOWER_number)%9; i<9; i++) f_out << left << setw(7) << "";
+  f_out << right << setw(3)<<"*"<<"\n";
   f_out<<"*                                                                    *"<<"\n";
   f_out<<"#*******************                                                 *"<<"\n";
@@ -387,24 +428,13 @@
   f_out<<"*                                                                    *"<<"\n";
   f_out << left << setw(40) <<"* Minimum pT for electrons: "<<""
-	<< left << setw(20) <<ELEC_pt         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(20) <<PTCUT_elec         <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(40) <<"* Minimum pT for muons: "<<""
-	<< left << setw(20) <<MUON_pt         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(20) <<PTCUT_muon         <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(40) <<"* Minimum pT for jets: "<<""
-	<< left << setw(20) <<JET_pt         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(20) <<PTCUT_jet          <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(40) <<"* Minimum pT for Tau-jets: "<<""
-	<< left << setw(20) <<TAUJET_pt         <<""<< right << setw(10)<<"*"<<"\n";
+	<< left << setw(20) <<PTCUT_taujet       <<""<< right << setw(10)<<"*"<<"\n";
   f_out << left << setw(40) <<"* Minimum pT for photons: "<<""
-        << left << setw(20) <<GAMMA_pt         <<""<< right << setw(10)<<"*"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out<<"#***************************                                         *"<<"\n";
-  f_out<<"# B-tagging efficiencies [%]                                         *"<<"\n";
-  f_out<<"#***************************                                         *"<<"\n";
-  f_out<<"*                                                                    *"<<"\n";
-  f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<""
-	<< left << setw(10) <<TAGGING_B         <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<""
-	<< left << setw(10) <<MISTAGGING_C         <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<""
-	<< left << setw(10) <<MISTAGGING_L         <<""<< right << setw(10)<<"*"<<"\n";
+        << left << setw(20) <<PTCUT_gamma        <<""<< right << setw(10)<<"*"<<"\n";
   f_out<<"*                                                                    *"<<"\n";
   f_out<<"#***************                                                     *"<<"\n";
@@ -421,75 +451,98 @@
   f_out<<"*                                                                    *"<<"\n";
   f_out<<"* You have chosen                                                    *"<<"\n";
-  switch(JETALGO) {
+  switch(JET_jetalgo) {
   default:
   case 1: {
-  f_out<<"* CDF JetClu jet algorithm with parameters:                          *"<<"\n";
-  f_out << left << setw(40) <<"*        - Seed threshold:    "<<""
-        << left << setw(10) <<SEEDTHRESHOLD                   <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius:       "<<""
-        << left << setw(10) <<CONERADIUS                      <<""<< right << setw(20)<<"*"<<"\n";
-  f_out << left << setw(40) <<"*        - Adjacency cut:     "<<""
-        << left << setw(10) <<C_ADJACENCYCUT                  <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Max iterations:    "<<""
-        << left << setw(10) <<C_MAXITERATIONS                 <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Iratch:            "<<""
-        << left << setw(10) <<C_IRATCH                        <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Overlap threshold: "<<""
-        << left << setw(10) <<OVERLAPTHRESHOLD                <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+    f_out<<"* CDF JetClu jet algorithm with parameters:                          *"<<"\n";
+    f_out << left << setw(40) <<"*        - Seed threshold:    "<<""
+	  << left << setw(10) <<JET_seed                        <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius:       "<<""
+	  << left << setw(10) <<JET_coneradius                  <<""<< right << setw(20)<<"*"<<"\n";
+    f_out << left << setw(40) <<"*        - Adjacency cut:     "<<""
+	  << left << setw(10) <<JET_C_adjacencycut              <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Max iterations:    "<<""
+	  << left << setw(10) <<JET_C_maxiterations             <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Iratch:            "<<""
+	  << left << setw(10) <<JET_C_iratch                    <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Overlap threshold: "<<""
+	  << left << setw(10) <<JET_overlap                     <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
   }
     break;
   case 2: {
-  f_out<<"* CDF midpoint jet algorithm with parameters:                        *"<<"\n";
-  f_out << left << setw(40) <<"*        - Seed threshold:    "<<""
-        << left << setw(20) <<SEEDTHRESHOLD                   <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius:       "<<""
-        << left << setw(20) <<CONERADIUS                      <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone area fraction:"<<""
-        << left << setw(20) <<M_CONEAREAFRACTION              <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Maximum pair size: "<<""
-        << left << setw(20) <<M_MAXPAIRSIZE                   <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Max iterations:    "<<""
-        << left << setw(20) <<M_MAXITERATIONS                 <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Overlap threshold: "<<""
-        << left << setw(20) <<OVERLAPTHRESHOLD                <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out<<"* CDF midpoint jet algorithm with parameters:                        *"<<"\n";
+    f_out << left << setw(40) <<"*        - Seed threshold:    "<<""
+	  << left << setw(20) <<JET_seed                        <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius:       "<<""
+	  << left << setw(20) <<JET_coneradius                  <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone area fraction:"<<""
+	  << left << setw(20) <<JET_M_coneareafraction          <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Maximum pair size: "<<""
+	  << left << setw(20) <<JET_M_maxpairsize               <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Max iterations:    "<<""
+	  << left << setw(20) <<JET_M_maxiterations             <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Overlap threshold: "<<""
+	  << left << setw(20) <<JET_overlap                     <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
   }
     break;
   case 3: {
-  f_out <<"* SISCone jet algorithm with parameters:                            *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius:             "<<""
-        << left << setw(20) <<CONERADIUS                            <<""<< right << setw(10)<<"*"<<"\n";
-  f_out << left << setw(40) <<"*        - Overlap threshold:       "<<""
-        << left << setw(20) <<OVERLAPTHRESHOLD                      <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Number pass max:         "<<""
-	<< left << setw(20) <<NPASS                                 <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
-  f_out << left << setw(40) <<"*        - Minimum pT for protojet: "<<""
-	<< left << setw(20) <<PROTOJET_PTMIN                        <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out <<"* SISCone jet algorithm with parameters:                            *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius:             "<<""
+	  << left << setw(20) <<JET_coneradius                        <<""<< right << setw(10)<<"*"<<"\n";
+    f_out << left << setw(40) <<"*        - Overlap threshold:       "<<""
+	  << left << setw(20) <<JET_overlap                           <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Number pass max:         "<<""
+	  << left << setw(20) <<JET_S_npass                           <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
+    f_out << left << setw(40) <<"*        - Minimum pT for protojet: "<<""
+	  << left << setw(20) <<JET_S_protojet_ptmin                  <<""<< right << setw(10)<<"! not in datacard  *"<<"\n";
   }
     break;
   case 4: {
-  f_out <<"* KT jet algorithm with parameters:                                 *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius: "<<""
-        << left << setw(20) <<CONERADIUS                <<""<< right << setw(10)<<"*"<<"\n";
+    f_out <<"* KT jet algorithm with parameters:                                 *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius: "<<""
+	  << left << setw(20) <<JET_coneradius                <<""<< right << setw(10)<<"*"<<"\n";
   }
     break;
   case 5: {
-  f_out <<"* Cambridge/Aachen jet algorithm with parameters:                   *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius: "<<""
-        << left << setw(20) <<CONERADIUS                <<""<< right << setw(10)<<"*"<<"\n";
+    f_out <<"* Cambridge/Aachen jet algorithm with parameters:                   *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius: "<<""
+	  << left << setw(20) <<JET_coneradius                <<""<< right << setw(10)<<"*"<<"\n";
   }
     break;
   case 6: {
-  f_out <<"* Anti-kt jet algorithm with parameters:                            *"<<"\n";
-  f_out << left << setw(40) <<"*        - Cone radius: "<<""
-        << left << setw(20) <<CONERADIUS                <<""<< right << setw(10)<<"*"<<"\n";
+    f_out <<"* Anti-kt jet algorithm with parameters:                            *"<<"\n";
+    f_out << left << setw(40) <<"*        - Cone radius: "<<""
+	  << left << setw(20) <<JET_coneradius                <<""<< right << setw(10)<<"*"<<"\n";
   }
     break;
-
-
-  }
+  }
+  f_out<<"*                                                                    *"<<"\n";
+  f_out<<"#******************************                                      *"<<"\n";
+  f_out<<"# Tau-jet definition parameters                                      *"<<"\n";
+  f_out<<"#******************************                                      *"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  f_out << left << setw(45) <<"* Cone radius for calorimeter tagging:  "<<""
+	<< left << setw(5) <<TAU_energy_scone                           <<""<< right << setw(20)<<"*"<<"\n";
+  f_out << left << setw(45) <<"* Fraction of energy in the small cone: "<<""
+	<< left << setw(5) <<TAU_energy_frac*100                        <<""<< right << setw(20)<<"! not in datacard  *"<<"\n";
+  f_out << left << setw(45) <<"* Cone radius for tracking tagging:     "<<""
+	<< left << setw(5) <<TAU_track_scone                            <<""<< right << setw(20)<<"*"<<"\n";
+  f_out << left << setw(45) <<"* Minimum track pT [GeV]:               "<<""
+	<< left << setw(5) <<TAU_track_pt                                <<""<< right << setw(20)<<"*"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  f_out<<"#***************************                                         *"<<"\n";
+  f_out<<"# B-tagging efficiencies [%]                                         *"<<"\n";
+  f_out<<"#***************************                                         *"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
+  f_out << left << setw(50) <<"* Efficiency to tag a \"b\" as a b-jet: "<<""
+	<< left << setw(10) <<BTAG_b               <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(50) <<"* Efficiency to mistag a c-jet as a b-jet: "<<""
+	<< left << setw(10) <<BTAG_mistag_c            <<""<< right << setw(10)<<"*"<<"\n";
+  f_out << left << setw(50) <<"* Efficiency to mistag a light jet as a b-jet: "<<""
+	<< left << setw(10) <<BTAG_mistag_l            <<""<< right << setw(10)<<"*"<<"\n";
+  f_out<<"*                                                                    *"<<"\n";
   f_out<<"*                                                                    *"<<"\n";
   f_out<<"#....................................................................*"<<"\n";
   f_out<<"#>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"<<"\n";
-
+  
 }
 
@@ -502,5 +555,5 @@
   float energyS = 0.0;		// after smearing  // \sigma/E = C + N/E + S/\sqrt{E}
   
-  if(fabs(electron.Eta()) < MAX_TRACKER) { // if the electron is inside the tracker
+  if(fabs(electron.Eta()) < CEN_max_tracker) { // if the electron is inside the tracker
     energyS = gRandom->Gaus(energy, sqrt( 
 					 pow(ELG_Ncen,2) + 
@@ -508,5 +561,5 @@
 					 pow(ELG_Scen*sqrt(energy),2) ));
   } 
-  if(fabs(electron.Eta()) > MAX_TRACKER && fabs(electron.Eta()) < MAX_CALO_FWD){
+  if(fabs(electron.Eta()) > CEN_max_tracker && fabs(electron.Eta()) < CEN_max_calo_fwd){
     energyS = gRandom->Gaus(energy, sqrt(
 					 pow(ELG_Nfwd,2) +
@@ -526,5 +579,5 @@
   float ptS=pt;
 
-  if(fabs(muon.Eta()) < MAX_MU )
+  if(fabs(muon.Eta()) < CEN_max_mu )
    {
      ptS = gRandom->Gaus(pt, MU_SmearPt*pt ); // after smearing // \sigma/E = C + N/E + S/\sqrt{E}
@@ -550,5 +603,5 @@
   
   float energyS1,energyS2;
-  if(fabs(hadron.Eta()) < MAX_CALO_CEN) {
+  if(fabs(hadron.Eta()) < CEN_max_calo_cen) {
    energyS1 = gRandom->Gaus(energy_hcal, sqrt(
 					      pow(HAD_Nhcal,2) +
@@ -564,5 +617,5 @@
   energyS = ((energyS1>0)?energyS1:0) + ((energyS2>0)?energyS2:0);
   } 
-  if(abs(hadron.Eta()) > MAX_CALO_CEN && fabs(hadron.Eta()) < MAX_CALO_FWD){ 
+  if(abs(hadron.Eta()) > CEN_max_calo_cen && fabs(hadron.Eta()) < CEN_max_calo_fwd){ 
     energyS = gRandom->Gaus(energy, sqrt(
 			    pow(HAD_Nhf,2) +
@@ -609,6 +662,6 @@
   double Energie=0;
   for(unsigned int i=0; i < towers.size(); i++) {
-      if(towers[i].fourVector.pt() < SEEDTHRESHOLD) continue;
-      if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_CONE_ENERGY)) {
+      if(towers[i].fourVector.pt() < JET_seed) continue;
+      if((DeltaR(phi,eta,towers[i].fourVector.phi(),towers[i].fourVector.eta()) < TAU_energy_scone)) {
           Energie += towers[i].fourVector.E;
       }
@@ -630,5 +683,5 @@
   for(unsigned int i=0; i < tracks.size(); i++) { 
       if((tracks[i].Pt() < pt_track )||
-	 (DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta()) > TAU_CONE_TRACKS)
+	 (DeltaR(phi,eta,tracks[i].Phi(),tracks[i].Eta()) > TAU_track_scone)
         )continue;
       numtrack++;
@@ -647,5 +700,5 @@
       for(int i=0; i < subarray.GetEntries();i++) { // should have pt>PT_JETMIN and a small cone radius (r<CONE_JET)
 	  float genDeltaR = DeltaR(subarray[i]->Phi,subarray[i]->Eta,phi,eta);
-          if(genDeltaR < CONERADIUS && subarray[i]->E > emax) {
+          if(genDeltaR < JET_coneradius && subarray[i]->E > emax) {
               emax=subarray[i]->E;
               Ppid=abs(subarray[i]->PID);
@@ -659,7 +712,7 @@
 //******************** Simulates the b-tagging efficiency for real bjet, or the misendentification for other jets****************
 bool RESOLution::Btaggedjet(const TLorentzVector &JET, const TSimpleArray<TRootGenParticle> &subarray)	{
-  if(      rand()%100 < (TAGGING_B+1)    && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40%
-  else if( rand()%100 < (MISTAGGING_C+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10%
-  else if( rand()%100 < (MISTAGGING_L+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0)   return true; // b-tag of light jets is 1%
+  if(      rand()%100 < (BTAG_b+1)    && Bjets(subarray,JET.Eta(),JET.Phi())==pB ) return true; // b-tag of b-jets is 40%
+  else if( rand()%100 < (BTAG_mistag_c+1) && Bjets(subarray,JET.Eta(),JET.Phi())==pC ) return true; // b-tag of c-jets is 10%
+  else if( rand()%100 < (BTAG_mistag_l+1) && Bjets(subarray,JET.Eta(),JET.Phi())!=0)   return true; // b-tag of light jets is 1%
   return false;
 }
@@ -691,7 +744,7 @@
    iEta = -100; 
    int index=-100;
-   for (unsigned int i=1; i< NTOWERS+1; i++) {
-	if(fabs(eta)>TOWER_ETA_EDGES[i-1] && fabs(eta)<TOWER_ETA_EDGES[i]) {
-		iEta = (eta>0) ? TOWER_ETA_EDGES[i-1] : -TOWER_ETA_EDGES[i];
+   for (unsigned int i=1; i< TOWER_number+1; i++) {
+	if(fabs(eta)>TOWER_eta_edges[i-1] && fabs(eta)<TOWER_eta_edges[i]) {
+		iEta = (eta>0) ? TOWER_eta_edges[i-1] : -TOWER_eta_edges[i];
 		index = i-1;
 		//cout << setw(15) << left << eta << "\t" << iEta << endl;
@@ -701,6 +754,6 @@
    if(index==-100) return; 
    iPhi = -100;
-   float dphi = TOWER_DPHI[index]*PI/180.; 
-   for (unsigned int i=1; i < 360/TOWER_DPHI[index]; i++ ) {
+   float dphi = TOWER_dphi[index]*PI/180.; 
+   for (unsigned int i=1; i < 360/TOWER_dphi[index]; i++ ) {
 	float low = -PI+(i-1)*dphi;
 	float high= low+dphi;
