review of the magic lidar data analysis method and study of its

76
Review of the MAGIC LIDAR data analysis method and study of its stability Treball de fi de grau - Bachelor thesis - Bachelorarbeit Grau de Física Curs 2013-2014 Convocatòria de febrer Author: Miquel C ASSANYES Supervisors: Christian F RUCK Dr. Markus GAUG Tutors: Prof. Lluís F ONT Prof. Josep Maria MONDELO

Upload: vanhuong

Post on 05-Jan-2017

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Review of the MAGIC LIDAR data analysis method and study of its

Review of the MAGIC LIDAR dataanalysis method and study of its stability

Treball de fi de grau - Bachelor thesis - BachelorarbeitGrau de Física

Curs 2013-2014Convocatòria de febrer

Author:Miquel CASSANYES

Supervisors:Christian FRUCK

Dr. Markus GAUG

Tutors:Prof. Lluís FONT

Prof. Josep Maria MONDELO

Page 2: Review of the MAGIC LIDAR data analysis method and study of its
Page 3: Review of the MAGIC LIDAR data analysis method and study of its

Das Universum ist nicht nur fremdartiger, als wir denken,es ist auch fremdartiger, als wir denken können.

Werner Heisenberg

Ich habe keine besondere Begabung,sondern bin nur leidenschaftlich neugierig.

Albert Einstein

Page 4: Review of the MAGIC LIDAR data analysis method and study of its
Page 5: Review of the MAGIC LIDAR data analysis method and study of its

Abstract Miquel Cassanyes

Abstract

The MAGIC telescopes (Observatorio del Roque de los Muchachos in La Palma,Canary Islands) are specifically designed to study high energy phenomena of the Uni-verse, by means of the very high energy γ photons emitted in such processes, using theso-called Imaging Air-shower Cherenkov Technique (IACT). Since they are ground-based telescopes, the atmosphere plays a crucial role in the conversion of the γ raysto detectable Cherenkov light and its transmission to ground. For this reason, a LIghtDetection And Ranging (LIDAR) system has been installed on the MAGIC site in orderto monitor the atmosphere.

The MAGIC LIDAR, developed by Christian Fruck et al. (Max-Planck-Institut fürPhysik, Munich), provides range resolved information about the light transmission in theatmosphere. The data analysis software implements a method innovated by C. Fruck tostudy the effects of thin aerosol layers on the optical conditions above the telescopes.The goal of this work was to review and characterize the implemented method, to im-prove it and to update the software to test the improvements, as well as to check thestability and robustness of both the method and the LIDAR system hardware. To do so,one year of LIDAR data has been studied.

Whereas degradation of the LIDAR hardware could be excluded with great confi-dence, a strong temperature dependency of the LIDAR return signal has been found.Several hypotheses were considered to interpret this finding. However, a conclusiveexplanation will require more than one full yearly cycle of data.

i

Page 6: Review of the MAGIC LIDAR data analysis method and study of its
Page 7: Review of the MAGIC LIDAR data analysis method and study of its

Resum Miquel Cassanyes

Resum

Els telescopis MAGIC (Observatorio del Roque de los Muchachos a La Palma, IllesCanàries) estan especialment dissenyats per estudiar fenòmens d’alta energia de l’U-nivers, a partir dels fotons de molt alta energia emesos en aquests processos, usantl’anomenada Imaging Air-shower Cherenkov Technique (IACT). Com que són teles-copis situats a la superfície terrestre, l’atmosfera juga un paper crucial en la conversiódels rajos γ a llum Cherenkov detectable i en la seva transmissió fins a la superfície.Per aquest motiu, un sistema LIDAR (LIght Detection And Ranging) s’ha instal·lat al’emplaçament de MAGIC per monitoritzar l’atmosfera.

El LIDAR de MAGIC, desenvolupat per Christian Fruck et al. (Max-Planck-Institutfür Physik, Munic), aporta informació sobre la transmissió a l’atmosfera resolta en dis-tància. El programa d’anàlisi de dades implementa un mètode creat per C. Fruck perestudiar els efectes de capes primes d’aerosols en les condicions òptiques en alçadessuperiors a la de la localització dels telescopis. L’objectiu d’aquest treball és revisarel mètode implementat, millorar-lo i actualitzar el programa per fer tests de les millo-res, així com també comprovar l’estabilitat i robustesa del mètode i del hardware delLIDAR. Per tal de fer-ho s’han estudiat les dades d’un any sencer del LIDAR.

Mentre que la degradació del hardware del LIDAR ha pogut ser descartada amb altaconfiança, s’ha trobat una forta dependència del senyal de tornada del LIDAR amb latemperatura. Es van considerar diverses hipòtesis per interpretar aquest descobriment.Tot i així, caldrà estudiar més d’un cicle anual de dades de LIDAR per trobar una expli-cació concloent.

iii

Page 8: Review of the MAGIC LIDAR data analysis method and study of its
Page 9: Review of the MAGIC LIDAR data analysis method and study of its

Zusammenfassung Miquel Cassanyes

Zusammenfassung

Die MAGIC-Teleskope auf dem Observatorio del Roque de los Muchachos auf derKanareninsel La Palma wurden zur gezielten Beobachtung hochenergetischer Phänome-ne im Universum entwickelt, indem hochenergetische Gammastrahlen, die in solchenProzessen ausgesandt werden, mittels der sogenannten Imaging Air-shower Cheren-kov Technique (IACT) beobachtet werden. Da diese Teleskope erdgebunden operierien,spielt die Atmosphäre eine wichtige Rolle in der Umwandlung der Gammastrahlen inbeobachtbares Tscherenkovlicht, und deren Transmission zur Erde. Aus diesem Grundwurde neben den MAGIC-Teleskopen ein LIDAR-System installiert welches zur Über-wachung der Atmosphäre eingesetzt wird.

Der MAGIC-LIDAR wurde von Christian Fruck am Max-Planck-Institut für Phy-sik entwickelt und produziert reichweitenaufgelöste Information über die Lichtdurch-lässigkeit der Atmosphäre. Die Datenanalysesoftware benutzt eine Methode, die vonC. Fruck entwickelt wurde, um die Effekte dünner Aerosolschichten auf die optischenBedingungen über den Teleskopen zu rekonstruiren. Das Ziel dieser Arbeit besteht auseiner kritischen Überprüfung und Charakterizierung der verwendeten Methode sowieseine Verbesserung. Des weiteren wurde die Methode auf und die LIDAR-HardwareRobustheit und Stabilität untersucht. Zu diesen Weg wurde ein volles Jahr LIDAR-Dataausgewerdet.

Während ein Sensitivitätsverlust der LIDAR-Hardware mit großer Wahrscheinlich-keit ausgeschlossen werden kann, wurde eine starke Temperaturabhängigkeit des LIDAR-Signals gefunden. Verschiedene Hypothesen zur Interpretation dieser Resultate werdenbesprochen, jedoch eine eindeutige Erklärung benötigt noch weitere Daten als nur dieseseine Jahre.

v

Page 10: Review of the MAGIC LIDAR data analysis method and study of its
Page 11: Review of the MAGIC LIDAR data analysis method and study of its

Contents

Abstract iAbstract . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iResum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iiiZusammenfassung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . v

1 Introduction 11.1 The goals of this work . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.2 γ-ray astronomy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11.3 Extended air-showers and the Cherenkov effect . . . . . . . . . . . . . . . 21.4 Satellites and ground-based telescopes . . . . . . . . . . . . . . . . . . . . 31.5 The MAGIC telescopes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41.6 Influence of the atmosphere . . . . . . . . . . . . . . . . . . . . . . . . . . 5

2 The LIght Detection And Ranging (LIDAR) system 92.1 The LIDAR equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.2 Signal inversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.3 Technical aspects of the MAGIC LIDAR . . . . . . . . . . . . . . . . . . . 122.4 Reading the LIDAR data . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

3 The MAGIC LIDAR data analysis method and study of its stability 173.1 Clean night transmission profile . . . . . . . . . . . . . . . . . . . . . . . 173.2 Fitting the signal data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.3 Determination of the transmission values . . . . . . . . . . . . . . . . . . . 223.4 Stability over time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243.5 Dependence with respect to zenith angle . . . . . . . . . . . . . . . . . . . 273.6 Dependence with respect to temperature, pressure and relative humidity . . 28

4 Conclusions and outlook 33

References 37

Acknowledgements 39Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39Agraïments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41Danksagung . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43

Page 12: Review of the MAGIC LIDAR data analysis method and study of its

Miquel Cassanyes

Appendix 45

viii

Page 13: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

1 Introduction

1.1 The goals of this work

The MAGIC telescopes are used to study phenomena within the universe related to the emis-sion of high energy particles that we can measure using the so-called Imaging Air-showerCherenkov Technique (IACT). This technique is based on the fact that high energy particles(10 GeV - 100 TeV) produce an extended air-shower and Cherenkov radiation is emitted. Us-ing the MAGIC telescopes, operating since 2004 and 2009, one can collect this Cherenkovlight and reconstruct the air-shower to get information about the primary γ , which providesinformation about the source emitting these particles.

The atmosphere is a crucial aspect to take into account when considering this technique.We need to carefully characterize the atmosphere and do it continuously due to the variationover time that it presents. Doing so, we can know the conditions in which we are collectingdata with the MAGIC telescopes. The weather conditions affect in a direct way the transmis-sion of light within the atmosphere.

A LIDAR system has been operating since 2011 in La Palma, providing range-resolveddata about the light transmission in the atmosphere. Several issues with the way the LIDARis working, mainly related to the determination of the transmission values and the stability ofthe system over time, require an improvement. Today, we have already one full year of dataavailable (14793 data sets), which allow us to test and characterize the method developedby [Fruck (2011)], that he specifically adapted for the use along with IACTs, and check thesystem’s stability. This is the goal of this work.

In starting this work, I spent two months working together with C. Fruck at the Max-Planck-Institut für Physik (MPI1) where I learned his method. After my return to Barcelona,I studied one specific part of this method, namely the stability of the so-called Rayleigh fit,which is crucial for the understanding of the method itself as well as the hardware of theLIDAR system. The first two chapters are strongly based on C. Fruck’s diploma thesis, be-cause it is necessary to introduce the reader into the concept of the MAGIC LIDAR analysis.From the third chapter on, my own contribution is presented.

1.2 γ-ray astronomy

It is known that most part of the radiation that reaches the Earth has a thermal origin. How-ever, the radiation coming from thermal processes never exceeds energies higher than a fewkeV. Nonetheless, photons with higher energies have been detected. These photons, then,must be produced in non-thermal processes [Grupen (2005)].

In addition to these high energetic photons, cosmic rays can be measured and they presentsimilar energy values to those observed in high energetic photons. An unresolved problemis the origin of such cosmic rays. These rays are constituted by charged particles, the ma-

1www.mpp.mpg.de

1

Page 14: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

jority of those being protons or heavier nuclei and the rest being electrons. In the universe,however, one can find many processes where magnetic fields are involved and, even thoughthey are weak, given the fact that particles travel enormous distances from their sources toour detectors, they can severely deflect cosmic rays. It is for this reason that it is not possibleto determine the origin of cosmic rays, since their directions are modified by the magneticfields.

It is known that γ-rays, as well as cosmic rays, are produced in extreme environmentsone can find in the universe. At least in some cases, the sources could even be the same forboth phenomena. Having γ-rays coming from these sources could be helpful to determinethe origin of cosmic rays, because their trajectories are not deflected by magnetic fields.Another possibility might be given by neutrino astronomy, but it is quite challenging tostudy the sources using neutrinos as ’messengers’ because of the almost complete lack ofinteraction of neutrinos with matter.

These sources could be both galactic and extragalactic, with different processes at workemitting γ-radiation. Some galactic sources could be supernova remnants (SNRs), binarysystems such as micro-quasars (MQS) or binary pulsars (BP), pulsars, pulsar wind nebu-lae (PWN) or solar flares, while the extragalactic sources that are usually named are ac-tive galactic nuclei (AGN), γ-ray bursts (GRB), star-burst galaxies or dark matter structures[Menzel (2013)]. The processes producing γ-radiation, to name some, could be bremsstrahlung,inverse Compton scattering, synchrotron radiation and different situations where particle de-cay or annihilation are involved [Schultz (2013)].

1.3 Extended air-showers and the Cherenkov effect

When a charged particle travels through a dielectric medium, the charge distribution of thismedium is affected by the moving particle. This phenomenon polarizes the medium as theparticle is traveling through it. The effects are negligible at slow speeds because the mediumreacts at the same speed as the particle travels. On the other hand, if the charged particle isfast enough, a net dipole moment is created which moves at the speed of the particle.

Radiation is emitted due to the creation and extinction of small dipoles, but it generallyinterferes destructively and has no effect. Only if the charged particle is traveling faster thanlight within the medium the interference is constructive and each dipole increases the amountof radiation being emitted. This is the so-called Cherenkov radiation [Menzel (2013)].

This light is only emitted under a certain angle θ that can be calculated as

cosθ =lwlp

=cnt

βct=

1βn

(1)

where lw and lp are the paths that the wave and the particle travel in a time t, n is the refractionindex of the medium and β is the speed of the particle relative to the speed of light in vacuumc.

2

Page 15: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

Figure 1: Scheme of the light transmission when Cherenkov light is emitted.

The spectrum of the Cherenkov radiation ranges from UV to radio wavelengths followinga λ−2 behavior. Taking into account the effects that the atmosphere has on the propagationof the light, we find a peak between 300 and 400 nm that varies depending on the weatherconditions.

In the context of γ-ray astronomy, the Cherenkov effect is important because it is relatedto the so-called extended air-showers. When a high energy γ enters the atmosphere, it mostlikely collides with another particle, creating two secondary particles. These particles willalso collide with other particles within the atmosphere and create a particle cascade, wheremost of the particles descend in a narrow cone. If those particles are fast enough, they willproduce Cherenkov radiation when entering the atmosphere. Taking into account that therefraction index of the atmosphere is roughly 1.00029 [Lide (1996)], Cherenkov light willbe emitted under an angle of approximately 1.36o. Considering the length these showershave, that corresponds to an illuminated area with a diameter of 300 m. It is important topoint out that not only a γ , but also a hadron, can produce an air-shower in the context ofhigh energy astronomy.

1.4 Satellites and ground-based telescopes

There are two possibilities when trying to study high energy particles. Since the upper layersof the atmosphere absorb this radiation, some decades ago there was no direct way to getinformation about them.

The first solution came up in the 1950s, when the satellite Sputnik was launched. Since asatellite is out of the atmosphere, the radiation can be detected directly with the detectors thatone can install on it, providing information in the X and γ spectral range. The first satellitesused for that purpose were launched about 15 years later than Sputnik, making it possibleto detect sources like the Crab Nebula, Vela X1 and Cygnus X3, among others, for the firsttime [Grupen (2005)].

3

Page 16: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

Another possibility was brought by the IACT. This technique uses telescopes with largeoptical mirrors with diameters of several meters able to collect data from the incomingCherenkov light. Since only a few Cherenkov photons per air-shower are produced andreach the cameras of the telescope separated by only a few nanoseconds in time, ultra fastand sensitive light detectors must be used. From the total amount of light, the shape of theimage and its position and orientation, one can reconstruct the air-shower to get informa-tion about the primary γ that started the air-shower. It is possible to determine the directionof the incoming particle and even distinguish between electromagnetic and hadronic air-showers [Hillas (1985), Hillas (2013), Weekes (1989)]. Tracing back the trajectories of thenon-charged particles one can find their sources and create maps of sources in the sky.

1.5 The MAGIC telescopes

The MAGIC telescopes are two IACT telescopes designed to cover the range between 30GeV and 50 TeV in the electromagnetic spectrum with optical dishes of 17 m in diameterseparated by 85 m located roughly 2200 m above the sea level at the Observatorio del

Figure 2: The telescopes MAGIC I and MAGIC II in La Palma.

4

Page 17: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

Roque de los Muchachos (ORM)2 on the Canarian island of La Palma (28o45’25”N 17o53’3ç3”W)[Wagner (2006)]. The first one, MAGIC I, was installed in 2004 and MAGIC II is operatingsince 2009 providing data in stereoscopic mode together with MAGIC I.

Both telescopes have their mirrors supported by carbon fiber reinforced plastic tubes,which form a solid and light-weighted structure that makes it possible to reorient the tele-scopes in a few tens of seconds to record data in case of a GRB alert from satellite detectors.This is crucial, since these phenomena last only up to a couple of minutes. The mirrors arecomposed of panels, each one having a spherical shape, but assembled together in a parabolicone. The focal length of both telescopes is 17 m. Their cameras present 1039 photomulti-plier tubes (PMTs) with a peak in quantum efficiency of 32% at around 330 nm wavelength.These PMTs are installed in different groups to make it easier to replace them in case ofmalfunction or while updating the system. In addition, light guides cover the spaces betweenthe surfaces covered by PMTs to improve the sensitivity in these areas. The electrical signalof the PMTs is amplified before being transformed into an optical signal and being sent tothe counting house. In the counting house, the trigger system detects air-shower events and,in case one is spotted, stores the data.

1.6 Influence of the atmosphere

Since Cherenkov light is affected by attenuation and backscattering, atmospheric conditionssuch as a transparency play an important role, for example, when we determine the energy ofa primary γ that enters the atmosphere and starts an air-shower. It is also important for IACTtelescopes to be able to range-resolve the attenuation of light within the atmosphere, becausethe Cherenkov light, which is produced while the shower travels through the atmosphere, isattenuated at varying distances.

We would like to point out that such experiments do not work with any test beam; theenergy and flux calibration depends solely on Monte Carlo simulations. The effect of theatmosphere also needs to be taken into account in the calibration process.

Scattering and absorption processes

