#include "TString.h" #include "StructDef.h" //200414 200414 200414 200414 200414 // 1615 1759 1806 1842 2249 //210414 210414 210414 210414 210414 210414 210414 210414 210414 210414 210414 210414 // 0153 0342 0627 0712 0900 1050 1103 1557 1801 1941 2211 2338 //220414 220414 220414 220414 220414 220414 220414 220414 // 0024 0251 0445 0531 1425 2032 2200 2332 //230414 230414 230414 230414 230414 230414 230414 230414 230414 230414 230414 230414 230414 230414 // 0101 0155 0315 0442 0619 1010 1450 2036 2037 2136 2204 2331 2335 2336 //240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 240414 // 0002 0018 0041 0146 0244 0334 0342 0356 0414 0435 0454 1331 1855 2212 2223 // 250414 // 0053 const Int_t kiNbFiles = 5 + 12 + 8 + 14 + 15 + 1; const TString ksFilesDay[kiNbFiles] = { "200414", "200414", "200414", "200414", "200414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "210414", "220414", "220414", "220414", "220414", "220414", "220414", "220414", "220414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "230414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "240414", "250414" }; const TString ksFilesHour[kiNbFiles] = { "1615", "1759", "1806", "1842", "2249", "0153", "0342", "0627", "0712", "0900", "1050", "1103", "1557", "1801", "1941", "2211", "2338", "0024", "0251", "0445", "0531", "1425", "2032", "2200", "2332", "0101", "0155", "0315", "0442", "0619", "1010", "1450", "2036", "2037", "2136", "2204", "2331", "2335", "2336", "0002", "0018", "0041", "0146", "0244", "0334", "0342", "0356", "0414", "0435", "0454", "1331", "1855", "2212", "2223", "0053" }; Bool_t currentPlot( Int_t iDetectorIndex = -1, Int_t iDate = 0, Int_t iTime = -1, Int_t iSecOffset = 0 ) { Int_t iIndexVoltage = 0; Int_t iIndexCurrent = 1; Int_t iIndexPower = 2; Int_t iIndexStatus = 3; Int_t iNbFields = 4; Int_t iNbChannels = 4; const Int_t kiNbRpc = 11; TString sChNameRpc[kiNbRpc] = { "HD_Big", "HD_Sm", "HD_Ref", "USTC", "TS_PAD", "TS_Strip", "BUC_Ref", "BUC_2010", "BUC_2012", "BUC_2013", "TRD_BUC"}; Int_t iSlotRpcNeg[kiNbRpc] = { 0 , 0 , 0 , 0 , 0 , 0 , 1 , 1 , 1 , 1 , 1 }; Int_t iBdIdxRpcNeg[kiNbRpc] = { 0 , 0 , 0 , 0 , 0 , 0 , 4 , 4 , 4 , 4 , 4 }; Int_t iChIdxRpcNeg[kiNbRpc] = { 0 , 1 , 2 , 3 , 4 , 5 , 0 , 1 , 2 , 3 , 4 }; Int_t iSlotRpcPos[kiNbRpc] = { 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 3 }; Int_t iBdIdxRpcPos[kiNbRpc] = { 2 , 2 , 2 , 2 , 2 , 2 , 6 , 6 , 6 , 6 , 6 }; Int_t iChIdxRpcPos[kiNbRpc] = { 0 , 1 , 2 , 3 , 4 , 5 , 0 , 1 , 2 , 3 , 4 }; const Int_t kiNbPmt = 10; TString sChNamePmt[kiNbPmt] = { "BUC_PMT1", "BUC_PMT2", "BUC_PMT3", "BUC_PMT4", "PMT1", "PMT2", "PMT3", "PMT4", "BUC_PMT5", "BUC_PMT6"}; Int_t iSlotPmtNeg[kiNbPmt] = { 4 , 4 , 4 , 4 , 5 , 5 , 5 , 5 , 5 , 5 }; Int_t iBdIdxPmtNeg[kiNbPmt] = { 13 , 13 , 13 , 13 , 14 , 14 , 14 , 14 , 14 , 14 }; Int_t iChIdxPmtNeg[kiNbPmt] = { 0 , 1 , 4 , 5 , 0 , 1 , 2 , 3 , 4 , 5 }; Rpc_HV stRpcValArray[kiNbRpc]; Pmt_HV stPmtValArray[kiNbPmt]; // Looking for RPC currents const Int_t kiNbBoardsUsed = 6; Int_t kiSlotIndex[kiNbBoardsUsed] = { 0, 4, 2, 6, 13, 14}; Int_t kiSlotSzOff[kiNbBoardsUsed] = { 0, 0, 0, 0, 2, 2}; TString sFileName[kiNbBoardsUsed]; fstream * fInputFile[kiNbBoardsUsed]; std::streampos fSizeFile[kiNbBoardsUsed]; if( iDetectorIndex < 0 || 0 == iDate || -1 == iTime ) { cout<<"Please provide a detector index, a data and a time as input!!!!"<fail() ) { cout<<"************************************************************************"<seekg( 0, std::ios::end ); fSizeFile[iBoardIndex] = fInputFile[iBoardIndex]->tellg(); fInputFile[iBoardIndex]->seekg( 0, std::ios::beg ); } // for( Int_t iBoardIndex = 0; iBoardIndex < kiNbBoardsUsed; iBoardIndex++) Bool_t bAllSameSize = kTRUE; for( Int_t iBoardIndex = 1; iBoardIndex < kiNbBoardsUsed; iBoardIndex++) if( (fSizeFile[0] + kiSlotSzOff[iBoardIndex]) != fSizeFile[iBoardIndex] ) { cout<<" Warning!!!! the file for board "<eof() ) { Bool_t bEndReachedInOne = kFALSE; for( Int_t iBoardIndex = 0; iBoardIndex < kiNbBoardsUsed; iBoardIndex++) { // Read a line of the HV file and set the iterator automatically to the next line sLine[iBoardIndex].ReadLine( *(fInputFile[iBoardIndex]) , kFALSE); if( 0 == sLine[iBoardIndex].Length() ) { bEndReachedInOne = kTRUE; break; } // if( 0 == sLine[iBoardIndex].Length() ) // Extract the fields as sub-strings pValuesArray[iBoardIndex] = sLine[iBoardIndex].Tokenize( ";" ); } // If at least one file is over, stop! if( kTRUE == bEndReachedInOne ) break; // Extract RPC data as numbers for( Int_t iRpcIndex = 0; iRpcIndex < kiNbRpc; iRpcIndex++) { TObjString* subString; // Take readout time from negative voltage board subString = (TObjString*)pValuesArray[ iSlotRpcNeg[iRpcIndex] ]->At(0); TString sHour = subString->GetString(); TString sMin = sHour(3,2); TString sSec = sHour(6,2); TString sMilSec = sHour(9,2); sHour = sHour(0,2); if (-1 == iFirstHour) iFirstHour = sHour.Atoi(); else if ( sHour.Atoi() < iFirstHour) { iNewDay ++; iFirstHour = sHour.Atoi(); } // else if ( sHour.Atoi() < iFirstHour) tTempTime.Set( sYearString.Atoi(), // Year sMonthString.Atoi(), // Month sDayString.Atoi() +iNewDay, // Day sHour.Atoi(), // Hour sMin.Atoi(), // Minutes sSec.Atoi(), // Seconds sMilSec.Atoi() * 10000000, // Nanoseconds kFALSE, // Not in UTC iSecOffset ); stRpcValArray[iRpcIndex].iTimeSec = tTempTime.GetSec(); //Extract seconds stRpcValArray[iRpcIndex].iTimeMilliSec = tTempTime.GetNanoSec()/1000000; //Extract milliseconds // cout<Divide(2,2,0,0); tCanvas->cd(1); gPad->SetTopMargin(0.15); gPad->SetRightMargin(0.15); gPad->SetBottomMargin(0.15); gPad->SetLeftMargin(0.15); hCurrentEvoTot->Draw(); hCurrentEvoPos->SetLineColor(kGreen); hCurrentEvoPos->Draw("SAME"); hCurrentEvoNeg->SetLineColor(kRed); hCurrentEvoNeg->Draw("SAME"); tCanvas->cd(2); gPad->SetTopMargin(0.15); gPad->SetRightMargin(0.15); gPad->SetBottomMargin(0.15); gPad->SetLeftMargin(0.15); hCurrentComp->Draw("colz"); tCanvas->cd(3); gPad->SetTopMargin(0.15); gPad->SetRightMargin(0.15); gPad->SetBottomMargin(0.15); gPad->SetLeftMargin(0.15); hVoltageEvoPos->SetLineColor(kRed); hVoltageEvoPos->Draw(); hVoltageEvoNeg->SetLineColor(kBlack); hVoltageEvoNeg->Draw("SAME"); tCanvas->cd(4); gPad->SetTopMargin(0.15); gPad->SetRightMargin(0.15); gPad->SetBottomMargin(0.15); gPad->SetLeftMargin(0.15); hTimeBinCor->Draw(); // Print RPC data from last line for( Int_t iRpcIndex = 0; iRpcIndex < kiNbRpc; iRpcIndex++) stRpcValArray[iRpcIndex].Print(); // Print PMT data from last line for( Int_t iPmtIndex = 0; iPmtIndex < kiNbPmt; iPmtIndex++) stPmtValArray[iPmtIndex].Print(); // Close the fstream objects (this also delete them) for( Int_t iBoardIndex = 0; iBoardIndex < kiNbBoardsUsed; iBoardIndex++) fInputFile[iBoardIndex]->close(); return kTRUE; }