PREAN/TFndProcessRec.h

00001 // @(#)fROOT/PREAN:$Name:  $:$Id: TFndProcessRec.h,v 1.11 2007/09/21 15:30:56 Diego_Faso Exp $
00002 // Final Revision Author: Diego Faso <mailto:faso@to.infn.it>, 2006/10/30
00003 // First Revision Author: B. Dalena, D. Di Santo, D. Faso, G. Simonetti
00004 // Original Author: Valerio Filippini, Alberto Panzarasa (2000)
00005 
00007 //                                                                       //
00008 //            Prototypes for FORTRAN fidarc functions                    //
00009 //                                                                       //
00011 
00012 #ifndef FROOT_TFndProcessRec
00013 #define FROOT_TFndProcessRec
00014 
00015 extern "C" {
00016   void gzcali_(int*); 
00017   void hlimit_(int*); 
00018   void uginit_();
00019   void fin_open_(char *fname, int *iout, int *ierr); // from readlib.cpp
00020   void fin_close_();                                 // from readlib.cpp
00021   int* get_current_raw_event_();  // from readlib.cpp
00022   void fin_open03_(char *fname, int *iout, int *ierr); // from readlib03.cpp
00023   void fin_close03_();                                 // from readlib03.cpp
00024   int* get_current_raw_event03_();  // from readlib03.cpp
00025   void ginit_();   // within uginit
00026   void ffset_(char*,int*); // within uginit
00027   void houtpu_(int*);      // within uginit
00028   void uvinit_();  // within uginit
00029   void ugffgo_();  // within uginit
00030   void gffgo_();   // within uginit
00031   void uginou_(int*);   // within uginit
00032   void gzinit_();  // within uginit
00033   void gdinit_();  // within uginit
00034   void reageo_();  // within uginit
00035   void ggclos_();  // within uginit
00036   void gphysi_();  // within uginit
00037   void ugidbg_();  // within uginit
00038   void ugeoin_();  // within uginit
00039   void genini_();  // within uginit
00040   void tofini_();  // within uginit
00041   void simini_();  // within uginit
00042   void vrecin_();  // within uginit
00043   void ustrinit_();  // within uginit
00044   void uhinit_();  // within uginit
00045   void dstini_();  // within uginit (may not use)
00046   void iofini_();  // within uginit
00047   void jevent_();  // within uginit
00048   void uglast_(); 
00049   void gtrigi_(); 
00050   void gtrig_(); 
00051   void gtrigc_(); 
00052   void gutrev_(); 
00053   void guout_(); 
00054   void rdtupk_(int*); 
00055   void checktrig_(); 
00056   void consinit_(); 
00057   void provatof_(); 
00058   void mzwipe_(int*); 
00059   void mzdrop_(int* ,int* ,char*); // already used in read_lib
00060   void vrecon_();  //
00061   void films_();   //
00062   void patstrw_(); //
00063   void genrec_(); //
00064   void trkfit_(); //
00065   void ktrkvert_(); // from v_603 on (short tracks)
00066   void vertfit_();  // from v_603 on (short tracks)
00067   void kalmanfit_(); // from v_603 on (Kalman-filter)
00068   void neutfind_(); //
00069   void bhabharc_(); //
00070   void bhatrkfit_(); //
00071   void babarc_(); //
00072   void babafit_(); //
00073 }
00074 
00075 typedef struct {
00076   int    idebug;
00077   int    idemin;
00078   int    idemax;
00079   int    itest;
00080   int    idrun;
00081   int    idevt;
00082   int    ieorun;
00083   int    ieotri;
00084   int    ievent;
00085   int    iswit[10];
00086   int    ifinit[20];
00087   int    nevent;
00088   int    nrndm[2];
00089 } Gcflag_t;
00090 
00091 typedef struct {
00092   int ixdst;
00093   int ixdiv1;
00094   int ixdiv2;
00095   int ixdiv3;
00096   float fence[16];
00097   int jinfo;
00098   int jfges;
00099   int jmstr;
00100   int jstrw;
00101   int jfdst;
00102 } Zerbini_t;
00103 
00104 typedef struct {
00105   int iout[9];
00106 } Runinf_t;
00107 // Runinf_t Contains information about the date of the real data run (from READ_LIB.C routine)
00108 //      IOUT(1)      Unix time of the run (run header)
00109 //      IOUT(2)      run type
00110 //      IOUT(3)      run number
00111 //      IOUT(4)      year (YYYY) of the run
00112 //      IOUT(5)      month (MM)
00113 //      IOUT(6)      day (DD)
00114 //      IOUT(7)      hour (hh)
00115 //      IOUT(8)      minute (mm)
00116 //      IOUT(9)      second (ss)
00117 
00118 
00119 // ---
00120 #include "TNamed.h"
00121 #include "TString.h"
00122 #include "TH1F.h"
00123 #include "TH2F.h"
00124 // ---
00125 
00126 #include "FROOT.h" // very important (procedure definitions)
00127 
00128 class TFndProcessRec : public TNamed {
00129 
00130  public:
00131   enum E_prec_Bhabha_Mode { E_SINGLE_HELIX=0, E_DOUBLE_HELIX=1 };
00132 
00133  private:
00134   // support for multi-processing
00135   enum { K_NMAX_PROCESSES = 30 };
00136   TString fProcDirBaseName;
00137   Int_t fCurProcNum;
00138 
00139   TString *fTyp;  // run type
00140   Int_t    fNum;  // run number
00141   TString *fRawFileName; // real filename (5 digits run number)
00142   TString *fMsqlDbHostStr; // MSQL_DB_HOST_NAME
00143 
00144   Zerbini_t *fZebini; // pointer to the ZEBINI fortran common (see GENEDE)
00145   Gcflag_t  *fGcflag;  // pointer to the GCFLAG fortran common (see GENEDE)
00146   Runinf_t  *fRuninf;  // pointer to the RUNING fortran common (see GENEDE)
00147 
00148   void *flib_handle; // used in 'dlsym'
00149 
00150   Int_t fJINFO;
00151   Int_t fJFGES;
00152   Int_t fJFDST;
00153   Int_t *fLQ;
00154   Int_t *fIQ;
00155   Float_t *fQ;
00156   
00157   Bool_t fdebug;
00158   Bool_t fRawFileExists;
00159 
00160   E_prec_Bhabha_Mode fCurBhabhaRecMode;
00161 
00162  public:
00163 
00164   TFndProcessRec();
00165   TFndProcessRec(Int_t num, Bool_t debug=kFALSE); // batch Monte Carlo
00166   TFndProcessRec(const Char_t *typ, Int_t num, const Char_t *data_path="$RDT", const Char_t *msql_db_host="$MSQL_DB_HOST", Bool_t debug=kFALSE);  // batch real data
00167   ~TFndProcessRec();
00168   
00169   Int_t UgEvent(); // to process run event by event 
00170   Int_t FillJFGES();   // Fill JFGES with reconstructed hits without recostructing the event
00171   Int_t Reconstruct(); // Process the event reconstruction and move banks to JFDST
00172   void  CloseRun(Bool_t last=kFALSE); // perform fortran close run operations ()
00173   Int_t CloseInterface(); // close fortran; reset zebra; close fida*.so (dlclose)
00174 
00175   void InitNewRun(const Char_t *typ, Int_t num, const Char_t *data_path="$RDT", const Char_t *msql_db_host="$MSQL_DB_HOST", Bool_t debug=kFALSE); // start new run processing (recycling the used zebra structure)
00176 
00177   Bool_t GetStatusBit(Int_t l, Int_t k);
00178 
00179   UInt_t *GetRawEvPointer();
00180   Int_t   GetJINFO() {return fJINFO;}
00181   Int_t   GetJFGES() {return fJFGES;}
00182   Int_t   GetJFDST() {return fJFDST;}
00183   Int_t   *GetLQ() {if(fLQ) return fLQ; else return 0;}
00184   Int_t   *GetIQ() {if(fIQ) return fIQ; else return 0;}
00185   Float_t *GetQ() {if(fQ) return fQ; else return 0;}
00186 
00187   Int_t   GetLQ(Int_t address) {if(fLQ) return fLQ[address]; else return 0;}
00188   Int_t   GetIQ(Int_t address) {if(fIQ) return fIQ[address]; else return 0;}
00189   Float_t  GetQ(Int_t address) {if(fQ)  return fQ[address];  else return 0;}
00190 
00191   TString *GetRunType() { return fTyp; }
00192   void PrintZebiniContent();  
00193   void PrintGcflagContent();  
00194   Bool_t GetDebugFlag() { return fdebug; }
00195 
00196   void SetRuninf();    // assign runinf_ common to class data members
00197 
00198   void SelectBhabhaInFidaRC(E_prec_Bhabha_Mode mode); // uncomment or comment the BABA line
00199   E_prec_Bhabha_Mode GetBhabhaRecMode() { return fCurBhabhaRecMode; }
00200   
00201   // private:
00202   void CreateProcInpFiles(); // make a directory for current process fida*.dat
00203   void CleanCurrentProcess(); // remove directory with current process fida*.dat
00204 
00205   static void CleanRecOutputs(Bool_t out,Bool_t his,Bool_t dst);
00206 
00207  private: // remove after debug
00208 
00209   void CommInit(); // Initialization needed by all ctors
00210   void CheckRawFile(); // check raw file existence
00211   void InitRun();      // initialize ZEBRA structure (first run)
00212   void SetZebini();    // assign zebini_ common to class data members
00213   void SetGcflag();    // assign zebini_ common to class data members
00214   void SetFidaRC(Char_t *card, Char_t *option); // set run type and number 'fidarc.dat'
00215 
00216 
00217   // ---
00218   // --- End of class: from now on you will find example methods only. ---
00219   // ---
00220   // --- EXAMPLE methods ---
00221   //__________________________________________________
00222   // zebra access example methods
00223   // --- test class like this:
00224   /*
00225     TFndProcessRec *proc =new TFndProcessRec("FINU",536,kTRUE);
00226     proc->SetMaxEv(100);
00227     proc->AutoProcessRun();
00228   */
00229   // Automatic file 'Autoprocess_histos.root' is created
00230   // BHABHA bank not decoded in this example!!!
00231  public:
00232   Int_t  fMaxEv;
00233 
00234   Bool_t fBhaFlag;  // Flags used
00235   Bool_t fHypeFlag; // for histos
00236   Bool_t fCosmFlag; // declaration
00237   
00238   // --- HYPE analysis (K-)
00239   Int_t fcount_k_min;
00240   Int_t fcount_k_min_inside;
00241   TH2F *fHyp_K_min_xy_vert_histo;
00242   TH1F *fHyp_K_min_z_vert_histo;
00243   TH1F *fHyp_K_min_mom_neg_trk;
00244   TH1F *fHyp_K_min_mom_pos_trk;
00245 
00246   // --- BABA analysis 
00247   Int_t fcount_BABA;
00248   Int_t fcount_BABA_OK;
00249   TH1F *fBABA_mom_patt_histo;
00250   TH1F *fBABA_mom_fit_histo;
00251 
00252   // --- BHABHA analysis 
00253 
00254 
00255   // --- COSM analysis 
00256   Int_t fcount_COSM;
00257   Int_t fcount_COSM_OK;
00258   TH1F *fCosm_SignOfCharge_histo;
00259   TH1F * fCOSM_mom_patt_histo;
00260   TH1F * fCOSM_mom_fit_histo;
00261  
00262 
00263   //--- examples methods
00264   inline void SetMaxEv(Int_t n) { fMaxEv=n; }
00265   virtual void AutoProcessRun();
00266 
00267  private:
00268   Int_t GetHypeDst();
00269   Int_t GetBabaDst();
00270   Int_t GetBhabhaDst();
00271   Int_t GetCosmDst();
00272   
00273   ClassDef(TFndProcessRec,0) // The heart of the froot<->fidarc interface
00274     };
00275     
00276 #endif // FROOT_TFndProcessRec
00277     

Generated on Tue Oct 16 15:40:47 2007 by  doxygen 1.5.2