Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

JetWebLogReader Class Reference

Inheritance diagram for JetWebLogReader:

Inheritance graph
[legend]
Collaboration diagram for JetWebLogReader:

Collaboration graph
[legend]
List of all members.

Detailed Description

Uses JDOM API to read a JetWeb XML logfile. Produces a Logfile object

Author:
S Butterworth, UCL.
Version:
Date
2006-12-04 21:57:12 +0000 (Mon, 04 Dec 2006)
Revision
1328

Definition at line 29 of file JetWebLogReader.java.


Public Member Functions

 JetWebLogReader (String filename) throws JetWebXMLException
void fillLog (LogFile log) throws JetWebException

Static Public Member Functions

void main (String args[])

Protected Member Functions

Document getDocument ()
String getFileName ()

Protected Attributes

RunSeries runSeries_ = null

Static Protected Attributes

final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces"
final String VALIDATION_FEATURE_ID = "http://xml.org/sax/features/validation"
final String SCHEMA_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/schema"
final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking"
final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic"
final String LOAD_EXTERNAL_DTD_FEATURE_ID = "http://apache.org/xml/features/nonvalidating/load-external-dtd"
final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser"
final boolean DEFAULT_NAMESPACES = true
final boolean DEFAULT_VALIDATION = false
final boolean DEFAULT_LOAD_EXTERNAL_DTD = true
final boolean DEFAULT_SCHEMA_VALIDATION = false
final boolean DEFAULT_SCHEMA_FULL_CHECKING = false
final boolean DEFAULT_DYNAMIC_VALIDATION = false
final boolean DEFAULT_CANONICAL = false

Private Member Functions

void buildNamespace ()
Run fillRun (Element reaction, Element run) throws JetWebException
double crossSection (Element norm)
double lumi (Element norm)
Generator makeGenerator (Element settings) throws JetWebException
Collision fillCollision (Element collE) throws JetWebXMLException
void fillDoubleArrays (List< Element > aList, Generator generator) throws JetWebException
void fillIntArrays (List< Element > aList, Generator generator) throws JetWebException
void fillIntParams (List< Element > ipList, Generator generator) throws JetWebException
void fillDoubleParams (List< Element > dpList, Generator generator) throws JetWebException
HashMap< String, Object > procParams (Generator generator, Element settings) throws JetWebXMLException
String getParticleName (String pName)
void initParticleNames ()

Private Attributes

LogFile logfile = null
Element hepml = null
Namespace ns = null

Static Private Attributes

boolean zipped = true
String HEPDATA = "hepdata"
String HEPML = "hepml"
String SETTINGS = "generatorSettings"
String GENERATOR = "generator"
String RUN = "run"
String RUNSERIES = "runSeries"
String DARRAY = "doubleArray"
String IARRAY = "intArray"
String IMATRIX = "intMatrix"
String DPARAM = "doubleParameter"
String IPARAM = "intParameter"
String PDF = "pdf"
String ARRAYE = "arrayElement"
String MATRIXE = "matrixElement"
String NORM = "normalisation"
String LUMI = "luminosity"
String NEVENTS = "numberOfEvents"
String CX = "crossSection"
String PARTICLE = "particle"
String REACTION = "reaction"
String COLLISION = "collision"
String MOMENTUM = "momentum"
String COMMENT = "comment"
String ID = "id"
String DEFAULT_NS = "hep"
String DEFAULT_NS_URI
String PHOTON = "gamma"
String PROTON = "p"
String ANTIPROTON = "pbar"
String GAMMALEPTON = "gamma/e"
String GAMMAANTILEPTON = "gamma/e+"
boolean particleNameMapInit_ = true
HashMap< String, String > particleNameMap_

Constructor & Destructor Documentation

JetWebLogReader String  filename  )  throws JetWebXMLException
 

Definition at line 132 of file JetWebLogReader.java.

References JetWebLogReader.buildNamespace(), and JetWebLogReader.zipped.

Referenced by JetWebLogReader.main().

00132                                                                       {
00133     //be careful, this should be zipped
00134     super(filename,zipped);
00135     buildNamespace();
00136    }


Member Function Documentation

void buildNamespace  )  [private]
 

Definition at line 138 of file JetWebLogReader.java.

References JetWebLogReader.ns.

Referenced by JetWebLogReader.JetWebLogReader().

00138                                  {
00139     String nsPrefix = System.getProperty("hepdataNS");
00140     String nsUri = System.getProperty("hepdataNsURI");
00141     if (nsPrefix==null){
00142         nsPrefix=DEFAULT_NS;
00143     }
00144     if (nsUri==null){
00145         nsUri=DEFAULT_NS_URI;
00146     }
00147     ns = Namespace.getNamespace(nsPrefix,nsUri);
00148 
00149     }

double crossSection Element  norm  )  [private]
 

Definition at line 330 of file JetWebLogReader.java.

References JetWebLogReader.CX, JetWebLogReader.LUMI, JetWebLogReader.NEVENTS, and JetWebLogReader.ns.

Referenced by JetWebLogReader.fillRun(), and JetWebLogReader.lumi().

