DcsWriter Class Reference

#include <DcsWriter.h>

Inheritance diagram for DcsWriter:
JobCModule

List of all members.

Public Member Functions

 DcsWriter ()
 ~DcsWriter ()
JobCResult Ana (const MomNavigator *mom)
void EndJob ()
void BeginJob ()

Private Member Functions

JobCResult ProcessRawRecord (const RawRecord *rawrec)

Detailed Description

Definition at line 13 of file DcsWriter.h.


Constructor & Destructor Documentation

DcsWriter::DcsWriter (  ) 

Definition at line 54 of file DcsWriter.cxx.

00054 {}

DcsWriter::~DcsWriter (  ) 

Definition at line 58 of file DcsWriter.cxx.

00058 {}


Member Function Documentation

JobCResult DcsWriter::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 62 of file DcsWriter.cxx.

References JobCResult::Failed(), JobCResult::kPassed, and ProcessRawRecord().

00063 {
00064         JobCResult result = JobCResult::kPassed;
00065 
00066         TObject   *tobj   = 0;
00067         TIter reciter = const_cast<MomNavigator*>(mom)->FragmentIter();
00068         while ( (tobj = reciter() ) ) {
00069                 RawRecord *rawrec = dynamic_cast<RawRecord *>(tobj);
00070                 JobCResult aresult = ProcessRawRecord(rawrec);
00071                 if (aresult.Failed()) result = aresult;
00072         }
00073 
00074         return result;
00075 }

void DcsWriter::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 502 of file DcsWriter.cxx.

References CoilTools::FixFormat().

00503 {
00504   // Change the logging format
00505   CoilTools::FixFormat(); // change debug, warning message formats dammit 
00506 }

void DcsWriter::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 510 of file DcsWriter.cxx.

References CoilTools::Distill(), VldTimeStamp::GetBOT(), VldTimeStamp::GetEOT(), and Detector::kFar.

JobCResult DcsWriter::ProcessRawRecord ( const RawRecord rawrec  )  [private]

Definition at line 82 of file DcsWriter.cxx.