When light travels though a polarizable medium, small dipoles are created along its path.These dipoles emit light in different directions causing some of the light to be scattered away.This phenomenon is called Rayleigh scattering and and is responsible for the bluish light thatwe see when we look at the sky during the day. The reason why we see the sky blue, and notred or green, has to do with the strong dependence it has with respect to the wavelength ofthe incoming light.

Assuming unpolarized light, the differential scattering cross-section for a gas molecule

2http://www.iac.es/eno.php?op1=2&lang=en

5

Page 18: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

is given by the expression

dσR(θ)dΩ

=π2(n2 −1)2

N2λ 4cos2(θ)+1

2(2)

where θ is the angle defined by the direction we consider and the direction of propagation ofthe incoming light, which has a wavelength of λ , n is the refractive coefficient of the mediumand N is the number density of refractors.

Rayleigh scattering is known to have an important effect when the size of moleculesor particles are significantly smaller than the wavelength of the scattered light. When theyboth have similar size, the phenomena becomes so complicated that only some idealizedsituations are analytically resolvable. Aerosols typically have sizes larger or comparable tothe green light wavelength. For spherical aerosol particles, the analytic solution is known asMie scattering.

Given that we are writing equation 2 for just one particle, we need to consider the particledensity within the atmosphere in order to compute the absorption that occurs when the lightis traveling through the air. To do so, we define the volume backscattering coefficient asβ = σ · n(h), where n(h) is the particle density of the atmosphere and h the atmosphericheight.

The volume Rayleigh scattering cross section for unpolarized light is [Bucholtz (1995),McCartney (1976)]:

βmol(θ = 180,λ ,h) =6π2 · (n2

s −1)2

Ns ·λ 4 · (n2s +2)2 ·

(6+3ρ(h)6−7ρ(h)

)· P(h)

Ps· Ts

T (h)

· 34·(

2+2ρ(h)2+ρ(h)

)·(

1+1−ρ(h)1+ρ(h)

)m−1 Sr−1 , (3)

where the first line shows the original cross-section formula, including the King correction,due to the depolarization ρ of the air molecules, and the correction for the different air den-sities at height h, measured through temperature T and pressure P. The second line is theChandrasekhar corrected phase function [Chandrasekhar (1950), McCartney (1976)]. Fur-ther, n(h) is the refraction index of air and Ns the number density of molecules per unitvolume, at standard conditions (Ns = 2.5469 ·1025 m−3 [Bodhaine (1999)] at Ts = 288.15 Kand Ps = 101.325 kPa). According to [Tomasi (2005)], both n and ρ depend slightly on thewavelength of light, atmospheric pressure, temperature, relative humidity and the concentra-tion of CO2. Assuming dry air and standard values Ps and Ts, we obtain for the Nd:YAG laserat 532 nm (ns − 1) = 2.779 · 10−4. The depolarization coefficients ρ = 0.0283 can be usedfor typical atmospheric conditions in the lower troposphere, and vary by less than 0.5%.

Using these numbers and the relation 9 · (n2 − 1)2/(n+ 2)2 ≈ 4 · (n− 1)2, the volumescattering cross section can be written as:

βmol(θ = 180,λ = 532nm,h)≈ 1.545 ·10−6 · P(h)Ps

· Ts

T (h)m−1 Sr−1 . (4)

6

Page 19: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

The relation is precise to at least 0.5%, with the main uncertainty stemming from the un-known water vapor content [Tomasi (2005)].

Assuming a standard atmosphere [NASA (1976)], the term P(h)Ps

· TsT (h) can be described

by a scale height of Hs ≈ 10.35 km, hence:

βmol(θ = 180,λ = 532nm,h)≈ 1.545 ·10−6 · exp(−h/Hs) m−1 Sr−1 . (5)

Some processes of quantum origin might also take place. Raman scattering, to namean important one, has to do with the possibility that vibrational or rotational states of themolecules are excited or relaxed.

Standard atmosphere

Assuming the air to be clean, the main interaction between the light and the atmosphereis caused by Rayleigh scattering, which depends on the chemical composition and numberdensity n(h) of air molecules.

Even if this model worked well, it seems mandatory to try to improve it and take intoaccount the variations in temperature. NASA published a few decades ago [Minzner (1976)]a simple model of the molecular part of the atmosphere, assuming the air as dry, clean andbehaving like an ideal gas. The temperature changes with respect to altitude below 11 kmare given by

T (h) = Ts −L ·h. (6)

where Ts = 288.15 K is the standard temperature at sea level and L ≈ 6.5 K/m is called thetemperature lapse rate. Depending on the amount of water in the air, it can vary considerably.

Using that temperature model, we can derive an approximation for the pressure and den-sity profiles

P(h) = Ps ·(

1− LhTs

) gMRL

≃ Ps · exp(− h

H0,P

)n(h) = ns ·

(1− Lh

Ts

) gMRL −1

≃ ns · exp(− h

H0,n

) (7)

where P(h) is the pressure at altitude h, Ps = 1013.25 hPa the pressure at sea level, R the gasconstant, M ≈ 29.0 g/mol the effective molar mass of the air gas mixture, g the gravitationalacceleration, H0,P = RTs

gM ≈ 8400 m the characteristic scale height for pressure and H0,n =RTs

gM−RL ≈ 10300 m that for the number density.

Light of the Night Sky (LoNS)

The expression "Light of the Night Sky" refers to the fact that, even at midnight, somenight can be seen up in the sky. The sources of this light can be both natural and artificial.

7

Page 20: Review of the MAGIC LIDAR data analysis method and study of its

Introduction Miquel Cassanyes

On the one hand, some light obviously comes from the moon, either directly or after be-ing scattered. Distant stars also need to be considered, not only because of their contributionto the direct sources, but also because their light is scattered in the interplanetary gas anddust contained within the planetary plane creating the so-called zodiacal light. Another ma-jor source would be the airglow and in some sites one needs to take into account the AuroraBorealis and the scattered light from lightnings.

On the other hand, being nowadays much more important than the natural sources, wehave the light pollution caused by human civilization. The reason for this is the reflection ofthis light in different layers of the atmosphere, bringing it back to the ground.

The artificial sources make it quite difficult to set a ground-based astronomical stationand force these experiments to be in remote locations such as the Roque de los Muchachosin La Palma (MAGIC), the desert in Namibia (HESS) or the desert in Arizona (VERITAS)in order to reach the best possible observation conditions.

Atmospheric conditions in La Palma

Special laws exist in La Palma that forbid outdoor illumination that contributes to theLoNS to make this place as dark as possible to improve the observation conditions. Manymunicipalities use Na lamps for street illumination to achieve this goal.

The proximity of the island to the desert makes it possible to worsen the observationconditions due to dust intrusions. A temperature inversion below the altitude of the ORMcauses a thick cloud layer. This layer acts as a barrier that blocks sand coming from thedesert that would otherwise lift into higher layers within the atmosphere and affect the opticalconditions.

In some summer nights, mainly in July or August, the conditions change in a way thatmakes the temperature inversion disappear. If so, the sand gets to higher altitudes, interfereswith the light that we want to observe with the telescopes and makes the collected data lessreliable. This phenomenon is called Calima and can be seen up to the first 4 km of theatmosphere.

8

Page 21: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

2 The LIght Detection And Ranging (LIDAR) system

The LIDAR technique allows us to measure the differential atmospheric transmission deter-mining the distance and properties of backscattering objects using electromagnetic pulses inthe visible spectrum. Given that lasers can produce monochromatic light, they are used inmost LIDAR applications.

Figure 3: MAGIC LIDAR system installed in La Palma. Picture from [Fruck (2011)].

2.1 The LIDAR equation

To present the way a LIDAR system works, we need to consider the following single scat-tering LIDAR equation:

dN(r) = N0CG(r)Ar2 β (r)exp

(−2

∫ r

0α(r′)dr′

)dr (8)

where dN(r) is the differential number of observed photons, A is the effective area, N0 thenumber of photons that have been backscattering at a distance between r and r + dr, Cis the overall detection efficiency related to the experimental setup, G(r) is a geometricaland optical factor, β (r) is the local backscattering coefficient and α(r′) is the extinction

9

Page 22: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

coefficient of the medium. Both contain a molecular scattering part (βm(r) and αm(r)) and anaerosol scattering part (βa(r) and αa(r)); β (r)= βm(r)+βa(r), α(r)=αm(r)+αa(r). Whenthe LIDAR detector field of view and the laser completely overlap, G(r) can be considered tobe 1. For very short pulses, this equation is not correct for practical use and the digitizationlength l is required in the equation as shown below.

N(r) = N(r, l) =∫ r+ l

2

r− l2

dN(r′)≈ N0Ar2 β (r)l exp

(−2

∫ r

0α(r′)dr′

). (9)

2.2 Signal inversion

In order to solve the LIDAR equation we need to determine the backscattering and attenu-ation coefficients, β and α , from the return signal N(r). To do so, we will work with thenatural logarithm of the range corrected signal. The equation

S(r) = ln(N(r)r2) = ln(N0 Al)+ ln(β (r))−2∫ r

0α(r′)dr′ (10)

can be written in differential form as

dSdr

=1β

dβdr

−2α. (11)

It is important to notice that this equation can not be solved without additional informa-tion because both β and α are unknown. For this reason, a functional relationship betweenthem must be assumed. The expression α

β is usually referred to as LIDAR ratio. In particularsituations, some methods provide reasonable signal inversions using specific assumptions[Klett (1981)].

Forward integration

In inhomogeneous atmospheres, other assumptions must be used. One of them [Klett (1981)]relates β and α as

β = const. ·αk (12)

where k ∈ [0.7,1.0]. The differential equation can now be written as

dSdr

=kα

dαdr

−2α. (13)

This equation can be solved with ease, as shown in [Klett (1981)], by expressing it interms of y = 1

α , finding a solution to the homogeneous equation and a particular solution tothe non-homogeneous equation by the variation of parameters method. Doing so, one canfind that

α(r) =exp

(S(r)−S0

k

)1

α0− 2

k∫ r

r0exp

(S(r)−S(r0)

k

)dr′

(14)

10

Page 23: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

where S0 = S(r = r0) and α0 = α(r = r0), being r0 a distance where the value of α is known.As explained by [Klett (1981)], this solution is numerically unstable due to the fact that

α is expressed as a quotient of two values that approach 0 close to the detector.

Backward integration

Klett himself modified the previous method to improve its stability introducing a newidea which is based on evaluating the integration constant at a range rm instead of the posi-tion close to the detector r0. The result is now the same, but integrating backwards from thisreference distance rm.

α(r) =exp S(r)−Sm

k1

αm+ 2

k∫ rm

r exp(

S(r′)−Smk

)dr′

. (15)

Rayleigh case

A special case of forward integration is that related to pure Rayleigh scattering (see chapter1.6).

In order to convert equation 5 into a dependency on the altitude above the MAGIC LI-DAR, we use the altitude above see level of the MAGIC site: HMAGIC = 2.2 km. And then,

H = h−HMAGIC. (16)

Doing so, equation 5 can be written as

βmol(θ = 180,λ = 532nm,h) ≈ 1.545 ·10−6 · exp(−H/H0,n) · exp(−HMAGIC/H0,n) m−1 Sr−1

≈ 1.545 ·10−6 · exp(−H/H0,n) ·0.81

≈ 1.545 ·10−6 · exp(−H/H0,n) ·PMAGIC

Ps· Ts

TMAGIC≈ β0 · exp(−H/H0,n) . (17)

In the last line, we have introduced the actual values of the pressure and temperaturemeasurements made by the MAGIC weather station.

We can now introduce equation 17 into the LIDAR equation and, using the fact that forRayleigh scattering,

α =8π3

β ≈ 8.38β (18)

and also that βa ≈ 0 in the Rayleigh regime, we obtain

S(r) = ln(N0 ·A · l ·β0)−H

H0,n− 16π

3·β0 ·H0,n

∫ H/cosθ

0−exp

(− r′

H0,n

)dr′−2

∫ H/cosθ

0αa(r′)dr′

≈ ln(N0 ·A · l ·β0)−1

cosθ· ln 1

T 2g−H ·

(1

H0,n+

16π3

· β0

cosθ

)+

H2

cos2 θ· 8π

3·β0 ·

1H0,n

+ . . .

≈ C− s ·H + k ·H2 + . . . (19)

11

Page 24: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

where Ta is the integral transmission through the ground layer and we have estimated thatthe y-intercept C resulted to be more or less 16.5 when the LIDAR started operating andTa = 0 and the slope s, that we estimate to be roughly 1.18 ·10−4 m−1. The value of k can beestimated to be of the order of 10−9.

2.3 Technical aspects of the MAGIC LIDAR

Figure 4: Scheme of the LIDAR system with some of its components. Picture from[Fruck (2011)].

The different devices that constitute the MAGIC LIDAR will now be introduced, empha-sizing that this particular system was designed to be used to determine the range resolvedtransmission and absorption within the different atmosphere layers.

The MAGIC LIDAR consists of the following components [Fruck (2011)]:

• Laser: It is a frequency doubled, passively Q-switched, pulsed Nd:YAG laser with apulse energy of 5.1 µJ, a pulse width of 0.5 ns and pulse repetition frequency up to 2kHz, manufactured by Soliton GmbH.3

3http://www.soliton-gmbh.de/

12

Page 25: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

The Nd:YAG crystal is pumped by a diode laser and, when the absorber material in-side the laser oscillator is saturated, it becomes transparent and the stored pulse isshot within about 500 ps. A non-linear crystal is used to produce harmonics of the fre-quency related to the characteristic 1064 nm wavelength and all lines but the green oneat 532 nm are blocked by filters. In addition, a monitor photodiode makes it possibleto generate a trigger signal when the laser pulse is emitted and a 10x beam expandernarrows the beam cone to a more operational value, since the beam was measured tohave a too high divergence.

• Telescope: The light collector is a 0.6 m diameter mirror that makes it possible tocollect enough backscattered photons. It has a focal length of 1.5 m.

• Telescope mount: Allows the alignment the LIDAR in the right position in the sky.The mount consists of a robotic device that tracks the observed position of the MAGICtelescopes at all times except when taking data that can move with maximum slewingspeed of 30os−1, maximum slewing acceleration of 20os−2 and absolute positioningaccuracy of 5”.

• Detector module: The light that is collected by the mirror passes through a diaphragmof adjustable diameter to adapt the field of view to match the beam divergence of thelaser, reducing the effect of other light sources. In addition, a filter with a bandwidthof 2.5 nm around the 532 nm wavelength of the laser is used.

The detector is a Hybrid Photo Diode (HPD), since it must have a high detection effi-ciency to make sure that we can detect single photons coming from many kilometersaway.

• Photon Detection Efficiency (PDE) of the LIDAR system: A value for the PDE willbe computed, taking into account all the losses that might take place throughout thesystem. First of all, the beam expansion optics already produce some losses, whichhave a factor of 0.1, so about 0.9 is transmitted. Then the light reaches the mirrors,which have a reflectance of 0.65 and, after that, one finds the detector module lensesand the interference filter, with a transmission factor of 0.8 and 0.7, respectively. Atthe end, the PDE of the HPD needs to be taken into account, and can be estimatedto be roughly 0.44. Multiplying the different values, we obtain the PDE of the wholesystem, which results to be of 14%.

The rest of the LIDAR components are not discussed in this work.

2.4 Reading the LIDAR data

The graphs that we obtain represent photon counts with respect to the distance from the de-tector. The return signal is corrected for the solid angle multiplying it by r2 and the logarithmof that product is shown because of the exponential decrease of the number of photon countsover distance. No uncertainty bars are plotted in order to have a clearer plot and taking into

13

Page 26: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

account that the noise is a reasonable representation of these error margin. In the calculationsin turn, accurately calculated uncertainty estimates are used.

Figure 5: Example of a LIDAR graph to show how there are read. Picture from[Fruck (2011)].

Figure 5 displays the method developed by Christian Fruck with short explanations. Inthe first few hundred meters, we can see a sudden increase from 0 to more than 1011 counts.It has to do with the fact that the detector and the laser are aligned but not on-axis and, for thisreason, the backscattered light is only within the field of view of the detector after the pulsehas traveled some distance. We can see a decrease in the first kilometers after the alignmentthat has to do with the backscattered light related to the planetary boundary layer. An increaseof the number of photon counts due to the aerosols follows immediately the increase relatedto the alignment and, after traveling past the boundary layer, the correspondent decrease canbe seen. After that, a linear behavior can be observed. In these kilometers, the majorityof the light travels with pure Rayleigh interaction. Since the atmosphere particle density isconsidered to decrease exponentially over distance, a logarithmic plot such as this one showsa linear correlation. In this region, the Rayleigh fits are done. A few kilometers higher, wesee high peaks. They are related not only to Rayleigh scattering, as most of the signal, butalso to Mie scattering. This happens because some clouds are located at this altitude andthe number of backscattered photons is greatly increased. After the peaks, the behavior isagain that of a linear function. It can be measured that, even though the slope is roughly thesame we could measure before the peaks, it is not the same function, since the y-intercept is

14

Page 27: Review of the MAGIC LIDAR data analysis method and study of its

The LIDAR system Miquel Cassanyes

now lower. It is the same behavior but rescaled. Since the graph gives information regardingthe amount of light that is backscattered and the clouds produce an increase of the numberof backscattered photons, it can be seen that the rescaling factor gives us a first idea of theamount of light lost within the cloud. Comparing a fit before and another one after the cloud,we obtain information related to light transmission in this particular region. It is possibleto detect different peaks within the graph, corresponding to different clouds. In the lastkilometers of the atmosphere, the noise is quite high and it is difficult to obtain reliable data.

Figure 6 is just a real example of a situation which is similar to Figure 5.

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 47

Rayleigh fit from: 3092m - 5273m

/NDF=0.92χ, -1C = 16.42, s = 0.00012m

=0.961ground

=921 m, Tground

Calimaness=1e+09, H