00330                                              {
00331 
00332     double cs = -1.0;
00333     boolean gotCS = false;
00334 
00335     if(norm!=null){
00336         String cross = norm.getChildTextTrim(CX, ns);
00337         if(cross!=null && !cross.equals("")){
00338         cs = Double.parseDouble(cross);
00339         gotCS = true;
00340         }else{
00341         String nevents = norm.getChildTextTrim(NEVENTS,ns);
00342         String lum = norm.getChildTextTrim(LUMI,ns);
00343 
00344         if(nevents!=null &&
00345            !nevents.equals("") &&
00346            lum!=null &&
00347            !lum.equals("")){
00348             Double l = (Double)Double.parseDouble(lum);
00349             double n = Double.parseDouble(nevents);
00350             
00351             if(!l.equals(0)){
00352             cs = n/l;
00353             gotCS = true;
00354             }
00355         }
00356         }
00357     }
00358 
00359     if(!gotCS){
00360         System.out.println
00361         ("Warning: cross section not specified for run!");
00362     }
00363     
00364     return cs;
00365     }

Collision fillCollision Element  collE  )  throws JetWebXMLException [private]
 

Definition at line 481 of file JetWebLogReader.java.

References Collision.addParticle(), JetWebLogReader.COLLISION, Collision.getId(), Collision.getNumberOfParticles(), JetWebLogReader.getParticleName(), JetWebLogReader.ID, JetWebLogReader.logfile, JetWebLogReader.MOMENTUM, JetWebLogReader.ns, and JetWebLogReader.PARTICLE.

Referenced by JetWebLogReader.fillRun().

00481                                                                              {
00482 
00483         Collision coll = new Collision();
00484 
00485     List<Element> pList = collE.getChild(COLLISION, ns).getChildren(PARTICLE,ns);
00486 
00487     if (pList==null||pList.size()==0) {
00488         throw new JetWebXMLException
00489         ("XMLLogReader; Collision has no particles",
00490          logfile.toString());
00491     }
00492 
00493     Iterator<Element> it = pList.iterator();
00494 
00495     while (it.hasNext()){
00496         Element eParticle = (Element)it.next();
00497         String name = getParticleName(eParticle.getAttributeValue("name"));
00498 
00499         Double energy = null;
00500         Particle particle = null;
00501         Integer pNumber = null;
00502         try {
00503         pNumber = new Integer(eParticle.getAttributeValue(ID));
00504         energy = new Double(eParticle.getChildTextTrim(MOMENTUM,ns));
00505             particle = new Particle(name,energy.doubleValue());
00506 
00507         } catch (NumberFormatException e){
00508 
00509         throw new JetWebXMLException
00510             (e+" LogFileReader: getParticle ",
00511              name+" energy <"+
00512              eParticle.getChildTextTrim(MOMENTUM,ns)+">");
00513         } catch (NullPointerException e){
00514         throw new JetWebXMLException
00515             (e+" LogFileReader: getParticle ",
00516              name+" energy <"+
00517              eParticle.getChildTextTrim(MOMENTUM,ns)+">");
00518         }
00519         try{
00520         coll.addParticle(particle, pNumber);
00521         }catch(JetWebException err){
00522         System.out.println(err.getMessage());
00523         throw new JetWebXMLException
00524             ("XMLLogReader: Badly defined particle in collision", 
00525              this.getFileName());
00526         }
00527     }
00528 
00529     if(coll.getNumberOfParticles()!=2){
00530         throw new JetWebXMLException
00531             ("XMLLogReader: Collision does not contain two particles", 
00532              this.getFileName());
00533     }
00534 
00535     if(coll.getId()==-1){
00536         throw new JetWebXMLException
00537             ("XMLLogReader: Collision is not present in Database", 
00538              this.getFileName());
00539     };
00540 
00541     return coll;
00542 
00543     }//fillCollision

void fillDoubleArrays List< Element >  aList,
Generator  generator
throws JetWebException [private]
 

Definition at line 546 of file JetWebLogReader.java.

References JetWebLogReader.ARRAYE, and JetWebLogReader.ns.

Referenced by JetWebLogReader.makeGenerator().

00547                           {
00548 
00549     if (aList==null) return;
00550     Iterator<Element> it = aList.iterator();
00551     while (it.hasNext()){
00552         Element eArray = it.next();
00553         String aName = eArray.getAttributeValue("name");
00554         Iterator<Element> eleIt = 
00555         eArray.getChildren(ARRAYE,ns).iterator();       
00556         if (generator.inModel(aName)||
00557         generator.inCuts(aName)){
00558         if (!generator.getRealParameterArrays().containsKey(aName)){
00559             generator.getRealParameterArrays().put
00560             (aName,new HashMap<Integer,Double>());
00561         }
00562         HashMap<Integer,Double> array = 
00563             generator.getRealParameterArrays().get(aName);
00564         while (eleIt.hasNext()){
00565             Element e = (Element)eleIt.next();
00566             Integer index = new Integer(e.getAttributeValue("index"));
00567             Double eVal = new Double(e.getTextTrim());
00568             if(generator.inModel(aName, index)||generator.inCuts(aName)){
00569             array.put(index,eVal);
00570             }
00571         }
00572         }
00573     }
00574 
00575     };

