Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members

NCSelection.C

Go to the documentation of this file.
00001 
00002 // NCSelection.C
00003 //
00004 // Author     : J. List
00005 // Created    : 31/05/2005
00006 // Last update: $Date: 2005/06/08 16:35:08 $
00007 //          by: $Author: boehmej $
00008 // 
00009 // Comment    : 
00010 //      This implements an NC Selection in SFHMarana
00012 
00013 
00014 
00015 #include <cstdio>
00016 #include <cstdlib> 
00017 #include <iostream> 
00018 #include <fstream> 
00019 
00020 #include "SFHMarana/SFHMarEvent.h"
00021 #include "SFHMarana/MaranaEventLoop.h"
00022 #include "jbltools/sfh/FloatFun.h"
00023 #include "jbltools/sfh/h1/H1HatVariables.h"
00024 
00025 #include <TROOT.h>
00026 #include <TCanvas.h>
00027 #include <TPostScript.h>
00028 #include <TStyle.h>
00029 
00030 // ----- Init ROOT environment ---------------- 
00031 TROOT the_root("EXEMPLE","Exemple analysis"); 
00032 
00033 
00034 using namespace std;
00035 
00036 int main(int argc, char *argv[]) 
00037 { 
00038 
00039   if (argc <2) { 
00040     cout << "Usage:" <<endl;
00041     cout << "NCSelection input_parameters " <<endl;
00042     exit(1);
00043   }
00044 
00045 //...declare the run manager
00046   TRunHisto run(argv[1]);
00047 
00048 //...declare the  event --> use "local" SFHMarEvent (derived from TMarEvent)
00049   SFHMarEvent event(&run);
00050  
00051 //...declare histogram classes 
00052   Char_t OutputTextFile[200];
00053 
00054 //--- create object which manages histogram booking & filling 
00055 //    (derived from THisto derived from THistoManager)
00056   MaranaEventLoop evtLoop(run,"NCHistos","NCEvents.txt");
00057 
00058 //---- hat selection (if needed to online preselect the sample) ...
00059   printf("Nb events before hat selection: %d \n",gH1Tree->GetEntries());
00060   H1Tree::Instance()->SelectHat("Q2e>500.");
00061   printf("Nb events after hat selection: %d \n",gH1Tree->GetEntries());
00062     
00063 //...loop over events  
00064   cout << "\n>>> start loop \n"<<endl;
00065   
00066   event.find_ElePho=kTRUE;
00067   event.PtMinEle=0;
00068   event.ThetaMinEle=5;
00069   event.ThetaMaxEle=175;
00070 
00071   event.find_Muon=kTRUE;
00072   event.PtMinMu=2;
00073   event.ThetaMinMu=10;
00074   event.ThetaMaxMu=160;
00075   event.DTrTrMinMu=0.5; 
00076 
00077 //--- disable other thight finders
00078   event.find_Jet=kFALSE;
00079   event.find_NP=kFALSE;
00080   
00081     
00082 //---- Here start the main loop on events
00083   while (event.Next(run)) { 
00084     if (event.num%5000==0)cout << "--> process event "<< event.num<<endl; 
00085 
00086     if (!(event.MCFlag)) { //--- checks for data quality runs
00087       static H1ShortPtr RunQuality("RunQ");
00088       if (*RunQuality==3&&!event.IsData2003()) {
00089         printf("Poor Quality run rejected \n");
00090         continue;
00091       }
00092     }      
00093            
00094     if(!event.IsHV()||event.IsCosmic()) continue;       //--- HV, cosmic base cut
00095 
00096     if((fabs(event.Vertex[2])>35)||event.Vertex[2]==0) continue;        //--- HV, cosmic base cut
00097 
00098 //---- Check Timing
00099     if(event.IsTimingOk() == kFALSE) continue;
00100 
00101 
00102 //---- Filling of histograms
00103     evtLoop.Fill();        // trigger self-filling process 
00104   }
00105       
00106   //some style stuff
00107   gROOT->SetStyle("Plain");
00108   gStyle->SetOptTitle(1);
00109   gStyle->SetHistLineWidth(2);
00110   gStyle->SetCanvasBorderMode(0);
00111   gStyle->SetPadBorderMode(0);
00112   gStyle->SetPadColor(0);
00113   gStyle->SetCanvasColor(0);
00114   gStyle->SetTitleColor(1);
00115   gStyle->SetStatColor(0);
00116   gStyle->SetOptFit(1);
00117   gStyle->SetOptStat(1);
00118 
00119   TPostScript *ps  = new TPostScript("NC.ps", 111);
00120   TCanvas *c = new TCanvas("NC", "NCSelection", 600, 800);
00121   evtLoop.Draw(c, ps, "E0", false, 1, 3, false, false);
00122   ps->Close(); 
00123   cout << "Postscript written to NC.ps"  << endl;
00124  
00125   cout << "\n>>>>>>>>  End of events loop : " << event.num << " Events  <<<<<<<<<" << endl; 
00126 
00127   return 0;
00128  
00129 }
00130 
00131 
00132 
00133 
00134 
00135 

Generated on Thu Jul 28 11:48:52 2005 for SFHMarana by doxygen 1.3.2