Changeset 1488 for trunk/MagicSoft
- Timestamp:
- 08/08/02 09:15:26 (22 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/manalysis/MHillasSrc.cc
r1434 r1488 116 116 } 117 117 118 fDist = dist;119 // [mm]120 118 // 121 119 // Calculate Alpha and Cosda = cos(d,a) … … 123 121 // a head-tail information 124 122 // 125 const Double_t arg = (sy-tand*sx) / ( fDist*sqrt(tand*tand+1));123 const Double_t arg = (sy-tand*sx) / (dist*sqrt(tand*tand+1)); 126 124 127 125 fAlpha = asin(arg)*kRad2Deg; // [deg] 128 fCosDeltaAlpha = fHeadTail/fDist; // [1] 126 fCosDeltaAlpha = fHeadTail/dist; // [1] 127 fDist = dist; // [mm] 129 128 130 129 SetReadyToSave(); -
trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.cc
r1337 r1488 26 26 ///////////////////////////////////////////////////////////////////////////// 27 27 // 28 // MMultiDimDistCalc 29 // 30 // Calculated a multidimensional distance. It calculates the distance to 31 // all vectors in a given matrix describing Gammas and another one 32 // describing Hadrons (non gammas). The shortest distances are avaraged. 33 // How many distances are used for avaraging can be specified in the 34 // constructor. 28 // MMultiDimDistCalc 29 // 30 // Calculated a multidimensional distance. It calculates the distance to 31 // all vectors in a given matrix describing Gammas and another one 32 // describing Hadrons (non gammas). The shortest distances are avaraged. 33 // How many distances are used for avaraging can be specified in the 34 // constructor. 35 // 36 // * If you want to use the kernel function to calculate the distance use: 37 // MMultiDimDistCalc::SetUseKernelMethod(); 38 // * To use only the n next neighbors for your calculation use: 39 // MMultiDimDistCalc::SetUseNumRows(n); 40 // * To use all reference events set the number to 0 <default> 35 41 // 36 42 //////////////////////////////////////////////////////////////////////////// 37 43 #include "MMultiDimDistCalc.h" 38 44 45 #include <fstream.h> 46 39 47 #include "MHMatrix.h" // must be before MLogManip.h 40 48 … … 49 57 ClassImp(MMultiDimDistCalc); 50 58 59 static const TString gsDefName = "MMultiDimDistCalc"; 60 static const TString gsDefTitle = "Composite Probabilities Loop 1/2"; 51 61 // -------------------------------------------------------------------------- 52 62 // … … 54 64 // avaraging in CalcDist 55 65 // 56 MMultiDimDistCalc::MMultiDimDistCalc( Int_t num,const char *name, const char *title)57 : fNum( num)66 MMultiDimDistCalc::MMultiDimDistCalc(const char *name, const char *title) 67 : fNum(0), fUseKernel(kFALSE) 58 68 { 59 69 // 60 70 // set the name and title of this object 61 71 // 62 fName = name ? name : "MMultiDimDistCalc";63 fTitle = title ? title : "Composite Probabilities Loop 1/2";72 fName = name ? name : gsDefName.Data(); 73 fTitle = title ? title : gsDefTitle.Data(); 64 74 65 75 fData = new TList; … … 152 162 event(n++) = data->GetValue(); 153 163 154 Double_t dg = fMGammas->CalcDist(event, fNum); 155 Double_t dh = fMHadrons->CalcDist(event, fNum); 156 164 Double_t numg = fNum; 165 Double_t numh = fNum; 166 if (fNum==0) 167 { 168 numg = fMGammas->GetM().GetNrows(); 169 numh = fMHadrons->GetM().GetNrows(); 170 } 171 if (fUseKernel) 172 { 173 numg = -numg; 174 numh = -numh; 175 } 176 177 Double_t dg = fMGammas->CalcDist(event, numg); 178 Double_t dh = fMHadrons->CalcDist(event, numh); 179 180 //fHadroness->SetHadroness(dg/(dg+dh)); 157 181 fHadroness->SetHadroness(exp(-dh/dg)); 158 182 … … 160 184 } 161 185 186 void MMultiDimDistCalc::StreamPrimitive(ofstream &out) const 187 { 188 out << " MMultiDimDist " << GetUniqueName(); 189 190 if (fName!=gsDefName || fTitle!=gsDefTitle) 191 { 192 out << "(\"" << fName << "\""; 193 if (fTitle!=gsDefTitle) 194 out << ", \"" << fTitle << "\")"; 195 } 196 out << ";" << endl; 197 198 if (fNum!=0) 199 out << " " << GetUniqueName() << ".SetUseNumRows(" << fNum << ");" << endl; 200 if (fUseKernel) 201 out << " " << GetUniqueName() << ".SetUseKernelMethod();" << endl; 202 } -
trunk/MagicSoft/Mars/manalysis/MMultiDimDistCalc.h
r1337 r1488 13 13 { 14 14 private: 15 Int_t fNum; // number of distances used for an avarage 15 Int_t fNum; // number of distances used for an avarage 16 Bool_t fUseKernel; // Flag whether kernel method should be used 16 17 17 18 MHMatrix *fMGammas; //! Gammas describing matrix … … 22 23 TList *fData; //! Used to store the MDataChains to get the event values 23 24 25 void StreamPrimitive(ofstream &out) const; 26 24 27 public: 25 MMultiDimDistCalc( Int_t num,const char *name=NULL, const char *title=NULL);28 MMultiDimDistCalc(const char *name=NULL, const char *title=NULL); 26 29 ~MMultiDimDistCalc(); 30 31 void SetUseNumRows(UShort_t n=0) { fNum = n; } 32 void SetUseKernelMethod(Bool_t k=kTRUE) { fUseKernel = k; } 27 33 28 34 Bool_t PreProcess(MParList *plist); 29 35 Bool_t Process(); 30 36 31 ClassDef(MMultiDimDistCalc, 1) // Task to calculate multidimensional distances37 ClassDef(MMultiDimDistCalc, 0) // Task to calculate multidimensional distances 32 38 }; 33 39 -
trunk/MagicSoft/Mars/mdata/DataLinkDef.h
r1287 r1488 6 6 7 7 #pragma link C++ class MData+; 8 #pragma link C++ class MDataArray+; 8 9 #pragma link C++ class MDataList+; 9 10 #pragma link C++ class MDataValue+; -
trunk/MagicSoft/Mars/mdata/Makefile
r1287 r1488 32 32 33 33 SRCFILES = MData.cc \ 34 MDataArray.cc \ 34 35 MDataMember.cc \ 35 36 MDataValue.cc \ -
trunk/MagicSoft/Mars/mfileio/MWriteRootFile.cc
r1483 r1488 49 49 ClassImp(MWriteRootFile); 50 50 51 static const TString gsDefName = "MWriteRootFile"; 52 static const TString gsDefTitle = "Task which writes a root-output file"; 51 53 // -------------------------------------------------------------------------- 52 54 // … … 56 58 MWriteRootFile::MWriteRootFile() : fOut(NULL) 57 59 { 58 fName = "MWriteRootFile";59 fTitle = "Task which writes a root-output file";60 fName = gsDefName; 61 fTitle = gsDefTitle; 60 62 61 63 fBranches.SetOwner(); … … 76 78 const char *title) 77 79 { 78 fName = name ? name : "MWriteRootFile";79 fTitle = title ? title : "Task which writes a root-output file";80 fName = name ? name : gsDefName.Data(); 81 fTitle = title ? title : gsDefTitle.Data(); 80 82 81 83 // … … 409 411 out << fOut->GetOption() << "\", \""; 410 412 out << fOut->GetTitle() << "\", "; 411 out << fOut->GetCompressionLevel() << ", \""; 412 out << fName << "\", \"" << fTitle << "\");" << endl;; 413 out << fOut->GetCompressionLevel(); 414 415 if (fName!=gsDefName || fTitle!=gsDefTitle) 416 { 417 out << ", \"" << fName << "\""; 418 if (fTitle!=gsDefTitle) 419 out << ", \"" << fTitle << "\""; 420 } 421 out << ");" << endl; 422 413 423 414 424 MRootFileBranch *entry; … … 416 426 while ((entry=(MRootFileBranch*)Next())) 417 427 { 428 out << " " << GetUniqueName() << ".AddContainer("; 429 418 430 if (entry->GetContainer()) 419 431 { … … 424 436 out << "\"" << entry->GetContName() << "\""; 425 437 426 out << ", \"" << entry->GetName() << "\", \""; 427 out << entry->GetTitle() << "\");" << endl; 438 out << ", \"" << entry->GetName() << "\""; 439 if ((TString)entry->GetTitle()!="") 440 out << ", \"" << entry->GetTitle() << "\""; 441 442 out <<");" << endl; 428 443 } 429 444 }
Note:
See TracChangeset
for help on using the changeset viewer.