• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

beamtime/cern-oct12/go4/TTrackingProc.cxx (r4864/r3721)

Go to the documentation of this file.
00001 #include "TTrackingProc.h"
00002 
00003 #include "TTimeStamp.h"
00004 #include "TSystem.h"
00005 #include "TROOT.h"
00006 #include "TGo4Log.h"
00007 
00008 #include "TGo4UserException.h"
00009 
00010 
00011 
00012 TTrackingProc::TTrackingProc(const char* name) :
00013    TCBMBeamtimeProc(name),
00014    fBeamMonitorEvent(0),
00015    fFirstHodoEvent(0),
00016    fSecondHodoEvent(0),
00017    fMSFFMEvent(0),
00018    fRICHEvent(0),
00019    fBUCHEvent(0),
00020    fOutputEvent(0)
00021 {
00022    TGo4Log::Info("TTrackingProc: Create instance %s", name);
00023    TString obname, obtitle;
00024 
00025    fPar = (TTrackingParam*) MakeParameter("TrackingPar", "TTrackingParam");
00026 
00027 // fKalman = new CbmKF();
00028 
00029   fPosXHod1 = MakeTH1('I', "Tracking/XPosHod1","XPosHod1_title",  1000,-50.,50.);
00030   fPosYHod1 = MakeTH1('I', "Tracking/YPosHod1","YPosHod1_title",  1000,-50.,50.);
00031   fPosXYHod1 = MakeTH2('I', "Tracking/XYPosHod1","XYPosHod1_title",  100,-50.,50.,  100,-50.,50.);
00032   fPosXHod2 = MakeTH1('I', "Tracking/XPosHod2","XPosHod2_title",  1000,-50.,50.);
00033   fPosYHod2 = MakeTH1('I', "Tracking/YPosHod2","YPosHod2_title",  1000,-50.,50.);
00034   fPosXYHod2 = MakeTH2('I', "Tracking/XYPosHod2","XYPosHod2_title",  100,-50.,50.,  100,-50.,50.);
00035 
00036    ExecuteScript("set_TrackingPar.C");
00037 
00039 //TString dir="Tracking";
00040 //TString gname="HYGraph";
00041 //TString fullname= dir+"/"+gname;
00042 //cout <<"graph name is "<<fullname.Data() << endl;
00043 // grHY=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00044 //
00045 //   if(grHY==0) {
00046 //      grHY=new TGraphErrors(2, ZHf, YHf, EZHf, EYHf);
00047 //      grHY->SetName(gname);
00048 //     AddObject(grHY, dir.Data());
00049 //
00050 // }
00051 // cout <<"assigned  object"<< grHY->GetName()<< endl;
00052 //gname="HXGraph";
00053 //  fullname= dir+"/"+gname;
00054 // grHX=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00055 //   if(grHX==0) {
00056 //      grHX=new TGraphErrors(2, ZHf, XHf, EZHf, EXHf);
00057 //      grHX->SetName(gname);
00058 //      AddObject(grHX, dir.Data());
00059 //
00060 // }
00061 //gname="YGraph";
00062 // fullname=  dir+"/"+gname;
00063 //  grY=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00064 //  if(grY==0) {
00065 //      grY = new TGraphErrors(5, Zf, Yf, EZf, EYf);
00066 //      grY->SetName(gname);
00067 //      grY->SetTitle("YZ projection");
00068 //      grY->GetXaxis()->SetTitle("Z (mm) ");
00069 //      grY->GetYaxis()->SetTitle("Y (mm) ");
00070 //      grY->SetMarkerStyle(21);
00071 //      grY->SetMarkerColor(4);
00072 //      grY->SetMarkerSize(0.8);
00073 //      grY->SetLineColor(4);
00074 //      grY->GetXaxis()->SetRangeUser(-10, 3100);
00075 //      AddObject(grY, dir.Data());
00076 // }
00077 //gname="XGraph";
00078 //fullname=  dir+"/"+gname;
00079 // grX=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00080 //   if(grX==0) {
00081 //      grX = new TGraphErrors(5, Zf, Xf, EZf, EXf);
00082 //      grX->SetName(gname);
00083 //      grX->SetTitle("XZ projection");
00084 //      grX->GetXaxis()->SetTitle("Z (mm) ");
00085 //      grX->GetYaxis()->SetTitle("X (mm) ");
00086 //      grX->SetMarkerStyle(20);
00087 //      grX->SetMarkerColor(4);
00088 //      grX->SetMarkerSize(0.8);
00089 //      grX->SetLineColor(4);
00090 //      grX->GetXaxis()->SetRangeUser(-10, 3100);
00091 //      AddObject(grX, dir.Data());
00092 // }
00093 //gname="YaGraph";
00094 // fullname=  dir+"/"+gname;
00095 //  graY=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00096 //  if(graY==0) {
00097 //      graY = new TGraphErrors(7, Za, Ya, EZa, EYa);
00098 //      graY->SetName(gname);
00099 //      graY->SetTitle("YZ projection");
00100 //      grY->GetXaxis()->SetTitle("Z (mm) ");
00101 //      graY->GetYaxis()->SetTitle("Y (mm) ");
00102 //      graY->SetMarkerStyle(21);
00103 //      graY->SetMarkerColor(4);
00104 //      graY->SetMarkerSize(0.8);
00105 //      graY->SetLineColor(4);
00106 //      graY->GetXaxis()->SetRangeUser(-10, 3100);
00107 //      AddObject(graY, dir.Data());
00108 // }
00109 //gname="XaGraph";
00110 //fullname=  dir+"/"+gname;
00111 //  graX=dynamic_cast<TGraphErrors*>(GetObject(fullname));
00112 //   if(graX==0) {
00113 //      graX = new TGraphErrors(7, Za, Xa, EZa, EXa);
00114 //      graX->SetName(gname);
00115 //      graX->SetTitle("XZ projection");
00116 //      graX->GetXaxis()->SetTitle("Z (mm) ");
00117 //      graX->GetYaxis()->SetTitle("X (mm) ");
00118 //      graX->SetMarkerStyle(20);
00119 //      graX->SetMarkerColor(4);
00120 //      graX->SetMarkerSize(0.8);
00121 //      graX->SetLineColor(4);
00122 //      graX->GetXaxis()->SetRangeUser(-10, 3100);
00123 //      AddObject(graX, dir.Data());
00124 // }
00125 
00126    TGo4Log::Info("TTrackingProc Histograms created");
00127 }
00128 
00129 
00130 
00131 TTrackingProc::~TTrackingProc()
00132 {
00133 }
00134 
00135 
00136 
00137 void TTrackingProc::InitEvent(TGo4EventElement* outevnt)
00138 {
00139    // first assign input event:
00140    // since input event object is never discarded within processor lifetime,
00141    // we just search for subevent by name once to speed up processing
00142  TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00143       if(btevent)
00144       {
00145       fBeamMonitorEvent=dynamic_cast<TBeamMonitorEvent*>(btevent->GetSubEvent("BEAM"));
00146       fFirstHodoEvent=dynamic_cast<TFiberHodEvent*>(btevent->GetSubEvent("Hodo1"));
00147       fSecondHodoEvent=dynamic_cast<TFiberHodEvent*>(btevent->GetSubEvent("Hodo2"));
00148       fMSFFMEvent=dynamic_cast<TTRDMuensterFrankfurtEvent*>(btevent->GetSubEvent("TRDMSFFM"));
00149       fRICHEvent=dynamic_cast<TRICHEvent*>(btevent->GetSubEvent("RICH"));
00150       fBUCHEvent=dynamic_cast<TTRDBucharestEvent*>(btevent->GetSubEvent("TRDBUCHAREST"));
00151       }
00152       else  {
00153          cout << "btevent == 0\n";
00154       }
00155    //if(fSTSEvent!=0)
00156  
00157 // btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00158 //      if(btevent)
00159 //      {
00160 //      fRocInputEvent = dynamic_cast<TRocEvent*>(btevent->GetSubEvent("ROC"));
00161 //      fRocInputEvent->GetEventTime();
00162 //      }
00163 //      else  {
00164 //         cout << "detector event == 0\n";
00165 //      }
00166  
00167  
00168  
00169  // then assign output event
00170    // since output event object is never discarded within processor lifetime,
00171    // we just search for subevent by name once to speed up processing
00172    if(fOutputEvent==0)
00173    {
00174       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt); 
00175 // CbmKF* kalman = new CbmKF();
00176       if(btevent)
00177       {
00178          fOutputEvent=dynamic_cast<TTrackingEvent*>(btevent->GetSubEvent("TRACKING"));
00179       }
00180       else
00181       {
00182          fOutputEvent= dynamic_cast<TTrackingEvent*>(outevnt);
00183       }
00184       if(fOutputEvent==0) {
00185          GO4_STOP_ANALYSIS_MESSAGE("**** TTrackingProc: Fatal error: output event is not a TTrackingEvent!!! STOP GO4");
00186       }
00187    }
00188 }
00189 
00190 
00191  
00192 void TTrackingProc::FinalizeEvent()
00193 {
00194    if(fBeamMonitorEvent && fBeamMonitorEvent->IsValid())
00195    {
00196 
00197    }
00198    static int eventNum = 0;
00199 
00200 
00201    // TODO: implemement some correlation analysis between all detector hits...
00202 
00203    if( fFirstHodoEvent->NumHits() == 1 && fSecondHodoEvent->NumHits() == 1) {
00204 
00205 // here rest of hodoscope analysis from cosy (<-I.Vasiliev)
00206 
00207 
00208 //filling the control histos for the Hodo
00209 
00210     for( UInt_t iHit1 = 0; iHit1 < fFirstHodoEvent->NumHits(); iHit1++ ) {
00211             fPosXHod1->Fill( fFirstHodoEvent->Hit(iHit1).X );
00212             fPosYHod1->Fill( fFirstHodoEvent->Hit(iHit1).Y );
00213             fPosXYHod1->Fill( fFirstHodoEvent->Hit(iHit1).X , fFirstHodoEvent->Hit(iHit1).Y );
00214 //      cout<<"event # "<<eventNum<<" current time" << fRocInputEvent->GetEventTime()<<" first_time_stamp "<<first_time_stamp<<endl;
00215             //            fPosXHod1_vs_time->Fill( eventNum,fFirstHodoEvent->Hit(iHit1).X );
00216 //            fPosXHod1_vs_time->Fill( fRocInputEvent->GetEventTime()-first_time_stamp,fFirstHodoEvent->Hit(iHit1).X );
00217 //            fPosYHod1_vs_time->Fill( fRocInputEvent->GetEventTime()-first_time_stamp,fFirstHodoEvent->Hit(iHit1).Y );
00218 //          Xf[0] = fFirstHodoEvent->Hit(iHit1).X;
00219 //          Yf[0] = fFirstHodoEvent->Hit(iHit1).Y;
00220 //          Xa[0] = fFirstHodoEvent->Hit(iHit1).X;
00221 //          Ya[0] = fFirstHodoEvent->Hit(iHit1).Y;
00222 
00223 
00224 
00225         }
00226         for(UInt_t iHit5 = 0; iHit5 < fSecondHodoEvent->NumHits(); iHit5++ ) {
00227             fPosXHod2->Fill( fSecondHodoEvent->Hit(iHit5).X );
00228             fPosYHod2->Fill( fSecondHodoEvent->Hit(iHit5).Y );
00229             fPosXYHod2->Fill( fSecondHodoEvent->Hit(iHit5).X , fSecondHodoEvent->Hit(iHit5).Y ); 
00230 //            fPosXHod2_vs_time->Fill( fRocInputEvent->GetEventTime()-first_time_stamp,fSecondHodoEvent->Hit(iHit5).X );
00231 //            fPosYHod2_vs_time->Fill( fRocInputEvent->GetEventTime()-first_time_stamp,fSecondHodoEvent->Hit(iHit5).Y );
00232 //          Xf[4] = fSecondHodoEvent->Hit(iHit5).X;
00233 //          Yf[4] = fSecondHodoEvent->Hit(iHit5).Y;
00234 //          Xa[6] = fSecondHodoEvent->Hit(iHit5).X;
00235 //          Ya[6] = fSecondHodoEvent->Hit(iHit5).Y;
00236 
00237 
00238 
00239         }
00240 //    cout<<" Xa[0], Xa[6] " <<Xa[0]<<" "<< Xa[6]<<endl;
00241 //          fCorrXHod->Fill( Xa[0] , Xa[6]);
00242 //            fCorrYHod->Fill( Ya[0] , Ya[6]);
00243 
00244 
00245                 }
00246 
00247 
00248 }

Generated on Tue Dec 10 2013 04:52:16 for ROCsoft by  doxygen 1.7.1