References DbiWriter< T >::Close(), CoilTools::Distill(), err(), RawDcsChillerMonitorBlock::GetAhuS1RmTemp(), RawDcsHvMonitorBlock::GetAlarmbits(), RawDcsEnvMonitorBlock::GetCalCerPressure1(), RawDcsEnvMonitorBlock::GetCalCerPressure2(), RawDcsEnvMonitorBlock::GetCalCerPressure3(), RawDcsEnvMonitorBlock::GetCalCerPressure4(), RawDcsEnvMonitorBlock::GetCalCerPressure5(), RawDcsEnvMonitorBlock::GetCalCounter1(), RawDcsEnvMonitorBlock::GetCalCounter2(), RawDcsEnvMonitorBlock::GetCalCounter3(), RawDcsEnvMonitorBlock::GetCalCounter4(), RawDcsEnvMonitorBlock::GetCalCounter5(), RawDcsEnvMonitorBlock::GetCalCounter6(), RawDcsEnvMonitorBlock::GetCalCounter7(), RawDcsEnvMonitorBlock::GetCalCounter8(), RawDcsEnvMonitorBlock::GetCalEnvIsTriggerEvent(), RawDcsEnvMonitorBlock::GetCalEnvThermArray(), RawDcsEnvMonitorBlock::GetCalEnvTriggerRate(), RawDcsEnvMonitorBlock::GetCalHumid(), RawDcsMagnetMonitorBlock::GetCalIsT7(), RawDcsEnvMonitorBlock::GetCalPressure(), RawDcsEnvMonitorBlock::GetCalTemperature(), RawDcsMagnetMonitorBlock::GetCalZT11_BHZ01(), RawDcsMagnetMonitorBlock::GetCalZT11_BHZ02(), RawDcsMagnetMonitorBlock::GetCalZT11_QDE01(), RawDcsMagnetMonitorBlock::GetCalZT11_QDE05(), RawDcsMagnetMonitorBlock::GetCalZT11_QFO02(), RawDcsMagnetMonitorBlock::GetCalZT11_QFO03(), RawDcsMagnetMonitorBlock::GetCalZT11_QFO04(), RawDcsMagnetMonitorBlock::GetCalZT11_QVT01(), RawDcsMagnetMonitorBlock::GetCalZT7_BHZ01NS7(), RawDcsMagnetMonitorBlock::GetCalZT7_BHZ01S7(), RawDcsMagnetMonitorBlock::GetCalZT7_BHZ02(), RawDcsMagnetMonitorBlock::GetCalZT7_QDE02(), RawDcsMagnetMonitorBlock::GetCalZT7_QDE04(), RawDcsMagnetMonitorBlock::GetCalZT7_QFO01(), RawDcsMagnetMonitorBlock::GetCalZT7_QFO03(), RawDcsMagnetMonitorBlock::GetCalZT7_QFO05(), RawDcsHvMonitorBlock::GetCard(), RawDcsHvMonitorBlock::GetChannel(), RawDcsCanMonitorBlock::GetCurrent1(), RawDcsCanMonitorBlock::GetCurrent2(), RawDcsCanMonitorBlock::GetCurrent3(), RawDcsCanMonitorBlock::GetCurrent4(), VldContext::GetDetector(), RawDcsChillerMonitorBlock::GetDetReturnCwt(), RawDcsChillerMonitorBlock::GetDetSupplyCwt(), RawDcsChillerMonitorBlock::GetDischargeCwt(), RawDcsChillerMonitorBlock::GetDischargeFct(), RawDcsEnvMonitorBlock::GetEnvDetector(), RawDcsMagnetMonitorBlock::GetFarCurrent(), RawDcsEnvMonitorBlock::GetFarHumid1(), RawDcsEnvMonitorBlock::GetFarHumid2(), RawDcsMagnetMonitorBlock::GetFarImbalanceVoltage(), RawDcsEnvMonitorBlock::GetFarPressure1(), RawDcsEnvMonitorBlock::GetFarPressure2(), RawDcsEnvMonitorBlock::GetFarRadon1(), RawDcsEnvMonitorBlock::GetFarRadon2(), RawDcsEnvMonitorBlock::GetFarRadonFactor1(), RawDcsEnvMonitorBlock::GetFarRadonFactor2(), RawDcsMagnetMonitorBlock::GetFarSupermodule(), RawDcsEnvMonitorBlock::GetFarTemperature1(), RawDcsEnvMonitorBlock::GetFarTemperature2(), RawDcsMagnetMonitorBlock::GetFarThermocoupleArray(), RawDcsMagnetMonitorBlock::GetFarVoltage(), RawDcsChillerMonitorBlock::GetFcu1RmTemp(), RawDcsChillerMonitorBlock::GetFcu2RmTemp(), RawDcsChillerMonitorBlock::GetHx3ColdRetWt(), RawDcsChillerMonitorBlock::GetHx3WarmDischWt(), RawDcsRpsMonitorBlock::GetIsError(), RawDcsRpsMonitorBlock::GetIsWarning(), RawDcsMagnetMonitorBlock::GetMagDetector(), RawDcsHvMonitorBlock::GetMainframe(), RawDcsMagnetMonitorBlock::GetNearCurrent(), RawDcsMagnetMonitorBlock::GetNearCurrentRegMode(), RawDcsMagnetMonitorBlock::GetNearDCOverCurrent(), RawDcsEnvMonitorBlock::GetNearEnvThermArray(), RawDcsMagnetMonitorBlock::GetNearExternalRef(), RawDcsMagnetMonitorBlock::GetNearGroundFault(), RawDcsEnvMonitorBlock::GetNearHumid(), RawDcsMagnetMonitorBlock::GetNearInterLockState(), RawDcsMagnetMonitorBlock::GetNearLocalRemoteState(), RawDcsMagnetMonitorBlock::GetNearOnOffState(), RawDcsMagnetMonitorBlock::GetNearOverTemp(), RawDcsMagnetMonitorBlock::GetNearPolarity(), RawDcsEnvMonitorBlock::GetNearPressure(), RawDcsEnvMonitorBlock::GetNearRadonCounts(), RawDcsMagnetMonitorBlock::GetNearRawData(), RawDcsEnvMonitorBlock::GetNearTemperature(), RawDcsMagnetMonitorBlock::GetNearVoltage(), RawDcsMagnetMonitorBlock::GetNearVoltageReference(), RawDcsMagnetMonitorBlock::GetNumEntries(), RawDcsRpsMonitorBlock::GetNumEntries(), RawDcsChillerMonitorBlock::GetNumEntries(), RawDcsHvMonitorBlock::GetNumEntries(), RawDcsCanMonitorBlock::GetNumEntries(), RawDcsEnvMonitorBlock::GetNumEntries(), RawDcsHvMonitorBlock::GetPlane(), RawDcsHvMonitorBlock::GetPmt(), RawDcsCanMonitorBlock::GetPowerState(), RawDcsCanMonitorBlock::GetPowerSupplyId(), RawDcsRpsMonitorBlock::GetRackNumber(), RawRecord::GetRawBlockIter(), RawDcsHvMonitorBlock::GetRawChannel(), RawDcsHvMonitorBlock::GetRawGeometry(), RawDcsHvMonitorBlock::GetReadVoltage(), RawDcsChillerMonitorBlock::GetReturnCwt(), RawDcsChillerMonitorBlock::GetReturnWt(), RawDcsChillerMonitorBlock::GetS1RmTemp(), VldTimeStamp::GetSec(), RawDcsHvMonitorBlock::GetSetVoltage(), RawDcsHvMonitorBlock::GetSide(), VldContext::GetSimFlag(), RawDcsChillerMonitorBlock::GetStateChiller1(), RawDcsChillerMonitorBlock::GetStateChiller2(), RawDcsChillerMonitorBlock::GetStateDetAlarm(), RawDcsChillerMonitorBlock::GetStateFluidCooler(), RawDcsChillerMonitorBlock::GetStatePumpP1(), RawDcsChillerMonitorBlock::GetStatePumpP4(), RawDcsChillerMonitorBlock::GetStatePumpP5(), RawDcsRpsMonitorBlock::GetStatus(), RawDcsChillerMonitorBlock::GetSurfaceTemp(), RawDcsCanMonitorBlock::GetTemperatureInt(), RawDcsMagnetMonitorBlock::GetTimeStamp(), RawDcsCanMonitorBlock::GetTimeStamp(), RawDcsEnvMonitorBlock::GetTimeStamp(), RawDcsHvMonitorBlock::GetTimeStamp(), RawDcsRpsMonitorBlock::GetTimeStamp(), RawDcsChillerMonitorBlock::GetTimeStamp(), RawDcsRpsMonitorBlock::GetUnpackedRpsStruct(), RawDcsCanMonitorBlock::GetVldContext(), RawDcsEnvMonitorBlock::GetVldContext(), RawDcsMagnetMonitorBlock::GetVldContext(), RawDcsHvMonitorBlock::GetVldContext(), RawDcsRpsMonitorBlock::GetVldContext(), RawDcsChillerMonitorBlock::GetVldContext(), RawDcsCanMonitorBlock::GetVoltage1(), RawDcsCanMonitorBlock::GetVoltage2(), RawDcsCanMonitorBlock::GetVoltage3(), RawDcsCanMonitorBlock::GetVoltage4(), Detector::kFar, JobCResult::kPassed, nentries, Dcs_Env_Near::SetAdditionalTherms(), Dcs_Env_Cal::SetCerenAndCounts(), stat, timer(), Munits::volt, and warn().