1. layer from: 5955m - 8852m

=0.556cloud = 15.24 and T2

= 16.41, C1C

Figure 6: Real LIDAR graph showing a similar behavior to Figure 5. The green line is theRayleigh fit, the blue one its extrapolation to the axis and the red ones are other fits used tocalculate the cloud transmission.

15

Page 28: Review of the MAGIC LIDAR data analysis method and study of its
Page 29: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

3 The MAGIC LIDAR data analysis method and study ofits stability

In this section, the main proper work, namely a study of different aspects related to the stabil-ity of the method and the system, such as dependence with respect to temperature or zenithangle, will be presented. These topics require a previous explanation on how some parts ofthe data analysis are done, such as fitting the signal data or determining the transmissionvalues.

3.1 Clean night transmission profile

As previously explained, a standard clean night atmosphere profile would have a graph suchas the one displayed in Figure 7. This means that, after a small peak related to ground layerjust after the full overlap takes place, we observe the behavior to be linear, since there are noclouds in the sky. In such a case, we would expect high optical transmission values becausethe lack of clouds allows the light to travel through the atmosphere undisturbed by aerosolsand reach the MAGIC telescopes. Only the ground layer will cause some aerosol extinctionof light. Its analysis is based on a theoretical expectation for the case of no aerosols at alland will be explained in more detail later on (see chapter 3.3).

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 38

Rayleigh fit from: 2680m - 5201m

/NDF=1.32χ, -1C = 16.19, s = 9.2e-05m

=0.858ground

=1071 m, Tground

Calimaness=3e+09, H

Figure 7: Example of a clean night situation.

17

Page 30: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

It was detected however that, during some clean nights, the transmission values weremuch lower than expected. Our first thought was that there could be some aspects relatedto the hardware that had not been taken into account and were causing stability problems.A second possible explanation we considered was that the used software was not stable,meaning that it was not performing equally in every scenario.

This work is based on the second hypothesis. We focused on running different tests toevaluate the software performance under different circumstances to be able to detect hints ofmalfunction and present an updated version of the program with these issues solved.

3.2 Fitting the signal data

The following method is based on two fundamental assumptions.

1. The ground layer is always found below 2.5 km above ground and does not need tobe resolved in detail. Its effect on the transmission of the Cherenkov light is always aglobal one.

2. In case of higher layers, these are always thin and do not need to be resolved either.Only one global extinction coefficient for the entire layer is needed for the Cherenkovdata analysis.

During the update, the way the fitting is done has been significantly changed. We presentthe original method to compare with the new one, because this is probably the major updateof the software.

We repeat that the range corrected signal of the LIDAR in a pure Rayleigh range can bewritten as

N(r) · r2 ≃ ·exp(C− s · r) (20)

where N(r) is the return signal and C and s have been introduced in equation 19.When we refer to a fit in the following paragraphs, we mean an exponential fit that allows

to determine values for C and s, neglecting the influence of the higher order terms. Lookingat the data graphs, since they represent ln

(N(r) · r2) over altitude, we think of C as the y-

intercept and s as the slope, since the equation will be

ln(N(r) · r2)=C− s · r. (21)

Original method by C. Fruck

It is assumed that the ground layer affects the first 2.5 km of the atmosphere. Since theseoptical effects could disturb the Rayleigh fit, a fit is never initialized in the first 3 km of theatmosphere. To locate the first region to fit, we take into account 3 km of distance, from 3km up to 6 km. A length of 500 m is considered and the χ2 is calculated between 3000 mand 3500 m. Then, the region is changed by a step of 50 m and the χ2 is calculated, now

18

Page 31: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

between 3050 m and 3550 m. This process is repeated until the region between 5500 m and6000 m is reached and the region with the lowest χ2 value is where the fit is accepted. Itis important to point out that the slope was fixed to a constant value of 1.2 · 10−4 m−1 (seeequation 19).

In case of the LIDAR pointing to different locations than at zenith, all these values aremultiplied with the cosine of the zenith angle because the x-axis of the plot is given in rangerather than altitude. This convention maintains the fit boundaries always at the same altitude.

To fit in higher altitudes, an analogous procedure is applied, minimizing the χ2 value andupdating the region of study by steps of 50 m up to a maximum altitude of 22 km.

Updated method in this work

Some of the graphs obtained within 2013 indicate that a length of 500 m is often af-fected by small local fluctuations. Moreover, the original method minimized the χ2 valuein the different regions without taking into account that even the minimum χ2 value couldbe too high. For this reason, a method with variable length and a χ2 threshold has beenimplemented. We also left the slope variable for the fit.

At the beginning, this method works as the other one did, but setting an interval lengthof 2500 m to gain stability. After the χ2 value has been minimized considering the differentpossible intervals between 3.125 km and 6 km altitude, it is compared with a threshold. If thecalculated value is greater than this threshold value, the interval is reduced by a factor of 1.25and the same procedure is applied with this new interval length. There is also a minimuminterval length that we set at 700 m to avoid instability.

To fit in higher altitudes, the same method is applied, fitting up to 22 km altitude.An example of the results obtained using both methods is shown in Figures 8 and 9.

On the one hand, we can see that the original program finds the first region to fit in a pureRayleigh situation, as we would expect. Even though the fit region is correct, the fact that theslope is fixed does not include the dependencies on zenith angle and possible dependencieson atmospheric conditions and, in some situations, the fixed value might not be appropriate.In such a case, the C value could end up being too high with a negative measurement forthe Calimaness, which does not really make sense. Furthermore, the transmission coefficientcould be greater than 1, which is also meaningless. On the other hand, the plot obtained withthe new version of the software, given that the fit length is much larger, gives a slightly morestable fit that results in a more reasonable value for C and the Calimaness and values of thetransmission coefficient between 0 and 1, as they should be.

It has been seen that this method is more stable than the other one, but in some particularsituations it might be possible than high χ2 values are reached. It could happen if the χ2

value is too high and a minimum length interval requires further division, which will notoccur. In this case, the image is completely discarded from further analysis.

19

Page 32: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 15

Rayleigh fit from: 3485m - 3985m

/NDF=0.92χ, -1C = 16.37, s = 0.00012m

=0.939ground

=1064 m, Tground

Calimaness=2e+09, H

Figure 8: Example of a fit done with the original method by C. Fruck.

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 15

Rayleigh fit from: 2579m - 5677m

/NDF=1.72χ, -1C = 16.26, s = 9.2e-05m

=0.888ground

=1209 m, Tground

Calimaness=3e+09, H

Figure 9: Example of a fit done with the updated method in this work.

20

Page 33: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

/NDF)2χlog(0 0.5 1 1.5 2 2.5

Ray

leig

h no

rmal

izat

ion

C

10

210

310

/NDF2χRayleigh Fit Normalization vs.

/NDF)2χlog(0 0.5 1 1.5 2 2.5

)-1

Ray

leig

h S

lope