void fillDoubleParams List< Element >  dpList,
Generator  generator
throws JetWebException [private]
 

Definition at line 626 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator().

00627                           {
00628 
00629     if (dpList==null) return;
00630     Iterator<Element> it = dpList.iterator();
00631     while (it.hasNext()){
00632         Element dParam = it.next();
00633         String pName = dParam.getAttributeValue("name");
00634         Double pValue = new Double(dParam.getTextTrim());
00635         HashMap<String,Double> rParams = generator.getRealParameters();
00636 
00637         if (rParams.containsKey(pName)){
00638         // maybe be more severe about this?
00639         System.out.println("Warning. Multiply defined "+pName);
00640         rParams.remove(pName);
00641         }
00642 
00643         if (generator.inModel(pName)||generator.inCuts(pName)){
00644         rParams.put(pName,pValue);      
00645         }
00646     }
00647     }

void fillIntArrays List< Element >  aList,
Generator  generator
throws JetWebException [private]
 

Definition at line 577 of file JetWebLogReader.java.

References JetWebLogReader.ARRAYE, and JetWebLogReader.ns.

Referenced by JetWebLogReader.makeGenerator().

00578                           {
00579     if (aList==null) return;
00580     Iterator<Element> it = aList.iterator();
00581     while (it.hasNext()){
00582         Element eArray = it.next();
00583         String aName = eArray.getAttributeValue("name");        
00584         Iterator<Element> eleIt = eArray.getChildren(ARRAYE,ns).iterator();     
00585         if (generator.inModel(aName)){
00586         if (!generator.getIntParameterArrays().containsKey(aName)){
00587             generator.getIntParameterArrays().put(aName,new HashMap<Integer,Integer>());
00588         }
00589         HashMap<Integer,Integer> array = generator.getIntParameterArrays().get(aName);
00590         while (eleIt.hasNext()){
00591             Element e = eleIt.next();
00592             Integer index = new Integer(e.getAttributeValue("index"));
00593             Integer eVal = new Integer(e.getTextTrim());
00594             array.put(index,eVal);         
00595         }
00596         }       
00597     }
00598     }

void fillIntParams List< Element >  ipList,
Generator  generator
throws JetWebException [private]
 

Definition at line 601 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator().

00602                           {
00603 
00604     if (ipList==null) return;
00605     Iterator<Element> it = ipList.iterator();
00606     while (it.hasNext()){
00607         Element iParam = (Element)it.next();
00608         String pName = iParam.getAttributeValue("name");
00609         Integer pValue = new Integer(iParam.getTextTrim());
00610 
00611         HashMap<String,Integer> iParams = generator.getIntParameters();
00612         if (iParams.containsKey(pName)){
00613         // maybe be more severe about this?
00614         System.out.println("Warning. Multiply defined "+pName);
00615         iParams.remove(pName);
00616         }
00617 
00618         // Read in process params for now because some model params 
00619         // are only relevant to some processes
00620 
00621         //if (generator.inModel(pName)){
00622         iParams.put(pName,pValue);
00623         //}
00624     }
00625     }

void fillLog LogFile  log  )  throws JetWebException
 

Populates LogFile from an xml file containing hepdata element. This replaces the "findParms" method on LogFile which populated the LogFile from the job printout.

Definition at line 155 of file JetWebLogReader.java.

References RunSeries.addRun(), JetWebLogReader.fillRun(), RunSeries.getCrossSection(), JetWebXMLReader.getDocument(), JetWebXMLReader.getFileName(), RunSeries.getLumi(), JetWebLogReader.hepml, JetWebLogReader.HEPML, JetWebLogReader.logfile, JetWebLogReader.ns, JetWebLogReader.REACTION, JetWebLogReader.RUN, JetWebLogReader.RUNSERIES, JetWebLogReader.runSeries_, RunSeries.setCrossSection(), RunSeries.setLumi(), and ResultSearchPattern.setSoftDefaults().

Referenced by FileUploader.doModelUpload(), JobUtils.getLogFiles(), JobUtils.getNewData(), and JetWebLogReader.main().

