@@ -184,23 +184,28 @@ TRestAxionSolarHiddenPhotonFlux::~TRestAxionSolarHiddenPhotonFlux() {}
184
184
// / inside the metadata members, and calculate the solar flux for a given m.
185
185
// /
186
186
Bool_t TRestAxionSolarHiddenPhotonFlux::LoadTables () {
187
-
188
- if (GetMass () <= 0 ) {
189
- RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - hidden photon mass not yet defined" << RESTendl;
190
- RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - mass given as " << GetMass () << " eV" << RESTendl;
191
- return false ;
187
+ if (GetMass () <= 0 ) {
188
+ RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - hidden photon mass not yet defined"
189
+ << RESTendl;
190
+ RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - mass given as " << GetMass () << " eV"
191
+ << RESTendl;
192
+ return false ;
193
+ }
194
+ if (fFluxDataFile == " " ) {
195
+ RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - flux table not found!!\n "
196
+ << fFluxDataFile << RESTendl;
197
+ return false ;
192
198
}
193
- if ( fFluxDataFile == " " ){
194
- RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - flux table not found!!\n " << fFluxDataFile << RESTendl;
195
- return false ;
199
+ if (fWidthDataFile == " " ) {
200
+ RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - width table not found!!\n "
201
+ << fWidthDataFile << RESTendl;
202
+ return false ;
196
203
}
197
- if ( fWidthDataFile == " " ) {
198
- RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - width table not found!!\n " << fWidthDataFile << RESTendl;
199
- return false ;
200
- }
201
- if ( fPlasmaFreqDataFile == " " ) {
202
- RESTWarning << " TRestAxionSolarHiddenPhotonFlux::LoadTables - plasma frequency table not found!!\n " << fPlasmaFreqDataFile << RESTendl;
203
- return false ;
204
+ if (fPlasmaFreqDataFile == " " ) {
205
+ RESTWarning
206
+ << " TRestAxionSolarHiddenPhotonFlux::LoadTables - plasma frequency table not found!!\n "
207
+ << fPlasmaFreqDataFile << RESTendl;
208
+ return false ;
204
209
}
205
210
206
211
LoadContinuumFluxTable ();
@@ -248,7 +253,9 @@ void TRestAxionSolarHiddenPhotonFlux::LoadContinuumFluxTable() {
248
253
249
254
for (unsigned int n = 0 ; n < fluxTable.size (); n++) {
250
255
TH1D* h = new TH1D (Form (" %s_ContinuumFluxAtRadius%d" , GetName (), n), " " , 200 , 0 , 20 );
251
- for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) { h->SetBinContent (m + 1 , fluxTable[n][m]); }
256
+ for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) {
257
+ h->SetBinContent (m + 1 , fluxTable[n][m]);
258
+ }
252
259
fContinuumTable .push_back (h);
253
260
}
254
261
}
@@ -277,8 +284,9 @@ void TRestAxionSolarHiddenPhotonFlux::LoadWidthTable() {
277
284
}
278
285
279
286
TRestTools::ReadBinaryTable (fullPathName, fluxTable);
280
- // RESTMetadata << "Width table rows / columns: " << fluxTable.size() << " " << fluxTable[0].size() << RESTendl;
281
-
287
+ // RESTMetadata << "Width table rows / columns: " << fluxTable.size() << " " << fluxTable[0].size() <<
288
+ // RESTendl;
289
+
282
290
if (fluxTable.size () != 1000 || fluxTable[0 ].size () != 200 ) {
283
291
fluxTable.clear ();
284
292
RESTError << " LoadWidthTable. The table does not contain the right number of rows or columns"
@@ -288,7 +296,9 @@ void TRestAxionSolarHiddenPhotonFlux::LoadWidthTable() {
288
296
289
297
for (unsigned int n = 0 ; n < fluxTable.size (); n++) {
290
298
TH1D* h = new TH1D (Form (" %s_ResonanceWidthAtRadius%d" , GetName (), n), " " , 200 , 0 , 20 );
291
- for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) { h->SetBinContent (m + 1 , fluxTable[n][m]); }
299
+ for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) {
300
+ h->SetBinContent (m + 1 , fluxTable[n][m]);
301
+ }
292
302
fWidthTable .push_back (h);
293
303
}
294
304
}
@@ -318,7 +328,7 @@ void TRestAxionSolarHiddenPhotonFlux::LoadPlasmaFreqTable() {
318
328
}
319
329
320
330
TRestTools::ReadBinaryTable (fullPathName, fluxTable);
321
-
331
+
322
332
if (fluxTable.size () != 1000 || fluxTable[0 ].size () != 1 ) {
323
333
fluxTable.clear ();
324
334
RESTError << " LoadPlasmaFreqTable. The table does not contain the right number of rows or columns"
@@ -328,7 +338,9 @@ void TRestAxionSolarHiddenPhotonFlux::LoadPlasmaFreqTable() {
328
338
329
339
for (unsigned int n = 0 ; n < fluxTable.size (); n++) {
330
340
TH1D* h = new TH1D (Form (" %s_PlasmaFreqAtRadius%d" , GetName (), n), " " , 1 , 0 , 20 );
331
- for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) { h->SetBinContent (m + 1 , fluxTable[n][m]); }
341
+ for (unsigned int m = 0 ; m < fluxTable[n].size (); m++) {
342
+ h->SetBinContent (m + 1 , fluxTable[n][m]);
343
+ }
332
344
fPlasmaFreqTable .push_back (h);
333
345
}
334
346
}
@@ -341,20 +353,21 @@ void TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux() {
341
353
if (GetMass () == 0 ) {
342
354
RESTError << " CalculateSolarFlux. The hidden photon mass is set to zero!" << RESTendl;
343
355
return ;
344
- }
345
- if (fContinuumTable .size () == 0 ) {
346
- RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty flux table!" << RESTendl;
347
- return ;
348
356
}
349
- if (fPlasmaFreqTable .size () == 0 ) {
350
- RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty plasma freq table!" << RESTendl;
351
- return ;
357
+ if (fContinuumTable .size () == 0 ) {
358
+ RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty flux table!" << RESTendl;
359
+ return ;
352
360
}
353
- if (fWidthTable .size () == 0 ) {
354
- RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty width table!" << RESTendl;
355
- return ;
361
+ if (fPlasmaFreqTable .size () == 0 ) {
362
+ RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty plasma freq table!"
363
+ << RESTendl;
364
+ return ;
365
+ }
366
+ if (fWidthTable .size () == 0 ) {
367
+ RESTError << " TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux - empty width table!" << RESTendl;
368
+ return ;
356
369
}
357
-
370
+
358
371
Double_t mass = GetMass ();
359
372
cout << mass << endl;
360
373
for (unsigned int n = 0 ; n < fContinuumTable .size (); n++) {
@@ -363,19 +376,21 @@ void TRestAxionSolarHiddenPhotonFlux::CalculateSolarFlux() {
363
376
Double_t wp = fPlasmaFreqTable [n]->GetBinContent (1 );
364
377
TH1D* hMass = new TH1D (Form (" %s_hMass%d" , GetName (), n), " hMass" , 200 , 0 , 20 );
365
378
TH1D* hWg2 = (TH1D*)fWidthTable [n]->Clone ();
366
- hWg2->Multiply (hWg2); // (w G)^2
379
+ hWg2->Multiply (hWg2); // (w G)^2
367
380
368
- for ( unsigned int c = 0 ; c < 200 ; c++ ) {
369
- Double_t wG = fWidthTable [n]->GetBinContent (c+1 );
370
- hMass->SetBinContent ( c+1 , pow (mass,-4 ) * ( pow ( pow (mass,2 ) - pow (wp,2 ) , 2 )));// + pow(wG,2) ) ); // m2
371
- }
372
-
373
- hMass->Add (hWg2); // (m2 - wp2)^2 + (w G)^2
381
+ for (unsigned int c = 0 ; c < 200 ; c++) {
382
+ Double_t wG = fWidthTable [n]->GetBinContent (c + 1 );
383
+ hMass->SetBinContent (
384
+ c + 1 , pow (mass, -4 ) * (pow (pow (mass, 2 ) - pow (wp, 2 ), 2 ))); // + pow(wG,2) ) ); // m2
385
+ }
374
386
375
- TH1D* h = (TH1D*)fWidthTable [n]->Clone (); // wG
376
- h->Multiply (fContinuumTable [n]); // wG * flux
377
- h->Divide (hMass); // wG * flux / ( (m2 - wp2)^2 + (w G)^2 )
378
- // h->Scale(pow(mass, 4)); // m4 * wG * flux / ( (m2 - wp2)^2 + (w G)^2 )
387
+ hMass->Add (hWg2); // (m2 - wp2)^2 + (w G)^2
388
+
389
+ TH1D* h = (TH1D*)fWidthTable [n]->Clone (); // wG
390
+ h->Multiply (fContinuumTable [n]); // wG * flux
391
+ h->Divide (hMass); // wG * flux / ( (m2 - wp2)^2 + (w G)^2 )
392
+ // h->Scale(pow(mass, 4)); // m4 * wG * flux / ( (m2 - wp2)^2 + (w G)^2
393
+ // )
379
394
380
395
fFluxTable .push_back (h);
381
396
}
@@ -477,9 +492,11 @@ Double_t TRestAxionSolarHiddenPhotonFlux::IntegrateFluxInRange(TVector2 eRange)
477
492
// / flux distributions defined inside the solar tables loaded in the class
478
493
// /
479
494
std::pair<Double_t, Double_t> TRestAxionSolarHiddenPhotonFlux::GetRandomEnergyAndRadius (TVector2 eRange) {
480
-
481
495
std::pair<Double_t, Double_t> result = {0 , 0 };
482
- if (!AreTablesLoaded ()) { RESTWarning << " Tables not loaded!!" << RESTendl; return result; }
496
+ if (!AreTablesLoaded ()) {
497
+ RESTWarning << " Tables not loaded!!" << RESTendl;
498
+ return result;
499
+ }
483
500
Double_t rnd = fRandom ->Rndm ();
484
501
for (unsigned int r = 0 ; r < fFluxTableIntegrals .size (); r++) {
485
502
if (rnd < fFluxTableIntegrals [r]) {
@@ -529,9 +546,9 @@ void TRestAxionSolarHiddenPhotonFlux::PrintIntegratedRingFlux() {
529
546
void TRestAxionSolarHiddenPhotonFlux::PrintMetadata () {
530
547
TRestAxionSolarFlux::PrintMetadata ();
531
548
532
- RESTMetadata << " - Solar hidden photon datafile (flux) : " << fFluxDataFile << RESTendl;
533
- RESTMetadata << " - Solar hidden photon datafile (width) : " << fWidthDataFile << RESTendl;
534
- RESTMetadata << " - Solar hidden photon datafile (plasma freq) : " << fPlasmaFreqDataFile << RESTendl;
549
+ RESTMetadata << " - Solar hidden photon datafile (flux) : " << fFluxDataFile << RESTendl;
550
+ RESTMetadata << " - Solar hidden photon datafile (width) : " << fWidthDataFile << RESTendl;
551
+ RESTMetadata << " - Solar hidden photon datafile (plasma freq) : " << fPlasmaFreqDataFile << RESTendl;
535
552
RESTMetadata << " -------" << RESTendl;
536
553
RESTMetadata << " - Total continuum flux : " << fTotalContinuumFlux << " cm-2 s-1" << RESTendl;
537
554
RESTMetadata << " ++++++++++++++++++" << RESTendl;
@@ -610,4 +627,3 @@ TCanvas* TRestAxionSolarHiddenPhotonFlux::DrawSolarFlux() {
610
627
611
628
return fCanvas ;
612
629
}
613
-
0 commit comments