Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:22:50

0001 #!/usr/local/bin/perl
0002 
0003 open(RUNFILE, "tempFile.txt");
0004 
0005 @runs = readline(RUNFILE);
0006 close(RUNFILE);
0007 
0008 foreach $run (@runs)  
0009 {
0010 $runName = substr($run,0,45);
0011 $runName = "/tmp/csccalib/" . $runName;
0012 $list = "$list" . "\"" . "$runName" . "\",";
0013 }  
0014 
0015 #cut off the last comma from the run list. 
0016 
0017 $list = substr($list,0,-1);
0018 
0019 #read in config updates from ConfigUpdate.txt
0020 open (UPDATES, "ConfigUpdate.txt");
0021 while (<UPDATES>) {
0022     $DSOURCE_INPUT = $DSOURCE_INPUT . $_ ;
0023 }
0024 close(UPDATES);
0025 
0026 $RUI_DUMMY = substr($ARGV[0],30);
0027 $RUI = substr($RUI_DUMMY,0, 5);
0028 
0029 $saturation = 
0030 
0031 "process TEST = {
0032         source = DaqSource{ string reader = \"CSCFileReader\"
0033                 PSet pset = {untracked vstring $RUI ={\"$ARGV[0]\"}
0034                 untracked string dataType  = \"DAQ\"
0035                 untracked int32 input = -1
0036                 $DSOURCE_INPUT
0037                 untracked int32 firstEvent = 0
0038 }
0039         }
0040  
0041         module cscunpacker = CSCDCCUnpacker { 
0042         //untracked bool PrintEventNumber = false
0043         untracked bool Debug = false 
0044         untracked int32 debugVerbosity = 0 
0045         FileInPath theMappingFile = \"OnlineDB/CSCCondDB/test/csc_slice_test_map.txt\"
0046         }
0047  
0048         module analyzer = CSCSaturationAnalyzer {
0049                 untracked int32 Verbosity = 0
0050                 #change to true to send constants to DB !!
0051                 untracked bool debug = false
0052         } 
0053  
0054          
0055         path p = {cscunpacker,analyzer} 
0056 }";
0057 
0058 
0059 print "$saturation\n"; 
0060 
0061 #output .cfg file
0062 open(CONFIGFILE, ">CSCsaturation.cfg");
0063 print CONFIGFILE "$saturation";
0064 close(CONFIGFILE); 
0065 
0066 #read in dummy runs list, for reading. 
0067 open(DUMMYRUNSOLD, "GoodSaturationRunsDummy.txt");
0068 @dummyruns = readline(DUMMYRUNSOLD);
0069 close(DUMMYRUNSOLD);
0070 
0071 #compare the runs just processed, in @runs to the old list of runs, in @dummyruns.
0072 #if the just-processed run is in the file, do not re-write it. otherwise, write it. 
0073 
0074 #perl cannot compare a string to an array, so this reads in the array @runs as a 
0075 #variable. all members is @runs are now in text in $runVar. 
0076 $runVar="";
0077 foreach $run (@runs){
0078     $runVar=$runVar . $run
0079     }
0080 print "$runVar\n";
0081 
0082 #initialize variable which will become the new run list for processing.
0083 $dummyrunsNew = "";
0084 #read in each line in the input dummyrun file. if it is in runVar, i.e. if it
0085 #was processed in this config, do NOT rewrite it. otherwise, write it. 
0086 foreach $dummyrun (@dummyruns){  
0087     #this if reads as "if the string pointed to by the variable dummyrun is contained 
0088     #in the string pointed to by the variable runVar, then..."
0089     if ( $runVar =~ m/($dummyrun)/){ print "$dummyrun processed\n"}
0090     else { 
0091         print "$dummyrun NOT processed\n";
0092         $dummyrunsNew = $dummyrunsNew . $dummyrun;
0093            };
0094     }
0095 
0096 
0097 print "\n\n ******dummrunsNew******\n$dummyrunsNew";
0098 
0099 #re-open dummy runs list, for writing, in order to remove already processed runs. 
0100 open(DUMMYRUNS, ">GoodSaturationRunsDummy.txt");
0101 print DUMMYRUNS "$dummyrunsNew";
0102 close(DUMMYRUNS);
0103