00155                                                             {
00156     
00157     try { 
00158         logfile = log;  
00159         logfile.setValid(false);
00160         runSeries_ = logfile.getRunSeries();
00161         if (runSeries_==null) {
00162         System.out.println
00163            ("JetWebLogReader.fillLog: LogFile contains null runSeries");
00164         runSeries_ = new RunSeries();
00165         logfile.setRunSeries(runSeries_);
00166         }else{
00167         System.out.println
00168           ("JetWebLogReader.fillLog: LogFile already contains a runSeries");
00169         }
00170         
00171         Element root = getDocument().getRootElement();
00172 
00173         if(root.getName().equals(HEPML)){
00174         hepml = root;
00175         } else {
00176         //hepdata = root.getChild(HEPDATA,ns);
00177         hepml = root.getChild(HEPML, ns);
00178         if (hepml==null){
00179             throw new JetWebXMLException
00180             ("XML LogReader cannot find "
00181              +HEPML+" in "+root.getName(),getFileName());
00182             // +HEPDATA+" in "+root.getName(),getFileName());
00183         }
00184         }
00185         
00186         List<Element> runs = null;//new List<Element>();
00187         Element runSeries = null;
00188         Element reaction = null;
00189         
00190         try{
00191         reaction = hepml.getChild(REACTION, ns);
00192         //reaction  = (Element)hepml.getChildren().get(0);
00193         }catch (Exception e){
00194         throw new JetWebXMLException
00195             ("XML LogReader cannot find "+REACTION
00196              +" in "+root.getName(),getFileName());
00197         }
00198 
00199         try{
00200         runSeries = hepml.getChild(RUNSERIES, ns);
00201         }catch (Exception e){
00202         throw new JetWebXMLException
00203             ("XML LogReader cannot find "+RUNSERIES
00204              +" in "+root.getName(),getFileName());
00205         }
00206 
00207         try{
00208         runs = runSeries.getChildren(RUN, ns);
00209         System.out.println
00210             ("JetWebLogReader: found " + runs.size() +" runs");
00211         }catch (Exception e){
00212 
00213         throw new JetWebXMLException
00214             ("XML LogReader cannot find "+RUN
00215              +" in "+root.getName(),getFileName());
00216         }
00217 
00218         for(int ii=0; ii!= runs.size(); ++ii){
00219         runSeries_.addRun(fillRun(reaction, runs.get(ii)));
00220         }
00221         runSeries_.setSoftDefaults();
00222         // at this stage only the current log lumi is here.
00223         logfile.setLumi(runSeries_.getLumi());
00224         logfile.setCrossSection(runSeries_.getCrossSection());
00225 
00226         logfile.doChecks();
00227 
00228         //make sure LogReader xml file and Logfile xml file are same
00229         if (!this.getFileName().equals(logfile.getXmlFileName())){
00230         System.out.println
00231             ("LogReader Warning: xmlfile "+this.getFileName()
00232              + " different from logfile xmlfile " + 
00233              logfile.getXmlFileName() +
00234              " changing logfile version");
00235         logfile.setXmlFile(this.getFileName());
00236         }
00237 
00238     } catch (JetWebException jwe) {
00239         System.out.println
00240         ("JetWebLogReader: Problem reading "+log.getFile());
00241         System.out.println(jwe.getMessage());
00242         jwe.printStackTrace(System.out);
00243         logfile.setValid(false);
00244         logfile.setStatus(LogFile.ERROR);
00245     }   
00246     }

Run fillRun Element  reaction,
Element  run
throws JetWebException [private]
 

Fill a run from the run element in the logfile

Parameters:
Element the reaction element containing the collision settings
Element the Run element

Definition at line 255 of file JetWebLogReader.java.

References JetWebLogReader.ANTIPROTON, JetWebLogReader.crossSection(), JetWebLogReader.fillCollision(), JetWebLogReader.getParticleName(), JetWebLogReader.lumi(), JetWebLogReader.makeGenerator(), JetWebLogReader.NORM, JetWebLogReader.ns, JetWebLogReader.PARTICLE, JetWebLogReader.PDF, JetWebLogReader.PHOTON, JetWebLogReader.procParams(), JetWebLogReader.PROTON, Run.setCrossSection(), Run.setGenerator(), PDF.setIsPhoton(), PDF.setIsProton(), Run.setLumi(), Run.setMCProcessType(), Run.setPDF(), Run.setProcParams(), and JetWebLogReader.SETTINGS.

Referenced by JetWebLogReader.fillLog().

00256                           {
00257 
00258     Run runObj = new Run();
00259 
00260     Element settings = run.getChild(SETTINGS, ns);
00261     
00262     if(settings==null){
00263         throw new JetWebXMLException
00264         ("JetWebLogReader: No Generator settings", this.getFileName());
00265     }
00266 
00267     Generator generator = makeGenerator(settings);
00268     
00269     runObj.setGenerator(generator);
00270     Iterator<Element> pdfIt = settings.getChildren(PDF, ns).iterator();
00271 
00272     if(pdfIt==null){
00273         throw new JetWebXMLException
00274         ("JetWebLogReader: No PDFs", this.getFileName());
00275     }
00276 
00277     while(pdfIt.hasNext()){
00278         Element pdf = (Element)pdfIt.next();
00279         String particleName = 
00280         getParticleName(pdf.getChild(PARTICLE,ns).
00281                 getAttributeValue("name"));
00282         String pdfSet = pdf.getAttributeValue("set");
00283         String pdfM = pdf.getAttributeValue("member");
00284         String pdfScheme = pdf.getAttributeValue("scheme");
00285         if(particleName==null||
00286            pdfSet==null||
00287            pdfM==null||
00288            pdfScheme==null){
00289         throw new JetWebXMLException
00290             ("JetWebLogReader: Badly defined PDFs", 
00291              this.getFileName());
00292         }
00293 
00294         Integer pdfMember = null;
00295         if (pdfM!=null){
00296         pdfMember= new Integer(pdfM);
00297         }
00298         
00299         PDF pdfObj = new PDF(pdfMember);
00300 
00301         if(particleName.equals(PHOTON)){
00302         pdfObj.setIsPhoton();
00303         }else if(particleName.equals(PROTON) ||
00304              particleName.equals(ANTIPROTON)){
00305 
00306         pdfObj.setIsProton();
00307         }
00308 
00309         runObj.setPDF(pdfObj);
00310     }
00311 
00312     Element norm = run.getChild(NORM, ns);
00313 
00314     //runObj.setLumi(lumi(run));
00315     runObj.setLumi(lumi(norm));
00316     runObj.setCrossSection(crossSection(norm));
00317     runObj.setProcParams(procParams(generator, settings));
00318     try{
00319 
00320         runObj.setMCProcessType(fillCollision(reaction));
00321 
00322     }catch(JetWebException err){
00323         System.out.println(err.getMessage());
00324     }
00325 
00326     return(runObj);
00327     
00328     }

