Warning, /Fireworks/Macros/makeProxyBuilder is written in an unsupported language. File is not indexed.
0001 #!/usr/bin/env perl
0002 # Author: D.Kovalskyi
0003
0004 use warnings;
0005
0006 $CLASSNAME = '';
0007 $TYPE = '';
0008 $PURPOSE = '';
0009 $HELP = 0;
0010
0011
0012 #-------------------------------------------------------------------------------
0013 # Parse command-line arguments
0014
0015 while ($#ARGV >= 0 and $ARGV[0] =~ m/^--([-\w]+)(?:=(.+))?$/)
0016 {
0017 my $var = uc $1;
0018 my $val = defined $2 ? $2 : 1;
0019 $var =~ s/-/_/g;
0020 eval("\$$var = '$val';");
0021 shift @ARGV;
0022 }
0023
0024 if ($HELP or $#ARGV < 0 or $#ARGV > 0)
0025 {
0026 print STDERR <<"FNORD";
0027 usage: $0 [OPTIONS] classname
0028
0029 classname - class-name to use, also file-name
0030
0031 OPTIONS
0032
0033 --help describe command and arguments
0034
0035 --type=<string> data collection type
0036 --purpose=<string> purpose of proxy builer
0037 FNORD
0038 exit 1;
0039 }
0040
0041 $CLASSNAME = shift;
0042 $now_string = gmtime();
0043 #-------------------------------------------------------------------------------
0044 # Ask for arguments that were not given as options
0045
0046 if ($TYPE eq "")
0047 {
0048 print "\nA data proxy builder maps a data collection of the form std::vector<T>\n",
0049 "to a collection of TEveElements - ROOT graphical primitives.\n",
0050 "What is the data type(T) type you want to read: ";
0051 $TYPE = <STDIN>;
0052 $TYPE =~ s/\n//;
0053 }
0054
0055 if ($PURPOSE eq "")
0056 {
0057 print "\nProxy builders for various views with the same input data types are grouped\n",
0058 "by their \"purpose\". For example reco::Track collections can be \"Tracks\",\n",
0059 "\"GlobalMuons\", \"rsTracks\" etc. If you choose one of the existing names like\n",
0060 "\"Muons\" or \"Electrons\", output of your new proxy builder will be associated to\n",
0061 "to all other products created by other proxies for this \"purpose\".\n";
0062 print "What is the \"purpose\" of the new proxy builder? ";
0063 $PURPOSE = <STDIN>;
0064 $PURPOSE =~ s/\n//;
0065 }
0066
0067 #-------------------------------------------------------------------------------
0068 # Output the file
0069
0070 my $output = "${CLASSNAME}.cc";
0071
0072 open (OUT, ">$output") or die "Cannot write to file $output\n$!\n";
0073
0074 print OUT <<"FNORD";
0075 // -*- C++ -*-
0076 //
0077 // Package: Fireworks
0078 // Class : $CLASSNAME
0079
0080 /*
0081
0082 Description: [one line class summary]
0083
0084 Usage:
0085 <usage>
0086
0087 */
0088 //
0089 // Original Author:
0090 // Created: $now_string
0091 //
0092 //
0093
0094 // system include files
0095
0096 // user include files
0097 #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h"
0098 #include "TEvePointSet.h"
0099
0100 // forward declarations
0101
0102 class $CLASSNAME : public FWSimpleProxyBuilderTemplate<$TYPE> {
0103 public:
0104 $CLASSNAME();
0105 virtual ~$CLASSNAME();
0106
0107 // ---------- const member functions ---------------------
0108
0109 // ---------- static member functions --------------------
0110
0111 // ---------- member functions ---------------------------
0112
0113 REGISTER_PROXYBUILDER_METHODS();
0114
0115 private:
0116 $CLASSNAME(const $CLASSNAME&); // stop default
0117 const $CLASSNAME& operator=(const $CLASSNAME&); // stop default
0118
0119 void build(const $TYPE&, unsigned int, TEveElement&, const FWViewContext*);
0120
0121 // ---------- member data --------------------------------
0122 };
0123
0124 //
0125 // constructors and destructor
0126 //
0127 ${CLASSNAME}::${CLASSNAME}()
0128 {
0129 }
0130
0131 ${CLASSNAME}::~${CLASSNAME}()
0132 {
0133 }
0134
0135 //
0136 // member functions
0137 //
0138 void
0139 ${CLASSNAME}::build(const $TYPE& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext*)
0140 {
0141 //// Just an example that creates a bunch of points
0142 // TEvePointSet* pointSet = new TEvePointSet();
0143 // pointSet->SetNextPoint( iData.x(), iData.y(), iData.z() );
0144 // setupAddElement(pointSet, &oItemHolder);
0145 }
0146
0147 //
0148 // const member functions
0149 //
0150
0151 //
0152 // static member functions
0153 //
0154
0155 REGISTER_FWPROXYBUILDER($CLASSNAME, $TYPE, "$PURPOSE", FWViewType::kAll3DBits | FWViewType::kAllRPZBits);
0156 FNORD
0157
0158 close OUT;
0159
0160 print "\nFile $output is created.\n",
0161 "Please add necessary include files to read the data type you selected\n",
0162 "and provide code that builds graphical representation of your data.\n",
0163 "When you done, compile your code by typing \"make\"\n";
0164