s (

m

-410

-310

-210

/NDF2χRayleigh Fit Slope vs.

Figure 10: χ2 distributions that justify the threshold that was set on the χ2 of the Rayleigh fit(the cleannights quality cut is the green line and the violet one is used for other purposes).

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 2

Rayleigh fit from: 3698m - 4517m

/NDF=1.92χ, -1), s = 0.00016m2C = 16.56 ln(m

=1.030ground

Calimaness = -1e+09, T

1. layer from: 6247m - 9396m

=0.557cloud = 15.15 and T2

= 16.32, C1C

Figure 11: Example of a fit that results in a negative Calimaness measurement.

21

Page 34: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

hIntegralplotEntries 13548Mean 5.296e+09

/ ndf 2χ 19.5686 / 10Constant 15± 1150

µ 2.6e+07± 3.2e+09 σ 1.8e+07± 1.062e+09

Calimaness (1)0 20 40 60 80 100

910×

Cou

nts

1

10

210

310

hIntegralplotEntries 13548Mean 5.296e+09

/ ndf 2χ 19.5686 / 10Constant 15± 1150

µ 2.6e+07± 3.2e+09 σ 1.8e+07± 1.062e+09

Calimaness

Figure 12: Calimaness distribution showing the thresholds that determine if a data file isrelated to cleannights or dustynights.

Plotting the reduced χ2 distribution, as we do in Figure 10, we see that below the thresh-old of 5, most of the fit results have reasonable values (i.e. 12 <C < 17 and s below 3 ·10−4)while above the threshold the nonsense results dominate.

There are some situations where negative values for the Calimaness are measured. Wehave found that this occurred during three nights where small hardly visible layers of aerosolsare found in the region of the first Rayleigh fit. Figure 11 shows an example. Looking at thedistribution of Calimaness (see Figure 12) we see that another case corresponds indeed to adifferent population of events from the normal statistical fluctuations of a clean night.

3.3 Determination of the transmission values

It is not possible to obtain information of the transmission only by means of the backscatteredlight of a single wavelength. Since this LIDAR system operates with only one wavelength,we need another method. As previously mentioned, since we do have range resolved infor-mation of the number of photon counts, transmission variations can be directly measuredby comparing the range corrected number of photon counts measured at two given altitudes,given the previous assumptions.

If we fit the data to an exponential function at ranges r1 and r2 with an aerosol layerin between, since s, according to the chosen standard atmosphere model, is not expected tochange with distance, the same function will be obtained, but they will have different scalingconstants C1 and C2. Taking the difference of the range corrected number of photon counts,which is equivalent to taking exp(−(C1 −C2)), we will know the relative number of photoncounts at range r2 with respect to that at range r1; it is the attenuation of the signal for adouble transmission. It is a double transmission because the light collected by the LIDARdetector travels through the same atmosphere layers twice; once going up after being shot

22

Page 35: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

and once going down after being backscattered. It is for this reason that we consider thetransmission coefficient to be

T1,2 = exp(−1

2· (C1 −C2)

). (22)

Cloud detection

Within the program, we only determine transmission coefficients through cloud layers.We will now introduce how these clouds are detected.

In previous sections we have already explained how clouds affect the transmission oflight; in the presence of clouds, the number of backscattered photons massively increases.In these situations, the reduced χ2 is significantly greater than 1. The software detects acloud as a region where the reduced χ2 is greater than 2.5. At higher altitudes, when thecloud layer has been left behind, another cloudless region will be found and another fit willbe made. Comparing both the fitted value of C before and the one after the cloud, we will beable to determine the transmission coefficient across the cloud layer.

Cloudiness at low altitudes

If there is a cloud layer in the region where the first fit would normally take place, wewill not have a reference value to compare with. For this reason, we would like to determinea standard C value that we could use to determine transmission coefficients where such thingoccurs. We call this standard value C0.

In the original program, after running some tests, this value was set to 16.5. We deter-mined this number in a theoretical way. Taking equation 19,

C0 = ln(N ·A · l ·β0) . (23)

We assume N = 6.825 · 1012 photons, A = π · r2 · PDE ≈ 0.04 m2, l = 48 m and β0 ≈1.25 · 10−6 m−1 and the obtained value is C0 = 16.6. The difference to C. Fruck’s valuecorresponds to a difference of 0.3% of the obtained transmission, according to equation 22.Assuming the LIDAR system to be stable, this value should not change much over time,meaning that considering C0 = 16.5 to be able to determine transmission coefficients whenthe first fit could not be made should be a reasonable estimation. However, C0 may show de-pendencies on temperature, atmospheric pressure and time, even if the LIDAR system wasstable, because the atmosphere changes continuously.

Being aware of these possible shortcomings we can define a transmissions value for theground layer as

Tground = exp(−1

2· (C0 −C1)

). (24)

23

Page 36: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

3.4 Stability over time

Apart from C. Fruck’s initial tests, this C0 value had not been studied any further. Since itgives information about the stability of the system, we decided to observe the dependence ofthis C0 value with time. Furthermore, we wanted to compare the theoretical value with theaverage value among the C values of the first fit in clean night measurements.

As shown in Figure 14, we can see that a night with strong Calimaness presents anatmospheric profile with an offset between the collected data and the linear extrapolation ofthe first fit. Figure 15 shows an example of a low Calimaness situation. We can calculate thearea enclosed by both functions as a numeric estimation of the Calima effect. This will serveus well to separate the files in the so-called cleannights and dustynights folders, which arerespectively related to dustless and dusty nights in the first kilometers of the atmosphere.

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 10

Rayleigh fit from: 4282m - 5088m

/NDF=10.42χ and -1), s = 0.00180m2C = 24.79 log(m

=63.064ground

Calimaness = -1e+13, T

1. layer from: 7431m - 20669m

=0.000cloud = 0.00 and T2

= 27.73, C1C

Figure 13: Example of a bad fit situation.

We determined the number of counts associated with every possible value of this offset,obtaining its profile according to relative frequency. Doing so, a graph shown in Figure12 provided information on how to set a threshold to automatically distinguish clear fromdusty nights. In the distribution we can distinguish four populations of events: first, thosecorresponding to very clear nights, which have been fit to a Gaussian. At the left side ofthat Gaussian, a small number of events is found which happens to have negative values forthe Calimaness. In the previous chapter, where we have already studied these events, wehave found that these correspond to a situation where the Rayleigh fit has been distorted due

24

Page 37: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

to tiny aerosol layers in the fit region. At the right side of the Gaussian, another broaderdistribution of events with a small amount of dust is found. It is related to the residualaerosol ground layer. Finally, for Calimaness values greater than 1010, dust intrusions fromthe Saharan desert have occurred, which cause large extinction of light. These situationsare very well known for the ORM [Lombardi (2008)]. Figure 16 shows the evolution of theCalimaness values over 2013. The dust intrusions (Calima) during the summer months areclearly visible.

The program required an automatic method to determine if a data file corresponded toa clear night or not in order to separate the files in the cleannights and dustynights folders.A third category called badfit was introduced for images whose Rayleigh part could notbe fit (see Figure 13). The cleannights folder is filled with those files with a Calimanesssmaller than 1010 and a ground layer transmission greater than 0.75 (see Figures 12 and 17).We can consider the minimum value between the two peaks as a threshold because it willseparate both data groups and there will be the smallest amount of files in a region whereit is complicated to decide whether it was a clean night or not. The dustynights folder isfilled with those data sets above the two dust thresholds and the badfit files are those witha reduced χ2 value greater than 5 or a negative Calimaness. We have run the program over14793 data files and there are about 10% of the files in the dustynights folder and 2.1% inthe badfit folder.

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 42

Rayleigh fit from: 4043m - 5897m

/NDF=0.92χ and -1), s = 0.00012m2C = 15.47 log(m

=0.597ground

Calimaness = 2e+10, T

Figure 14: Example of a fit with strong Calimaness.

There is a fourth folder, named nosignal, which contains the events which basically show

25

Page 38: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

only noise because the LIDAR was inside a cloud. These files are detected using a thresholdon the integrated signal within the first five kilometers of the atmosphere. This happens inabout 1.3% of the cases.4

altitude above MAGIC (m)0 2 4 6 8 10 12 14 16

310×

))2 (

m2

r×S

= ln

( N

(r)

(ph.

e./b

in)

13

13.5

14

14.5

15

15.5

16

16.5

17

17.5

18 °Zenith angle: 22

Rayleigh fit from: 3654m - 5966m

/NDF=0.92χ and -1), s = 0.00011m2C = 16.39 log(m

=0.945ground

Calimaness = 4e+09, T

Figure 15: Example of a fit with no Calimaness and only some residual ground layer effect.

Time/dateDec-31 Mar-02 May-01 Jul-01 Aug-31 Oct-31 Dec-31

Cal

iman

ess

910

1010

1110

Calimaness vs. time

Figure 16: Calimaness values measured in 2013 showing the threshold that distinguishesbetween cleannights and dustynights.

4The duty cycle of the LIDAR is very high but a concrete number has not yet been provided by the MAGICcollaboration.

26

Page 39: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

Calimaness (1)0 5 10 15 20 25 30 35 40

910×

(1)

0T

0.2

0.3

0.4

0.5

0.6

0.7

0.8

0.9

1

1.1

0

20

40

60

80

100

120

Ground layer transmission vs. Calimaness

Figure 17: Plot showing the correlation between the Calimaness and the ground layer trans-mission. At 1010 for the Calimaness and 0.75 for the ground layer transmission, thereis the threshold to automatically filter the data files to save the results as cleannights ordustynights.

3.5 Dependence with respect to zenith angle

In the following we study dependencies of the fit parameters with zenith angle. To do so, weplot the distributions of the fit parameters against the inverse of the cosine of the zenith angleand fit their mean profile to a linear dependency assumption. The fits are typically distortedby Calima events and by outliers. For this reason, only cleannights data have been selectedand moreover simple graphical cuts have been applied to the two-dimensional distributionsto discard far outliers.

In the left side of Figure 18, the dependency of the Rayleigh normalization with respectto the inverse of the cosine of the zenith angle is shown. It is expected that, for clean nights,only a tiny correlation exists due to the atmospheric transmission of the ground layer (seeequation 19), namely −1/cosθ · ln1/T 2

g . Aerosol transmission measurements from Tenerifesuggest that Tg ≈ 0.98 for clean nights, hence − ln1/T 2

g ≈−0.04. We see in Figure 18 (left)that no correlation at all seems to exist and the fit to the mean profile gives a dependency

27

Page 40: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

compatible with zero. The natural variations of the ground layer density seem to be muchbigger than the expected zenith angle dependency, as can also be appreciated by eye in thegraph. We conclude that the expected dependency is too small to be measured with thismethod.

In the right side of Figure 18, we can see the dependency of the Rayleigh slope withrespect to the inverse of the the cosine of the zenith angle. In this case, there is a slightdependency between them, as it is expected (see equation 19). We estimated this correlationto have a slope of the order of 16π

3 ·β0 ≈ 2.1 ·10−5, and we can see in the fit to the histogramprofile that the measured value is about 1.21 ·10−5±0.07 m−1. This result is of the expectedorder of magnitude, but comes out to be a factor of 1.7 too low. To discard effects of thequadratic terms, we applied a cut on the zenith angle requiring θ < 25C with no differ-ent outcome. Again, variations of the atmosphere seem to have a greater impact than theexpected dependency.

)θ1/cos(1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2

Ray

leig

h no

rmal

izat

ion

C

16.1

16.2

16.3

16.4

16.5

0

10

20

30

40

50

)θC vs. 1/cos( / ndf 2χ 286.707 / 56

p0 0.0057± 16.3183

p1 0.00461478± 0.00213999

)θC vs. 1/cos( / ndf 2χ 286.707 / 56

p0 0.0057± 16.3183

p1 0.00461478± 0.00213999

-1Rayleigh normalization vs. cos(Zenith)

)θC vs. 1/cos( / ndf 2χ 286.707 / 56

p0 0.0057± 16.3183 p1 0.0046± 0.0021

σ: 0.00,S: 0.2ρ

)θ1/cos(1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2

)-1

Ray

leig

h S

lope

(m

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16-310×

0

5

10

15

20

25

30

35

40

)θs vs. 1/cos( / ndf 2χ 343.691 / 55

p0 8.27366e-07± 9.89131e-05

p1 6.89593e-07± 1.21421e-05

)θs vs. 1/cos( / ndf 2χ 343.691 / 55

p0 8.27366e-07± 9.89131e-05

p1 6.89593e-07± 1.21421e-05

-1Rayleigh Slope vs. cos(Zenith)

)θs vs. 1/cos( / ndf 2χ 343.691 / 55

p0 8.3e-07± 9.891e-05

p1 6.9e-07± 1.214e-05

σ: 0.11,S: 10.5ρ

Figure 18: Dependence of the Rayleigh normalization and slope with respect to the zenithangle.

3.6 Dependence with respect to temperature, pressure and relative hu-midity

Almost every part of the LIDAR hardware (eg. the laser output power or the PDE of theHPD) as well as the atmospheric parameters (eg. β0 or H0,n) are expected to vary withtemperature, but also atmospheric pressure and relative humidity. It is therefore expected to

28

Page 41: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

obtain correlations of the Rayleigh fit parameters with these, but the results will be difficultto interpret since we can not disentangle the individual dependencies from each other.

From equation 19, we expect that the normalization C correlates linearly with the naturallogarithm of atmospheric pressure divided by temperature, since β0 contains the atmosphericconditions at the MAGIC site. The slope s is expected to contain a similar but smallerdependency; P

PMAGIC· TMAGIC

T · 16π3 · β0, where we used for the average atmospheric pressure

PMAGIC = 788.2 hPa and TMAGIC = 282.04 K. Such a correlation is shown in Figure 19.

ln(pressure/temperature (hPa/K))-0.04 -0.03 -0.02 -0.01 0 0.01 0.02 0.03

Ray

leig

h no

rmal

izat

ion

C

16

16.1

16.2

16.3

16.4

16.5

0

2

4

6

8

10

12

14

16

18

MAGIC/T

MAGICC vs. P

/ ndf 2χ 1624.73 / 54

p0 0.001± 16.301

p1 0.07781± 6.10795

MAGIC/T

MAGICC vs. P

/ ndf 2χ 1624.73 / 54

p0 0.001± 16.301

p1 0.07781± 6.10795

Rayleigh normalization vs. P/T

MAGIC/TMAGICC vs. P / ndf 2χ 1624.73 / 54

p0 0.001± 16.301 p1 0.078± 6.108

σ: 0.51,S: 34.3ρ

pressure/temperature (hPa/K)0.96 0.97 0.98 0.99 1 1.01 1.02 1.03

)-1

Ray

leig

h S

lope

s (

m

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16-310×

0

2

4

6

8

10

12

MAGIC/T

MAGICs vs. P

/ ndf 2χ 287.853 / 51

p0 0.000016340± 0.000223505 p1 0.000016406± -0.000113317

MAGIC/T

MAGICs vs. P

/ ndf 2χ 287.853 / 51

p0 0.000016340± 0.000223505 p1 0.000016406± -0.000113317

Rayleigh Slope vs. P/T

MAGIC/TMAGICs vs. P / ndf 2χ 287.853 / 51

p0 1.6e-05± 0.000224 p1 1.6e-05± -0.000113

σ: -0.08,S: 5.3ρ

Figure 19: Rayleigh normalization C plotted against ln PPMAGIC

· TMAGICT (left). Rayleigh slope s

plotted against PT (right).

In the first case, the correlation is observed to be a factor 6 stronger than expected. Thefitted slope results to be slightly negative. However, the correlation is weak. This alreadypoints to additional temperature dependencies.

The next Figure 20 shows the pure dependencies with temperature before and after thecorrection for P/T . One can see that the correction slightly reduces the dependency of theRayleigh normalization on temperature. However, a strong correlation of ∆C

∆T = −0.0129±0.0004C remains. The correlation with the slope is compatible with no correlation for bothcases.

Looking again into equation 19, we could identify three possible dependencies with tem-perature, namely the laser output power, the PDE of the HPD and the ground layer transmis-sion.

A quick look into the literature [Sato (2012)] showed that Nd:YAG lasers do have anegative dependency of the output power on temperature of the same order of magnitude.

29

Page 42: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

Sato et al. give a value of -2% per degree Celsius, which is of the same order of magnitudeas our measurement of -1.3% per degree Celsius.

As any semiconductor device, HPDs do show a very strong dependency of their gainwith temperature, of the order of -2% per degree Celsius [Saito (2008)]. The MAGIC col-laboration has succeeded in building a temperature stabilized control of HPDs[Saito (2008)]reducing the dependency to -0.3% per degree Celsius from 25 to 35C. The last number is afactor 4 smaller than our measurement of -1.3% per degree Celsius, however, C. Fruck (priv.comm.) believes that a stronger residual dependency is plausible for the HPD device used inthe MAGIC LIDAR.

C)°temperature (0 2 4 6 8 10 12 14 16 18 20 22

Ray

leig

h no

rmal

izat

ion

C

16

16.1

16.2

16.3

16.4

16.5

0

2

4

6

8

10

12

14

16MAGIC

C vs. T

/ ndf 2χ 680.795 / 47p0 0.0035± 16.4451 p1 0.0003687± -0.0140744

MAGICC vs. T

/ ndf 2χ 680.795 / 47p0 0.0035± 16.4451 p1 0.0003687± -0.0140744

Rayleigh normalization vs. Temperature

MAGICC vs. T / ndf 2χ 680.795 / 47

p0 0.0035± 16.4451 p1 0.00037± -0.01407

σ: -0.51,S: 34.8ρ

C)°temperature (0 2 4 6 8 10 12 14 16 18 20 22

)-1

Ray

leig

h S

lope

s (

m

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16-310×

0

2

4

6

8

10

12

14MAGIC

s vs. T / ndf 2χ 670.431 / 54

p0 0.000000506± 0.000108549

p1 4.40636e-08± 1.67985e-07

MAGICs vs. T

/ ndf 2χ 670.431 / 54

p0 0.000000506± 0.000108549

p1 4.40636e-08± 1.67985e-07

Rayleigh Slope vs. Temperature

MAGICs vs. T / ndf 2χ 670.431 / 54

p0 5.1e-07± 0.00010855 p1 4.4e-08± 1.68e-07

σ: 0.02,S: 1.3ρ

C)°temperature (0 2 4 6 8 10 12 14 16 18 20 22

Ray

leig

h no

rmal

izat

ion

C

16

16.1

16.2

16.3

16.4

16.5

0

2

4

6

8

10

12

14

16

18

20 (clean nights, P/T corr.)

MAGICC vs. T

/ ndf 2χ 363.452 / 42p0 0.0035± 16.4405

p1 0.0003681± -0.0129285

(clean nights, P/T corr.)MAGIC

C vs. T

/ ndf 2χ 363.452 / 42p0 0.0035± 16.4405

p1 0.0003681± -0.0129285

Rayleigh normalization (P/T corrected) vs. Temperature

(clean nights, P/T corr.)MAGICC vs. T

/ ndf 2χ 363.452 / 42p0 0.0035± 16.4405 p1 0.00037± -0.01293

σ: -0.57,S: 39.8ρ

C)°temperature (0 2 4 6 8 10 12 14 16 18 20 22

)-1

Ray

leig

h S

lope

s (

m

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16

-310×

0

2

4

6

8

10

12

14 (clean nights, P/T corr.)

MAGICs vs. T

/ ndf 2χ 655.38 / 54

p0 0.000000471± 0.000106628

p1 4.16211e-08± 2.12935e-07

(clean nights, P/T corr.)MAGIC

s vs. T

/ ndf 2χ 655.38 / 54

p0 0.000000471± 0.000106628

p1 4.16211e-08± 2.12935e-07

Rayleigh Slope (P/T corrected) vs. Temperature

(clean nights, P/T corr.)MAGIC

s vs. T

/ ndf 2χ 655.38 / 54

p0 4.7e-07± 0.00010663 p1 4.2e-08± 2.13e-07

σ: 0.00,S: 0.3ρ

Figure 20: Dependencies of the Rayleigh normalization (left) and Rayleigh slope (right)with respect to temperature, before (top) and after (bottom) correcting their dependencieson temperature.

30

Page 43: Review of the MAGIC LIDAR data analysis method and study of its

The MAGIC LIDAR data analysis method and study of its stability Miquel Cassanyes

As a third hypothesis, we consider the dependency of the extinction coefficient αa withtemperature. As C depends on the ground layer transmission as − 2

cosθ · ln 1T 2

g, as dependency

of -0.3% transmission per degree Celsius would explain our measurements. This is possiblesince dust intrusions correlate with high temperature on the Canary Islands [Lombardi (2011)].

Another external parameter of interest is the relative humidity. Figure 21 shows theresults of plotting the Rayleigh normalization and the Rayleigh slope against the relativehumidity. On the left side, we can see that the dependencies for the Rayleigh normalizationshow a correlation coefficient ρ =−0.02, which means that they are neglectful. One mightconsider a possible dependency related to the transmission value of the ground layer, butit showed an insignificant correlation; given the fit results, we can set an upper limit tothe dependency of 0.045% per percent of relative humidity with 95% CL. On the otherhand, the right side of Figure 21 indicates that a significant but weak correlation of ρ =0.19 exists between the Rayleigh slope and the relative humidity. As equation 19 shows,there is an expected dependency of the slope with respect to the temperature lapse rate (seedefinition of H0,n after equation 7), which depends on relative humidity [UC]. We find(1.5±0.1) ·10−7 m−1 per percent of relative humidity.

rel.hum. (%)0 10 20 30 40 50 60 70 80 90

Ray

leig

h no

rmal

izat

ion

C

16

16.1

16.2

16.3

16.4

16.5

0

5

10

15

20

25

30

MAGICC vs. RH / ndf 2χ 299.323 / 58

p0 0.0023± 16.3139

p1 0.000085520± 0.000266635

MAGICC vs. RH / ndf 2χ 299.323 / 58

p0 0.0023± 16.3139

p1 0.000085520± 0.000266635

Rayleigh normalization vs. Rel. Humidity

MAGICC vs. RH / ndf 2χ 299.323 / 58

p0 0.0023± 16.3139 p1 8.6e-05± 0.000267

σ: -0.02,S: 1.2ρ

rel.hum. (%)0 10 20 30 40 50 60 70 80 90

)-1

Ray

leig

h S

lope

s (

m

0.07

0.08

0.09

0.1

0.11

0.12

0.13

0.14

0.15

0.16-310×

0

2

4

6

8

10

12

14

16

18

20

22

MAGICs vs. RH / ndf 2χ 379.049 / 58

p0 0.000000341± 0.000107069

p1 1.12900e-08± 1.46653e-07

MAGICs vs. RH / ndf 2χ 379.049 / 58

p0 0.000000341± 0.000107069

p1 1.12900e-08± 1.46653e-07

Rayleigh Slope vs. Rel. Humidity

MAGICs vs. RH / ndf 2χ 379.049 / 58

p0 3.4e-07± 0.00010707 p1 1.1e-08± 1.47e-07

σ: 0.19,S: 11.7ρ

Figure 21: Rayleigh normalization and Rayleigh slope plotted against relative humidity.

31

Page 44: Review of the MAGIC LIDAR data analysis method and study of its
Page 45: Review of the MAGIC LIDAR data analysis method and study of its

Conclusions and outlook Miquel Cassanyes

4 Conclusions and outlook

This work is based on the analysis of a LIDAR system, installed at the Observatorio delRoque de los Muchachos (ORM) at La Palma (Canary Islands) for the MAGIC telescopessystem. It has now taken one full year of standard data (14793 data sets), which allows areview of the stability of the standard analysis method as well as the LIDAR hardware itself.The standard analysis has been developed by Christian Fruck at the MPI Munich, with whomI collaborated closely since summer 2013.

I checked and improved the Rayleigh fit algorithm of the MAGIC LIDAR data analysis.This improved method works in at least 97.9% of the cases, after removal of the small portionof data without signal. The main changes are related to the fitting algorithm, implementing avariable fit length and various quality thresholds based on the reduced χ2 of the accepted fitsas well as others related to the interpretation of the results (ie. cleannights and dustynights).I have shown that the method is stable even in cases of strong Calima.

In order to understand possible dependencies of the Rayleigh fit results on zenith angle,temperature, pressure and relative humidity, I first derived a theoretical formula for the rangecorrected return signal for an altitude range where no aerosols are present in the air. In thisequation, number 19, all the expected dependencies are presented.

Among the investigated parameters, only one strong and non-expected correlation wasfound, namely the intercept of the Rayleigh fit with respect to ambient temperature on theground (see Figure 20). This effect could be explained by either a -1.3%/C degradationof the laser output power, a -1.3%/C degradation of the Hybrid Photon Detector (HPD)gain used for the detection of the LIDAR return signal or a possible average degradationof -0.3%/C the atmospheric transmission of the aerosol ground layer in the first thousandmeters of the atmosphere. Also a combination of the three effects is possible.

Finally, the stability of the retrieved Rayleigh fit intercept values during 2013 has beeninvestigated and is shown in Figure 22. Their evolution with time is shown and fitted foronly clean nights with and without corrections due to temperature and atmospheric pressure.In all three cases an increase of the values with time is observed. This is incompatible withan assumed degradation of the LIDAR hardware. The fact that the temperature correctionsincrease further this positive dependency with time points to the hypothesis that the previ-ously found temperature dependency has to be attributed rather to changes in the dust contentof the ground layer than to hardware effects of the LIDAR itself. Assuming hence that thehardware is best described by only the obvious P/T corrections, we obtain an apparent en-hancement of the LIDAR sensitivity of (4.8± 0.5)% per year. This allows us to excludedegradation of the LIDAR mirrors and HPDs at the level of 9.6σ . Looking at the distributionof temperatures over the year 2013 (see Figure 24), we can see that the spring of 2013 wason average colder than the autumn. The evolution of the temperature was hence not symmet-ric around the summer months. To further exclude seasonal effects of the atmosphere, it isnecessary to analyze more yearly cycles of LIDAR data.

From the distribution of C values shown in Figure 23, we can assume that C never goesbeyond a value of about 16.6, compatible with our previous theoretical estimation (see equa-

33

Page 46: Review of the MAGIC LIDAR data analysis method and study of its

Conclusions and outlook Miquel Cassanyes

tion 23). Knowing that the aerosol content at La Palma can reach values of almost 0, thisvalue can be assume to be very close to the true value of C0.

Time/dateDec-31 Mar-02 May-01 Jul-01 Aug-31 Oct-31 Dec-31

Ray

leig

h no

rmal

izat

ion

C

15.2

15.4

15.6

15.8

16

16.2

16.4

16.6

Rayleigh normalization vs. time

/ ndf 2χ 39.5814 / 3810

beginning of yearC 0.0027± 16.2876

) -1 C (year∆ 0.0048± 0.0612

/ ndf 2χ 45.2678 / 3810

beginning of yearC 0.0029± 16.2938

) -1 C (year∆ 0.0051± 0.0485

/ ndf 2χ 28.5336 / 3810

beginning of yearC 0.0023± 16.2734

) -1 C (year∆ 0.0041± 0.0928

Figure 22: Values measured in 2013 showing the intercept of the Rayleigh fit C versus timefor the following cases: dusty nights (red), clean nights (green), clean nights corrected foratmospheric pressure and temperature (P/T ) (blue) and using the full temperature correc-tion (orange). The last three have been fitted to a linear fit assumption.

Rayleigh normalization C14 14.5 15 15.5 16 16.5

Cou

nts

1

10

210

310

Rayleigh normalizationclean nights, low zenith angle

Constant 3.8± 169.9 µ 0.0019± 16.3268 σ 0.0017± 0.0938

clean nights, low zenith angleConstant 3.8± 169.9

µ 0.0019± 16.3268 σ 0.0017± 0.0938 clean nights, P/T corrected, low zenith angle

Constant 3.7± 164 µ 0.0019± 16.3299 σ 0.0018± 0.0963

clean nights, P/T corrected, low zenith angleConstant 3.7± 164

µ 0.0019± 16.3299 σ 0.0018± 0.0963

clean nights, P/T and T corrected, low zenith angle

Constant 3.9± 182.7 µ 0.002± 16.3212 σ 0.0016± 0.0881

clean nights, P/T and T corrected, low zenith angle

Constant 3.9± 182.7 µ 0.002± 16.3212 σ 0.0016± 0.0881

Figure 23: Distribution of intercept values of the Rayleigh fit C for the following cases:dusty nights (red), clean nights (green), clean nights corrected for atmospheric pressure andtemperature (P/T ) (blue) and using the full temperature correction (orange). The last threehave been fitted to a Gaussian assumption.

34

Page 47: Review of the MAGIC LIDAR data analysis method and study of its

Conclusions and outlook Miquel Cassanyes

Time/dateDec-31 Mar-02 May-01 Jul-01 Aug-31 Oct-31 Dec-31

C)

°te

mpe

ratu

re o

n gr

ound

(

0

24

68

10

1214

1618

2022

24

Temperature on ground vs. time

Figure 24: Values of the temperature in ORM during 2013.

35

Page 48: Review of the MAGIC LIDAR data analysis method and study of its
Page 49: Review of the MAGIC LIDAR data analysis method and study of its

References Miquel Cassanyes

References

[Bodhaine (1999)] Bodhaine, B. A. and Wood, N. B. and Dutton, E. G. and Slusser, J. R.,On Rayleigh Optical Depth Calculations, volume 16, page 1854, Journal of Atmosphericand Oceanic Technology, 1999.

[Bucholtz (1995)] Bucholtz, A., Rayleigh-scattering calculations for the terrestrial atmo-sphere, issue 15, volume 34, page 2765, Applied Optics, 1995.

[Chandrasekhar (1950)] Chandrasekhar, S., Radiative Transfer, chapter 1, page 49, OxfordUniv. Press, UK, 1950.

[Fegan (1997)] Fegan, D. J., Topical Review: γ/hadron separation at TeV energies, Journalof Physics G Nuclear Physics, 1997.

[Fruck (2011)] Fruck, C., A new LIDAR system for the MAGIC telescopes and site searchinstrumentation for CTA, Diploma thesis, Technical University of Munich, 2011.

[Grupen (2005)] Grupen, C., Astroparticle physics, Springer, 2005.

[Hillas (1985)] Hillas, A. M., Cherenkov light images of EAS produced by primary gammashowers, Proc. of the 19th ICRC, 1985.

[Hillas (2013)] Hillas, A. M., Evolution of ground-based gamma-ray astronomy from theearly days to the Cherenkov Telescope Arrays, Astroparticle Physics, 2013.

[IAC] Instituto de Astrofísica de Canarias, http://www.iac.es/eno.php?op1=2.

[Klett (1981)] Klett, J. D. , Stable analytical inversion solution for processing lidar returns,Applied Optics, 20:211-220, 1981.

[UC] Lectures on The Climate System of the University of Columbia, http://eesc.

columbia.edu/courses/ees/climate/lectures/atm_phys.html. 2007.

[Lide (1996)] Lide, D. R., Handbook of Chemistry and Physics, CRC Press, 1996.

[Lombardi (2008)] Lombardi G., Zitelli V., Ortolani S., Pedani M. and Ghedina A., “ElRoque de Los Muchachos Site characteristics. III. Analysis of atmospheric dust andaerosol extinction”, A&A 8273 (2008), arXiv:0802.3947v2.

[Lombardi (2011)] Lombardi, G. and Zitelli, V. and Ortolani, S. and Melnick, J. and Ghe-dina, A. and Garcia, A. Molinari E. and Gatica C., Near-infrared thermal emissivityfrom ground based atmospheric dust measurements at ORM MNRAS 416, Issue 2, pp.1585-1590, 2011.

[McCartney (1976)] McCartney, J. Optics of the atmosphere: scattering by molecules andparticles, John Wiley & Sons, Pure and Applied Optics Series, 1976.

37

Page 50: Review of the MAGIC LIDAR data analysis method and study of its

References Miquel Cassanyes

[Measures (1984)] Measures, R. M., Laser Remote Sensing, Wiley, 1984.

[Menzel (2013)] Menzel, U. Monte Carlo studies of gamma-mimicking hadron backgroundin Imaging Air Cherenkov Telescopes, Diploma thesis, University of Konstanz, 2013.

[Tomasi (2005)] Tomasi, C. and Vitale, V. and Petrov, B. and Lupi, A. and Cacciari, A.,Improved algorithm for calculations of Rayleigh-scattering optical depth in standardatmospheres, volume 44, issue 16, page 3320, Applied Optics, 2005.

[NASA (1976)] NASA, U.S. Standard Atmosphere, U.S. Government Printing Office, 1976.

[Minzner (1976)] Minzner, R. A. et al., Defining constants, equations, and abbreviated ta-bles of the 1975 U.S. Standard Atmosphere, NASA Technical Report, 1976.

[Saito (2008)] Saito, T. Y. and Shayduk, M. and Fonseca, M. V. et al., Recent Progress ofGaAsP HPD development for the MAGIC telescope project, International Cosmic RayConference, 2008.

[Sato (2012)] Sato, Y. and Taira, T., Model for the temperature dependent emission crosssection of Nd laser media, in Conference on Lasers and Electro-Optics 2012, OSA Tech-nical Digest (online) (Optical Society of America, 2012), paper CTu1D.7.

[Schultz (2013)] Schultz, C. H.E., Development of New Composite Mirrors for ImagingCherenkov Telescopes and Observations of the Two Blazar Objects 1ES 0806+054 and1ES 1011+496 with MAGIC Ph.D. thesis, University and INFN Padova, 2013.

[Wagner (2006)] Wagner, R. M., Measurement of Very High Energy Gamma-Ray Emissionfrom Four Blazars Using the MAGIC telescope and a Comparative Blazar Study, Ph.D.thesis, Technical University of Munich, 2006.

[Weekes (1989)] Weekes, T. C. and Cawley, M. F. and Fegan, D. J., Observation of TeVGamma-rays from the Crab Nebula Using the Atmospheric Cerenkov Imaging Tech-nique, The Astrophysics Journal, 1989.

38

Page 51: Review of the MAGIC LIDAR data analysis method and study of its

Acknowledgments Miquel Cassanyes

Acknowledgements

I would like to express my appreciation to Christian Fruck, supervisor of this work, forhis patient guidance during the planning and development of this research work and myintroduction to the field of γ-ray astronomy. I wish to thank Dr. Markus Gaug as well, alsosupervisor of this work, for his willingness to discuss and exhaustively review this work.

I would like to acknowledge the help provided by Dr. Razmik Mirzoyan, who gave methe chance to develop part of this work within the MPI. I am also grateful to Prof. LluísFont, co-tutor of this work, who offered me the possibility to develop this bachelor thesiswithin the MAGIC collaboration and has uninterruptedly guided me, and by Prof. JosepMaria Mondelo, also co-tutor of this work, always willing to help.

I would also like to thank all the people of the MAGIC group at MPI, who helped meduring my stay in Munich.

Finally, I wish to thank my family for their unconditional support throughout the wholeprocess of writing this work.

39

Page 52: Review of the MAGIC LIDAR data analysis method and study of its
Page 53: Review of the MAGIC LIDAR data analysis method and study of its

Agraïments Miquel Cassanyes

Agraïments

M’agradaria expressar el meu agraïment a en Christian Fruck, supervisor d’aquest treball,per la seva paciència i orientació al llarg de la planificació i el desenvolupament d’aquesttreball de recerca i de la meva introducció al camp de l’astronomia de rajos gamma. Voldriaagrair també al Dr. Markus Gaug, també supervisor d’aquest treball, la seva disposició adiscutir i a revisar exhaustivament aquest treball.

M’agradaria fer constar l’ajuda donada pel Dr. Razmik Mirzoyan, que va donar-me laoportunitat de desenvolupar part d’aquest treball a l’MPI. També estic agraït per l’ajuda delProf. Lluís Font, cotutor d’aquest treball, que va oferir-me la possiblitat de desenvoluparaquest treball de fi de grau dins la col·laboració MAGIC i que m’ha guiat en tot moment, i ladel Prof. Josep Maria Mondelo, també cotutor d’aquest treball, sempre disposat a ajudar.

Voldria donar les gràcies a tota la gent del grup MAGIC de l’MPI, que van ajudar-medurant la meva estada a Munic.

Finalment, vull agrair a la meva família el seu suport incondicional al llarg de tot elprocés de redactar aquest treball.

41

Page 54: Review of the MAGIC LIDAR data analysis method and study of its
Page 55: Review of the MAGIC LIDAR data analysis method and study of its

Danksagung Miquel Cassanyes

Danksagung

I möchte mich ganz besonders bei Christian Fruck, den Betreuer dieser Arbeit für seinegeduldige Leitung während der Planungs- und Entwicklungsphase dieser Arbeit und für dieEinführung in das Feld der Gammaastronomie bedanken. Ich möchte mich auch bei Dr. Mar-kus Gaug, ebenfalls Betreuer dieser Arbeit, für seine Bereitschaft, diese Arbeit zu besprechenund eingehend zu überprüfen.

Weiters möchte ich mich bei Dr. Razmik Mirzoyan bedanken, der mir die Möglichkeitgegeben hat, Teile dieser Arbeit beim MPI zu entwickeln. Außerdem bedanke ich mich beiProf. Lluís Font, Mitbetreuer dieser Arbeit, für die Möglichkeit, meine Bachelorarbeit in-nerhalb der MAGIC Kollaboration zu auszuführen und für seine kontinuierliche Anleitung.Ferne Prof. Josep Maria Mondelo, ebenfalls Mitbetreuer dieser Arbeit, und immer bereit zuhelfen.

Ich möchte auch allen Mitgliedern der MAGIC-Gruppe am MPI, die mir während meinesAufenthalts in München geholfen haben, danken.

Schlussendlich möchte ich meiner Familie danken, die mich immer bedingungslos wäh-rend der gesamten Dauer dieser Arbeit unterstützt hat.

43

Page 56: Review of the MAGIC LIDAR data analysis method and study of its
Page 57: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

Appendix//**************************************************// Program for analyzing LIDAR data//// Author: Christian Fruck// [email protected]// Updated by: Miquel Cassanyes and Markus Gaug// [email protected]// [email protected]// Max-Planck-Institut fuer Physik// Version 0.2, 2014-01-30////**************************************************

// build with root: g++ -o lidar_new6 lidar_new6.cc -L. -lm `root-config --cflags` `root-config --glibs`

// ###################################################################################################################################// --- includes ---// ###################################################################################################################################

#include <fstream>#include <iostream>#include <iomanip>#include <stdio.h>#include <dirent.h>#include <stdlib.h>//#include <fstream>#include <string>#include <sstream>#include <iterator>#include <vector>#include <map>#include <time.h>

#include <fcntl.h>//#include <sys/sendfile.h>#include <sys/stat.h>#include <sys/types.h>#include <unistd.h>

#include "TRint.h"#include "TDatime.h"#include "TMath.h"#include "TROOT.h"#include "TH2F.h"#include "TH2.h"#include "TColor.h"#include "TH2D.h"#include "TF2.h"

#include "TH1F.h"#include "TH1D.h"#include "TF1.h"#include "TFile.h"#include "TSpline.h"#include "TGraph.h"#include "TGraphErrors.h"#include "TGraph2D.h"#include "TRandom3.h"#include "TVirtualFitter.h"#include "TList.h"#include "TAxis.h"#include "TPaveText.h"#include "TPave.h"#include "TString.h"#include "THistPainter.h"#include "TLine.h"#include "TEllipse.h"#include "TBox.h"#include "TMarker.h"#include "TView3D.h"#include "TGaxis.h"

#include <TCanvas.h>#include <TStyle.h>#include <TNtuple.h>

using namespace std;

#define PI 3.1415#define bins 512#define ref_bin 320//320#define bins_2 64

45

Page 58: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

// TGraphs for the analysis plots

TGraph *g6km;TGraph *g9km;TGraph *g12km;TGraph *gcalt;TGraph *gctrans;TGraph *gC_0plot;TGraph *gSlopeplot;TGraph *gIntegralplot;TGraph *gRCS_minplot;

TH1F *hSlopeplot;TH1F *hC_0plot;TH1F *hIntegralplot;TH2F *hIntegralvsSlope;TH2F *hC_0vsSlope;TH2F *hC_0vsIntegral;TH2F *hC_0vsRCS_min;TH2F *hSlopevsRCS_min;TH2F *hC_0vsZenith;TH2F *hSlopevsZenith;TH2F *hIntegralvsZenith;TH2F *hRCS_minvsZenith;

TH2F *hC_0vsTemperature;TH2F *hSlopevsTemperature;TH2F *hIntegralvsTemperature;TH2F *hRCS_minvsTemperature;

TH2F *hC_0vsPressure;TH2F *hSlopevsPressure;TH2F *hIntegralvsPressure;TH2F *hRCS_minvsPressure;

TH2F *hC_0vsHumidity;TH2F *hSlopevsHumidity;TH2F *hIntegralvsHumidity;TH2F *hRCS_minvsHumidity;

TGraph2D *VisibilityTime;

TH1F *ratio_match;TH2F *trans_alt;

TString wsfile = "WS2013.root";TNtuple weather;

static const Bool_t fullfit = kTRUE;static const Bool_t fullplot = kTRUE;

static const Double_t Step_0 = 50.;static const Double_t Interval_0 = 2500.; // interval forstatic const Double_t Interval_min = 700.; // interval forstatic const Double_t Interval_red_fac = 1.25;static const Double_t X1_init = 3000.;static const Double_t X2_init = 6000.;static const Double_t Calima_0 = 500.;static const Double_t RCS_min_limit = 5.;static const Double_t RCS_cloud_max = 2.5;static const Double_t RCS_max_cloud_end = 1.25;static const Double_t Integral_max = 1.955821e+09;static const Double_t Erange_max = 25.; // kmstatic const Double_t cloud_max = 22000.; // mstatic const Double_t trans_max_dist_ext = 0.9;static const Double_t trans_max_fix_ratio = 1.05;static const Double_t trans_range_upper = 1.0;static const Double_t trans_range_lower = 0.0;static const Double_t C_0_nocalima = 16.5;

static const Double_t alt_min = 20.0; // deg.static const Int_t shots_full = 50000;

static const Double_t LIDAR_ratio = 26.0;

static const Int_t noutdata = 5;static const TString outdata[noutdata] = "offset", "C_0", "Slope", "Integral", "RCS_min" ;

static const Int_t nfolders = 4;static const TString folders[nfolders] = "timestabilitycheck", "goodweather", "badweather", "badfit" ;

// ###################################################################################################################################// --- function declarations ---// ###################################################################################################################################

int process_file(const TString dir, const TString filename, const char *datafile, const char *plotfile, const char *logplotfile, constchar *sigfile);

46

Page 59: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

void set_plot_style()const Int_t NRGBs = 5;const Int_t NCont = 64;//255;

Double_t stops[NRGBs] = 0.00, 0.60, 0.70, 0.80, 1.00 ;Double_t red[NRGBs] = 0.90, 1.00, 0.20, 0.00, 0.00 ;Double_t green[NRGBs] = 0.00, 1.00, 1.00, 0.80, 0.00 ;Double_t blue[NRGBs] = 0.00, 0.00, 0.20, 0.80, 0.80 ;TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);gStyle->SetNumberContours(NCont);

gStyle->SetLineWidth(2.);gStyle->SetTextSize(0.6);gStyle->SetLabelSize(0.04,"x");gStyle->SetLabelSize(0.04,"y");gStyle->SetTitleSize(0.05,"xy");gStyle->SetTitleOffset(.8,"x");gStyle->SetTitleOffset(.8,"y");gStyle->SetPadTopMargin(0.04); //0.1gStyle->SetPadRightMargin(0.05);gStyle->SetPadBottomMargin(0.09);gStyle->SetPadLeftMargin(0.08);

TGaxis::SetMaxDigits(3);

gStyle->SetOptFit(0000);gStyle->SetTitleW(0.8);

gROOT->SetStyle("Modern");

Bool_t load_weather()TFile *f = new TFile(wsfile);// weather = new TNtuple();// weather.SetDirectory(NULL);if (weather.Read("WS") <= 0)cout << "Could not read ntuple 'WS' from file " << wsfile << endl;return kFALSE;

// weather.SetDirectory(NULL);weather.Print();

weather.GetEntry(0);Float_t *args = weather.GetArgs();cout << args[0] << " " << args[1] << " " << args[2] << endl;

return kTRUE;

Double_t getmjd(Int_t y,Int_t m, Int_t d,Int_t h,Int_t mn,Int_t s, TString &str)

if (m<1 || m>12)cout << "Time info from " << str << " could not be interpretd! Month out of bounds";return -1.;

y += 2000;

static int months[12] = 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ;// Allow for leap yearmonths[1] = (y%4==0 && (y%100!=0 || y%400==0)) ? 29 : 28;if (d<1 || d>months[m-1])cout << "Time info from " << str << " could not be interpretd! Day out of bounds";return -1.;

// Precalculate some valuesconst Byte_t lm = 12-m;const ULong_t lm10 = 4712 + y - lm/10;

static const UInt_t kHour = 3600000; // ms one hourstatic const UInt_t kDay = kHour*24; // ms one day

// Perform the conversionconst Int_t mjd = 1461L*lm10/4 + (306*((m+9)%12)+5)/10 - (3*((lm10+188)/100))/4 + d - 2399904;const ULong_t tm = ((((h*60+mn)*60)+s)*1000);const Bool_t am = tm<kHour*13; // day of sunrise?

Double_t fMjd = am ? mjd : mjd + 1;// cout << "MJD: " << fMjd << endl;Long_t fTime = am ? tm : tm-kDay;

47

Page 60: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

fMjd += (Double_t)fTime/kDay;

// printf("MDJ: %.5f\n",fMjd);

return fMjd;

Bool_t getweather(Float_t mjd,Float_t &temperature, Float_t &pressure, Float_t &humidity)

weather.GetEntry(0);Float_t *args = weather.GetArgs();Float_t mjd_0 = args[0];if (mjd_0 > mjd)printf("No weather information in %s for MJD: %.6f (too small)\n",wsfile.Data(),mjd);return kFALSE;

const Int_t nentries = weather.GetEntries();weather.GetEntry(nentries-1);args = weather.GetArgs();Float_t mjd_n = args[0];if (mjd_n < mjd)cout << "No weather information in " << wsfile << " for MJD: " << mjd << " (too big)" << endl;return kFALSE;

Int_t entry_test = TMath::Nint((mjd - mjd_0) / (mjd_n - mjd_0) * nentries);weather.GetEntry(entry_test);args = weather.GetArgs();Float_t mjd_test = args[0];

printf("%.6f %.6f %.6f %d\n",mjd_test,mjd_0,mjd_n,entry_test);

Int_t cc = 0;Int_t entry_mid = entry_test;

while (fabs(mjd_test-mjd) > 0.00001) // more or less minutesentry_test += TMath::Nint(((mjd - mjd_test) / (mjd_n - mjd_0) * nentries));if (entry_test < 0)

entry_test = 0;if (entry_test > nentries-1)

entry_test = nentries-1;weather.GetEntry(entry_test);args = weather.GetArgs();mjd_test = args[0];

printf("%.6f %.6f %d %d\n",mjd_test,mjd,entry_test,cc);cc++;// entry_prev = entry_test;if (cc>10)

break;

temperature = args[1];pressure = args[2];humidity = args[4];

return kTRUE;

// ###################################################################################################################################// --- MAIN ---// ###################################################################################################################################

int main(int argc, char *argv[])// ===== Creating or preparing the 'timestabilitycheck' folder and the 'offsetovertime.txt' and 'C_0overtime.txt' files ==============

load_weather();

// weather.GetEntry(10);// Float_t *args = weather.GetArgs();// cout << args[0] << " " << args[1] << " " << args[2] << endl;// return 0;

const TString dir(argv[1]);struct dirent *entry;DIR *dir_0;

for (Int_t i=0;i<nfolders;i++)TString folderlocation = dir + "/" + folders[i];

48

Page 61: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

cout << folderlocation << endl;dir_0 = opendir(folderlocation.Data());if (dir_0)

cout << "The '" << folders[i] << "' folder did already exist\n";//cout << "List of deleted files\n";while (entry = readdir(dir_0))TString fname(entry->d_name);if (fname == "." || fname == "..")

continue;TString fullname(folderlocation + "/" + fname);if (remove(fullname.Data()))

cout << "Error deleting file " << fullname << endl;// else// // //cout << "File succesfully deleted\n";// //cout << name << endl;//

elsecout << "The '" << folders[i] << "' folder did not exist. It will now be created.\n";if (mkdir(folderlocation.Data(),0777)==-1)//creating a directorycout << "Error creating the '" << folders[i] << "' folder\n";

if (i==0)for (Int_t j=0;j<noutdata;j++)TString location = folderlocation + "/" + outdata[j] + "overtime.txt";ofstream myfile;myfile.open(location.Data(), ios::out | ios::trunc);myfile << outdata[j] << endl << endl;myfile.close();

// ===== Some initialization and style settings =====================================================================================

gROOT->Reset();

set_plot_style();

TDatime *offtime = new TDatime(2005, 1, 1, 0, 0 ,0);gStyle->SetTimeOffset(offtime->Convert());

// ===== Plots and Histograms for Data Analysis =====================================================================================

g6km = new TGraph(0);g9km = new TGraph(0);g12km = new TGraph(0);gcalt = new TGraph(0);gctrans = new TGraph(0);gC_0plot = new TGraph(0);gSlopeplot = new TGraph(0);gIntegralplot = new TGraph(0);gRCS_minplot = new TGraph(0);

hSlopeplot = new TH1F("hSlopeplot", "Rayleigh Slope;(m^-1);Counts", 25000, -0.04, 0.);hC_0plot = new TH1F("hC_0plot", "Rayleigh normalization;(m^2);Counts", 10000, 0., 100.);hIntegralplot = new TH1F("hIntegralplot", "Calimaness;m^3;Counts", 5000, 0., 5.e11);hIntegralvsSlope = new TH2F("hIntegralvsSlople", "Calimaness vs Rayleigh Slope;Rayleigh Slope (m^-1);Calimaness (m^3)"

, 5000, -0.01, 0., 1000, 0., 5.e11);hC_0vsSlope = new TH2F("hC_0vsSlope", "Rayleigh normalization vs Rayleigh Slope;Rayleigh Slope (m^-1);Rayleigh

normalization (m^2)", 1000, -0.01, 0., 1000, 0., 100.);hC_0vsIntegral = new TH2F("hC_0vsIntegral", "Rayleigh normalization vs Calimaness;Calimaness (m^3);Rayleigh normalization

(m^2)", 1000, 0., 2.e11, 1000, 0., 100.);hC_0vsRCS_min = new TH2F("hC_0vsRCS_min", "First Fit Normalization vs #chi^2/NDF;log(#chi^2/NDF);Rayleigh normalization

(m^2)", 100, 0., 3., 10000, 0., 1000.);hSlopevsRCS_min = new TH2F("hSlopevsRCS_min", "First Fit Slope vs #chi^2/NDF;log(#chi^2/NDF);Rayleigh Slope (m^-1)"

, 100, 0., 3., 10000, -0.04, 0.);hC_0vsZenith = new TH2F("hC_0vsZenith", "Rayleigh normalization vs cos(Zenith);cos(#theta);Rayleigh normalization (m^2)"

, 75, 0., 1., 5000, 0., 100.);hSlopevsZenith = new TH2F("hSlopevsZenith", "Rayleigh Slope vs cos(Zenith);cos(#theta);Rayleigh Slope (m^-1)"

, 75, 0., 1., 10000, -0.01, 0.);hIntegralvsZenith= new TH2F("hIntegranvsZenith", "Calimaness vs cos(Zenith);cos(#theta);Calimaness (m^3)"

, 75, 0., 1., 5000, 0., 5.e11);hRCS_minvsZenith = new TH2F("hRCS_minvsZenith", "RCS_min vs cos(Zenith);cos(#theta);RCS_min"

, 75, 0., 1., 5000, 0., 70.);hC_0vsTemperature = new TH2F("hC_0vsTemperature", "Rayleigh normalization vs Temperature;temperature (#circ C);Rayleigh

normalization (m^2)",75, -5., 30., 5000, 0., 100.);hSlopevsTemperature = new TH2F("hSlopevsTemperature", "Rayleigh Slope vs Temperature;temperature (#circ C);Rayleigh Slope (m^-1)"

, 75, -5., 30.,10000, -0.01, 0.);hIntegralvsTemperature= new TH2F("hIntegranvsTemperature","Calimaness vs Temperature;temperature (#circ C);Calimaness (m^3)"

, 75, -5., 30., 5000, 0., 5.e11);hRCS_minvsTemperature = new TH2F("hRCS_minvsTemperature", "RCS_min vs Temperature;temperature (#circ C);RCS_min"

49

Page 62: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

, 75, -5., 30., 5000, 0., 70.);hC_0vsPressure = new TH2F("hC_0vsPressure", "Rayleigh normalization vs Pressure;pressure (hPa);Rayleigh normalization (m^2)"

, 75, 765., 795., 5000, 0., 100.);hSlopevsPressure = new TH2F("hSlopevsPressure", "Rayleigh Slope vs Pressure;pressure (hPa);Rayleigh Slope (m^-1)"

, 75, 765., 795.,10000, -0.01, 0.);hIntegralvsPressure= new TH2F("hIntegranvsPressure", "Calimaness vs Pressure;pressure (hPa);Calimaness (m^3)"

, 75, 765., 795., 5000, 0., 5.e11);hRCS_minvsPressure = new TH2F("hRCS_minvsPressure", "RCS_min vs Pressure;pressure (hPa);RCS_min"

, 75, 765., 795., 5000, 0., 70.);hC_0vsHumidity = new TH2F("hC_0vsHumidity", "Rayleigh normalization vs Rel. Humidity;rel.hum. (%);Rayleigh normalization

%(m^2)", 100, 0., 100., 5000, 0., 100.);hSlopevsHumidity = new TH2F("hSlopevsHumidity", "Rayleigh Slope vs Rel. Humidity;rel.hum. (%);Rayleigh Slope

%(m^-1)", 100, 0., 100., 10000, -0.01, 0.);hIntegralvsHumidity= new TH2F("hIntegranvsHumidity", "Calimaness vs Rel. Humidity;rel.hum. (%);Calimaness

%(m^3)", 100, 0., 100., 5000, 0., 5.e11);hRCS_minvsHumidity = new TH2F("hRCS_minvsHumidity", "RCS_min vs Rel. Humidity;rel.hum. (

%);RCS_min", 100, 0., 100., 5000, 0., 70.);

VisibilityTime = new TGraph2D;

ratio_match = new TH1F("ratio_match","LIDAR extinction coeff. methods (fixed ratio / total trans)", 30, 0.0, 3.0);trans_alt = new TH2F("trans_alt", "transmission vs. altitude", 60, 0.0, 15E3, 40, 0.0, 1.0);

// open directory streamdir_0 = opendir(argv[1]);if (dir_0)TList list;while (1)

entry = readdir( dir_0 );if (!entry)break;

list.AddLast( new TNamed(entry->d_name,"") );

closedir( dir_0 );list.Sort();

TIter Next(&list);TObject *o=NULL;

while ((o=Next()))TString filename = o->GetName();if (filename.BeginsWith("."))

continue;

cout << endl << endl << "HERE " << filename << endl;

if (filename.BeginsWith("lida") && filename[24] == 'd')TString datafile = dir + "/" + filename;TString plotfile = datafile;TString logplotfile = datafile;TString sigfile = datafile;plotfile .ReplaceAll(".dat",".png");logplotfile.ReplaceAll(".dat","_log.png");sigfile .ReplaceAll(".dat","_sigm.png");

cout << filename << endl;cout << datafile << endl;cout << plotfile << endl;cout << logplotfile << endl;cout << sigfile << endl;

// run main analysis taskif (process_file(dir.Data(), filename.Data(), datafile.Data(), plotfile.Data(), logplotfile.Data(), sigfile.Data()))

return 1;

// ===== finalizing plots ============================================================================================================

TApplication* rootapp = new TApplication("example",&argc, argv);

// Transmission TimelineTCanvas *cTrans = new TCanvas("cTrans","Transmission curve",200,10,1600,800);cTrans->SetFillColor(10);cTrans->SetTicks();cTrans->SetGrid();cTrans->SetTheta(89.9999);cTrans->SetPhi(0.0000001);

VisibilityTime->SetMarkerStyle(21);VisibilityTime->SetMarkerSize(2.0);VisibilityTime->SetTitle("Visibility altitude/time developenment");

50

Page 63: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

VisibilityTime->GetXaxis()->SetTitle("Time/date");VisibilityTime->GetYaxis()->SetTitle("altitude [m]");VisibilityTime->GetZaxis()->SetTitle("visibility");VisibilityTime->GetXaxis()->SetTimeDisplay(1);VisibilityTime->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");VisibilityTime->GetYaxis()->SetNdivisions(520);//~ VisibilityTime->GetXaxis()->SetTimeOffset(0,"gmt");VisibilityTime->GetYaxis()->SetRangeUser(0.0, 15000.0);VisibilityTime->GetZaxis()->SetRangeUser(0.0, 1.0);

//~ VisibilityTime->Draw("Pcolz");//~ VisibilityTime->Draw("colz");

g6km->SetLineColor(2);g6km->SetLineWidth(1);g6km->SetLineStyle(3);g6km->SetMarkerColor(2);g6km->SetMarkerStyle(7);g6km->SetFillStyle(0);g6km->SetFillColor(0);g6km->SetTitle("transmission curve");g6km->GetXaxis()->SetTitle("Time/date");g6km->GetYaxis()->SetTitle("transmission");g6km->GetXaxis()->SetTimeDisplay(1);g6km->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");g6km->GetYaxis()->SetNdivisions(520);//~ g6km->GetXaxis()->SetTimeOffset(0,"gmt");g6km->GetYaxis()->SetRangeUser(0.0, 1.0);

g9km->SetLineColor(3);g9km->SetLineWidth(1);g9km->SetLineStyle(3);g9km->SetMarkerColor(3);g9km->SetMarkerStyle(7);g9km->SetFillStyle(0);g9km->SetFillColor(0);g9km->SetTitle("transmission curve");g9km->GetXaxis()->SetTitle("Time/date");g9km->GetYaxis()->SetTitle("transmission");g9km->GetXaxis()->SetTimeDisplay(1);g9km->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");//~ g9km->GetXaxis()->SetTimeOffset(0,"gmt");g9km->GetYaxis()->SetRangeUser(0.0, 1.0);

g12km->SetLineColor(4);g12km->SetLineWidth(1);g12km->SetLineStyle(3);g12km->SetMarkerColor(4);g12km->SetMarkerStyle(7);g12km->SetFillStyle(0);g12km->SetFillColor(0);g12km->SetTitle("transmission curve");g12km->GetXaxis()->SetTitle("Time/date");g12km->GetYaxis()->SetTitle("transmission");g12km->GetXaxis()->SetTimeDisplay(1);g12km->GetXaxis()->SetLabelSize(0.025);g12km->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");//~ g12km->GetXaxis()->SetTimeOffset(0,"gmt");g12km->GetYaxis()->SetRangeUser(0.0, 1.0);

g12km->Draw("Alp");g9km->Draw("lp");g6km->Draw("lp");

cTrans->SaveAs("./tcurve.root");

TCanvas *ccalt = new TCanvas("ccalt","cloud altitude",200,10,1600,800);ccalt->SetFillColor(10);ccalt->SetTicks();ccalt->SetGrid();

gcalt->SetLineColor(4);gcalt->SetLineWidth(1);gcalt->SetLineStyle(3);gcalt->SetMarkerColor(4);gcalt->SetMarkerStyle(7);gcalt->SetFillStyle(0);gcalt->SetFillColor(0);gcalt->SetTitle("cloud altitude");gcalt->GetXaxis()->SetTitle("Time/date");gcalt->GetYaxis()->SetTitle("cloud altitude");gcalt->GetXaxis()->SetTimeDisplay(1);gcalt->GetXaxis()->SetLabelSize(0.025);gcalt->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");//~ gcalt->GetXaxis()->SetTimeOffset(0,"gmt");gcalt->GetYaxis()->SetRangeUser(0.0, 16000);

51

Page 64: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

gcalt->Draw("Ap");

ccalt->SaveAs("./hcurve.root");

TCanvas *cctrans = new TCanvas("cctrans","cloud transmission",200,10,1600,800);cctrans->SetFillColor(10);cctrans->SetTicks();cctrans->SetGrid();

gctrans->SetLineColor(2);gctrans->SetLineWidth(1);gctrans->SetLineStyle(3);gctrans->SetMarkerColor(2);gctrans->SetMarkerStyle(7);gctrans->SetFillStyle(0);gctrans->SetFillColor(0);gctrans->SetTitle("cloud transmision");gctrans->GetXaxis()->SetTitle("Time/date");gctrans->GetYaxis()->SetTitle("cloud transmission");gctrans->GetXaxis()->SetTimeDisplay(1);gctrans->GetXaxis()->SetLabelSize(0.025);gctrans->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");//~ gctrans->GetXaxis()->SetTimeOffset(0,"gmt");gctrans->GetYaxis()->SetRangeUser(0.0, 1.0);

gctrans->Draw("Ap");

cctrans->SaveAs("./ctcurve.root");

TCanvas *cC_0plot = new TCanvas("cC_0plot", "C_0 vs time", 200, 10, 1600, 800);cC_0plot->SetFillColor(10);cC_0plot->SetTicks();cC_0plot->SetGrid();

cC_0plot->Divide(1,2);cC_0plot->cd(1);

gC_0plot->SetLineColor(2);gC_0plot->SetLineWidth(1);gC_0plot->SetLineStyle(3);gC_0plot->SetMarkerColor(2);gC_0plot->SetMarkerStyle(7);gC_0plot->SetFillStyle(0);gC_0plot->SetFillColor(0);gC_0plot->GetXaxis()->SetTitle("Time/date");gC_0plot->GetYaxis()->SetTitle("C_0");gC_0plot->GetXaxis()->SetTimeDisplay(1);gC_0plot->GetXaxis()->SetLabelSize(0.025);gC_0plot->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");// gC_0plot->GetYaxis()->SetRangeUser(14.50, 17.50);gC_0plot->Draw("Ap");

cC_0plot->cd(2);hC_0plot->Draw();

cC_0plot->SaveAs("./C_0overtime.root");

TCanvas *cSlopeplot = new TCanvas("cSlopeplot", "Slope vs time", 200, 10, 1600, 800);

cSlopeplot->SetFillColor(10);cSlopeplot->SetTicks();cSlopeplot->SetGrid();cSlopeplot->Divide(1,2);cSlopeplot->cd(1);

gSlopeplot->SetLineColor(2);gSlopeplot->SetLineWidth(1);gSlopeplot->SetLineStyle(3);gSlopeplot->SetMarkerColor(2);gSlopeplot->SetMarkerStyle(7);gSlopeplot->SetFillStyle(0);gSlopeplot->SetFillColor(0);gSlopeplot->GetXaxis()->SetTitle("Time/date");gSlopeplot->GetYaxis()->SetTitle("Slope");gSlopeplot->GetXaxis()->SetTimeDisplay(1);gSlopeplot->GetXaxis()->SetLabelSize(0.025);gSlopeplot->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");// gSlopeplot->GetYaxis()->SetRangeUser(-0.0005, -0.00);

gSlopeplot->Draw("Ap");

cSlopeplot->cd(2);hSlopeplot->Draw();

52

Page 65: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

cSlopeplot->SaveAs("./Slopeovertime.root");

TCanvas *cIntegralplot = new TCanvas("cIntegralplot", "Integral vs time", 200, 10, 1600, 800);cIntegralplot->SetFillColor(10);cIntegralplot->SetTicks();cIntegralplot->SetGrid();

cIntegralplot->Divide(1,2);cIntegralplot->cd(1);

gIntegralplot->SetLineColor(2);gIntegralplot->SetLineWidth(1);gIntegralplot->SetLineStyle(3);gIntegralplot->SetMarkerColor(2);gIntegralplot->SetMarkerStyle(7);gIntegralplot->SetFillStyle(0);gIntegralplot->SetFillColor(0);gIntegralplot->GetXaxis()->SetTitle("Time/date");gIntegralplot->GetYaxis()->SetTitle("Integral");gIntegralplot->GetXaxis()->SetTimeDisplay(1);gIntegralplot->GetXaxis()->SetLabelSize(0.025);gIntegralplot->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");// gIntegralplot->GetYaxis()->SetRangeUser(-0.0005, -0.00);

gIntegralplot->Draw("Ap");

cIntegralplot->cd(2);hIntegralplot->Draw();

cIntegralplot->SaveAs("./Integralovertime.root");

TCanvas *cRCS_minplot = new TCanvas("cRCS_minplot", "RCS_min vs time", 200, 10, 1600, 800);cRCS_minplot->SetFillColor(10);cRCS_minplot->SetTicks();cRCS_minplot->SetGrid();

gRCS_minplot->SetLineColor(2);gRCS_minplot->SetLineWidth(1);gRCS_minplot->SetLineStyle(3);gRCS_minplot->SetMarkerColor(2);gRCS_minplot->SetMarkerStyle(7);gRCS_minplot->SetFillStyle(0);gRCS_minplot->SetFillColor(0);gRCS_minplot->GetXaxis()->SetTitle("Time/date");gRCS_minplot->GetYaxis()->SetTitle("RCS_min");gRCS_minplot->GetXaxis()->SetTimeDisplay(1);gRCS_minplot->GetXaxis()->SetLabelSize(0.025);gRCS_minplot->GetXaxis()->SetTimeFormat("%y-%m-%d_%H:%M");// gRCS_minplot->GetYaxis()->SetRangeUser(-0.0005, -0.00);

gRCS_minplot->Draw("Ap");

cRCS_minplot->SaveAs("./RCS_minovertime.root");

TCanvas *cCombinedplot = new TCanvas("cCombinedplot", "Combined plots", 200, 10, 1600, 800);cCombinedplot->SetFillColor(10);

cCombinedplot->Divide(1,3);cCombinedplot->cd(1);hIntegralvsSlope->Draw("colz");cCombinedplot->cd(2);hC_0vsSlope->Draw("colz");cCombinedplot->cd(3);hC_0vsIntegral->Draw("colz");

cCombinedplot->SaveAs("./Combined.root");

TCanvas *cCombined2plot = new TCanvas("cCombined2plot", "Combined plots with RCS_min", 200, 10, 1600, 800);cCombinedplot->SetFillColor(10);

cCombined2plot->Divide(1,2);cCombined2plot->cd(1);hC_0vsRCS_min->Draw("colz");cCombined2plot->cd(2);hSlopevsRCS_min->Draw("colz");

cCombined2plot->SaveAs("./Combined2.root");

TCanvas *cCombined3plot = new TCanvas("cCombined3plot", "Combined plots with zenith", 200, 10, 900, 900);cCombined3plot->SetFillColor(10);

cCombined3plot->Divide(2,2);cCombined3plot->cd(1);hC_0vsZenith ->Draw("colz");cCombined3plot->cd(2);hSlopevsZenith ->Draw("colz");

53

Page 66: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

cCombined3plot->cd(3);hIntegralvsZenith->Draw("colz");cCombined3plot->cd(4);hRCS_minvsZenith->Draw("colz");

cCombined3plot->SaveAs("./Combined3.root");

TCanvas *cCombined4plot = new TCanvas("cCombined4plot", "Combined plots with temperature", 200, 10, 900, 900);cCombined4plot->SetFillColor(10);

cCombined4plot->Divide(2,2);cCombined4plot->cd(1);hC_0vsTemperature ->Draw("colz");cCombined4plot->cd(2);hSlopevsTemperature ->Draw("colz");cCombined4plot->cd(3);hIntegralvsTemperature->Draw("colz");cCombined4plot->cd(4);hRCS_minvsTemperature->Draw("colz");

cCombined4plot->SaveAs("./Combined4.root");

TCanvas *cCombined5plot = new TCanvas("cCombined5plot", "Combined plots with atm. pressure", 200, 10, 900, 900);cCombined5plot->SetFillColor(10);

cCombined5plot->Divide(2,2);cCombined5plot->cd(1);hC_0vsPressure ->Draw("colz");cCombined5plot->cd(2);hSlopevsPressure ->Draw("colz");cCombined5plot->cd(3);hIntegralvsPressure->Draw("colz");cCombined5plot->cd(4);hRCS_minvsPressure->Draw("colz");

cCombined5plot->SaveAs("./Combined5.root");

TCanvas *cCombined6plot = new TCanvas("cCombined6plot", "Combined plots with rel. humidity", 200, 10, 900, 900);cCombined6plot->SetFillColor(10);

cCombined6plot->Divide(2,2);cCombined6plot->cd(1);hC_0vsHumidity ->Draw("colz");cCombined6plot->cd(2);hSlopevsHumidity ->Draw("colz");cCombined6plot->cd(3);hIntegralvsHumidity->Draw("colz");cCombined6plot->cd(4);hRCS_minvsHumidity->Draw("colz");

cCombined6plot->SaveAs("./Combined6.root");

// ===== finalizing histos =====================================================================================================

TCanvas *c_ratio_match = new TCanvas("c_ratio_match","Matching LIDAR ratio",200,10,1280,800);

ratio_match->SetFillColor(38);ratio_match->GetXaxis()->SetTitle("#sigma_FLR / #sigma_TT");ratio_match->GetYaxis()->SetTitle("frequency");ratio_match->GetXaxis()->SetTitleSize(0.04);ratio_match->GetYaxis()->SetTitleSize(0.04);ratio_match->Draw();c_ratio_match->SaveAs("./c_ratio_match.png");

TCanvas *c_trans_alt = new TCanvas("c_trans_alt","Transmission altitude distribution",200,10,1280,800);

trans_alt->GetXaxis()->SetTitle("cloud altitude [m]");trans_alt->GetYaxis()->SetTitle("cloud transmission");trans_alt->GetXaxis()->SetTitleSize(0.04);trans_alt->GetYaxis()->SetTitleSize(0.04);trans_alt->Draw("colz");c_trans_alt->SaveAs("./c_trans_alt.png");

//rootapp->Run(); /*This code line displays the plots when you run the program*/

return 0;

// ###################################################################################################################################// --- function definitions ---// ###################################################################################################################################

54

Page 67: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

int process_file(const TString dir, const TString filename, const char *datafile, const char *plotfile, const char *logplotfile, constchar *sigfile)

// ===== preparing time information ==================================================================================================

int year, month, day, hr, min, sec;year = month = day = hr = min = sec = 0;

sscanf(filename.Data(),"lidar_%d_%d_%d_%d-%d-%d.dat", &year, &month, &day, &hr, &min, &sec);

TDatime *datime = new TDatime(2000+year, month, day, hr, min ,sec);TDatime *reftime = new TDatime(2005, 1, 1, 0, 0 ,0);

UInt_t abstime = datime->Convert() - reftime->Convert();cout << endl << abstime << " " << datime->GetTime() << endl;datime->Print();

// Time of switching scaling in dataTDatime *switchtime = new TDatime(2012, 5, 28, 12, 0, 0);int stime = int(abstime) - int(switchtime->Convert() - reftime->Convert());cout << "STIME" << stime << endl;

// Time of switching error estimation in data formatTDatime *switchtime2 = new TDatime(2012, 11, 1, 0, 0, 0);int stime2 = int(abstime) - int(switchtime2->Convert() - reftime->Convert());cout << "STIME2" << stime2 << endl;

// Time of switching scaling to final valueTDatime *switchtime3 = new TDatime(2012, 12, 17, 12, 0, 0);int stime3 = int(abstime) - int(switchtime3->Convert() - reftime->Convert());cout << "STIME3" << stime3 << endl;

// ===== reading file ==============================================================================================================

Float_t alt_deg = 0.0;Double_t alt = 0.0;Int_t shots = 0;

TGraphErrors *signalPlot = new TGraphErrors();TGraphErrors *logSignalPlot = new TGraphErrors();TGraphErrors *sigmaPlotTrans = new TGraphErrors();TGraphErrors *sigmaPlotRatio = new TGraphErrors();TGraphErrors *sigmaPlot = new TGraphErrors();TGraphErrors *visPlot = new TGraphErrors();

cout << endl << "Reading file: " << datafile << endl;

ifstream data (datafile);if (data)string line;istringstream iss(line);iss >> skipws;for (int j = 0; j < 7; ++j)

getline (data,line);if(j<5)char fileheader[10][30]= 0;for (int l = 0; l < line.size(); ++l)

fileheader[j][l] = line[l];

if(j==0) sscanf(fileheader[j], "ALT: %f", &alt_deg);if(j==4) sscanf(fileheader[j], "shots: %d", &shots);

alt = alt_deg / 180.0 * PI;

Int_t i = 0;while (getline (data,line) && i < 1000)

Double_t x_temp, y1_temp, t_temp, y2_temp, y3_temp;iss >> x_temp >> y1_temp >> y2_temp >> y3_temp;iss.clear();iss.str(line);

Double_t range, signal, signalRSQ, logsigRSQ;Double_t Erange, Esignal, EsignalRSQ, ElogsigRSQ;y1_temp -= double(shots)/1E3;

Double_t salt = sin(alt);

range = x_temp * salt;Erange = Erange_max * salt;

55

Page 68: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

// final scalingif (stime3 > 0)signal = y1_temp / double(shots) / 1.05;Esignal = y3_temp / double(shots) / 1.05;signalRSQ = y1_temp * x_temp * x_temp / double(shots) / 1.05;EsignalRSQ = ( y3_temp * x_temp * x_temp + y1_temp * 2.0 * 25.0 * salt ) / double(shots) / 1.05;

// new error estimateelse if (stime2 > 0)signal = y1_temp / double(shots);Esignal = y3_temp / double(shots);signalRSQ = y1_temp * x_temp * x_temp / double(shots);EsignalRSQ = ( y3_temp * x_temp * x_temp + y1_temp * 2.0 * 25.0 * salt ) / double(shots);

// old error estimateelse if (stime > 0)signal = y1_temp / double(shots);Esignal = sqrt(abs(y1_temp)) / double(shots);signalRSQ = y1_temp * x_temp * x_temp / double(shots);EsignalRSQ = ( sqrt(abs(y1_temp)) * x_temp * x_temp + y1_temp * 2.0 * 25.0 * salt ) / double(shots);

// old error estimate and signal scalingelsesignal = y1_temp / double(shots) / 0.5;Esignal = sqrt(abs(y1_temp)) / double(shots) / 0.5;signalRSQ = y1_temp * x_temp * x_temp / double(shots) / 0.5;EsignalRSQ = ( sqrt(abs(y1_temp)) * x_temp * x_temp + y1_temp * 2.0 * 25.0 * salt ) / double(shots) / 0.5;

if (signalRSQ > 0.0 && (signalRSQ - EsignalRSQ) > 0.0)logsigRSQ = log(signalRSQ);ElogsigRSQ = 0.5 * (log(signalRSQ + EsignalRSQ) - log(signalRSQ - EsignalRSQ));

elselogsigRSQ = 0.0;ElogsigRSQ = 0.0;

signalPlot->SetPoint (i, range, signalRSQ);signalPlot->SetPointError(i, Erange, EsignalRSQ);

logSignalPlot->SetPoint (i, range, logsigRSQ);logSignalPlot->SetPointError(i, Erange, ElogsigRSQ);

i++;

data.close();

cout << "Finished reading file" << endl;cout << "Altitude is: " << alt_deg << endl;

elsecout << "Unable to open file" << endl;

// ===== plotting the raw signal ===================================================================================================

/* //comment in case all png and pdf files are not needed

TCanvas *c1 = new TCanvas("c1", "LIDAR", 200, 10, 1400, 800);c1->cd();c1->SetFillColor(10);c1->SetGrid();c1->SetLogy();c1->SetTicks();

signalPlot->SetLineColor(1);signalPlot->SetLineWidth(1);signalPlot->SetMarkerColor(1);signalPlot->SetMarkerStyle(6);signalPlot->SetFillStyle(0);signalPlot->SetFillColor(1);//signalPlot->SetTitle(filename);signalPlot->SetTitle("");signalPlot->GetXaxis()->SetTitle("altitude above MAGIC [m]");signalPlot->GetYaxis()->SetTitle("signal [Phe/bin] #times RÂ");signalPlot->GetXaxis()->SetLimits(-1E4, 1E5);signalPlot->GetYaxis()->SetRangeUser(2E5, 2E8);signalPlot->GetXaxis()->SetRangeUser(0.0, 20000.0);

56

Page 69: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

signalPlot->Draw("Ap");//~c1->SaveAs(plotfile);

*/

TCanvas *c22 = new TCanvas("c22", "LIDAR", 200, 10, 1400, 800);c22->cd();c22->SetFillColor(10);c22->SetGrid();c22->SetTicks();

logSignalPlot->SetLineColor(1);logSignalPlot->SetLineWidth(1);logSignalPlot->SetMarkerColor(1);logSignalPlot->SetMarkerStyle(6);logSignalPlot->SetFillStyle(0);logSignalPlot->SetFillColor(1);//logSignalPlot->SetTitle(filename);logSignalPlot->SetTitle("");logSignalPlot->GetXaxis()->SetTitle("altitude above MAGIC [m]");logSignalPlot->GetYaxis()->SetTitle("log( signal [Phe/bin] #times RÂ )");logSignalPlot->GetXaxis()->SetLimits(-1E4, 1E5);logSignalPlot->GetYaxis()->SetRangeUser(10, 20);logSignalPlot->GetXaxis()->SetRangeUser(0.0, 20000.0);

logSignalPlot->Draw("Ap");// c22->SaveAs(logplotfile);

// ===== fitting the signal - measuring transmission ===============================================================================

if (alt_deg > alt_min && shots == shots_full)

// text field for some numbers

TPaveText *info = new TPaveText(0.5, 0.75, 0.975, 0.925, "NDC");info->SetFillColor(0);info->SetTextSize(0.02);info->SetTextAlign(12);

// function for the fits

TF1 *expo = new TF1("expo","[0]+[1]*x",0,100000);expo->SetParName(0,"Const");expo->SetParName(1,"Slope");expo->SetParameter(0,1E7);expo->SetParameter(1,-1E-5);

Double_t Slope = -1.2E-4;Double_t Slope_c = Slope; // copy of the parameter to reinicialize

if (fullfit)expo->SetParameter(1,Slope); //in the previous version, it was set as FixParameter

elseexpo->FixParameter(1,Slope);

expo->SetParLimits(1,-0.1,0.);

Double_t Step = Step_0 * sin(alt);Double_t Interval = Interval_0 * sin(alt);

Double_t Trans = 0.0;Double_t C_0 = 0.0;Double_t C_0_first = 0.0;Double_t C_1 = 0.0;Double_t H_0 = 0.0;Double_t H_1 = 0.0;Double_t H_M = 0.0;Double_t X = 0.0;

Int_t i = 0;Int_t j = 0;Int_t i_T = 0;Int_t i_R = 0;

Int_t N = 0;Double_t Integral = 0.0;

// searching for good low altitude reference region (between 3 and 6km)

Double_t X1 = X1_init * sin(alt);Double_t X2 = X1 + Interval;Double_t RCS_min = 1.0E9;while (X2 < X2_init)

if (fullfit)expo->SetParameter(1, Slope_c); //reinicialization of the expected parameter

57

Page 70: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

expo->SetRange(X1,X2);logSignalPlot->Fit(expo,"RQ");Double_t ChiSQ = expo->GetChisquare();Double_t Const = expo->GetParameter(0);Double_t EConst = expo->GetParError(0);Double_t SLO = expo->GetParameter(1);Double_t ESLO = expo->GetParError(1);

Double_t RCS = fullfit ? ChiSQ/(expo->GetNumberFitPoints()-2.0) : ChiSQ/(expo->GetNumberFitPoints()-1.0); //updated from -1 to -2if (RCS < RCS_min)C_0 = Const;Slope = SLO; //update the Slope value from the fitH_0 = X1;H_1 = X2;RCS_min = RCS;

X1 += Step;X2 += Step;

while (RCS_min > RCS_min_limit)// make Interval smallerInterval = Interval / Interval_red_fac;if (Interval < Interval_min)break;

X1 = X1_init * sin(alt);X2 = X1 + Interval;RCS_min = 1.0E9;

while (X2 < X2_init)if (fullfit)

expo->SetParameter(1, Slope_c); //reinicialization of the expected parameter

expo->SetRange(X1,X2);logSignalPlot->Fit(expo,"RQ");

Double_t ChiSQ = expo->GetChisquare();Double_t Const = expo->GetParameter(0);Double_t EConst = expo->GetParError(0);Double_t SLO = expo->GetParameter(1);Double_t ESLO = expo->GetParError(1);

Double_t RCS = fullfit ? ChiSQ/(expo->GetNumberFitPoints()-2.0) : ChiSQ/(expo->GetNumberFitPoints()-1.0); //updated from -1 to -2if (RCS < RCS_min)

C_0 = Const;Slope = SLO; // update the Slope value from the fitH_0 = X1;H_1 = X2;RCS_min = RCS;

X1 += Step;X2 += Step;

Trans = sqrt( exp(C_0) / exp (C_0_nocalima));

expo->SetRange(H_0,H_1);logSignalPlot->Fit(expo,"RQ");expo->DrawCopy("same");

TString text(Form("Initial fit: %.1fm - %.1fm with C_0 = %.2f, slope=%.5f and trans. %.3f, #chi^2/NDF=%.1f", H_0, H_1, C_0, Slope%,Trans,RCS_min));

TText *initial = info->AddText(text);

C_0_first = C_0;

// extrapolate sigma to zero meters

Integral = 0.0;for (X = Calima_0; X < H_0; X += Step)

Double_t I_step = Step * ( signalPlot->Eval(X,0,"") - exp( C_0 + X*Slope - 0.02 ) );if (I_step > 0) Integral += I_step;

i = 0;if (Trans <= 1.05)

for (X = Calima_0; X < H_0; X += Step)Double_t S_step = signalPlot->Eval(X,0,"") - exp( C_0 + X*Slope - 0.02 );

58

Page 71: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

if (S_step > 0) sigmaPlot->SetPoint(i, X, S_step / (Integral / -1.0 / log(Trans) ) );else sigmaPlot->SetPoint(i, X, 0.0);++i;

if (Trans > 1.05)for (X = 500.0; X < H_0; X += Step)if ( (signalPlot->Eval(X,0,"") - exp( C_0_nocalima + X*Slope - 0.02 ) ) > 0 ) sigmaPlot->SetPoint(i, X, LIDAR_ratio * 1.588E-6 *

exp( (X + 2200.0) * Slope ) * ( signalPlot->Eval(X,0,"") - exp( C_0_nocalima + X*Slope ) ) / exp( C_0_nocalima + X*Slope ) );else sigmaPlot->SetPoint(i, X, 0.0);++i;

// saving offset dataTString date = filename(6,23);

Int_t h,mn,s,y,m,d;Int_t n = sscanf(date.Data(),"%2d_%02d_%02d_%02d-%02d-%02d",&y,&m,&d,&h,&mn,&s);if (n != 6)

cout << "Time info from " << date << " could not be interpretd!";return 1;

Double_t mjd = getmjd(y,m,d,h,mn,s,date);if (mjd < 0.)

return 1;

Float_t temperature, pressure, humidity;

getweather(mjd,temperature,pressure,humidity);printf("TEMP: %.2f P: %.1f RH: %.1f\n",temperature,pressure, humidity);

//cout << filename << endl;//cout << date << endl;

Double_t Integral_c = Integral;TString sourcefile = dir + "/" + filename;

// copying data related to good weather conditions and bad weather conditions separatelyfor (Int_t i=0;i<nfolders;i++)

TString folderlocation = dir + "/" + folders[i];cout << folderlocation << endl;if (i==0)TString location = folderlocation + "/" + outdata[0] + "overtime.txt";cout << location << endl;ofstream myfile;myfile.open (location.Data(), ios::out | ios::app);myfile << Integral << " " << date << endl;myfile.close();

TString copiedfile = folderlocation + "/" + filename;

if (RCS_min > RCS_min_limit) // badfitif (i==3) // badfit

//cout << "The file to be copied should be " << sourcefile << endl;//cout << "The copied file should be " << copiedfile << endl;ifstream infile (sourcefile.Data(), fstream::binary);ofstream outfile(copiedfile.Data(), fstream::trunc | fstream::binary);outfile << infile.rdbuf();

else if (Integral < Integral_max)if (i==1) // goodweather

//cout << "The file to be copied should be " << sourcefile << endl;//cout << "The copied file should be " << copiedfile << endl;ifstream infile (sourcefile, fstream::binary);ofstream outfile(copiedfile, fstream::trunc | fstream::binary);outfile << infile.rdbuf ();

elseif (i==2) // badweather

//cout << "The file to be copied should be " << sourcefile << endl;//cout << "The copied file should be " << copiedfile << endl;ifstream infile (sourcefile, fstream::binary);

59

Page 72: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

ofstream outfile(copiedfile, fstream::trunc | fstream::binary);outfile << infile.rdbuf ();

if (i==0)// Serching for cloud layers

X = H_0;X1 = H_0 + Step;X2 = X1 + Interval + Step;

while (X2 < cloud_max * sin(alt))expo->SetRange(X1, X2);logSignalPlot->Fit(expo,"RQ");Double_t ChiSQ = expo->GetChisquare();Double_t Const = expo->GetParameter(0);Double_t EConst = expo->GetParError(0);Double_t RCS = ChiSQ/(expo->GetNumberFitPoints()-1.0);Double_t LastValue = logSignalPlot->Eval(X2,0,"");

if (RCS > RCS_cloud_max && LastValue > X2*Slope+Const)// go one step backX1 -= Step;X2 -= Step;expo->SetRange(X1, X2);logSignalPlot->Fit(expo,"RQ");Double_t ChiSQ = expo->GetChisquare();Double_t Const = expo->GetParameter(0);Double_t EConst = expo->GetParError(0);Double_t RCS = ChiSQ/(expo->GetNumberFitPoints()-1.0);Double_t LastValue = logSignalPlot->Eval(X2,0,"");Trans = 0.0;

// deal with range before cloudfor (X = X1; X < X2; X += Step)

sigmaPlot->SetPoint(i, X, 0.0);++i;

C_0 = Const;cout << "C_0 " << C_0 << endl;H_0 = X2;expo->DrawCopy("same");

// scan for end of layer

Double_t C_min = 0.0;Double_t RCS_min = 1E9;

while (X2 < (cloud_max + 1500.0) * sin(alt))expo->SetRange(X1 + Step,X2 + Step);logSignalPlot->Fit(expo,"RQ");Double_t ChiSQ = expo->GetChisquare();Double_t Const = expo->GetParameter(0);Double_t EConst = expo->GetParError(0);Double_t RCS = ChiSQ/(expo->GetNumberFitPoints()-1.0);Double_t FirstValue = logSignalPlot->Eval(X1,0,"");C_1 = Const;if (RCS < RCS_max_cloud_end && FirstValue < X1*Slope+C_0)if (RCS < RCS_min)

RCS_min = RCS;C_min = C_1;

break;

X1 += Step;X2 += Step;

if (X2 >= (cloud_max + 1500.0) * sin(alt))C_1 = C_min;

Trans = sqrt( exp(C_1) / exp(C_0) );H_1 = X1;expo->DrawCopy("same");

N += 1;text = Form("%d. layer: %.1fm - %.1fm with C_0 = %.2f, C_1 = %.2f and fit. trans. %.3f", N, H_0, H_1, C_0, C_1, Trans);TText *initial = info->AddText(text);

60

Page 73: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

Double_t ratio_trans_comp = 0.;Int_t ratio_trans_comp_N = 0;Double_t s_ratio = 0.;

// DISTRIBUTED EXTINCTION METHOD APPLIED HEREif (Trans <= trans_max_dist_ext)

// distribute total extinction over cloud// estimate sigma with fixed lidar ratio of 30 - ONLY FOR STATS

Integral = 0.;H_M = 0.;for (X = H_0; X < H_1; X += Step)Integral += Step * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) );H_M += X * Step * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) );

