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