AlProject56.cxx

Go to the documentation of this file.
00001 ////////////////////////////////////////////////////////////////////////
00002 // $Id: AlProject56.cxx,v 1.2 2006/11/07 21:29:33 lebedev Exp $
00003 //
00004 // lebedev@physics.harvard.edu
00005 ////////////////////////////////////////////////////////////////////////
00006 
00007 #include "Alignment/AlProject56.h"
00008 
00009 #include "Bfield/bfield.h"
00010 #include "Config/CfgConfig.h"
00011 #include "Config/CfgParam.h"
00012 #include "EventDataModel/EDMEventHandle.h"
00013 #include "TrkRBase/TrackSeg.h"
00014 #include "TrkRBase/Wire.h"
00015 
00016 MODULE_DECL(AlProject56);
00017 ClassImp(AlProjectNt);
00018 
00019 using namespace std;
00020 
00021 //......................................................................
00022 
00023 AlProject56::AlProject56(const char* version) :
00024   JobCModule("AlProject56")
00025 {
00026   // Register module to be updated with a given config version
00027   SetCfgVersion(version);
00028   // Make sure that configuration has been loaded
00029   CheckInit();
00030 
00031   fNt = new AlProjectNt;
00032   fTree = new TTree("ptree", "Segment projection tree");
00033   fTree->Branch("fNt", "AlProjectNt", &fNt);
00034   
00035 }
00036 
00037 //......................................................................
00038 
00039 AlProject56::~AlProject56()
00040 {
00041   fTree->Write();
00042   delete fTree;
00043 }
00044 
00045 //......................................................................
00046 
00047 JobCResult AlProject56::Ana(const EDMEventHandle& evt)
00048 {
00049   vector<const TrackSeg*> seg;
00050   vector<const Wire*> wires;
00051 
00052   try { evt.Reco().Get(fSegFolder.c_str(), seg); }
00053   catch (...) { }
00054   if (seg.empty()) return kFailed;
00055 
00056   double x[3];
00057 
00058   for (int cham = 0; cham < kNCham; ++cham) {
00059     GChamGeo& geo = GMIPPGeo::Instance().Cham(cham);
00060     
00061     wires.clear();
00062     try { evt.Cal().Get(geo.Name(), wires); }
00063     catch (...) { continue; }
00064     if (wires.empty()) continue;
00065 
00066     for (unsigned int i = 0; i < seg.size(); ++i) {
00067       const TrackSeg* trk = seg[i];
00068       // Skip tracks which have this chamber in the fit
00069       if (trk->Point(cham)) continue; 
00070       
00071       // Predict u in every plane
00072       for (int j = 0; j < kNPlane; ++j) {
00073     trk->GetXY(geo.Z(j + 1), x, 0);
00074     double u;
00075     geo.XYToU(j + 1, x[0], x[1], u);
00076     fNt->u[j] = u;
00077     geo.XYToU(j + 1, trk->dXdZ(), trk->dYdZ(), u);
00078     fNt->dudz[j] = u;
00079       }
00080       for (unsigned int j = 0; j < wires.size(); ++j) {
00081     const Wire* w = wires[j];
00082 
00083     fNt->cham = cham;
00084     fNt->plane = w->Plane();;
00085     fNt->wire = w->WireHit();
00086     fTree->Fill();
00087       }
00088     }
00089   }
00090   
00091   return kPassed;
00092 }
00093 
00094 //......................................................................
00095   
00096 void AlProject56::NewRun(int run, int subrun)
00097 {
00098   GMIPPGeo::Instance(run);
00099   config_bfield(run, subrun);
00100 }
00101 
00102 //......................................................................
00103 
00104 void AlProject56::Update(const CfgConfig& c)
00105 {
00106   c("Debug").Get(fDebug);
00107   c("SegFolder").Get(fSegFolder);
00108 
00109   // Change the flag to signify that our configuration has been read
00110   fIsInit = true;
00111 }
00112 
00113 ////////////////////////////////////////////////////////////////////////

Generated on Mon Nov 23 08:01:43 2009 for MIPP(E907) by  doxygen 1.4.7