Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:13:40

0001 #!/usr/bin/env perl
0002 
0003 $runNum_ = $ARGV[0];
0004 $string_ = $ARGV[1];
0005 
0006 
0007 #configure here
0008 #$ntpdir=  "/store/express/BeamCommissioning09/ExpressPhysics/FEVT/v2";
0009 #$ntpdir=  "/store/data/BeamCommissioning09/ZeroBias/RECO/v2/";
0010 #$ntpdir=  "/store/data/BeamCommissioning09/MinimumBias/RECO/v2/";
0011 #$ntpdir=  "/store/data/Commissioning10/MinimumBias/RECO/v3/";
0012 #$ntpdir=  "/store/data/Commissioning10/MinimumBias/RECO/v5/";
0013 #$ntpdir=  "/store/data/Commissioning10/Cosmics/RECO/v3/";
0014 #$ntpdir=  "/store/express/Commissioning10/ExpressPhysics/FEVT/v6/";
0015 $ntpdir=  "/store/express/Commissioning10/ExpressPhysics/FEVT/v7/";
0016 
0017 #####################
0018 $tempDir = "./runs";
0019 
0020 if(! $ARGV[0] ) {print "Usage: ./createInput.pl [RUN] [stringToSearch]\n"; exit;}
0021 if(! $ARGV[1] ) {print "GETTING ALL FILES with sufix $string_!!!!!\n"; $string_ = "root";}
0022 
0023 if ($string_ eq "dat") {
0024  $ntpdir= "/store/streamer/Data/A/";
0025 }
0026 
0027 $A = substr($runNum_,0,3);
0028 $B = substr($runNum_,3);
0029      print "A=$A\n";
0030      print "B=$B\n";
0031 
0032 
0033      print "Checking directory: \"/castor/cern.ch/cms$ntpdir\" \n";
0034      print "nsls /castor/cern.ch/cms$ntpdir/000/$A/$B/ | grep $string_ > tmp.lis\n";
0035      system("nsls /castor/cern.ch/cms$ntpdir/000/$A/$B/ | grep $string_ > tmp.lis");
0036      open(FILE, "tmp.lis") or die "Can't open `..tmp.lis': $!";
0037      @v = <FILE>;
0038      $lines=0;
0039 
0040 #open CFGFILE, "> $runNum_\_cfi.py";
0041 #open CFGFILE, "> curRun_files_cfi.py";
0042      unless(-d $tempDir){
0043       system("mkdir ./runs");
0044      }
0045      open CFGFILE, "> ./runs/Run\_$runNum_\_cfi.py";
0046 print CFGFILE "import FWCore.ParameterSet.Config as cms\n";
0047 #print CFGFILE "maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )\n";
0048 #print CFGFILE "readFiles = cms.untracked.vstring()\n"; 
0049 #print CFGFILE "secFiles = cms.untracked.vstring()\n"; 
0050 #print CFGFILE "source = cms.Source (\"NewEventStreamFileReader\",fileNames = readFiles, secondaryFileNames = secFiles)\n"; 
0051 #     print CFGFILE "readFiles.extend( (\n"; 
0052 if ($string_ eq "dat") {
0053      print CFGFILE "source = cms.Source (\"NewEventStreamFileReader\",\n";
0054 }
0055 if ($string_ eq "root") {
0056      print CFGFILE "source = cms.Source (\"PoolSource\",\n";
0057 }
0058      print CFGFILE "fileNames = cms.untracked.vstring(\n"; 
0059 #process.source = cms.Source("PoolSource",
0060 ##    fileNames = cms.untracked.vstring('/store/data/Commissioning09/Cosmics/RAW/v3/000/118/967/006BA396-9378-DE11-BBC8-000423D944FC.root')
0061      
0062      print "@v\n";
0063      $size=@v-1;
0064      foreach (@v) {
0065      chomp($_);
0066      if($lines<$size) { print CFGFILE "'$ntpdir/000/$A/$B/$_',\n"; }
0067      if($lines==$size) { print CFGFILE "'$ntpdir/000/$A/$B/$_'\n"; }
0068      $lines ++;
0069      }
0070      print CFGFILE "));\n"; 
0071 #print CFGFILE "secFiles.extend( (\n"; 
0072 #     print CFGFILE "))\n"; 
0073     
0074      close CFGFILE;
0075      
0076      print "\n";
0077      print "Total number of files read: $lines\n";
0078      system("rm -f tmp.lis");
0079 system("cp -f runs/Run_$runNum_\_cfi.py curRun\_files\_cfi.py");
0080 #system("cp -f $runNum_\_cfi.py ../python/");
0081 
0082 FINE :
0083 print "End submission...\n";
0084 print "picked up files with sufix:   $string_ \n";
0085 print "from dir: $ntpdir \n";