Fork me on GitHub

Changeset 249 in svn for trunk/Delphes.cpp


Ignore:
Timestamp:
Feb 5, 2009, 6:19:29 PM (15 years ago)
Author:
severine ovyn
Message:

OK Card selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Delphes.cpp

    r246 r249  
    6565
    6666
    67   if(argc != 4 && argc != 3 && argc != 5) {
     67  if(argc != 3 && argc != 4 && argc != 5) {
    6868    cout << " Usage: " << argv[0] << " input_file output_file [detector_card] [trigger_card] " << endl;
    6969    cout << " input_list - list of files in Ntpl, StdHep of LHEF format," << endl;
     
    138138
    139139 
    140   //read the input TROOT file
     140  //read the output TROOT file
    141141  string inputFileList(argv[1]), outputfilename(argv[2]);
    142   if(outputfilename.find(".root") > outputfilename.length() ) {
    143     cout << "output_file should be a .root file!\n";
     142  if(outputfilename.find(".root") > outputfilename.length()) {
     143    cout <<"**    ERROR: 'output_file' should be a .root file. Exiting...      **"<< endl;
    144144    exit(1);
    145145  }
     
    157157 
    158158  //read the datacard input file
    159   string DetDatacard("");
    160   if(argc>=4)DetDatacard =argv[3];
     159  string DetDatacard("");                  //for detector smearing parameters
     160  string TrigDatacard("data/trigger.dat"); //for trigger selection
     161 
     162  string lineCard1,lineCard2;
     163  bool detecCard=false,trigCard=false;
     164  if(argv[3])
     165    { 
     166      ifstream infile1(argv[3]);
     167      infile1 >> lineCard1; // the first line determines the type of input files
     168      if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==true)
     169           cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
     170      else if(strstr(lineCard1.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[3]; detecCard=true;}
     171      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==true)
     172           cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
     173      else if(strstr(lineCard1.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[3]; trigCard=true;}
     174    }
     175  if(argv[4])
     176    { 
     177      ifstream infile2(argv[4]);
     178      infile2 >> lineCard2; // the first line determines the type of input files
     179      if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==true)
     180           cerr <<"**         ERROR: A DETECTOR card has already been loaded          **"<< endl;
     181      else if(strstr(lineCard2.c_str(),"DETECTOR") && detecCard==false){DetDatacard =argv[4]; detecCard=true;}
     182      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==true)
     183           cerr <<"**         ERROR: A TRIGGER card has already been loaded           **"<< endl;
     184      else if(strstr(lineCard2.c_str(),"TRIGGER") && trigCard==false){TrigDatacard =argv[4]; trigCard=true;}
     185    }
    161186 
    162187  //Smearing information
     
    174199  cout <<"**                                                                 **"<< endl;
    175200
    176   //read the trigger input file
    177   string TrigDatacard("data/trigger.dat");
    178   if(argc==5)  TrigDatacard =argv[4];
    179  
    180201  //Trigger information
     202  cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
     203  if(trigCard==false)
     204     {
     205       cout <<"**        WARNING: Datadard  not found, use default card           **" << endl;
     206       TrigDatacard="data/trigger.dat";
     207     }
    181208  TriggerTable *TRIGT = new TriggerTable();
    182209  TRIGT->TriggerCardReader(TrigDatacard.c_str());
     
    184211  if(DET->FLAG_trigger == 1)
    185212    {
    186       cout <<"**        ########### Start reading TRIGGER card ##########        **"<< endl;
    187213      cout << left  << setw(40) <<"**        Opening configuration card: "<<""
    188214           << left  << setw(20) << TrigDatacard                            <<""
     
    240266  ExRootTreeReader *treeReader = new ExRootTreeReader(&chain);
    241267  const TClonesArray *branchGen = treeReader->UseBranch("Particle");
     268
    242269  TIter itGen((TCollection*)branchGen);
    243270 
Note: See TracChangeset for help on using the changeset viewer.