Back to home page

Project CMSSW displayed by LXR

 
 

    


Warning, /DQM/SiStripMonitorClient/scripts/initializeForGreenBarrack is written in an unsupported language. File is not indexed.

0001 #!/usr/bin/env perl
0002 ################################################################################
0003 #
0004 # initialize
0005 # ----------
0006 #
0007 # Setup XDAQ filter farm applications for testing, and generate scripts to
0008 # control execution.
0009 #
0010 #                          03/28/2007 Philipp Schieferdecker <schiefer@fnal.gov>
0011 ################################################################################
0012 use File::Copy;
0013 
0014 
0015 # welcome
0016 print "\n============================================================";
0017 print "\ninitialize ...";
0018 print "\n============================================================\n";
0019 
0020 # hostname, default
0021 #my $hostname = $ENV{"HOST"};
0022 chop(my $hostname = `hostname -f`);
0023 
0024 
0025 # set variables
0026 #my $port = 22101;
0027 my $port = 40866;
0028 
0029 my $appname="evf::FUEventProcessor";
0030 
0031 my $localid=50;
0032 
0033 my $libpath = getLibraryPath("EventFilter/Processor");
0034 
0035 my $libname = "libEventFilterProcessor.so";
0036 
0037 my $pwd = `pwd`; chomp $pwd;
0038 
0039 
0040 my $dqm_dir = $ENV{"CMSSW_BASE"}."/src/DQM/SiStripMonitorClient/test";
0041 my $dqm_int = $ENV{"CMSSW_BASE"}."/src/DQM/Integration/test";
0042 my $dqm_common = $ENV{"CMSSW_BASE"}."/src/DQM/TrackerCommon/test";
0043 my $dqm_wdir = "/tmp";
0044 
0045 my $cfg_file = "SiStripDQM_RealData_Online_cfg.py";
0046 
0047 print "cfg file name : $cfg_file\n";
0048 print " host name : $host_name\n"; 
0049 #
0050 # interpret command line
0051 #
0052 #foreach $param (@ARGV) {
0053 #    if    ($hostname eq "fillme")    { $hostname=$param; }
0054 #    elsif ($param    eq "-host")     { $hostname="fillme"; }
0055 #
0056 #    else { die ("Unknown parameter $param!\n"); }
0057 #}
0058 
0059 print "hostname = $hostname\n";
0060 
0061 #
0062 # make directories
0063 #
0064 print "make directories ...\n";
0065 
0066 `mkdir -p $dqm_wdir/soap`;
0067 `mkdir -p $dqm_wdir/xml`;
0068 `mkdir -p $dqm_int/TkMap`;
0069 
0070 
0071 #
0072 # make cfg files
0073 #
0074 print "copy cfg files ...\n";
0075 
0076 
0077 copy("$dqm_dir/../data/layer.js",           "$dqm_int/TkMap/layer.js");
0078 copy("$dqm_dir/../data/crate.js",           "$dqm_int/TkMap/crate.js");
0079 copy("$dqm_dir/../data/jqviewer.js",        "$dqm_int/TkMap/jqviewer.js");
0080 copy("$dqm_dir/../data/viewerHeader.xhtml", "$dqm_int/TkMap/viewerHeader.xhtml");
0081 copy("$dqm_dir/../data/viewerTrailer.xhtml","$dqm_int/TkMap/viewerTrailer.xhtml");
0082 copy("$dqm_dir/$cfg_file", "$dqm_int/$cfg_file");
0083 system qq[perl], qq[-pi -e], qq[s!TkMapCreationFrequency  = -1!TkMapCreationFrequency  = 1!], qq[$dqm_int/$cfg_file]; 
0084 system qq[perl], qq[-pi -e], qq[s!/dqmdata/dqm/reference!/home/dqmdevlocal/reference!], qq[$dqm_int/$cfg_file]; 
0085 system qq[perl], qq[-pi -e], qq[s!#process.SiteLocalConfigService!process.SiteLocalConfigService!], qq[$dqm_int/$cfg_file]; 
0086 #
0087 # make XDAQ 'profile.xml'
0088 #
0089 print "make xdaq profile ...\n";
0090 
0091 my @EXproperties = ("logUrl",  "string","console",
0092                     "logLevel","string","ERROR");
0093 
0094 
0095 my @Pathproperties = ("documentRoot", "string",q|${XDAQ_DOCUMENT_ROOT}|,
0096                       "aliasName",  "string","temporary",
0097                       "aliasPath","string",$dqm_wdir);
0098 
0099 my @XPproperties = ("settings", "string",q|${XDAQ_ROOT}/htdocs/xplore/xml/shortcuts.xml|,
0100                     "republishInterval",  "string",3600);
0101 
0102 my @STproperties = ("useDiscovery", "boolean","true",
0103                      "publish", "string", "exception",
0104                      "watchdog", "string", "PT5S");
0105 my @XMasproperties = ("useDiscovery", "boolean","true",
0106                        "autoConfigure", "boolean", "true",
0107                        "autoConfSearchPath", "string", q|${XDAQ_SETUP_ROOT}/${XDAQ_ZONE}/sensor|);
0108 
0109 open (XML,">$dqm_wdir/xml/profile.xml") or die ("Can't open file: $!\n");
0110 print XML makeXmlHeader();
0111 print XML makeXmlProfileHeader();
0112 print XML makeXmlAppHeader(0,"executive::Application",0,"executive","profile");
0113 print XML makeXmlAppProperties("Executive",@EXproperties); 
0114 print XML "      </properties>\n";
0115 print XML "    </xp:Application>\n";
0116 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libb2innub.so");
0117 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libexecutive.so");
0118 print XML makeXmlAppHeader(0,"pt::http::PeerTransportHTTP",1,);
0119 print XML makeXmlAppProperties("pt::http::PeerTransportHTTP",@Pathproperties);
0120 print XML "      </properties>\n";
0121 print XML "    </xp:Application>\n";
0122 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libpthttp.so");
0123 print XML makeXmlAppHeader(0,"pt::fifo::PeerTransportFifo",8);
0124 print XML "    </xp:Application>\n";
0125 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libptfifo.so");
0126 print XML makeXmlAppHeader(0,"xrelay::Application",4,"xrelay");
0127 print XML "    </xp:Application>\n";
0128 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxrelay.so");
0129 print XML makeXmlAppHeader(0,"hyperdaq::Application",3,"hyperdaq");
0130 print XML "    </xp:Application>\n";
0131 print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libhyperdaq.so");
0132 #print XML makeXmlAppHeader(0,"xplore::Application",9);
0133 #print XML makeXmlAppProperties("xplore::Application",@XPproperties);
0134 #print XML "      </properties>\n";
0135 #print XML "    </xp:Application>\n";
0136 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libslp.so");
0137 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxslp.so");
0138 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxploreutils.so");
0139 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxplore.so");
0140 #print XML makeXmlAppHeader(0,"sentinel::Application",21,"sentinel","exception");
0141 #print XML makeXmlAppProperties("Sentinel",@STproperties);
0142 #print XML "      </properties>\n";
0143 #print XML "    </xp:Application>\n";
0144 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libwsaddressing.so");
0145 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libwseventing.so");
0146 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libsentinelutils.so");
0147 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libsentinel.so");
0148 #print XML makeXmlAppHeader(0,"xmas::sensor::Application",10,"sensor","c2d05,service,init3");
0149 #print XML makeXmlAppProperties("xmas",@XMasproperties);
0150 #print XML makeXmlAppPublish();
0151 #print XML "      </properties>\n";
0152 #print XML "    </xp:Application>\n";
0153 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxmasutils.so");
0154 #print XML makeXmlAppTrailer(0,q|${XDAQ_ROOT}/lib|,"libxmassensor.so");
0155 print XML makeXmlProfileTrailer();
0156 
0157 
0158 
0159 #
0160 # make  xdaq configuration file 'evf.xml'
0161 #
0162 print "make xdaq  configuration ...\n";
0163 
0164 my @properties = ("parameterSet", "string","file:$dqm_int/$cfg_file",
0165                     "hasPrescaleService","boolean","false",
0166                     "isRunNumberSetter","boolean","false",
0167                     "hasSharedMemory","boolean","false");
0168 
0169 open (XML,">$dqm_wdir/xml/evf.xml") or die ("Can't open file: $!\n");
0170 print XML makeXmlHeader();
0171 print XML makeXmlPartitionHeader();
0172 print XML makeXmlComm(@apps);
0173 
0174 
0175   print XML makeXmlContextHeader("DQM",$hostname,$port);
0176   print XML makeXmlAppHeader(1,$appname,$localid);
0177   print XML makeXmlAppProperties($appname,@properties);
0178   print XML "      </properties>\n";
0179   print XML "    </xc:Application>\n";
0180   print XML makeXmlAppTrailer(1,$libpath,$libname);
0181   print XML makeXmlContextTrailer();
0182 
0183 
0184 print XML makeXmlPartitionTrailer();
0185 close (XML);
0186 
0187 
0188 #
0189 # make soap command xml files
0190 #
0191 print "make soap command files ...\n";
0192 
0193 my @commands = ('Configure','Enable','Stop','Halt' );
0194 
0195 foreach  (@commands) {
0196     open(CMD,">$dqm_wdir/soap/$_".".xml") or die ("Can't open file: $!\n");
0197     print CMD makeSoapCommand($hostname,$port,$localid,$_);
0198     close(CMD);
0199 }
0200 
0201 
0202 #
0203 # make control scripts
0204 #
0205 print "make control scripts ...\n";
0206 
0207 # configure
0208 open (CTL,qq|>$dqm_wdir/configure|) or die ("Can't open file: $!\n");
0209 print CTL "#!/usr/bin/perl\n\n";
0210 print CTL makeCtlCommand("Configure",$appname,"DQM",$hostname,$port,0,"source");
0211 
0212 close (CTL);
0213 `chmod +x $dqm_wdir/configure`;
0214 
0215 # enable
0216 open (CTL,qq|>$dqm_wdir/enable|) or die ("Can't open file: $!\n");
0217 print CTL "#!/usr/bin/perl\n\n";
0218 print CTL makeCtlCommand("Enable",$appname,"DQM",$hostname,$port,0,"source");
0219 
0220 close (CTL);
0221 `chmod +x $dqm_wdir/enable`;
0222 
0223 # stop
0224 open (CTL,qq|>$dqm_wdir/stop|) or die ("Can't open file: $!\n");
0225 print CTL "#!/usr/bin/perl\n\n";
0226 print CTL makeCtlCommand("Stop",$appname,"DQM",$hostname,$port,5,"source");
0227 
0228 close (CTL);
0229 `chmod +x $dqm_wdir/stop`;
0230 
0231 # halt
0232 open (CTL, qq|>$dqm_wdir/halt|) or die ("Can't open file: $!\n");
0233 print CTL "#!/usr/bin/perl\n\n";
0234 print CTL makeCtlCommand("Halt",$appname,"DQM",$hostname,$port,1,"source");
0235 
0236 close (CTL);
0237 `chmod +x $dqm_wdir/halt`;
0238 
0239 # destroy
0240 open (CTL,qq|>$dqm_wdir/destroy|) or die ("Can't open file: $!\n");
0241 print CTL makeCtlDestroy();
0242 close (CTL);
0243 `chmod +x $dqm_wdir/destroy`;
0244 
0245 #
0246 # copy scripts and other auxiliary files
0247 #
0248 copy("$dqm_dir/.WebLib.js",  "$dqm_wdir/WebLib.js");
0249 copy("$dqm_dir/Online.html", "$dqm_wdir/.");
0250 copy("$dqm_dir/loader.html", "$dqm_wdir/.");
0251 copy("$dqm_dir/TrackerMapFrame.html", "$dqm_wdir/.");
0252 copy("$dqm_dir/TrackerMapSelection.html", "$dqm_wdir/.");
0253 copy("$dqm_dir/TrackerMapPlot.html", "$dqm_wdir/.");
0254 
0255 $SERVED_DIR="http://$hostname:$port/temporary";
0256 system qq[perl], qq[-pi -e], qq[s#SERVED_DIRECTORY_URL#$SERVED_DIR#], qq[$dqm_wdir/WebLib.js]; 
0257 system qq[perl], qq[-pi -e], qq[s#40000#$port#], qq[$dqm_wdir/WebLib.js]; 
0258 system qq[perl], qq[-pi -e], qq[s#lid=27#lid=$localid#], qq[$dqm_wdir/WebLib.js]; 
0259 system qq[perl], qq[-pi -e], qq[s#SERVED_DIRECTORY_URL#$SERVED_DIR#], qq[$dqm_int/TkMap/viewerHeader.xhtml]; 
0260 
0261 system qq[cp], qq[-r], qq[$dqm_common/js_files],  qq[$dqm_wdir/js_files];
0262 system qq[cp], qq[-r], qq[$dqm_common/css_files], qq[$dqm_wdir/css_files];
0263 system qq[cp], qq[-r], qq[$dqm_common/images],    qq[$dqm_wdir/images];
0264 copy("$dqm_dir/js_files/CommonActions.js", "$dqm_wdir/js_files/CommonActions.js");
0265 copy("$dqm_dir/js_files/RequestHistos.js", "$dqm_wdir/js_files/RequestHistos.js");
0266 copy("$dqm_dir/js_files/TkMapFrame.js",    "$dqm_wdir/js_files/TkMapFrame.js");
0267 copy("$dqm_dir/css_files/style.css",       "$dqm_wdir/css_files/style.css");
0268 system qq[cp], qq[-r], qq[$dqm_common/jquery],    qq[$dqm_wdir/jquery];
0269 #system qq[perl], qq[-pi -e], qq[s#40000#$port#], qq[$dqm_wdir/js_files/IMGC.js]; 
0270 #system qq[perl], qq[-pi -e], qq[s#lid=27#lid=$localid#], qq[$dqm_wdir/js_files/IMGC.js]; 
0271 
0272 my $dqm_python = $ENV{"CMSSW_BASE"}."/src/DQM/Integration/python/test";
0273 
0274 system qq[perl], qq[-pi -e], qq[s!srv-c2d05-18!$hostname!], qq[$dqm_python/environment_playback_cfi.py]; 
0275 system qq[perl], qq[-pi -e], qq[s!9090!9190!], qq[$dqm_python/environment_playback_cfi.py]; 
0276 
0277 #
0278 # start processes
0279 #
0280 
0281 #print "\nstart xdaq.exe on $hostname:$port\n";
0282 #`nice -n 15 xdaq.exe -h $hostname -p $port -e xml/profile.xml -c xml/evf.xml >& log/$hostname.$port.log &`;
0283 open OUTPUT, qq|>$dqm_wdir/start| or die($!);
0284 my $script=<<"EOS";
0285 #!/bin/sh
0286 
0287 xdaq.exe -h $hostname -p $port -e $dqm_wdir/xml/profile.xml -c $dqm_wdir/xml/evf.xml
0288 EOS
0289 print OUTPUT $script;
0290 close OUTPUT;
0291 `chmod +x $dqm_wdir/start`;
0292 
0293 
0294 
0295 ################################################################################
0296 ################################################################################
0297 ## sub routines
0298 ################################################################################
0299 ################################################################################
0300 
0301 
0302 ################################################################################
0303 sub getLibraryPath
0304 {
0305     my ($pkg) = (@_);
0306     
0307     my $cmssw_base         = $ENV{"CMSSW_BASE"};
0308     my $cmssw_release_base = $ENV{"CMSSW_RELEASE_BASE"};
0309 
0310     my $result = "/lib/" . $ENV{"SCRAM_ARCH"};
0311     
0312     if (-e "$cmssw_base/src/$pkg") {
0313         $result = $cmssw_base . $result;
0314     }
0315     else {
0316         $result = $cmssw_release_base . $result;
0317     }
0318     print "\n Result of Lib Path $result\n";
0319     return $result;
0320 }
0321 
0322 ################################################################################
0323 sub makeSoapCommand
0324 {
0325     my ($hostname,$port,$localid,$command) = @_;
0326     
0327     my $result="";
0328     
0329     $result = $result . "<SOAP-ENV:Envelope\n";
0330     $result = $result . "  SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0331     $result = $result . "  xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n";
0332     $result = $result . "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0333     $result = $result . "  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n";
0334     $result = $result . "  xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n\n";
0335     $result = $result . "<SOAP-ENV:Header>\n";
0336     $result = $result . "  <xr:relay SOAP-ENV:actor=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XRelay-10\"\n";
0337     $result = $result . "    xmlns:xr=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XRelay-10\">\n";
0338     $result = $result . "  <xr:to url=\"http://$hostname:$port\" urn=\"urn:xdaq-application:lid=$localid\"/>\n";
0339     $result = $result . "</xr:relay>\n";
0340     $result = $result . "</SOAP-ENV:Header>\n\n";
0341     $result = $result . "<SOAP-ENV:Body>\n";
0342     $result = $result . "  <xdaq:$command xmlns:xdaq=\"urn:xdaq-soap:3.0\"></xdaq:$command>\n";
0343     $result = $result . "</SOAP-ENV:Body>\n\n";
0344     $result = $result . "</SOAP-ENV:Envelope>\n";
0345     
0346     return $result;
0347 }
0348 
0349 
0350 
0351 
0352 ################################################################################
0353 ################################################################################
0354 sub makeXmlHeader
0355 {
0356     my $result = "";
0357     
0358     return "<?xml version='1.0'?>\n\n";
0359     $result = $result . "<xc:Partition\n";
0360     $result = $result . "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0361     $result = $result . "  xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0362     $result = $result . "  xmlns:xc=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30\">\n\n";
0363     
0364     return $result;
0365 }
0366 
0367 
0368 ################################################################################
0369 sub makeXmlPartitionHeader
0370 {
0371     my $result = "";
0372     
0373     $result = $result . "<xc:Partition\n";
0374     $result = $result . "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0375     $result = $result . "  xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0376     $result = $result . "  xmlns:xc=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30\">\n\n";
0377     
0378     return $result;
0379 }
0380 
0381 
0382 ################################################################################
0383 sub makeXmlProfileHeader
0384 {
0385     return 
0386         "<xp:Profile\n" .
0387         "  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" .
0388         "  xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" .
0389         "  xmlns:xp=\"http://xdaq.web.cern.ch/xdaq/xsd/2005/XMLProfile-10\">\n\n";
0390 }
0391 
0392 
0393 ################################################################################
0394 sub makeXmlComm
0395 {
0396     my $result = "";
0397     
0398     $result = $result . "  <!-- communication protocoll -->\n";
0399     $result = $result . "  <i2o:protocol xmlns:i2o=" .
0400         "\"http://xdaq.web.cern.ch/xdaq/xsd/2004/I2OConfiguration-30\">\n";
0401     
0402     while (@_>0) {
0403         my $appname  = shift (@_);
0404         my $localid  = shift (@_);
0405         $result = $result . "    <i2o:target class=\"" . $appname .
0406                             "\" instance=\"0\" tid=\"" . $localid . "\"/>\n";
0407     }
0408     $result = $result . "  </i2o:protocol>\n\n";
0409     
0410     return $result;
0411 }
0412 
0413 
0414 ################################################################################
0415 sub makeXmlContextHeader
0416 {
0417     my ($contextname,$hostname,$port) = @_;
0418 
0419     my $result = "";
0420     
0421     $result = $result . "<!-- " . $contextname . " CONTEXT -->\n";
0422     $result = $result . "  <xc:Context url=\"http://$hostname:$port\">\n\n";
0423     
0424     return $result;
0425 }
0426 
0427 
0428 
0429 ################################################################################
0430 sub makeXmlEndpoint
0431 {
0432     my ($hostname,$port) = @_;
0433 
0434     my $result = "";
0435     $result = $result . "    <xc:Endpoint hostname=\"" . $hostname .
0436         "\" network=\"tcp0\" " .
0437         "port=\"" .$port . "\" protocol=\"tcp\" " .
0438         "service=\"i2o\"></xc:Endpoint>\n\n";
0439     return $result;
0440 }
0441 
0442 
0443 ################################################################################
0444 sub makeXmlAppHeader
0445 {
0446     my ($inContext,$appname,$localid,$service,$group) = @_;
0447 
0448     my $ns = "xc"; if (!$inContext) { $ns = "xp"; }
0449     
0450     my $result = qq|    <$ns:Application class="$appname" id="$localid"|;
0451     $result .= qq| group="$group"| if defined $group;
0452     $result .= qq| service="$service"| if defined $service;
0453     $result .= qq| instance="0"|;
0454     $result .= qq| network="local">\n|;
0455     return $result;
0456 }
0457 
0458 
0459 ################################################################################
0460 sub makeXmlAppProperties
0461 {
0462     my $result = "";
0463 
0464     my $appname = shift (@_);
0465 
0466     $result = $result . "      <properties xmlns=\"urn:xdaq-application:" . $appname .
0467                                     "\" xsi:type=\"soapenc:Struct\">\n";
0468     while (@_>0) {
0469         my $name  = shift (@_);
0470         my $type  = shift (@_);
0471         my $value = shift (@_);
0472         $result = $result . "        <" . $name . " xsi:type=\"xsd:" . $type . "\">" . $value . "</" . $name . ">\n";
0473     }
0474 #    $result = $result . "      </properties>\n";
0475     
0476     return $result;
0477 }
0478 
0479 
0480 ################################################################################
0481 sub makeXmlUnicast
0482 {
0483     my ($appname) = (@_);
0484     return "      <xc:Unicast class=\"" . $appname . "\" network=\"tcp0\"></xc:Unicast>\n";
0485 }
0486 
0487 
0488 ################################################################################
0489 sub makeXmlAppTrailer
0490 {
0491     my ($inContext,$libpath,$libname) = @_;
0492 
0493     my $ns = "xc"; if (!$inContext) { $ns = "xp"; }
0494     
0495     my $result = "";
0496     
0497 #    $result = $result . "    </$ns:Application>\n";
0498     $result = $result . "    <$ns:Module>" . $libpath .
0499                         "/" . $libname . "</$ns:Module>\n\n";
0500     
0501     return $result;
0502 }
0503 
0504 
0505 ################################################################################
0506 sub makeXmlContextTrailer
0507 {
0508     return "  </xc:Context>\n\n\n";
0509 }
0510 
0511 
0512 ################################################################################
0513 sub makeXmlProfileTrailer
0514 {
0515     return "</xp:Profile>\n";
0516 }
0517 
0518 
0519 ################################################################################
0520 sub makeXmlPartitionTrailer
0521 {
0522     return "</xc:Partition>\n";
0523 }
0524 
0525 
0526 ################################################################################
0527 sub makeXmlAppPublish
0528 {
0529 
0530     my $result = qq|             <publish xsi:type="soapenc:Array" soapenc:arrayType="xsd:ur-type[1]">\n|;
0531     $result .= qq|                <item xsi:type="soapenc:Struct" soapenc:position="[0]">\n|;
0532     $result .= qq|                   <tag xsi:type="xsd:string"></tag>\n|;
0533     $result .= qq|                   <group xsi:type="xsd:string">c2d05</group>\n|;
0534     $result .= qq|                </item>\n|;
0535     $result .= qq|             </publish>\n|;
0536     
0537     return $result;
0538 }
0539 ################################################################################
0540 sub makeCtlDestroy
0541 {
0542     my $result = "";
0543 
0544     my $cmd = "killall xdaq.exe";
0545 
0546     $result = $result . "#!/usr/bin/perl\n\n";
0547     $result = $result . "print \"$cmd ...\\n\";\n\n";
0548     $result = $result . "`$cmd`;\n\n";
0549     $result = $result . "print \"remove files and dirs ...\n\";\n\n";
0550     $result = $result . "`rm -rf  $dqm_wdir/soap/ $dqm_wdir/xml/ "
0551           . "$dqm_wdir/log/ /tmp/sm $dqm_int/TkMap/ "
0552           . "start configure enable halt stop gennums.txt"
0553           . " summaryCatalog.txt `;\n\n";
0554     $result = $result . "`rm -rf $dqm_wdir/Online.html $dqm_wdir/loader.html "
0555           . " $dqm_wdir\*.coor  $dqm_wdir/TrackerMapFrame.html "
0556           . " TrackerMapFrame.html TrackerMapPlot.html TrackerMapSelection.html "
0557           . " $dqm_wdir/fedtrackermap.html  $dqm_wdir/WebLib.js "
0558           . " $dqm_wdir/css_files $dqm_wdir/js_files $dqm_wdir/images `;\n\n";
0559     $result = $result . "`rm -rf $dqm_wdir/svgmap.xml $dqm_wdir/svgmap_fed.xml  "
0560           . " $dqm_wdir/dqmtmapfed.png $dqm_wdir/dqmtmap.png`;\n\n";
0561     $result = $result . "`rm -rf $dqm_wdir/dqmtmaplayer\*.html $dqm_wdir/loader.html "
0562           . " $dqm_wdir/dqmtmapcrate\*.html $dqm_wdir/Online.html "
0563           . " $dqm_wdir/TrackerMap\*.html  $dqm_wdir/dqmtmapcrate\*.xml"
0564           . " $dqm_dir/dqmtmaplayer\*.xml  $dqm_wdir/dqmtmapviewer.xhtml "
0565           . " $dqm_wdir/crate.js $dqm_wdir/layer.js $dqm_dir/viewer.js "
0566           . " $dqm_wdir/WebLib.js $dqm_wdir/viewer.css $dqm_wdir/xml $dqm_wdir/jquery`;\n\n";
0567     $result = $result . "print \"FUShmCleanUp_t ...\\n\";\n\n";
0568     $result = $result . "`FUShmCleanUp_t`;\n\n";
0569     $result = $result . "print \"XDAQ session destroyed!\\n\";\n\n";
0570     $result = $result . "`rm destroy`;\n";
0571     
0572     return $result;
0573 }
0574 
0575 
0576 ################################################################################
0577 sub makeCtlCommand
0578 {
0579     my ($cmd,$appname,$appabrev,$host,$port,$sleep,$param) = (@_);
0580 
0581     my $result = "";
0582     
0583     $result = $result."print \"\\n===============================================\";\n";
0584     $result = $result."print \"\\n$cmd the $appname ($appabrev)...\";\n";
0585     $result = $result."print \"\\n\===============================================\";\n";
0586     $result = $result."my \$result = `".makeCurlCommand($cmd,$appabrev,$host,$port)."`;\n";
0587     $result = $result."print \"\\n\$result\\n\\n\";\n";
0588     if ($sleep>0){
0589         $result = $result . "\n\t`sleep $sleep`;\n";
0590     }
0591 
0592     return $result;
0593 }
0594 
0595 
0596 ################################################################################
0597 sub makeCurlCommand
0598 {
0599     my ($cmd,$appabrev,$host,$port) = @_;
0600     my $pwd = `pwd`; chomp($pwd);
0601     return 
0602         "curl --stderr /dev/null -H " .
0603         "\"SOAPAction: urn:xdaq-application:lid=4\" " .
0604         "-d @" . $dqm_wdir . "/soap/" . $cmd . ".xml " .
0605         "http://" . $host . ":" . $port;
0606 }