H_M /= Integral;

for (X = H_0; X < H_1; X += Step)Double_t sigma_trans = (signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) ) / (Integral / -1.0 / log(Trans) );Double_t sigma_ratio = LIDAR_ratio * 1.588E-6 * exp( (X + 2200.0) * Slope ) * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 +

X*Slope ) ) / exp( (C_0 + C_1)/2 + X*Slope );//~ Double_t sigma_ratio = LIDAR_ratio * 1.588E-6 * exp( (8000.0 + 2200.0) * Slope ) * ( signalPlot->Eval(X,0,"") - exp( (C_0 +

C_1)/2 + X*Slope ) ) / exp( (C_0 + C_1)/2 + X*Slope );

if (sigma_trans/sigma_ratio < 10.0 && X < 20000*sin(alt) && C_1 > 12.0)sigmaPlotTrans->SetPoint(i_T, X, sigma_trans);sigmaPlotRatio->SetPoint(i_R, X, sigma_ratio);

else

sigmaPlotTrans->SetPoint(i_T, X, 0.0);sigmaPlotRatio->SetPoint(i_R, X, 0.0);

++i_T;++i_R;

// distribute total extinction over cloudsigmaPlot->SetPoint(i, X, sigmaPlotTrans->Eval(X));++i;

if (Trans >= 0.6 && Trans <= 0.8 && H_0 > 5000 && H_1 < 12000)ratio_trans_comp += sigma_ratio/sigma_trans;ratio_trans_comp_N ++;

