00001 // $Id: filterStrangeMuDst.C,v 2.1 2003/02/10 16:50:08 genevb Exp $ 00002 // $Log: filterStrangeMuDst.C,v $ 00003 // Revision 2.1 2003/02/10 16:50:08 genevb 00004 // simple updates 00005 // 00006 // Revision 2.0 2000/06/09 22:12:56 genevb 00007 // Updated for version 2 of Strangeness mico DST package 00008 // 00009 // Revision 1.2 2000/04/12 16:16:55 genevb 00010 // Remove unnecessary library loads 00011 // 00012 // Revision 1.1 2000/04/05 20:27:58 genevb 00013 // Introduction of macro to filter strangeness micro DSTs 00014 // 00015 // 00016 //====================================================== 00017 // owner: Gene Van Buren, UCLA 00018 // what it does: uses StStrangeMuDstMaker to read a micro DST 00019 // and filter it to a sub-micro DST 00020 // 00021 // - This example shows how one might select only those V0s 00022 // whose mass under the lambda hypothesis falls in a range 00023 // near that of that lambda. 00024 // - Another possibility is to select entire events, and the 00025 // lines commented out during the event loop with totalV0Pt 00026 // show how one would filter out those events whose total 00027 // Pt from V0's is greater than 350 GeV/c. 00028 //====================================================== 00029 00030 00031 TStopwatch clock; 00032 00033 void load() { 00034 gSystem->Load("St_base"); 00035 gSystem->Load("StChain"); 00036 gSystem->Load("StUtilities"); 00037 gSystem->Load("StarClassLibrary"); 00038 gSystem->Load("StEvent"); 00039 gSystem->Load("StStrangeMuDstMaker"); 00040 } 00041 00042 void run() { 00043 00044 // Set number of events to analyse 00045 const Int_t Nevents = 10000; // go to EOF 00046 00047 StChain chain("myChain"); 00048 00049 // The maker for the new micro DST must be constructed _before_ the 00050 // maker to read the old micro DST. This is because the copying is 00051 // done during chain.Clear(), and the new maker's Clear() must be 00052 // called to do the copying before the old maker's Clear() is called, 00053 // erasing the event. 00054 00055 StStrangeMuDstMaker strangeNewDst("strangeNewMuDst"); 00056 strangeNewDst.SetWrite("newEvMuDst.root"); // 00057 strangeNewDst.DoV0(); // Selects V0 vertices for new micro-DST 00058 strangeNewDst.DoMc(); // Keep MC info if it is available 00059 00060 StStrangeMuDstMaker strangeOldDst("strangeOldMuDst"); 00061 strangeOldDst.SetRead(); // Sets "read" mode (using default file names) 00062 // DoV0() and DoMc() are autmatically called for the old maker by the new. 00063 00064 // Now we tell the new maker that it will create a sub-DST of the old one. 00065 strangeNewDst.SubDst(&strangeOldDst); 00066 00067 // Next, any additional cuts that are being made should be added to 00068 // the cuts information in the new DST. 00069 strangeNewDst.Cuts().Add("Lambda mass","1.11 < mass < 1.12"); 00070 // strangeNewDst.Cuts().Add("Large Pt total","Pt total > 350 GeV/c"); 00071 00072 clock.Start(kTRUE); 00073 00074 // Do init 00075 Int_t ierr = chain.Init(); 00076 if( ierr ) { chain.Fatal(ierr,"on init"); return; } 00077 00078 // Loop over events 00079 for( Int_t i=0; i<Nevents; i++ ) { 00080 if( chain.Make() ) break; 00081 00082 // Float_t totalV0Pt = 0.; 00083 for( Int_t j=0; j<strangeOldDst.GetNV0(); j++ ) { 00084 StV0MuDst *v0m = strangeOldDst.GetV0(j); 00085 Float_t ml = v0m->massLambda(); 00086 if ((ml>1.11) && (ml<1.12)) strangeNewDst.SelectV0(j); 00087 // totalV0Pt += v0m->ptV0(); 00088 } 00089 // if (totalV0Pt > 350.) strangeNewDst.SelectEvent(); 00090 00091 if( i != Nevents) chain.Clear(); 00092 printf("*** Finished processing event %d\n",i); 00093 } 00094 00095 // Finish 00096 if( Nevents >= 1 ) { 00097 chain.Finish(); 00098 } 00099 00100 // Stop the stopwatch 00101 clock.Stop(); 00102 clock.Print(); 00103 } 00104 00105 void filterStrangeMuDst() { 00106 load(); 00107 run(); 00108 }
1.5.9