Document getDocument  )  [protected, inherited]
 

Definition at line 365 of file JetWebXMLReader.java.

Referenced by JetWebLogReader.fillLog(), and JetWebPlotMLReader.populateSoloPlot().

00365                                      {
00366     //if (doc==null) throw new JetWebXMLException("XML Reader not initialised: Document is null",null);
00367     return doc;
00368     }

String getFileName  )  [protected, inherited]
 

Definition at line 369 of file JetWebXMLReader.java.

Referenced by JetWebLogReader.fillLog().

00369                                     {
00370     //if (filename==null) throw new JetWebXMLException("XML Reader not initialised: No Filename provided",null);
00371     return filename;
00372     }

String getParticleName String  pName  )  [private]
 

Definition at line 717 of file JetWebLogReader.java.

References JetWebLogReader.initParticleNames(), and JetWebLogReader.particleNameMap_.

Referenced by JetWebLogReader.fillCollision(), and JetWebLogReader.fillRun().

00717                                                 {
00718     
00719     if(particleNameMapInit_) initParticleNames();
00720 
00721     String name = 
00722         particleNameMap_.get(pName);
00723 
00724     if(name==null) return pName;
00725 
00726     return name;
00727     }

void initParticleNames  )  [private]
 

Definition at line 729 of file JetWebLogReader.java.

References JetWebLogReader.ANTIPROTON, JetWebLogReader.GAMMAANTILEPTON, JetWebLogReader.GAMMALEPTON, JetWebLogReader.particleNameMap_, JetWebLogReader.particleNameMapInit_, and JetWebLogReader.PROTON.

Referenced by JetWebLogReader.getParticleName().

00729                                     {
00730     particleNameMapInit_ = false;
00731     particleNameMap_.put("p+", PROTON);
00732     particleNameMap_.put("pbar-", ANTIPROTON);
00733     particleNameMap_.put(GAMMALEPTON, "e-");
00734     particleNameMap_.put(GAMMAANTILEPTON, "e+");
00735     
00736     return;
00737     }

double lumi Element  norm  )  [private]
 

Definition at line 368 of file JetWebLogReader.java.

References JetWebLogReader.crossSection(), JetWebLogReader.CX, JetWebLogReader.LUMI, JetWebLogReader.lumi(), JetWebLogReader.NEVENTS, and JetWebLogReader.ns.

Referenced by JetWebLogReader.fillRun(), and JetWebLogReader.lumi().

00368                                      {
00369     double luminosity = 0.0;
00370     boolean gotLumi = false;
00371 
00372     //Element norm = settings.getChild(NORM,ns);
00373     
00374     if(norm!=null){
00375         
00376         String lumi = norm.getChildTextTrim(LUMI,ns);
00377         if (lumi!=null && !lumi.equals("")){
00378         
00379         luminosity += Double.parseDouble(lumi);
00380         gotLumi = true;
00381 
00382         }else{
00383         String nevents = norm.getChildTextTrim(NEVENTS,ns);
00384         String cx = norm.getChildTextTrim(CX,ns);
00385         
00386         if(nevents != null &&
00387            !nevents.equals("") &&
00388            !cx.equals("")){
00389             Double crossSection = (Double)Double.parseDouble(cx);
00390             int n = Integer.parseInt(nevents);
00391 
00392             if(!crossSection.equals(0)){
00393             luminosity+= n / crossSection;
00394             gotLumi = true;
00395             }
00396         }
00397         }
00398     }
00399 
00400     if(!gotLumi){
00401         System.out.println("Warning: zero luminosity for run!");
00402     }
00403     return(luminosity);
00404     }

void main String  args[]  )  [static]
 

test main method args[0] : xml filename

Definition at line 111 of file JetWebLogReader.java.

References JetWebLogReader.fillLog(), and JetWebLogReader.JetWebLogReader().

00111                                           {
00112     if (args[0]==null){
00113         System.out.println("Please give xml doc URI");
00114         return;
00115     }
00116 
00117     
00118     try {
00119         System.out.println("Converting to JDOM..");
00120         JetWebLogReader reader = new JetWebLogReader(args[0]);
00121         LogFile log = new LogFile(args[0]);
00122         reader.fillLog(log);
00123         System.out.println(log.toString());
00124 
00125 
00126     } catch (Throwable t) {
00127         System.err.println("Error reading XML");
00128         System.err.println(t.toString());
00129     } 
00130     }