s_ratio = sigma_trans/sigma_ratio;

// FIXED RATIO METHOD APPLIED HEREelse if (Trans <= trans_max_fix_ratio)

// distribute total extinction over cloud - ONLY FOR STATS// estimate sigma with fixed lidar ratio of 30

Integral = 0.;H_M = 0.;for (X = H_0; X < H_1; X += Step)Integral += Step * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) );H_M += X * Step * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) );

H_M /= Integral;

for (X = H_0; X < H_1; X += Step)Double_t sigma_ratio = LIDAR_ratio * 1.588E-6 * exp( (X + 2200.0) * Slope ) * ( signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 +

X*Slope ) ) / exp( (C_0 + C_1)/2 + X*Slope );//~ Double_t sigma_ratio = LIDAR_ratio * 1.588E-6 * exp( (8000.0 + 2200.0) * Slope ) * ( signalPlot->Eval(X,0,"") - exp( (C_0 +

C_1)/2 + X*Slope ) ) / exp( (C_0 + C_1)/2 + X*Slope );Double_t sigma_trans = (signalPlot->Eval(X,0,"") - exp( (C_0 + C_1)/2 + X*Slope ) ) / (Integral / -1.0 / log(Trans) );

if (sigma_trans/sigma_ratio < 10.0 && X < 20000*sin(alt) && C_1 > 12.0)sigmaPlotTrans->SetPoint(i_T, X, sigma_trans);sigmaPlotRatio->SetPoint(i_R, X, sigma_ratio);

