Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

AlphaBanks.cpp

Go to the documentation of this file.
00001 /*-----------------------------------------------------------------------------*/
00002 /* Define methods for the Event class and create objects from the FORTRAN      */
00003 /* BOS memory.                                                                 */
00004 /* Author: R. Cavanaugh                                                        */
00005 /*-----------------------------------------------------------------------------*/
00006 
00007 #include <iostream>
00008 #include <fstream>
00009 #include <string> 
00010 #include <stdlib.h>
00011 #include "AlphaBanks.h"
00012 #include "fortran_def.h"
00013 #include "bos.h"     
00014 #include "CLHEP/Vector/LorentzVector.h"
00015 #include "AlephCollection.h"
00016 #include "TClass.h"
00017 
00018 extern ofstream fout;
00019 
00020 ClassImp(AlphaBanks)
00021 
00022 /*-----------------------------------------------------------------------------*/
00023 template <class GeneralBOSbank>   
00024 void GetBOSbank( char* Name, int RowOffset, GeneralBOSbank*& Bank, int NR = 0 )
00025 {                                                                                   
00026      int NRow    = NR;                                                               
00027      int Length  = 0;                                                               
00028      int BasePointer = 0;                                                           
00029      int Error   = 0;                                                               
00030      BANK_ALPHA( Name, NRow, Length, BasePointer, Error );            
00031      if( Error == 0 )                                                               
00032      {                                                                              
00033           int NumRows      = bcs_[ BasePointer + 1 ];                                
00034           int NumCols      = bcs_[ BasePointer     ];                                
00035           int FirstAddress =       BasePointer + 2  ;                                 
00036           int LastAddress  = FirstAddress + NumRows*NumCols;                              
00037                                                                                     
00038           if( FirstAddress <= RowOffset && RowOffset <= LastAddress)                 
00039                Bank = (GeneralBOSbank*) &bcs_[RowOffset];                           
00040           else                                                                      
00041                Bank = (GeneralBOSbank*) NULL;                                       
00042      }                                                                              
00043      else
00044           Bank = (GeneralBOSbank*) NULL;                                            
00045 }                                                                                   
00046 /*-----------------------------------------------------------------------------*/
00047 int BaseAddress( char* Name, int NR = 0 )
00048 {                                                                                   
00049      int Zero    = NR;                                                               
00050      int Length  = 0;                                                               
00051      int BasePointer = 0;                                                           
00052      int Error   = 0;                                                               
00053                                                                                     
00054      BANK_ALPHA( Name, Zero, Length, BasePointer, Error );                          
00055      if( Error == 0 ) 
00056           return BasePointer + 2;
00057      else 
00058      {
00059           return 0; 
00060      }                         
00061 }                                                                                   
00062 /*-----------------------------------------------------------------------------*/
00063 int Nrows( char* Name, int NR = 0 )
00064 {                                                                                   
00065      int Zero    = NR;                                                               
00066      int Length  = 0;                                                               
00067      int BasePointer = 0;                                                           
00068      int Error   = 0;                                                               
00069                                                                                     
00070      BANK_ALPHA( Name, Zero, Length, BasePointer, Error );                          
00071      if( Error == 0 ) 
00072           return bcs_[ BasePointer + 1 ];
00073      else 
00074      { 
00075           return 0; 
00076      }           
00077 }                                                                                   
00078 /*-----------------------------------------------------------------------------*/
00079 int Ncols( char* Name, int NR = 0 )
00080 {                                                                                   
00081      int Zero    = NR;                                                               
00082      int Length  = 0;                                                               
00083      int BasePointer = 0;                                                           
00084      int Error   = 0;                                                               
00085                                                                                     
00086      BANK_ALPHA( Name, Zero, Length, BasePointer, Error );                          
00087      if( Error == 0 ) 
00088           return bcs_[ BasePointer     ];
00089      else 
00090      { 
00091           return 0; 
00092      }               
00093 }                                                                                   
00094 /*-----------------------------------------------------------------------------*/
00095 template<typename PATTERN, typename BANKCLASS> 
00096 void Attach(PATTERN* pattern, BANKCLASS** Bank)
00097 {
00098   if (pattern != (PATTERN*) NULL )
00099   {
00100     BANKCLASS* Object = new BANKCLASS;
00101     Object -> Assign( pattern );
00102     *Bank = Object;
00103   }
00104   else
00105     *Bank = (BANKCLASS*) NULL;
00106 }
00107 /*-----------------------------------------------------------------------------*/
00109 //  Constructor
00111 AlphaBanks::AlphaBanks(DataSource src) 
00112 {
00113      if(src==BOS) LoadFromBos();
00114      _Valid = true;
00115 }
00116 
00117 void AlphaBanks::LoadFromBos()
00118 {
00119      RLEP_PATTERN* rlep_bank;  
00120      GetBOSbank( "RLEP", BaseAddress("RLEP") , rlep_bank );
00121      Attach( rlep_bank , &qext.LP);
00122 
00123      EVEH_PATTERN* eveh_bank;
00124      // we don't use the GetBOSbank stuff 'cause EVEH has no header
00125      {
00126        int Zero        = 0;                                                               
00127        int Length      = 0;                                                               
00128        int BasePointer = 0;                                                           
00129        int Error       = 0;                                                               
00130        BANK_ALPHA( "EVEH", Zero , Length, BasePointer, Error ); 
00131        if( Error == 0 )                                                               
00132           eveh_bank = (EVEH_PATTERN*) &bcs_[BasePointer];                           
00133        else
00134           eveh_bank = (EVEH_PATTERN*) NULL;                                            
00135      }                                                                              
00136      Attach( eveh_bank, &qhac.EH);
00137                
00138 
00139      RUNH_PATTERN* runh_bank;
00140      // we don't use the GetBOSbank stuff 'cause RUNH has no header
00141      {
00142        int Zero        = 0;                                                               
00143        int Length      = 0;                                                               
00144        int BasePointer = 0;                                                           
00145        int Error       = 0;                                                               
00146        BANK_ALPHA( "RUNH", Zero , Length, BasePointer, Error ); 
00147        if( Error == 0 )                                                               
00148           runh_bank = (RUNH_PATTERN*) &bcs_[BasePointer];                           
00149        else
00150           runh_bank = (RUNH_PATTERN*) NULL;                                            
00151      }                                                                              
00152      Attach( runh_bank, &qhac.RH);
00153 
00154      ASIM_PATTERN* asim_bank;
00155      GetBOSbank( "ASIM", BaseAddress("ASIM") , asim_bank );
00156      Attach( asim_bank, &qhac.AS);
00157      ADBR_PATTERN* adbr_bank;
00158      // scan the whole vector of banks.
00159      // select the one associated with the current run.
00160      int runnum;
00161      if ((qhac.EH) != (EVEH*) NULL) runnum= qhac.EH->RN;
00162      else runnum = -1;
00163      if (runnum<2001) //MC
00164      {
00165        int iperiod;
00166        if ((qhac.AS) != (ASIM*) NULL) iperiod= qhac.AS->YM;
00167        else if ((qhac.RH) != (RUNH*) NULL) iperiod = (qhac.RH->SD)/100;
00168        else iperiod = -1;
00169        GetBOSbank( "ADBR", BaseAddress("ADBR"), adbr_bank );
00170        if(adbr_bank != NULL){
00171        // Y2K Patch for backwards compatibility
00172        // format for ADBR is now YYYYMM
00173        if((iperiod>0)&&(iperiod<10000)&&(adbr_bank->PN>190000)) iperiod+=190000;
00174        if((iperiod>190000)&&(adbr_bank->PN<10000)) iperiod-=190000;
00175        if(iperiod >= adbr_bank->PN)
00176           if(iperiod == adbr_bank->PN) Attach( adbr_bank, &qhac.AD);
00177           else 
00178             {
00179               GetBOSbank( "ADBR", BaseAddress("ADBR")+(Nrows("ADBR")-1)*Ncols("ADBR"), adbr_bank );
00180               if (iperiod >= adbr_bank->PN) Attach( adbr_bank, &qhac.AD);
00181               else
00182               {
00183                // loop on the rows
00184                int row=1;
00185                do {
00186                  row++;
00187                  GetBOSbank( "ADBR", BaseAddress("ADBR")+row*Ncols("ADBR"), adbr_bank );
00188                } while(iperiod>=adbr_bank->PN);
00189                // Row ound (it was the one before), attach.
00190                row--;
00191                GetBOSbank( "ADBR", BaseAddress("ADBR")+row*Ncols("ADBR"), adbr_bank );
00192                Attach( adbr_bank, &qhac.AD);
00193               }
00194             }
00195        else Attach( (ADBR_PATTERN*)NULL, &qhac.AD);}
00196        else Attach( (ADBR_PATTERN*)NULL, &qhac.AD);   
00197      }
00198      else // raw data
00199      {
00200        GetBOSbank( "ADBR", BaseAddress("ADBR"), adbr_bank );
00201        if(adbr_bank != NULL)
00202        if(runnum >= adbr_bank->FR)
00203           if(runnum == adbr_bank->FR) Attach( adbr_bank, &qhac.AD);
00204           else 
00205             {
00206               GetBOSbank( "ADBR", BaseAddress("ADBR")+(Nrows("ADBR")-1)*Ncols("ADBR"), adbr_bank );
00207               if (runnum >= adbr_bank->FR) Attach( adbr_bank, &qhac.AD);
00208               else
00209               {
00210                // loop on the rows
00211                int row=1;
00212                do {
00213                  row++;
00214                  GetBOSbank( "ADBR", BaseAddress("ADBR")+row*Ncols("ADBR"), adbr_bank );
00215                } while(runnum>=adbr_bank->FR);
00216                // Row found (it was the one before), attach.
00217                row--;
00218                GetBOSbank( "ADBR", BaseAddress("ADBR")+row*Ncols("ADBR"), adbr_bank );
00219                Attach( adbr_bank, &qhac.AD);
00220               }
00221             }
00222        else Attach( (ADBR_PATTERN*)NULL, &qhac.AD);
00223        else Attach( (ADBR_PATTERN*)NULL, &qhac.AD);
00224      }
00225 
00226      qhac.BN.resize(Nrows("XTBN"));
00227      for (unsigned int row=0;row<qhac.BN.size();row++)
00228      {
00229         XTBN_PATTERN* xtbn_bank;
00230         GetBOSbank( "XTBN", BaseAddress("XTBN")+ row*Ncols("XTBN") , xtbn_bank );
00231         Attach( xtbn_bank, &qhac.BN[row]);
00232      }
00233 
00234      XTCN_PATTERN* xtcn_bank;
00235      GetBOSbank( "XTCN", BaseAddress("XTCN") , xtcn_bank );
00236      Attach( xtcn_bank, &qhac.CN);
00237 
00238      XTOP_PATTERN* xtop_bank;
00239      if (runnum != -1)
00240       {
00241         GetBOSbank( "XTOP", BaseAddress("XTOP") , xtop_bank , runnum);
00242         Attach( xtop_bank, &qhac.OP);
00243       }
00244      else
00245       {
00246         Attach( (XTOP_PATTERN*)NULL, &qhac.OP);
00247       }
00248      LUPA_PATTERN* lupa_bank;
00249      GetBOSbank( "LUPA", BaseAddress("LUPA") , lupa_bank );
00250      Attach( lupa_bank, &qhac.LP);
00251 
00252      SILH_PATTERN* silh_bank;
00253      GetBOSbank( "SILH", BaseAddress("SILH") , silh_bank );
00254      Attach( silh_bank, &qhac.SI);
00255 
00256      qhac.HV.resize(Nrows("XHVB"));
00257      XHVB_PATTERN* xhvb_bank;
00258      for (int row=0;row<Nrows("XHVB");row++)
00259      {
00260           GetBOSbank( "XHVB", BaseAddress("XHVB")+ row*Ncols("XHVB"), xhvb_bank );
00261           Attach( xhvb_bank, &qhac.HV[row]);
00262      }
00263 
00264      XTEB_PATTERN* xteb_bank;
00265      GetBOSbank( "XTEB", BaseAddress("XTEB") , xteb_bank );
00266      Attach( xteb_bank, &qhac.EB);
00267 
00268      XTRB_PATTERN* xtrb_bank;
00269      GetBOSbank( "XTRB", BaseAddress("XTRB") , xtrb_bank );
00270      Attach( xtrb_bank, &qhac.RB);
00271 
00272      DTBP_PATTERN* dtbp_bank;
00273      GetBOSbank( "DTBP", BaseAddress("DTBP") , dtbp_bank );
00274      Attach( dtbp_bank, &qhac.BP);
00275 
00276      SIX2_PATTERN* six2_bank;
00277      GetBOSbank( "SIX2", BaseAddress("SIX2") , six2_bank );
00278      Attach( six2_bank, &qhac.X2);
00279 
00280      qhac.TV.resize(Nrows("X1TV"));
00281      X1TV_PATTERN* x1tv_bank;
00282      for (unsigned int row=0;row<qhac.TV.size();row++)
00283      {
00284           GetBOSbank( "X1TV", BaseAddress("X1TV")+ row*Ncols("X1TV") , x1tv_bank );
00285           Attach( x1tv_bank, &qhac.TV[row]);
00286      }
00287 
00288      qhac.KW.resize(Nrows("KWGT"));
00289      KWGT_PATTERN* kwgt_bank;
00290      for (unsigned int row=0;row<qhac.KW.size();row++)
00291      {
00292           GetBOSbank( "KWGT", BaseAddress("KWGT")+ row*Ncols("KWGT") , kwgt_bank );
00293           Attach( kwgt_bank, &qhac.KW[row]);
00294      }
00295 
00296      qhac.IP.resize(Nrows("X1IP"));
00297      X1IP_PATTERN* x1ip_bank;
00298      for (unsigned int row=0;row<qhac.IP.size();row++)
00299      {
00300           GetBOSbank( "X1IP", BaseAddress("X1IP")+ row*Ncols("X1IP") , x1ip_bank );
00301           Attach( x1ip_bank, &qhac.IP[row]);
00302      }
00303 
00304      qhac.TH.resize(Nrows("X1TH"));
00305      X1TH_PATTERN* x1th_bank;
00306      for (unsigned int row=0;row<qhac.TH.size();row++)
00307      {
00308           GetBOSbank( "X1TH", BaseAddress("X1TH")+ row*Ncols("X1TH") , x1th_bank );
00309           Attach( x1th_bank, &qhac.TH[row]);
00310      }
00311 
00312      qhac.XD.resize(Nrows("X1AD"));
00313      X1AD_PATTERN* x1ad_bank;
00314      for (unsigned int row=0;row<qhac.XD.size();row++)
00315      {
00316           GetBOSbank( "X1AD", BaseAddress("X1AD")+ row*Ncols("X1AD") , x1ad_bank );
00317           Attach( x1ad_bank, &qhac.XD[row]);
00318      }
00319 
00320      qhac.XA.resize(Nrows("SIXA"));
00321      SIXA_PATTERN* sixa_bank;
00322      for (unsigned int row=0;row<qhac.XA.size();row++)
00323      {
00324           GetBOSbank( "SIXA", BaseAddress("SIXA")+ row*Ncols("SIXA") , sixa_bank );
00325           Attach( sixa_bank, &qhac.XA[row]);
00326      }
00327 
00328      qhac.CO.resize(Nrows("SRCO"));
00329      SRCO_PATTERN* srco_bank;
00330      for (unsigned int row=0;row<qhac.CO.size();row++)
00331      {
00332           GetBOSbank( "SRCO", BaseAddress("SRCO")+ row*Ncols("SRCO") , srco_bank );
00333           Attach( srco_bank, &qhac.CO[row]);
00334      }
00335 
00336      SITC_PATTERN* sitc_bank;
00337      GetBOSbank( "SITC", BaseAddress("SITC") , sitc_bank );
00338      Attach( sitc_bank, &qhac.TC);
00339 
00340      qhac.BV.resize(Nrows("VHBV"));
00341      VHBV_PATTERN* vhbv_bank;
00342      for (unsigned int row=0;row<qhac.BV.size();row++)
00343      {
00344           GetBOSbank( "VHBV", BaseAddress("VHBV")+ row*Ncols("VHBV") , vhbv_bank );
00345           Attach( vhbv_bank, &qhac.BV[row]);
00346      }
00347 
00348      qhac.PV.resize(Nrows("VHPV"));
00349      VHPV_PATTERN* vhpv_bank;
00350      for (unsigned int row=0;row<qhac.PV.size();row++)
00351      {
00352           GetBOSbank( "VHPV", BaseAddress("VHPV")+ row*Ncols("VHPV") , vhpv_bank );
00353           Attach( vhpv_bank, &qhac.PV[row]);
00354      }
00355 
00356      EAUX_PATTERN* eaux_bank;
00357      GetBOSbank( "EAUX", BaseAddress("EAUX") , eaux_bank );
00358      Attach( eaux_bank, &qhac.EX);
00359 
00360      KEVH_PATTERN* kevh_bank;
00361      GetBOSbank( "KEVH", BaseAddress("KEVH") , kevh_bank );
00362      Attach( kevh_bank, &qhac.KE);
00363 
00364      REVH_PATTERN* revh_bank;
00365      GetBOSbank( "REVH", BaseAddress("REVH") , revh_bank );
00366      Attach( revh_bank, &qhac.RE);
00367 
00368      qhac.LO.resize(Nrows("LOLE"));
00369      LOLE_PATTERN* lole_bank;
00370      for (unsigned int row=0;row<qhac.LO.size();row++)
00371      {
00372           GetBOSbank( "LOLE", BaseAddress("LOLE")+ row*Ncols("LOLE"), lole_bank );
00373           Attach( lole_bank, &qhac.LO[row]);
00374      }
00375 
00376      qhac.X1.resize(Nrows("X1RG"));
00377      X1RG_PATTERN* x1rg_bank;
00378      for (unsigned int row=0;row<qhac.X1.size();row++)
00379      {
00380           X1RG_PATTERN* x1rg_bank;
00381           GetBOSbank( "X1RG", BaseAddress("X1RG")+ row*Ncols("X1RG"), x1rg_bank );
00382           Attach( x1rg_bank, &qhac.X1[row]);
00383      }
00384 
00385      BOMB_PATTERN* bomb_bank;
00386      GetBOSbank( "BOMB", BaseAddress("BOMB") , bomb_bank );
00387      Attach( bomb_bank, &qhac.BO);
00388 
00389      int QvecType[45];  ALPHA_PARAM(QvecType[0]);
00390      KFCHT = QvecType[ 0];  KLCHT = QvecType[ 1];  KNCHT = QvecType[ 2];
00391      KFCOT = QvecType[ 3];  KLCOT = QvecType[ 4];  KNCOT = QvecType[ 5];
00392      KFIST = QvecType[ 6];  KLIST = QvecType[ 7];  KNIST = QvecType[ 8];
00393      KFAST = QvecType[ 9];  KLAST = QvecType[10];  KNAST = QvecType[11];
00394      KFRET = QvecType[12];  KLRET = QvecType[13];  KNRET = QvecType[14];
00395      KFEFT = QvecType[15];  KLEFT = QvecType[16];  KNEFT = QvecType[17];
00396      KFNET = QvecType[18];  KLNET = QvecType[19];  KNNET = QvecType[20];
00397      KFGAT = QvecType[21];  KLGAT = QvecType[22];  KNGAT = QvecType[23];
00398      KFJET = QvecType[24];  KLJET = QvecType[25];  KNJET = QvecType[26];
00399      KFMCT = QvecType[27];  KLMCT = QvecType[28];  KNMCT = QvecType[29];
00400      KFV0T = QvecType[30];  KLV0T = QvecType[31];  KNV0T = QvecType[32];
00401      KFLVT = QvecType[33];  KLLVT = QvecType[34];  KNLVT = QvecType[35];
00402      KFDCT = QvecType[36];  KLDCT = QvecType[37];  KNDCT = QvecType[38];
00403      KFREV = QvecType[39];  KLREV = QvecType[40];  KNREV = QvecType[41];
00404      KFMCV = QvecType[42];  KLMCV = QvecType[43];  KNMCV = QvecType[44];
00405      OKFCHT = QvecType[ 0]; 
00406      OKFCOT = QvecType[ 3];
00407      OKFIST = QvecType[ 6];
00408      OKFAST = QvecType[ 9];
00409      OKFRET = QvecType[12];
00410      OKFEFT = QvecType[15];
00411      OKFNET = QvecType[18];
00412      OKFGAT = QvecType[21];
00413      OKFJET = QvecType[24];
00414      OKFMCT = QvecType[27];
00415      OKFV0T = QvecType[30];
00416      OKFLVT = QvecType[33];
00417      OKFDCT = QvecType[36];
00418      OKFREV = QvecType[39];
00419      OKFMCV = QvecType[42];
00420      // count how many distinct tracks there is
00421      int qvecsize=0;
00422      for(int i=0;i<Nrows("QVEC");i++) 
00423      if(
00424         ((i>=KFCHT)&&(i<=KLCHT))||
00425         ((i>=KFCOT)&&(i<=KLCOT))||
00426         ((i>=KFIST)&&(i<=KLIST))||
00427         ((i>=KFAST)&&(i<=KLAST))||
00428         ((i>=KFRET)&&(i<=KLRET))||
00429         ((i>=KFEFT)&&(i<=KLEFT))||
00430         ((i>=KFNET)&&(i<=KLNET))||
00431         ((i>=KFGAT)&&(i<=KLGAT))||
00432         ((i>=KFJET)&&(i<=KLJET))||
00433         ((i>=KFMCT)&&(i<=KLMCT))||
00434         ((i>=KFV0T)&&(i<=KLV0T))||
00435         ((i>=KFLVT)&&(i<=KLLVT))||
00436         ((i>=KFDCT)&&(i<=KLDCT))
00437        ) qvecsize++;
00438      qvec.resize( qvecsize );
00439      int RowEff=0;
00440      for(int Row = 1; Row <= Nrows("QVEC"); Row++)
00441        if(
00442                 ((Row>=QvecType[ 0])&&(Row<=QvecType[ 1]))||
00443                 ((Row>=QvecType[ 3])&&(Row<=QvecType[ 4]))||
00444                 ((Row>=QvecType[ 6])&&(Row<=QvecType[ 7]))||
00445                 ((Row>=QvecType[ 9])&&(Row<=QvecType[10]))||
00446                 ((Row>=QvecType[12])&&(Row<=QvecType[13]))||
00447                 ((Row>=QvecType[15])&&(Row<=QvecType[16]))||
00448                 ((Row>=QvecType[18])&&(Row<=QvecType[19]))||
00449                 ((Row>=QvecType[21])&&(Row<=QvecType[22]))||
00450                 ((Row>=QvecType[24])&&(Row<=QvecType[25]))||
00451                 ((Row>=QvecType[27])&&(Row<=QvecType[28]))||
00452                 ((Row>=QvecType[30])&&(Row<=QvecType[31]))||
00453                 ((Row>=QvecType[33])&&(Row<=QvecType[34]))||
00454                 ((Row>=QvecType[36])&&(Row<=QvecType[37]))
00455          )
00456      {
00457           QVEC_PATTERN* qvec_bank;  
00458           GetBOSbank( "QVEC", BaseAddress("QVEC") + (Row-1)*Ncols("QVEC"), qvec_bank );
00459           qvec[RowEff].Assign( qvec_bank );
00460 
00461           qvec[RowEff].DL.resize( qvec_bank -> ND );
00462           for( int Daughter = 0; Daughter < qvec_bank -> ND; Daughter++ )
00463           {
00464                QLIN_PATTERN* qlin_bank;
00465                GetBOSbank( "QLIN", BaseAddress("QLIN") + qvec_bank -> DL + Daughter, qlin_bank); 
00466                qvec[RowEff].DL[ Daughter ] = qlin_bank -> I;
00467           }
00468 
00469           qvec[RowEff].OL.resize( qvec_bank -> NO );
00470           for( int Mother = 0; Mother < qvec_bank -> NO; Mother++ )
00471           {
00472                QLIN_PATTERN* qlin_bank;
00473                GetBOSbank( "QLIN", BaseAddress("QLIN") + qvec_bank -> OL + Mother, qlin_bank );  
00474                qvec[RowEff].OL[ Mother ] = qlin_bank -> I;
00475           }
00476 
00477           qvec[RowEff].ML.resize( qvec_bank -> NM );
00478           for( int Match = 0; Match < qvec_bank -> NM; Match++ )
00479           {
00480                QMTL_PATTERN* qmtl_bank;
00481                GetBOSbank( "QMTL", BaseAddress("QMTL") + qvec_bank -> ML + Match, qmtl_bank );  
00482                qvec[RowEff].ML[ Match ] = qmtl_bank -> I;
00483           }
00484 
00485           QDET_PATTERN* qdet_bank;  
00486           GetBOSbank( "QDET", qvec_bank -> QD, qdet_bank ); 
00487           Attach( qdet_bank , &qvec[RowEff].QD);
00488           if( qdet_bank != (QDET_PATTERN*) NULL )
00489           {
00490                FRFT_PATTERN* frft_bank;  
00491                GetBOSbank( "FRFT", qdet_bank -> AF, frft_bank );  
00492                Attach( frft_bank, &qvec[RowEff].QD->AF );
00493 
00494                FRTL_PATTERN* frtl_bank;  
00495                GetBOSbank( "FRTL", qdet_bank -> AL, frtl_bank );  
00496                Attach( frtl_bank, &qvec[RowEff].QD->AL );
00497 
00498                for( int i = 0; i <= 4; i++)
00499                {
00500                     TEXS_PATTERN* texs_bank;  
00501                     GetBOSbank( "TEXS", qdet_bank -> AT[i], texs_bank ); 
00502                     Attach( texs_bank, &qvec[RowEff].QD->AT[i] );
00503                }
00504                TEXS_PATTERN* texs_bank;  
00505                GetBOSbank( "TEXS", qdet_bank -> LT, texs_bank ); 
00506                Attach( texs_bank, &qvec[RowEff].QD->LT );
00507 
00508                EIDT_PATTERN* eidt_bank;  
00509                GetBOSbank( "EIDT", qdet_bank -> AE, eidt_bank ); 
00510                Attach( eidt_bank, &qvec[RowEff].QD->AE );
00511 
00512                HMAD_PATTERN* hmad_bank;  
00513                GetBOSbank( "HMAD", qdet_bank -> AH, hmad_bank ); 
00514                Attach( hmad_bank, &qvec[RowEff].QD->AH );
00515 
00516                MCAD_PATTERN* mcad_bank;  
00517                GetBOSbank( "MCAD", qdet_bank -> AM, mcad_bank ); 
00518                Attach( mcad_bank, &qvec[RowEff].QD->AM );
00519 
00520                PECO_PATTERN* peco_bank;  
00521                GetBOSbank( "PECO", qdet_bank -> EC, peco_bank ); 
00522                Attach( peco_bank, &qvec[RowEff].QD->EC );
00523 
00524                PHCO_PATTERN* phco_bank;  
00525                GetBOSbank( "PHCO", qdet_bank -> HC, phco_bank ); 
00526                Attach( phco_bank, &qvec[RowEff].QD->HC);
00527 
00528                PEPT_PATTERN* pept_bank;  
00529                GetBOSbank( "PEPT", qdet_bank -> ET, pept_bank ); 
00530                Attach( pept_bank, &qvec[RowEff].QD->ET );
00531 
00532                FRID_PATTERN* frid_bank;  
00533                GetBOSbank( "FRID", qdet_bank -> FI, frid_bank ); 
00534                Attach( frid_bank, &qvec[RowEff].QD->FI );
00535 
00536                EFOL_PATTERN* efol_bank;  
00537                GetBOSbank( "EFOL", qdet_bank -> EF, efol_bank ); 
00538                DENF_PATTERN* denf_bank;
00539                GetBOSbank( "DENF", qdet_bank -> EF, denf_bank );
00540                DENW_PATTERN* denw_bank;
00541                GetBOSbank( "DENW", qdet_bank -> EF, denw_bank );
00542                if(efol_bank)
00543                         Attach( efol_bank, &qvec[RowEff].QD->EF );
00544                else
00545                {
00546                         Attach( denf_bank, &qvec[RowEff].QD->EF );
00547                         Attach( denw_bank, &qvec[RowEff].QD->EF );
00548                }
00549 
00550                PCQA_PATTERN* pcqa_bank;  
00551                GetBOSbank( "PCQA", qdet_bank -> PC, pcqa_bank ); 
00552                Attach( pcqa_bank, &qvec[RowEff].QD->PC );
00553 
00554                EGPC_PATTERN* egpc_bank;  
00555                GetBOSbank( "EGPC", qdet_bank -> EG, egpc_bank ); 
00556                Attach( egpc_bank, &qvec[RowEff].QD->EG );
00557 
00558                MUID_PATTERN* muid_bank;  
00559                GetBOSbank( "MUID", qdet_bank -> MU, muid_bank ); 
00560                Attach( muid_bank, &qvec[RowEff].QD->MU );
00561                PGAC_PATTERN* pgac_bank;  
00562                GetBOSbank( "PGAC", qdet_bank -> PG, pgac_bank ); 
00563                Attach( pgac_bank, &qvec[RowEff].QD->PG );
00564                PDLT_PATTERN* pdlt_bank;  
00565                GetBOSbank( "PDLT", qdet_bank -> PD, pdlt_bank ); 
00566                Attach( pdlt_bank, &qvec[RowEff].QD->PD );
00567 
00568                PMLT_PATTERN* pmlt_bank;  
00569                GetBOSbank( "PMLT", qdet_bank -> PM, pmlt_bank ); 
00570                Attach( pmlt_bank, &qvec[RowEff].QD->PM );
00571           }
00572           if(KFCHT==Row) KFCHT=RowEff+1;
00573           if(KFCOT==Row) KFCOT=RowEff+1;
00574           if(KFIST==Row) KFIST=RowEff+1;
00575           if(KFAST==Row) KFAST=RowEff+1;
00576           if(KFRET==Row) KFRET=RowEff+1;
00577           if(KFEFT==Row) KFEFT=RowEff+1;
00578           if(KFNET==Row) KFNET=RowEff+1;
00579           if(KFGAT==Row) KFGAT=RowEff+1;
00580           if(KFJET==Row) KFJET=RowEff+1;
00581           if(KFMCT==Row) KFMCT=RowEff+1;
00582           if(KFV0T==Row) KFV0T=RowEff+1;
00583           if(KFLVT==Row) KFLVT=RowEff+1;
00584           if(KFDCT==Row) KFDCT=RowEff+1;
00585           if(KLCHT==Row) KLCHT=RowEff+1;
00586           if(KLCOT==Row) KLCOT=RowEff+1;
00587           if(KLIST==Row) KLIST=RowEff+1;
00588           if(KLAST==Row) KLAST=RowEff+1;
00589           if(KLRET==Row) KLRET=RowEff+1;
00590           if(KLEFT==Row) KLEFT=RowEff+1;
00591           if(KLNET==Row) KLNET=RowEff+1;
00592           if(KLGAT==Row) KLGAT=RowEff+1;
00593           if(KLJET==Row) KLJET=RowEff+1;
00594           if(KLMCT==Row) KLMCT=RowEff+1;
00595           if(KLV0T==Row) KLV0T=RowEff+1;
00596           if(KLLVT==Row) KLLVT=RowEff+1;
00597           if(KLDCT==Row) KLDCT=RowEff+1;
00598           RowEff++;
00599      }
00600      // count how many distinct vertices there is
00601      int qvrtsize=0;
00602      for(int i=0;i<Nrows("QVRT");i++) if(((i>=KFREV)&&(i<=KLREV))||((i>=KFMCV)&&(i<=KLMCV))) qvrtsize++;
00603      qvrt.resize( qvrtsize );
00604      RowEff=0;
00605      for (int Row=1; Row <= Nrows("QVRT"); Row++)
00606         if(((Row>=QvecType[39])&&(Row<=QvecType[40]))||((Row>=QvecType[42])&&(Row<=QvecType[43]))) 
00607      {
00608              QVRT_PATTERN* qvrt_bank;
00609              GetBOSbank( "QVRT", BaseAddress("QVRT")+(Row-1)*Ncols("QVRT"), qvrt_bank );
00610              qvrt[RowEff].Assign(qvrt_bank);
00611              qvrt[RowEff].DL.resize(qvrt_bank->ND);
00612              for( int Daughter = 0; Daughter < qvrt_bank -> ND; Daughter++ )
00613              {
00614                 QLIN_PATTERN* qlin_bank;
00615                 GetBOSbank( "QLIN", BaseAddress("QLIN") + qvrt_bank -> DL + Daughter, qlin_bank); 
00616                 qvrt[RowEff].DL[ Daughter ] = qlin_bank -> I;
00617              }
00618              YV0V_PATTERN* yv0v_bank;
00619              GetBOSbank( "YV0V", qvrt_bank->AY, yv0v_bank);
00620              Attach(yv0v_bank, &qvrt[RowEff].AY );
00621              FVER_PATTERN* fver_bank;
00622              GetBOSbank( "FVER", qvrt_bank->AF, fver_bank);
00623              Attach(fver_bank, &qvrt[RowEff].AF );
00624              if(KFREV==Row) KFREV=RowEff+1;
00625              if(KLREV==Row) KLREV=RowEff+1;
00626              if(KFMCV==Row) KFMCV=RowEff+1;
00627              if(KLMCV==Row) KLMCV=RowEff+1;
00628              RowEff++;
00629      }
00630      // some patches to fill banks with additionnal information
00631      float value = 0;
00632      QELEP_ALPHA(value);
00633      qhac.EH->TE = int(value*1000000);
00634 }
00635 
00636 void AlphaBanks::InitObjectStructure()
00637 {
00638      try{
00639      // it may be an error in some very rare cases.
00640      // sometimes, there is an lepton without any track
00641      // (missing qvec), etc. 
00642      MCtruth.resize( KNMCT );
00643      if(KNMCT)
00644      {
00645      if ((unsigned int)KLMCT>qvec.size()) throw 0;
00646      for( int i = KFMCT - 1; i < KLMCT; i++ ) 
00647      {
00648          MCtruth[ i - (KFMCT - 1) ].SetPointer( &qvec[i] );
00649 
00650          AlephCollection<AlMCtruth*> MotherVector( qvec[i].NO );
00651          for( int j = 0; j < qvec[i].NO; j++)  MotherVector[j] = &MCtruth[ qvec[i].OL[j] - OKFMCT ];
00652          MCtruth[ i - (KFMCT - 1) ].setMotherVector( MotherVector );
00653 
00654          AlephCollection<AlMCtruth*> DaughterVector( qvec[i].ND );
00655          for( int j = 0; j < qvec[i].ND; j++)  DaughterVector[j] = &MCtruth[ qvec[i].DL[j] - OKFMCT ];
00656          MCtruth[ i - (KFMCT - 1) ].setDaughterVector( DaughterVector );
00657      }
00658      for( AlephCollection<AlMCtruth>::iterator imc = MCtruthV().begin(); imc < MCtruthV().end(); imc++ )
00659      {
00660           addObject(imc);
00661      }
00662      }
00663      Track.resize( KNCHT ); 
00664      if(KNCHT)
00665      {
00666      if ((unsigned int)KLCHT>qvec.size()) throw 1;
00667      for( int i = KFCHT - 1; i < KLCHT; i++ ) 
00668      {
00669           Track[ i - (KFCHT - 1) ].SetPointer( &qvec[i] );
00670           AlephCollection<AlMCtruth*> MatchingVector( qvec[i].NM );
00671           for( int j = 0; j < qvec[i].NM; j++) 
00672           {
00673                   if ((unsigned int)(qvec[i].ML[j] - OKFMCT)>=MCtruth.size()) throw 2;
00674                   MatchingVector[j] = &MCtruth[ qvec[i].ML[j] - OKFMCT ];
00675           }
00676           Track[ i - (KFCHT - 1) ].setMatchingVector( MatchingVector );
00677      }
00678      for( AlephCollection<AlTrack>::iterator ich = TrackV().begin(); ich < TrackV().end(); ich++ )
00679      {
00680           addObject(ich);
00681      }
00682      }
00683      V0Track.resize( KNDCT ); 
00684      if(KNDCT)
00685      {
00686      if ((unsigned int)KLDCT>qvec.size()) throw 11;
00687      for( int i = KFDCT - 1; i < KLDCT; i++ ) 
00688      {
00689           V0Track[ i - (KFDCT - 1) ].SetPointer( &qvec[i] );
00690           AlephCollection<AlMCtruth*> MatchingVector( qvec[i].NM );
00691           for( int j = 0; j < qvec[i].NM; j++)
00692           {
00693                   if ((unsigned int)(qvec[i].ML[j] - OKFMCT)>=MCtruth.size()) throw 2;
00694                   MatchingVector[j] = &MCtruth[ qvec[i].ML[j] - OKFMCT ];
00695           }
00696           V0Track[ i - (KFDCT - 1) ].setMatchingVector( MatchingVector );
00697      }
00698      for( AlephCollection<AlTrack>::iterator ich = V0TrackV().begin(); ich < V0TrackV().end(); ich++ )
00699      {
00700           addObject(ich);
00701      }
00702      }
00703      StdV0.resize( KNV0T ); 
00704      if(KNV0T)
00705      {
00706      if ((unsigned int)KLV0T>qvec.size()) throw 12;
00707      for( int i = KFV0T - 1; i < KLV0T; i++ ) 
00708      {
00709           StdV0[ i - (KFV0T - 1) ].SetPointer( &qvec[i] );
00710           AlephCollection<AlMCtruth*> MatchingVector( qvec[i].NM );
00711           for( int j = 0; j < qvec[i].NM; j++) 
00712           {
00713                   if ((unsigned int)(qvec[i].ML[j] - OKFMCT)>=MCtruth.size()) throw 2;
00714                   MatchingVector[j] = &MCtruth[ qvec[i].ML[j] - OKFMCT ];
00715           }
00716           StdV0[ i - (KFV0T - 1) ].setMatchingVector( MatchingVector );
00717      }
00718      for( AlephCollection<AlTrack>::iterator ich = StdV0V().begin(); ich < StdV0V().end(); ich++ )
00719      {
00720           addObject(ich);
00721      }
00722      }
00723      LongV0.resize( KNLVT ); 
00724      if(KNLVT)
00725      {
00726      if ((unsigned int)KLLVT>qvec.size()) throw 13;
00727      for( int i = KFLVT - 1; i < KLLVT; i++ ) 
00728      {
00729           LongV0[ i - (KFLVT - 1) ].SetPointer( &qvec[i] );
00730           AlephCollection<AlMCtruth*> MatchingVector( qvec[i].NM );
00731           for( int j = 0; j < qvec[i].NM; j++) 
00732           {
00733                   if ((unsigned int)(qvec[i].ML[j] - OKFMCT)>=MCtruth.size()) throw 2;
00734                   MatchingVector[j] = &MCtruth[ qvec[i].ML[j] - OKFMCT ];
00735           }
00736           LongV0[ i - (KFLVT - 1) ].setMatchingVector( MatchingVector );
00737      }
00738      for( AlephCollection<AlTrack>::iterator ich = LongV0V().begin(); ich < LongV0V().end(); ich++ )
00739      {
00740           addObject(ich);
00741      }
00742      }
00743      Eflw.resize( KNEFT );
00744      if(KNEFT)
00745      {
00746      if ((unsigned int)KLEFT>qvec.size()) throw 3; 
00747      for( int i = KFEFT - 1; i < KLEFT; i++ ) 
00748      {
00749           Eflw[ i - (KFEFT - 1) ].SetPointer( &qvec[i] );
00750           Eflw[ i - (KFEFT - 1) ].setEfType(Eflw[ i - (KFEFT - 1) ].Qvec()->QD->EF->TY);
00751           AlTrack* theAssoctrack;
00752           int itr = Eflw[ i - (KFEFT - 1) ].Qvec()->QD->EF->LT;
00753           if (itr>(int)Track.size()) throw 5;
00754           if (itr==0)
00755                   theAssoctrack = NULL;
00756           else
00757           {
00758                   theAssoctrack = &Track[itr-1];
00759                   theAssoctrack->setEflw(&Eflw[ i - (KFEFT - 1) ]);
00760           }
00761           Eflw[ i - (KFEFT - 1) ].setTrack(theAssoctrack);
00762           TEmap[ theAssoctrack  ] = (i - (KFEFT - 1));
00763      }
00764      for( AlephCollection<AlEflw>::iterator ift = EflwV().begin(); ift < EflwV().end(); ift++ )
00765      {
00766           addObject(ift);
00767      }
00768      }
00769      for( AlephCollection<AlTrack>::iterator itr = TrackV().begin(); itr < TrackV().end(); itr++)
00770      {
00771              if(itr->Qvec()->QD->MU)
00772              {
00773                      AlTrack* theAssocTrack = &(*itr);
00774                      AlMuon tmpmuon;
00775                      tmpmuon.setTrack( theAssocTrack );
00776                      AlEflw* theAssocEflw;
00777                      if (TEmap.find(theAssocTrack) == TEmap.end())
00778                              theAssocEflw = NULL;
00779                      else
00780                              theAssocEflw = &Eflw[TEmap.find(theAssocTrack)->second];
00781                      tmpmuon.setEflw( theAssocEflw );
00782                      Muon.push_back(tmpmuon);
00783              }
00784      }
00785      for( AlephCollection<AlMuon>::iterator imu = MuonV().begin(); imu < MuonV().end(); imu++ )
00786      {
00787           addObject(imu);
00788      }
00789      for( AlephCollection<AlTrack>::iterator itr = TrackV().begin(); itr < TrackV().end(); itr++)
00790      {
00791              if(itr->Qvec()->QD->AE)
00792              {
00793                      AlTrack* theAssocTrack = &(*itr);
00794                      AlElec tmpelec;
00795                      tmpelec.setTrack( theAssocTrack );
00796                      AlEflw* theAssocEflw;
00797                      if (TEmap.find(theAssocTrack) == TEmap.end())
00798                              theAssocEflw = NULL;
00799                      else
00800                              theAssocEflw = &Eflw[TEmap.find(theAssocTrack)->second];
00801                      tmpelec.setEflw( theAssocEflw );
00802                      Elec.push_back(tmpelec);
00803              }
00804      }
00805      for( AlephCollection<AlElec>::iterator iel = ElecV().begin(); iel < ElecV().end(); iel++ )
00806        {
00807           addObject(iel);
00808        }
00809      Gamp.resize( KNGAT );
00810      if(KNGAT)
00811      {
00812      if ((unsigned int)KLGAT > qvec.size()) throw 8;
00813      for( int i = KFGAT - 1; i < KLGAT; i++ ) 
00814      {
00815           Gamp[ i - (KFGAT - 1) ].SetPointer( &qvec[i] );
00816           if((Gamp[ i - (KFGAT - 1) ].Qvec()!=NULL)&&(Gamp[ i - (KFGAT - 1) ].Qvec()->QD!=NULL)&&(Gamp[ i - (KFGAT - 1) ].Qvec()->QD->PG!=NULL))
00817                 if((Gamp[ i - (KFGAT - 1) ].Qvec()->QD->PG->PN>0)&&(Gamp[ i - (KFGAT - 1) ].Qvec()->QD->PG->PN<=(KLGAT-KFGAT+1)))
00818                         Gamp[ i - (KFGAT - 1) ].SetFake(&Gamp[ i + (Gamp[ i - (KFGAT - 1) ].Qvec()->QD->PG->PN) - (KFGAT - 1)]);
00819      }
00820      for( AlephCollection<AlGamp>::iterator ift = GampV().begin(); ift < GampV().end(); ift++ )
00821      {
00822           addObject(ift);
00823      }
00824      }
00825      if(KNREV>0)               // it may be no vertex at all
00826      {
00827      if ((unsigned int)KLREV > qvrt.size()) throw 9;
00828         if(qvrt[KFREV-1].TY == 1) // it may be no main vertex
00829         {
00830              _MainVertex.SetPointer(&qvrt[KFREV-1]);
00831              _MainVertex.SetIncomingTrack(NULL);
00832              for (vector<unsigned short>::iterator ii=qvrt[KFREV-1].DL.begin();ii<qvrt[KFREV-1].DL.end();ii++)
00833              {
00834                      AlTrack* theaddr = NULL;
00835                      if(((*ii)>=OKFCHT)&&((*ii)<(OKFCHT+KNCHT))) theaddr = &Track[(*ii)-KFCHT];
00836                      if(((*ii)>=OKFDCT)&&((*ii)<(OKFDCT+KNDCT))) theaddr = &V0Track[(*ii)-KFDCT];
00837                      _MainVertex.AddOutgoingTrack(theaddr);
00838              }
00839              SecVertices.resize(KNREV-1); 
00840              for(int i = KFREV; i<KLREV; i++)
00841              {
00842                      SecVertices[i-KFREV].SetPointer(&qvrt[i]);
00843                      AlTrack* theaddr = NULL;
00844                      if((qvrt[i].IP>=OKFV0T)&&(qvrt[i].IP<(OKFV0T+KNV0T))) theaddr = &StdV0[qvrt[i].IP-OKFV0T];
00845                      if((qvrt[i].IP>=OKFLVT)&&(qvrt[i].IP<(OKFLVT+KNLVT))) theaddr = &LongV0[qvrt[i].IP-OKFLVT];
00846                      if((qvrt[i].IP>=OKFCHT)&&(qvrt[i].IP<(OKFCHT+KNCHT))) theaddr = &Track[qvrt[i].IP-OKFCHT];
00847                      SecVertices[i-KFREV].SetIncomingTrack(theaddr);
00848                      for (vector<unsigned short>::iterator ii=qvrt[i].DL.begin();ii<qvrt[i].DL.end();ii++)
00849                      {
00850                              AlTrack* theaddr = NULL;
00851                              if(((*ii)>=OKFCHT)&&((*ii)<(OKFCHT+KNCHT))) theaddr = &Track[(*ii)-OKFCHT];
00852                              if(((*ii)>=OKFDCT)&&((*ii)<(OKFDCT+KNDCT))) theaddr = &V0Track[(*ii)-OKFDCT];
00853                              SecVertices[i-KFREV].AddOutgoingTrack(theaddr);
00854                      }
00855              }
00856         }
00857         else
00858         {
00859              SecVertices.resize(KNREV);
00860              for(int i = KFREV-1; i<KLREV; i++)
00861              {
00862                      SecVertices[i-KFREV+1].SetPointer(&qvrt[i]);
00863                      AlTrack* theaddr = NULL;
00864                      if((qvrt[i].IP>=OKFV0T)&&(qvrt[i].IP<(OKFV0T+KNV0T))) theaddr = &StdV0[qvrt[i].IP-OKFV0T];
00865                      if((qvrt[i].IP>=OKFLVT)&&(qvrt[i].IP<(OKFLVT+KNLVT))) theaddr = &LongV0[qvrt[i].IP-OKFLVT];
00866                      SecVertices[i-KFREV+1].SetIncomingTrack(theaddr);
00867                      for (vector<unsigned short>::iterator ii=qvrt[i].DL.begin();ii<qvrt[i].DL.end();ii++)
00868                      {
00869                              AlTrack* theaddr = NULL;
00870                              if(((*ii)>=OKFCHT)&&((*ii)<(OKFCHT+KNCHT))) theaddr = &Track[(*ii)-OKFCHT];
00871                              if(((*ii)>=OKFDCT)&&((*ii)<(OKFDCT+KNDCT))) theaddr = &V0Track[(*ii)-OKFDCT];
00872                              SecVertices[i-KFREV+1].AddOutgoingTrack(theaddr);
00873                      }
00874              }
00875         }
00876      }
00877      MCvertices.resize(KNMCV);
00878      if(KNMCV)
00879      {
00880      if ((unsigned int)KLMCV > qvrt.size()) throw 10;
00881      for(int i = KFMCV-1; i<KLMCV; i++)
00882      {
00883              MCvertices[i-KFMCV+1].SetPointer(&qvrt[i]);
00884              AlMCtruth* theaddr = NULL;
00885              if((qvrt[i].IP>=OKFMCT)&&(qvrt[i].IP<(OKFMCT+KNMCT))) theaddr = &MCtruth[qvrt[i].IP-OKFMCT];
00886              MCvertices[i-KFMCV+1].SetIncomingTrack(theaddr);
00887              for (vector<unsigned short>::iterator ii=qvrt[i].DL.begin();ii<qvrt[i].DL.end();ii++)
00888              {
00889                      AlMCtruth* theaddr = NULL;
00890                      if(((*ii)>=OKFMCT)&&((*ii)<(OKFMCT+KNMCT))) theaddr = &MCtruth[(*ii)-OKFMCT];
00891                      MCvertices[i-KFMCV+1].AddOutgoingTrack(theaddr);
00892              }
00893      }
00894      }
00895      if(KNCHT)
00896      for( int i = KFCHT - 1; i < KLCHT; i++ ) 
00897      {
00898           int ismain = KNREV ? ((qvrt[KFREV-1].TY == 1) ? 1 : 0) : 0;
00899           if (((qvec[i].OV!=0)&&((qvec[i].OV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].OV-OKFREV-ismain)>=(int)SecVertices.size())) throw 14;
00900           if (((qvec[i].EV!=0)&&((qvec[i].EV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].EV-OKFREV-ismain)>=(int)SecVertices.size())) throw 15;
00901           QvrtBase*  origin;
00902           if ((qvec[i].OV==0)||(qvec[i].OV==OKFREV))
00903           {
00904                   if (ismain==1)
00905                           origin = &_MainVertex;
00906                   else    origin = NULL;
00907           }
00908           else origin = &SecVertices[qvec[i].OV-OKFREV-ismain];
00909           QvrtBase*  end = &SecVertices[qvec[i].EV-OKFREV-ismain];
00910           if (qvec[i].EV==0) end = NULL;
00911           Track[ i - (KFCHT - 1) ].setOriginVertex(origin);
00912           Track[ i - (KFCHT - 1) ].setEndVertex(end);
00913      }
00914      if(KNDCT)
00915      for( int i = KFDCT - 1; i < KLDCT; i++ ) 
00916      {
00917           int ismain = KNREV ? ((qvrt[KFREV-1].TY == 1) ? 1 : 0) : 0 ;
00918           if (((qvec[i].OV!=0)&&((qvec[i].OV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].OV-OKFREV-ismain)>=(int)SecVertices.size())) throw 14;
00919           if (((qvec[i].EV!=0)&&((qvec[i].EV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].EV-OKFREV-ismain)>=(int)SecVertices.size())) throw 15;
00920           QvrtBase*  origin;
00921           if ((qvec[i].OV==0)||(qvec[i].OV==OKFREV))
00922           {
00923                   if (ismain==1)
00924                           origin = &_MainVertex;
00925                   else    origin = NULL;
00926           }
00927           else origin = &SecVertices[qvec[i].OV-OKFREV-ismain];
00928           QvrtBase*  end = &SecVertices[qvec[i].EV-OKFREV-ismain];
00929           if (qvec[i].EV==0) end = NULL;
00930           V0Track[ i - (KFDCT - 1) ].setOriginVertex(origin);
00931           V0Track[ i - (KFDCT - 1) ].setEndVertex(end);
00932      }
00933      if(KNV0T)
00934      for( int i = KFV0T - 1; i < KLV0T; i++ ) 
00935      {
00936           int ismain = KNREV ? ((qvrt[KFREV-1].TY == 1) ? 1 : 0) : 0 ;
00937           if (((qvec[i].OV!=0)&&((qvec[i].OV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].OV-OKFREV-ismain)>=(int)SecVertices.size())) throw 14;
00938           if (((qvec[i].EV!=0)&&((qvec[i].EV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].EV-OKFREV-ismain)>=(int)SecVertices.size())) throw 15;
00939           QvrtBase*  origin;
00940           if ((qvec[i].OV==0)||(qvec[i].OV==OKFREV))
00941           {
00942                   if (ismain==1)
00943                           origin = &_MainVertex;
00944                   else    origin = NULL;
00945           }
00946           else origin = &SecVertices[qvec[i].OV-OKFREV-ismain];
00947           QvrtBase*  end = &SecVertices[qvec[i].EV-OKFREV-ismain];
00948           if (qvec[i].EV==0) end = NULL;
00949           StdV0[ i - (KFV0T - 1) ].setOriginVertex(origin);
00950           StdV0[ i - (KFV0T - 1) ].setEndVertex(end);
00951      }
00952      if(KNLVT)
00953      for( int i = KFLVT - 1; i < KLLVT; i++ ) 
00954      {
00955           int ismain = KNREV ? ((qvrt[KFREV-1].TY == 1) ? 1 : 0) : 0 ;
00956           if (((qvec[i].OV!=0)&&((qvec[i].OV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].OV-OKFREV-ismain)>=(int)SecVertices.size())) throw 14;
00957           if (((qvec[i].EV!=0)&&((qvec[i].EV-(OKFREV-1)-ismain)<-1) ) ||((qvec[i].EV-OKFREV-ismain)>=(int)SecVertices.size())) throw 15;
00958           QvrtBase*  origin;
00959           if ((qvec[i].OV==0)||(qvec[i].OV==OKFREV))
00960           {
00961                   if (ismain==1)
00962                           origin = &_MainVertex;
00963                   else    origin = NULL;
00964           }
00965           else origin = &SecVertices[qvec[i].OV-OKFREV-ismain];
00966           QvrtBase*  end = &SecVertices[qvec[i].EV-OKFREV-ismain];
00967           if (qvec[i].EV==0) end = NULL;
00968           LongV0[ i - (KFLVT - 1) ].setOriginVertex(origin);
00969           LongV0[ i - (KFLVT - 1) ].setEndVertex(end);
00970      }
00971      if(KNMCT)
00972      for( int i = KFMCT - 1; i < KLMCT; i++ ) 
00973      {
00974         MCtruth[ i - (KFMCT - 1) ].SetPointer( &qvec[i] );
00975         if ((((qvec[i].OV-OKFMCV)<0)&&(qvec[i].OV!=0))||((qvec[i].OV-OKFMCV)>=(int)MCvertices.size())) throw 14;
00976         if ((((qvec[i].EV-OKFMCV)<0)&&(qvec[i].EV!=0))||((qvec[i].EV-OKFMCV)>=(int)MCvertices.size())) throw 15;
00977         QvrtBase*  origin = &MCvertices[qvec[i].OV-OKFMCV];
00978         QvrtBase*  end    = &MCvertices[qvec[i].EV-OKFMCV];
00979         if (qvec[i].EV==0) end = NULL;
00980         if (qvec[i].OV==0) origin = NULL;
00981         MCtruth[ i - (KFMCT - 1) ].setOriginVertex(origin);
00982         MCtruth[ i - (KFMCT - 1) ].setEndVertex(end);
00983      }
00984      }
00985      catch (int a) {  cerr << "Event invalid: " << a << endl; _Valid = false;} 
00986      _Event.SETqhac(&qhac);
00987      _Run.SETqhac(&qhac);
00988      _Run.SETqext(&qext);
00989 }
00990 /*-----------------------------------------------------------------------------*/
00991 template <class AlphaObject>
00992 void Detach( AlphaObject*& Object )
00993 {
00994      delete Object;     
00995      Object = (AlphaObject*) NULL;     
00996 }
00997 /*-----------------------------------------------------------------------------*/
00999 //  Destructor
01001 AlphaBanks::~AlphaBanks() 
01002 {
01003      for( int Row = 0; (uint) Row < qvec.size(); Row++ ) 
01004      {
01005           if( qvec[Row].QD != (QDET*) NULL)  
01006           {
01007                if( qvec[Row].QD -> AF != (FRFT*) NULL )   Detach( qvec[Row].QD -> AF );
01008                if( qvec[Row].QD -> AL != (FRTL*) NULL )   Detach( qvec[Row].QD -> AL );
01009                for( int i = 0; i < 4; i++)
01010                     if( qvec[Row].QD -> AT[i] != (TEXS*) NULL ) Detach( qvec[Row].QD -> AT[i] );
01011                if( qvec[Row].QD -> LT != (TEXS*) NULL )   Detach( qvec[Row].QD -> LT );
01012                if( qvec[Row].QD -> AE != (EIDT*) NULL )   Detach( qvec[Row].QD -> AE );
01013                if( qvec[Row].QD -> AH != (HMAD*) NULL )   Detach( qvec[Row].QD -> AH );
01014                if( qvec[Row].QD -> AM != (MCAD*) NULL )   Detach( qvec[Row].QD -> AM );
01015                if( qvec[Row].QD -> EC != (PECO*) NULL )   Detach( qvec[Row].QD -> EC );
01016                if( qvec[Row].QD -> HC != (PHCO*) NULL )   Detach( qvec[Row].QD -> HC );
01017                if( qvec[Row].QD -> ET != (PEPT*) NULL )   Detach( qvec[Row].QD -> ET );
01018                if( qvec[Row].QD -> FI != (FRID*) NULL )   Detach( qvec[Row].QD -> FI );
01019                if( qvec[Row].QD -> EF != (EFOL*) NULL )   Detach( qvec[Row].QD -> EF );
01020                if( qvec[Row].QD -> PC != (PCQA*) NULL )   Detach( qvec[Row].QD -> PC );
01021                if( qvec[Row].QD -> EG != (EGPC*) NULL )   Detach( qvec[Row].QD -> EG );
01022                if( qvec[Row].QD -> MU != (MUID*) NULL )   Detach( qvec[Row].QD -> MU );
01023                if( qvec[Row].QD -> PG != (PGAC*) NULL )   Detach( qvec[Row].QD -> PG );
01024                if( qvec[Row].QD -> PD != (PDLT*) NULL )   Detach( qvec[Row].QD -> PD );
01025                if( qvec[Row].QD -> PM != (PMLT*) NULL )   Detach( qvec[Row].QD -> PM );                    
01026                Detach( qvec[Row].QD );
01027           }
01028      }
01029      qvec.resize( 0 );
01030      for( int Row = 0; (uint) Row < qvrt.size(); Row++ )
01031      {
01032           if( qvrt[Row].AY != (YV0V*) NULL) 
01033                   Detach( qvrt[Row].AY );
01034           if( qvrt[Row].AF != (FVER*) NULL)
01035           {
01036                Detach( qvrt[Row].AF );
01037           }
01038      }
01039      qvrt.resize( 0 );
01040      if( qext.LP != (RLEP*) NULL )  Detach( qext.LP );
01041      
01042      if( qhac.EH != (EVEH*) NULL )  Detach( qhac.EH );
01043      if( qhac.RH != (RUNH*) NULL )  Detach( qhac.RH );
01044      if( qhac.KE != (KEVH*) NULL )  Detach( qhac.KE );
01045      if( qhac.RE != (REVH*) NULL )  Detach( qhac.RE );
01046      if( qhac.BO != (BOMB*) NULL )  Detach( qhac.BO );
01047      if( qhac.AS != (ASIM*) NULL )  Detach( qhac.AS );
01048      if( qhac.AD != (ADBR*) NULL )  Detach( qhac.AD );
01049      if( qhac.CN != (XTCN*) NULL )  Detach( qhac.CN );
01050      if( qhac.OP != (XTOP*) NULL )  Detach( qhac.OP );
01051      if( qhac.LP != (LUPA*) NULL )  Detach( qhac.LP );
01052      if( qhac.SI != (SILH*) NULL )  Detach( qhac.SI );
01053      if( qhac.EB != (XTEB*) NULL )  Detach( qhac.EB );
01054      if( qhac.RB != (XTRB*) NULL )  Detach( qhac.RB );
01055      if( qhac.BP != (DTBP*) NULL )  Detach( qhac.BP );
01056      if( qhac.X2 != (SIX2*) NULL )  Detach( qhac.X2 );
01057      if( qhac.TC != (SITC*) NULL )  Detach( qhac.TC );
01058      if( qhac.EX != (EAUX*) NULL )  Detach( qhac.EX );
01059      for (unsigned int row=0;row<qhac.LO.size();row++)
01060         if( qhac.LO[row] != (LOLE*) NULL )  Detach( qhac.LO[row] );
01061      for (unsigned int row=0;row<qhac.X1.size();row++)
01062         if( qhac.X1[row] != (X1RG*) NULL )  Detach( qhac.X1[row] );
01063      for (unsigned int row=0;row<qhac.BN.size();row++)
01064         if( qhac.BN[row] != (XTBN*) NULL )  Detach( qhac.BN[row] );
01065      for (unsigned int row=0;row<qhac.HV.size();row++)
01066         if( qhac.HV[row] != (XHVB*) NULL )  Detach( qhac.HV[row] );
01067      for (unsigned int row=0;row<qhac.TV.size();row++)
01068         if( qhac.TV[row] != (X1TV*) NULL )  Detach( qhac.TV[row] );
01069      for (unsigned int row=0;row<qhac.KW.size();row++)
01070         if( qhac.KW[row] != (KWGT*) NULL )  Detach( qhac.KW[row] );
01071      for (unsigned int row=0;row<qhac.IP.size();row++)
01072         if( qhac.IP[row] != (X1IP*) NULL )  Detach( qhac.IP[row] );
01073      for (unsigned int row=0;row<qhac.XA.size();row++)
01074         if( qhac.XA[row] != (SIXA*) NULL )  Detach( qhac.XA[row] );
01075      for (unsigned int row=0;row<qhac.CO.size();row++)
01076         if( qhac.CO[row] != (SRCO*) NULL )  Detach( qhac.CO[row] );
01077      for (unsigned int row=0;row<qhac.BV.size();row++)
01078         if( qhac.BV[row] != (VHBV*) NULL )  Detach( qhac.BV[row] );
01079      for (unsigned int row=0;row<qhac.PV.size();row++)
01080         if( qhac.PV[row] != (VHPV*) NULL )  Detach( qhac.PV[row] );
01081      for (unsigned int row=0;row<qhac.TH.size();row++)
01082         if( qhac.TH[row] != (X1TH*) NULL )  Detach( qhac.TH[row] );
01083      for (unsigned int row=0;row<qhac.XD.size();row++)
01084         if( qhac.XD[row] != (X1AD*) NULL )  Detach( qhac.XD[row] );
01085 }
01086 
01087 void AlphaBanks::addObject(AlObject* obj) { Objects.push_back(obj); }
01088 
01089 
01090 AlephCollection< AlGamp     >& AlphaBanks::GampV()         {return Gamp;                   }
01091 AlephCollection< AlGamp*    >  AlphaBanks::GampPV()        {return Gamp.Pointers();        }
01092 AlephCollection< AlEflw     >& AlphaBanks::EflwV()         {return Eflw;                   }
01093 AlephCollection< AlEflw*    >  AlphaBanks::EflwPV()        {return Eflw.Pointers();        }
01094 AlephCollection< AlTrack    >& AlphaBanks::TrackV()        {return Track;                  }
01095 AlephCollection< AlTrack*   >  AlphaBanks::TrackPV()       {return Track.Pointers();       }
01096 AlephCollection< AlTrack    >& AlphaBanks::V0TrackV()      {return V0Track;                }
01097 AlephCollection< AlTrack*   >  AlphaBanks::V0TrackPV()     {return V0Track.Pointers();     }
01098 AlephCollection< AlTrack    >& AlphaBanks::StdV0V()        {return StdV0;                  }
01099 AlephCollection< AlTrack*   >  AlphaBanks::StdV0PV()       {return StdV0.Pointers();       }
01100 AlephCollection< AlTrack    >& AlphaBanks::LongV0V()       {return LongV0;                 }
01101 AlephCollection< AlTrack*   >  AlphaBanks::LongV0PV()      {return LongV0.Pointers();      }
01102 AlephCollection< AlMCtruth  >& AlphaBanks::MCtruthV()      {return MCtruth;                }
01103 AlephCollection< AlMCtruth* >  AlphaBanks::MCtruthPV()     {return MCtruth.Pointers();     }
01104 AlephCollection< AlMuon     >& AlphaBanks::MuonV()         {return Muon;                   }
01105 AlephCollection< AlMuon*    >  AlphaBanks::MuonPV()        {return Muon.Pointers();        }
01106 AlephCollection< AlElec     >& AlphaBanks::ElecV()         {return Elec;                   }
01107 AlephCollection< AlElec*    >  AlphaBanks::ElecPV()        {return Elec.Pointers();        }
01108 AlVertex&                      AlphaBanks::MainVertex()    {return _MainVertex;            }
01109 AlVertex*                      AlphaBanks::MainVertexP()   {return &_MainVertex;           }
01110 AlephCollection< AlVertex   >& AlphaBanks::SecVerticesV()  {return SecVertices;            }
01111 AlephCollection< AlVertex*  >  AlphaBanks::SecVerticesPV() {return SecVertices.Pointers(); }
01112 AlephCollection< AlVertex   >& AlphaBanks::MCverticesV()   {return MCvertices;             }
01113 AlephCollection< AlVertex*  >  AlphaBanks::MCverticesPV()  {return MCvertices.Pointers();  }
01114 AlephCollection< AlObject*  >  AlphaBanks::ObjectPV()      {return Objects;                }
01115 
01116 bool AlphaBanks::isValid() const
01117 {
01118         return _Valid;
01119 }

Generated at Wed Jun 18 17:19:11 2003 for ALPHA++ by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001