From b19ddd9b88225eede585263fab712ac0f11c3a26 Mon Sep 17 00:00:00 2001 From: Ric Rodriguez Date: Sat, 14 Apr 2018 20:27:31 -0700 Subject: [PATCH] 4.6 from nicolo --- Carriers.cxx | 0 Carriers.h | 2 +- Dict.cxx | 4 +- Getymax | 0 Makefile | 6 +- Potentials.cxx | 10 +- README.md | 15 --- WFGUI.cxx | 347 +++++++++++++++++++++++++++++++++++-------------- WFGUI.h | 18 ++- WFGUI_good.cxx | 0 grep | 0 11 files changed, 271 insertions(+), 131 deletions(-) mode change 100644 => 100755 Carriers.cxx mode change 100644 => 100755 Carriers.h mode change 100644 => 100755 Dict.cxx mode change 100644 => 100755 Getymax delete mode 100644 README.md mode change 100644 => 100755 WFGUI.h mode change 100644 => 100755 WFGUI_good.cxx mode change 100644 => 100755 grep diff --git a/Carriers.cxx b/Carriers.cxx old mode 100644 new mode 100755 diff --git a/Carriers.h b/Carriers.h old mode 100644 new mode 100755 index a50f734..8b028b8 --- a/Carriers.h +++ b/Carriers.h @@ -32,7 +32,7 @@ //#define CNMGAINLENGHT 2 #define CNMDexp 1 //1 // needs to be 0!!! otherwise simulation does not work well // FBK -#define FBKGAINDEPTH 0.6 +#define FBKGAINDEPTH 0.62 #define FBKGAINLENGTH 1.2 // //#define FBKGAINDEPTH 1.0 diff --git a/Dict.cxx b/Dict.cxx old mode 100644 new mode 100755 index 80e94d8..a398dca --- a/Dict.cxx +++ b/Dict.cxx @@ -403,8 +403,8 @@ namespace { 0 }; static const char* includePaths[] = { -"/usr/local/Cellar/root/6.12.04_1/include/root", -"/Users/Home/weightfield2/", +"/root61206/include", +"/Users/nicolo/work/GruppoV_UFSD/Weightfield_evolution/weightfield4.6/", 0 }; static const char* fwdDeclCode = R"DICTFWDDCLS( diff --git a/Getymax b/Getymax old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile index 960fbea..e13ccdd 100755 --- a/Makefile +++ b/Makefile @@ -3,11 +3,11 @@ ################################# weightfield: WFGUI.h WFGUI.cxx Potentials.h Potentials.cxx Field.h Field.cxx Carriers.h Carriers.cxx - rootcling -f Dict.cxx -c WFGUI.h LinkDef.h + rootcint -f Dict.cxx -c WFGUI.h LinkDef.h g++ -O3 -Wall -Wextra -o weightfield Weightfield.cxx WFGUI.cxx Potentials.cxx Field.cxx Carriers.cxx `root-config --cflags --glibs` Dict.cxx all: WFGUI.h WFGUI.cxx Potentials.h Potentials.cxx Field.h Field.cxx Carriers.h Carriers.cxx - rootcling -f Dict.cxx -c WFGUI.h LinkDef.h + rootcint -f Dict.cxx -c WFGUI.h LinkDef.h g++ -O3 -Wall -Wextra -o weightfield Weightfield.cxx WFGUI.cxx Potentials.cxx Field.cxx Carriers.cxx `root-config --cflags --glibs` Dict.cxx debug: WFGUI.h WFGUI.cxx Potentials.h Potentials.cxx Field.h Field.cxx Carriers.h Carriers.cxx - rootcling -f Dict.cxx -c WFGUI.h LinkDef.h + rootcint -f Dict.cxx -c WFGUI.h LinkDef.h g++ -g -O0 -Wall -Wextra -o weightfield Weightfield.cxx WFGUI.cxx Potentials.cxx Field.cxx Carriers.cxx `root-config --cflags --glibs` Dict.cxx diff --git a/Potentials.cxx b/Potentials.cxx index 01a36d7..79bbc86 100755 --- a/Potentials.cxx +++ b/Potentials.cxx @@ -158,8 +158,8 @@ void Potentials::SetDoping(unsigned char s, unsigned char b) { ////////////////////////////////////////////////////////////////////// void Potentials::SetPitchWidthXY(int dimy, int nstrip,double p, double w, double Stepx, double Stepy ) { - - // cout << " SetPitch = " << dimy << " " << nstrip << " " << p << " " << w << " Stepx " << Stepx << " stepy " << Stepy << endl; + // Stepy = 0.1; + // cout << " In Potential SetPitch = " << dimy << " " << nstrip << " " << p << " " << w << " Stepx " << Stepx << " stepy " << Stepy << endl; ref=0; pitch=p; // here it's in micron width=w; // here it's in micron @@ -212,6 +212,8 @@ void Potentials::SetPitchWidthXY(int dimy, int nstrip,double p, double w, double BinSizey = 1.*dimy/(1.*YMAX); + // BinSizey = Stepy; + BinSizex = 1.*count*pitch/(1.*XMAX); //here we change from micron to bins @@ -224,7 +226,7 @@ void Potentials::SetPitchWidthXY(int dimy, int nstrip,double p, double w, double pitch=(int) (pitch/BinSizex); // here it's in # bin width= (int) (width/BinSizex); // here it's in # bin - // cout << "Bin size x = " << GetBinSizex() << " micron " << endl; + cout << "Bin size y = " << GetBinSizey() << " micron " << endl; // cout << "Bin size y = " << GetBinSizey() << " micron " << endl; // cout << "Number of bin: X = " << XMAX<< ", Y = " << YMAX << endl; @@ -256,7 +258,7 @@ void Potentials::SetPitchWidthXY(int dimy, int nstrip,double p, double w, double } } - + // cout << " In Potential end SetPitch = " << dimy << " " << nstrip << " " << p << " " << w << " Stepx " << Stepx << " stepy " << Stepy << endl; } ////////////////////////////////////////////////////////////////////// diff --git a/README.md b/README.md deleted file mode 100644 index a0766d7..0000000 --- a/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Weightfield2 - -Source code mirror for Weightfield2 - -## Installation - -Ensure that [root](https://root.cern.ch/) is installed, then type -```shell -make -j8 -./weightfield -``` -To load in saved params, -```shell -./weightfield params.dat -``` diff --git a/WFGUI.cxx b/WFGUI.cxx index 7394a06..2fc2f9c 100644 --- a/WFGUI.cxx +++ b/WFGUI.cxx @@ -71,12 +71,18 @@ std::map GetParameters(const char* ifname) //--Currents-- valueMap["TEMPERATURE"] = 300.; - cout<< "Processing parameters from file " << ifname < GetParameters(const char* ifname) WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFrame(p,w,h), dwpot(Potentials(300,1,200,30)) { //take intial varible names from parameters file - const char* ifname = "parameters.dat"; + // const char* ifname = "parameters.dat"; + string fname1 = "parameters.dat"; + string ifname; string userFile; - if(app->Argc() < 2){ - ifname = "parameters.dat"; - }else{ - ifname = app->Argv(1); - } - std::map valueMap = GetParameters(ifname); - this->UserValues = valueMap; + if(app->Argc() < 2) + { + fname1 = "parameters.dat"; + } + else + { + fname1 = app->Argv(1); + } + string fname = "./sensors/data/"; - // mainframes initial settings - radiobuttonstatus=MIPunif;//radio button mip set as default - BatchOn=false; - fileName = ""; - Connect("CloseWindow()", "WFGUI", this, "CloseWindow()");// connect exit-button of window to CloseWindow() + ifname = fname+fname1; + std::map valueMap = GetParameters(ifname.c_str()); + this->UserValues = valueMap; - SetLayoutManager(new TGHorizontalLayout(this)); - - ///**************************************************** GRAPHS ********************************************************/// + // mainframes initial settings + radiobuttonstatus=MIPunif;//radio button mip set as default + BatchOn=false; + fileName = ""; + Connect("CloseWindow()", "WFGUI", this, "CloseWindow()");// connect exit-button of window to CloseWindow() + + SetLayoutManager(new TGHorizontalLayout(this)); + + ///**************************************************** GRAPHS ********************************************************/// PotentialTab = new TGTab(this,600,220);//General Tab @@ -525,13 +539,14 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///START OF SETTINGS FRAME//////////////////////////////////////////////////////////////////////////////////////////////// - SettingsGlobalFrame = new TGVerticalFrame(this,500,90); - SettingsFrame2 = new TGHorizontalFrame(SettingsGlobalFrame, 500, 90); + SettingsGlobalFrame = new TGVerticalFrame(this,400,90); + SettingsFrame2 = new TGHorizontalFrame(SettingsGlobalFrame, 400, 90); /////////////////////////////////////////////////////////////////////////////////////////////// //////START OF CONTROL FRAME/////////////////////////////////////////////////////////////////// - ControlFrame = new TGGroupFrame(SettingsFrame2," Control",kVerticalFrame); + // ControlFrame = new TGGroupFrame(SettingsFrame2,"Control",kVerticalFrame); + ControlFrame = new TGVerticalFrame(SettingsFrame2); //////////////////////////////////////////// /////////RUN FRAME///////////// @@ -550,24 +565,6 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr StopButton = new TGTextButton(ButtonPotFrame," Stop "); ExitButton = new TGTextButton(ButtonPotFrame," Exit "); - /////////////////////////////////////////////////////////// - // Saving interface - - SaveFrame = new TGGroupFrame(ControlFrame,"Configuration file",kHorizontalFrame); - SaveButton = new TGTextButton(SaveFrame, " Save "); - SaveFileName = new TGTextEntry(SaveFrame, new TGTextBuffer(5), kSunkenFrame | kDoubleBorder | kOwnBackground); - SaveFileName->SetText("sampleout.dat"); - SaveFileName->SetMaxLength(4096); - SaveFileName->SetAlignment(kTextLeft); - SaveFileName->MoveResize(56, 80, 150, 22); - SaveFileName->SetState(kTRUE); - SaveButton->Associate(this); - SaveButton->SetTextColor(1, kFALSE); - SaveButton->Connect("Clicked()", "WFGUI", this, "SaveData()"); - SaveButton->SetEnabled(kTRUE); - - SaveFrame->AddFrame(SaveButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); - SaveFrame->AddFrame(SaveFileName, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); //develop entries SetButton->Associate(this); @@ -616,8 +613,8 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr SamplingLabel = new TGLabel(SamplingFrame,"Time Step [ps]:"); StepLabel = new TGLabel(SamplingFrame,"Step x,y [micron]: "); SamplingEntry = new TGNumberEntry(SamplingFrame, valueMap["SAMPLING"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.1,100); - StepxEntry = new TGNumberEntry(SamplingFrame, valueMap["STEPX"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.1,2); - StepyEntry = new TGNumberEntry(SamplingFrame, valueMap["STEPY"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.1,2); + StepxEntry = new TGNumberEntry(SamplingFrame, valueMap["STEPX"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.01,2); + StepyEntry = new TGNumberEntry(SamplingFrame, valueMap["STEPY"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.01,2); //develop entries SamplingEntry->SetState(kTRUE); @@ -702,7 +699,6 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr NameFrame->AddFrame(FileNameEntry, new TGLayoutHints(kLHintsRight| kLHintsTop | kLHintsExpandX,1,1,1,1)); //add frames - ControlFrame->AddFrame(SaveFrame, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX ,1,1,1,1)); ControlFrame->AddFrame(NameFrame, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX ,1,1,1,1)); //////////////////////////////////////////// @@ -932,10 +928,10 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr // IrradiationLabel = new TGLabel(IrradiationLabelFrame,new TGString(":")); - DopingGLButton[0] = new TGRadioButton( DopingGLButtonGroup, new TGHotString("B")); - DopingGLButton[1] = new TGRadioButton( DopingGLButtonGroup, new TGHotString("B+C")); - DopingGLButton[0]->SetState(kButtonDown); - DopingGLButton[0]->SetOn(kTRUE); + // DopingGLButton[0] = new TGRadioButton( DopingGLButtonGroup, new TGHotString("B")); + // DopingGLButton[1] = new TGRadioButton( DopingGLButtonGroup, new TGHotString("B+C")); + //DopingGLButton[0]->SetState(kButtonDown); + // DopingGLButton[0]->SetOn(kTRUE); // DopingGLButton[0]->Connect("Toggled(Bool_t)", "WFGUI", this, "CallSetDopingGL()"); // DopingGLButton[1]->Connect("Toggled(Bool_t)", "WFGUI", this, "CallSetDopingGL()"); // CallSetDopingGL(); @@ -1112,8 +1108,58 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr /////////////////////////////////////////////////////////////////////////////////////////////// - //////START OF DETECTOR PROPERTIES FRAME ////////////////////////////////////////////////////// + //////START OF Right frame ////////////////////////////////////////////////////// RightFrame = new TGVerticalFrame(SettingsFrame2); + + /////////////////////////////////////////////////////////// + // Saving interface + + SaveFrame = new TGGroupFrame(RightFrame,"Filesin sensors/data && sensors/graph",kHorizontalFrame); + SaveButton = new TGTextButton(SaveFrame, "Save"); + LoadButton = new TGTextButton(SaveFrame, "Load"); + + SaveFileName = new TGTextEntry(SaveFrame, new TGTextBuffer(5), kSunkenFrame | kDoubleBorder | kOwnBackground); + // SaveFileName->SetText("sampleout.dat"); + SaveFileName->SetText(fname1.c_str()); + SaveFileName->SetMaxLength(2000); + SaveFileName->SetAlignment(kTextLeft); + SaveFileName->MoveResize(56, 80, 100, 22); + SaveFileName->SetState(kTRUE); + SaveButton->Associate(this); + SaveButton->SetTextColor(1, kFALSE); + SaveButton->Connect("Clicked()", "WFGUI", this, "SaveData()"); + SaveButton->SetEnabled(kTRUE); + SaveButton->SetBackgroundColor(0x00ff00); + + + LoadButton->Associate(this); + LoadButton->SetTextColor(1, kFALSE); + LoadButton->Connect("Clicked()", "WFGUI", this, "LoadData()"); + // LoadButton->Connect("Clicked()", "WFGUI", this, "GetParameters()"); + LoadButton->SetEnabled(kTRUE); + + SaveFrame->AddFrame(SaveButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); + SaveFrame->AddFrame(LoadButton, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); + SaveFrame->AddFrame(SaveFileName, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); + + SaveButton1 = new TGTextButton(SaveFrame, "Save"); + SaveFileName1 = new TGTextEntry(SaveFrame, new TGTextBuffer(5), kSunkenFrame | kDoubleBorder | kOwnBackground); + // SaveFileName->SetText("sampleout.dat"); + SaveFileName1->SetText("graph"); + SaveFileName1->SetMaxLength(2000); + SaveFileName1->SetAlignment(kTextLeft); + SaveFileName1->MoveResize(56, 80, 100, 22); + SaveFileName1->SetState(kTRUE); + SaveButton1->Associate(this); + SaveButton1->SetTextColor(1, kFALSE); + SaveButton1->Connect("Clicked()", "WFGUI", this, "SaveGraph()"); + SaveButton1->SetEnabled(kTRUE); + + SaveFrame->AddFrame(SaveButton1, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); + SaveFrame->AddFrame(SaveFileName1, new TGLayoutHints(kLHintsLeft | kLHintsTop,1,1,1,1)); + + + DetectorPropertiesFrame = new TGGroupFrame(RightFrame,"Detector Properties",kVerticalFrame); //////////////////////////////////////////// @@ -1252,7 +1298,7 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr GainShape = new TGComboBox(GainShapeFrame); GainShape->AddEntry(new TGString(" - "), 0); GainShape->AddEntry(new TGString("Shallow doping: linear from the electrode"), 1); - GainShape->AddEntry(new TGString("Deep doping: a square starting 0.6 micron deep)"), 2); + GainShape->AddEntry(new TGString("Deep doping: a square @ 0.6 micron"), 2); GainShape->AddEntry(new TGString("Epi: 3 micron deep"), 3); Dopingentry = new TGNumberEntry(GainSetFrame, valueMap["DOP_LEV"],4,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.,500.); @@ -1341,7 +1387,7 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr VoltageFrame->AddFrame(VolSetFrame,new TGLayoutHints(kLHintsRight,0,0,0,0)); DetectorPropertiesFrame->AddFrame(VoltageFrame ,new TGLayoutHints(kLHintsCenterY| kLHintsExpandX ,1,1,1,1)); //////////////////////////////////////////// - + RightFrame->AddFrame(SaveFrame, new TGLayoutHints(kLHintsCenterY | kLHintsExpandX ,1,1,1,1)); RightFrame->AddFrame(DetectorPropertiesFrame, new TGLayoutHints(kLHintsLeft | kLHintsTop | kLHintsExpandX, 1,1,1,1)); //////END OF DETECTOR PROPERTIES FRAME///////////////////////////////////////////////////////// @@ -1409,7 +1455,7 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr OscBWEntry = new TGNumberEntry(OscilloscopeRightFrame, valueMap["OSCOPE_BW"],3,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative); ImpLabel = new TGLabel(OscilloscopeLeftFrame,new TGString("CSA:Imp[Ohm],Tr.Imp[mV/fC]:")); // ImpEntry = new TGNumberEntry(OscilloscopeRightFrame, valueMap["IMPEDANCE"],3,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative); - TRiseLabel = new TGLabel(OscilloscopeLeftFrame, new TGString("CSA (Cdet = 0 fC) :T_r,T_f (10-90%) [ns]:")); + TRiseLabel = new TGLabel(OscilloscopeLeftFrame, new TGString("CSA(Cdet=0)T_r,f(10-90%)[ns]:")); TFallEntry = new TGNumberEntry(TRiseSetFrame, valueMap["SHPR_DCY_TIME"],3,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.1,40.); TRiseEntry = new TGNumberEntry(TRiseSetFrame, valueMap["SHPR_INT_TIME"],3,-1,TGNumberFormat::kNESReal,TGNumberFormat::kNEANonNegative,TGNumberFormat::kNELLimitMinMax,0.1,60.); // ShTransLabel = new TGLabel(OscilloscopeLeftFrame,new TGString("CSA Trans Imp.[mV/fQ]:")); @@ -1651,12 +1697,27 @@ WFGUI::WFGUI(const TGWindow *p, UInt_t w, UInt_t h, TApplication *app): TGMainFr Galpha = 330000; Gbeta = 1200000; BField = 0; - SetGainKind(2); - SetGainDoping(0); - SetGainShape(0); + + SetGainDoping(valueMap["DOPING_GL"]); //call callsetdopingGL + SetGainShape(valueMap["SHAPE_GL"]); //call setgaindoping and setgainkind + SetGainKind(valueMap["KIND_GL"]); //call noone + + GainKind->Select(valueMap["KIND_GL"]); + GainDoping->Select(valueMap["DOPING_GL"]); + GainShape->Select(valueMap["SHAPE_GL"]); + Dopingentry->SetNumber(valueMap["DOP_LEV"]); + Biasentry->SetNumber(valueMap["BIAS_VOLTAGE"]); + Depletionentry->SetNumber(valueMap["DEPL_VOLTAGE"]); + YMAXentry->SetNumber(valueMap["DETECT_HEIGHT"]); + XMAXentry->SetNumber(valueMap["STRIP_NUMB"]); + Pitchentry->SetNumber(valueMap["STR_PITCH"]); + Widthentry->SetNumber(valueMap["STR_WIDTH"]); + TempEntry->SetNumber(valueMap["TEMPERATURE"]); + + //changes to window MapSubwindows(); - SetWindowName("Weightfield2 Build 4.5"); + SetWindowName("Weightfield2 Build 4.6"); Resize(GetDefaultSize()); MapWindow(); CallSetPart(1); @@ -2341,13 +2402,15 @@ void WFGUI::DrawFieldsAbs(int LCol = 1) { double Maxwabs = 0; double LocalGain = 0; double LocalGain_h = 0; + double WGain = 0; int wherecutbin = wherecut/dwpot.GetBinSizex(); // cout << "Wherecut = " << wherecut << " wherecutbin = " << wherecutbin << endl; Npos = 0; - for(int k=0;k< NBins;k++) + // cout << "Binsize y = " << dwpot.GetBinSizey() << " NBins: " << NBins << "Nbins2: " << GetYMax()/dwpot.GetBinSizey() << endl; + for(int k=0;k< NBins-1;k++) { - + Npos = k; // breakdown field // if (k==0) bdfield[k]= 1e-3*4e5/(1.-1./3.*log10( (fabs(dwpot.Getdopyx(1,wherecutbin))*(EPSILON*EPSILONR)/ECHARGE*1e-6)/1e16));//breakdown voltage kV/cm // else bdfield[k] = 1e-3*4e5/(1.-1./3.*log10( (fabs(dwpot.Getdopyx(Npos,wherecutbin))*(EPSILON*EPSILONR)/ECHARGE*1e-6)/1e16));//breakdown voltage kV/cm @@ -2364,17 +2427,29 @@ void WFGUI::DrawFieldsAbs(int LCol = 1) { LocalGain = 1.; LocalGain_h = 1.; - + /* if(k>0 && q1[k] < GetYMax() - ELECTRODE_DEPTH -0.2 ) // the value 0.2 is due to the fact that the last part of gain is normally jumped away { - for (int ll = 0; ll 100) { @@ -2397,7 +2472,7 @@ void WFGUI::DrawFieldsAbs(int LCol = 1) { { gain[k] = (LocalGain)*gain[k-1]; gain_h[k] = (LocalGain_h)*gain_h[k-1]; - // cout << "Npos = " << Npos << " pos = " <1.01 && Getygainlow() == 0) { @@ -2420,7 +2495,7 @@ void WFGUI::DrawFieldsAbs(int LCol = 1) { if (Maxgain < gain[k]) Maxgain = gain[k]; if (dabs[k]GetNumber()); SetGainon(false); SetYGain(Gainentry->GetNumber()); - if (Dopingentry->GetNumber() > 0.1) - { + // if (Dopingentry->GetNumber() > 0.1) + // { - SetStepy(0.1); + SetStepy(0.1); // cout << "Sensor with gain layer, y-step set to 0.1 micron" << endl; - StepyEntry->SetNumber(0.1); - } + // StepyEntry->SetNumber(0.1); + // } /*SetGainon(true); SetYGain(1.); if (Gainentry->GetNumber() > 1. && CallGetDetType() ==0 ) @@ -2967,11 +3042,11 @@ int WFGUI::CallBoundaryConditions() { TempEntry->GetNumber(); SetSWidth(Widthentry->GetNumber()); if(PotentialThread==0) - { + { + // cout << " In WFGUI Boundary stepy " << GetStepy() << endl; // cout << " CallA" << endl; dwpot.SetPitchWidthXY(GetYMax(),GetNStrips(),Pitchentry->GetNumber(),Widthentry->GetNumber(), GetStepx(), GetStepy() ); // set pitch, width, XMAX and YMAX // added 0.01 to add stability on pitch determination - // dwpot.SetV(Biasentry->GetNumber(),Depletionentry->GetNumber()); // set depletion and bias voltage dwpot.SetV(GetVBias(),GetVDepl()); // set depeletion and bias voltage dwpot.SetDoping(stripdoping,bulkdoping); @@ -3068,9 +3143,9 @@ void WFGUI::CallSetDopingGL(Int_t id) { // c_coefficient: float B = 5.5; - float BC = 2.1; + float BC = 2.7; // it was 2.1; float Ga = 8.5; - float GAC = 2.7; + float GAC = 3.3; // it was 2.7 float BLD = 4.1; DopingGLType = B; @@ -3218,6 +3293,7 @@ void WFGUI::SetGainShape(Int_t id) } SetGainKind(GetGainKind()); SetGainDoping(GetGainDoping()); + return; } @@ -3283,12 +3359,18 @@ void WFGUI::SetGainDoping(Int_t id) { GainShape->Select(0); GainShape->SetEnabled(kFALSE); GainDoping->Select(0); + SamplingEntry->SetNumber(0.3); + SamplingEntry->SetState(kTRUE); } if (id > 0 && NGainDoping ==0) { CalculateButton->SetEnabled(kFALSE); GainShape->SetEnabled(kTRUE); GainShape->Select(2); + SamplingEntry->SetNumber(0.1); + SamplingEntry->SetState(kFALSE); + SetStepy(0.06); + StepyEntry->SetNumber(0.06); } CalculateButton->SetEnabled(kFALSE); NGainDoping = id; @@ -4771,10 +4853,33 @@ void WFGUI::CloseWindow() // Got close message for this MainFrame. Terminates th SetStopOn(); gApplication->Terminate(); } +///////////////////////////////////////////////////////////////////////////////////////////// +void WFGUI::LoadData(){ + + string fname = "./sensors/data/"; + fname+=SaveFileName->GetText(); + // std::cout << "Loading data from file " << fname.c_str() << std::endl; + std::map valueMap = GetParameters(fname.c_str()); + + // partial loading for now + + SetGainDoping(valueMap["DOPING_GL"]); //call callsetdopingGL + SetGainShape(valueMap["SHAPE_GL"]); //call setgaindoping and setgainkind + SetGainKind(valueMap["KIND_GL"]); //call noone + + GainKind->Select(valueMap["KIND_GL"]); + GainDoping->Select(valueMap["DOPING_GL"]); + GainShape->Select(valueMap["SHAPE_GL"]); + Dopingentry->SetNumber(valueMap["DOP_LEV"]); + + +} + ///////////////////////////////////////////////////////////////////////////////////////////// void WFGUI::SaveData(){ std::cout << "Saving data" << std::endl; + UserValues["BBBW"] = BBBWEntry->GetNumber(); UserValues["BBGAIN"] = BBGainEntry->GetNumber(); UserValues["BBVTH"] = BBVthEntry->GetNumber(); @@ -4813,21 +4918,69 @@ void WFGUI::SaveData(){ UserValues["TEMPERATURE"] = TempEntry->GetNumber(); UserValues["USERQ"] = 73; UserValues["VTH"] = CSAVthEntry->GetNumber(); - UserValues["YPOSITION"] = EdgeNumberentry->GetNumber(); + UserValues["YPOSITION"] = EdgeNumberentry->GetNumber(); + + UserValues["KIND_GL"] =GetGainKind(); + UserValues["DOPING_GL"] =NGainDoping; + UserValues["SHAPE_GL"] =GetGainShape(); + + std::ofstream myfile; - string fname = "./"; + string fname = "./sensors/data/"; fname+=SaveFileName->GetText(); + + ifstream ifile(fname); + if (ifile) { + if (Eflag == 0) + { + cout << "The file exists, and is open for input" << endl; + SaveButton->SetBackgroundColor(0xff0000); + SaveButton->SetTitle("sure?"); + + Eflag = 1; + return; + } + else if (Eflag == 1) + { + Eflag = 0; + SaveButton->SetBackgroundColor(0x00ff00); + SaveButton->SetTitle("Save"); + } + } myfile.open(fname, ios::out); + for (auto it = UserValues.begin(); it!=UserValues.end(); it++){ myfile << it->first << " " << it->second << "\n"; myfile.flush(); } + myfile.flush(); myfile.close(); } ///////////////////////////////////////////////////////////////////////////////////////////// +void WFGUI::SaveGraph(){ + std::cout << "Saving graph" << std::endl; + + std::ofstream myfile; + string fname = "./sensors/graph/"; + fname+=SaveFileName1->GetText(); + fname +=".root"; + + // Added saving of canvases + TFile *outputFile = new TFile(fname.c_str(), "RECREATE"); + Getcanvasp()->Write("potentials"); + Getcanvaspc()->cd(1); + Getcanvaspc()->Write("eh_pairs"); + Getcanvaspc()->cd(2); + Getcanvaspc()->Write("potential_currents"); + Getcanvasw()->Write("weighting"); + outputFile->Write(); + outputFile->Close(); + +} +///////////////////////////////////////////////////////////////////////////////////////////// TThread* WFGUI::GetPotentialThread() { return PotentialThread; } @@ -4850,47 +5003,39 @@ void* WFGUI::StartPotentialCalcTh(void* arg) // cout << __LINE__<< endl; // sleep(1); - if (gui->GetGainon()==true && fabs(gui->GetStepy()-0.1)>0.06 ) + if (gui->GetGainon()==true && (gui->GetStepy()-0.1)>0. ) { cout << "Calculation done with step in y = " << gui->GetStepy() << endl; - gui->SetStepy(0.1); - gui->StepyEntry->SetNumber(0.1); - cout << "Sensor with gain layer, y-step has to be 0.1 micron" << endl; + gui->SetStepy(0.08); + gui->StepyEntry->SetNumber(0.08); + cout << "Sensor with gain layer, y-step has to be < 0.1 micron" << endl; cout << "Calculate the potential again" << endl; gui->CalculateButton->SetEnabled(kFALSE); gui->CalcPotButton->SetEnabled(kTRUE); gui->SetButton->SetEnabled(kTRUE); + gui->CalculatingLabel->SetBackgroundColor(0xff0000); // when calculation completed, set progress label color to green + gui->CalculatingLabel->SetTitle("Calculate the potential again"); } - else gui->SetAllButton(1); - // if (GetGainon()=false ) - //else - // { - // cout << StepYButton[1]->GetState() << "Buttom Stepy 1 " << endl; - // } - //gui->DrawFieldsAbs(); - - gui->CalculatingLabel->SetBackgroundColor(0x00ff00); // when calculation completed, set progress label color to green - gui->CalculatingLabel->SetTitle("Done"); - - // Added saving of canvases - TFile *outputFile = new TFile("potentials.root", "RECREATE"); - gui->Getcanvasp()->Write("potentials"); - gui->Getcanvaspc()->cd(1); - gui->Getcanvaspc()->Write("eh_pairs"); - gui->Getcanvaspc()->cd(2); - gui->Getcanvaspc()->Write("potential_currents"); - gui->Getcanvasw()->Write("weighting"); - outputFile->Write(); - outputFile->Close(); + else + { + gui->SetAllButton(1); + gui->CalculatingLabel->SetBackgroundColor(0x00ff00); // when calculation completed, set progress label color to green + gui->CalculatingLabel->SetTitle("Done"); + } return NULL; } ///////////////////////////////////////////////////////////////////////////////////////////// Int_t WFGUI::ThreadstartPotential(){ + if( GetGainDoping()>0) + { + SetStepy(0.06); + StepyEntry->SetNumber(0.06); + } // CallBoundaryConditions(); // cout << __LINE__<< endl; WFGUI* arg = this; @@ -5387,7 +5532,7 @@ void WFGUI::SetStepy( double val) } ////////////////////////////////////////////////////////////////////////////////////// double WFGUI::GetStepy() { - return Stepy+0.01; + return Stepy+0.01; } ///////////////////////////////////////////////////////////////////////////////////////////// diff --git a/WFGUI.h b/WFGUI.h old mode 100644 new mode 100755 index 2e894d3..9788278 --- a/WFGUI.h +++ b/WFGUI.h @@ -81,6 +81,7 @@ class WFGUI : public TGMainFrame { bool UniformQFlag; bool UserUniformQFlag; bool ReadOutTopFlag; + int Eflag=0; unsigned char stripdoping; unsigned char bulkdoping; @@ -224,7 +225,8 @@ class WFGUI : public TGMainFrame { TGHorizontalFrame *DJDetailsBottomFrame; // SettingsFrame2 contains: - TGGroupFrame *ControlFrame; + // TGGroupFrame *ControlFrame; + TGVerticalFrame *ControlFrame; TGVerticalFrame *RightFrame; //ControlFrame contains @@ -544,11 +546,15 @@ class WFGUI : public TGMainFrame { TGTextButton *DrawCutsUserEntry; TGTextButton *DrawCutsUserEntry2; TGTextButton *FileNameButton; - TGLabel *FileNameLabel; + TGLabel *FileNameLabel; // Added saving gui buttons TGTextEntry *FileNameEntry; - TGTextEntry *SaveFileName; - TGTextButton *SaveButton; + TGTextEntry *SaveFileName; + TGTextButton *SaveButton; + TGTextButton *LoadButton; + + TGTextEntry *SaveFileName1; + TGTextButton *SaveButton1; //TGComboBox *SetAlpha; //!!!! original particle selection TGHorizontalFrame *fSliceExtentL; @@ -659,7 +665,9 @@ class WFGUI : public TGMainFrame { void CallCalculateCurrents(); // Method to calculate currents // static void* StartPotentialCalcTh(void*); void CloseWindow(); // Method to close window - void SaveData(); // Method to save plots + void SaveData(); // Method to save plots + void LoadData(); // Method to save plots + void SaveGraph(); // Method to save graph TH2F* Getwhist(); // Method which returns whist TH2F* Getdhist(); // Method which returns dhist TH2F* Getchist(); // Method which returns dhist diff --git a/WFGUI_good.cxx b/WFGUI_good.cxx old mode 100644 new mode 100755 diff --git a/grep b/grep old mode 100644 new mode 100755