#include "runtimeCommon.h" void plotIV(Bool_t hasPowerboard=false,Bool_t sensorOutput=true, const char* batch=NULL, int wafer=0, const char* component=NULL,const char* moduleSN=NULL,const char* moduleStage=NULL, const char* runnumber=NULL,Float_t temp=0.0,Float_t humidity=0.0,const char* comments=NULL){ if(nHVSupplies>0){ for(Int_t i=0; iGetIVGraph(); TCanvas* cIV = new TCanvas(); ivGraph->Draw(); ivGraph->GetHistogram()->SetXTitle("Bias Voltage(V)"); ivGraph->GetHistogram()->SetYTitle("Current (uA)"); // build filenames std::string fname1; std::string fname2; std::string fname3; std::string fname4; // make sure wafer numbers are 5 digits with leading zeros std::string WaferS = std::to_string(wafer); while (WaferS.length()<5) { WaferS.insert(0,"0");} //use run number entered unless the string is empty std::string TheRunNumber; if (strcmp(runnumber,"")==0){TheRunNumber=std::to_string(e->runnum);} else {TheRunNumber=runnumber;} //add leading zeros onto the run number used in the title std::string TitleRunNum = TheRunNumber; while (TitleRunNum.length()<3) { TitleRunNum.insert(0,"0");} if (sensorOutput) { fname1=Form("%s/ps/%s_W%s_IV_%s.pdf", e->sct_var,batch,WaferS.c_str(), TitleRunNum.c_str()); fname2=Form("%s/data/%s_W%s_IV_%s.root", e->sct_var,batch,WaferS.c_str(), TitleRunNum.c_str()); fname3=Form("%s/results/%s_W%s_IV_%s.dat", e->sct_var,batch,WaferS.c_str(), TitleRunNum.c_str()); fname4=Form("%s_W%s_IV_%s.dat",batch,WaferS.c_str(), TitleRunNum.c_str()); } else{ fname1=Form("%s/ps/%s_%s_IV_%s.pdf", e->sct_var,moduleSN,moduleStage, TitleRunNum.c_str()); fname2=Form("%s/data/%s_%s_IV_%s.root", e->sct_var,moduleSN,moduleStage, TitleRunNum.c_str()); fname3=Form("%s/results/%s_%s_IV_%s.dat", e->sct_var,moduleSN,moduleStage, TitleRunNum.c_str()); fname4=Form("%s_%s_IV_%s.dat",moduleSN,moduleStage, TitleRunNum.c_str()); } std::cout << "Saving pdf to file " << fname1 << std::endl; cIV->Print(fname1.c_str(),"pdf"); std::cout << "Saving root to file " << fname2 << std::endl; cIV->SaveAs(fname2.c_str()); //get date and time for output file string datetime = NowTimeString(); string date = datetime.substr(0,datetime.find("T")); //isolate date string current_time = datetime.erase(0, datetime.find("T") + 1); //isolate time current_time.erase(current_time.find(".")); string year = date.substr(0,date.find("-")); string month = date.substr(5,2); string day = date.substr(8); if (month=="1") { month = "Jan";} if (month=="2") { month = "Feb";} if (month=="3") { month = "Mar";} if (month=="4") { month = "Apr";} if (month=="5") { month = "May";} if (month=="6") { month = "Jun";} if (month=="7") { month = "Jul";} if (month=="8") { month = "Aug";} if (month=="9") { month = "Sep";} if (month=="10") { month = "Oct";} if (month=="11") { month = "Nov";} if (month=="12") { month = "Dec";} //get values from IVScanConfig file std::string configpath = std::string(getConfigDirectory()) + "IVScanConfig.txt"; std::ifstream config(configpath); if (config.fail()) { std::cout<<"IVScanConfig.txt not found. Please copy the file to your config folder and edit with relevant values."<GetN(); j++){ Int_t ok = ivGraph->GetPoint(j,x,y); Double_t newy = y * 1000; //convert current from uA to nA fprintf(outfile, "%010.2lf\t%010.2lf\t%s\n",x,newy,"000000.00"); //record a shunt voltage of 000000.00 to comply with DB format } fclose(outfile); } } } }