00001
00002 #include "TFndGenInfo.h"
00003 #include "TFndHdt.h"
00004 #include "Gui.h"
00005
00006 #include "AccessHDT_MultiRun.C"
00007
00008 #include "FROOT.h"
00009 using namespace FROOT;
00010
00011 static const Float_t K_EN_THR = 1000;
00012
00013 class HdtAppl_TofiPID: public THdtAccess{
00014
00015 private:
00016
00017 TFndHTof *fHtof;
00018
00019
00020 public:
00021 HdtAppl_TofiPID();
00022 ~HdtAppl_TofiPID();
00023
00024 void InitProcess();
00025 void FinishProcess();
00026
00027 void Pre_Run_Operation();
00028 void Post_Run_Operation();
00029
00030 void UseHdtEvent();
00031
00032
00033 static Bool_t CheckBtb(const Int_t &sl_ref,const Int_t &sl_opp);
00034
00035
00036
00037 ClassDef(HdtAppl_TofiPID,1)
00038 };
00039
00040 ClassImp(HdtAppl_TofiPID)
00041
00042
00043 HdtAppl_TofiPID::HdtAppl_TofiPID()
00044 {
00045
00046
00047
00048 }
00049
00050
00051 HdtAppl_TofiPID::~HdtAppl_TofiPID(){
00052
00053 FinishRun();
00054
00055 fHtof = 0;
00056
00057 }
00058
00059
00060 void HdtAppl_TofiPID::InitProcess(){
00061
00062 cout << "Initializing process" << endl;
00063
00064 }
00065
00066
00067 void HdtAppl_TofiPID::FinishProcess(){
00068
00069 cout << "Finishing process" << endl;
00070
00071 }
00072
00073
00074 void HdtAppl_TofiPID::Pre_Run_Operation(){
00075
00076 cout << "Performing pre-run operation for run " << fCurrentRun << endl;
00077
00078 }
00079
00080
00081 void HdtAppl_TofiPID::Post_Run_Operation(){
00082
00083 cout << "Performing post-run operation for run " << fCurrentRun << endl;
00084
00085 }
00086
00087
00088 void HdtAppl_TofiPID::UseHdtEvent(){
00089
00090 Int_t evnum = fCurHdtEv->GetEventNumber();
00091 cout << "...............Using Hdt-Event (" << evnum << ")" << endl;
00092
00093 Int_t nhits = fCurHdtEv->GetNumberOfTofHits();
00094
00095 const Int_t nsl = K_N_TOFINO_SLABS;
00096
00097 Bool_t IsHighTdc[nsl] = { kFALSE };
00098 Bool_t IsHighAdc[nsl] = { kFALSE };
00099 Bool_t IsTrigOk[nsl] = { kFALSE };
00100
00101
00102 for(Int_t nh=0; nh<nhits; nh++){
00103 fHtof = fCurHdtEv->GetTofHit(nh);
00104 Int_t slab = fHtof->GetSlab();
00105 if(slab < 1 || slab > nsl) continue;
00106
00107
00108 cout << endl<< "nh: " << nh << "--------------" << endl;
00109 fHtof->PrintHit(2);
00110
00111
00112 if(fHtof->GetHighMeanTimer() > -1) IsHighTdc[slab-1] = kTRUE;
00113
00114 Float_t chrg = -1;
00115 chrg = fHtof->GetCalibAdcE() * fHtof->GetCalibAdcP();
00116 if(chrg > 0){
00117 chrg = TMath::Sqrt(chrg);
00118 if( chrg > K_EN_THR) IsHighAdc[slab-1] = kTRUE;
00119 }
00120 }
00121
00122
00123 Bool_t chk_res1 = 1;
00124 if(chk_res1){
00125 cout << "Slabs over TDC high threshold: ";
00126 for(Int_t i=0; i<nsl; i++) if( IsHighTdc[i] ) cout << " " << i+1;
00127 cout << endl;
00128
00129 cout << "Slabs over charge high threshold: ";
00130 for(Int_t i=0; i<nsl; i++) if( IsHighAdc[i] ) cout << " " << i+1;
00131 cout << endl << endl;
00132 }
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143 }
00144
00145
00146
00150 Bool_t HdtAppl_TofiPID::CheckBtb(const Int_t &sl_ref,const Int_t &sl_opp){
00151
00152 for(Int_t of = 5 ; of <= 7 ; of++){
00153 Int_t check = ( (sl_ref+of) <= 12 ) ? ( sl_ref + of ) : ( sl_ref - (12-of) ) ;
00154 if(check == sl_opp) return kTRUE;
00155 }
00156
00157 return kFALSE;
00158 }
00159
00160
00161
00162
00163
00164
00165 void Tofino_PID_Check(TString run_type="FINU",Int_t first_run = -1,Int_t last_run = -1,Int_t n_evs_run=-1,Int_t n_evs_tot=-1){
00166
00167
00168
00169
00170 HdtAppl_TofiPID *hdt_appl = new HdtAppl_TofiPID();
00171 Int_t debug_lev = 0;
00172
00173 hdt_appl->SetVerboseLevel(0);
00174 hdt_appl->SetUpdateEvGap(3000);
00175
00176 hdt_appl->Init("$MSQL_DB_HOST","$RDT",run_type,first_run,last_run,n_evs_run,n_evs_tot,debug_lev);
00177
00178 hdt_appl->InitProcess();
00179
00180 Int_t res_loop = hdt_appl->RunLoop();
00181 cout << "Number of missing runs: " << res_loop << endl;
00182
00183
00184
00185
00186
00187 hdt_appl->FinishProcess();
00188
00189 delete hdt_appl;
00190
00191 }