Generator makeGenerator Element  settings  )  throws JetWebException [private]
 

Definition at line 406 of file JetWebLogReader.java.

References JetWebLogReader.DARRAY, JetWebLogReader.DPARAM, JetWebLogReader.fillDoubleArrays(), JetWebLogReader.fillDoubleParams(), JetWebLogReader.fillIntArrays(), JetWebLogReader.fillIntParams(), JetWebLogReader.GENERATOR, JetWebLogReader.IARRAY, JetWebLogReader.IPARAM, and JetWebLogReader.ns.

Referenced by JetWebLogReader.fillRun().

00407                           {
00408 
00409     Generator generator = null;
00410 
00411         String genName = 
00412         settings.getChild(GENERATOR, ns).getAttributeValue("name");
00413         
00414         String genVersion = 
00415         settings.getChild(GENERATOR,ns).getAttributeValue("version");
00416         
00417         if(genName==null||
00418            genVersion==null){
00419         throw new JetWebXMLException
00420             ("JetWebLogReader: Badly defined generator settings", 
00421              this.getFileName());
00422         }
00423 
00424         int ii = genVersion.indexOf(".");
00425         
00426         while(ii>-1){
00427         genVersion = 
00428             genVersion.substring(0,ii)+genVersion.substring(ii+1);
00429         ii = genVersion.indexOf(".");
00430         }
00431         try{
00432         generator = Generator.Maker(genName, genVersion);
00433         }catch(JetWebException err){
00434         System.out.println(err.getMessage());
00435         throw new JetWebXMLException
00436             ("JetWebLogReader: Badly defined generator settings", 
00437              this.getFileName());
00438         }
00439         List<Element> arg = settings.getChildren(DARRAY,ns);
00440         if(arg!=null){
00441         fillDoubleArrays(arg, generator);
00442         }else{
00443         throw new JetWebXMLException
00444             ("JetWebLogReader: Badly defined generator settings", 
00445              this.getFileName());
00446         }
00447 
00448         arg = settings.getChildren(IARRAY,ns);
00449 
00450         if(arg!=null){
00451         fillIntArrays(arg, generator);
00452         }else{
00453         throw new JetWebXMLException
00454             ("JetWebLogReader: Badly defined generator settings", 
00455              this.getFileName());
00456         }
00457 
00458         arg = settings.getChildren(DPARAM,ns);
00459 
00460         if(arg!=null){
00461         fillDoubleParams(arg, generator);
00462         }else{
00463         throw new JetWebXMLException
00464             ("JetWebLogReader: Badly defined generator settings", 
00465              this.getFileName());
00466         }
00467 
00468         arg = settings.getChildren(IPARAM,ns);
00469 
00470         if(arg!=null){
00471         fillIntParams(arg, generator);
00472         }else{
00473         throw new JetWebXMLException
00474             ("JetWebLogReader: Badly defined generator settings", 
00475              this.getFileName());
00476         }
00477 
00478     return(generator);
00479     }

HashMap<String, Object> procParams Generator  generator,
Element  settings
throws JetWebXMLException [private]
 

Definition at line 650 of file JetWebLogReader.java.

References JetWebLogReader.ARRAYE, JetWebLogReader.IARRAY, JetWebLogReader.IMATRIX, JetWebLogReader.IPARAM, JetWebLogReader.MATRIXE, and JetWebLogReader.ns.

Referenced by JetWebLogReader.fillRun().

00651                              {
00652 
00653     Iterator<Element> aIt = settings.getChildren(IARRAY, ns).iterator();
00654     Iterator<Element> iIt = settings.getChildren(IPARAM, ns).iterator();
00655     Iterator<Element> mIt = settings.getChildren(IMATRIX, ns).iterator();
00656 
00657     HashMap<String, Object > Params = 
00658         new HashMap<String, Object >();
00659 
00660     while(aIt.hasNext()){
00661         Element eArray = aIt.next();
00662         String aName = eArray.getAttributeValue("name");        
00663         Iterator<Element> eleIt = eArray.getChildren(ARRAYE,ns).iterator();
00664         
00665         if(generator.inProcessType(aName)){
00666         HashMap<Integer,Integer> array = new HashMap<Integer,Integer>();
00667         while(eleIt.hasNext()){
00668             Element e = eleIt.next();
00669             Integer index = new Integer(e.getAttributeValue("index"));
00670             Integer eVal = new Integer(e.getTextTrim());
00671             array.put(index, eVal);
00672         }
00673         Params.put(aName, array);
00674         }
00675     }
00676     
00677     while(iIt.hasNext()){
00678         Element iParam = (Element)iIt.next();
00679         String pName = iParam.getAttributeValue("name");
00680         Integer pValue = new Integer(iParam.getTextTrim());
00681         
00682         if (generator.inProcessType(pName)){
00683         //HashMap<Integer,Integer> map = new HashMap<Integer,Integer>();
00684         //map.put(new Integer(1),pValue);
00685         //Params.put(pName, map);
00686         Params.put(pName, pValue);
00687         }
00688     }
00689 
00690     while(mIt.hasNext()){
00691         Element eMatrix = (Element)mIt.next();
00692         String mName = eMatrix.getAttributeValue("name");
00693         Iterator<Element> matIt = 
00694         eMatrix.getChildren(MATRIXE,ns).iterator();
00695         if(generator.inProcessType(mName)){
00696         HashMap<Integer, HashMap<Integer, Integer>> matrix = 
00697             new HashMap<Integer, HashMap<Integer, Integer>>();
00698         while(matIt.hasNext()){
00699             Element e = matIt.next();
00700             Integer iindex = new Integer(e.getAttributeValue("iindex"));
00701             Integer jindex = new Integer(e.getAttributeValue("jindex"));
00702             Integer mValue = new Integer(e.getTextTrim());
00703             HashMap<Integer, Integer> row = matrix.get(iindex);
00704             if(row==null){
00705             row = new HashMap<Integer, Integer>();
00706             matrix.put(iindex, row);
00707             }
00708             row.put(jindex, mValue);
00709         }
00710         Params.put(mName, matrix);
00711         }
00712     }
00713 
00714     return(Params);
00715     };


