Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:57:13

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