/[PAMELA software]/DarthVader/CalorimeterLevel2/src/CaloLevel0.cpp
ViewVC logotype

Diff of /DarthVader/CalorimeterLevel2/src/CaloLevel0.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by mocchiut, Tue May 22 06:56:12 2007 UTC revision 1.7 by mocchiut, Sun Sep 9 18:57:26 2007 UTC
# Line 87  void CaloLevel0::SetVerbose(Bool_t ct){ Line 87  void CaloLevel0::SetVerbose(Bool_t ct){
87  /**  /**
88   * Initialize CaloLevel0 object   * Initialize CaloLevel0 object
89  **/  **/
90  void CaloLevel0::ProcessingInit(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){  void CaloLevel0::ProcessingInit(GL_TABLES *glt, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t isdeb, Bool_t isverb){
91      //
92      const TString host = glt->CGetHost();
93      const TString user = glt->CGetUser();
94      const TString psw = glt->CGetPsw();
95      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
96      if ( !dbc->IsConnected() ) throw -116;  
97    //    //
98    debug = isdeb;    debug = isdeb;
99    verbose = isverb;    verbose = isverb;
# Line 164  void CaloLevel0::ProcessingInit(TSQLServ Line 170  void CaloLevel0::ProcessingInit(TSQLServ
170    //    //
171    delete glcalo;    delete glcalo;
172    delete glroot;    delete glroot;
173      dbc->Close();
174      delete dbc;
175    //    //
176    return;    return;
177    //    //
178  }  }
179    
180  Int_t CaloLevel0::ChkCalib(TSQLServer *dbc, UInt_t atime){  Int_t CaloLevel0::ChkCalib(GL_TABLES *glt, UInt_t atime){
181    Int_t sgnl = 0;    Int_t sgnl = 0;
182    for ( Int_t s = 0; s < 4; s++){    for ( Int_t s = 0; s < 4; s++){
183      if ( atime > totime[s] ){      if ( atime > totime[s] ){
184        if ( !dbc->IsConnected() ) throw -116;        sgnl = Update(glt,atime,s);
       sgnl = Update(dbc,atime,s);  
185        if ( sgnl < 0 ) return(sgnl);        if ( sgnl < 0 ) return(sgnl);
186      };      };
187    };    };
188    return(sgnl);    return(sgnl);
189  }  }
190    
191  Int_t CaloLevel0::ChkParam(TSQLServer *dbc, UInt_t runheader, Bool_t mechal){  Int_t CaloLevel0::ChkParam(GL_TABLES *glt, UInt_t runheader, Bool_t mechal){
192      const TString host = glt->CGetHost();
193      const TString user = glt->CGetUser();
194      const TString psw = glt->CGetPsw();
195      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
196      if ( !dbc->IsConnected() ) throw -116;
197      //
198    stringstream calfile;    stringstream calfile;
199    stringstream bmfile;    stringstream bmfile;
200    stringstream aligfile;    stringstream aligfile;
# Line 223  Int_t CaloLevel0::ChkParam(TSQLServer *d Line 236  Int_t CaloLevel0::ChkParam(TSQLServer *d
236        for (Int_t k = 0; k < 22; k++ ){        for (Int_t k = 0; k < 22; k++ ){
237          for (Int_t l = 0; l < 96; l++ ){          for (Int_t l = 0; l < 96; l++ ){
238            fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f);            fread(&mip[m][k][l],sizeof(mip[m][k][l]),1,f);
239            if ( verbose ) printf(" %f \n",mip[m][k][l]);            if ( debug ) printf(" %f \n",mip[m][k][l]);
240          };          };
241        };        };
242      };      };
# Line 337  Int_t CaloLevel0::ChkParam(TSQLServer *d Line 350  Int_t CaloLevel0::ChkParam(TSQLServer *d
350    };    };
351    //    //
352    delete glparam;    delete glparam;
353      dbc->Close();
354      delete dbc;
355    //    //
356    return(0);    return(0);
357  }  }
# Line 399  Int_t CaloLevel0::Calibrate(Int_t ei){ Line 414  Int_t CaloLevel0::Calibrate(Int_t ei){
414    //    //
415    Int_t val = 0;    Int_t val = 0;
416    Int_t del = 1100;    Int_t del = 1100;
417      for (Int_t sec = 0; sec < 4; sec++){
418        for (Int_t dsec = 0; dsec < 7; dsec++){
419          val = (Int_t)de->calselftrig[sec][dsec];
420          del = delay(val);
421          clevel2->selfdelay[sec][dsec] = del;
422        };
423      };
424      val = 0;
425      del = 1100;
426    if ( clevel2->trigty != 2. ){    if ( clevel2->trigty != 2. ){
427      Bool_t ck = false;      Bool_t ck = false;
428      for (Int_t sec = 0; sec < 4; sec++){      for (Int_t sec = 0; sec < 4; sec++){
# Line 786  void CaloLevel0::FillTrkVar(CaloLevel2 * Line 810  void CaloLevel0::FillTrkVar(CaloLevel2 *
810      memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar));      memcpy(t_ca->tibar,clevel2->cibar,sizeof(clevel2->cibar));
811      memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar));      memcpy(t_ca->tbar,clevel2->cbar,sizeof(clevel2->cbar));
812      memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax));      memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax));
813        memcpy(ca->selfdelay,clevel2->selfdelay,sizeof(clevel2->selfdelay));
814      ca->varcfit[2] = clevel2->varcfit[0];      ca->varcfit[2] = clevel2->varcfit[0];
815      ca->varcfit[3] = clevel2->varcfit[1];      ca->varcfit[3] = clevel2->varcfit[1];
816      ca->npcfit[2] = clevel2->npcfit[0];      ca->npcfit[2] = clevel2->npcfit[0];
# Line 838  void CaloLevel0::FillCommonVar(CaloLevel Line 863  void CaloLevel0::FillCommonVar(CaloLevel
863    ca->selen = clevel2->selen;    ca->selen = clevel2->selen;
864    memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq));    memcpy(ca->qq,clevel2->qq,sizeof(clevel2->qq));
865    memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax));    memcpy(ca->planemax,clevel2->planemax,sizeof(clevel2->planemax));
866      memcpy(ca->selfdelay,clevel2->selfdelay,sizeof(clevel2->selfdelay));
867    ca->varcfit[0] = clevel2->varcfit[0];    ca->varcfit[0] = clevel2->varcfit[0];
868    ca->varcfit[1] = clevel2->varcfit[1];    ca->varcfit[1] = clevel2->varcfit[1];
869    ca->npcfit[0] = clevel2->npcfit[0];    ca->npcfit[0] = clevel2->npcfit[0];
# Line 928  void CaloLevel0::ClearCommonVar(){ Line 954  void CaloLevel0::ClearCommonVar(){
954    memset(clevel2->varcfit, 0, 4*sizeof(Float_t));    memset(clevel2->varcfit, 0, 4*sizeof(Float_t));
955    memset(clevel2->npcfit, 0, 4*sizeof(Int_t));    memset(clevel2->npcfit, 0, 4*sizeof(Int_t));
956    memset(clevel2->planemax, 0, 2*sizeof(Int_t));    memset(clevel2->planemax, 0, 2*sizeof(Int_t));
957      memset(clevel2->selfdelay, 0, 4*7*sizeof(Int_t));
958    memset(clevel2->fmode, 0, 2*sizeof(Int_t));    memset(clevel2->fmode, 0, 2*sizeof(Int_t));
959    memset(clevel2->cibar, 0, 2*22*sizeof(Int_t));    memset(clevel2->cibar, 0, 2*22*sizeof(Int_t));
960    memset(clevel2->cbar, 0, 2*22*sizeof(Float_t));    memset(clevel2->cbar, 0, 2*22*sizeof(Float_t));
# Line 984  void CaloLevel0::ClearCalibVals(Int_t s) Line 1011  void CaloLevel0::ClearCalibVals(Int_t s)
1011    return;    return;
1012  }  }
1013    
1014  Int_t CaloLevel0::Update(TSQLServer *dbc, UInt_t atime, Int_t s){  Int_t CaloLevel0::Update(GL_TABLES *glt, UInt_t atime, Int_t s){
1015    //    //
1016      const TString host = glt->CGetHost();
1017      const TString user = glt->CGetUser();
1018      const TString psw = glt->CGetPsw();
1019      TSQLServer *dbc = TSQLServer::Connect(host.Data(),user.Data(),psw.Data());
1020      if ( !dbc->IsConnected() ) throw -116;
1021    Int_t sgnl = 0;    Int_t sgnl = 0;
1022    //    //
1023    GL_CALO_CALIB *glcalo = new GL_CALO_CALIB();    GL_CALO_CALIB *glcalo = new GL_CALO_CALIB();

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.7

  ViewVC Help
Powered by ViewVC 1.1.23