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

beamtime/gsi-aug12/prod/go4/ROOTCONV/TRootConverterProc.cxx (r4864/r3870)

Go to the documentation of this file.
00001 /* Generated by Together */
00002 
00003 #include "TRootConverterProc.h"
00004 #include "TCBMBeamtimeEvent.h"
00005 #include "TGo4Version.h"
00006 #if __GO4BUILDVERSION__ > 40502
00007    #include "go4iostream.h"
00008 #else
00009    #include "Riostream.h"
00010 #endif
00011 #include "TGo4UserException.h"
00012 #include "TGo4MbsEvent.h"
00013 
00014 #include "TH1.h"
00015 #include "TH2.h"
00016 #include "TH3.h"
00017 #include "TProfile.h"
00018 
00019 #include "TGo4Analysis.h"
00020 
00021 #include <algorithm>
00022 
00023 //***********************************************************
00024 TRootConverterProc::TRootConverterProc(const char* name) :
00025 TCBMBeamtimeProc(name),
00026 fCrateInputEvent(0),
00027 fTriglogInputEvent(0),
00028 fEpicsInputEvent(0),
00029 fVftxInputEvent(0),
00030 fRpcHdInputEvent(0),
00031 fRpcBucInputEvent(0),
00032 fRpcBucMod1InputEvent(0),
00033 fRpcBucMod2InputEvent(0),
00034 fRpcBucMod3InputEvent(0),
00035 fRpcBucMod4InputEvent(0),
00036 fPlasticsInputEvent(0),
00037 fPadRpcInputEvent(0),
00038 fScalOrMu1InputEvent(0),
00039 fScalOrMu2InputEvent(0),
00040 fMatchingInputEvent(0),
00041 #ifdef ROOTCONV_WITHHODO
00042 fHodoInputEvent(0),
00043 #endif
00044 fOutputEvent(0),
00045 cleanTree(0)
00046 {
00047    TGo4Log::Info("**** TRootConverterProc: Create instance %s", name);
00048 
00049 #if defined(ROOTCONV_WITHHODO)
00050    fRocPar = (TRocParam*) GetParameter("RocPar");
00051    cout << "ROCPAR = " << fRocPar << endl;
00052    
00053    if (fRocPar->numRocs > 0) fNumRocs = (UInt_t) fRocPar->numRocs;
00054 #endif
00055 
00056 
00057    fRootConvPar = (TRootConverterParam*) MakeParameter("RootConvPar", "TRootConverterParam");
00058    cout << "RootConvPar = " << fRootConvPar << endl;
00059 
00060 
00061    // ROC general variables
00062    uNbEvents = 0;
00063    
00064 #ifdef ROOTCONV_WITHHODO
00065    if(1 == fRootConvPar->uHodoDebugHisto)
00066    {
00067       TString path = GetName();
00068       path += "/";
00069       path += GetName();
00070 
00071       // Booking histograms
00072       hNbClustersPerEventHodoscope = MakeTH1('I', path+"_NbClustersPerEventHodoscope","Nb hosdoscope clusters per event",
00073             16,-0.5,15.5);
00074 
00075       hHitXvsMilliSecondsInSpill = MakeTH2('I', path+"_HitPosXVsTimeMilSecInSpill",
00076             "Hodoscope hit position versus time in Spill; Time in spill [ms]; X [mm]; Counts [mm]",
00077             8000,-50, 79950, 32,-14.5,15.5 );
00078       hHitYvsMilliSecondsInSpill = MakeTH2('I', path+"_HitPosYVsTimeMilSecInSpill",
00079             "Hodoscope hit position versus time in Spill; Time in spill [ms]; Y [mm]; Counts [mm]",
00080             8000,-50, 79950, 32,-14.5,15.5 );
00081       // No MakeTH3 function in go4, so do same operations by hand
00082       // => Need to check if loaded from autosave and create by ourselves
00083       path = GetName();
00084       path += "/";
00085       TString sName = GetName();
00086       hHit2DvsSeconds        = (TH3*)GetHistogram( path+ sName +"_HitPosVsTimeSec" );
00087       if( 0 == hHit2DvsSeconds )
00088       {
00089          hHit2DvsSeconds        = new TH3I( sName +"_HitPosVsTimeSec",
00090                                  "Hodoscope hit position versus time; Time [s]; X [mm]; Y [mm]",
00091                                  1000,-0.5, 1999.5, 32,-14.5,15.5, 32,-14.5,15.5 );
00092          AddHistogram( hHit2DvsSeconds, path );
00093       }
00094       hHit2DvsSecondsInSpill        = (TH3*)GetHistogram( path + sName +"_HitPosVsTimeSecInSpill" );
00095       if( 0 == hHit2DvsSecondsInSpill )
00096       {
00097          hHit2DvsSecondsInSpill = new TH3I( sName +"_HitPosVsTimeSecInSpill",
00098                                  "Hodoscope hit position versus time in Spill; Time in spill [s]; X [mm]; Y [mm]",
00099                                  80,-0.5, 79.5, 32,-14.5,15.5, 32,-14.5,15.5 );
00100          AddHistogram( hHit2DvsSecondsInSpill, path );
00101       }
00102       hHit2DvsMilliSecondsInSpill        = (TH3*)GetHistogram( path + sName +"_HitPosVsTimeMilSecInSpill" );
00103       if( 0 == hHit2DvsMilliSecondsInSpill )
00104       {
00105          hHit2DvsMilliSecondsInSpill = new TH3I( sName +"_HitPosVsTimeMilSecInSpill",
00106                                  "Hodoscope hit position versus time in Spill; Time in spill [ms]; X [mm]; Y [mm]",
00107                                  8000,-50, 79950, 32,-14.5,15.5, 32,-14.5,15.5 );
00108          AddHistogram( hHit2DvsMilliSecondsInSpill, path );
00109       }
00110       // For hodoscope hits map
00111       uFirstMbsTime = 0;
00112       uSpillStartMbsTime = 0;
00113       uLastMbsTime = 0;
00114 
00115       uFirstMbsTimeMs = 0;
00116       uSpillStartMbsTimeMs = 0;
00117    } // if(1 == fRootConvPar->uHodoDebugHisto)
00118 #endif
00119 
00120    //~ TString path = GetName();
00121    //~ path += "/";
00122    //~ path += GetName();
00123    if( 1 == fRootConvPar->uSlowControlInTree )
00124    {
00125       hTimeEpicsUpdates = MakeTH1('I', "RootConv/RC_TimeEpicsUpdate","Timing of epics updates; Time [s]",
00126             7200, 0, 7200);
00127    } // if( 1 == fRootConvPar->uSlowControlInTree )
00128    uEpicsTimeOrigin = 0;
00129       
00130    //printf("RPC Histograms created \n");
00131    fflush ( stdout);
00132 }
00133 
00134 TRootConverterProc::~TRootConverterProc()
00135 {
00136 //   TGo4Log::Info("Proc  %p", this);
00137    if( (1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay)
00138          && 0 != cleanTree )
00139       {
00140           if( 1 == fRootConvPar->uRootDisplay )
00141              TGo4Analysis::Instance()->RemoveTree(cleanTree);
00142           if( 1 == fRootConvPar->uCleanOuputEnable )
00143           {
00144              fRootOut->Write("",TObject::kOverwrite);
00145              //~ gDirectory->Cd(sOutputFilename);
00146 //~ 
00147              //~ cleanTree->SetDirectory(gDirectory);
00148              //~ cleanTree->Write(0,TObject::kOverwrite); // to avoid double trees in file: cf http://root.cern.ch/root/roottalk/roottalk01/0842.html
00149              //~ gDirectory->Cd(oldDir->GetPath());
00150              fRootOut->Close();
00151           } // if( 1 == fRootConvPar->uCleanOuputEnable )
00152 
00153           if( 0 == fRootConvPar->uCleanOuputEnable )
00154              delete cleanTree;
00155 
00156           if( 1 == fRootConvPar->uSlowControlInTree )
00157           {
00158              vdPositiveHvI.clear();
00159              vdPositiveHvU.clear();
00160              vdNegativeHvI.clear();
00161              vdNegativeHvU.clear();
00162           }
00163 
00164 //          if( 1 == fRootConvPar->uCleanOuputEnable )
00165 //             delete fRootOut;
00166       }
00167 
00168    cout << "**** TRootConverterProc: Delete instance " << endl;
00169 }
00170 //***********************************************************
00171 
00172 void TRootConverterProc::InitEvent(TGo4EventElement* outevnt)
00173 {
00174    // first assign input event:
00175    // since input event object is never discarded within processor lifetime,
00176    // we just search for subevent by name once to speed up processing
00177 #ifdef ROOTCONV_WITHHODO
00178    if( 0==fHodoInputEvent && 1 == fRootConvPar->uHodoInputInTree )
00179    {
00180       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00181       if(btevent)
00182       {
00183          fHodoInputEvent=dynamic_cast<TFiberHodEvent*>(btevent->GetSubEvent("Hodo1"));
00184       }
00185       if( 0==fHodoInputEvent ) {
00186          GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event has no TFiberHodEvent!!! STOP GO4");
00187       }
00188    }
00189 #endif
00190 
00191    // Optional: if triggered mode and tree, look for the VME crate data
00192    // since input event object is never discarded within processor lifetime,
00193    // we just search for subevent by name once to speed up processing
00194 #if defined(ROOTCONV_WITHHODO)
00195    if( kFALSE == fRocPar->noTrigger && ( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay) )
00196 #else
00197    if( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay )
00198 #endif
00199    {
00200       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00201       if(btevent)
00202       {
00203          if(( 1 == fRootConvPar->uCaenInTree || 1 == fRootConvPar->uTriglogInputInTree)
00204              && fCrateInputEvent==0)
00205          {
00206             fCrateInputEvent=dynamic_cast<TMbsCrateEvent*>(btevent->GetSubEvent("MBSCRATE"));
00207 
00208             if(fCrateInputEvent==0) {
00209                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TMbsCrateEvent!!! STOP GO4");
00210             }
00211          } // if( ( 1 == fRootConvPar->uCaenInTree || 1 == fRootConvPar->uTriglogInputInTree) && fCrateInputEvent==0)
00212          if( 0 == fTriglogInputEvent && 1 == fRootConvPar->uTriglogInputInTree )
00213          {
00214                fTriglogInputEvent=dynamic_cast<TTriglogEvent*>(btevent->GetSubEvent("TRIGLOG"));
00215 
00216             if(fTriglogInputEvent==0) {
00217                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TTriglogEvent!!! STOP GO4");
00218             }
00219          } // if( 1 == fRootConvPar->uTriglogInputInTree )
00220          if( 0 == fEpicsInputEvent && 1 == fRootConvPar->uSlowControlInTree )
00221          {
00222                fEpicsInputEvent=dynamic_cast<TEpicsEvent*>(btevent->GetSubEvent("EPICS"));
00223 
00224             if(fEpicsInputEvent==0) {
00225                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TEpicsEvent!!! STOP GO4");
00226             }
00227          } // if( 1 == fRootConvPar->uSlowControlInTree )
00228       } // if(btevent)
00229          else if( 1 == fRootConvPar->uCaenInTree ||
00230                    1 == fRootConvPar->uTriglogInputInTree ||
00231                    1 == fRootConvPar->uSlowControlInTree)
00232             GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: Calibration input event not found!!! STOP GO4");
00233 
00234       btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Detector"));
00235       if(btevent)
00236       {
00237          if( 0 ==fVftxInputEvent && 1 == fRootConvPar->uVftxInTree)
00238          {
00239                fVftxInputEvent=dynamic_cast<TVftxEvent*>(btevent->GetSubEvent("VFTX"));
00240 
00241             if(fVftxInputEvent==0) {
00242                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TVftxEvent!!! STOP GO4");
00243             }
00244          } // if( 0 == fVftxInputEvent && 1 == fRootConvPar->uVftxInTree)
00245       } // if(btevent)
00246          else if( 1 == fRootConvPar->uVftxInTree )
00247             GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: Detector input event not found!!! STOP GO4");
00248 
00249       // Param need to be done!!!!
00250       btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Tracking"));
00251       if(btevent)
00252       {
00253          if( 1 == fRootConvPar->uRpcHdInTree  && fRpcHdInputEvent  ==0 )
00254          {
00255             fRpcHdInputEvent  =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_HD"));
00256 
00257             if( fRpcHdInputEvent ==0) {
00258                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for HD!!! STOP GO4");
00259             }
00260          } // if( 1 == fRootConvPar->uRpcHdInTree  && fRpcHdInputEvent  ==0 )
00261 
00262          if( ( 1 == fRootConvPar->uRpcBucInTree && fRpcBucInputEvent ==0 ) )
00263          {
00264             fRpcBucInputEvent =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_BUC_REF"));
00265 
00266             if( fRpcBucInputEvent==0) {
00267                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for Buc!!! STOP GO4");
00268             }
00269          } // if( ( 1 == fRootConvPar->uRpcBucInTree && fRpcBucInputEvent ==0 ) )
00270 
00271          if( ( 1 == fRootConvPar->uRpcBucM1InTree && fRpcBucMod1InputEvent ==0 ) )
00272          {
00273             fRpcBucMod1InputEvent =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_BUC_MOD1"));
00274 
00275             if( fRpcBucMod1InputEvent==0) {
00276                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for Buc Mod1!!! STOP GO4");
00277             }
00278          } // if( ( 1 == fRootConvPar->uRpcBucM1InTree && fRpcBucMod1InputEvent ==0 ) )
00279 
00280          if( ( 1 == fRootConvPar->uRpcBucM2InTree && fRpcBucMod2InputEvent ==0 ) )
00281          {
00282             fRpcBucMod2InputEvent =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_BUC_MOD2"));
00283 
00284             if( fRpcBucMod2InputEvent==0) {
00285                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for Buc Mod2!!! STOP GO4");
00286             }
00287          } // if( ( 1 == fRootConvPar->uRpcBucM2InTree && fRpcBucMod2InputEvent ==0 ) )
00288 
00289          if( ( 1 == fRootConvPar->uRpcBucM3InTree && fRpcBucMod3InputEvent ==0 ) )
00290          {
00291             fRpcBucMod3InputEvent =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_BUC_MOD3"));
00292 
00293             if( fRpcBucMod3InputEvent==0) {
00294                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for Buc Mod3!!! STOP GO4");
00295             }
00296          } // if( ( 1 == fRootConvPar->uRpcBucM3InTree && fRpcBucMod3InputEvent ==0 ) )
00297 
00298          if( ( 1 == fRootConvPar->uRpcBucM4InTree && fRpcBucMod4InputEvent ==0 ) )
00299          {
00300             fRpcBucMod4InputEvent =dynamic_cast<TRpcEvent*>(btevent->GetSubEvent("RPC_BUC_MOD4"));
00301 
00302             if( fRpcBucMod4InputEvent==0) {
00303                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TRpcEvent for Buc Mod4!!! STOP GO4");
00304             }
00305          } // if( ( 1 == fRootConvPar->uRpcBucM4InTree && fRpcBucMod4InputEvent ==0 ) )
00306 
00307          /* Plastics */
00308          if( ( 1 == fRootConvPar->uPlasticsInTree && fPlasticsInputEvent ==0 ) )
00309          {
00310             fPlasticsInputEvent =dynamic_cast<TPlasticsEvent*>(btevent->GetSubEvent("PLASTICS"));
00311 
00312             if( fPlasticsInputEvent==0) {
00313                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TPlasticsEvent for Plastics!!! STOP GO4");
00314             }
00315          } // if( ( 1 == fRootConvPar->uPlasticsInTree && fPlasticsInputEvent ==0 ) )
00316 
00317          /* Pad Rpc */
00318          if( ( 1 == fRootConvPar->uPadRpcInTree && fPadRpcInputEvent ==0 ) )
00319          {
00320             fPadRpcInputEvent =dynamic_cast<TPadRpcEvent*>(btevent->GetSubEvent("PADRPC"));
00321 
00322             if( fPadRpcInputEvent==0) {
00323                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TPadRpcEvent for Pad Rpc!!! STOP GO4");
00324             }
00325          } // if( ( 1 == fRootConvPar->uPadRpcInTree && fPadRpcInputEvent ==0 ) )
00326 
00327          if( 0 == fScalOrMu1InputEvent && 1 == fRootConvPar->uScalOrMuInTree )
00328          {
00329             fScalOrMu1InputEvent=dynamic_cast<TScalersEvent*>(btevent->GetSubEvent("SCALERS"));
00330 
00331             if(fScalOrMu1InputEvent==0) {
00332                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TScalersEvent!!! STOP GO4");
00333             }
00334          } // if( 1 == fRootConvPar->uTriglogInputInTree )
00335          if( 0 == fScalOrMu2InputEvent && 1 == fRootConvPar->uScalOrMu2InTree )
00336          {
00337             fScalOrMu2InputEvent=dynamic_cast<TScalersEvent*>(btevent->GetSubEvent("SCALERS2"));
00338 
00339             if(fScalOrMu2InputEvent==0) {
00340                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TScalersEvent!!! STOP GO4");
00341             }
00342          } // if( 1 == fRootConvPar->uTriglogInputInTree )
00343       } // if(btevent)
00344          else if(  1 == fRootConvPar->uRpcHdInTree ||
00345                    1 == fRootConvPar->uRpcBucInTree ||
00346                    1 == fRootConvPar->uRpcBucM1InTree ||
00347                    1 == fRootConvPar->uRpcBucM2InTree ||
00348                    1 == fRootConvPar->uRpcBucM3InTree ||
00349                    1 == fRootConvPar->uRpcBucM4InTree ||
00350                    1 == fRootConvPar->uPlasticsInTree ||
00351                    1 == fRootConvPar->uPadRpcInTree ||
00352                    1 == fRootConvPar->uScalOrMuInTree ||
00353                    1 == fRootConvPar->uScalOrMu2InTree )
00354             GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: Tracking input event not found!!! STOP GO4");
00355 
00356       if( 1 == fRootConvPar->uMatchingInTree )
00357       {
00358          if(fMatchingInputEvent==0)
00359          {
00360             TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent());
00361             if(btevent)
00362             {
00363                fMatchingInputEvent=dynamic_cast<TMatchingEvent*>(btevent->GetSubEvent("MATCHING"));
00364             }
00365 
00366             if(fMatchingInputEvent==0) {
00367                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TMatchingEvent!!! STOP GO4");
00368             }
00369          } // if(fMatchingInputEvent==0)
00370       } // if( 1 == fRootConvPar->uMatchingInTree )
00371 
00372    } // if( kFALSE == fRocPar->noTrigger && ( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay) )
00373       else if( 1 == fRootConvPar->uSlowControlInTree )
00374       {
00375          TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(GetInputEvent("Calibration"));
00376          if(fEpicsInputEvent==0)
00377          {
00378             if(btevent)
00379             {
00380                fEpicsInputEvent=dynamic_cast<TEpicsEvent*>(btevent->GetSubEvent("EPICS"));
00381             }
00382 
00383             if(fEpicsInputEvent==0) {
00384                GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: input event is/has not a TEpicsEvent!!! STOP GO4");
00385             }
00386          } // if(fEpicsInputEvent==0)
00387       } //  else if( 1 == fRootConvPar->uSlowControlInTree )
00388 
00389    // then assign output event
00390    // since output event object is never discarded within processor lifetime,
00391    // we just search for subevent by name once to speed up processing
00392    if(fOutputEvent==0)
00393    {
00394       TCBMBeamtimeEvent* btevent=dynamic_cast<TCBMBeamtimeEvent*>(outevnt);
00395       if(btevent)
00396       {
00397          fOutputEvent=dynamic_cast<TRootConverterEvent*>(btevent->GetSubEvent("ROOTCONV"));
00398       }
00399       else
00400       {
00401 
00402             fOutputEvent= dynamic_cast<TRootConverterEvent*>(outevnt);
00403       }
00404       if(fOutputEvent==0) {
00405       GO4_STOP_ANALYSIS_MESSAGE("**** TRootConverterProc: Fatal error: output event is not a TRootConverterEvent!!! STOP GO4");
00406       }
00407 
00408    }
00409 
00410    // Prepare root tree and tree output file
00411    if( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay)
00412    {
00413       if( 0 == cleanTree)
00414       {
00415          TGo4Log::Info("**** TRootConverter: Create tree ");
00416 
00417          if( 1 == fRootConvPar->uCleanOuputEnable )
00418          {
00419             oldDir = gDirectory;
00420 
00421             sOutputFilename = fRootConvPar->sOutputFilename;
00422             fRootOut= new TFile(sOutputFilename, "RECREATE", "TTree file from GET4 and CAEN v1290", 9);
00423             sOutputFilename += ":/";
00424             if (fRootOut->IsZombie()) {
00425                cout << "Error opening file for TTree output in TRootConverter" << endl;
00426             }
00427 
00428             gDirectory->Cd(sOutputFilename);
00429          }
00430 
00431          if( 0 == TGo4Analysis::Instance()->GetTree( "GsiAug12" ) )
00432          {
00433             cleanTree = new TTree("GsiAug12", "GSI August 2012 data");
00434             TGo4Log::Info("Output Tree created in %s", gDirectory->GetPath());
00435          } // if( 0 == TGo4Analysis::Instance()->GetTree( "GsiAug12" ) )
00436             else
00437             {
00438                cleanTree = TGo4Analysis::Instance()->GetTree( "GsiAug12" );
00439                TGo4Log::Info("Output Tree recovered from Go4");
00440             } // else of if( 0 == TGo4Analysis::Instance()->GetTree( "GsiAug12" ) )
00441 
00442          // To prevent having multiple trees when opening the file with Go4 -> Not right solution
00443 //         cleanTree->SetAutoFlush(0);
00444 
00445          // Data from CAEN v1290 & Lecroy QDC VME boards (triggered)
00446 #if defined(ROOTCONV_WITHHODO)
00447          if( kFALSE == fRocPar->noTrigger )
00448 #endif
00449          {
00450             if( -1 != fRootConvPar->iReferenceTdc && -1 != fRootConvPar->iReferenceChannel1 && 1 == fRootConvPar->uCaenInTree)
00451             {
00452                cleanTree->Branch("CaenRef1_Leading",
00453                                  &((fCrateInputEvent->fMtdc[fRootConvPar->iReferenceTdc]).lead[fRootConvPar->iReferenceChannel1]),
00454                                  "CaenRef1_Leading/I" );
00455                cleanTree->Branch("CaenRef1_Trailing",
00456                                  &((fCrateInputEvent->fMtdc[fRootConvPar->iReferenceTdc]).trail[fRootConvPar->iReferenceChannel1]),
00457                                  "CaenRef1_Trailing/I" );
00458             } // if( -1 != fRootConvPar->iReferenceTdc && -1 != fRootConvPar->iReferenceChannel && 1 == fRootConvPar->uCaenInTree )
00459             if( -1 != fRootConvPar->iReferenceTdc && -1 != fRootConvPar->iReferenceChannel2 && 1 == fRootConvPar->uCaenInTree )
00460             {
00461                cleanTree->Branch("CaenRef2_Leading",
00462                                  &((fCrateInputEvent->fMtdc[fRootConvPar->iReferenceTdc]).lead[fRootConvPar->iReferenceChannel2]),
00463                                  "CaenRef2_Leading/I" );
00464                cleanTree->Branch("CaenRef2_Trailing",
00465                                  &((fCrateInputEvent->fMtdc[fRootConvPar->iReferenceTdc]).trail[fRootConvPar->iReferenceChannel2]),
00466                                  "CaenRef2_Trailing/I" );
00467             } // if( -1 != fRootConvPar->iReferenceTdc && -1 != fRootConvPar->iReferenceChannel && 1 == fRootConvPar->uCaenInTree )
00468             
00469             if( 1 == fRootConvPar->uCaenMode )
00470             {
00471                for( Int_t iCaenBoard = 0; iCaenBoard<MAX_1290; iCaenBoard ++)
00472                   if( 1 == fRootConvPar->uGeneralCaenTdcEnabled[iCaenBoard])
00473                   {
00474                      cleanTree->Branch(Form("Caen%d_TriggerTime", iCaenBoard),  
00475                                        &( (fCrateInputEvent->fMtdc[iCaenBoard]).extended_trigger_time ),
00476                                        Form("Caen%d_TriggerTime/I", iCaenBoard )  );
00477                                        
00478                      // The multiple hits array for CAEN v1290 now also include first hit
00479                      // => either add to tree the first hit or add to tree only the multiple hit array
00480                      if( 1 == fRootConvPar->uCaenMulti )
00481                      {
00482                cleanTree->Branch(Form("Caen%d_Leading_NbHit", iCaenBoard), 
00483                                  (fCrateInputEvent->fMtdc[iCaenBoard]).hit_lead,
00484                                  Form("Caen%d_Leading_NbHit[%u]/I", iCaenBoard, T1290Data::NumChan ) );
00485                cleanTree->Branch(Form("Caen%d_Trailing_NbHit", iCaenBoard), 
00486                                  (fCrateInputEvent->fMtdc[iCaenBoard]).hit_trail,
00487                                  Form("Caen%d_Trailing_NbHit[%u]/I", iCaenBoard, T1290Data::NumChan ) );
00488                cleanTree->Branch(Form("Caen%d_Leading_multi", iCaenBoard),  
00489                                  (fCrateInputEvent->fMtdc[iCaenBoard]).lead_multi,
00490                                  Form("Caen%d_Leading_multi[%u][%u]/I", iCaenBoard, T1290Data::NumChan, T1290Data::MaxHits )  );
00491                cleanTree->Branch(Form("Caen%d_Trailing_multi", iCaenBoard), 
00492                                  (fCrateInputEvent->fMtdc[iCaenBoard]).trail_multi,
00493                                  Form("Caen%d_Trailing_multi[%u][%u]/I", iCaenBoard, T1290Data::NumChan, T1290Data::MaxHits ) );
00494                      } // if( 1 == fRootConvPar->uCaenMulti )
00495                         else
00496                         {
00497                      cleanTree->Branch(Form("Caen%d_Leading", iCaenBoard),  
00498                                        (fCrateInputEvent->fMtdc[iCaenBoard]).lead,
00499                                        Form("Caen%d_Leading[%u]/I", iCaenBoard, T1290Data::NumChan )  );
00500                      cleanTree->Branch(Form("Caen%d_Trailing", iCaenBoard), 
00501                                        (fCrateInputEvent->fMtdc[iCaenBoard]).trail,
00502                                        Form("Caen%d_Trailing[%u]/I", iCaenBoard, T1290Data::NumChan ) );
00503                         } // else of if( 1 == fRootConvPar->uCaenMulti )
00504                   } // if( 1 == fRootConvPar->uGeneralCaenTdcEnabled[iCaenBoard])
00505             } // if( 1 == fRootConvPar->uCaenMode )
00506             
00507             if( -1 != fRootConvPar->iPmtTdc && 0 == fRootConvPar->uCaenMode)
00508             {
00509                cleanTree->Branch("PmtTdc_Leading",  (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).lead,
00510                                  Form("PmtTdc_Leading[%u]/I", T1290Data::NumChan )  );
00511                cleanTree->Branch("PmtTdc_Trailing", (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).trail,
00512                                  Form("PmtTdc_Trailing[%u]/I", T1290Data::NumChan ) );
00513                cleanTree->Branch("PmtTdc_Leading_NbHit", (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).hit_lead,
00514                                     Form("PmtTdc_Leading_NbHit[%u]/I", T1290Data::NumChan ) );
00515                cleanTree->Branch("PmtTdc_Trailing_NbHit", (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).hit_trail,
00516                                  Form("PmtTdc_Trailing_NbHit[%u]/I", T1290Data::NumChan ) );
00517                cleanTree->Branch("PmtTdc_Leading_multi",  (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).lead_multi,
00518                                  Form("PmtTdc_Leading_multi[%u][%u]/I", T1290Data::NumChan, T1290Data::MaxHits )  );
00519                cleanTree->Branch("PmtTdc_Trailing_multi", (fCrateInputEvent->fMtdc[fRootConvPar->iPmtTdc]).trail_multi,
00520                                  Form("PmtTdc_Trailing_multi[%u][%u]/I", T1290Data::NumChan, T1290Data::MaxHits ) );
00521             } // if( -1 != fRootConvPar->iPmtTdc )
00522             if( -1 != fRootConvPar->iRpcTdcLeading && -1 != fRootConvPar->iRpcTdcTrailing && 0 == fRootConvPar->uCaenMode )
00523             {
00524                cleanTree->Branch("CaenRpc_Leading",  (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcLeading]).lead,
00525                                  Form("CaenRpc_Leading[%u]/I", T1290Data::NumChan )  );
00526                cleanTree->Branch("CaenRpc_Trailing", (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcTrailing]).trail,
00527                                  Form("CaenRpc_Trailing[%u]/I", T1290Data::NumChan ) );
00528                cleanTree->Branch("CaenRpc_Leading_NbHit", (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcLeading]).hit_lead,
00529                                     Form("CaenRpc_Leading_NbHit[%u]/I", T1290Data::NumChan ) );
00530                cleanTree->Branch("CaenRpc_Trailing_NbHit", (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcTrailing]).hit_trail,
00531                                  Form("CaenRpc_Trailing_NbHit[%u]/I", T1290Data::NumChan ) );
00532                cleanTree->Branch("CaenRpc_Leading_multi",  (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcLeading]).lead_multi,
00533                                  Form("CaenRpc_Leading_multi[%u][%u]/I", T1290Data::NumChan, T1290Data::MaxHits )  );
00534                cleanTree->Branch("CaenRpc_Trailing_multi", (fCrateInputEvent->fMtdc[fRootConvPar->iRpcTdcTrailing]).trail_multi,
00535                                  Form("CaenRpc_Trailing_multi[%u][%u]/I", T1290Data::NumChan, T1290Data::MaxHits ) );
00536             } // if( -1 != fRootConvPar->iRpcTdcLeading && -1 != fRootConvPar->iRpcTdcTrailing && 0 == fRootConvPar->uCaenMode )
00537             
00538             if( -1 != fRootConvPar->iPmtQdc )
00539             {
00540                cleanTree->Branch("PmtQdc", fCrateInputEvent->fData1182[fRootConvPar->iPmtQdc], Form("PmtQdc[%u]/s", NUM_1182_CH ) );
00541             } // if( -1 != fRootConvPar->iPmtQdc )
00542 
00543             if( 1 == fRootConvPar->uTriglogInputInTree)
00544             {
00545                cleanTree->Branch("TriglogSyncNb",  &(fTriglogInputEvent->fVulomSyncNumber),
00546                                  "TriglogSyncNb/i"  );
00547                cleanTree->Branch("TriglogPattern",  &(fTriglogInputEvent->fVulomTriggerPattern),
00548                                  "TriglogPattern/i"  );
00549                cleanTree->Branch("TriglogInputPattern",  &(fCrateInputEvent->fTriglogInputPattern),
00550                                  "TriglogInputPattern/i"  );
00551                cleanTree->Branch("TriglogTimeSec",  &(fTriglogInputEvent->fMbsTimeSecs),
00552                                  "TriglogTimeSec/i"  );
00553                cleanTree->Branch("TriglogTimeMilsec",  &(fTriglogInputEvent->fMbsTimeMillisec),
00554                                  "TriglogTimeMilsec/i"  );
00555                cleanTree->Branch("TriglogScalers1",  (fTriglogInputEvent->fVulomScaler[0]),
00556                                  Form("TriglogScalers1[%u]/i", N_SCALERS_CH )  );
00557                cleanTree->Branch("TriglogScalers2",  (fTriglogInputEvent->fVulomScaler[1]),
00558                                  Form("TriglogScalers2[%u]/i", N_SCALERS_CH )  );
00559                cleanTree->Branch("TriglogScalers3",  (fTriglogInputEvent->fVulomScaler[2]),
00560                                  Form("TriglogScalers3[%u]/i", N_SCALERS_CH )  );
00561             } // if( 1 == fRootConvPar->uTriglogInputInTree)
00562             if( 1 == fRootConvPar->uVftxInTree)
00563             {
00564                for( Int_t iVftxBoard = 0; iVftxBoard<MAX_FPGA_TDC; iVftxBoard ++)
00565                   if( 1 == fRootConvPar->uVftxEnabled[iVftxBoard])
00566                   {
00567                      TString sBrNameTrigg  = Form("Vftx%dTriggerTime", iVftxBoard);
00568                      TString sBrNameMulti  = Form("Vftx%dMultiplicity", iVftxBoard);
00569                      TString sBrNameFineT  = Form("Vftx%dFineTime", iVftxBoard);
00570                      TString sBrNameCoarT  = Form("Vftx%dCoarseTime", iVftxBoard);
00571                      TString sBrNameFutuB  = Form("Vftx%dFutureBit", iVftxBoard);
00572                      TString sBrNameTimeC  = Form("Vftx%dTimeCorr", iVftxBoard);
00573                      TString sBrNameFtCorr = Form("Vftx%dFineTimeCorr", iVftxBoard);
00574 
00575                cleanTree->Branch( sBrNameTrigg,  &((fVftxInputEvent->fVftxBoards[iVftxBoard]).iTriggerTime),
00576                                   sBrNameTrigg + "/I" );
00577                cleanTree->Branch( sBrNameMulti,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).iMultiplicity),
00578                                   sBrNameMulti + Form("[%u]/I", FPGA_TDC_NBCHAN )  );
00579                      if( 1 == fRootConvPar->uVftxFullDataMode )
00580                      {
00581                cleanTree->Branch( sBrNameFineT,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).iFineTime),
00582                                   sBrNameFineT + Form("[%u][%u]/I", FPGA_TDC_NBCHAN, TVftxBoardData::MaxMult )  );
00583                cleanTree->Branch( sBrNameCoarT,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).iCoarseTime),
00584                                   sBrNameCoarT + Form("[%u][%u]/I", FPGA_TDC_NBCHAN, TVftxBoardData::MaxMult )  );
00585                cleanTree->Branch( sBrNameFutuB,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).uFutureBit),
00586                                   sBrNameFutuB + Form("[%u][%u]/i", FPGA_TDC_NBCHAN, TVftxBoardData::MaxMult )  );
00587                cleanTree->Branch( sBrNameFtCorr,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).dFineTimeCorr),
00588                                   sBrNameFtCorr + Form("[%u][%u]/D", FPGA_TDC_NBCHAN, TVftxBoardData::MaxMult )  );
00589                      } //if( 1 == fRootConvPar->uVftxFullDataMode )
00590 
00591                cleanTree->Branch( sBrNameTimeC,  ((fVftxInputEvent->fVftxBoards[iVftxBoard]).dTimeCorr),
00592                                   sBrNameTimeC + Form("[%u][%u]/D", FPGA_TDC_NBCHAN, TVftxBoardData::MaxMult )  );
00593                   } // if( 1 == fRootConvPar->uVftxEnabled[iVftxBoard])
00594             } // if( 1 == fRootConvPar->uVftxInTree)
00595             if( 1 == fRootConvPar->uScalOrMuInTree)
00596             {
00597                cleanTree->Branch("ScalOrMuScalers",  (fCrateInputEvent->fScalOrMu).uScaler,
00598                                  Form("ScalOrMuScalers[%u]/i", SCALORMU_NB_SCAL )  );
00599             } // if( 1 == fRootConvPar->uVftxInTree)
00600 
00601             if( 1 == fRootConvPar->uRpcHdInTree)
00602             {
00603                cleanTree->Branch("RpcHdEvent",      "TRpcEvent", &fRpcHdInputEvent);
00604             }
00605             if( 1 == fRootConvPar->uRpcBucInTree)
00606             {
00607                cleanTree->Branch("RpcBucEvent",     "TRpcEvent", &fRpcBucInputEvent);
00608             }
00609             if( 1 == fRootConvPar->uRpcBucM1InTree)
00610             {
00611                cleanTree->Branch("RpcBucMod1Event", "TRpcEvent", &fRpcBucMod1InputEvent);
00612             }
00613             if( 1 == fRootConvPar->uRpcBucM2InTree)
00614             {
00615                cleanTree->Branch("RpcBucMod2Event", "TRpcEvent", &fRpcBucMod2InputEvent);
00616             }
00617             if( 1 == fRootConvPar->uRpcBucM3InTree)
00618             {
00619                cleanTree->Branch("RpcBucMod3Event", "TRpcEvent", &fRpcBucMod3InputEvent);
00620             }
00621             if( 1 == fRootConvPar->uRpcBucM4InTree)
00622             {
00623                cleanTree->Branch("RpcBucMod4Event", "TRpcEvent", &fRpcBucMod4InputEvent);
00624             }
00625             if( 1 == fRootConvPar->uPlasticsInTree)
00626             {
00627                cleanTree->Branch("PlasticsEvent",   "TPlasticsEvent", &fPlasticsInputEvent);
00628             }
00629             if( 1 == fRootConvPar->uPadRpcInTree)
00630             {
00631                cleanTree->Branch("PadRpcEvent",     "TPadRpcEvent", &fPadRpcInputEvent);
00632             }
00633             if( 1 == fRootConvPar->uScalOrMuInTree)
00634             {
00635                cleanTree->Branch("ScalOrMu1Event",  "TScalersEvent", &fScalOrMu1InputEvent);
00636             }
00637             if( 1 == fRootConvPar->uScalOrMu2InTree)
00638             {
00639                cleanTree->Branch("ScalOrMu2Event",  "TScalersEvent", &fScalOrMu2InputEvent);
00640             }
00641 
00642             if( 1 == fRootConvPar->uMatchingInTree)
00643             {
00644                cleanTree->Branch("MatchingEvent",  "TMatchingEvent", &fMatchingInputEvent);
00645             }
00646          } // if( kFALSE == fRocPar->noTrigger )
00647          
00648 #ifdef ROOTCONV_WITHHODO
00649          if( 1 == fRootConvPar->uHodoInputInTree )
00650          {
00651             cleanTree->Branch("HodoscopeX",  &(hitHodoscope.X),"HodoscopeX/D");
00652             cleanTree->Branch("HodoscopeY",  &(hitHodoscope.Y),"HodoscopeY/D");
00653          } // if( 1 == fRootConvPar->uHodoInputInTree )
00654 #endif
00655 
00656          if( 1 == fRootConvPar->uSlowControlInTree )
00657          {
00658             uSlowControlUpdateTime = 0;
00659             cleanTree->Branch( "TimeEpicsUpdate", &(uSlowControlUpdateTime),
00660                                "TimeEpicsUpdate/i"  );
00661             vdPositiveHvI.clear();
00662             vdPositiveHvU.clear();
00663             vdNegativeHvI.clear();
00664             vdNegativeHvU.clear();
00665             vdPositiveHvI.resize(fRootConvPar->uNbSlowControlChan);
00666             vdPositiveHvU.resize(fRootConvPar->uNbSlowControlChan);
00667             vdNegativeHvI.resize(fRootConvPar->uNbSlowControlChan);
00668             vdNegativeHvU.resize(fRootConvPar->uNbSlowControlChan);
00669             for( UInt_t uChannelHV = 0; uChannelHV < fRootConvPar->uNbSlowControlChan; uChannelHV++)
00670             {
00671                cleanTree->Branch( fRootConvPar->sScOutputNamePosI[uChannelHV], &(vdPositiveHvI.at(uChannelHV)),
00672                                  fRootConvPar->sScOutputNamePosI[uChannelHV] + Form("/D" )  );
00673                cleanTree->Branch( fRootConvPar->sScOutputNamePosU[uChannelHV], &(vdPositiveHvU.at(uChannelHV)),
00674                                  fRootConvPar->sScOutputNamePosU[uChannelHV] + Form("/D" )  );
00675                cleanTree->Branch( fRootConvPar->sScOutputNameNegI[uChannelHV], &(vdNegativeHvI.at(uChannelHV)),
00676                                  fRootConvPar->sScOutputNameNegI[uChannelHV] + Form("/D" )  );
00677                cleanTree->Branch( fRootConvPar->sScOutputNameNegU[uChannelHV], &(vdNegativeHvU.at(uChannelHV)),
00678                                  fRootConvPar->sScOutputNameNegU[uChannelHV] + Form("/D" )  );
00679                vdPositiveHvI.at(uChannelHV) = 0;
00680                vdPositiveHvU.at(uChannelHV) = 0;
00681                vdNegativeHvI.at(uChannelHV) = 0;
00682                vdNegativeHvU.at(uChannelHV) = 0;
00683             } // for( UInt_t uChannelHV = 0; uChannelHV < fRootConvPar->uNbSlowControlChan; uChannelHV++)
00684          } // if( 1 == fRootConvPar->uSlowControlInTree )
00685 
00686          cleanTree->SetDirectory(gDirectory);
00687 
00688          if( 1 == fRootConvPar->uRootDisplay && 0 == TGo4Analysis::Instance()->GetTree( "GsiAug12" ))
00689          {
00690             TGo4Analysis::Instance()->AddTree(cleanTree );
00691             TGo4Log::Info("Root Tree registered in Go4: %p", TGo4Analysis::Instance()->GetTree( "GsiAug12" ) );
00692          }
00693       } // if( 0 == cleanTree)
00694    } // if( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay)
00695 }
00696 
00697 
00698 void TRootConverterProc::FinalizeEvent()
00699 {
00700    if( 0 == fRootConvPar->uCleanOuputEnable && 0 == fRootConvPar->uRootDisplay)
00701          return;
00702    if( 0 == fRootConvPar->uCleanOuputEnable && 1 == fRootConvPar->uRootDisplay &&
00703        fRootConvPar->uEventsUntilReset <= cleanTree->GetEntries())
00704       cleanTree->Reset("");
00705 
00706    if(!fCrateInputEvent->IsValid() ) return; // skip incomplete mbs events from first step
00707    if( 1 == fRootConvPar->uTriglogInputInTree )
00708       if( !fTriglogInputEvent->IsValid() )
00709          return; // skip incomplete triglog events from first step
00710    if( 1 == fRootConvPar->uVftxInTree )
00711       if( !fVftxInputEvent->IsValid() )
00712          cout<<"Invalid VFTX event! event "<<uNbEvents<<endl;
00713 
00714    uNbEvents++;
00715 
00716    // Fill the tree
00717    if( ( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay) )
00718    {
00719 #ifdef ROOTCONV_WITHHODO
00720       if( 1 == fRootConvPar->uHodoInputInTree )
00721       {
00722          if( 1 == fRootConvPar->uHodoDebugHisto)
00723             hNbClustersPerEventHodoscope->Fill( fHodoInputEvent->NumHits() );
00724 
00725          if( 0 < fHodoInputEvent->NumHits() )
00726          {
00727             hitHodoscope = fHodoInputEvent->Hit(0);
00728             if( 1 == fRootConvPar->uTriglogInputInTree && 1 == fRootConvPar->uHodoDebugHisto )
00729             {
00730                if( 0 == uFirstMbsTime)
00731                {
00732                   uFirstMbsTime = fTriglogInputEvent->fMbsTimeSecs;
00733                   uSpillStartMbsTime = fTriglogInputEvent->fMbsTimeSecs- uFirstMbsTime;
00734                   uLastMbsTime = fTriglogInputEvent->fMbsTimeSecs;
00735 
00736                   uFirstMbsTimeMs = fTriglogInputEvent->fMbsTimeMillisec;
00737                   uSpillStartMbsTimeMs = fTriglogInputEvent->fMbsTimeMillisec- uFirstMbsTimeMs;
00738                }
00739 
00740                hHit2DvsSeconds->Fill( fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime,
00741                      fHodoInputEvent->Hit(0).X, fHodoInputEvent->Hit(0).Y);
00742 
00743                if( 20 < fTriglogInputEvent->fMbsTimeSecs - uLastMbsTime )
00744                {
00745                   uSpillStartMbsTime = fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime;
00746                   uSpillStartMbsTimeMs = fTriglogInputEvent->fMbsTimeMillisec - uFirstMbsTimeMs;
00747                }
00748 
00749                hHit2DvsSecondsInSpill->Fill(
00750                      fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime - uSpillStartMbsTime,
00751                      fHodoInputEvent->Hit(0).X, fHodoInputEvent->Hit(0).Y);
00752 
00753                hHit2DvsMilliSecondsInSpill->Fill(
00754                      (fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime - uSpillStartMbsTime)*1000 +
00755                      fTriglogInputEvent->fMbsTimeMillisec - uFirstMbsTimeMs - uSpillStartMbsTimeMs,
00756                      fHodoInputEvent->Hit(0).X, fHodoInputEvent->Hit(0).Y);
00757 
00758                hHitXvsMilliSecondsInSpill->Fill(
00759                      (fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime - uSpillStartMbsTime)*1000 +
00760                      fTriglogInputEvent->fMbsTimeMillisec - uFirstMbsTimeMs - uSpillStartMbsTimeMs,
00761                      fHodoInputEvent->Hit(0).X );
00762                hHitYvsMilliSecondsInSpill->Fill(
00763                      (fTriglogInputEvent->fMbsTimeSecs - uFirstMbsTime - uSpillStartMbsTime)*1000 +
00764                      fTriglogInputEvent->fMbsTimeMillisec - uFirstMbsTimeMs - uSpillStartMbsTimeMs,
00765                      fHodoInputEvent->Hit(0).Y );
00766 
00767                uLastMbsTime  = fTriglogInputEvent->fMbsTimeSecs;
00768 
00769             } // if( 1 == fRootConvPar->uTriglogInputInTree && 1 == fRootConvPar->uHodoDebugHisto )
00770          } // if( 0 < fHodoInputEvent->NumHits() )
00771       } // if( 1 == fRootConvPar->uHodoInputInTree )
00772 #endif
00773       if( 1 == fRootConvPar->uSlowControlInTree )
00774       {
00775          if( kTRUE == fEpicsInputEvent->IsValid() )
00776          {
00777             TString sVariableName = "";
00778             if( 0 == uEpicsTimeOrigin )
00779                uEpicsTimeOrigin = fEpicsInputEvent->fUTimeSeconds;
00780             hTimeEpicsUpdates->Fill( (fEpicsInputEvent->fUTimeSeconds )% 1000);
00781             uSlowControlUpdateTime = fEpicsInputEvent->fUTimeSeconds;
00782             for(UInt_t uEpicsVariableIndex = 0; uEpicsVariableIndex < fEpicsInputEvent->GetNumDoubles(); uEpicsVariableIndex++ )
00783             {
00784                sVariableName = fEpicsInputEvent->GetDoubleName( uEpicsVariableIndex );
00785                for( UInt_t uChannelHV = 0; uChannelHV < fRootConvPar->uNbSlowControlChan; uChannelHV++)
00786                {
00787                   if( sVariableName == fRootConvPar->sScInputNamePosI[uChannelHV])
00788                   {
00789                      vdPositiveHvI.at(uChannelHV) = fEpicsInputEvent->GetDouble(uEpicsVariableIndex);
00790                      break;
00791                   }
00792                   if( sVariableName == fRootConvPar->sScInputNamePosU[uChannelHV])
00793                   {
00794                      vdPositiveHvU.at(uChannelHV) = fEpicsInputEvent->GetDouble(uEpicsVariableIndex);
00795                      break;
00796                   }
00797                   if( sVariableName == fRootConvPar->sScInputNameNegI[uChannelHV])
00798                   {
00799                      vdNegativeHvI.at(uChannelHV) = fEpicsInputEvent->GetDouble(uEpicsVariableIndex);
00800                      break;
00801                   }
00802                   if( sVariableName == fRootConvPar->sScInputNameNegU[uChannelHV])
00803                   {
00804                      vdNegativeHvU.at(uChannelHV) = fEpicsInputEvent->GetDouble(uEpicsVariableIndex);
00805                      break;
00806                   }
00807                } //  for( UInt_t uChannelHV = 0; uChannelHV < fRootConvPar->uNbSlowControlChan; uChannelHV++)
00808             } // for(UInt_t uEpicsVariableIndex = 0; uEpicsVariableIndex < fEpicsInputEvent->GetNumDoubles(); uEpicsVariableIndex++ )
00809          } // if( kTRUE == fEpicsInputEvent->IsValid() )
00810       } // if( 1 == fRootConvPar->uSlowControlInTree )
00811 
00812       cleanTree->Fill();
00813    } // if( ( 1 == fRootConvPar->uCleanOuputEnable || 1 == fRootConvPar->uRootDisplay) )
00814 
00815    fOutputEvent->SetValid(kTRUE);
00816 }

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