Changeset 1215 for trunk/MagicSoft/Mars/macros
- Timestamp:
- 01/23/02 19:37:56 (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/macros/flux.C
r1211 r1215 54 54 55 55 MBinning binstheta("BinningTheta"); 56 binstheta.SetEdges( 5, 2.5, 27.5);56 binstheta.SetEdges(7, -2.5, 32.5); 57 57 58 58 MBinning binstime("BinningTime"); … … 72 72 // 73 73 MReadMarsFile reader("Events", "~/data/Gamma*.root"); 74 reader.EnableBranch("MMcEvt.fTheta"); 74 75 75 76 MGeomCamMagic geomcam; … … 168 169 tasklist.PrintStatistics(); 169 170 170 return; 171 172 parlist.FindObject("MHMcCollectionArea")->DrawClone(); 173 parlist.FindObject("MHStarMap")->DrawClone(); 174 175 // ------------ Eff On Time ----------------- 176 177 MHEnergyTime &alltime = *(MHEnergyTime*)parlist.FindObject("AllTime"); 178 MHEnergyTheta &alltheta = *(MHEnergyTheta*)parlist.FindObject("AllTheta"); 179 MHEnergyTime &seltime = *(MHEnergyTime*)parlist.FindObject("SelTime"); 180 MHEnergyTheta &seltheta = *(MHEnergyTheta*)parlist.FindObject("SelTheta"); 181 182 MHEnergyTime collareatime; 183 MHEnergyTheta collareatheta; 184 collareatime.Divide(&seltime, &alltime); 185 collareatheta.Divide(&seltheta, &alltheta); 186 187 MHTimeDiffTime &effontime = *(MHTimeDiffTime*)parlist.FindObject("EffOnTime"); 171 /* 172 parlist.FindObject("HSource")->DrawClone();; 173 parlist.FindObject("MHHillas")->DrawClone(); 174 parlist.FindObject("MHStarMap")->DrawClone(); 175 parlist.FindObject("HAntiSource")->DrawClone(); 176 parlist.FindObject("MHMcCollectionArea")->DrawClone(); 177 */ 178 179 /* 180 MHEnergyTime &alltime = *(MHEnergyTime*)parlist.FindObject("AllTime"); 181 MHEnergyTheta &alltheta = *(MHEnergyTheta*)parlist.FindObject("AllTheta"); 182 MHEnergyTime &seltime = *(MHEnergyTime*)parlist.FindObject("SelTime"); 183 MHEnergyTheta &seltheta = *(MHEnergyTheta*)parlist.FindObject("SelTheta"); 184 185 MHEnergyTime collareatime; 186 MHEnergyTheta collareatheta; 187 collareatime.Divide(&seltime, &alltime); 188 collareatheta.Divide(&seltheta, &alltheta); 189 */ 190 191 MHTimeDiffTime &effontime = *(MHTimeDiffTime*)parlist.FindObject("EffOnTime"); 188 192 MHTimeDiffTheta &effontheta = *(MHTimeDiffTheta*)parlist.FindObject("EffOnTheta"); 189 193 190 effontime.DrawClone(); 191 effontheta.DrawClone(); 192 193 MHEffOnTimeTime ontime; 194 MHEffOnTimeTheta ontheta; 195 ontime.SetupFill(&parlist); 196 ontheta.SetupFill(&parlist); 197 198 ontime.Calc(effontime.GetHist()); 199 ontheta.Calc(effontheta.GetHist()); 200 201 ontime.DrawClone(); 202 ontheta.DrawClone(); 203 204 parlist.FindObject("HSource")->DrawClone();; 205 parlist.FindObject("HAntiSource")->DrawClone(); 206 parlist.FindObject("MHHillas")->DrawClone(); 207 208 MHAlphaEnergyTime &fluxsp = *(MHAlphaEnergyTime)parlist.FindObject("HillasSrc"); 209 MHAlphaEnergyTime &fluxasp = *(MHAlphaEnergyTime)parlist.FindObject("HillasAntiSrc"); 210 MHAlphaEnergyTheta &fluxsptheta = *(MHAlphaEnergyTime)parlist.FindObject("HillasSrc"); 211 MHAlphaEnergyTheta &fluxasptheta = *(MHAlphaEnergyTime)parlist.FindObject("HillasAntiSrc"); 212 213 fluxsp.DrawClone(); 214 fluxasp.DrawClone(); 215 fluxsptheta.DrawClone(); 216 fluxasptheta.DrawClone(); 217 218 MHAlphaEnergyTheta resulttime; 219 MHAlphaEnergyTheta resulttheta; 220 resulttime.Substract(&fluxsp, &fluxasp); 221 resulttheta.Substract(&fluxsptheta, &fluxasptheta); 222 223 resulttime.DrawClone(); 224 resulttheta.DrawClone(); 225 226 TH2D &projecttime = *resulttime.GetAlphaProjection(-10, 10); 227 TH2D &projecttheta = *resulttheta.GetAlphaProjection(-10, 10); 228 229 projecttime.SetTitle("Number of Gammas vs. EnergyEst and Time (Alpha integrated between -10, 10deg)"); 230 projecttheta.SetTitle("Number of Gammas vs. EnergyEst and Theta (Alpha integrated between -10, 10deg)"); 231 232 c = new TCanvas("To be unfolded"); 233 c->Divide(2,2); 234 c->cd(1); 235 projecttime.DrawCopy(); 236 c->cd(2); 237 projecttheta.DrawCopy(); 238 239 for (int i=1; i<=binstime.GetNumBins(); i++) 240 { 241 if (ontime.GetHist()->GetBinContent(i)==0) 242 continue; 243 244 TH1D &hist = *projecttime.ProjectionX("Number of Gammas vs. EnergyEst for a fixed time", i, i); 245 246 /* UNFOLDING */ 247 248 //hist->Divide(collareatime); 249 hist.Scale(1./ontime.GetHist()->GetBinContent(i)); 250 251 for (int j=1; j<=binse.GetNumBins(); j++) 252 hist.SetBinContent(j, hist.GetBinContent(j)/hist.GetBinWidth(j)); 253 254 hist.SetName("Flux"); 255 hist.SetTitle("Flux[Gammas/s/m^2/GeV] vs. EnergyTrue for a fixed Time"); 256 257 char n[100]; 258 sprintf(n, "Canv%d", j); 259 c= new TCanvas(n, "Title"); 260 hist.DrawCopy(); 261 } 262 263 delete &projecttime; 264 delete &projecttheta; 265 266 return; 267 268 // ------------------------------------------ 269 270 MHMcCollectionArea carea; 271 TH1D *collareatime = carea.GetHist(); // FIXME! 272 TH1D *collareatheta = carea.GetHist(); // FIXME! 194 /* 195 effontime.DrawClone(); 196 effontheta.DrawClone(); 197 */ 198 199 MHEffOnTimeTime ontime; 200 MHEffOnTimeTheta ontheta; 201 ontime.SetupFill(&parlist); 202 ontheta.SetupFill(&parlist); 203 204 ontime.Calc(effontime.GetHist()); 205 ontheta.Calc(effontheta.GetHist()); 206 207 /* 208 ontime.DrawClone(); 209 ontheta.DrawClone(); 210 */ 211 212 MHAlphaEnergyTime &fluxsp = *(MHAlphaEnergyTime*)parlist.FindObject("FluxSrcTime"); 213 MHAlphaEnergyTime &fluxasp = *(MHAlphaEnergyTime*)parlist.FindObject("FluxASrcTime"); 214 MHAlphaEnergyTheta &fluxsptheta = *(MHAlphaEnergyTheta*)parlist.FindObject("FluxSrcTheta"); 215 MHAlphaEnergyTheta &fluxasptheta = *(MHAlphaEnergyTheta*)parlist.FindObject("FluxASrcTheta"); 216 217 /* 218 fluxsp.DrawClone(); 219 fluxasp.DrawClone(); 220 fluxsptheta.DrawClone(); 221 fluxasptheta.DrawClone(); 222 */ 223 224 MHAlphaEnergyTime resulttime; 225 MHAlphaEnergyTheta resulttheta; 226 resulttime.Substract(&fluxsp, &fluxasp); 227 resulttheta.Substract(&fluxsptheta, &fluxasptheta); 228 229 /* 230 resulttime.DrawClone(); 231 resulttheta.DrawClone(); 232 */ 233 234 TH2D &projecttime = *resulttime.GetAlphaProjection(-10, 10); 235 TH2D &projecttheta = *resulttheta.GetAlphaProjection(-10, 10); 236 237 projecttime.SetTitle("Number of Gammas vs. EnergyEst and Time (Alpha integrated between -10, 10deg)"); 238 projecttheta.SetTitle("Number of Gammas vs. EnergyEst and Theta (Alpha integrated between -10, 10deg)"); 239 240 /* 241 TCanvas *c = new TCanvas("Unfold", "To be unfolded", 350, 500); 242 c->Divide(1, 2); 243 c->cd(1); 244 projecttime.DrawCopy(); 245 c->cd(2); 246 projecttheta.DrawCopy(); 247 */ 248 249 return; 250 251 for (int i=1; i<=binstime.GetNumBins(); i++) 252 { 253 if (ontime.GetHist()->GetBinContent(i)==0) 254 continue; 255 256 TH1D &hist = *projecttime.ProjectionX("Number of Gammas vs. EnergyEst for a fixed time", i, i); 257 258 /* UNFOLDING */ 259 260 //hist->Divide(collareatime); 261 hist.Scale(1./ontime.GetHist()->GetBinContent(i)); 262 263 for (int j=1; j<=binse.GetNumBins(); j++) 264 hist.SetBinContent(j, hist.GetBinContent(j)/hist.GetBinWidth(j)); 265 266 hist.SetName("Flux"); 267 hist.SetTitle("Flux[Gammas/s/m^2/GeV] vs. EnergyTrue for a fixed Time"); 268 269 char n[100]; 270 sprintf(n, "Canv%d", j); 271 c= new TCanvas(n, "Title"); 272 hist.DrawCopy(); 273 } 274 275 delete &projecttime; 276 delete &projecttheta; 277 278 return; 279 280 // ------------------------------------------ 281 282 MHMcCollectionArea carea; 283 TH1D *collareatime = carea.GetHist(); // FIXME! 284 TH1D *collareatheta = carea.GetHist(); // FIXME! 273 285 }
Note:
See TracChangeset
for help on using the changeset viewer.