Referenced by Ana().

00083 {
00084         JobCResult result = JobCResult::kPassed;
00085         TIter itr = rawrec->GetRawBlockIter();
00086         RawDataBlock* rdb = 0;
00087         Int_t aggNo=-1;
00088         Dbi::Task task=0;
00089 
00090         while ( (rdb = dynamic_cast<RawDataBlock*>( itr() )) ) {
00091                 RawDcsRpsMonitorBlock* rpsblk = dynamic_cast<RawDcsRpsMonitorBlock*>(rdb);
00092                 if(rpsblk)
00093                 {
00094                         Int_t rackno,rackraw,stat,warn,err;
00095                         int nentries = rpsblk->GetNumEntries();
00096                         for ( int indx = 0; indx < nentries; ++indx ) {
00097 
00098                                 //make entry in database with DbiWriter
00099 
00100                                 VldContext timer;
00101                                 timer=rpsblk->GetVldContext();
00102 //                              VldTimeStamp start=timer.GetTimeStamp();
00103                                 VldTimeStamp start=rpsblk->GetTimeStamp(indx);
00104                                 time_t vcSec = start.GetSec() + 60*20; //(20 min validity)
00105                                 VldTimeStamp end(vcSec,0);
00106                                 VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Rps");
00107 //                              VldTimeStamp create = VldTimeStamp();
00108                                 rackno=rpsblk->GetRackNumber(indx);
00109                                 aggNo=rackno;
00110                                 DbiWriter<Dcs_Rps> writer(range,aggNo,task,start);
00111                                 rackraw=rpsblk->GetUnpackedRpsStruct(indx);
00112                                 stat=rpsblk->GetStatus(indx);
00113                                 warn=rpsblk->GetIsWarning(indx);
00114                                 err=rpsblk->GetIsError(indx);
00115                                 Dcs_Rps row0(rackno,rackraw,stat,warn,err);
00116                                 writer << row0;
00117                                 writer.Close();
00118                         }
00119                         continue;
00120                 }
00121                 RawDcsChillerMonitorBlock* chillblk = dynamic_cast<RawDcsChillerMonitorBlock*>(rdb);
00122                 if(chillblk)
00123                 {
00124                         aggNo=-1;
00125                         int nentries = chillblk->GetNumEntries();
00126                         for ( int indx = 0; indx < nentries; ++indx ) {
00127 
00128                                 //make entry in database with DbiWriter
00129 
00130                                 VldContext timer;
00131                                 timer=chillblk->GetVldContext();
00132 //                              VldTimeStamp start=timer.GetTimeStamp();
00133                                 VldTimeStamp start=chillblk->GetTimeStamp(indx);
00134                                 time_t vcSec = start.GetSec() + 60*20; //(20 min validity)
00135                                 VldTimeStamp end(vcSec,0);
00136                                 VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Rps");
00137 //                              VldTimeStamp create = VldTimeStamp();
00138                                 DbiWriter<Dcs_Chiller_Far> writer(range,aggNo,task,start);
00139                                 Float_t ReturnWt=chillblk->GetReturnWt(indx);
00140                                 Float_t DischargeFct=chillblk->GetDischargeFct(indx);
00141                                 Float_t ReturnCwt=chillblk->GetReturnCwt(indx);
00142                                 Float_t DischargeCwt=chillblk->GetDischargeCwt(indx);
00143                                 Int_t StateFluidCooler=chillblk->GetStateFluidCooler(indx);
00144                                 Int_t StatePumpP4=chillblk->GetStatePumpP4(indx);
00145                                 Int_t StateChiller1=chillblk->GetStateChiller1(indx);
00146                                 Int_t StateChiller2=chillblk->GetStateChiller2(indx);
00147                                 Float_t DetReturnCwt=chillblk->GetDetReturnCwt(indx);
00148                                 Float_t DetSupplyCwt=chillblk->GetDetSupplyCwt(indx);
00149                                 Int_t StatePumpP5=chillblk->GetStatePumpP5(indx);
00150                                 Int_t StateDetAlarm=chillblk->GetStateDetAlarm(indx);
00151                                 Float_t AhuS1RmTemp=chillblk->GetAhuS1RmTemp(indx);
00152                                 Float_t Hx3ColdRetWt=chillblk->GetHx3ColdRetWt(indx);
00153                                 Float_t Hx3WarmDischWt=chillblk->GetHx3WarmDischWt(indx);
00154                                 Int_t StatePumpP1=chillblk->GetStatePumpP1(indx);
00155                                 Float_t Fcu1RmTemp=chillblk->GetFcu1RmTemp(indx);
00156                                 Float_t Fcu2RmTemp=chillblk->GetFcu2RmTemp(indx);
00157                                 Float_t S1RmTemp=chillblk->GetS1RmTemp(indx);
00158                                 Float_t SurfaceTemp=chillblk->GetSurfaceTemp(indx);
00159                                 Dcs_Chiller_Far row0(ReturnWt,DischargeFct,ReturnCwt,DischargeCwt,StateFluidCooler,StatePumpP4,StateChiller1,StateChiller2,DetReturnCwt,DetSupplyCwt,StatePumpP5,StateDetAlarm,AhuS1RmTemp,Hx3ColdRetWt,Hx3WarmDischWt,StatePumpP1,Fcu1RmTemp,Fcu2RmTemp,S1RmTemp,SurfaceTemp);
00160                                 writer << row0;
00161                                 writer.Close();
00162                         }
00163                         continue;
00164                 }
00165 
00166                 RawDcsHvMonitorBlock* hvblk = dynamic_cast<RawDcsHvMonitorBlock*>(rdb);
00167                 if(hvblk)
00168                 {
00169                         // figure out how to run multiple rows per seqno....
00170                         Int_t logical,geometry,mainframe,card,channel,plane,supermod,side,pmt,setv,readv,hv_err;
00171                         int nentries = hvblk->GetNumEntries();
00172                         if (nentries==0)
00173                                 continue;
00174                         VldContext timer;
00175                         timer=hvblk->GetVldContext();
00176                         VldTimeStamp start=hvblk->GetTimeStamp(0);
00177                         time_t vcSec = start.GetSec() + 60*20; //(20 minute validity)
00178                         VldTimeStamp end(vcSec,0);
00179                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Hv");
00180 //                      VldTimeStamp create = VldTimeStamp();
00181                         mainframe=hvblk->GetMainframe(0);
00182                         supermod=1;
00183                         if (mainframe>8)
00184                                 supermod=-1;
00185                         if (mainframe>4 && mainframe < 9)
00186                                 supermod=2;
00187                         Int_t near=0;
00188                         if (timer.GetDetector()==1)
00189                         {
00190                                 near=1;
00191                                 supermod=-1;
00192                         }
00193                         aggNo=supermod;
00194                         DbiWriter<Dcs_Hv> writer(range,aggNo,task,start);
00195                         for ( int indx = 0; indx < nentries; ++indx ) {
00196                                 logical=hvblk->GetRawChannel(indx);
00197                                 geometry=hvblk->GetRawGeometry(indx);
00198                                 mainframe=hvblk->GetMainframe(indx);
00199                                 card=hvblk->GetCard(indx);
00200                                 channel=hvblk->GetChannel(indx);
00201                                 plane=hvblk->GetPlane(indx);
00202                                 supermod=1;
00203                                 if (mainframe>8)
00204                                         supermod=0;
00205                                 if (mainframe>4 && mainframe < 9)
00206                                         supermod=2;
00207                                 if (near==1)
00208                                         supermod=-1;
00209                                 side=hvblk->GetSide(indx);
00210                                 pmt=hvblk->GetPmt(indx);
00211                                 setv=hvblk->GetSetVoltage(indx);
00212                                 readv=hvblk->GetReadVoltage(indx);
00213                                 hv_err=hvblk->GetAlarmbits(indx);
00214                                 Dcs_Hv row0(logical,geometry,mainframe,card,channel,plane,supermod,side,pmt,setv,readv,hv_err);
00215                                 writer << row0;
00216 //                              if (indx== nentries)
00217 //                                      writer.Close();
00218 //I think this is how it can work
00219 //Close after all events have been written?  I think each block is a single 
00220 //set of seqnos, so this is okay.  However, the writer is inside the for 
00221 //loop, and we need its scope to extend beyond it, test at beginning if 
00222 //data, and make the writer before entering for loop
00223                         }
00224                         writer.Close();
00225                         continue;
00226                 }
00227                 RawDcsEnvMonitorBlock* envblk = dynamic_cast<RawDcsEnvMonitorBlock*>(rdb);
00228                 if(envblk)
00229                 {
00230                         aggNo=-1;
00231                         if(envblk->GetEnvDetector()==2)
00232                         {
00233                                 Float_t temp1,humid1,radon1,pres1,temp2,humid2,radon2,pres2,radonfact1,radonfact2;
00234                                 int nentries = envblk->GetNumEntries();
00235                                 for ( int indx = 0; indx < nentries; ++indx )
00236                                 {       
00237                                         VldContext timer;
00238                                         timer=envblk->GetVldContext();
00239                                         VldTimeStamp start=envblk->GetTimeStamp(indx);
00240                                         time_t vcSec = start.GetSec() + 60*10; //10 minute validity for fardet
00241                                         VldTimeStamp end(vcSec,0);
00242                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Env_Far");
00243 //                                      VldTimeStamp create = VldTimeStamp();
00244                                         DbiWriter<Dcs_Env_Far> writer(range,aggNo,task,start);
00245                                         temp1=envblk->GetFarTemperature1(indx);
00246                                         humid1=envblk->GetFarHumid1(indx);
00247                                         radon1=envblk->GetFarRadon1(indx);
00248                                         pres1=envblk->GetFarPressure1(indx);
00249                                         temp2=envblk->GetFarTemperature2(indx);
00250                                         humid2=envblk->GetFarHumid2(indx);
00251                                         radon2=envblk->GetFarRadon2(indx);
00252                                         pres2=envblk->GetFarPressure2(indx);
00253                                         radonfact1=envblk->GetFarRadonFactor1(indx);
00254                                         radonfact2=envblk->GetFarRadonFactor2(indx);
00255                                         Dcs_Env_Far row0(temp1,humid1,radon1,pres1,temp2,humid2,radon2,pres2,radonfact1,radonfact2);
00256                                         writer << row0;
00257                                         writer.Close();
00258                                 }
00259                         }
00260                         if(envblk->GetEnvDetector()==4)
00261                         {
00262                                 Float_t temp,humid,pres;
00263                                 Int_t iTherm[32];
00264                                 Float_t therm[32];
00265                                 Int_t isTrig,TrigRate,iCount1,iCount2,iCount3,iCount4,iCount5,iCount6,iCount7,iCount8;
00266                                 Float_t fCerenkov1,fCerenkov2,fCerenkov3,fCerenkov4,fCerenkov5;
00267                                 int nentries = envblk->GetNumEntries();
00268                                 for ( int indx = 0; indx < nentries; ++indx )
00269                                 {       
00270                                         VldContext timer;
00271                                         timer=envblk->GetVldContext();
00272                                         VldTimeStamp start=envblk->GetTimeStamp(indx);
00273                                         time_t vcSec = start.GetSec() + 30; //30 sec validity for caldet env
00274                                         VldTimeStamp end(vcSec,0);
00275                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Env_Cal");
00276 //                                      VldTimeStamp create = VldTimeStamp();
00277                                         DbiWriter<Dcs_Env_Cal> writer(range,aggNo,task,start);
00278                                         temp=envblk->GetCalTemperature(indx);
00279                                         humid=envblk->GetCalHumid(indx);
00280                                         pres=envblk->GetCalPressure(indx);
00281                                         isTrig=envblk->GetCalEnvIsTriggerEvent(indx);
00282                                         TrigRate=envblk->GetCalEnvTriggerRate(indx);
00283                                         fCerenkov1=envblk->GetCalCerPressure1(indx);
00284                                         fCerenkov2=envblk->GetCalCerPressure2(indx);
00285                                         fCerenkov3=envblk->GetCalCerPressure3(indx);
00286                                         fCerenkov4=envblk->GetCalCerPressure4(indx);
00287                                         fCerenkov5=envblk->GetCalCerPressure5(indx);
00288                                         iCount1=envblk->GetCalCounter1(indx);
00289                                         iCount2=envblk->GetCalCounter2(indx);
00290                                         iCount3=envblk->GetCalCounter3(indx);
00291                                         iCount4=envblk->GetCalCounter4(indx);
00292                                         iCount5=envblk->GetCalCounter5(indx);
00293                                         iCount6=envblk->GetCalCounter6(indx);
00294                                         iCount7=envblk->GetCalCounter7(indx);
00295                                         iCount8=envblk->GetCalCounter8(indx);
00296                                         envblk->GetCalEnvThermArray(indx,iTherm);
00297                                         for (Int_t i= 0; i < 32; i++)
00298                                         {
00299                                                 memcpy(&therm[i],&iTherm[i],4);
00300                                         }
00301                                         Dcs_Env_Cal row0(temp,humid,pres,isTrig,TrigRate,therm[0],therm[1],therm[2],therm[3],therm[4],therm[5],therm[6],therm[7],therm[8],therm[9],therm[10],therm[11],therm[12],therm[13],therm[14],therm[15],therm[16],therm[17],therm[18],therm[19],therm[20],therm[21],therm[22],therm[23],therm[24],therm[25],therm[26],therm[27],therm[28],therm[29],therm[30],therm[31]);
00302                                         row0.SetCerenAndCounts(fCerenkov1,fCerenkov2,fCerenkov3,fCerenkov4,fCerenkov5,iCount1,iCount2,iCount3,iCount4,iCount5,iCount6,iCount7,iCount8);
00303                                         writer << row0;
00304                                         writer.Close();
00305                                 }
00306                         }
00307                         if(envblk->GetEnvDetector()==1)
00308                         {
00309                                 /* neardet stuff */
00310                                 Float_t temp,humid,pres;
00311                                 Int_t iTherm[56];
00312                                 Float_t therm[56];
00313                                 Int_t TrigRate;
00314                                 int nentries = envblk->GetNumEntries();
00315                                 for ( int indx = 0; indx < nentries; ++indx )
00316                                 {       
00317                                         VldContext timer;
00318                                         timer=envblk->GetVldContext();
00319                                         VldTimeStamp start=envblk->GetTimeStamp(indx);
00320                                         time_t vcSec = start.GetSec() + 30; //30 sec validity for caldet env
00321                                         VldTimeStamp end(vcSec,0);
00322                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Env_Cal");
00323 //                                      VldTimeStamp create = VldTimeStamp();
00324                                         DbiWriter<Dcs_Env_Near> writer(range,aggNo,task,start);
00325                                         temp=envblk->GetNearTemperature(indx);
00326                                         humid=envblk->GetNearHumid(indx);
00327                                         pres=envblk->GetNearPressure(indx);
00328                                         TrigRate=envblk->GetNearRadonCounts(indx);
00329                                         envblk->GetNearEnvThermArray(indx,iTherm);
00330                                         for (Int_t i= 0; i < 56; i++)
00331                                         {
00332                                                 memcpy(&therm[i],&iTherm[i],4);
00333                                         }
00334                                         Dcs_Env_Near row0(temp,humid,pres,TrigRate,therm[0],therm[1],therm[2],therm[3],therm[4],therm[5],therm[6],therm[7],therm[8],therm[9],therm[10],therm[11],therm[12],therm[13],therm[14],therm[15],therm[16],therm[17],therm[18],therm[19],therm[20],therm[21],therm[22],therm[23],therm[24],therm[25],therm[26],therm[27],therm[28],therm[29],therm[30],therm[31]);
00335                                         row0.SetAdditionalTherms(therm[32],therm[33],therm[34],therm[35],therm[36],therm[37],therm[38],therm[39],therm[40],therm[41],therm[42],therm[43],therm[44],therm[45],therm[46],therm[47],therm[48],therm[49],therm[50],therm[51],therm[52],therm[53],therm[54],therm[55]);
00336                                         writer << row0;
00337                                         writer.Close();
00338                                 }
00339                         }
00340                         continue;
00341                 }
00342 
00343                 RawDcsMagnetMonitorBlock* magblk = dynamic_cast<RawDcsMagnetMonitorBlock*>(rdb);
00344                 if(magblk)
00345                 {
00346                         aggNo=-1;
00347                         if(magblk->GetMagDetector()==2)
00348                         {
00349                                 Float_t current,voltage,therm[29], imb;
00350                                 Int_t iTherms[29];
00351                                 Int_t supermod;
00352                                 int nentries = magblk->GetNumEntries();
00353                                 for ( int indx = 0; indx < nentries; ++indx )
00354                                 {       
00355                                         VldContext timer;
00356                                         timer=magblk->GetVldContext();
00357                                         VldTimeStamp start=magblk->GetTimeStamp(indx);
00358                                         time_t vcSec = start.GetSec() + 60*2; // 2 minute validity
00359                                         VldTimeStamp end(vcSec,0);
00360                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Mag_Far");
00361                                         VldTimeStamp create = VldTimeStamp();
00362                                         supermod=magblk->GetFarSupermodule(indx);
00363                                         aggNo=supermod;
00364                                         DbiWriter<Dcs_Mag_Far> writer(range,aggNo,task,start);
00365                                         current=magblk->GetFarCurrent(indx);
00366                                         voltage=magblk->GetFarVoltage(indx);
00367                                         magblk->GetFarThermocoupleArray(indx,iTherms);
00368                                         for (Int_t i=0; i < 29; i++)
00369                                         {
00370                                                 memcpy(&therm[i],&iTherms[i],4);
00371                                         }
00372                                         imb=magblk->GetFarImbalanceVoltage(indx);
00373                                         Dcs_Mag_Far row0(current,voltage,supermod,therm[0],therm[1],therm[2],therm[3],therm[4],therm[5],therm[6],therm[7],therm[8],therm[9],therm[10],therm[11],therm[12],therm[13],therm[14],therm[15],therm[16],therm[17],therm[18],therm[19],therm[20],therm[21],therm[22],therm[23],therm[24],therm[25],therm[26],therm[27],therm[28],imb);
00374                                         writer << row0;
00375                                         writer.Close();
00376                                         // send row off to distiller
00377                                         CoilTools::Distill(start,end,supermod,current,Detector::kFar);
00378                                 }
00379                         }
00380                         if(magblk->GetMagDetector()==1)
00381                         {
00382                                 int nentries = magblk->GetNumEntries();
00383                                 for ( int indx = 0; indx < nentries; ++indx )
00384                                 {       
00385                                         Float_t volt, curr, voltref;
00386                                         Int_t raw;
00387                                         Short_t remote,interlock,onoff;
00388                                         Short_t ground,overcurr,overtemp,regmode;
00389                                         Short_t extref,polarity;
00390                                         VldContext timer;
00391                                         timer=magblk->GetVldContext();
00392                                         VldTimeStamp start=magblk->GetTimeStamp(indx);
00393                                         time_t vcSec = start.GetSec() + 40*60; // 40 minute
00394                                         VldTimeStamp end(vcSec,0);
00395                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Mag_Near");
00396                                         VldTimeStamp create = VldTimeStamp();
00397                                         DbiWriter<Dcs_Mag_Near> writer(range,aggNo,task,start);
00398                                         curr=magblk->GetNearCurrent(indx);
00399                                         volt=magblk->GetNearVoltage(indx);
00400                                         voltref=magblk->GetNearVoltageReference(indx);
00401                                         raw=magblk->GetNearRawData(indx);
00402                                         remote=magblk->GetNearLocalRemoteState(indx);
00403                                         interlock=magblk->GetNearInterLockState(indx);
00404                                         onoff=magblk->GetNearOnOffState(indx);
00405                                         ground=magblk->GetNearGroundFault(indx);
00406                                         overcurr=magblk->GetNearDCOverCurrent(indx);
00407                                         overtemp=magblk->GetNearOverTemp(indx);
00408                                         regmode=magblk->GetNearCurrentRegMode(indx);
00409                                         extref=magblk->GetNearExternalRef(indx);
00410                                         polarity=magblk->GetNearPolarity(indx);
00411 
00412                                         Dcs_Mag_Near row0(curr,volt, voltref,raw,remote,interlock,onoff,ground,overcurr,overtemp,regmode,extref,polarity);
00413                                         writer << row0;
00414                                         writer.Close();
00415                                 }
00416                         }
00417                         if(magblk->GetMagDetector()==4)
00418                         {
00419                                 Int_t isT7;
00420                                 Float_t curr1,curr2,curr3,curr4,curr5,curr6,curr7,curr8,curr9,curr10,curr11,curr12,curr13,curr14,curr15,curr16;
00421                                 int nentries = magblk->GetNumEntries();
00422                                 for ( int indx = 0; indx < nentries; ++indx )
00423                                 {       
00424                                         VldContext timer;
00425                                         timer=magblk->GetVldContext();
00426                                         VldTimeStamp start=magblk->GetTimeStamp(indx);
00427                                         time_t vcSec = start.GetSec() + 15; // 15 sec validity for caldet
00428                                         VldTimeStamp end(vcSec,0);
00429                                         VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Mag_Cal");
00430                                         VldTimeStamp create = VldTimeStamp();
00431                                         DbiWriter<Dcs_Mag_Cal> writer(range,aggNo,task,start);
00432                                         isT7=magblk->GetCalIsT7(indx);
00433                                         curr1=magblk->GetCalZT7_BHZ01S7(indx);
00434                                         curr2=magblk->GetCalZT7_BHZ01NS7(indx);
00435                                         curr3=magblk->GetCalZT7_BHZ02(indx);
00436                                         curr4=magblk->GetCalZT7_QFO01(indx);
00437                                         curr5=magblk->GetCalZT7_QDE02(indx);
00438                                         curr6=magblk->GetCalZT7_QFO03(indx);
00439                                         curr7=magblk->GetCalZT7_QDE04(indx);
00440                                         curr8=magblk->GetCalZT7_QFO05(indx);
00441                                         curr9=magblk->GetCalZT11_QDE01(indx);
00442                                         curr10=magblk->GetCalZT11_QFO02(indx);
00443                                         curr11=magblk->GetCalZT11_BHZ01(indx);
00444                                         curr12=magblk->GetCalZT11_QFO03(indx);
00445                                         curr13=magblk->GetCalZT11_BHZ02(indx);
00446                                         curr14=magblk->GetCalZT11_QFO04(indx);
00447                                         curr15=magblk->GetCalZT11_QDE05(indx);
00448                                         curr16=magblk->GetCalZT11_QVT01(indx);
00449                                         
00450                                         Dcs_Mag_Cal row0(isT7,curr1,curr2,curr3,curr4,curr5,curr6,curr7,curr8,curr9,curr10,curr11,curr12,curr13,curr14,curr15,curr16);
00451                                         writer << row0;
00452                                         writer.Close();
00453                                 }
00454                         }
00455                         continue;
00456                 }
00457                 RawDcsCanMonitorBlock* canblk = dynamic_cast<RawDcsCanMonitorBlock*>(rdb);
00458                 if(canblk)
00459                 {
00460                         Int_t rackno,racktemp,power;
00461                         Float_t volt1,volt2,volt3,volt4,curr1,curr2,curr3,curr4;
00462                         int nentries = canblk->GetNumEntries();
00463                         for ( int indx = 0; indx < nentries; ++indx ) {
00464 
00465                                 //make entry in database with DbiWriter
00466 
00467                                 VldContext timer;
00468                                 timer=canblk->GetVldContext();
00469 //                              VldTimeStamp start=timer.GetTimeStamp();
00470                                 VldTimeStamp start=canblk->GetTimeStamp(indx);
00471                                 time_t vcSec = start.GetSec() + 60*20; //(20 min validity)
00472                                 VldTimeStamp end(vcSec,0);
00473                                 VldRange range(timer.GetDetector(),timer.GetSimFlag(),start,end,"Dcs_Can");
00474 //                              VldTimeStamp create = VldTimeStamp();
00475                                 rackno=canblk->GetPowerSupplyId(indx);
00476                                 aggNo=rackno;
00477                                 DbiWriter<Dcs_Can> writer(range,aggNo,task,start);
00478 
00479                                 power=canblk->GetPowerState(indx);
00480                                 volt1=canblk->GetVoltage1(indx);
00481                                 volt2=canblk->GetVoltage2(indx);
00482                                 volt3=canblk->GetVoltage3(indx);
00483                                 volt4=canblk->GetVoltage4(indx);
00484                                 curr1=canblk->GetCurrent1(indx);
00485                                 curr2=canblk->GetCurrent2(indx);
00486                                 curr3=canblk->GetCurrent3(indx);
00487                                 curr4=canblk->GetCurrent4(indx);
00488                                 racktemp=canblk->GetTemperatureInt(indx);
00489 
00490                                 Dcs_Can row0(rackno,power,volt1,volt2,volt3,volt4,curr1,curr2,curr3,curr4,racktemp);
00491                                 writer << row0;
00492                                 writer.Close();
00493                         }
00494                         continue;
00495                 }
00496         }
00497         return result;
00498 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1