/// Class to build average gas properties inside TPC /// over a particular time period (or run). Also /// has facilities to make plots of TPC gas properties /// over a time period. /// Blair Jamieson (C) 2009, 2010 #include "ITPCGasAvg.hxx" /// Initialize TPC gas properties averaging object using unix times ITPCGasAvg::ITPCGasAvg( int maxsamples, long autmin, long autmax){ fTimeMin = autmin; fTimeMax = autmax; fMaxSamples = maxsamples; Init(); } /// Initialize TPC gas properties averaging object using year, /// month(0-11), day (1-31), ... ITPCGasAvg:: ITPCGasAvg(int maxsamples, int ayearmin, int amonthmin, int adaymin, int ahourmin, int aminmin, int asecmin, int ayearmax, int amonthmax, int adaymax, int ahourmax, int aminmax, int asecmax ){ fMaxSamples = maxsamples; tm mt; // use time structure from time.h // to build unix time from year,month, etc. mt.tm_year = ayearmin - 1900; mt.tm_mon = amonthmin-1; mt.tm_mday = adaymin; mt.tm_hour = ahourmin; mt.tm_min = aminmin; mt.tm_sec = asecmin; fTimeMin = (long)mktime(&mt); mt.tm_year = ayearmax - 1900; mt.tm_mon = amonthmax-1; mt.tm_mday = adaymax; mt.tm_hour = ahourmax; mt.tm_min = aminmax; mt.tm_sec = asecmax; fTimeMax = (long)mktime(&mt); Init(); } /// Initialize gas properties / pressure averaging object void ITPCGasAvg::Init(){ // first calculate delta-time for maximum number of samples: long adt; if ( fMaxSamples >0 ){ adt = (fTimeMax-fTimeMin)/fMaxSamples; if (adt<30) adt = 30; // readings are only every so often anyway so set minimum to every 30 seconds } else { // use a default of every 30 sec? adt = 30; } std::cout<<" Look for gas properties readings from time " < MaxSamples = "<Write(); fCF4Flow.fGraph->Write(); fIbuFlow.fGraph->Write(); fArFrac .fGraph->Write(); fCF4Frac.fGraph->Write(); fIbuFrac.fGraph->Write(); fPatm .fGraph->Write(); fPD1 .fGraph->Write(); fPD2 .fGraph->Write(); fP .fGraph->Write(); fPD4 .fGraph->Write(); fH2O .fGraph->Write(); fO2 .fGraph->Write(); fIbuMon.fGraph->Write(); fCO2An .fGraph->Write(); fCF4An .fGraph->Write(); fTO2 .fGraph->Write(); fTTPC1 .fGraph->Write(); fTTPC2 .fGraph->Write(); fTTPC3 .fGraph->Write(); fDensity1 .fGraph->Write(); fDensity2 .fGraph->Write(); fDensity3 .fGraph->Write(); fD0TC1 .fGraph->Write(); fD0TC2 .fGraph->Write(); fD0TC3 .fGraph->Write(); fD0TC4 .fGraph->Write(); fD0TC5 .fGraph->Write(); fP0TC1 .fGraph->Write(); fP0TC2 .fGraph->Write(); fP0TC3 .fGraph->Write(); fP0TC4 .fGraph->Write(); fP0TC5 .fGraph->Write(); fP0TC6 .fGraph->Write(); fDXTC1 .fGraph->Write(); fDXTC2 .fGraph->Write(); fDXTC3 .fGraph->Write(); fVdIn .fGraph->Write(); fVdInUnc .fGraph->Write(); fVdOut .fGraph->Write(); fVdOutUnc .fGraph->Write(); fGainIn .fGraph->Write(); fGainInUnc .fGraph->Write(); fGainOut .fGraph->Write(); fGainOutUnc.fGraph->Write(); fout.Close(); return; }