Member Data Documentation

String ANTIPROTON = "pbar" [static, private]
 

Definition at line 96 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun(), and JetWebLogReader.initParticleNames().

String ARRAYE = "arrayElement" [static, private]
 

hepdata element tag

Definition at line 64 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillDoubleArrays(), JetWebLogReader.fillIntArrays(), and JetWebLogReader.procParams().

String COLLISION = "collision" [static, private]
 

hepdata element tag

Definition at line 79 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillCollision().

String COMMENT = "comment" [static, private]
 

hepdata element tag

Definition at line 83 of file JetWebLogReader.java.

String CX = "crossSection" [static, private]
 

hepdata element tag

Definition at line 73 of file JetWebLogReader.java.

Referenced by JetWebLogReader.crossSection(), and JetWebLogReader.lumi().

String DARRAY = "doubleArray" [static, private]
 

hepdata element tag

Definition at line 52 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator().

final boolean DEFAULT_CANONICAL = false [static, protected, inherited]
 

Default canonical output (false).

Definition at line 65 of file JetWebXMLReader.java.

final boolean DEFAULT_DYNAMIC_VALIDATION = false [static, protected, inherited]
 

Default dynamic validation support (false).

Definition at line 62 of file JetWebXMLReader.java.

final boolean DEFAULT_LOAD_EXTERNAL_DTD = true [static, protected, inherited]
 

Default load external DTD (true).

Definition at line 53 of file JetWebXMLReader.java.

final boolean DEFAULT_NAMESPACES = true [static, protected, inherited]
 

Default namespaces support (true).

Definition at line 47 of file JetWebXMLReader.java.

String DEFAULT_NS = "hep" [static, private]
 

hepdata namespace tag *

Definition at line 88 of file JetWebLogReader.java.

String DEFAULT_NS_URI [static, private]
 

Initial value:

 
    "http://www.cedar.ac.uk/xml/hepml"
hepdata namespace uri *

Definition at line 92 of file JetWebLogReader.java.

final String DEFAULT_PARSER_NAME = "org.apache.xerces.parsers.SAXParser" [static, protected, inherited]
 

Default parser name.

Definition at line 44 of file JetWebXMLReader.java.

final boolean DEFAULT_SCHEMA_FULL_CHECKING = false [static, protected, inherited]
 

Default Schema full checking support (false).

Definition at line 59 of file JetWebXMLReader.java.

final boolean DEFAULT_SCHEMA_VALIDATION = false [static, protected, inherited]
 

Default Schema validation support (false).

Definition at line 56 of file JetWebXMLReader.java.

final boolean DEFAULT_VALIDATION = false [static, protected, inherited]
 

Default validation support (false).

Definition at line 50 of file JetWebXMLReader.java.

String DPARAM = "doubleParameter" [static, private]
 

hepdata element tag

Definition at line 58 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator().

final String DYNAMIC_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/dynamic" [static, protected, inherited]
 

