Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:10:24

0001 #!/usr/bin/env perl
0002 
0003 
0004 #configure here
0005 $ntpdir=  "/store/streamer/RunPrep09/A";
0006 
0007 #####################
0008 
0009 
0010 $runNum_ = $ARGV[0];
0011 $string_ = $ARGV[1];
0012 
0013 if(! $ARGV[0] ) {print "Usage: ./createInput.pl [RUN] [stringToSearch]\n"; exit;}
0014 if(! $ARGV[1] ) {print "GETTING ALL FILES!!!!!\n"; $string_ = "dat";}
0015 
0016 $A = substr($runNum_,0,3);
0017 $B = substr($runNum_,3);
0018      print "A=$A\n";
0019      print "B=$B\n";
0020 
0021 
0022      print "Checking directory: \"/castor/cern.ch/cms$ntpdir\" \n";
0023      print "nsls /castor/cern.ch/cms$ntpdir/000/$A/$B/ | grep $string_ > tmp.lis\n";
0024      system("nsls /castor/cern.ch/cms$ntpdir/000/$A/$B/ | grep $string_ > tmp.lis");
0025      open(FILE, "tmp.lis") or die "Can't open `..tmp.lis': $!";
0026      @v = <FILE>;
0027      $lines=0;
0028 
0029      open CFGFILE, "> $runNum_\_cfi.py";
0030      print CFGFILE "import FWCore.ParameterSet.Config as cms\n";
0031      print CFGFILE "maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\n";
0032      print CFGFILE "readFiles = cms.untracked.vstring()\n"; 
0033      print CFGFILE "secFiles = cms.untracked.vstring()\n"; 
0034      print CFGFILE "source = cms.Source (\"NewEventStreamFileReader\",fileNames = readFiles, secondaryFileNames = secFiles)\n"; 
0035      print CFGFILE "readFiles.extend( (\n"; 
0036      
0037      print "@v\n";
0038      $size=@v-1;
0039      foreach (@v) {
0040      chomp($_);
0041      if($lines<$size) { print CFGFILE "'$ntpdir/000/$A/$B/$_',\n"; }
0042      if($lines==$size) { print CFGFILE "'$ntpdir/000/$A/$B/$_'\n"; }
0043      $lines ++;
0044      }
0045      print CFGFILE "));\n"; 
0046      print CFGFILE "secFiles.extend( (\n"; 
0047      print CFGFILE "))\n"; 
0048     
0049      close CFGFILE;
0050      
0051      print "\n";
0052      print "Total number of files read: $lines\n";
0053      system("rm -f tmp.lis");
0054      system("cp -f $runNum_\_cfi.py ../python/");
0055 
0056 FINE :
0057 print "End submission...\n";