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