Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #!/bin/csh
0002 if(-e ../../SiPixelMonitorClient/test/sipixel_monitorelement_backup.xml) then
0003     cp ../../SiPixelMonitorClient/test/sipixel_monitorelement_backup.xml ../../SiPixelMonitorClient/test/sipixel_monitorelement_config.xml
0004 endif
0005 
0006 if(-e ../../SiPixelMonitorClient/test/sipixel_monitorelement_skeleton_backup.xml) then
0007     cp ../../SiPixelMonitorClient/test/sipixel_monitorelement_skeleton_backup.xml ../../SiPixelMonitorClient/test/sipixel_monitorelement_skeleton.xml
0008     endif
0009 
0010    set all_flag = "false"
0011     set default_flag = "false"
0012     set physics_flag = "false"
0013     set calib_flag = "false"
0014     set opt_flag = "true"
0015     set var_flag = ( 0 0 0 0 0 0 0 0 0 0 )
0016 if( !(-d ../../../DQM/SiPixelMonitorClient/test)) then
0017     echo "Please check out the DQM/SiPixelMonitorClient package"
0018 endif
0019 
0020 if($#argv > 1) then
0021     cd ../../../DQM/SiPixelMonitorClient/test
0022     cp sipixel_monitorelement_config.xml sipixel_monitorelement_backup.xml
0023     cp sipixel_monitorelement_skeleton.xml sipixel_monitorelement_skeleton_backup.xml
0024     set num_args = $#argv
0025     
0026     set i = 2
0027  
0028     
0029     while ($i <= $num_args)
0030         set monlist = $argv[$i]
0031             switch($monlist)
0032                 case All:
0033                     set all_flag = "true"
0034                     cp sipixel_monitorelement_config_all.xml sipixel_monitorelement_config.xml
0035                     breaksw
0036                 case RawData:
0037                     set reglist = "me_parts/rawdataMEs.txt"
0038                     set grandlist = "me_parts/rawdataMEs.txt"
0039                     set regspot = "RAWDATA"
0040                     set grandspot = "RAWDATA"
0041                     set var_flag[1] = 1
0042                     
0043                 breaksw
0044                 case Digi:
0045                     set reglist = "me_parts/digiMEs.txt"
0046                     set grandlist = "me_parts/digiMEs.txt"
0047                     set regspot = "DIGIS"
0048                     set grandspot = "DIGIS"
0049                     set var_flag[2] = 1
0050                     
0051                 breaksw
0052                 case Cluster:
0053                     set reglist = "me_parts/clusterMEs.txt"
0054                     set grandlist = "me_parts/clusterMEs.txt"
0055                     set regspot = "CLUSTERS"
0056                     set grandspot = "CLUSTERS"
0057                     set var_flag[3] = 1
0058                     breaksw
0059                 case RecHit:
0060                     set reglist = "me_parts/rechitMEs.txt"
0061                     set grandlist = "me_parts/rechitMEs.txt"
0062                     set regspot = "RECHITS"
0063                     set grandspot = "RECHITS"
0064                     set var_flag[4] = 1
0065                     breaksw
0066                 case Track:
0067                     set reglist = "me_parts/trackMEs.txt"
0068                     set grandlist = "me_parts/grandtrackMEs.txt"
0069                     set regspot = "REGTRACKS"
0070                     set grandspot = "GRANDTRACKS"
0071                     set var_flag[5] = 1
0072                     breaksw
0073                 case Gain:
0074                     set reglist = "me_parts/gainMEs.txt"
0075                     set grandlist = "me_parts/grandgainMEs.txt"
0076                     set regspot = "REGGAIN"
0077                     set grandspot = "GRANDGAIN"
0078                     set var_flag[6] = 1
0079                     set var_flag[7] = 1
0080                     breaksw
0081                 case SCurve:
0082                     set reglist = "me_parts/scurveMEs.txt"
0083                     set grandlist = "me_parts/grandscurveMEs.txt"
0084                     set regspot = "REGSCURVE"
0085                     set grandspot = "GRANDSCURVE"
0086                     set var_flag[6] = 1
0087                     set var_flag[8] = 1
0088                     breaksw
0089                 case PixelAlive:
0090                     set reglist = "me_parts/pixelMEs.txt"
0091                     set grandlist = "me_parts/grandpixelMEs.txt"
0092                     set regspot = "REGPIXEL"
0093                     set grandspot = "GRANDPIXEL"
0094                      set var_flag[6] = 1
0095                     set var_flag[9] = 1
0096                     breaksw
0097                 case Physics:
0098                     set physics_flag = "true"
0099                     cp sipixel_monitorelement_config_physicsdata.xml sipixel_monitorelement_config.xml    
0100                     breaksw
0101                 case Calibration:
0102                     set calib_flag = "true"
0103                     cp sipixel_monitorelement_config_calibrations.xml sipixel_monitorelement_config.xml
0104                     breaksw
0105                 default:
0106                     echo "${monlist} is not a valid monitor element choice.  Valid options are Physics or Calibration."
0107                     breaksw
0108                 endsw
0109               if( $physics_flag != "true" && $calib_flag != "true" ) then
0110                 
0111                 sed "/$regspot/ r $reglist" < sipixel_monitorelement_skeleton.xml > temp.xml
0112                 cp temp.xml sipixel_monitorelement_skeleton.xml
0113                 rm temp.xml
0114                 if($grandspot != $regspot) then
0115                     sed "/$grandspot/ r $grandlist" < sipixel_monitorelement_skeleton.xml > temp.xml
0116                     cp temp.xml sipixel_monitorelement_skeleton.xml
0117                     rm temp.xml
0118                 endif
0119             endif
0120                 @ i = $i + 1
0121     end
0122 
0123     if ($all_flag == "false" && $calib_flag == "false" && $physics_flag == "false" ) then
0124        cp sipixel_monitorelement_skeleton.xml sipixel_monitorelement_config.xml
0125        foreach me_name (RAWDATA DIGIS CLUSTERS GRANDTRACKS RECHITS GRANDGAIN GRANDSCURVE GRANDPIXEL REGTRACKS REGGAIN REGSCURVE REGPIXEL)
0126             sed "/$me_name/d" < sipixel_monitorelement_config.xml > temp.xml
0127             cp temp.xml sipixel_monitorelement_config.xml
0128             rm temp.xml
0129 
0130        end
0131 
0132     endif
0133 
0134     cd ../../SiPixelCommon/test
0135 
0136 else
0137     set opt_flag = "false"
0138     echo "No option specified!  Please choose Calibration or Physics"
0139 endif
0140 
0141 if ( $opt_flag == "true" ) then
0142     set xx = 2
0143     set depth = 0
0144     while ( $xx < 6 )
0145         if ( $var_flag[$xx] == 1 ) then
0146             set depth = $xx
0147         endif
0148         @ xx = $xx + 1
0149     end  
0150 
0151     set runscript = "runme.csh"
0152     set filelist = $argv[1]
0153     set file_counter = 1
0154     foreach filename ( `more $filelist` )
0155 
0156         if(-e Run_offline_DQM_${file_counter}_cfg.py) then
0157                     rm Run_offline_DQM_${file_counter}_cfg.py
0158         endif
0159 
0160         set rsys = "rfio:"
0161         set osys = "file:"
0162         set iscastor = `echo $filename | grep -o /castor/cern.ch`
0163         set isdata = `echo $filename | grep -o /store/data`
0164         set calibtype = `echo $filename | grep -o -e "PixelAlive" -e "SCurve" -e "GainCalibration"`
0165         set file_extension = `echo $filename | grep -o -e ".dmp" -e ".root" -e ".dat"`
0166         set endrun = `echo $filename | grep -o -e "_[0-9]\{2,\}\."`
0167         set runnumber = `echo $endrun | grep -o -e ".*[^\.]"`
0168         set rundefault = "_default"
0169         
0170 
0171         
0172         if($calibtype == "PixelAlive" || $calibtype == "SCurve" || $calibtype == "GainCalibration") then
0173             set tagnumber = $calibtype$runnumber            
0174         else if ($calib_flag == "true") then
0175             set tagnumber = "PixelAlive_default"
0176         else
0177             set tagnumber = ""
0178         endif
0179 
0180 
0181         if(  $iscastor == "/castor/cern.ch" ) then
0182             set filetorun = $rsys$filename
0183         else if ( $isdata == "/store/data" ) then
0184             set filetorun = $filename
0185         else
0186             set filetorun = $osys$filename
0187         endif
0188 
0189         if( $physics_flag == "true" ) then
0190         sed "s#FILENAME#$filetorun#" < client_template_physics_cfg.py > Run_offline_DQM_${file_counter}_cfg.py
0191         else if ($calib_flag == "true" ) then
0192         sed "s#FILENAME#$filetorun#" < client_template_calib_cfg.py > Run_offline_DQM_${file_counter}_cfg.py
0193         else
0194         sed "s#FILENAME#$filetorun#" < client_template_cfg.py > Run_offline_DQM_${file_counter}_cfg.py
0195         endif
0196         
0197         if( $all_flag == "true" ) then
0198             rm Run_offline_DQM_${file_counter}_cfg.py
0199         sed "s#FILENAME#$filetorun#" < client_template_all_cfg.py > Run_offline_DQM_${file_counter}_cfg.py
0200         sed "s#CALIBRATIONTAG#$tagnumber#" < Run_offline_DQM_${file_counter}_cfg.py > temp_cfg.py
0201         cp temp_cfg.py Run_offline_DQM_${file_counter}_cfg.py
0202         rm temp_cfg.py
0203         endif
0204        
0205         sed "s#CALIBRATIONTAG#$tagnumber#" < Run_offline_DQM_${file_counter}_cfg.py > temp_cfg.py
0206         cp temp_cfg.py Run_offline_DQM_${file_counter}_cfg.py
0207         rm temp_cfg.py
0208 
0209         if( $file_extension == ".dat" ) then
0210             echo ".dat files are not supported actively by this script, but a config file will be generated anyway"
0211             sed 's/DAT//' < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0212             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0213             rm temp.xml
0214             set source_type = "NewEventStreamFileReader"
0215             set first_param = " max_event_size = cms.int32(7000000),"
0216             set second_param = " max_queue_depth = cms.int32(5),"
0217             set converter = "datconverter,"
0218             sed "/siPixelDigis/ i\ $converter" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0219             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0220             rm temp.xml
0221             
0222         else
0223             sed '/^DAT/d' < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0224             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0225             rm temp.xml
0226 
0227         endif
0228 
0229         if( $file_extension == ".dmp" ) then
0230             set source_type = PixelSLinkDataInputSource
0231             set first_param = " fedid = cms.untracked.int32(-1)"
0232             set second_param = "runNumber = cms.untracked.int32(-1)"
0233         endif
0234         set has_calibdigis = "false"
0235         set has_digis = "false"
0236         set has_clusters = "false"
0237         set has_rechits = "false"
0238         if( $file_extension == ".root" ) then
0239             set source_type = PoolSource
0240             set first_param = ""
0241             set second_param = ""
0242             edmEventSize -v $filename >& es.log 
0243             set has_calibdigis = `grep -m 1 -o -e "siPixelCalibDigis" es.log`
0244             if( $has_calibdigis == "siPixelCalibDigis" ) then
0245                 set has_calibdigis = "true"
0246             else
0247                 set has_calibdigis = "false"
0248             endif
0249 
0250 
0251             set has_digis = `grep -m 1 -o -e "siPixelDigis" es.log`
0252             if( $has_digis == "siPixelDigis" ) then
0253                 set has_digis = "true"
0254             else
0255                 set has_digis = "false"
0256             endif
0257 
0258 
0259             set has_clusters = ` grep -m 1 -o -e "siPixelClusters" es.log`
0260             if( $has_clusters == "siPixelClusters" ) then
0261                 set has_clusters = "true"
0262             else
0263                 set has_clusters = "false"
0264             endif
0265 
0266 
0267             set has_rechits = `grep -m 1 -o -e "siPixelRecHits" es.log`
0268             if( $has_rechits == "siPixelRecHits" ) then
0269                 set has_rechits = "true"
0270             else
0271                 set has_rechits = "false"
0272             endif
0273             rm es.log
0274         endif
0275 
0276     if( $all_flag == "true" || $default_flag == "true" ) then
0277         if( $has_digis == "true" ) then
0278             sed "/siPixelDigis,/d" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0279             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0280             rm temp.xml
0281         endif
0282         if( $has_clusters == "true" ) then
0283             sed "/siPixelClusters,/d" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0284             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0285             rm temp.xml
0286         endif
0287         if( $has_rechits == "true" ) then
0288             sed "/siPixelRecHits,/d" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0289             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0290             rm temp.xml
0291         endif
0292         if( $has_calibdigis == "true" ) then
0293             sed "/siPixelCalibDigis,/d" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0294             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0295             rm temp.xml
0296         endif
0297     endif       
0298         if( $depth > 1 || $var_flag[6] == 1 ) then
0299             if( $depth > 2 ) then
0300                 if( $depth > 3) then
0301                     if( $has_rechits != "true" ) then
0302                         sed "s/RECSPOT/process.siPixelRecHits*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0303                         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0304                         rm temp.xml
0305                     endif
0306                 endif
0307                 if( $has_clusters != "true" ) then
0308                         sed "s/CLUSPOT/process.siPixelClusters*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0309                         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0310                         rm temp.xml
0311                 endif
0312             endif
0313             if( $has_digis != "true" ) then
0314                         sed "s/DIGISPOT/process.siPixelDigis*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0315                         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0316                         rm temp.xml
0317             endif
0318         endif
0319 
0320 
0321         if( $calib_flag == "true") then
0322                 if( $has_calibdigis != "true" ) then
0323                         sed "s/CDSPOT/process.siPixelCalibDigis*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0324                         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0325                         rm temp.xml
0326                         
0327                 endif
0328                 set calibration_tag = "CRZT210_V1P::All"
0329                         sed "s/GLOBALCALIB/$calibtype/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0330                 cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0331                 rm temp.xml
0332                 
0333         else if( $var_flag[6] != 1 ) then
0334           set calibration_tag = "CRUZET4_V5P::All"
0335            set connect_string = "frontier://FrontierProd/CMS_COND_21X_GLOBALTAG"
0336            sed '/^CALIB/d' < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0337                 cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0338                 rm temp.xml
0339             sed 's/PHYS//' < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0340              cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0341              rm temp.xml
0342 
0343         endif
0344          
0345         sed "s/GTAG/$calibration_tag/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0346         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0347         rm temp.xml
0348 
0349 
0350         if( $var_flag[1] == 1 ) then
0351             sed "s/RAWMONSPOT/process.RAWmonitor*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0352             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0353             rm temp.xml
0354         endif
0355         if( $var_flag[2] == 1 ) then
0356             sed "s/DIGMONSPOT/process.DIGImonitor*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0357             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0358             rm temp.xml
0359         endif
0360         if( $var_flag[3] == 1 ) then
0361             sed "s/CLUMONSPOT/process.CLUmonitor*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0362             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0363             rm temp.xml
0364         endif
0365         if( $var_flag[4] == 1 ) then
0366             sed "s/RECMONSPOT/process.RECmonitor*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0367             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0368             rm temp.xml
0369         endif
0370         if( $var_flag[7] == 1 ) then
0371             sed "s/GAINSPOT/process.siPixelGainCalibrationAnalysis*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0372             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0373             rm temp.xml
0374         endif
0375         if( $var_flag[8] == 1 ) then
0376             sed "s/SCURVESPOT/process.siPixelSCurveAnalysis*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0377             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0378             rm temp.xml
0379         endif
0380         if( $var_flag[9] == 1 ) then
0381             sed "s/PIXELSPOT/process.siPixelIsAliveCalibration*/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0382             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0383             rm temp.xml
0384         endif
0385 
0386         foreach mon_name (DIGISPOT CLUSPOT RECSPOT CDSPOT SCURVESPOT GAINSPOT PIXELSPOT RAWMONSPOT DIGMONSPOT CLUMONSPOT RECMONSPOT)
0387             sed "s/$mon_name//" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0388             cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0389             rm temp.xml
0390 
0391        end
0392 
0393 
0394 
0395         
0396 
0397         sed "s/SOURCETYPE/$source_type/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0398         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0399         rm temp.xml
0400         sed "s/ONEPARAM/$first_param/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0401         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0402         rm temp.xml
0403         sed "s/TWOPARAM/$second_param/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0404         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py 
0405         rm temp.xml
0406         set logname = "DQM_text_output_"
0407         set logfile = $logname$file_counter
0408         sed "s/TEXTFILE/$logfile/" < Run_offline_DQM_${file_counter}_cfg.py > temp.xml
0409         cp temp.xml Run_offline_DQM_${file_counter}_cfg.py
0410         rm temp.xml       
0411         echo "created file Run_offline_DQM_${file_counter}_cfg.py to run on file ${filename}"
0412         @ file_counter = $file_counter + 1
0413         
0414     end
0415 
0416 endif