else

sigmaPlotTrans->SetPoint(i_T, X, 0.0);sigmaPlotRatio->SetPoint(i_R, X, 0.0);

++i_T;++i_R;

61

Page 74: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

// estimate sigma with fixed lidar ratio of 30sigmaPlot->SetPoint(i, X, sigmaPlotRatio->Eval(X));++i;

s_ratio = sigma_trans/sigma_ratio;

//----------------------------------------------------------------------------// TESTDouble_t Visibility = 0.0;for (X = H_0; X < H_1; X += Step)Visibility -= sigmaPlot->Eval(X,0,"")*Step;

cout << Trans << endl;Trans = exp(Visibility);cout << Trans << endl;//----------------------------------------------------------------------------

if (ratio_trans_comp_N != 0)ratio_match->Fill(ratio_trans_comp/ratio_trans_comp_N);

if (s_ratio < 2.0 && Trans < trans_range_upper && Trans > trans_range_lower)trans_alt->Fill(H_M, Trans);gcalt->SetPoint(gcalt->GetN(), abstime, H_M);gctrans->SetPoint(gctrans->GetN(), abstime, Trans);

X1 += Step;X2 += Step;

// set sigma to zero

sigmaPlot->SetPoint(i, X, 0.0);++i;;X += Step;

for (Int_t j=1;j<noutdata;j++)TString location = folderlocation + "/" + outdata[j] + "overtime.txt";cout << location << endl;ofstream myfile;myfile.open (location.Data(), ios::out | ios::app);

