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

Run.java

Go to the documentation of this file.
00001 
00002 package cedar.jetweb.model;
00003 
00004 import java.util.HashMap;
00005 import cedar.jetweb.model.MCProcessType;
00006 import cedar.jetweb.model.Collision;
00007 import cedar.jetweb.generator.Generator;
00008 import cedar.jetweb.JetWebException;
00009 import cedar.jetweb.JetWebConfig;
00010 
00020 public class Run{
00021 
00022     private MCProcessType proc_ = new MCProcessType();
00023     private double lumi_=0.0;
00024     private double crossSection_ = -1.0;
00025 
00026     //private HashMap<String, HashMap<Integer, Integer>>procParameters_
00027     //= new HashMap<String, HashMap<Integer, Integer>>();
00028 
00029     private HashMap<String, Object> procParameters_
00030     = new HashMap<String, Object>();
00031 
00032     private Generator generator_;
00033 
00034     private PDF photonPDF_;
00035     private PDF protonPDF_;
00036     private PDF pionPDF_;
00037 
00038     private static String SCHEME_PDFLIB="PDFLIB";
00039     private static String SCHEME_LHAPDF="LHAPDF";
00040     private static String PROTON="gamma";
00041     private static String PHOTON="p";
00042     private static String ANTIPROTON="pbar";
00043 
00049     public Run setProcParams
00050     //(HashMap<String, HashMap<Integer, Integer>> arg){
00051     (HashMap<String, Object> arg){
00052     //System.out.println("procParams = "+arg);
00053     procParameters_ = arg;
00054     return(this);
00055     }
00056 
00064     public Run setMCProcessType(Collision collision)
00065     throws JetWebException{
00066     
00067     if(proc_==null) proc_ = new MCProcessType();
00068 
00069     proc_.setCollision(collision);
00070     proc_.setMCProcessName(generator_.getMCProcessName(procParameters_));
00071     proc_.getId();
00072     
00073     return(this);
00074     }
00075 
00076 
00081     public Run setMCProcessType(MCProcessType proc){
00082     proc_ = proc;
00083     return(this);
00084     };
00085 
00090     public MCProcessType getMCProcessType(){
00091     return(proc_);
00092     };
00093 
00098     public Run setCrossSection(double cs){
00099     crossSection_ = cs;
00100     return this;
00101     }
00102 
00103     public Double getCrossSection(){
00104     return crossSection_;
00105     }
00106 
00107 
00112     public Run setLumi(double lumi){
00113     lumi_ = lumi;
00114     return(this);
00115     };
00116 
00117 
00122     public double getLumi(){
00123     return(lumi_);
00124     };
00125 
00130     public Run setGenerator(Generator generator){
00131     generator_ = generator;
00132     return(this);
00133     };
00134 
00139     public Generator getGenerator(){
00140     return(generator_);
00141     };
00142 
00143 
00149     public Run setPDF(PDF pdf){
00150 
00151     //System.out.println("setting pdf in run");
00152 
00153     //System.out.println("pdf = "+pdf.getName());
00154        
00155     //System.out.println("pdf.isPhoton() = "+pdf.isPhoton());
00156     //System.out.println("pdf.isProton() = "+pdf.isProton());
00157 
00158     if(pdf.isPhoton()) photonPDF_ = pdf;
00159     if(pdf.isProton()) protonPDF_ = pdf;
00160     if(pdf.isPion())   pionPDF_ = pdf;
00161 
00162     return this;
00163     }
00164 
00165     public PDF getProtonPDF(){
00166     return(protonPDF_);
00167     }
00168 
00169     public PDF getPhotonPDF(){
00170     return(photonPDF_);
00171     }
00172 
00173     public PDF getPionPDF(){
00174     return pionPDF_;
00175     };
00176 
00177     /*
00178      * This needs more work!
00179      * Compares 2 runs for consistency.
00180      * Might want it to return a run with the shared consistent generator 
00181      * rather than a boolean as it does at the moment.
00182      * Also, pdfs don't necessarily have to be the same if they are irrelevent
00183      * (e.g. doesn't matter if photon pdfs are different at the Tevatron)
00184      */
00185 
00186     public boolean isConsistentWith(Run run){
00187 
00188     boolean sameProtonPDF = false;
00189     sameProtonPDF = protonPDF_==null || 
00190         run.getProtonPDF()==null;
00191     
00192     if(!sameProtonPDF &&
00193        protonPDF_.equals(run.getProtonPDF())) sameProtonPDF = true;
00194     
00195     boolean samePhotonPDF = false;
00196     samePhotonPDF = photonPDF_==null ||
00197         run.getPhotonPDF()==null;
00198     if(!samePhotonPDF && 
00199        photonPDF_.equals(run.getPhotonPDF())) samePhotonPDF = true;
00200        
00201     return(
00202            samePhotonPDF && 
00203            sameProtonPDF &&
00204            //generator_.isConsistentWith(run.getGenerator())&&
00205            generator_.hasConsistentModel(run.getGenerator()) &&
00206            proc_.getCompatibleProcesses().contains
00207            (run.getMCProcessType().getId())
00208            );
00209            
00210     
00211     };
00212 
00219     public boolean equals(Run run){
00220     
00221     boolean eq = (proc_.equals(run.getMCProcessType())) && 
00222         isConsistentWith(run);
00223     
00224     return eq;
00225     }
00226 
00227 }

Generated Wed Jan 17 09:14:27 GMT 2007