Changeset 5904 for trunk/MagicSoft
- Timestamp:
- 01/20/05 10:09:24 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mtemp/mifae
- Files:
-
- 2 added
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mtemp/mifae/Changelog
r5879 r5904 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 2005/01/20 Eva Domingo 22 * library/MDispParameters.[cc,h] 23 - Added substituting previous MDisp.[cc,h] classes. 24 Old MDisp::Calc function moved to MDispCalc task. 25 * library/MDispCalc.[cc,h] 26 - Now includes the DISP parameterization, defined in 27 MDispCalc::Calc. MDispCalc::InitMapping now defines 28 training and test matrices with only the columns of 29 variables needed in the DISP expression. 30 * library/MHDisp.[cc,h] 31 - Changed the Chi2 name by MinPar (to clarify it accounts for 32 the parameter asked to be minimized in the Disp optimization). 33 Added MHDisp::InitMapping, defines matrices with only the columns 34 of variables needed for computing the minimization parameter 35 and for filling the DISP histograms. 20 36 21 37 2005/01/18 Javier Rico & Markus Gaug -
trunk/MagicSoft/Mars/mtemp/mifae/library/IFAELinkDef.h
r5672 r5904 27 27 #pragma link C++ class MTopologyCalc+; 28 28 #pragma link C++ class MImageParDisp+; 29 #pragma link C++ class MDisp +;29 #pragma link C++ class MDispParameters+; 30 30 #pragma link C++ class MDispCalc+; 31 31 #pragma link C++ class MHDisp+; -
trunk/MagicSoft/Mars/mtemp/mifae/library/MDispCalc.cc
r5671 r5904 28 28 // MDispCalc // 29 29 // // 30 // This task calculates Disp 31 // (parameters are taken from the container MDisp)//32 // Also the matrix of variables to be used in the Disp optimization//33 // is defined//30 // This task calculates Disp with a given parameterization // 31 // (parameters are stored in the MDispParameters container) // 32 // Also the matrix of variables to be used in the Disp // 33 // parameterization is defined // 34 34 // // 35 35 // // … … 48 48 #include "MPointingPos.h" 49 49 #include "MImageParDisp.h" 50 #include "MDisp .h"50 #include "MDispParameters.h" 51 51 52 52 #include "MHMatrix.h" … … 62 62 using namespace std; 63 63 64 static const Int_t nPars=5; // number of parameters used in the Disp expression 65 66 enum dispVar_t {kSize,kWidth,kLength,kConc,kLeakage1,kLeakage2,kTotVar}; // enum variables for the 67 // matrix columns mapping 68 64 69 // -------------------------------------------------------------------------- 65 70 // 66 71 // constructor 67 72 // 68 MDispCalc::MDispCalc(const char *imagepardispname, const char *dispname, 73 MDispCalc::MDispCalc(const char *imagepardispname, 74 const char *dispparametersname, 69 75 const char *name, const char *title) 70 : fImageParDispName(imagepardispname), fDispName(dispname) 76 : fImageParDispName(imagepardispname), 77 fDispParametersName(dispparametersname), 78 fLogSize0(3.), fLength0(0.1), fWidth0(0.05), 79 fConc0(0.35), fLeakage10(0.05), fLeakage20(0.1) 71 80 { 72 81 fName = name ? name : "MDispCalc"; … … 76 85 77 86 // initialize mapping array dimension to the number of columns of fMatrix 78 fMap.Set( 18);87 fMap.Set(kTotVar); 79 88 } 80 89 … … 106 115 } 107 116 108 fDisp = (MDisp*)pList->FindObject(fDispName, "MDisp"); 109 if (!fDisp) 110 { 111 *fLog << err << fDispName << " [MDisp] not found... aborting." << endl; 112 return kFALSE; 113 } 117 fDispParameters = (MDispParameters*)pList->FindObject(fDispParametersName, "MDispParameters"); 118 if (!fDispParameters) 119 { 120 *fLog << err << fDispParametersName << " [MDispParameters] not found... aborting." << endl; 121 return kFALSE; 122 } 123 fDispParameters->GetParameters().Set(nPars); 124 fDispParameters->GetStepsizes().Set(nPars); 114 125 115 126 … … 160 171 if (!fPointing) 161 172 { 162 *fLog << err << "MPointingPos not found... " 163 << "MMcEvt is going to be used to get Theta and Phi." 164 << endl; 165 // return kFALSE; 173 *fLog << err << "MPointingPos not found... aborting." << endl; 174 return kFALSE; 166 175 } 167 176 … … 175 184 // 176 185 // You can use this function if you want to use a MHMatrix instead of the 177 // given containers for the Disp optimization. This function adds all186 // given containers for the Disp parameterization. This function adds all 178 187 // necessary columns to the given matrix. Afterwards, you should fill 179 188 // the matrix with the corresponding data (eg from a file by using 180 189 // MHMatrix::Fill). Then, if you loop through the matrix (eg using 181 // MMatrixLoop), MDispCalc:: Processwill take the values from the matrix190 // MMatrixLoop), MDispCalc::Calc will take the values from the matrix 182 191 // instead of the containers. 183 192 // … … 189 198 fMatrix = mat; 190 199 191 fMap[0] = fMatrix->AddColumn("MSrcPosCam.fX"); 192 fMap[1] = fMatrix->AddColumn("MSrcPosCam.fY"); 193 fMap[2] = fMatrix->AddColumn("MHillas.fMeanX"); 194 fMap[3] = fMatrix->AddColumn("MHillas.fMeanY"); 195 fMap[4] = fMatrix->AddColumn("MHillas.fDelta"); 196 197 fMap[5] = fMatrix->AddColumn("MHillas.fSize"); 198 fMap[6] = fMatrix->AddColumn("MHillas.fWidth"); 199 fMap[7] = fMatrix->AddColumn("MHillas.fLength"); 200 201 fMap[8] = fMatrix->AddColumn("MNewImagePar.fConc"); 202 fMap[9] = fMatrix->AddColumn("MNewImagePar.fLeakage1"); 203 fMap[10] = fMatrix->AddColumn("MNewImagePar.fLeakage2"); 204 205 fMap[11] = fMatrix->AddColumn("MHillasExt.fM3Long"); 206 fMap[12] = fMatrix->AddColumn("MHillasExt.fAsym"); 207 208 fMap[13] = fMatrix->AddColumn("MMcEvt.fEnergy"); 209 fMap[14] = fMatrix->AddColumn("MMcEvt.fImpact"); 210 fMap[15] = fMatrix->AddColumn("MMcEvt.fLongitmax"); 211 212 if (fPointing) 213 { 214 fMap[16] = fMatrix->AddColumn("MPointingPos.fZd"); 215 fMap[17] = fMatrix->AddColumn("MPointingPos.fAz"); 216 } 217 else 218 { 219 fMap[16] = fMatrix->AddColumn("MMcEvt.fTelescopeTheta*kRad2Deg"); 220 fMap[17] = fMatrix->AddColumn("MMcEvt.fTelescopePhi*kRad2Deg"); 221 } 222 } 223 224 225 // -------------------------------------------------------------------------- 226 // 227 // Returns the Matrix and the mapped value for each Matrix column 228 // 229 MHMatrix* MDispCalc::GetMatrixMap(TArrayI &map) 230 { 231 map = fMap; 232 233 return fMatrix; 200 fMap[kSize] = fMatrix->AddColumn("MHillas.fSize"); 201 fMap[kWidth] = fMatrix->AddColumn("MHillas.fWidth"); 202 fMap[kLength] = fMatrix->AddColumn("MHillas.fLength"); 203 204 fMap[kConc] = fMatrix->AddColumn("MNewImagePar.fConc"); 205 fMap[kLeakage1] = fMatrix->AddColumn("MNewImagePar.fLeakage1"); 206 fMap[kLeakage2] = fMatrix->AddColumn("MNewImagePar.fLeakage2"); 234 207 } 235 208 … … 258 231 { 259 232 // get variables needed to compute disp from the matrix or the containers 260 const Double_t size = fMatrix ? GetVal( 5): fHil->GetSize();261 const Double_t width0 = fMatrix ? GetVal( 6): fHil->GetWidth();262 const Double_t length0 = fMatrix ? GetVal( 7): fHil->GetLength();263 const Double_t conc = fMatrix ? GetVal( 8): fNewPar->GetConc();264 const Double_t leakage1 = fMatrix ? GetVal( 9): fNewPar->GetLeakage1();265 const Double_t leakage2 = fMatrix ? GetVal( 10) : fNewPar->GetLeakage2();233 const Double_t size = fMatrix ? GetVal(kSize) : fHil->GetSize(); 234 const Double_t width0 = fMatrix ? GetVal(kWidth) : fHil->GetWidth(); 235 const Double_t length0 = fMatrix ? GetVal(kLength) : fHil->GetLength(); 236 const Double_t conc = fMatrix ? GetVal(kConc) : fNewPar->GetConc(); 237 const Double_t leakage1 = fMatrix ? GetVal(kLeakage1) : fNewPar->GetLeakage1(); 238 const Double_t leakage2 = fMatrix ? GetVal(kLeakage2) : fNewPar->GetLeakage2(); 266 239 267 240 // convert to deg … … 269 242 const Double_t length = length0 * fMm2Deg; 270 243 271 // create an array to pass the variables to MDisp::Calc 272 Int_t numimagevars = 6; 273 TArrayD imagevars(numimagevars); 274 imagevars[0] = log10(size); 275 imagevars[1] = width; 276 imagevars[2] = length; 277 imagevars[3] = conc; 278 imagevars[4] = leakage1; 279 imagevars[5] = leakage2; 244 // create an array to pass the variables to MDispCalc::Calc 245 TArrayD imagevars(kTotVar); 246 imagevars[kSize] = log10(size); 247 imagevars[kWidth] = width; 248 imagevars[kLength] = length; 249 imagevars[kConc] = conc; 250 imagevars[kLeakage1] = leakage1; 251 imagevars[kLeakage2] = leakage2; 280 252 281 253 // compute Disp 282 Double_t disp = fDisp->Calc(imagevars);254 Double_t disp = Calc(imagevars); 283 255 284 256 // save value into MImageParDisp container … … 288 260 return kTRUE; 289 261 } 262 263 264 // -------------------------------------------------------------------------- 265 // 266 // Set the Disp parameterization and Calculate Disp 267 // 268 // 269 Double_t MDispCalc::Calc(TArrayD &imagevar) 270 { 271 // get parameters 272 const TArrayD& p = fDispParameters->GetParameters(); 273 274 // get image variables to be used in the Disp parameterization 275 Double_t logsize = imagevar[0]; 276 Double_t width = imagevar[1]; 277 Double_t length = imagevar[2]; 278 // Double_t conc = imagevar[3]; 279 // Double_t leakage1 = imagevar[4]; 280 // Double_t leakage2 = imagevar[5]; 281 282 // Disp parameterization to be optimized 283 // Note: fLogSize0, fLength0... variables are introduced to uncorrelate as much 284 // as possible the parameters in the Disp expression, with the purpose of 285 // helping the minimization algorithm to converge. They are set approx. 286 // to their distribution mean value in the MDisp constructor, but can be 287 // changed using the corresponding set function. 288 // 289 290 // Double_t disp = p[0] + p[1]*(logsize-fLogSize0) 291 // + (p[2] + p[3]*(logsize-fLogSize0))*width/length; 292 293 Double_t disp = p[0] + p[1]*(logsize-fLogSize0) + p[4]*(length-fLength0) 294 + (p[2] + p[3]*(logsize-fLogSize0))*width/length; 295 296 // Double_t disp = p[0] + p[1]*(logsize-fLogSize0) + p[4]*(length-fLength0) 297 // + (p[2] + p[3]*(logsize-fLogSize0))*length/width; 298 299 // Double_t disp = p[0] + p[1]*(logsize-fLogSize0) + p[4]*(length-fLength0) 300 // + (p[2] + p[3]*(logsize-fLogSize0) + p[5]*(length-fLength0))*width/length; 301 302 // Double_t disp = p[0] + p[1]*(logsize-fLogSize0) + p[4]*(width-fWidth0) 303 // + (p[2] + p[3]*(logsize-fLogSize0))*width/length; // + p[5]*(width-fWidth0))*width/length; 304 305 // Double_t disp = p[0] + p[1]*(logsize-fLogSize0) + p[4]*(conc-fConc0) 306 // + (p[2] + p[3]*(logsize-fLogSize0))*width/length; // + p[5]*(conc-fConc0))*width/length; 307 308 // Double_t disp = ( p[0] + p[1]*(logsize-fLogSize0) 309 // + p[2]*pow(logsize-fLogSize0,2) 310 // + p[3]*pow(logsize-fLogSize0,3) 311 // + p[4]*pow(logsize-fLogSize0,4) ) 312 // *( 1/(1+width/length) ); 313 314 // Double_t disp = ( p[0] + p[1]*(logsize-fLogSize0) 315 // + p[2]*pow(logsize-fLogSize0,2) 316 // + p[3]*pow(logsize-fLogSize0,3) 317 // + p[4]*pow(logsize-fLogSize0,4) ) 318 // *(1-width/length); 319 320 return disp; 321 } 322 290 323 //=========================================================================== 291 324 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MDispCalc.h
r5671 r5904 21 21 class MPointingPos; 22 22 class MImageParDisp; 23 class MDisp ;23 class MDispParameters; 24 24 class MHMatrix; 25 25 class MParList; … … 29 29 private: 30 30 31 MSrcPosCam *fSrcPos; 32 MHillas *fHil; 33 MHillasExt *fHilExt; 34 MNewImagePar *fNewPar; 35 MMcEvt *fMcEvt; 36 MPointingPos *fPointing; // NOTE: take (theta,phi) from this container 37 // when it is available (MC calibrated files 38 // or data files) 39 40 MImageParDisp *fImageParDisp; //! output container for Disp 41 MDisp *fDisp; // container for Disp parameters 31 MSrcPosCam *fSrcPos; 32 MHillas *fHil; 33 MHillasExt *fHilExt; 34 MNewImagePar *fNewPar; 35 MMcEvt *fMcEvt; 36 MPointingPos *fPointing; 37 38 MImageParDisp *fImageParDisp; //! output container for Disp value 39 MDispParameters *fDispParameters; //! container for Disp parameters 42 40 43 41 TString fImageParDispName; // name of container to store Disp 44 TString fDispName; // name of container for Disp parameters 42 TString fDispParametersName; // name of container for Disp parameters 43 44 Double_t fLogSize0; // Variables introduced in the Disp expression 45 Double_t fLength0; // to shift the minimization around the mean 46 Double_t fWidth0; // values of the variables, so it makes easier 47 Double_t fConc0; // to MINUIT to converge. Default values are set 48 Double_t fLeakage10; // in the constructor (to their standard mean 49 Double_t fLeakage20; // distribution values) but can be changed with 50 // the corresponding set function. 45 51 46 52 Double_t fMm2Deg; // conversion factor from mm to deg 47 53 48 54 MHMatrix *fMatrix; // matrix defined to have as much columns as 49 // variables wanted to be accessible during 50 // Disp optimization, and as much rows as 51 // events used for the optimization 52 // (filled at MFindDisp) 55 // variables wanted to parameterize Disp, 56 // and as much rows as events used for the 57 // optimization (filled at MFindDisp) 53 58 54 TArrayI fMap; // array to store the matrix mapping column 55 // numbers corresponding to each added variable 59 TArrayI fMap; // array storing the matrix mapping column 60 // numbers corresponding to each variable 61 // added to fMatrix 56 62 57 63 … … 59 65 Int_t Process(); 60 66 61 Double_t GetVal(Int_t i) const; // get value of variable entered in the matrix62 //at column fMap[i]67 Double_t GetVal(Int_t i) const; // get value of variable entered in the 68 // matrix at column fMap[i] 63 69 64 70 … … 70 76 71 77 void InitMapping(MHMatrix *mat); // define the matrix of variables 72 MHMatrix* GetMatrixMap(TArrayI &map); // get matrix and its mapping array 78 // needed for the Disp parameterization 79 80 Double_t Calc(TArrayD &imagevar); // calculate Disp with a given expression 81 82 void SetLogSize0(Double_t newmeanval) { fLogSize0 = newmeanval; } 83 void SetWidth0(Double_t newmeanval) { fWidth0 = newmeanval; } 84 void SetLength0(Double_t newmeanval) { fLength0 = newmeanval; } 85 void SetConc0(Double_t newmeanval) { fConc0 = newmeanval; } 86 void SetLeakage10(Double_t newmeanval) { fLeakage10 = newmeanval; } 87 void SetLeakage20(Double_t newmeanval) { fLeakage20 = newmeanval; } 73 88 74 89 ClassDef(MDispCalc, 0) // Task to evaluate Disp -
trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.cc
r5671 r5904 48 48 #include "MBinning.h" 49 49 #include "MContinue.h" 50 #include "MDisp .h"50 #include "MDispParameters.h" 51 51 #include "MDispCalc.h" 52 52 #include "MDataElement.h" … … 72 72 #include "MMatrixLoop.h" 73 73 #include "MMinuitInterface.h" 74 #include "MParameters.h" 74 75 #include "MParList.h" 75 76 #include "MProgressBar.h" … … 95 96 // 96 97 // - the parameters to be varied in the minimization are the parameters 97 // appearing in the parametrization of Disp (MDisp ::Calc())98 // appearing in the parametrization of Disp (MDispCalc::Calc()) 98 99 // 99 100 //------------------------------------------------------------------------ … … 104 105 cout << "entry fcnDisp" << endl; 105 106 106 // save pointer to the MINUIT o ject (for optimizing Disp) for the case107 // save pointer to the MINUIT object (for optimizing Disp) for the case 107 108 // that it is overwritten by the pointer to another Minuit object 108 109 // TMinuit *savePointer = gMinuit; … … 116 117 117 118 // get needed Disp containers from the existing parList 118 MDisp *disp = (MDisp*)plistfcn->FindObject("MDisp");119 if (!disp )120 { 121 gLog << "fcnDisp : MDisp object '" << "MDisp"119 MDispParameters *dispparams = (MDispParameters*)plistfcn->FindObject("MDispParameters"); 120 if (!dispparams) 121 { 122 gLog << "fcnDisp : MDispParameters object '" << "MDispParameters" 122 123 << "' not found... aborting" << endl; 123 124 return; … … 132 133 } 133 134 135 MParameterD *minpar = (MParameterD*)plistfcn->FindObject("MinimizationParameter"); 136 134 137 // 135 // transfer current parameter values to MDisp 138 // transfer current parameter values to MDispParameters 136 139 // 137 140 // Attention : npar is the number of variable parameters … … 142 145 gMinuit->mnstat(fMin, fEdm, fErrdef, fNpari, fNparx, fIstat); 143 146 144 disp ->SetParameters(TArrayD(fNparx, par));147 dispparams->SetParameters(TArrayD(fNparx, par)); 145 148 146 149 // checking that parameters have been properly set 147 TArrayD checkparameters = disp ->GetParameters();150 TArrayD checkparameters = dispparams->GetParameters(); 148 151 gLog << "fcnDisp : fNpari, fNparx =" << fNpari << ", " 149 152 << fNparx << endl; … … 155 158 156 159 // 157 // loop over the events in the training matri x to compute the Chi^2158 // for the currentparameter values160 // loop over the events in the training matrices to compute the parameter 161 // to minimize for the current Disp parameter values 159 162 evtloopfcn->Eventloop(); 160 163 … … 162 165 163 166 //------------------------------------------- 164 // get the Chi^2 value for the current values of the parameters 165 f = hdisp->GetChi2(); 167 // get the Minimization parameter value for the current values 168 // of the Disp parameters 169 if (minpar) 170 f = minpar->GetVal(); 171 else 172 { 173 gLog << "fcnDisp : MParameterD object '" << "MinimizationParameter" 174 << "' not found... aborting" << endl; 175 return; 176 } 166 177 } 167 178 … … 184 195 // (done at MFDisp constructor) 185 196 fDispFilter = fdisp; 186 *fLog << inf << "MFindDisp::MFindDisp; address of MFDisp object = "187 << fDispFilter << endl;188 197 189 198 // matrices to contain the training/test samples 190 fMatrixTrain = new MHMatrix("MatrixTrain"); 191 fMatrixTest = new MHMatrix("MatrixTest"); 192 193 // objects of MDispCalc to which these matrices are attached 199 fMatrixTrainCalc = new MHMatrix("MatrixTrainCalc"); 200 fMatrixTrainHists = new MHMatrix("MatrixTrainHists"); 201 fMatrixTestCalc = new MHMatrix("MatrixTestCalc"); 202 fMatrixTestHists = new MHMatrix("MatrixTestHists"); 203 204 // objects of MDispCalc where the first part of the matrices mapping is defined 194 205 fDispCalcTrain = new MDispCalc("DispTrain"); 195 206 fDispCalcTest = new MDispCalc("DispTest"); 196 207 208 // objects of MHDisp where the second part of the matrices mapping is defined 209 fHDispTrain = new MHDisp("DispTrain"); 210 fHDispTest = new MHDisp("DispTest"); 211 197 212 // define columns of matrices 198 fDispCalcTrain->InitMapping(fMatrixTrain); 199 fDispCalcTest->InitMapping(fMatrixTest); 213 // Train matrix 214 fDispCalcTrain->InitMapping(fMatrixTrainCalc); 215 fHDispTrain->InitMapping(fMatrixTrainHists); 216 // Test matrix 217 fDispCalcTest->InitMapping(fMatrixTestCalc); 218 fHDispTest->InitMapping(fMatrixTestHists); 200 219 } 220 201 221 202 222 // -------------------------------------------------------------------------- … … 207 227 { 208 228 delete fCam; 209 delete fMatrixTrain; 210 delete fMatrixTest; 229 delete fMatrixTrainCalc; 230 delete fMatrixTrainHists; 231 delete fMatrixTestCalc; 232 delete fMatrixTestHists; 211 233 delete fDispCalcTrain; 212 234 delete fDispCalcTest; 235 delete fHDispTrain; 236 delete fHDispTest; 213 237 } 214 238 … … 216 240 // -------------------------------------------------------------------------- 217 241 // 218 // Define the matrix 'fMatrixTrain' for the TRAINING sample 242 // Define the matrices 'fMatrixTrainCalc' and 'fMatrixTrainHists' 243 // for the TRAINING sample 219 244 // 220 245 // alltogether 'howmanytrain' events are read from file 'nametrain'; … … 223 248 // 224 249 Bool_t MFindDisp::DefineTrainMatrix( 225 const TString &nametrain, MH3 &hreftrain, 226 const Int_t howmanytrain, const TString &filetrain,250 const TString &nametrain, MH3 &hreftrain, 251 const Int_t howmanytrain, const TString &filetrain, 227 252 Int_t iflag) 228 253 { … … 231 256 232 257 *fLog << "=============================================" << endl; 233 *fLog << "Fill TRAINING Matri xfrom file '" << nametrain << endl;258 *fLog << "Fill TRAINING Matrices from file '" << nametrain << endl; 234 259 *fLog << " select " << howmanytrain << " events " << endl; 235 260 if (!hreftrain.GetHist().GetEntries()==0) … … 266 291 seltrain.SetName("selectTrain"); 267 292 268 MFillH filltrain(fMatrixTrain); 269 filltrain.SetFilter(&seltrain); 270 filltrain.SetName("fillMatrixTrain"); 293 MFillH filltraincalc(fMatrixTrainCalc); 294 filltraincalc.SetFilter(&seltrain); 295 filltraincalc.SetName("fillMatrixTrainCalc"); 296 297 MFillH filltrainhists(fMatrixTrainHists); 298 filltrainhists.SetFilter(&seltrain); 299 filltrainhists.SetName("fillMatrixTrainHists"); 271 300 272 301 //****************************** … … 275 304 plist.AddToList(&tlist); 276 305 plist.AddToList(fCam); 277 plist.AddToList(fMatrixTrain); 306 plist.AddToList(fMatrixTrainCalc); 307 plist.AddToList(fMatrixTrainHists); 278 308 279 309 //****************************** … … 284 314 tlist.AddToList(&contdisp); 285 315 tlist.AddToList(&seltrain); 286 tlist.AddToList(&filltrain); 316 tlist.AddToList(&filltraincalc); 317 tlist.AddToList(&filltrainhists); 287 318 288 319 //****************************** … … 302 333 303 334 304 // print the filled Training Matrix 305 fMatrixTrain->Print("SizeCols"); 335 // print the filled Training Matrices 336 fMatrixTrainCalc->Print("SizeCols"); 337 fMatrixTrainHists->Print("SizeCols"); 306 338 307 339 // check that number of generated events is compatible with the resquested 308 Int_t howmanygenerated = fMatrixTrain->GetM().GetNrows();309 if (TMath::Abs(howmanygenerated -howmanytrain) > TMath::Sqrt(9.*howmanytrain))340 Int_t howmanygeneratedcalc = fMatrixTrainCalc->GetM().GetNrows(); 341 if (TMath::Abs(howmanygeneratedcalc-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 310 342 { 311 343 *fLog << "MFindDisp::DefineTrainMatrix; no.of generated events (" 312 << howmanygenerated 344 << howmanygeneratedcalc 313 345 << ") is incompatible with the no.of requested events (" 314 346 << howmanytrain << ")" << endl; 315 347 } 316 348 317 *fLog << "TRAINING Matrix was filled" << endl; 349 Int_t howmanygeneratedhists = fMatrixTrainHists->GetM().GetNrows(); 350 if (TMath::Abs(howmanygeneratedhists-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 351 { 352 *fLog << "MFindDisp::DefineTrainMatrix; no.of generated events (" 353 << howmanygeneratedhists 354 << ") is incompatible with the no.of requested events (" 355 << howmanytrain << ")" << endl; 356 } 357 358 359 *fLog << "TRAINING Matrices were filled" << endl; 318 360 *fLog << "=============================================" << endl; 319 361 320 362 321 363 //-------------------------- 322 // write out training matri x364 // write out training matrices 323 365 324 366 if (filetrain != "") 325 367 { 326 368 TFile filetr(filetrain, "RECREATE"); 327 fMatrixTrain->Write(); 369 fMatrixTrainCalc->Write(); 370 fMatrixTrainHists->Write(); 328 371 filetr.Close(); 329 372 330 *fLog << "MFindDisp::DefineTrainMatrix; Training matri x waswritten onto file '"373 *fLog << "MFindDisp::DefineTrainMatrix; Training matrices were written onto file '" 331 374 << filetrain << "'" << endl; 332 375 } 376 333 377 334 378 if (display != NULL) … … 341 385 // -------------------------------------------------------------------------- 342 386 // 343 // Define the matrix 'fMatrixTest' for the TEST sample 387 // Define the matrices 'fMatrixTestCalc' and 'fMatrixTestHists' 388 // for the TEST sample 344 389 // 345 390 // alltogether 'howmanytest' events are read from file 'nametest' … … 356 401 357 402 *fLog << "=============================================" << endl; 358 *fLog << "Fill TEST Matri xfrom file '" << nametest << endl;403 *fLog << "Fill TEST Matrices from file '" << nametest << endl; 359 404 *fLog << " select " << howmanytest << " events " << endl; 360 405 if (!hreftest.GetHist().GetEntries()==0) … … 390 435 seltest.SetName("selectTest"); 391 436 392 MFillH filltest(fMatrixTest); 393 filltest.SetFilter(&seltest); 394 filltest.SetName("fillMatrixTest"); 437 MFillH filltestcalc(fMatrixTestCalc); 438 filltestcalc.SetFilter(&seltest); 439 filltestcalc.SetName("fillMatrixTestCalc"); 440 441 MFillH filltesthists(fMatrixTestHists); 442 filltesthists.SetFilter(&seltest); 443 filltesthists.SetName("fillMatrixTestHists"); 395 444 396 445 //****************************** … … 399 448 plist.AddToList(&tlist); 400 449 plist.AddToList(fCam); 401 plist.AddToList(fMatrixTest); 450 plist.AddToList(fMatrixTestCalc); 451 plist.AddToList(fMatrixTestHists); 402 452 403 453 //****************************** … … 408 458 tlist.AddToList(&contdisp); 409 459 tlist.AddToList(&seltest); 410 tlist.AddToList(&filltest); 460 tlist.AddToList(&filltestcalc); 461 tlist.AddToList(&filltesthists); 411 462 412 463 //****************************** … … 426 477 427 478 428 // print the filled Test Matrix 429 fMatrixTest->Print("SizeCols"); 479 // print the filled Test Matrices 480 fMatrixTestCalc->Print("SizeCols"); 481 fMatrixTestHists->Print("SizeCols"); 430 482 431 483 // check that number of generated events is compatible with the resquested 432 const Int_t howmanygenerated = fMatrixTest->GetM().GetNrows();433 if (TMath::Abs(howmanygenerated -howmanytest) > TMath::Sqrt(9.*howmanytest))484 const Int_t howmanygeneratedcalc = fMatrixTestCalc->GetM().GetNrows(); 485 if (TMath::Abs(howmanygeneratedcalc-howmanytest) > TMath::Sqrt(9.*howmanytest)) 434 486 { 435 487 *fLog << "MFindDisp::DefineTestMatrix; no.of generated events (" 436 << howmanygenerated 488 << howmanygeneratedcalc 437 489 << ") is incompatible with the no.of requested events (" 438 490 << howmanytest << ")" << endl; 439 491 } 440 492 441 *fLog << "TEST Matrix was filled" << endl; 493 const Int_t howmanygeneratedhists = fMatrixTestHists->GetM().GetNrows(); 494 if (TMath::Abs(howmanygeneratedhists-howmanytest) > TMath::Sqrt(9.*howmanytest)) 495 { 496 *fLog << "MFindDisp::DefineTestMatrix; no.of generated events (" 497 << howmanygeneratedhists 498 << ") is incompatible with the no.of requested events (" 499 << howmanytest << ")" << endl; 500 } 501 502 *fLog << "TEST Matrices were filled" << endl; 442 503 *fLog << "=============================================" << endl; 443 504 444 505 445 506 //-------------------------- 446 // write out test matri x507 // write out test matrices 447 508 448 509 if (filetest != "") 449 510 { 450 511 TFile filete(filetest, "RECREATE"); 451 fMatrixTest->Write(); 512 fMatrixTestCalc->Write(); 513 fMatrixTestHists->Write(); 452 514 filete.Close(); 453 515 454 *fLog << "MFindDisp::DefineTestMatrix; Test matri x waswritten onto file '"516 *fLog << "MFindDisp::DefineTestMatrix; Test matrices were written onto file '" 455 517 << filetest << "'" << endl; 456 518 } 519 457 520 458 521 if (display != NULL) … … 477 540 { 478 541 *fLog << "=============================================" << endl; 479 *fLog << "Fill TRAINING and TEST Matri xfrom file '" << name << endl;542 *fLog << "Fill TRAINING and TEST Matrices from file '" << name << endl; 480 543 *fLog << " select " << howmanytrain 481 544 << " training and " << howmanytest << " test events " << endl; … … 521 584 split.SetSelectionRatio(prob); 522 585 523 MFillH filltrain(fMatrixTrain); 524 filltrain.SetFilter(&split); 525 filltrain.SetName("fillMatrixTrain"); 586 MFillH filltraincalc(fMatrixTrainCalc); 587 filltraincalc.SetFilter(&split); 588 filltraincalc.SetName("fillMatrixTrainCalc"); 589 590 MFillH filltrainhists(fMatrixTrainHists); 591 filltrainhists.SetFilter(&split); 592 filltrainhists.SetName("fillMatrixTrainHists"); 526 593 527 594 // consider this event as candidate for a test event … … 530 597 conttrain.SetName("ContTrain"); 531 598 532 MFillH filltest(fMatrixTest); 533 filltest.SetName("fillMatrixTest"); 599 MFillH filltestcalc(fMatrixTestCalc); 600 filltestcalc.SetName("fillMatrixTestCalc"); 601 602 MFillH filltesthists(fMatrixTestHists); 603 filltesthists.SetName("fillMatrixTestHists"); 534 604 535 605 … … 539 609 plist.AddToList(&tlist); 540 610 plist.AddToList(fCam); 541 plist.AddToList(fMatrixTrain); 542 plist.AddToList(fMatrixTest); 611 plist.AddToList(fMatrixTrainCalc); 612 plist.AddToList(fMatrixTrainHists); 613 plist.AddToList(fMatrixTestCalc); 614 plist.AddToList(fMatrixTestHists); 543 615 544 616 //****************************** … … 549 621 tlist.AddToList(&contdisp); 550 622 tlist.AddToList(&cont); 551 tlist.AddToList(&filltrain); 623 tlist.AddToList(&filltraincalc); 624 tlist.AddToList(&filltrainhists); 552 625 tlist.AddToList(&conttrain); 553 tlist.AddToList(&filltest); 626 tlist.AddToList(&filltestcalc); 627 tlist.AddToList(&filltesthists); 554 628 555 629 //****************************** … … 570 644 571 645 572 // print the filled Train Matrix 573 fMatrixTrain->Print("SizeCols"); 646 // print the filled Train Matrices 647 fMatrixTrainCalc->Print("SizeCols"); 648 fMatrixTrainHists->Print("SizeCols"); 574 649 575 650 // check that number of generated events is compatible with the resquested 576 const Int_t generatedtrain = fMatrixTrain->GetM().GetNrows();577 if (TMath::Abs(generatedtrain -howmanytrain) > TMath::Sqrt(9.*howmanytrain))651 const Int_t generatedtraincalc = fMatrixTrainCalc->GetM().GetNrows(); 652 if (TMath::Abs(generatedtraincalc-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 578 653 { 579 654 *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events (" 580 << generatedtrain 655 << generatedtraincalc 581 656 << ") is incompatible with the no.of requested events (" 582 657 << howmanytrain << ")" << endl; 583 658 } 584 585 586 // print the filled Test Matrix 587 fMatrixTest->Print("SizeCols"); 659 const Int_t generatedtrainhists = fMatrixTrainHists->GetM().GetNrows(); 660 if (TMath::Abs(generatedtrainhists-howmanytrain) > TMath::Sqrt(9.*howmanytrain)) 661 { 662 *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events (" 663 << generatedtrainhists 664 << ") is incompatible with the no.of requested events (" 665 << howmanytrain << ")" << endl; 666 } 667 668 669 // print the filled Test Matrices 670 fMatrixTestCalc->Print("SizeCols"); 671 fMatrixTestHists->Print("SizeCols"); 588 672 589 673 // check that number of generated events is compatible with the resquested 590 const Int_t generatedtest = fMatrixTest->GetM().GetNrows();591 if (TMath::Abs(generatedtest -howmanytest) > TMath::Sqrt(9.*howmanytest))674 const Int_t generatedtestcalc = fMatrixTestCalc->GetM().GetNrows(); 675 if (TMath::Abs(generatedtestcalc-howmanytest) > TMath::Sqrt(9.*howmanytest)) 592 676 { 593 677 *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events (" 594 << generatedtest 678 << generatedtestcalc 595 679 << ") is incompatible with the no.of requested events (" 596 680 << howmanytest << ")" << endl; 597 681 } 598 599 600 *fLog << "TRAINING and TEST Matrix were filled" << endl; 682 const Int_t generatedtesthists = fMatrixTestHists->GetM().GetNrows(); 683 if (TMath::Abs(generatedtesthists-howmanytest) > TMath::Sqrt(9.*howmanytest)) 684 { 685 *fLog << "MFindDisp::DefineTrainTestMatrix; no.of generated events (" 686 << generatedtesthists 687 << ") is incompatible with the no.of requested events (" 688 << howmanytest << ")" << endl; 689 } 690 691 692 *fLog << "TRAINING and TEST Matrices were filled" << endl; 601 693 *fLog << "=============================================" << endl; 602 694 603 695 696 //---------------------------- 697 // write out training matrices 698 699 if (filetrain != "") 700 { 701 TFile filetr(filetrain, "RECREATE"); 702 fMatrixTrainCalc->Write(); 703 fMatrixTrainHists->Write(); 704 filetr.Close(); 705 706 *fLog << "MFindDisp::DefineTrainTestMatrix; Training matrices were written onto file '" 707 << filetrain << "'" << endl; 708 } 709 604 710 //-------------------------- 605 // write out training matrix 606 607 if (filetrain != "") 608 { 609 TFile filetr(filetrain, "RECREATE"); 610 fMatrixTrain->Write(); 611 filetr.Close(); 612 613 *fLog << "MFindDisp::DefineTrainTestMatrix; Training matrix was written onto file '" 614 << filetrain << "'" << endl; 615 } 616 617 //-------------------------- 618 // write out test matrix 711 // write out test matrices 619 712 620 713 if (filetest != "") 621 714 { 622 715 TFile filete(filetest, "RECREATE"); 623 fMatrixTest->Write(); 716 fMatrixTestCalc->Write(); 717 fMatrixTestHists->Write(); 624 718 filete.Close(); 625 719 626 *fLog << "MFindDisp::DefineTrainTestMatrix; Test matri x waswritten onto file '"720 *fLog << "MFindDisp::DefineTrainTestMatrix; Test matrices were written onto file '" 627 721 << filetest << "'" << endl; 628 722 } … … 643 737 { 644 738 //-------------------------- 645 // read in training matri x739 // read in training matrices 646 740 647 741 TFile filetr(filetrain); 648 fMatrixTrain->Read("MatrixTrain"); 649 fMatrixTrain->Print("SizeCols"); 650 651 *fLog << "MFindDisp::ReadMatrix; Training matrix was read in from file '" 742 fMatrixTrainCalc->Read("MatrixTrainCalc"); 743 fMatrixTrainHists->Read("MatrixTrainHists"); 744 fMatrixTrainCalc->Print("SizeCols"); 745 fMatrixTrainHists->Print("SizeCols"); 746 747 *fLog << "MFindDisp::ReadMatrix; Training matrices were read in from file '" 652 748 << filetrain << "'" << endl; 653 749 filetr.Close(); … … 655 751 656 752 //-------------------------- 657 // read in test matri x753 // read in test matrices 658 754 659 755 TFile filete(filetest); 660 fMatrixTest->Read("MatrixTest"); 661 fMatrixTest->Print("SizeCols"); 662 663 *fLog << "MFindDisp::ReadMatrix; Test matrix was read in from file '" 756 fMatrixTestCalc->Read("MatrixTestCalc"); 757 fMatrixTestHists->Read("MatrixTestHists"); 758 fMatrixTestCalc->Print("SizeCols"); 759 fMatrixTestHists->Print("SizeCols"); 760 761 *fLog << "MFindDisp::ReadMatrix; Test matrices were read in from file '" 664 762 << filetest << "'" << endl; 665 763 filete.Close(); … … 686 784 // 687 785 // - call TMinuit to do the minimization : 688 // the fcnDisp function calculates the Chi^2 for the current689 // 786 // the fcnDisp function calculates the parameter to minimize 787 // for the current Disp parameter values; 690 788 // for this - Disp is calculated in the event loop by calling 691 // MDispCalc::Process() ==> MDisp ::Calc()692 // - the Chi^2 contributions are summed up in the event loop693 // by calling MHDisp::Fill()694 // - after the event loop the Chi^2 is calculated by calling695 // MHDisp::Finalize()789 // MDispCalc::Process() ==> MDispCalc::Calc() 790 // - the Minimization parameter contributions are summed up 791 // in the event loop by calling MHDisp::Fill() 792 // - after the event loop the final value of the Minimization 793 // parameter is calculated by calling MHDisp::Finalize() 696 794 // 697 795 // Needed as input : (to be set by the Set functions) … … 703 801 // - from the file parDispInit (if it is != "") 704 802 // - or from the arrays params and/or steps 705 // - or from the Disp constructor803 // - or from the DispParameters constructor 706 804 // 707 805 //---------------------------------------------------------------------- … … 721 819 722 820 723 if (fMatrixTrain == NULL)724 { 725 *fLog << "MFindDisp::FindParams; training matri x isnot defined... aborting"821 if (fMatrixTrainCalc == NULL || fMatrixTrainHists == NULL) 822 { 823 *fLog << "MFindDisp::FindParams; training matrices are not defined... aborting" 726 824 << endl; 727 825 return kFALSE; 728 826 } 729 827 730 if (fMatrixTrain ->GetM().GetNrows() <= 0)731 { 732 *fLog << "MFindDisp::FindParams; training matri x hasno entries"828 if (fMatrixTrainCalc->GetM().GetNrows() <= 0 || fMatrixTrainHists->GetM().GetNrows() <= 0) 829 { 830 *fLog << "MFindDisp::FindParams; training matrices have no entries" 733 831 << endl; 734 832 return kFALSE; … … 740 838 741 839 // loop over rows of matrix 742 MMatrixLoop loop(fMatrixTrain); 840 MMatrixLoop loopcalc(fMatrixTrainCalc); 841 MMatrixLoop loophists(fMatrixTrainHists); 743 842 744 843 //-------------------------------- 745 844 // create container for the Disp parameters 746 845 // and set them to their initial values 747 MDisp disp;846 MDispParameters dispparams; 748 847 749 848 // take initial values from file parDispInit … … 751 850 { 752 851 TFile inparam(parDispInit); 753 disp .Read("MDisp");852 dispparams.Read("MDispParameters"); 754 853 inparam.Close(); 755 854 *fLog << "MFindDisp::FindParams; initial values of parameters are taken from file " … … 764 863 *fLog << "MFindDisp::FindParams; initial values of parameters are taken from 'params'" 765 864 << endl; 766 disp .SetParameters(params);865 dispparams.SetParameters(params); 767 866 } 768 867 if (steps.GetSize() != 0) … … 770 869 *fLog << "MFindDisp::FindParams; initial step sizes are taken from 'steps'" 771 870 << endl; 772 disp .SetStepsizes(steps);871 dispparams.SetStepsizes(steps); 773 872 } 774 873 } … … 776 875 { 777 876 *fLog << "MFindDisp::FindParams; initial values and step sizes are taken " 778 << "from the MDisp constructor" << endl; 779 } 780 781 // get the matrix pointer and mapping from MDispCalc object to set the same in MHDisp object 782 TArrayI map; 783 MHMatrix *tmpmatrix = NULL; 784 tmpmatrix = fDispCalcTrain->GetMatrixMap(map); 785 786 // attention: argument of MHDisp is the name of MImageParDisp container, that should 787 // be the same than the name given to it when creating MDispCalc object at the MFindDisp 788 // constructor: fDispCalcTrain = new MDispCalc("DispTrain"); 789 MHDisp hdisp("DispTrain"); 790 hdisp.SetMatrixMap(tmpmatrix,map); 791 // fill the plots for Disp and sum up the Chi^2 contributions 877 << "from the MDispParameters constructor" << endl; 878 } 879 880 // fill the plots for Disp and sum up the Minimization parameter contributions 792 881 MFillH filldispplots("MHDisp", ""); 793 882 … … 796 885 797 886 parlistfcn.AddToList(&tasklistfcn); 798 parlistfcn.AddToList(&disp );799 parlistfcn.AddToList( &hdisp);887 parlistfcn.AddToList(&dispparams); 888 parlistfcn.AddToList(fHDispTrain); 800 889 parlistfcn.AddToList(fCam); 801 parlistfcn.AddToList(fMatrixTrain); 890 parlistfcn.AddToList(fMatrixTrainCalc); 891 parlistfcn.AddToList(fMatrixTrainHists); 802 892 803 893 //****************************** 804 894 // entries in MTaskList 805 895 806 tasklistfcn.AddToList(&loop); 896 tasklistfcn.AddToList(&loopcalc); 897 tasklistfcn.AddToList(&loophists); 807 898 tasklistfcn.AddToList(fDispCalcTrain); 808 899 tasklistfcn.AddToList(&filldispplots); … … 834 925 835 926 // get initial values of parameters 836 fVinit = disp .GetParameters();837 fStep = disp .GetStepsizes();927 fVinit = dispparams.GetParameters(); 928 fStep = dispparams.GetStepsizes(); 838 929 839 930 TString name[fVinit.GetSize()]; … … 901 992 902 993 TFile outparam(fFilenameParam, "RECREATE"); 903 disp .Write();994 dispparams.Write(); 904 995 outparam.Close(); 905 996 … … 907 998 << fFilenameParam << "' :" << endl; 908 999 909 const TArrayD &check = disp .GetParameters();1000 const TArrayD &check = dispparams.GetParameters(); 910 1001 for (Int_t i=0; i<check.GetSize(); i++) 911 1002 *fLog << check[i] << ", "; … … 916 1007 //------------------------------------------- 917 1008 // draw the plots 918 hdisp.Draw();1009 fHDispTrain->Draw(); 919 1010 920 1011 *fLog << "End of Disp optimization part" << endl; … … 932 1023 Bool_t MFindDisp::TestParams() 933 1024 { 934 if (fMatrixTest == NULL)935 { 936 *fLog << "MFindDisp::TestParams; test matri x isnot defined... aborting"1025 if (fMatrixTestCalc == NULL || fMatrixTestHists == NULL) 1026 { 1027 *fLog << "MFindDisp::TestParams; test matrices are not defined... aborting" 937 1028 << endl; 938 1029 return kFALSE; 939 1030 } 940 1031 941 if (fMatrixTest ->GetM().GetNrows() <= 0)942 { 943 *fLog << "MFindDisp::TestParams; test matri x hasno entries"1032 if (fMatrixTestCalc->GetM().GetNrows() <= 0 || fMatrixTestHists->GetM().GetNrows() <= 0) 1033 { 1034 *fLog << "MFindDisp::TestParams; test matrices have no entries" 944 1035 << endl; 945 1036 return kFALSE; … … 955 1046 956 1047 TFile inparam(fFilenameParam); 957 MDisp dispin;958 dispin.Read("MDisp ");1048 MDispParameters dispin; 1049 dispin.Read("MDispParameters"); 959 1050 inparam.Close(); 960 1051 … … 973 1064 MTaskList tasklist2; 974 1065 975 MDisp disp;976 disp .SetParameters(dispPar);977 978 MMatrixLoop loop (fMatrixTest);979 980 // get the matrix pointer and mapping from MDispCalc object to set the same in MHDisp object 981 TArrayI map;982 MHMatrix *tmpmatrix = NULL;983 tmpmatrix = fDispCalcTest->GetMatrixMap(map);1066 MDispParameters dispparams; 1067 dispparams.SetParameters(dispPar); 1068 1069 MMatrixLoop loopcalc(fMatrixTestCalc); 1070 MMatrixLoop loophists(fMatrixTestHists); 1071 1072 MHMatrix *imatrix = NULL; 1073 TArrayI imap; 1074 fHDispTest->GetMatrixMap(imatrix,imap); 984 1075 985 1076 // attention: argument of MHDisp is the name of MImageParDisp container, that should 986 1077 // be the same than the name given to it when creating MDispCalc object at the MFindDisp 987 1078 // constructor: fDispCalcTrain = new MDispCalc("DispTest"); 988 // fill the plots for Disp and sum up the Chi^2contributions1079 // fill the plots for Disp and sum up the Minimization parameter contributions 989 1080 MHDisp hdisp1("DispTest"); 990 1081 hdisp1.SetName("MHDispCorr"); 991 1082 hdisp1.SetSelectedPos(1); 992 hdisp1.SetMatrixMap( tmpmatrix,map);1083 hdisp1.SetMatrixMap(imatrix,imap); 993 1084 MFillH filldispplots1("MHDispCorr[MHDisp]", ""); 994 1085 … … 996 1087 hdisp2.SetName("MHDispWrong"); 997 1088 hdisp2.SetSelectedPos(2); 998 hdisp2.SetMatrixMap( tmpmatrix,map);1089 hdisp2.SetMatrixMap(imatrix,imap); 999 1090 MFillH filldispplots2("MHDispWrong[MHDisp]", ""); 1000 1091 … … 1002 1093 hdisp3.SetName("MHDispM3Long"); 1003 1094 hdisp3.SetSelectedPos(3); 1004 hdisp3.SetMatrixMap( tmpmatrix,map);1095 hdisp3.SetMatrixMap(imatrix,imap); 1005 1096 MFillH filldispplots3("MHDispM3Long[MHDisp]", ""); 1006 1097 … … 1008 1099 hdisp4.SetName("MHDispAsym"); 1009 1100 hdisp4.SetSelectedPos(4); 1010 hdisp4.SetMatrixMap( tmpmatrix,map);1101 hdisp4.SetMatrixMap(imatrix,imap); 1011 1102 MFillH filldispplots4("MHDispAsym[MHDisp]", ""); 1012 1103 … … 1016 1107 1017 1108 parlist2.AddToList(&tasklist2); 1018 parlist2.AddToList(&disp );1109 parlist2.AddToList(&dispparams); 1019 1110 parlist2.AddToList(&hdisp1); 1020 1111 parlist2.AddToList(&hdisp2); … … 1022 1113 parlist2.AddToList(&hdisp4); 1023 1114 parlist2.AddToList(fCam); 1024 parlist2.AddToList(fMatrixTest); 1115 parlist2.AddToList(fMatrixTestCalc); 1116 parlist2.AddToList(fMatrixTestHists); 1025 1117 1026 1118 //****************************** 1027 1119 // entries in MTaskList 1028 1120 1029 tasklist2.AddToList(&loop); 1121 tasklist2.AddToList(&loopcalc); 1122 tasklist2.AddToList(&loophists); 1030 1123 tasklist2.AddToList(fDispCalcTest); 1031 1124 tasklist2.AddToList(&filldispplots1); … … 1064 1157 return kTRUE; 1065 1158 } 1066 1067 1068 1069 1070 1071 1072 1073 -
trunk/MagicSoft/Mars/mtemp/mifae/library/MFindDisp.h
r5671 r5904 16 16 class MHMatrix; 17 17 class MDispCalc; 18 class MHDisp; 18 19 class MFDisp; 19 20 class MFilter; … … 34 35 Int_t fHowManyTest; // number of events for testing 35 36 36 MHMatrix *fMatrixTrain; // training matrix 37 MHMatrix *fMatrixTest; // testing matrix 37 MHMatrix *fMatrixTrainCalc; // training matrix with variables needed in MDispCalc 38 MHMatrix *fMatrixTrainHists; // training matrix with variables needed in MHDisp 39 MHMatrix *fMatrixTestCalc; // testing matrix with variables needed in MDispCalc 40 MHMatrix *fMatrixTestHists; // testing matrix with variables needed in MHDisp 38 41 39 42 MDispCalc *fDispCalcTrain; 40 43 MDispCalc *fDispCalcTest; 44 45 MHDisp *fHDispTrain; 46 MHDisp *fHDispTest; 41 47 42 48 MFDisp *fDispFilter; // filter to select an events sample … … 93 99 Int_t iflag=0); 94 100 95 MHMatrix *GetMatrixTrain() { return fMatrixTrain; } 96 MHMatrix *GetMatrixTest() { return fMatrixTest; } 101 MHMatrix *GetMatrixTrainCalc() { return fMatrixTrainCalc; } 102 MHMatrix *GetMatrixTrainHists() { return fMatrixTrainHists; } 103 MHMatrix *GetMatrixTestCalc() { return fMatrixTestCalc; } 104 MHMatrix *GetMatrixTestHists() { return fMatrixTestHists; } 97 105 98 106 Bool_t ReadMatrix( const TString &filetrain, const TString &filetest); -
trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.cc
r5671 r5904 29 29 // // 30 30 // container holding the histograms for Disp // 31 // also computes the Chi^2 of the Disp optimization//31 // also computes the minimization parameter of the Disp optimization // 32 32 // // 33 33 ///////////////////////////////////////////////////////////////////////////// … … 54 54 55 55 #include "MHMatrix.h" 56 #include "MParameters.h" 56 57 57 58 #include "MParList.h" … … 63 64 64 65 using namespace std; 66 67 enum dispVar_t {kX,kY,kMeanX,kMeanY,kDelta,kSize,kM3Long,kAsym, 68 kEnergy,kImpact,kLongitmax,kZd,kAz,kTotVar}; // enum variables for the 69 // matrix columns mapping 65 70 66 71 // -------------------------------------------------------------------------- … … 75 80 fTitle = title ? title : "Histograms for Disp"; 76 81 77 fSelectedPos = 1; // default MHDisp flag (selects Correct Disp s rcpos)82 fSelectedPos = 1; // default MHDisp flag (selects Correct Disp source position solution) 78 83 79 84 fMatrix = NULL; 85 86 // initialize mapping array dimension to the number of columns of fMatrix 87 fMap.Set(kTotVar); 80 88 81 89 //-------------------------------------------------- … … 110 118 fSkymapXY->SetYTitle("Y Disp source position [deg]"); 111 119 112 fHist Chi2 = new TH1F("fHistChi2" ,120 fHistMinPar = new TH1F("fHistMinPar" , 113 121 "Distance^2 between Disp and real srcpos", 100, 0., 2.); 114 fHist Chi2->SetDirectory(NULL);115 fHist Chi2->UseCurrentStyle();116 fHist Chi2->SetXTitle("Chi^2 = distance^2 Disp to real srcpos [deg^2]");117 fHist Chi2->SetYTitle("# events");122 fHistMinPar->SetDirectory(NULL); 123 fHistMinPar->UseCurrentStyle(); 124 fHistMinPar->SetXTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]"); 125 fHistMinPar->SetYTitle("# events"); 118 126 119 127 fHistDuDv = new TH2F("fHistDuDv", … … 125 133 fHistDuDv->SetYTitle("Du = longitudinal distance [deg]"); 126 134 127 fHist Chi2Energy = new TH2F("fHistChi2Energy",128 " Chi^2vs. Energy", 50, 1., 3., 100, 0., 2.);129 fHist Chi2Energy->SetDirectory(NULL);130 fHist Chi2Energy->UseCurrentStyle();131 fHist Chi2Energy->SetXTitle("log10(Energy) [GeV]");132 fHist Chi2Energy->SetYTitle("Chi^2 = distance^2 Disp to real srcpos [deg^2]");133 134 fHist Chi2Size = new TH2F("fHistChi2Size",135 " Chi^2vs. Size", 50, 2., 4., 100, 0., 2.);136 fHist Chi2Size->SetDirectory(NULL);137 fHist Chi2Size->UseCurrentStyle();138 fHist Chi2Size->SetXTitle("log10(Size) [#phot]");139 fHist Chi2Size->SetYTitle("Chi^2 = distance^2 Disp to real srcpos [deg^2]");135 fHistMinParEnergy = new TH2F("fHistMinParEnergy", 136 "Minimization parameter vs. Energy", 50, 1., 3., 100, 0., 2.); 137 fHistMinParEnergy->SetDirectory(NULL); 138 fHistMinParEnergy->UseCurrentStyle(); 139 fHistMinParEnergy->SetXTitle("log10(Energy) [GeV]"); 140 fHistMinParEnergy->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]"); 141 142 fHistMinParSize = new TH2F("fHistMinParSize", 143 "Minimization parameter vs. Size", 50, 2., 4., 100, 0., 2.); 144 fHistMinParSize->SetDirectory(NULL); 145 fHistMinParSize->UseCurrentStyle(); 146 fHistMinParSize->SetXTitle("log10(Size) [#phot]"); 147 fHistMinParSize->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]"); 140 148 141 149 fHistDuEnergy = new TH2F("fHistDuEnergy", … … 170 178 "Fraction events srcpos well assign vs. Size", 50, 2., 4., 0., 1.); 171 179 fEvCorrAssign->SetDirectory(NULL); 172 fEvCorrAssign-> UseCurrentStyle();180 fEvCorrAssign->SetStats(0); 173 181 fEvCorrAssign->SetXTitle("log10(Size) [#phot]"); 174 182 fEvCorrAssign->SetYTitle("Fraction of events with srcpos well assign"); … … 186 194 delete fHistcosZA; 187 195 delete fSkymapXY; 188 delete fHist Chi2;196 delete fHistMinPar; 189 197 delete fHistDuDv; 190 delete fHist Chi2Energy;191 delete fHist Chi2Size;198 delete fHistMinParEnergy; 199 delete fHistMinParSize; 192 200 delete fHistDuEnergy; 193 201 delete fHistDuSize; … … 204 212 Bool_t MHDisp::SetupFill(const MParList *pList) 205 213 { 206 // reset all histograms and Chi^2computing variables214 // reset all histograms and Minimization parameter computing variables 207 215 // before each new eventloop 208 216 fNumEv = 0; 209 fSumChi2 = 0.; 210 fChi2 = 0.; 217 fSumMinPar = 0.; 218 fMinPar = (MParameterD*)const_cast<MParList*>(pList)->FindCreateObj("MParameterD", "MinimizationParameter"); 219 if (!fMinPar) 220 { 221 *fLog << err << "MParameterD (MinimizationParameter) not found and could not be created... aborting." 222 << endl; 223 return kFALSE; 224 } 225 fMinPar->SetVal(0); 211 226 212 227 fHistEnergy->Reset(); … … 214 229 fHistcosZA->Reset(); 215 230 fSkymapXY->Reset(); 216 fHist Chi2->Reset();231 fHistMinPar->Reset(); 217 232 fHistDuDv->Reset(); 218 fHist Chi2Energy->Reset();219 fHist Chi2Size->Reset();233 fHistMinParEnergy->Reset(); 234 fHistMinParSize->Reset(); 220 235 fHistDuEnergy->Reset(); 221 236 fHistDuSize->Reset(); … … 250 265 // if fMatrix exists, skip preprocessing and just read events from matrix; 251 266 // if doesn't exist, read variables values from containers, so look for them 267 cout << "MHDisp::SetupFill: fMatrix = " << fMatrix << endl; 268 252 269 if (fMatrix) 253 270 return kTRUE; … … 291 308 if (!fPointing) 292 309 { 293 *fLog << err << "MPointingPos not found... " 294 << "MMcEvt is going to be used to get Theta and Phi." 295 << endl; 296 // return kFALSE; 310 *fLog << err << "MPointingPos not found... aborting." << endl; 311 return kFALSE; 297 312 } 298 313 … … 306 321 // 307 322 // Set which selection algorithm for the Disp estimated source position 308 // we want to follow when filling the histograms:323 // solutions we want to follow when filling the histograms: 309 324 // * iflag == 1 --> Correct source position, the closest to the real srcpos 310 325 // (only applicable to MC or well known source real data) … … 323 338 // 324 339 // Sets the Matrix and the array of mapped values for each Matrix column 325 // (see MDispCalc)326 340 // 327 341 void MHDisp::SetMatrixMap(MHMatrix *matrix, TArrayI &map) … … 334 348 // -------------------------------------------------------------------------- 335 349 // 350 // Returns the Matrix and the mapped value for each Matrix column 351 // 352 void MHDisp::GetMatrixMap(MHMatrix* &matrix, TArrayI &map) 353 { 354 map = fMap; 355 matrix = fMatrix; 356 } 357 358 359 // -------------------------------------------------------------------------- 360 // 361 // You can use this function if you want to use a MHMatrix instead of the 362 // given containers for the Disp optimization. This function adds all 363 // necessary columns to the given matrix. Afterwards, you should fill 364 // the matrix with the corresponding data (eg from a file by using 365 // MHMatrix::Fill). Then, if you loop through the matrix (eg using 366 // MMatrixLoop), MHDisp::Fill will take the values from the matrix 367 // instead of the containers. 368 // 369 void MHDisp::InitMapping(MHMatrix *mat) 370 { 371 if (fMatrix) 372 return; 373 374 fMatrix = mat; 375 376 fMap[kX] = fMatrix->AddColumn("MSrcPosCam.fX"); 377 fMap[kY] = fMatrix->AddColumn("MSrcPosCam.fY"); 378 fMap[kMeanX] = fMatrix->AddColumn("MHillas.fMeanX"); 379 fMap[kMeanY] = fMatrix->AddColumn("MHillas.fMeanY"); 380 fMap[kDelta] = fMatrix->AddColumn("MHillas.fDelta"); 381 382 fMap[kSize] = fMatrix->AddColumn("MHillas.fSize"); 383 384 fMap[kM3Long] = fMatrix->AddColumn("MHillasExt.fM3Long"); 385 fMap[kAsym] = fMatrix->AddColumn("MHillasExt.fAsym"); 386 387 fMap[kEnergy] = fMatrix->AddColumn("MMcEvt.fEnergy"); 388 fMap[kImpact] = fMatrix->AddColumn("MMcEvt.fImpact"); 389 fMap[kLongitmax] = fMatrix->AddColumn("MMcEvt.fLongitmax"); 390 391 fMap[kZd] = fMatrix->AddColumn("MPointingPos.fZd"); 392 fMap[kAz] = fMatrix->AddColumn("MPointingPos.fAz"); 393 } 394 395 396 // -------------------------------------------------------------------------- 397 // 336 398 // Returns a mapped value from the Matrix 337 399 // … … 349 411 // -------------------------------------------------------------------------- 350 412 // 351 // Fill the histograms and sum up the Chi^2 outcome of each processed event 413 // Fill the histograms and sum up the Minimization paramter outcome 414 // of each processed event 352 415 // 353 416 Bool_t MHDisp::Fill(const MParContainer *par, const Stat_t w) … … 356 419 Double_t impact = 0.; 357 420 Double_t xmax = 0.; 358 Double_t theta = 0.;359 Double_t phi = 0.;360 421 361 422 if ( fMatrix || (!fMatrix && fMcEvt) ) 362 423 { 363 energy = fMatrix ? GetVal(13) : fMcEvt->GetEnergy(); 364 impact = fMatrix ? GetVal(14) : fMcEvt->GetImpact(); 365 xmax = fMatrix ? GetVal(15) : fMcEvt->GetLongitmax(); 366 367 if (fPointing) 368 { 369 theta = fMatrix ? GetVal(16) : fPointing->GetZd(); 370 phi = fMatrix ? GetVal(17) : fPointing->GetAz(); 371 } 372 else 373 { 374 theta = fMatrix ? GetVal(16) : fMcEvt->GetTelescopeTheta()*kRad2Deg; 375 phi = fMatrix ? GetVal(17) : fMcEvt->GetTelescopePhi()*kRad2Deg; 376 } 424 energy = fMatrix ? GetVal(kEnergy) : fMcEvt->GetEnergy(); 425 impact = fMatrix ? GetVal(kImpact) : fMcEvt->GetImpact(); 426 xmax = fMatrix ? GetVal(kLongitmax) : fMcEvt->GetLongitmax(); 377 427 } 378 428 else 379 429 *fLog << "No MMcEvt container available (no Energy,ImpactPar or Xmax)" << endl; 380 430 381 Double_t xsrcpos0 = fMatrix ? GetVal(0) : fSrcPos->GetX(); 382 Double_t ysrcpos0 = fMatrix ? GetVal(1) : fSrcPos->GetY(); 383 Double_t xmean0 = fMatrix ? GetVal(2) : fHil->GetMeanX(); 384 Double_t ymean0 = fMatrix ? GetVal(3) : fHil->GetMeanY(); 385 Double_t delta = fMatrix ? GetVal(4) : fHil->GetDelta(); 386 387 Double_t size = fMatrix ? GetVal(5) : fHil->GetSize(); 388 // Double_t width0 = fMatrix ? GetVal(6) : fHil->GetWidth(); 389 // Double_t length0 = fMatrix ? GetVal(7) : fHil->GetLength(); 390 391 // Double_t conc = fMatrix ? GetVal(8) : fNewPar->GetConc(); 392 // Double_t leakage1 = fMatrix ? GetVal(9) : fNewPar->GetLeakage1(); 393 // Double_t leakage2 = fMatrix ? GetVal(10) : fNewPar->GetLeakage2(); 394 395 Double_t m3long = fMatrix ? GetVal(11) : fHilExt->GetM3Long(); 396 Double_t asym = fMatrix ? GetVal(12) : fHilExt->GetAsym(); 431 Double_t theta = fMatrix ? GetVal(kZd) : fPointing->GetZd(); 432 // Double_t phi = fMatrix ? GetVal(kAz) : fPointing->GetAz(); 433 434 Double_t xsrcpos0 = fMatrix ? GetVal(kX) : fSrcPos->GetX(); 435 Double_t ysrcpos0 = fMatrix ? GetVal(kY) : fSrcPos->GetY(); 436 Double_t xmean0 = fMatrix ? GetVal(kMeanX) : fHil->GetMeanX(); 437 Double_t ymean0 = fMatrix ? GetVal(kMeanY) : fHil->GetMeanY(); 438 Double_t delta = fMatrix ? GetVal(kDelta) : fHil->GetDelta(); 439 440 Double_t size = fMatrix ? GetVal(kSize) : fHil->GetSize(); 441 442 Double_t m3long = fMatrix ? GetVal(kM3Long) : fHilExt->GetM3Long(); 443 Double_t asym = fMatrix ? GetVal(kAsym) : fHilExt->GetAsym(); 397 444 398 445 //------------------------------------------ 399 446 // convert to deg 400 // Double_t width = width0 * fMm2Deg;401 // Double_t length = length0 * fMm2Deg;402 447 Double_t xsrcpos = xsrcpos0 * fMm2Deg; 403 448 Double_t ysrcpos = ysrcpos0 * fMm2Deg; … … 453 498 // Distance between estimated Disp and real source position 454 499 Double_t d2 = (xdisp-xsrcpos)*(xdisp-xsrcpos) + (ydisp-ysrcpos)*(ydisp-ysrcpos); 455 fHist Chi2->Fill(d2);500 fHistMinPar->Fill(d2); 456 501 457 502 // Longitudinal and transversal distances between Disp and real source positon … … 465 510 fHistcosZA->Fill(cos(theta/kRad2Deg)); 466 511 467 // to check the size dependence of the optimization468 fHist Chi2Energy->Fill(log10(energy),d2);469 fHist Chi2Size->Fill(log10(size),d2);512 // to check the size and energy dependence of the optimization 513 fHistMinParEnergy->Fill(log10(energy),d2); 514 fHistMinParSize->Fill(log10(size),d2); 470 515 fHistDuEnergy->Fill(log10(energy),Du); 471 516 fHistDuSize->Fill(log10(size),Du); … … 473 518 fHistDvSize->Fill(log10(size),Dv); 474 519 475 // variables for Chi^2calculation (= d^2)520 // variables for the Minimization parameter calculation (= d^2) 476 521 fNumEv += 1; 477 fSum Chi2+= d2;522 fSumMinPar += d2; 478 523 479 524 return kTRUE; … … 483 528 // -------------------------------------------------------------------------- 484 529 // 485 // Calculates the final Chi^2of the Disp optimization530 // Calculates the final Minimization parameter of the Disp optimization 486 531 // 487 532 Bool_t MHDisp::Finalize() 488 533 { 489 f Chi2 = fSumChi2/fNumEv;534 fMinPar->SetVal(fSumMinPar/fNumEv); 490 535 *fLog << endl; 491 *fLog << "MHDisp::Finalize: Sum Chi2, NumEv = " << fSumChi2<< ", " << fNumEv << endl;492 *fLog << "MHDisp::Finalize: Final Chi2 = " << fChi2<< endl;493 494 f Chi2 = fHistChi2->GetMean();495 *fLog << "MHDisp::Finalize: Final Chi2 = " << fChi2<< endl;536 *fLog << "MHDisp::Finalize: SumMinPar, NumEv = " << fSumMinPar << ", " << fNumEv << endl; 537 *fLog << "MHDisp::Finalize: Final MinPar = " << fMinPar->GetVal() << endl; 538 539 fMinPar->SetVal(fHistMinPar->GetMean()); 540 *fLog << "MHDisp::Finalize: Final MinPar = " << fMinPar->GetVal() << endl; 496 541 497 542 SetReadyToSave(); … … 542 587 pad->cd(4); 543 588 gPad->SetBorderMode(0); 544 fHist Chi2->SetTitleOffset(1.2,"Y");545 fHist Chi2->DrawClone(opt);546 fHist Chi2->SetBit(kCanDelete);547 gPad->Modified(); 548 549 TProfile *prof Chi2Energy = fHistChi2Energy->ProfileX("Chi^2vs. Energy",0,99999,"s");550 prof Chi2Energy->SetXTitle("log10(Energy) [GeV]");551 prof Chi2Energy->SetYTitle("Chi^2 = distance^2 Disp to real srcpos [deg^2]");589 fHistMinPar->SetTitleOffset(1.2,"Y"); 590 fHistMinPar->DrawClone(opt); 591 fHistMinPar->SetBit(kCanDelete); 592 gPad->Modified(); 593 594 TProfile *profMinParEnergy = fHistMinParEnergy->ProfileX("Minimization parameter vs. Energy",0,99999,"s"); 595 profMinParEnergy->SetXTitle("log10(Energy) [GeV]"); 596 profMinParEnergy->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]"); 552 597 pad->cd(5); 553 598 gPad->SetBorderMode(0); 554 profChi2Energy->SetTitleOffset(1.2,"Y"); 555 profChi2Energy->DrawClone(opt); 556 profChi2Energy->SetBit(kCanDelete); 557 gPad->Modified(); 558 559 TProfile *profChi2Size = fHistChi2Size->ProfileX("Chi^2 vs. Size",0,99999,"s"); 560 profChi2Size->SetXTitle("log10(Size) [#phot]"); 561 profChi2Size->SetYTitle("Chi^2 = distance^2 Disp to real srcpos [deg^2]"); 599 profMinParEnergy->SetTitleOffset(1.2,"Y"); 600 profMinParEnergy->SetStats(0); 601 profMinParEnergy->DrawClone(opt); 602 profMinParEnergy->SetBit(kCanDelete); 603 gPad->Modified(); 604 605 TProfile *profMinParSize = fHistMinParSize->ProfileX("Minimization parameter vs. Size",0,99999,"s"); 606 profMinParSize->SetXTitle("log10(Size) [#phot]"); 607 profMinParSize->SetYTitle("Minimization parameter = d^2 Disp to real srcpos [deg^2]"); 562 608 pad->cd(6); 563 609 gPad->SetBorderMode(0); 564 profChi2Size->SetTitleOffset(1.2,"Y"); 565 profChi2Size->DrawClone(opt); 566 profChi2Size->SetBit(kCanDelete); 610 profMinParSize->SetTitleOffset(1.2,"Y"); 611 profMinParSize->SetStats(0); 612 profMinParSize->DrawClone(opt); 613 profMinParSize->SetBit(kCanDelete); 567 614 gPad->Modified(); 568 615 … … 604 651 gPad->SetBorderMode(0); 605 652 profDuEnergy->SetTitleOffset(1.2,"Y"); 653 profDuEnergy->SetStats(0); 606 654 profDuEnergy->DrawClone(opt); 607 655 profDuEnergy->SetBit(kCanDelete); … … 614 662 gPad->SetBorderMode(0); 615 663 profDuSize->SetTitleOffset(1.2,"Y"); 664 profDuSize->SetStats(0); 616 665 profDuSize->DrawClone(opt); 617 666 profDuSize->SetBit(kCanDelete); … … 634 683 gPad->SetBorderMode(0); 635 684 profDvEnergy->SetTitleOffset(1.2,"Y"); 685 profDvEnergy->SetStats(0); 636 686 profDvEnergy->DrawClone(opt); 637 687 profDvEnergy->SetBit(kCanDelete); … … 644 694 gPad->SetBorderMode(0); 645 695 profDvSize->SetTitleOffset(1.2,"Y"); 696 profDvSize->SetStats(0); 646 697 profDvSize->DrawClone(opt); 647 698 profDvSize->SetBit(kCanDelete); -
trunk/MagicSoft/Mars/mtemp/mifae/library/MHDisp.h
r5671 r5904 21 21 class MPointingPos; 22 22 class MHMatrix; 23 class MParameterD; 23 24 24 25 class MHDisp : public MH … … 36 37 TString fImageParDispName; 37 38 38 Int_t fSelectedPos; // flag to select which Disp estimatedposition39 // we want to fill the histograms (see Set function)39 Int_t fSelectedPos; // flag to select which of the two Disp source position 40 // solutions we want to fill the histograms (see Set function) 40 41 41 42 TH1F *fHistEnergy; // Energy distribution of events … … 43 44 TH1F *fHistcosZA; // cosinus Zenith angle distribution of events 44 45 TH2F *fSkymapXY; // 2D histogram for Disp estimated source positions 45 TH1F *fHist Chi2; // Histogram of the event Chi^2 (= d^2 = distance^246 // between Disp estimated and true source position)46 TH1F *fHistMinPar; // Histogram of the event Minimization Parameter (= d^2 = 47 // = distance^2 between Disp estimated and true source position) 47 48 TH2F *fHistDuDv; // Distribution of longitudinal (Du) and transversal 48 49 // (Dv) distances between Disp and true source position 49 TH2F *fHist Chi2Energy; // Chi^2(= d^2) vs. Energy50 TH2F *fHist Chi2Size; // Chi^2(= d^2) vs. Size50 TH2F *fHistMinParEnergy; // Minimization Parameter (= d^2) vs. Energy 51 TH2F *fHistMinParSize; // Minimization Parameter (= d^2) vs. Size 51 52 TH2F *fHistDuEnergy; // Du vs. Energy 52 53 TH2F *fHistDuSize; // Du vs. Size … … 58 59 Double_t fMm2Deg; // conversion factor from mm to deg 59 60 60 MHMatrix *fMatrix; // matrix storing variables needed for Disp optimization61 TArrayI fMap; // array storing the matrix mapping of columns defined62 // in MDispCalc::InitMapping61 MHMatrix *fMatrix; // matrix storing variables needed for the Disp optimization 62 TArrayI fMap; // array storing the matrix mapping column numbers corresponding 63 // to each variable added to fMatrix 63 64 64 65 Double_t GetVal(Int_t i) const; 65 66 66 67 Int_t fNumEv; // total number of events 67 Double_t fSum Chi2; // current sum of Chi^268 Double_t fChi2; // final Chi^2of the Disp optimization68 Double_t fSumMinPar; // current sum of the minimization parameter 69 MParameterD *fMinPar; // final minimization parameters of the Disp optimization 69 70 70 71 public: … … 81 82 82 83 void SetMatrixMap(MHMatrix *matrix, TArrayI &map); 84 void GetMatrixMap(MHMatrix* &matrix, TArrayI &map); // get matrix and its mapping array 83 85 84 Double_t GetChi2() { return fChi2; } 86 void InitMapping(MHMatrix *mat); // define the matrix of variables 87 // needed for the Disp optimization 85 88 86 89 TH1F *GetHistEnergy() { return fHistEnergy; } … … 88 91 TH1F *GetHistcosZA() { return fHistcosZA; } 89 92 TH2F *GetSkymapXY() { return fSkymapXY; } 90 TH1F *GetHist Chi2() { return fHistChi2; }93 TH1F *GetHistMinPar() { return fHistMinPar; } 91 94 TH2F *GetHistDuDv() { return fHistDuDv; } 92 TH2F *GetHist Chi2Energy() { return fHistChi2Energy; }93 TH2F *GetHist Chi2Size() { return fHistChi2Size; }95 TH2F *GetHistMinParEnergy() { return fHistMinParEnergy; } 96 TH2F *GetHistMinParSize() { return fHistMinParSize; } 94 97 TH2F *GetHistDuEnergy() { return fHistDuEnergy; } 95 98 TH2F *GetHistDuSize() { return fHistDuSize; } … … 100 103 void Draw(Option_t *opt=""); 101 104 102 ClassDef(MHDisp, 1) // Container holding the Histograms for Disp 105 ClassDef(MHDisp, 1) // Container holding the Histograms for Disp and 106 // the parameter to minimize in the Disp optimization 103 107 }; 104 108 -
trunk/MagicSoft/Mars/mtemp/mifae/library/Makefile
r5672 r5904 74 74 MTopologyCalc.cc \ 75 75 MImageParDisp.cc \ 76 MDisp .cc \76 MDispParameters.cc \ 77 77 MDispCalc.cc \ 78 78 MHDisp.cc \
Note:
See TracChangeset
for help on using the changeset viewer.