Changeset 861 for trunk/MagicSoft/Mars/mmontecarlo
- Timestamp:
- 07/10/01 12:41:13 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mmontecarlo
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.cc
r859 r861 24 24 \* ======================================================================== */ 25 25 26 /////////////////////////////////////////////////////////////////////////// //27 // //28 // MMcThresholdCalc //29 // //30 // Input Containers: //31 // MMcEvt //32 // //33 // Output Containers: //34 // M McTrig;*, MHMcEnergy;* //35 // //26 /////////////////////////////////////////////////////////////////////////// 27 // 28 // MMcThresholdCalc 29 // 30 // Input Containers: 31 // MMcEvt, MMcTrig;* 32 // 33 // Output Containers: 34 // MHMcEnergies 35 // 36 36 ///////////////////////////////////////////////////////////////////////////// 37 37 … … 52 52 ClassImp(MMcThresholdCalc) 53 53 54 // -------------------------------------------------------------------------- 55 // 56 // Default Constructor. 57 // 54 58 MMcThresholdCalc::MMcThresholdCalc(const UInt_t dim, const char* name, 55 59 const char* title) : fDimension(dim) … … 58 62 *fTitle = title ? title : "Task to calculate the energy threshold from Monte Carlo"; 59 63 64 // Arrays of MMcTrig* and MHMcEnergy* are created in order to be 65 // able to work with root files with several trigger conditions. 60 66 fMcTrig = new MMcTrig*[fDimension]; 61 67 fHMcEnergy = new MHMcEnergy*[fDimension]; … … 66 72 } 67 73 74 // ------------------------------------------------------------------------- 75 // 76 // Default Destructor. 77 // 68 78 MMcThresholdCalc::~MMcThresholdCalc() 69 79 { … … 81 91 // connect Monte Carlo data with this task 82 92 93 // This task has into accout if the root file has one trigger 94 // condition (MMcTrig) or severl of them (MMcTrig;#.) 95 83 96 fMcEvt = (MMcEvt*)pList->FindObject("MMcEvt"); 84 97 if (!fMcEvt) … … 93 106 { 94 107 if (fDimension>1) 95 sprintf(auxname+7, ";%i ", i+1);108 sprintf(auxname+7, ";%i.", i+1); 96 109 97 110 fMcTrig[i] = (MMcTrig*)pList->FindObject(auxname); … … 110 123 for (unsigned int i=0; i<fDimension; i++) 111 124 { 112 if (fDimension>1 )113 sprintf(auxname+10, ";%i", i +1);125 if (fDimension>1&&i!=0) 126 sprintf(auxname+10, ";%i", i); 114 127 115 128 fHMcEnergy[i] = (MHMcEnergy*)pList->FindObject(auxname); … … 119 132 *fLog << dbginf << "'" << auxname << "' not found in list... creating." << endl; 120 133 121 fHMcEnergy[i] = new MHMcEnergy(fDimension>1 ? i+1: 0);134 fHMcEnergy[i] = new MHMcEnergy(fDimension>1&&i!=0 ? i : 0); 122 135 fMustDelete[i] = kTRUE; 123 136 pList->AddToList(fHMcEnergy[i]); … … 129 142 Bool_t MMcThresholdCalc::Process() 130 143 { 144 145 // The histograms are filled with log10 of the energy for triggered 146 // events and weighted with 1/E because it is needed the dN/dE vs. logE 147 // distribution to get the energy threshold. 148 131 149 const Float_t energy = fMcEvt->GetEnergy(); 132 150 const Float_t lg10 = log10(energy); … … 147 165 { 148 166 // fit the energy distribution to get the threshold 167 // Some iterations are done to be sure the fit parameters converge. 149 168 150 169 const Float_t sqrt2 = sqrt(2); … … 152 171 for (unsigned int i=0; i<fDimension; i++) 153 172 { 154 MHMcEnergy &h = *fHMcEnergy[i]; 173 Float_t peak; 174 Float_t sigma; 155 175 156 const Float_t peak = h.GetGaussPeak(); 157 const Float_t sigma = h.GetGaussSigma(); 158 159 h.Fit(1, 3); 160 h.Fit(peak - 2. *sigma, peak + 2. *sigma); 161 h.Fit(peak - sqrt2*sigma, peak + sqrt2*sigma); 176 fHMcEnergy[i]->Fit(1, 3); 177 178 peak = fHMcEnergy[i]->GetGaussPeak(); 179 sigma = fHMcEnergy[i]->GetGaussSigma(); 180 fHMcEnergy[i]->Fit(peak - 2. *sigma, peak + 2. *sigma); 181 182 peak = fHMcEnergy[i]->GetGaussPeak(); 183 sigma = fHMcEnergy[i]->GetGaussSigma(); 184 fHMcEnergy[i]->Fit(peak - sqrt2*sigma, peak + sqrt2*sigma); 162 185 } 163 186 return kTRUE; -
trunk/MagicSoft/Mars/mmontecarlo/MMcThresholdCalc.h
r859 r861 39 39 Bool_t PostProcess(); 40 40 41 ClassDef(MMcThresholdCalc, 0) // Task to fill the energy threshold information41 ClassDef(MMcThresholdCalc, 0) // Task to compute the energy threshold 42 42 }; 43 43
Note:
See TracChangeset
for help on using the changeset viewer.