switch (j)case 1:myfile << C_0_first << " " << date << endl;gC_0plot->SetPoint(gC_0plot->GetN(), abstime, C_0_first);hC_0plot->Fill (C_0_first);break;

case 2:myfile << Integral_c << " " << date << endl;gIntegralplot->SetPoint(gIntegralplot->GetN(), abstime, Integral_c);hIntegralplot->Fill (Integral_c);break;

case 3:myfile << RCS_min << " " << date << endl;gRCS_minplot->SetPoint(gRCS_minplot->GetN(), abstime, RCS_min);break;

myfile.close();

// saving the Combined histogramsif (RCS_min < RCS_min_limit)

hC_0vsSlope ->Fill(Slope, C_0);hIntegralvsSlope->Fill(Slope, Integral_c);hC_0vsIntegral ->Fill(Integral_c, C_0);

Double_t zen = cos((90.-alt_deg)*TMath::DegToRad());hC_0vsZenith ->Fill(zen,C_0);hSlopevsZenith ->Fill(zen,Slope);hIntegralvsZenith->Fill(zen,Integral_c);hRCS_minvsZenith ->Fill(zen,RCS_min);

hC_0vsTemperature ->Fill(temperature,C_0);hSlopevsTemperature ->Fill(temperature,Slope);hIntegralvsTemperature->Fill(temperature,Integral_c);hRCS_minvsTemperature ->Fill(temperature,RCS_min);

hC_0vsPressure ->Fill(pressure,C_0);hSlopevsPressure ->Fill(pressure,Slope);

62

Page 75: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

hIntegralvsPressure->Fill(pressure,Integral_c);hRCS_minvsPressure ->Fill(pressure,RCS_min);

hC_0vsHumidity ->Fill(humidity,C_0);hSlopevsHumidity ->Fill(humidity,Slope);hIntegralvsHumidity->Fill(humidity,Integral_c);hRCS_minvsHumidity ->Fill(humidity,RCS_min);

hC_0vsRCS_min ->Fill(log10(RCS_min), C_0);hSlopevsRCS_min->Fill(log10(RCS_min), Slope);

// ===== making visibility plot ============================================================================================

Double_t Visibility = 0.0;i = 0;for (X = 500.0; (X < 16000.0) && (X < 24000.0 * sin(alt)); X += 20.0)

Visibility -= sigmaPlot->Eval(X,0,"");visPlot->SetPoint(i, X, exp(Visibility*20.0));++i;//~ cout << Visibility << endl;

// ===== finishing plots =====================================================================================================

info->Draw();c22->SaveAs(logplotfile);

/* //comment in case all png and pdf files are not needed

TCanvas *c3 = new TCanvas("c3", "LIDAR", 200, 10, 1400, 800);c3->cd();c3->SetFillColor(10);c3->SetGrid();//~ c3->SetLogy();c3->SetTicks();

sigmaPlot->SetLineColor(1);sigmaPlot->SetLineWidth(1);sigmaPlot->SetMarkerColor(1);sigmaPlot->SetMarkerStyle(6);sigmaPlot->SetFillStyle(0);sigmaPlot->SetFillColor(1);//sigmaPlot->SetTitle(filename);sigmaPlot->SetTitle("");sigmaPlot->GetXaxis()->SetTitle("altitude above MAGIC [m]");sigmaPlot->GetYaxis()->SetTitle("extinction coefficient #sigma [m^-1]");sigmaPlot->GetXaxis()->SetLimits(-1E4, 1E5);sigmaPlot->GetYaxis()->SetRangeUser(-1.0e-5, 0.3E-3);//sigmaPlot->GetYaxis()->SetRangeUser(-1.0e-4, 1.0E-3);sigmaPlot->GetXaxis()->SetRangeUser(0.0, 20000.0);

sigmaPlotTrans->SetLineColor(4);sigmaPlotTrans->SetLineWidth(1);sigmaPlotTrans->SetMarkerColor(1);sigmaPlotTrans->SetMarkerStyle(6);

sigmaPlotRatio->SetLineColor(2);sigmaPlotRatio->SetLineWidth(1);sigmaPlotRatio->SetMarkerColor(1);sigmaPlotRatio->SetMarkerStyle(6);

sigmaPlot->Draw("Alp");sigmaPlotTrans->Draw("lp");sigmaPlotRatio->Draw("lp");c3->SaveAs(sigfile);

TCanvas *c4 = new TCanvas("c4", "LIDAR", 200, 10, 1400, 800);c4->cd();c4->SetFillColor(10);c4->SetGrid();//~ c4->SetLogy();c4->SetTicks();

visPlot->SetLineColor(1);visPlot->SetLineWidth(1);visPlot->SetMarkerColor(1);visPlot->SetMarkerStyle(6);visPlot->SetFillStyle(0);visPlot->SetFillColor(1);//visPlot->SetTitle(filename);visPlot->SetTitle("");visPlot->GetXaxis()->SetTitle("altitude above MAGIC [m]");visPlot->GetYaxis()->SetTitle("integ. aerosol transmission T(h)");visPlot->GetXaxis()->SetLimits(-1E4, 1E5);visPlot->GetYaxis()->SetRangeUser(0.0, 1.0);

63

Page 76: Review of the MAGIC LIDAR data analysis method and study of its

Appendix Miquel Cassanyes

visPlot->GetXaxis()->SetRangeUser(0.0, 20000.0);

visPlot->Draw("Alp");c4->SaveAs(plotfile);

c2->SaveAs(TString(logplotfile)+".root");c4->SaveAs(TString(plotfile)+".root");c3->SaveAs(TString(sigfile)+".root");

c2->SaveAs(TString(logplotfile)+".pdf");c4->SaveAs(TString(plotfile)+".pdf");c3->SaveAs(TString(sigfile)+".pdf");

*/

// ===== Filling the timeline plots =============================================================================================

X = 500.0;while (X <= 15000.0 && X < 24000.0 * sin(alt))

Double_t vis = visPlot->Eval(X);VisibilityTime->SetPoint(VisibilityTime->GetN(), abstime, X, vis);X += 100.0;

X = 6E3;if (X < 24E3*sin(alt)) g6km->SetPoint(g6km->GetN(), abstime, visPlot->Eval(X));else g6km->SetPoint(g6km->GetN(), abstime, visPlot->Eval(24E3*sin(alt)));

X = 9E3;if (X < 24E3*sin(alt)) g9km->SetPoint(g9km->GetN(), abstime, visPlot->Eval(X));else g9km->SetPoint(g9km->GetN(), abstime, visPlot->Eval(24E3*sin(alt)));

X = 12E3;if (X < 24E3*sin(alt)) g12km->SetPoint(g12km->GetN(), abstime, visPlot->Eval(X));else g12km->SetPoint(g12km->GetN(), abstime, visPlot->Eval(24E3*sin(alt)));

//~ rootapp->Run();return 0;

64