File indexing completed on 2024-04-06 12:08:42
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 use File::Copy;
0014
0015
0016 print "\n============================================================";
0017 print "\ninitialize ...";
0018 print "\n============================================================\n";
0019
0020
0021
0022 chop(my $hostname = `hostname -f`);
0023
0024
0025 my $port = 40000;
0026
0027 my $appname="evf::FUEventProcessor";
0028
0029 my $localid=27;
0030
0031 my $libpath = getLibraryPath("EventFilter/Processor");
0032
0033 my $libname = "libEventFilterProcessor.so";
0034
0035 my $pwd = `pwd`; chomp $pwd;
0036
0037
0038 my $dqm_dir = $ENV{"CMSSW_BASE"}."/src/DQM/SiStripMonitorClient/test";
0039
0040 my $dqm_common = $ENV{"CMSSW_BASE"}."/src/DQM/TrackerCommon/test";
0041
0042
0043
0044
0045 my $mode = $ARGV[0];
0046 my $cfg_file = "source_client_".$mode.".cfg";
0047 print "cfg file name : $cfg_file\n";
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060 print "hostname = $hostname\n";
0061
0062
0063
0064
0065 print "make directories ...\n";
0066 `mkdir -p log`;
0067 `mkdir -p soap`;
0068 `mkdir -p xml`;
0069
0070
0071
0072
0073 print "copy cfg files ...\n";
0074
0075 copy("$dqm_dir/$cfg_file", "$ENV{PWD}/$cfg_file");
0076
0077
0078
0079
0080
0081 copy("$dqm_dir/../data/sistrip_qualitytest_config.xml", "$ENV{PWD}/.");
0082
0083
0084
0085
0086
0087 print "make xdaq profile ...\n";
0088
0089 my @EXproperties = ("logUrl", "string","console",
0090 "logLevel","string","INFO");
0091
0092
0093 my @Pathproperties = ("documentRoot", "string",$ENV{"XDAQ_DOCUMENT_ROOT"},
0094 "aliasName", "string","temporary",
0095 "aliasPath","string",$ENV{"PWD"});
0096
0097 open (XML,">./xml/profile.xml") or die ("Can't open file: $!\n");
0098 print XML makeXmlHeader();
0099 print XML makeXmlProfileHeader();
0100 print XML makeXmlAppHeader(0,"executive::Application",0);
0101 print XML makeXmlAppProperties("Executive",@EXproperties);
0102 print XML makeXmlAppTrailer(0,$ENV{"XDAQ_ROOT"}."/lib","libexecutive.so");
0103 print XML makeXmlAppHeader(0,"pt::http::PeerTransportHTTP",1);
0104 print XML makeXmlAppProperties("pt::http::PeerTransportHTTP",@Pathproperties);
0105 print XML makeXmlAppTrailer(0,$ENV{"XDAQ_ROOT"}."/lib","libpthttp.so");
0106 print XML makeXmlAppHeader(0,"pt::fifo::PeerTransportFifo",8);
0107 print XML makeXmlAppTrailer(0,$ENV{"XDAQ_ROOT"}."/lib","libptfifo.so");
0108 print XML makeXmlAppHeader(0,"xrelay::Application",4);
0109 print XML makeXmlAppTrailer(0,$ENV{"XDAQ_ROOT"}."/lib","libxrelay.so");
0110 print XML makeXmlAppHeader(0,"hyperdaq::Application",3);
0111 print XML makeXmlAppTrailer(0,$ENV{"XDAQ_ROOT"}."/lib","libhyperdaq.so");
0112 print XML makeXmlProfileTrailer();
0113
0114
0115
0116
0117
0118
0119 print "make xdaq configuration ...\n";
0120
0121 my @properties = ("parameterSet", "string","file:$pwd/$cfg_file",
0122 "collReconnSec","integer","-1",
0123 "hasPrescaleService","boolean","false",
0124 "isRunNumberSetter","boolean","false",
0125 "hasSharedMemory","boolean","false");
0126
0127 open (XML,">./xml/evf.xml") or die ("Can't open file: $!\n");
0128 print XML makeXmlHeader();
0129 print XML makeXmlPartitionHeader();
0130 print XML makeXmlComm(@apps);
0131
0132
0133 print XML makeXmlContextHeader("DQM",$hostname,$port);
0134 print XML makeXmlAppHeader(1,$appname,$localid);
0135 print XML makeXmlAppProperties($appname,@properties);
0136 print XML makeXmlAppTrailer(1,$libpath,$libname);
0137 print XML makeXmlContextTrailer();
0138
0139
0140 print XML makeXmlPartitionTrailer();
0141 close (XML);
0142
0143
0144
0145
0146
0147 print "make soap command files ...\n";
0148
0149 my @commands = ('Configure','Enable','Stop','Halt' );
0150
0151 foreach (@commands) {
0152 open(CMD,">./soap/$_".".xml") or die ("Can't open file: $!\n");
0153 print CMD makeSoapCommand($hostname,$port,$localid,$_);
0154 close(CMD);
0155 }
0156
0157
0158
0159
0160
0161 print "make control scripts ...\n";
0162
0163
0164 open (CTL,">configure") or die ("Can't open file: $!\n");
0165 print CTL "#!/usr/bin/perl\n\n";
0166 print CTL makeCtlCommand("Configure",$appname,"DQM",$hostname,$port,0,"source");
0167
0168 close (CTL);
0169 `chmod +x configure`;
0170
0171
0172 open (CTL,">enable") or die ("Can't open file: $!\n");
0173 print CTL "#!/usr/bin/perl\n\n";
0174 print CTL makeCtlCommand("Enable",$appname,"DQM",$hostname,$port,0,"source");
0175
0176 close (CTL);
0177 `chmod +x enable`;
0178
0179
0180 open (CTL,">stop") or die ("Can't open file: $!\n");
0181 print CTL "#!/usr/bin/perl\n\n";
0182 print CTL makeCtlCommand("Stop",$appname,"DQM",$hostname,$port,5,"source");
0183
0184 close (CTL);
0185 `chmod +x stop`;
0186
0187
0188 open (CTL,">halt") or die ("Can't open file: $!\n");
0189 print CTL "#!/usr/bin/perl\n\n";
0190 print CTL makeCtlCommand("Halt",$appname,"DQM",$hostname,$port,1,"source");
0191
0192 close (CTL);
0193 `chmod +x halt`;
0194
0195
0196 open (CTL,">destroy") or die ("Can't open file: $!\n");
0197 print CTL makeCtlDestroy();
0198 close (CTL);
0199 `chmod +x destroy`;
0200
0201
0202
0203
0204 copy("$dqm_dir/.WebLib.js", "$ENV{PWD}/WebLib.js");
0205 copy("$dqm_dir/Online.html", "$ENV{PWD}/.");
0206 copy("$dqm_dir/loader.html", "$ENV{PWD}/.");
0207 copy("$dqm_dir/TrackerMapFrame.html", "$ENV{PWD}/.");
0208 copy("$dqm_dir/TrackerMapSelection.html", "$ENV{PWD}/.");
0209 copy("$dqm_dir/TrackerMapPlot.html", "$ENV{PWD}/.");
0210
0211 $SERVED_DIR="http://$hostname:40000/temporary";
0212 system , , , ;
0213
0214 system , , , ;
0215 system , , , ;
0216 system , , , ;
0217 copy("$dqm_dir/js_files/CommonActions.js", "$ENV{PWD}/js_files/CommonActions.js");
0218 copy("$dqm_dir/js_files/RequestHistos.js", "$ENV{PWD}/js_files/RequestHistos.js");
0219 copy("$dqm_dir/js_files/sistrip_svgmap.js", "$ENV{PWD}/js_files/sistrip_svgmap.js");
0220 copy("$dqm_dir/css_files/style.css", "$ENV{PWD}/css_files/style.css");
0221
0222
0223
0224
0225
0226
0227
0228 open OUTPUT, ">start" or die($!);
0229 my $script=<<"EOS";
0230
0231
0232 xdaq.exe -h $hostname -p $port -e xml/profile.xml -c xml/evf.xml
0233 EOS
0234 print OUTPUT $script;
0235 close OUTPUT;
0236 `chmod +x start`;
0237
0238
0239
0240
0241
0242
0243
0244
0245
0246
0247
0248 sub getLibraryPath
0249 {
0250 my ($pkg) = (@_);
0251
0252 my $cmssw_base = $ENV{"CMSSW_BASE"};
0253 my $cmssw_release_base = $ENV{"CMSSW_RELEASE_BASE"};
0254
0255 my $result = "/lib/" . $ENV{"SCRAM_ARCH"};
0256
0257 if (-e "$cmssw_base/src/$pkg") {
0258 $result = $cmssw_base . $result;
0259 }
0260 else {
0261 $result = $cmssw_release_base . $result;
0262 }
0263 print "\n Result of Lib Path $result\n";
0264 return $result;
0265 }
0266
0267
0268 sub makeSoapCommand
0269 {
0270 my ($hostname,$port,$localid,$command) = @_;
0271
0272 my $result="";
0273
0274 $result = $result . "<SOAP-ENV:Envelope\n";
0275 $result = $result . " SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0276 $result = $result . " xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n";
0277 $result = $result . " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0278 $result = $result . " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n";
0279 $result = $result . " xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\">\n\n";
0280 $result = $result . "<SOAP-ENV:Header>\n";
0281 $result = $result . " <xr:relay SOAP-ENV:actor=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XRelay-10\"\n";
0282 $result = $result . " xmlns:xr=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XRelay-10\">\n";
0283 $result = $result . " <xr:to url=\"http://$hostname:$port\" urn=\"urn:xdaq-application:lid=$localid\"/>\n";
0284 $result = $result . "</xr:relay>\n";
0285 $result = $result . "</SOAP-ENV:Header>\n\n";
0286 $result = $result . "<SOAP-ENV:Body>\n";
0287 $result = $result . " <xdaq:$command xmlns:xdaq=\"urn:xdaq-soap:3.0\"></xdaq:$command>\n";
0288 $result = $result . "</SOAP-ENV:Body>\n\n";
0289 $result = $result . "</SOAP-ENV:Envelope>\n";
0290
0291 return $result;
0292 }
0293
0294
0295
0296
0297
0298
0299 sub makeXmlHeader
0300 {
0301 my $result = "";
0302
0303 return "<?xml version='1.0'?>\n\n";
0304 $result = $result . "<xc:Partition\n";
0305 $result = $result . " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0306 $result = $result . " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0307 $result = $result . " xmlns:xc=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30\">\n\n";
0308
0309 return $result;
0310 }
0311
0312
0313
0314 sub makeXmlPartitionHeader
0315 {
0316 my $result = "";
0317
0318 $result = $result . "<xc:Partition\n";
0319 $result = $result . " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n";
0320 $result = $result . " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n";
0321 $result = $result . " xmlns:xc=\"http://xdaq.web.cern.ch/xdaq/xsd/2004/XMLConfiguration-30\">\n\n";
0322
0323 return $result;
0324 }
0325
0326
0327
0328 sub makeXmlProfileHeader
0329 {
0330 return
0331 "<xp:Profile\n" .
0332 " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" .
0333 " xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" .
0334 " xmlns:xp=\"http://xdaq.web.cern.ch/xdaq/xsd/2005/XMLProfile-10\">\n\n";
0335 }
0336
0337
0338
0339 sub makeXmlComm
0340 {
0341 my $result = "";
0342
0343 $result = $result . " <!-- communication protocoll -->\n";
0344 $result = $result . " <i2o:protocol xmlns:i2o=" .
0345 "\"http://xdaq.web.cern.ch/xdaq/xsd/2004/I2OConfiguration-30\">\n";
0346
0347 while (@_>0) {
0348 my $appname = shift (@_);
0349 my $localid = shift (@_);
0350 $result = $result . " <i2o:target class=\"" . $appname .
0351 "\" instance=\"0\" tid=\"" . $localid . "\"/>\n";
0352 }
0353 $result = $result . " </i2o:protocol>\n\n";
0354
0355 return $result;
0356 }
0357
0358
0359
0360 sub makeXmlContextHeader
0361 {
0362 my ($contextname,$hostname,$port) = @_;
0363
0364 my $result = "";
0365
0366 $result = $result . "<!-- " . $contextname . " CONTEXT -->\n";
0367 $result = $result . " <xc:Context url=\"http://$hostname:$port\">\n\n";
0368
0369 return $result;
0370 }
0371
0372
0373
0374
0375 sub makeXmlEndpoint
0376 {
0377 my ($hostname,$port) = @_;
0378
0379 my $result = "";
0380 $result = $result . " <xc:Endpoint hostname=\"" . $hostname .
0381 "\" network=\"tcp0\" " .
0382 "port=\"" .$port . "\" protocol=\"tcp\" " .
0383 "service=\"i2o\"></xc:Endpoint>\n\n";
0384 return $result;
0385 }
0386
0387
0388
0389 sub makeXmlAppHeader
0390 {
0391 my ($inContext,$appname,$localid) = @_;
0392
0393 my $ns = "xc"; if (!$inContext) { $ns = "xp"; }
0394
0395 my $result = " <$ns:Application class=\"" . $appname .
0396 "\" id=\"" . $localid . "\" instance=\"0\" network=\"local\">\n";
0397 return $result;
0398 }
0399
0400
0401
0402 sub makeXmlAppProperties
0403 {
0404 my $result = "";
0405
0406 my $appname = shift (@_);
0407
0408 $result = $result . " <properties xmlns=\"urn:xdaq-application:" . $appname .
0409 "\" xsi:type=\"soapenc:Struct\">\n";
0410 while (@_>0) {
0411 my $name = shift (@_);
0412 my $type = shift (@_);
0413 my $value = shift (@_);
0414 $result = $result . " <" . $name . " xsi:type=\"xsd:" . $type . "\">" . $value . "</" . $name . ">\n";
0415 }
0416 $result = $result . " </properties>\n";
0417
0418 return $result;
0419 }
0420
0421
0422
0423 sub makeXmlUnicast
0424 {
0425 my ($appname) = (@_);
0426 return " <xc:Unicast class=\"" . $appname . "\" network=\"tcp0\"></xc:Unicast>\n";
0427 }
0428
0429
0430
0431 sub makeXmlAppTrailer
0432 {
0433 my ($inContext,$libpath,$libname) = @_;
0434
0435 my $ns = "xc"; if (!$inContext) { $ns = "xp"; }
0436
0437 my $result = "";
0438
0439 $result = $result . " </$ns:Application>\n";
0440 $result = $result . " <$ns:Module>" . $libpath .
0441 "/" . $libname . "</$ns:Module>\n\n";
0442
0443 return $result;
0444 }
0445
0446
0447
0448 sub makeXmlContextTrailer
0449 {
0450 return " </xc:Context>\n\n\n";
0451 }
0452
0453
0454
0455 sub makeXmlProfileTrailer
0456 {
0457 return "</xp:Profile>\n";
0458 }
0459
0460
0461
0462 sub makeXmlPartitionTrailer
0463 {
0464 return "</xc:Partition>\n";
0465 }
0466
0467
0468
0469 sub makeCtlDestroy
0470 {
0471 my $result = "";
0472
0473 my $cmd = "killall xdaq.exe";
0474
0475 $result = $result . "#!/usr/bin/perl\n\n";
0476 $result = $result . "print \"$cmd ...\\n\";\n\n";
0477 $result = $result . "`$cmd`;\n\n";
0478 $result = $result . "print \"remove files and dirs ...\n\";\n\n";
0479 $result = $result . "`rm -rf soap/ xml/ log/ /tmp/sm "
0480 . "start configure enable halt stop gennums.txt"
0481 . " summaryCatalog.txt test.root`;\n\n";
0482 $result = $result . "`rm -rf sistrip\*.cfg sistrip_qualitytest_config.xml`;\n\n";
0483 $result = $result . "`rm -rf Online.html loader.html "
0484 . " TrackerMapFrame.html TrackerMapPlot.html TrackerMapSelection.html "
0485 . " fedtrackermap.html "
0486 . " css_files js_files images WebLib.js `;\n\n";
0487 $result = $result . "`rm -rf svgmap.xml svgmap_fed.xml Layer\*.xml \*.png`;\n\n";
0488 $result = $result . "print \"FUShmCleanUp_t ...\\n\";\n\n";
0489 $result = $result . "`FUShmCleanUp_t`;\n\n";
0490 $result = $result . "print \"XDAQ session destroyed!\\n\";\n\n";
0491 $result = $result . "`rm destroy`;\n";
0492
0493 return $result;
0494 }
0495
0496
0497
0498 sub makeCtlCommand
0499 {
0500 my ($cmd,$appname,$appabrev,$host,$port,$sleep,$param) = (@_);
0501
0502 my $result = "";
0503
0504 $result = $result."print \"\\n===============================================\";\n";
0505 $result = $result."print \"\\n$cmd the $appname ($appabrev)...\";\n";
0506 $result = $result."print \"\\n\===============================================\";\n";
0507 $result = $result."my \$result = `".makeCurlCommand($cmd,$appabrev,$host,$port)."`;\n";
0508 $result = $result."print \"\\n\$result\\n\\n\";\n";
0509 if ($sleep>0){
0510 $result = $result . "\n\t`sleep $sleep`;\n";
0511 }
0512
0513 return $result;
0514 }
0515
0516
0517
0518 sub makeCurlCommand
0519 {
0520 my ($cmd,$appabrev,$host,$port) = @_;
0521 my $pwd = `pwd`; chomp($pwd);
0522 return
0523 "curl --stderr /dev/null -H " .
0524 "\"SOAPAction: urn:xdaq-application:lid=4\" " .
0525 "-d @" . $pwd . "/soap/" . $cmd . ".xml " .
0526 "http://" . $host . ":" . $port;
0527 }