- Timestamp:
- 07/23/01 13:54:06 (23 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r892 r893 1 1 -*-*- END -*-*- 2 2001/07/23: Thomas Bretz 3 4 * mmontecarlo/MMcThresholdCalc.[cc,h]: 5 - changed PreProcess action to new stylish lists of containers 6 7 * mhist/Makefile: 8 - removed MEnergies.cc 9 10 * mhist/HistLinkDef.h: 11 - removed MEnergies.cc 12 13 14 2 15 2001/07/20: Thomas Bretz 3 16 -
trunk/MagicSoft/Mars/mhist/HistLinkDef.h
r887 r893 11 11 #pragma link C++ class MHStarMap; 12 12 #pragma link C++ class MHMcEnergy; 13 #pragma link C++ class MHMcEnergies;14 13 #pragma link C++ class MHMcCollectionArea; 15 14 #pragma link C++ class MHMcRate; -
trunk/MagicSoft/Mars/mhist/Makefile
r887 r893 39 39 MHMcCollectionArea.cc \ 40 40 MHMcEnergy.cc \ 41 MHMcEnergies.cc \42 41 MHMcRate.cc 43 42 -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
r867 r893 58 58 // Default Constructor. 59 59 // 60 MMcThresholdCalc::MMcThresholdCalc(const UInt_t dim, const char* name, 60 // Specify the number of trigger conditions you want to use. 61 // The default is 0. 62 // 63 // dim < 0: use only condition number dim (eg "MMcTrig;3") 64 // dim = 0: use only condition without a number ("MMcTrig") 65 // dim > 0: use conditions up to dim 66 // 67 MMcThresholdCalc::MMcThresholdCalc(const Int_t dim, const char* name, 61 68 const char* title) : fDimension(dim) 62 69 { 63 70 *fName = name ? name : "MMcThresholdCalc"; 64 71 *fTitle = title ? title : "Task to calculate the energy threshold from Monte Carlo"; 65 66 // Arrays of MMcTrig* and MHMcEnergy* are created in order to be67 // able to work with root files with several trigger conditions.68 fMcTrig = new MMcTrig*[fDimension];69 fHMcEnergy = new MHMcEnergy*[fDimension];70 fMustDelete = new Bool_t[fDimension];71 72 for (unsigned int i=0; i<fDimension; i++)73 fMustDelete[i]=kFALSE;74 72 } 75 73 76 74 // ------------------------------------------------------------------------- 77 75 // 78 // De fault Destructor.76 // Destructor. 79 77 // 80 78 MMcThresholdCalc::~MMcThresholdCalc() 81 79 { 82 for (unsigned int i=0; i<fDimension; i++) 83 if (fMustDelete[i]) 84 delete fHMcEnergy[i]; 80 if (fMcTrig) 81 delete fMcTrig; 85 82 86 delete fMcTrig; 87 delete fHMcEnergy; 88 delete fMustDelete; 83 if (fEnergy) 84 delete fEnergy; 89 85 } 90 86 … … 95 91 Bool_t MMcThresholdCalc::PreProcess(MParList* pList) 96 92 { 93 // 97 94 // This task takes into accout if the root file has one trigger 98 95 // condition (MMcTrig) or severl of them (MMcTrig;#.) … … 105 102 } 106 103 107 char auxname[15]="MMcTrig"; // string to write container names108 104 109 for (unsigned int i=0; i<fDimension; i++) 105 const UInt_t from = fDimension<=0 ? -fDimension : 0; 106 107 if (fDimension<=0) 108 fDimension = -fDimension; 109 110 fMcTrig = new TObjArray(pList->FindObjectList("MMcTrig", from, fDimension)); 111 if (fMcTrig->GetEntriesFast() != fDimension) 110 112 { 111 if (fDimension>1) 112 sprintf(auxname+7, ";%i", i+1); 113 114 fMcTrig[i] = (MMcTrig*)pList->FindObject(auxname); 115 if (fMcTrig[i]) 116 continue; 117 118 *fLog << dbginf << "'MMcTrig"; 119 if (fDimension>1) 120 *fLog << ";" << i+1; 121 *fLog << "' not found... aborting." << endl; 122 113 *fLog << dbginf << "Error: Not all requested MMcTrig objects are available...aborting." << endl; 123 114 return kFALSE; 124 115 } 125 116 126 strcpy(auxname, "MHMcEnergy"); 127 for (unsigned int i=0; i<fDimension; i++) 128 { 129 if (fDimension>1&&i!=0) 130 sprintf(auxname+10, ";%i", i); 131 132 fHMcEnergy[i] = (MHMcEnergy*)pList->FindObject(auxname); 133 if (fHMcEnergy[i]) 134 continue; 135 136 *fLog << dbginf << "'" << auxname << "' not found in list... creating." << endl; 137 138 fHMcEnergy[i] = new MHMcEnergy(fDimension>1&&i!=0 ? i : 0); 139 fMustDelete[i] = kTRUE; 140 pList->AddToList(fHMcEnergy[i]); 141 } 117 fEnergy = new TObjArray(pList->FindCreateObjList("MHMcEnergy", from, fDimension)); 118 if (fMcTrig->GetEntriesFast() != fDimension) 119 return kFALSE; 142 120 143 121 return kTRUE; … … 156 134 const Float_t reciproc = 1./energy; 157 135 158 for ( unsigned int i=0; i<fDimension; i++)159 if ( fMcTrig[i]->GetFirstLevel()>0)160 fHMcEnergy[i]->Fill(lg10, reciproc);136 for (Int_t i=0; i<fDimension; i++) 137 if (GetTrig(i)->GetFirstLevel()>0) 138 GetHEnergy(i)->Fill(lg10, reciproc); 161 139 162 140 return kTRUE; … … 170 148 Bool_t MMcThresholdCalc::PostProcess() 171 149 { 172 for ( unsigned int i=0; i<fDimension; i++)150 for (Int_t i=0; i<fDimension; i++) 173 151 { 174 Float_t peak; 175 Float_t sigma; 152 MHMcEnergy &hist = *GetHEnergy(i); 176 153 177 fHMcEnergy[i]->Fit(1, 3); 178 179 peak = fHMcEnergy[i]->GetGaussPeak(); 180 sigma = fHMcEnergy[i]->GetGaussSigma(); 181 fHMcEnergy[i]->Fit(peak - 2. *sigma, peak + 2. *sigma); 182 183 peak = fHMcEnergy[i]->GetGaussPeak(); 184 sigma = fHMcEnergy[i]->GetGaussSigma(); 185 fHMcEnergy[i]->Fit(peak - fSqrt2*sigma, peak + fSqrt2*sigma); 154 Float_t peak; 155 Float_t sigma; 156 157 hist.Fit(1, 3); 158 159 peak = hist.GetGaussPeak(); 160 sigma = hist.GetGaussSigma(); 161 hist.Fit(peak - 2. *sigma, peak + 2. *sigma); 162 163 peak = hist.GetGaussPeak(); 164 sigma = hist.GetGaussSigma(); 165 hist.Fit(peak - fSqrt2*sigma, peak + fSqrt2*sigma); 186 166 } 187 167 return kTRUE; -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.h
r866 r893 13 13 #include "MTask.h" 14 14 #endif 15 #ifndef ROOT_TObjArray 16 #include "TObjArray.h" 17 #endif 15 18 16 19 class MMcEvt; … … 21 24 { 22 25 private: 23 UInt_t fDimension;26 Int_t fDimension; 24 27 25 28 const MMcEvt *fMcEvt; // Container with Monte Carlo information 26 MMcTrig **fMcTrig; // Container with Monte Carlo trigger information27 MHMcEnergy **fHMcEnergy; // Container where we save the energy (threshold)28 29 29 Bool_t *fMustDelete; // delete indicator for selfcreated energy hists 30 TObjArray *fMcTrig; // Container with Monte Carlo trigger information 31 TObjArray *fEnergy; // Container where we save the energy (threshold) 30 32 31 33 const static Float_t fSqrt2; // sqrt(2) 32 34 35 MMcTrig *GetTrig (UInt_t i) { return (MMcTrig*) (*fMcTrig)[i]; } 36 MHMcEnergy *GetHEnergy(UInt_t i) { return (MHMcEnergy*)(*fEnergy)[i]; } 37 33 38 public: 34 39 35 MMcThresholdCalc(const UInt_t dim = 1,40 MMcThresholdCalc(const Int_t dim = 0, 36 41 const char* name = NULL, const char* title = NULL); 37 42 ~MMcThresholdCalc();
Note:
See TracChangeset
for help on using the changeset viewer.