Dynamic validation feature id (http://apache.org/xml/features/validation/dynamic).

Definition at line 36 of file JetWebXMLReader.java.

String GAMMAANTILEPTON = "gamma/e+" [static, private]
 

Definition at line 98 of file JetWebLogReader.java.

Referenced by JetWebLogReader.initParticleNames().

String GAMMALEPTON = "gamma/e" [static, private]
 

Definition at line 97 of file JetWebLogReader.java.

Referenced by JetWebLogReader.initParticleNames().

String GENERATOR = "generator" [static, private]
 

hepdata element tag

Definition at line 46 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator().

String HEPDATA = "hepdata" [static, private]
 

hepdata element tag

Definition at line 40 of file JetWebLogReader.java.

String HEPML = "hepml" [static, private]
 

hepdata element tag

Definition at line 42 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

Element hepml = null [private]
 

Definition at line 32 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

String IARRAY = "intArray" [static, private]
 

hepdata element tag

Definition at line 54 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator(), and JetWebLogReader.procParams().

String ID = "id" [static, private]
 

hepdata element tag

Definition at line 85 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillCollision().

String IMATRIX = "intMatrix" [static, private]
 

hepdata element tag

Definition at line 56 of file JetWebLogReader.java.

Referenced by JetWebLogReader.procParams().

String IPARAM = "intParameter" [static, private]
 

hepdata element tag

Definition at line 60 of file JetWebLogReader.java.

Referenced by JetWebLogReader.makeGenerator(), and JetWebLogReader.procParams().

final String LOAD_EXTERNAL_DTD_FEATURE_ID = "http://apache.org/xml/features/nonvalidating/load-external-dtd" [static, protected, inherited]
 

Load external DTD feature id (http://apache.org/xml/features/nonvalidating/load-external-dtd).

Definition at line 39 of file JetWebXMLReader.java.

LogFile logfile = null [private]
 

Definition at line 31 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillCollision(), and JetWebLogReader.fillLog().

String LUMI = "luminosity" [static, private]
 

hepdata element tag

Definition at line 69 of file JetWebLogReader.java.

Referenced by JetWebLogReader.crossSection(), and JetWebLogReader.lumi().

String MATRIXE = "matrixElement" [static, private]
 

Definition at line 65 of file JetWebLogReader.java.

Referenced by JetWebLogReader.procParams().

String MOMENTUM = "momentum" [static, private]
 

hepdata element tag

Definition at line 81 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillCollision().

final String NAMESPACES_FEATURE_ID = "http://xml.org/sax/features/namespaces" [static, protected, inherited]
 

Namespaces feature id (http://xml.org/sax/features/namespaces).

Definition at line 24 of file JetWebXMLReader.java.

String NEVENTS = "numberOfEvents" [static, private]
 

hepdata element tag

Definition at line 71 of file JetWebLogReader.java.

Referenced by JetWebLogReader.crossSection(), and JetWebLogReader.lumi().

String NORM = "normalisation" [static, private]
 

hepdata element tag

Definition at line 67 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun().

Namespace ns = null [private]
 

Definition at line 34 of file JetWebLogReader.java.

Referenced by JetWebLogReader.buildNamespace(), JetWebLogReader.crossSection(), JetWebLogReader.fillCollision(), JetWebLogReader.fillDoubleArrays(), JetWebLogReader.fillIntArrays(), JetWebLogReader.fillLog(), JetWebLogReader.fillRun(), JetWebLogReader.lumi(), JetWebLogReader.makeGenerator(), and JetWebLogReader.procParams().

String PARTICLE = "particle" [static, private]
 

hepdata element tag

Definition at line 75 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillCollision(), and JetWebLogReader.fillRun().

HashMap<String, String> particleNameMap_ [static, private]
 

Initial value:

 
    new HashMap<String String>()

Definition at line 101 of file JetWebLogReader.java.

Referenced by JetWebLogReader.getParticleName(), and JetWebLogReader.initParticleNames().

boolean particleNameMapInit_ = true [static, private]
 

Definition at line 100 of file JetWebLogReader.java.

Referenced by JetWebLogReader.initParticleNames().

String PDF = "pdf" [static, private]
 

hepdata element tag

Definition at line 62 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun().

String PHOTON = "gamma" [static, private]
 

Definition at line 94 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun().

String PROTON = "p" [static, private]
 

Definition at line 95 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun(), and JetWebLogReader.initParticleNames().

String REACTION = "reaction" [static, private]
 

hepdata element tag

Definition at line 77 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

String RUN = "run" [static, private]
 

hepdata element tag

Definition at line 48 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

String RUNSERIES = "runSeries" [static, private]
 

hepdata element tag

Definition at line 50 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

RunSeries runSeries_ = null [protected]
 

Definition at line 35 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillLog().

final String SCHEMA_FULL_CHECKING_FEATURE_ID = "http://apache.org/xml/features/validation/schema-full-checking" [static, protected, inherited]
 

Schema full checking feature id (http://apache.org/xml/features/validation/schema-full-checking).

Definition at line 33 of file JetWebXMLReader.java.

final String SCHEMA_VALIDATION_FEATURE_ID = "http://apache.org/xml/features/validation/schema" [static, protected, inherited]
 

Schema validation feature id (http://apache.org/xml/features/validation/schema).

Definition at line 30 of file JetWebXMLReader.java.

String SETTINGS = "generatorSettings" [static, private]
 

hepdata element tag

Definition at line 44 of file JetWebLogReader.java.

Referenced by JetWebLogReader.fillRun().

final String VALIDATION_FEATURE_ID = "http://xml.org/sax/features/validation" [static, protected, inherited]
 

Validation feature id (http://xml.org/sax/features/validation).

Definition at line 27 of file JetWebXMLReader.java.

boolean zipped = true [static, private]
 

input xmlfiles are .gz

Definition at line 38 of file JetWebLogReader.java.

Referenced by JetWebLogReader.JetWebLogReader().


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007