Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

ClusterCheck.cxx

Go to the documentation of this file.
00001 
00002 // $Id: ClusterCheck.cxx,v 1.1.1.1 2009/08/21 19:14:29 vahle Exp $
00003 //
00004 // A Module to make clusters within 1 view (2d clusters)
00005 // Based on RecoSubShower code 
00006 // A Module to make clusters within 1 view (2d clusters)
00007 // Based on RecoSubShower::FindCluster and RecoSubShower::MergeCluster code 
00008 //
00009 // \author $Author: vahle $
00010 //
00012 #include <iostream>
00013 #include <cmath>
00014 #include "TGraphErrors.h"
00015 #include "TF1.h"
00016 #include "TH2D.h"
00017 #include "TH1D.h"
00018 #include "TMath.h"
00019 #include "Geometry/Geometry.h"
00020 #include "Geometry/PlaneGeo.h"
00021 #include "Geometry/CellGeo.h"
00022 #include "Header/Header.h"
00023 #include "Simulation/MCTruth.h"
00024 #include "Simulation/FLSHitList.h"
00025 #include "Simulation/FLSHit.h"
00026 #include "JobControl/Exception.h"
00027 #include "RecoBase/CellHit.h"
00028 #include "RecoBase/Cluster.h"
00029 #include "RecoBase/ShowerBase.h"
00030 #include "ClusterMakerSS/ClusterSSHelpers.h"
00031 #include "ClusterMakerSS/MakeClusterSS.h"
00032 #include "ClusterMakerSS/ClusterCheck.h"
00033 
00034 using namespace std;
00035 using namespace clusterss;
00036 
00037 // This macro declares the existence of your module to ana
00038 MODULE_DECL(ClusterCheck); //Required!
00039 
00040 ClusterCheck::ClusterCheck(const char* version) :
00041   jobc::Module("makeclusterss::ClusterCheck")
00042 {
00043   // Set the configuration version tag
00044   this->SetCfgVersion(version); // Required!
00045 }
00046 
00047 //......................................................................
00048 
00049 void ClusterCheck::Update(const cfg::Config& /*c*/)
00050 {
00051 }
00052 
00053 //......................................................................
00054 
00055 ClusterCheck::~ClusterCheck()
00056 {
00057 }
00058 
00059 //......................................................................
00060 
00061 jobc::Result ClusterCheck::Reco(edm::EventHandle& /*evt*/)
00062 {
00063   
00064   return jobc::kPassed; // kFailed if you want to fail the event
00065 }
00066 
00067 //......................................................................
00068 
00069 jobc::Result ClusterCheck::Ana(const edm::EventHandle& evt)
00070 {
00071   const edm::EventHeader &eh = evt.Header();
00072   int run = eh.Run();
00073   int event = eh.Event();
00074   cout<<"*************** On run "<<run<<" event "<<event<<endl;
00075 
00076   //now get a daq header and geometry
00077   std::vector<const hdr::Header*> head(0);
00078   try{ evt.DAQ().Get(".",head); }
00079   catch(edm::Exception e){
00080     cerr<<"Couldn't get a head"<<endl;
00081     return jobc::kFailed;
00082   }
00083   geo::Geometry &geom = geo::Geometry::Instance(1,head[0]->DetectorID());
00084 
00085 
00086   //get the list of CellHits
00087   std::vector<const recobase::CellHit*> hitlist(0);
00088   try{ evt.Cal().Get("./MergeHits",hitlist); }
00089   catch(edm::Exception e){
00090     cerr<<"Couldn't find the MergedCellHit list, trying for the original"<<endl;
00091     try{ evt.Cal().Get("./Hits",hitlist); }
00092     catch(edm::Exception e){
00093       cerr<<"Couldn't find the Original CellHit list either, failing."<<endl;
00094       return jobc::kFailed;
00095     }
00096   }
00097   if(hitlist.size()<5){
00098     //    cerr<<"Not enough activity"<<endl;
00099     //    return jobc::kFailed; //lets just look at things that have some real activity
00100   }
00101 
00102   std::vector<const sim::MCTruth*> truelist(0);
00103   try { evt.MC().Get(".", truelist); }
00104   catch(edm::Exception e){
00105     cerr<<"Couldn't get a truelist"<<endl;
00106     return jobc::kFailed;
00107   }
00108 
00109   //get some truthiness
00110   int tidx=0;
00111   const TParticle &nupart = truelist[tidx]->GetNeutrino()->Nu();
00112   double eenu = 1.*nupart.Energy();
00113   if(eenu<0.100){
00114     //    cout<<"Not enough energy"<<endl;
00115     //    return jobc::kFailed;//let's just look at reasonable energy nus
00116   }
00117   //  double nuvtxx=nupart.Vx();
00118   //  double nuvtxy=nupart.Vy();
00119   double nuvtxz=nupart.Vz();
00120   int vcont=1;
00121   
00122   //  if(nuvtxx>-1.*(geom.DetHalfWidth()-20)&&nuvtxx<1.*(geom.DetHalfWidth()-20)){//20 cm in from xedges    
00123   //      if(nuvtxy>-1.*(geom.DetHalfHeight()-20)&&nuvtxy<1.*(geom.DetHalfHeight()-20)){//20 cm in from yedges
00124   //      if(nuvtxz>20&&nuvtxz<(geom.DetLength()-300)){//20 cm from front, and 300 cm from back (muon catcher)
00125   //      vcont=1;
00126   //}
00127   //}
00128   //}
00129   if(nuvtxz>(geom.DetLength()-300)){// 300 cm from back (muon catcher)
00130     vcont=0;
00131   }   
00132   if(vcont==0){ 
00133     //    cout<<"Not in Fid Vol"<<endl;
00134     //    return jobc::kFailed;
00135   }
00136 
00137   cout<<"Found an interaction of inu: "<<nupart.GetPdgCode()<<" CC/NC: "<<truelist[tidx]->GetNeutrino()->CCNC()<<endl;
00138   std::vector<const sim::FLSHitList*> flslist(0);
00139   try { evt.DetSim().Get(".", flslist); }
00140   catch(edm::Exception e){
00141     cerr<<"Couldn't get a flslist"<<endl;
00142     return jobc::kFailed;
00143   }
00144 
00145 
00146   std::vector<sim::FLSHit> flshits = flslist[tidx]->fHits;
00147   cout<<"Size of fls "<<flshits.size()<<endl;
00148   for(unsigned int i=0;i<flshits.size();i++){
00149     cout<<"Have a FLS hit in PLane: "<<flshits[i].fPlaneId<<" Cell "<<flshits[i].fCellId<<endl;
00150     cout<<" edep "<<flshits[i].fEdep<<" pdg of parent: "
00151         <<flshits[i].fPDG<<" track id "<<flshits[i].fTrackId<<endl;
00152   }
00153 
00154 
00155   std::vector<const recobase::Cluster *>xclusterlist(0);
00156   bool foundx=true;
00157   try{evt.Reco().Get("./SSClusterX",xclusterlist);}
00158   catch(edm::Exception e){
00159     //    cerr<<"Couldn't find an xcluster"<<endl;
00160     foundx=false;
00161   }
00162 
00163   std::vector<const recobase::Cluster *>yclusterlist(0);
00164   bool foundy=true;
00165   try{evt.Reco().Get("./SSClusterY",yclusterlist);}
00166   catch(edm::Exception e){
00167     //    cerr<<"Couldn't find an ycluster"<<endl;
00168     foundy=false;
00169   }
00170 
00171   std::vector<const recobase::Cluster *> &clist=xclusterlist;
00172   /*
00173   for(int i=0;i<2;i++){
00174     bool fc=false;
00175     geo::View_t view;
00176     if(i==0){
00177       clist=xclusterlist;
00178       fc = foundx;
00179       view=geo::kX;
00180     }
00181     else{
00182       clist=yclusterlist;
00183       fc = foundy;
00184       view=geo::kY;
00185     }
00186  
00187     if(fc){
00188       cout<<"*************In view "<<view<<" found "<<clist.size()<<" clusters "<<endl;
00189       for(unsigned int i=0;i<clist.size();i++){
00190         //      cout<<"NEw tv cell"<<endl;
00191         recobase::Cluster *c = new recobase::Cluster(*clist[i]);
00192         cout<<"cluster "<<i<<" has "<<c->NCell(view)<<" cells"<<endl;
00193         for(int j=0;j<c->NCell(view);j++){
00194           cout<<"Found cell number "<<j<<endl;
00195           c->Cell(view,j)->Print("");     
00196         }
00197       }
00198     }    
00199   }
00200 */
00201 
00202   return jobc::kPassed; // kFailed if you want to fail the event
00203   
00204 }
00205 

Generated on Mon Nov 23 04:45:25 2009 for NOvA Offline by  doxygen 1.3.9.1