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

RunSeries.java

Go to the documentation of this file.
00001 package cedar.jetweb.model;
00002 
00003 import java.util.Date;
00004 import java.util.Vector;
00005 import java.util.Enumeration;
00006 import java.util.HashMap;
00007 import java.util.Map;
00008 import java.util.Map.Entry;
00009 import java.util.Set;
00010 import java.util.TreeSet;
00011 
00012 import java.io.File;
00013 
00014 import cedar.jetweb.db.DBManager;
00015 import cedar.jetweb.db.DBJobManager;
00016 import cedar.jetweb.JetWebException;
00017 import cedar.jetweb.job.LogFile;
00018 import cedar.jetweb.JetWebConfig;
00019 import cedar.jetweb.util.Match;
00020 import cedar.jetweb.generator.Generator;
00021 import cedar.jetweb.model.plots.DataPlot;
00022 import cedar.jetweb.model.paper.*;
00023 import cedar.jetweb.job.CutCollection;
00024 
00032 public class RunSeries extends ResultSearchPattern {
00033 
00034     private int runseriesId=-1;
00035     private Date date;    
00036     private double lumi_;
00037     private boolean dirtyLumi_ = true;
00038     private Double crossSection_;
00039     private boolean dirtyCrossSection_ = true;
00040     private int nLogs=-1;
00041     private Vector<LogFile> logFiles;
00042     private boolean dirtyProcessType_ = true;
00043     private MCProcessType proc_;
00044     private Vector<Run> runs_ = new Vector<Run>(0);
00045     //    private Run combinedRun_ = new Run();
00046     private boolean isValid_=false;
00047     private boolean dirtyIsValid_ = true;
00048 
00049     private Generator generator_;
00050     private boolean dirtyGenerator_ = true;
00051     private boolean dirtyPhotonpdfList_ = true;
00052     private boolean dirtyProtonpdfList_ = true;
00053 
00054     private CutCollection cuts_;
00055     private boolean dirtyCuts_ = true;
00056     private boolean cutSuccess_ = false;
00057     private static HashMap<MCProcessType, Vector<MCProcessType> > 
00058     ProcessCompatibility_ = 
00059     new HashMap<MCProcessType, Vector<MCProcessType> > ();
00060 
00061     // Keep a record of the last previously used RunSeries to speed up access
00062     // if we need it twice
00063 
00064     private static Integer previousId_;
00065     private static RunSeries previousRunSeries_;
00066 
00068 
00069     // Method to make a new runseries from a runseries id
00070     // Keeps a cache of existing runseries.
00071    
00072     public static RunSeries Maker(Integer newId)
00073     throws JetWebException{
00074 
00075     if(newId!=previousId_){
00076         previousRunSeries_ = new RunSeries(newId);
00077         previousId_ = newId;
00078     }
00079 
00080     return previousRunSeries_;
00081 
00082     }
00084 
00088     public RunSeries(){
00089 
00090     super();
00091     System.out.println("Making empty runseries");
00092     runseriesId=-1;
00093 
00094     }
00096 
00102     public RunSeries(int newId) throws JetWebException {
00103 
00104     super();
00105     System.out.println("Making new runseries from id");
00106     runseriesId=newId;
00107     retrieve();
00108     }
00110 
00115     public RunSeries(ResultSearchPattern pattern){
00116 
00117     super();
00118     System.out.println("Making new runseries from resultserachpattern");
00119     runseriesId = -1;
00120 
00121     this.generatorList = pattern.getGeneratorList();
00122     setGenerator(generatorList.get(0));
00123     setLumi(0.0);
00124     this.protonpdfList = pattern.getProtonPDFList();
00125     this.photonpdfList = pattern.getPhotonPDFList();
00126 
00127     if(pattern.getProtonPDFList().size()!=0){
00128         runs_.get(0).setPDF(pattern.getProtonPDFList().get(0));
00129     }
00130 
00131     if(pattern.getPhotonPDFList().size()!=0){
00132         runs_.get(0).setPDF(pattern.getPhotonPDFList().get(0));
00133     }
00134 
00135     }
00137     /*
00138      * Retrieve this runseries from the DB
00139      */
00140 
00141     public boolean retrieve() throws JetWebException {
00142 
00143     DBManager.selectFromDB(this);
00144     dirtyLumi_=false;
00145     dirtyCrossSection_ = false;
00146     return true;
00147     }
00148 
00150 
00155     public int getId(){
00156     return runseriesId;
00157     }
00159 
00164     public void setId(int newrunseriesId){
00165     runseriesId = newrunseriesId;
00166     dirtyCuts_ =true;
00167     }
00169 
00174     public Date getDate(){ return date; }
00175 
00181     public void setDate(Date date){
00182     this.date = date;
00183     }
00185 
00193     public RunSeries setLumi(double newLumi){
00194     
00195     Run run = null;
00196 
00197     if(runs_.size()==0){
00198         run = new Run();
00199         run.setLumi(1.0);
00200         if(protonpdfList!=null && protonpdfList.size()!=0){
00201         run.setPDF(protonpdfList.get(0));
00202         }
00203         if(photonpdfList!=null && photonpdfList.size()!=0){
00204         run.setPDF(photonpdfList.get(0));
00205         }
00206 
00207         addRun(run);
00208         dirtyProtonpdfList_ = true;
00209         dirtyPhotonpdfList_ = true;
00210     }
00211 
00212     double oldLumi = getLumi();
00213 
00214     //protect from existing lumi = 0 !
00215     double norm = oldLumi/newLumi;
00216 
00217     if(Match.compareDouble(norm, 0.0)){
00218         // the old lumi is 0.
00219         // so set all runs to have the new Lumi and return
00220 
00221         for(Run r: runs_){
00222         r.setLumi(newLumi);
00223         }
00224         lumi_ = newLumi;
00225         return this;
00226     }
00227 
00228     norm = newLumi / oldLumi;
00229 
00230     if(norm != norm){
00231         // since we already tested for oldLumi/newLumi  = 0, 
00232         // the only way we can get here is if newLumi = oldLumi = 0.
00233         norm = 0.0;
00234     }
00235 
00236     for(Run r: runs_){
00237         r.setLumi(norm * r.getLumi());
00238     }
00239 
00240     lumi_ = newLumi;
00241     //  combinedRun_.setLumi(newLumi);
00242 
00243     return(this);
00244     }
00246 
00250     public Double getCrossSection(){
00251 
00252     if(!dirtyCrossSection_) return crossSection_;
00253     dirtyCrossSection_ = false;
00254 
00255     crossSection_ = 0.0;
00256 
00257     for(Run run: runs_){
00258         crossSection_ += run.getCrossSection();
00259     }
00260 
00261     return crossSection_;
00262     }
00264 
00268     public RunSeries setCrossSection(Double cs){
00269     dirtyCrossSection_ = false;
00270     crossSection_ = cs;
00271     return this;
00272     }
00273 
00275 
00282     public double getLumi(){ 
00283 
00284     if(!dirtyLumi_) return lumi_;
00285 
00286     dirtyLumi_ = false;
00287 
00288     Vector<Run> triedRuns = new Vector<Run>();
00289     Vector<Double> foundLumis = new Vector<Double>();
00290 
00291     for(Run run: runs_){
00292 
00293         boolean found = false;
00294 
00295         for(int ii=0; ii!=triedRuns.size() && !found; ++ii){
00296         if(run.equals(triedRuns.get(ii))){
00297 
00298             System.out.println
00299             ("RunSeries: Found matching runs for process "+
00300              run.getMCProcessType() + 
00301              ": Combining luminosities");
00302 
00303             System.out.println("Adding lumi "+
00304                        run.getLumi()+
00305                        " to already found lumi of "+
00306                        foundLumis.get(ii));
00307 
00308             Double newLumi = foundLumis.get(ii) + run.getLumi();
00309             
00310             foundLumis.set(ii, newLumi);
00311 
00312             found = true;
00313         }
00314         }
00315 
00316         if(!found){
00317         triedRuns.add(run);
00318         foundLumis.add(run.getLumi());
00319         }
00320     }
00321 
00322     //now get the lowest of the lumis found
00323 
00324     TreeSet<Double> sortedLumis = new TreeSet(foundLumis);
00325     lumi_ = sortedLumis.first();
00326     return lumi_;
00327     }
00329 
00332     public int getNLogs(){
00333     if (nLogs<0) { 
00334         try {
00335         nLogs = DBJobManager.getNLogs(this.getId());
00336         } catch (JetWebException j){
00337         System.out.println(j);
00338         }
00339     }
00340     return nLogs; 
00341     }
00343 
00346     public Vector<LogFile> getLogFiles(){
00347     if (logFiles==null){
00348         try {
00349         return DBJobManager.getLogFiles(this.getId());
00350         } catch (JetWebException j){
00351         System.out.println(j);
00352         }
00353     }
00354     return logFiles;
00355     }
00357 
00368     public RunSeries setMCProcessType(MCProcessType proc)
00369     throws JetWebException{
00370     dirtyCuts_ = true;
00371     if(!proc.isValid()){
00372         System.out.println
00373         ("Warning: MCProcessType for RunSeries"+
00374          " is not valid - not assigning");
00375         return this;
00376     }
00377        
00378     if(proc.equals(getMCProcessType())) return this;
00379       
00380     dirtyProcessType_ = true;
00381     dirtyIsValid_ = true;
00382 
00383     Vector<Integer> compatibleProcs = proc.getCompatibleProcesses();
00384 
00385     boolean compatible = (runs_.size()==0)? false: true;
00386 
00387     Vector<Integer> existingProcs = new Vector<Integer>();
00388 
00389     for(Run run: runs_){
00390 
00391         existingProcs.add(run.getMCProcessType().getId());
00392 
00393         if(!compatibleProcs.contains
00394            (run.getMCProcessType().getId())){
00395         compatible = false;
00396         }
00397     }
00398 
00399     if(!compatible){
00400         lumi_ = getLumi();
00401         generator_ = getGenerator();
00402         runs_.clear();
00403         dirtyProtonpdfList_ = true;
00404         dirtyPhotonpdfList_ = true;
00405         Vector<Integer> compatiblePIds = proc.getCompatibleProcesses();
00406 
00407         for(Integer PId: compatiblePIds){
00408         Run run = new Run();
00409         if(protonpdfList!=null && protonpdfList.size()!=0){
00410             run.setPDF(protonpdfList.get(0));
00411         }
00412         if(photonpdfList!=null && photonpdfList.size()!=0){
00413             run.setPDF(photonpdfList.get(0));
00414         }
00415         run.setLumi(lumi_);
00416         run.setGenerator(generator_);
00417         run.setMCProcessType(new MCProcessType(PId));
00418         runs_.add(run);
00419 
00420         }
00421 
00422         proc_ = proc;
00423         dirtyProcessType_ = false;
00424     }else{
00425 
00426         //for(int ii=0; ii!= compatibleProcs.size();++ii){
00427         for(Integer compatibleProc: compatibleProcs){
00428 
00429         //if(!existingProcs.contains(compatibleProcs.get(ii))){
00430         if(!existingProcs.contains(compatibleProc)){
00431             Run run = new Run();
00432             run.setLumi(lumi_);
00433             run.setMCProcessType
00434             //(new MCProcessType(compatibleProcs.get(ii)));
00435             (new MCProcessType(compatibleProc));
00436             runs_.add(run);
00437 
00438         }
00439         }
00440     }
00441 
00442     return(this);
00443     }
00444 
00446 
00454     public MCProcessType getMCProcessType()
00455     throws JetWebException{ 
00456 
00457     if(!dirtyProcessType_) return(proc_);
00458 
00459     dirtyProcessType_ = false;
00460 
00461     if(runs_.size()==0){
00462 
00463         proc_ = new MCProcessType();
00464         return(proc_);
00465     }
00466 
00467     boolean compatible = true;
00468 
00469     //Vector of process ids in this runseries
00470     Vector<Integer> PIds = new Vector<Integer>();
00471     
00472     //Vector of process ids with which all processes are compatible
00473     Vector<Integer> allowedIds = 
00474         runs_.get(0).getMCProcessType().getCompatibleProcesses();
00475 
00476 
00477     for(Run run: runs_){
00478 
00479 
00480         //System.out.println("Adding process type "+
00481         //         run.getMCProcessType().getId());
00482 
00483         PIds.add(run.getMCProcessType().getId());
00484         
00485         //Vector of process ids with which this process is compatible
00486         Vector<Integer> compatIds = 
00487         run.getMCProcessType().getCompatibleProcesses();
00488         
00489         Vector<Integer> tmp = new Vector<Integer>();
00490         if(compatIds!=null){
00491 
00492         for(Integer Id: compatIds){
00493             //System.out.println("compat. with "+Id);
00494             if(allowedIds.contains(Id)){
00495             tmp.add(Id);
00496             }
00497         }
00498     
00499         }else{
00500         System.out.println
00501             ("MCProcessType does not contain a " + 
00502              "list of processes it is compatible with");
00503 
00504         throw new JetWebException
00505             ("MCProcessType does not contain a " + 
00506              "list of processes it is compatible with",
00507              run.getMCProcessType().toString());
00508         }
00509         allowedIds = tmp;
00510     }
00511 
00512     //
00513     // if(compatIds!=null){//shouldn't ever be null since 
00514                         //it is compatible with itself at least.
00515 
00516         //Check that every process is compatible
00517     /*
00518         for(int jj=0; jj!=runs_.size(); ++jj){
00519             if(!compatIds.contains
00520                (run.getMCProcessType().getId())){
00521             compatible = false;
00522             }
00523             }*/
00524 
00525     for(Run run: runs_){
00526         if(!allowedIds.contains(run.getMCProcessType().getId())){
00527         compatible = false;
00528         }
00529     }
00530 
00531     if(!compatible){
00532         
00533         //System.out.println("!compatible");
00534 
00535         return null;
00536     }
00537 
00538 
00539     //Vector of valid Processes with which every process in this
00540     //runseries is compatible
00541     Vector<MCProcessType> validProcs = new Vector<MCProcessType>();
00542 
00543     for(Integer allowedId: allowedIds){
00544         MCProcessType tmp = new MCProcessType(allowedId);
00545 
00546         if(tmp.isValid()){
00547         validProcs.add(tmp);
00548         }
00549     }
00550 
00551 
00552     //System.out.println(validProcs.toString());
00553 
00554     //Processes which are valid and compatible _only_ with those
00555     //processes in this runseries (there should be ony one such process)
00556     Vector<MCProcessType> uniqueProcess = new Vector<MCProcessType>();
00557 
00558     for(int ii=0; ii!= validProcs.size(); ++ii){
00559 
00560         if(validProcs.get(ii).getCompatibleProcesses().containsAll(PIds)
00561            &&
00562            PIds.containsAll(validProcs.get(ii).getCompatibleProcesses())){
00563         uniqueProcess.add(validProcs.get(ii));
00564         }
00565     }
00566 
00567     if(uniqueProcess.size()==0){
00568 
00569         //System.out.println("uniqueProcess.size()==0");
00570 
00571         return null;
00572         /*
00573         throw new JetWebException
00574         ("Runs in this RunSeries do not " + 
00575          "form a complete and valid physics process", 
00576          PIds.toString());
00577         */
00578     }else if(uniqueProcess.size()>1){
00579         
00580         throw new JetWebException
00581         ("Database specifies two or more physics processes "+
00582          "that are compatible with this set of runs",
00583          PIds.toString());
00584     }
00585 
00586     proc_ = uniqueProcess.get(0);
00587     return(proc_);
00588     }
00590 
00596     public Vector<Integer> getSubSeries(){
00597 
00598 
00599     return new Vector<Integer>();
00600     }
00602     /*
00603      * Sets the Kinematical cuts for this runseries based upon the 
00604      * actual cuts used by the generator and the cuts required by the plots
00605      * generated by this runseries.
00606      * For example, if the generator in this runseries has a PTMin cut of 10
00607      * but the plot generated by this runseries with the lowest PT requirement
00608      * has a PTMin of 15 then the PTMin cut for this runseries will be set
00609      * at 15.  This is so that a future runseries with 10 < PTMin < 15
00610      * may be combined with this one (because it too will have its PTMin
00611      * cut raised to 15).
00612      * @returns true if cuts are successfully set.  false otherwise
00613      */
00614 
00620     public boolean setCuts()
00621     throws JetWebException{
00622 
00623     if(!dirtyCuts_) return cutSuccess_;
00624     
00625     cuts_ = getGenerator().getCutCollection();
00626     cutSuccess_ = (cuts_==null)? false: true;
00627     dirtyCuts_ = false;
00628     return cutSuccess_;
00629 
00630     // used to set cut collection to match the cut collection of the 
00631     // plot with the smallest cut collection for which this runseries
00632     // generates data.
00633     // no longer used.
00634 
00635     /*
00636     if(!dirtyCuts_) return cutSuccess_;
00637     dirtyCuts_ = false;
00638     CutCollection newCuts = new CutCollection();
00639     
00640     cutSuccess_ = false;
00641 
00642     for(Paper paper: PaperBank.getPapers()){
00643         for(DataPlot plot: paper.getPlots()){
00644         if(plot.getProcIdWanted(getGenerator()) ==
00645            getMCProcessType().getId()){
00646 
00647             CutCollection cuts = plot.getCutCollection();
00648 
00649             if(cuts!=null){
00650             if(cuts.isWithin(getGenerator().getCutCollection())){
00651                 newCuts = cuts.union(newCuts);
00652                 cutSuccess_ = true;
00653             }
00654             }
00655         }
00656         }
00657     }
00658 
00659     cuts_ = newCuts;
00660 
00661     return cutSuccess_;
00662     */
00663     }
00665     public CutCollection getCutCollection(){
00666     try{
00667         setCuts();
00668     }catch(JetWebException err){
00669         System.out.println
00670         ("RunSeries.getCutCollection():"+ 
00671          " unable to determine correct set of cuts.");
00672         System.out.println(err.getMessage());
00673         err.printStackTrace();
00674     }
00675     return cuts_;
00676     }
00678 
00682     public RunSeries addRun(Run run){
00683     
00684     if(runs_.size()==0 || run.isConsistentWith(runs_.get(0))){
00685         dirtyProcessType_ = true;
00686         dirtyLumi_ = true;
00687         dirtyCrossSection_ = true;
00688         dirtyIsValid_ = true;
00689         dirtyProtonpdfList_ = true;
00690         dirtyPhotonpdfList_ = true;
00691         dirtyCuts_ = true;
00692         runs_.add(run);
00693     }else{
00694         System.out.println
00695        ("Failed to add run to RunSeries - not consistent with existing runs!");
00696     }
00697     return(this);
00698     }
00700 
00701     public RunSeries clearRuns(){
00702     
00703     dirtyProcessType_ = true;
00704     dirtyLumi_ = true;
00705     dirtyCrossSection_ = true;
00706     dirtyIsValid_ = true;
00707     dirtyProtonpdfList_ = true;
00708     dirtyPhotonpdfList_ = true;
00709     dirtyCuts_ = true;
00710     runs_.clear();
00711     
00712     return this;
00713     }
00714 
00716 
00722     public void setGenerator(Generator generator){
00723     
00724     dirtyProtonpdfList_ = true;
00725     dirtyPhotonpdfList_ = true;
00726     dirtyCuts_ = true;
00727     if(runs_.size()==0){
00728         Run run = new Run();
00729         //run.setGenerator(generator);
00730         if(protonpdfList!=null && protonpdfList.size()!=0){
00731         run.setPDF(protonpdfList.get(0));
00732         }
00733         if(photonpdfList!=null && photonpdfList.size()!=0){
00734         run.setPDF(photonpdfList.get(0));
00735         }
00736         runs_.add(run);
00737     }
00738 
00739     for(Run run: runs_){
00740         run.setGenerator(generator);
00741     }
00742 
00743     generator_ = generator;
00744     dirtyGenerator_ = false;
00745     return;
00746     }
00748 
00753     public Generator getGenerator()
00754     throws JetWebException{
00755 
00756     if(!dirtyGenerator_) return generator_;
00757 
00758     if(runs_.size()==0){
00759         return null;
00760         //throw new JetWebException
00761         //("Error: Unable to get Generator - has not been set.",
00762         // "cedar.jetweb.model.RunSeries.getGenerator()");
00763     }
00764     
00765     generator_ = runs_.get(0).getGenerator();
00766     
00767     for(Run run: runs_){
00768 
00769         generator_ = generator_.union(run.getGenerator());
00770         
00771         if(generator_== null) return generator_;
00772 
00773     }
00774 
00775     dirtyGenerator_=false;
00776 
00777     return(generator_);
00778     }
00779     
00783     public Generator getGenerator(int i) throws JetWebException {
00784     if (i!=0) {
00785         throw new JetWebException("RunSeries: getGenerator("+i+")",
00786                       "method not allowed");
00787     }
00788     return getGenerator();
00789     }
00790 
00797     public Vector<Generator> getGeneratorList(){
00798     if(generatorList!=null){
00799         generatorList.clear();   
00800     }else{
00801         generatorList = new Vector<Generator>(1);
00802     }
00803     try{
00804         generatorList.add(getGenerator());
00805     }catch(JetWebException err){
00806         System.out.println(err.getMessage());
00807     }
00808     return generatorList;
00809     }
00811     public Vector<PDF> getProtonPDFList(){
00812     
00813     if(protonpdfList==null) protonpdfList = new Vector<PDF>();
00814 
00815     if(!dirtyProtonpdfList_){
00816         return protonpdfList;
00817     }
00818     
00819     dirtyProtonpdfList_ = false;
00820 
00821     Run checkRun;
00822 
00823     if(runs_.size()==0){
00824         return(protonpdfList);//assumes ptotonpdfList must have been null
00825     }else{
00826         checkRun = runs_.get(0);
00827         protonpdfList.clear();
00828         protonpdfList.add(checkRun.getProtonPDF());
00829     }
00830 
00831     for(Run run: runs_){
00832         if(!run.isConsistentWith(checkRun)){
00833         protonpdfList.add(run.getProtonPDF());
00834         }
00835     }
00836     return protonpdfList;
00837     }
00839     public Vector<PDF> getPhotonPDFList(){
00840     if(photonpdfList==null) photonpdfList = new Vector<PDF>();
00841 
00842     if(!dirtyPhotonpdfList_){
00843         return photonpdfList;
00844     }
00845 
00846     dirtyPhotonpdfList_ = false;
00847 
00848     Run checkRun;
00849 
00850     if(runs_.size()==0){
00851 
00852         System.out.println("runs_.size()=0: cannot determine photon pdf");
00853 
00854         return(photonpdfList);
00855     }else{
00856         checkRun = runs_.get(0);
00857         photonpdfList.clear();
00858         photonpdfList.add(checkRun.getPhotonPDF());
00859     }
00860 
00861     for(Run run: runs_){
00862         if(!run.isConsistentWith(checkRun)){
00863         photonpdfList.add(run.getPhotonPDF());
00864         }
00865     }
00866     return photonpdfList;
00867     }
00869     public PDF getProtonPDF()
00870     throws JetWebException {
00871 
00872     if(dirtyProtonpdfList_){
00873         getProtonPDFList();
00874     }
00875 
00876     if(protonpdfList==null || protonpdfList.size()==0){
00877         throw new JetWebException("No Proton PDF defined in RunSeries",
00878                       "RunSeries.getProtonPDF");
00879     }else if(protonpdfList.size()>1){
00880         throw new JetWebException
00881         ("Multiple proton PDFs defined in RunSeries - don't know which one to use",
00882          "RunSeries.getProtonPDF");
00883     }
00884     return protonpdfList.get(0);
00885     
00886     }
00888     public PDF getPhotonPDF()
00889     throws JetWebException{
00890 
00891     if(dirtyPhotonpdfList_){
00892         getPhotonPDFList();
00893     }
00894     if(photonpdfList==null || photonpdfList.size()==0){
00895         throw new JetWebException("No Photon PDF defined in RunSeries",
00896                       "RunSeries.getPhotonPDF");
00897     }else if(photonpdfList.size()>1){
00898         throw new JetWebException
00899         ("Multiple photon PDFs defined in RunSeries - don't know which one to use",
00900          "RunSeries.getPhotonPDF");
00901     }
00902 
00903 
00904     return photonpdfList.get(0);
00905 
00906     }
00908 
00911     public Vector<Model> getConsistentModels() throws JetWebException {
00912     return DBManager.getConsistentModels(this);
00913     }
00915 
00919     public boolean isValid()
00920     throws JetWebException{
00921 
00922     if(!dirtyIsValid_) return(isValid_);
00923     
00924     dirtyIsValid_ = false;
00925 
00926     getMCProcessType();
00927 
00928     isValid_ = (proc_ == null)? false: true;
00929 
00930     for(int ii=0; ii!=runs_.size() && isValid_;++ii){
00931         for(int jj=0; jj!= runs_.size(); ++jj){
00932         isValid_ = runs_.get(ii).isConsistentWith(runs_.get(jj));
00933         }
00934     }
00935 
00936     return(isValid_);
00937     }
00938 
00939 
00940     public RunSeries removeIrrelevantParameters() throws JetWebException {
00941 
00942     dirtyCuts_ = true;
00943     Set<Map.Entry<String,Integer>> intParameters;
00944     Set<Map.Entry<String,Double>>  realParameters;
00945     Set<Map.Entry<String,HashMap<Integer,Integer>>> intArrays;
00946     Set<Map.Entry<String,HashMap<Integer,Double>>> realArrays;
00947 
00948     Vector<String> toGo = new Vector<String>();
00949 
00950     // First the integer parameters.
00951     intParameters = generator_.getIntParameters().entrySet(); 
00952     for (Map.Entry<String,Integer> entry : intParameters){      
00953         if (!generator_.isRelevant(proc_,entry.getKey())){
00954             toGo.add(entry.getKey());
00955         }
00956     }
00957     for (String key : toGo){
00958         generator_.getIntParameters().remove(key);
00959     }
00960     toGo.clear();
00961 
00962     // Now the real parameters.
00963     realParameters = generator_.getRealParameters().entrySet(); 
00964     for (Map.Entry<String,Double> entry : realParameters){      
00965         if (!generator_.isRelevant(proc_,entry.getKey())){
00966             toGo.add(entry.getKey());
00967         }
00968     }
00969 
00970     for (String key : toGo){
00971         generator_.getRealParameters().remove(key);
00972     }
00973     toGo.clear();
00974 
00975 
00976     // Now the int arrays.
00977     intArrays = generator_.getIntParameterArrays().entrySet(); 
00978     for (Map.Entry<String,HashMap<Integer,Integer>> entry : intArrays){
00979         
00980         String arrayName = entry.getKey(); 
00981 
00982         Set<Map.Entry<Integer,Integer>> array = entry.getValue().entrySet();
00983 
00984         for (Map.Entry<Integer,Integer> arrayEntry : array){
00985 
00986         Integer index = arrayEntry.getKey();            
00987         if (!generator_.isRelevant(proc_,arrayName,index)){
00988             toGo.add(entry.getKey());
00989         }
00990         }
00991         for (String key : toGo){
00992         entry.getValue().remove(key);
00993         }
00994         toGo.clear();
00995     }
00996 
00997 
00998 
00999     // Now the real arrays.
01000     realArrays = generator_.getRealParameterArrays().entrySet(); 
01001     for (Map.Entry<String,HashMap<Integer,Double>> entry : realArrays){
01002         
01003         String arrayName = entry.getKey(); 
01004 
01005         Set<Map.Entry<Integer,Double>> array = entry.getValue().entrySet();
01006 
01007         for (Map.Entry<Integer,Double> arrayEntry : array){
01008 
01009         Integer index = arrayEntry.getKey();            
01010         if (!generator_.isRelevant(proc_,arrayName,index)){
01011             toGo.add(entry.getKey());
01012         }
01013         }
01014         for (String key : toGo){
01015         entry.getValue().remove(key);
01016         }
01017         toGo.clear();
01018 
01019 
01020 
01021     }
01022 
01023     // now make the runs consistent.
01024     for (Run run : runs_){
01025         run.setGenerator(generator_);
01026     }
01027 
01028     return this;
01029     }
01030 
01031 
01032 }

Generated Wed Jan 17 09:14:27 GMT 2007