Index: /trunk/Delphes.cpp
===================================================================
--- /trunk/Delphes.cpp	(revision 248)
+++ /trunk/Delphes.cpp	(revision 249)
@@ -65,5 +65,5 @@
 
 
-  if(argc != 4 && argc != 3 && argc != 5) {
+  if(argc != 3 && argc != 4 && argc != 5) {
     cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl;
     cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl;
@@ -138,8 +138,8 @@
 
   
-  //read the input TROOT file
+  //read the output TROOT file
   string inputFileList(argv[1]), outputfilename(argv[2]);
-  if(outputfilename.find(".root") > outputfilename.length() ) {
-    cout << "output_file should be a .root file!\n"; 
+  if(outputfilename.find(".root") > outputfilename.length()) {
+    cout <<"**    ERROR: 'output_file' should be a .root file. Exiting...      **"<< endl;
     exit(1);
   }
@@ -157,6 +157,31 @@
   
   //read the datacard input file
-  string DetDatacard("");
-  if(argc>=4)DetDatacard =argv[3];
+  string DetDatacard("");                  //for detector smearing parameters
+  string TrigDatacard("data/trigger.dat"); //for trigger selection
+ 
+  string lineCard1,lineCard2;
+  bool detecCard=false,trigCard=false;
+  if(argv[3]) 
+    {  
+      ifstream infile1(argv[3]);
+      infile1 >> lineCard1; // the first line determines the type of input files
+      if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==true) 
+           cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
+      else if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[3]; detecCard=true;}
+      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==true)
+           cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
+      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[3]; trigCard=true;}
+    }
+  if(argv[4])
+    {  
+      ifstream infile2(argv[4]);
+      infile2 >> lineCard2; // the first line determines the type of input files
+      if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==true)
+           cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
+      else if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[4]; detecCard=true;}
+      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==true)
+           cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
+      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[4]; trigCard=true;}
+    }
   
   //Smearing information
@@ -174,9 +199,11 @@
   cout <<"**                                                                 **"<< endl;
 
-  //read the trigger input file
-  string TrigDatacard("data/trigger.dat");
-  if(argc==5)  TrigDatacard =argv[4];
-  
   //Trigger information
+  cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
+  if(trigCard==false)
+     {
+       cout <<"**        WARNING: Datadard  not found, use default card           **" << endl;
+       TrigDatacard="data/trigger.dat";
+     }
   TriggerTable *TRIGT = new TriggerTable();
   TRIGT->TriggerCardReader(TrigDatacard.c_str());
@@ -184,5 +211,4 @@
   if(DET->FLAG_trigger == 1)
     {
-      cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
       cout << left  << setw(40) <<"**        Opening configuration card: "<<""
            << left  << setw(20) << TrigDatacard                            <<""
@@ -240,4 +266,5 @@
   ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
   const TClonesArray *branchGen = treeReader->UseBranch("Particle");
+
   TIter itGen((TCollection*)branchGen);
   
Index: /trunk/data/DataCardDet.dat
===================================================================
--- /trunk/data/DataCardDet.dat	(revision 248)
+++ /trunk/data/DataCardDet.dat	(revision 249)
@@ -1,2 +1,4 @@
+DETECTOR CARD      # DO NOT REMOVE THIS IS A TAG!
+
 # Detector extension, in pseudorapidity units
 CEN_max_tracker    2.5                // Maximum tracker coverage          
Index: /trunk/data/trigger.dat
===================================================================
--- /trunk/data/trigger.dat	(revision 248)
+++ /trunk/data/trigger.dat	(revision 249)
@@ -1,2 +1,5 @@
+TRIGGER CARD      # DO NOT REMOVE THIS IS A TAG!
+
+
 # list of trigger algorithms
 # trigger_name	>> algorithm                   #comments
Index: /trunk/src/SmearUtil.cc
===================================================================
--- /trunk/src/SmearUtil.cc	(revision 248)
+++ /trunk/src/SmearUtil.cc	(revision 249)
@@ -380,5 +380,5 @@
   ifstream fichier_a_lire(datacard.c_str());
   if(!fichier_a_lire.good()) {
-    cout <<"**        Datadard  not found, use default values                  **" << endl;
+    cout <<"**        WARNING: Datadard  not found, use default values         **" << endl;
     return;
   }
