]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/AliTPCGoofieValues.cxx
Updating CMake files
[u/mrichter/AliRoot.git] / TPC / AliTPCGoofieValues.cxx
1
2 /**************************************************************************
3  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  *                                                                        *
5  * Author: The ALICE Off-line Project.                                    *
6  * Contributors are mentioned in the code where appropriate.              *
7  *                                                                        *
8  * Permission to use, copy, modify and distribute this software and its   *
9  * documentation strictly for non-commercial purposes is hereby granted   *
10  * without fee, provided that the above copyright notice appears in all   *
11  * copies and that both the copyright notice and this permission notice   *
12  * appear in the supporting documentation. The authors make no claims     *
13  * about the suitability of this software for any purpose. It is          *
14  * provided "as is" without express or implied warranty.                  *
15  **************************************************************************/
16
17 /****************************************************************************
18  * TPC Calibration Class for GOOFIE values. Drift velocity, gas composition *
19  * and the gain.                                                            *
20  ****************************************************************************/
21  
22 #include "AliTPCGoofieValues.h"
23 #include <iostream>
24
25 /*****************************************************************************
26 *  The class AliTPCGoofieValues allows the access to GoofieValues. The only  *
27 *  construtor is load a data from ASCI file. The methods make Tgraphs and    *
28 *  TSplines of the time dependace of th values. One method allows save the   *
29 *  the graphs and spline togather with tree of allvalues into file.          *
30
31 Current example usage:
32
33 AliTPCGoofieValues *goofieVal = new AliTPCGoofieValues("Goofie_data_january_run_01_08.txt");
34 TFile f("goofieValues.root","recreate");
35 goofieVal->Write("goofie");
36 TBrowser b;
37 And now you can browse
38
39
40 *****************************************************************************/
41
42 ClassImp(AliTPCGoofieValues)
43
44 //____________________________________________________________________________
45 AliTPCGoofieValues::AliTPCGoofieValues():
46   TNamed(),
47   fLinesInFile(0),///< lines in ASCII file
48   fStartTime(0),///< StartTime
49   fEndTime(0),///< EndTime
50   fTimeOfRun(0),///<TimeOfRun
51   fTempGrad(0),///<TempGrad
52   fAverageTempGraph(0), ///<graph of average temperatures 
53   fTempGradGraph(0),///<graph of temperature gradients
54   fPressGraph(0),///<graph of pressures
55   fVdriftGraph(0),///<graph of drift velocities
56   fVdriftcorGraph(0),///<graph of drift velocities corrected
57   fGainFGraph(0),///<graph of near gain
58   fGainNGraph(0),///<graph of far gain
59   fCO2Graph(0),///<graph of CO2 content
60   fN2Graph(0),///<graph of N2 content
61   
62   fAverageTempSpline(0),///< spline of average temperatures 
63   fTempGradSpline(0),///<spline of  temperature gradients
64   fPressSpline(0),///<spline of pressures
65   fVdriftSpline(0),///<spline of drift velocities
66   fVdriftcorSpline(0),///<spline of drift velocities corrected
67   fGainFSpline(0),///<spline of near gain
68   fGainNSpline(0),///<spline of far gain
69   fCO2Spline(0),///<spline of CO2 content
70   fN2Spline(0),
71   fGoofieValues(0)///<spline of  N2 content
72 {
73   //
74   // Default constructor
75   //
76
77   
78   //____________________________________________________________________________
79 AliTPCGoofieValues::AliTPCGoofieValues(const char *fname):
80   TNamed(),
81   fLinesInFile(0),///< lines in ASCII file
82   fStartTime(0),///< StartTime
83   fEndTime(0),///< EndTime
84   fTimeOfRun(0),///<TimeOfRun
85   fTempGrad(0),///<TempGrad
86   fAverageTempGraph(0), ///<graph of average temperatures 
87   fTempGradGraph(0),///<graph of temperature gradients
88   fPressGraph(0),///<graph of pressures
89   fVdriftGraph(0),///<graph of drift velocities
90   fVdriftcorGraph(0),///<graph of drift velocities corrected
91   fGainFGraph(0),///<graph of near gain
92   fGainNGraph(0),///<graph of far gain
93   fCO2Graph(0),///<graph of CO2 content
94   fN2Graph(0),///<graph of N2 content
95   
96   fAverageTempSpline(0),///< spline of average temperatures 
97   fTempGradSpline(0),///<spline of  temperature gradients
98   fPressSpline(0),///<spline of pressures
99   fVdriftSpline(0),///<spline of drift velocities
100   fVdriftcorSpline(0),///<spline of drift velocities corrected
101   fGainFSpline(0),///<spline of near gain
102   fGainNSpline(0),///<spline of far gain
103   fCO2Spline(0),///<spline of CO2 content
104   fN2Spline(0),
105   fGoofieValues(0)///<spline of  N2 content
106 {
107     /**
108        Constructor take a values from ASCI file with raw values. <br>
109        example: <b>fname = AliTPCGoofie_run_001.txt </b><br>
110        Read the next values, in this order (each line of the file is a data point) <br>
111        fGoofieTime fGoofieTempF fGoofieTempN fGoofiePress fGoofieVdrift fGoofieVdriftcor fGoofieAreaF fGoofieAreaN fGoofieCO2 fGoofieN2 
112
113      */
114
115     fLinesInFile= 0 ;
116     fStartTime= 0 ;
117     fEndTime= 0 ;
118     fTimeOfRun= 0 ;
119     fTempGrad= 0 ;
120  
121     fGoofieValues = new TTree("tree","goofie values"); 
122     fLinesInFile  = fGoofieValues->ReadFile(fname,"fGoofieTime/D:fGoofieTempF/D:fGoofieTempN/D:fGoofiePress/D:fGoofieVdrift/D:fGoofieVdriftcor/D:fGoofieAreaF/D:fGoofieAreaN/D:fGoofieCO2/D:fGoofieN2/D"); 
123
124     fAverageTempGraph =  new TGraph();
125     fTempGradGraph    =  new TGraph();
126     fPressGraph       =  new TGraph();
127     fVdriftGraph      =  new TGraph();
128     fVdriftcorGraph   =  new TGraph();
129     fGainFGraph       =  new TGraph();
130     fGainNGraph       =  new TGraph();
131     fCO2Graph         =  new TGraph();
132     fN2Graph          =  new TGraph();
133  
134     FillAllGraphs();
135     //Splines are allocated via FillAllSplines
136     FillAllSplines();
137   }
138   //________________________________________________________________________________
139   AliTPCGoofieValues::~AliTPCGoofieValues()
140   {
141     /**
142        AliTPCGoofieValues destructor
143      */
144  
145   }
146   //_________________________________________________________________________________
147   Long64_t AliTPCGoofieValues::GetLinesInFile(){
148     return fLinesInFile;
149   }
150   //_________________________________________________________________________________
151   Double_t AliTPCGoofieValues::GetStartTime()
152   {
153     /**
154       take a time in beging of run from Goofie in seconds 
155      */
156  
157     return fStartTime;
158   }
159   //__________________________________________________________________________________
160   Double_t AliTPCGoofieValues::GetEndTime()
161   {
162     /**
163        take the time in the end of run from Goofie in seconds
164      */
165   
166     return fEndTime;
167   }
168   
169   //__________________________________________________________________________________
170   Double_t AliTPCGoofieValues::GetTimeOfRun()
171   {
172     /**
173        return time of run in seconds
174     */
175   
176     Double_t time = GetEndTime(/*const char *fname*/) - GetStartTime(/*const char *fname*/);
177     return time;
178   }
179   //__________________________________________________________________________________
180   Double_t AliTPCGoofieValues::GetTempGrad(Double_t timeSec)
181   {
182
183     /**
184        gradient of temperature in the chosen time in run
185      */
186   
187     Double_t tempGrad;
188     FillTempGradGraph();
189     tempGrad = EvalTempGrad(timeSec);
190     return tempGrad;
191   }
192   //__________________________________________________________________________________
193   void AliTPCGoofieValues::FillAllGraphs(){
194     /**
195        Fill ALL the Graphs.<br>
196        There are individual methods, to do the same.<br>
197        This function is anyway called in the ctor. 
198        Selection has to be implemented:
199        //
200        Example selection  :
201        
202        AliTPCGoofieValues *a = new AliTPCGoofieValues("Goofie_data_january_run_01_08.txt");
203        TEventList list("listGood","listGood");
204        a->GetTree()->Draw(">>listGood","abs(fGoofieAreaN-2600)<500&&abs(fGoofieAreaF-2900)<300&&abs(fGoofieAreaF/fGoofieAreaN-1.1)<0.2","");
205        a->GetTree()->Draw("fGoofieVdrift:fGoofieTime");
206        a->GetTree()->SetEventList(&list);
207        a->GetTree()->SetMarkerColor(2);
208        //
209        a->GetTree()->Draw("fGoofieVdrift:fGoofieTime","","same*");
210        TGraph gr(200,a.GetTree()->GetV2(),a.GetTree()->GetV1());
211        //example residuals
212        AliSplineFit fit;
213        fit.SetGraph(&gr)
214        fit->SetMinPoints(200);
215        fit->InitKnots(&gr,15,0,0.2)
216        fit.SplineFit(1)
217        fit.MakeDiffHisto(&gr)->Draw();
218
219        
220      */
221     Long64_t nevent = fGoofieValues->GetEntries();
222     
223     //temporal for reading the branches
224     Double_t fGoofieTime   = 0; 
225     Double_t fGoofieTempN  = 0; 
226     Double_t fGoofieTempF  = 0; 
227     Double_t fGoofiePress  = 0;   
228     Double_t fGoofieAreaF  = 0; 
229     Double_t fGoofieAreaN  = 0; 
230     Double_t fGoofieVdriftcor  = 0; 
231     Double_t fGoofieVdrift     = 0; 
232     Double_t fGoofieCO2  = 0; 
233     Double_t fGoofieN2   = 0; 
234     fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
235     fGoofieValues->SetBranchAddress("fGoofieTempN",&fGoofieTempN); 
236     fGoofieValues->SetBranchAddress("fGoofieTempF",&fGoofieTempF);  
237     fGoofieValues->SetBranchAddress("fGoofiePress",&fGoofiePress);
238     fGoofieValues->SetBranchAddress("fGoofieAreaF",&fGoofieAreaF);
239     fGoofieValues->SetBranchAddress("fGoofieAreaN",&fGoofieAreaN);
240     fGoofieValues->SetBranchAddress("fGoofieVdriftcor",&fGoofieVdriftcor);
241     fGoofieValues->SetBranchAddress("fGoofieVdrift",&fGoofieVdrift);
242     fGoofieValues->SetBranchAddress("fGoofieCO2",&fGoofieCO2);
243     fGoofieValues->SetBranchAddress("fGoofieN2",&fGoofieN2); 
244     fStartTime = 0; //fGoofieValues->GetBranch("fGoofieTime")->GetEntry(0);
245
246     for (int i = 0; i < nevent; ++i){
247       if (fGoofieValues->GetEvent(i)<0){
248         // cout<< "you're done, man  !" << endl;
249         continue;
250       }
251       if (i==0) fStartTime = fGoofieTime;
252       else if (i == (nevent-1)) fEndTime = fGoofieTime;
253       //// cout<<  " reading " << i << endl;
254       fAverageTempGraph->SetPoint(i,(fGoofieTime - fStartTime),(fGoofieTempF+fGoofieTempN)/2);
255       fTempGradGraph->SetPoint(i,(fGoofieTime - fStartTime),(fGoofieTempF-fGoofieTempN)/25); 
256       fPressGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofiePress);
257       fGainFGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieAreaF);
258       fGainNGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieAreaN);
259       fVdriftGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieVdrift);  
260       fVdriftcorGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieVdriftcor);     
261       fCO2Graph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieCO2);
262       fN2Graph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieN2);
263     }
264
265   }
266
267   void AliTPCGoofieValues::FillAllSplines(){ 
268     /**
269        Fill ALL the Splines.<br>
270        There are individual methods, to do the same.<br>
271        This function is anyway called in the ctor. 
272      */
273    
274     fAverageTempSpline = new TSpline3("temperature",fAverageTempGraph);
275     fTempGradSpline    = new TSpline3("temperature gradient",fTempGradGraph);
276     fPressSpline       = new TSpline3("pressure",fPressGraph);
277     fVdriftcorSpline   = new TSpline3("vdriftcor",fVdriftcorGraph);
278     fVdriftSpline      = new TSpline3("vdrift",fVdriftGraph);  
279     fGainFSpline       = new TSpline3("gainF",fGainFGraph);
280     fGainNSpline       = new TSpline3("gainN",fGainNGraph);
281     fCO2Spline         = new TSpline3("co2",fCO2Graph);
282     fN2Spline          = new TSpline3("n2",fN2Graph);
283     
284   }
285
286   //___________________________________________________________________________________
287   void AliTPCGoofieValues::FillAverageTempGraph() 
288   {
289     /**
290        graph of temperature vs time. <br>
291        If the graph is already filled, it's only putting a title.
292      */
293
294     fAverageTempGraph->SetTitle("time dependence of temperature");    
295
296     if (!fAverageTempGraph->GetN()==0){
297       // cout<< " graph already filled !!! " << endl;
298     }
299     else {
300       Double_t fGoofieTime   = 0; 
301       Double_t fGoofieTempN  = 0; 
302       Double_t fGoofieTempF  = 0; 
303       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
304       fGoofieValues->SetBranchAddress("fGoofieTempN",&fGoofieTempN); 
305       fGoofieValues->SetBranchAddress("fGoofieTempF",&fGoofieTempF);  
306       
307       Long64_t nevent = fGoofieValues->GetEntries();
308       
309       for (int i = 0; i < nevent; ++i){
310         if (fGoofieValues->GetEvent(i)<0){
311           // cout<< "you're done, man  !" << endl;
312           continue;
313         } 
314         if (i==0) fStartTime = fGoofieTime;
315         else if (i == (nevent-1)) fEndTime = fGoofieTime;
316         fAverageTempGraph->SetPoint(i,(fGoofieTime - fStartTime),(fGoofieTempF+fGoofieTempN)/2);
317       }
318     }
319   }
320   //__________________________________________________________________________________
321   void AliTPCGoofieValues::FillTempGradGraph()
322   {
323     /**
324        graph of temperature gradient [K/cm]<br>
325        If the graph is already filled, it's only putting a title.
326      */
327   
328     fTempGradGraph->SetTitle("time dpendance of Temperature`s gradient");
329     
330     if(! fTempGradGraph->GetN()==0){ 
331       // cout<< " graph already filled !!! " << endl;
332     }
333     else{
334       Double_t fGoofieTime   = 0; 
335       Double_t fGoofieTempN  = 0; 
336       Double_t fGoofieTempF  = 0; 
337       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
338       fGoofieValues->SetBranchAddress("fGoofieTempN",&fGoofieTempN); 
339       fGoofieValues->SetBranchAddress("fGoofieTempF",&fGoofieTempF);  
340       
341       Long64_t nevent = fGoofieValues->GetEntries();
342       for (int i = 0; i < nevent; ++i){
343         if (fGoofieValues->GetEvent(i)<0){
344           // cout<< "you're done, man  !" << endl;
345           continue;
346         } 
347         if (i==0) fStartTime = fGoofieTime;
348         else if (i == (nevent-1)) fEndTime = fGoofieTime;    
349         fTempGradGraph->SetPoint(i,(fGoofieTime - fStartTime),(fGoofieTempF-fGoofieTempN)/25); 
350       }
351     }
352   }
353
354   //____________________________________________________________________________________
355   void AliTPCGoofieValues::FillPressGraph()
356   {
357     /**
358        Graph of pressure<br>
359        If the graph is already filled, it's only putting a title. 
360      */
361
362     fPressGraph->SetTitle("time dpendance of Pressure");     
363     if(!fPressGraph->GetN()==0){
364       // cout<< " graph already filled !!! " << endl; 
365     }
366     else{
367       Double_t fGoofieTime   = 0; 
368       Double_t fGoofiePress  = 0;      
369       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
370       fGoofieValues->SetBranchAddress("fGoofiePress",&fGoofiePress);
371      
372       Long64_t nevent = fGoofieValues->GetEntries();
373       for (int i = 0; i < nevent; ++i){
374         if (fGoofieValues->GetEvent(i)<0){
375           // cout<< "you're done, man  !" << endl;
376           continue;
377         } 
378         if (i==0) fStartTime = fGoofieTime;
379         else if (i == (nevent-1)) fEndTime = fGoofieTime;      
380         fPressGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofiePress);
381       }
382     }
383   }
384
385   
386 //________________________________________________________________________________________________
387   void AliTPCGoofieValues::FillGainFGraph()
388   {
389
390     /**
391        return graph of Gain in the far point of Goofie`s detector<br>
392        If the graph is already filled, it's only putting a title.
393      */
394
395    fGainFGraph->SetTitle("time dpendance of Gain in the far point in natural unit");
396
397    if(!fGainFGraph->GetN()==0){
398      // cout<< " graph already filled !!! " << endl; 
399    }
400    else{
401      Double_t fGoofieTime   = 0;    
402      Double_t fGoofieAreaF  = 0; 
403      fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
404      fGoofieValues->SetBranchAddress("fGoofieAreaF",&fGoofieAreaF);
405      Long64_t nevent = fGoofieValues->GetEntries();
406      for (int i = 0; i < nevent; ++i){
407        if (fGoofieValues->GetEvent(i)<0){
408          // cout<< "you're done, man  !" << endl;
409          continue;
410        } 
411        if (i==0) fStartTime = fGoofieTime;
412        else if (i == (nevent-1)) fEndTime = fGoofieTime;          
413        fGainFGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieAreaF);
414      }
415    }
416   }
417   
418 //_____________________________________________________________________________________
419   void AliTPCGoofieValues::FillGainNGraph()
420   {
421     /**
422        Graph of Gain in the near point of Goofie`s detector<br>
423        If the graph is already filled, it's only putting a title.
424      */
425
426    fGainNGraph->SetTitle("time dependance of Gain in the far poin in natural unit");
427    if(!fGainNGraph->GetN()==0){
428      // cout<< " graph already filled !!! " << endl; 
429    }
430    else{
431
432      Double_t fGoofieTime   = 0;    
433      Double_t fGoofieAreaN  = 0; 
434      fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
435      fGoofieValues->SetBranchAddress("fGoofieAreaN",&fGoofieAreaN);
436      Long64_t nevent = fGoofieValues->GetEntries();
437      for (int i = 0; i < nevent; ++i){
438        if (fGoofieValues->GetEvent(i)<0){
439          // cout<< "you're done, man  !" << endl;
440          continue;
441        } 
442        if (i==0) fStartTime = fGoofieTime;
443        else if (i == (nevent-1)) fEndTime = fGoofieTime;          
444        fGainNGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieAreaN);
445      }
446    }
447    
448   }
449 //_______________________________________________________________________________________
450 void AliTPCGoofieValues::FillVdriftGraph()
451   {
452     /**
453        Graph of raw Vdrift<br>
454        If the graph is already filled, it's only putting a title.
455     */
456  
457     fVdriftGraph->SetTitle("time dpendance of raw Vdrift");
458     if(!fVdriftGraph->GetN()==0){
459       // cout<< " graph already filled !!! " << endl; 
460     }
461     else{  
462       Double_t fGoofieTime   = 0;      
463       Double_t fGoofieVdrift = 0; 
464       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);     
465       fGoofieValues->SetBranchAddress("fGoofieVdrift",&fGoofieVdrift);
466       Long64_t nevent = fGoofieValues->GetEntries();
467       for (int i = 0; i < nevent; ++i){
468         if (fGoofieValues->GetEvent(i)<0){
469           // cout<< "you're done, man  !" << endl;
470           continue;
471         } 
472         if (i==0) fStartTime = fGoofieTime;
473         else if (i == (nevent-1)) fEndTime = fGoofieTime;         
474         fVdriftGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieVdrift);   
475       }
476     }
477   }  
478 //_____________________________________________________________________________________________
479 void AliTPCGoofieValues::FillVdriftcorGraph()
480   {
481    /**
482        Graph of Vdrift corrected by temperature and pressure<br>
483        If the graph is already filled, it's only putting a title. 
484    */
485  
486     fVdriftcorGraph->SetTitle("time dpendance of raw Vdriftcor");   
487     if(!fVdriftcorGraph->GetN()==0){
488       // cout<< " graph already filled !!! " << endl; 
489     }
490     else{   
491       Double_t fGoofieTime   = 0;      
492       Double_t fGoofieVdriftcor = 0; 
493       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);     
494       fGoofieValues->SetBranchAddress("fGoofieVdriftcor",&fGoofieVdriftcor);
495       Long64_t nevent = fGoofieValues->GetEntries();
496       for (int i = 0; i < nevent; ++i){
497         if (fGoofieValues->GetEvent(i)<0){
498           // cout<< "you're done, man  !" << endl;
499           continue;
500         } 
501         if (i==0) fStartTime = fGoofieTime;
502         else if (i == (nevent-1)) fEndTime = fGoofieTime;         
503         fVdriftcorGraph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieVdriftcor);   
504       }
505     }
506   }
507 //____________________________________________________________________________________________
508 void AliTPCGoofieValues::FillCO2Graph()
509   {
510     /**
511        Graph of CO2<br>
512        If the graph is already filled, it's only putting a title. 
513     */
514  
515     fCO2Graph->SetTitle("time dependance of CO2");
516     if(!fCO2Graph->GetN()==0){
517       // cout<< " graph already filled !!! " << endl; 
518     }
519     else{     
520       Double_t fGoofieTime   = 0;    
521       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);        
522       Double_t fGoofieCO2  = 0;     
523       fGoofieValues->SetBranchAddress("fGoofieCO2",&fGoofieCO2);
524       Long64_t nevent = fGoofieValues->GetEntries();
525       for (int i = 0; i < nevent; ++i){
526         if (fGoofieValues->GetEvent(i)<0){
527           // cout<< "you're done, man  !" << endl;
528           continue;
529         } 
530         if (i==0) fStartTime = fGoofieTime;
531         else if (i == (nevent-1)) fEndTime = fGoofieTime;       
532         fCO2Graph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieCO2);  
533       }
534     }
535   }
536 //_____________________________________________________________________________________________
537 void AliTPCGoofieValues::FillN2Graph()
538   {
539     /**
540        Graph of N2<br>
541        If the graph is already filled, it's only putting a title.
542      */
543
544   
545     fN2Graph->SetTitle("time dependance of N2");
546     if(!fN2Graph->GetN()==0){
547       // cout<< " graph already filled !!! " << endl; 
548     }
549     else{     
550       Double_t fGoofieTime   = 0;    
551       fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);        
552       Double_t fGoofieN2  = 0;     
553       fGoofieValues->SetBranchAddress("fGoofieN2",&fGoofieN2);
554       Long64_t nevent = fGoofieValues->GetEntries();
555       for (int i = 0; i < nevent; ++i){
556         if (fGoofieValues->GetEvent(i)<0){
557           // cout<< "you're done, man  !" << endl;
558           continue;
559         } 
560         if (i==0) fStartTime = fGoofieTime;
561         else if (i == (nevent-1)) fEndTime = fGoofieTime;       
562         fN2Graph->SetPoint(i,(fGoofieTime - fStartTime),fGoofieN2);  
563       }
564     } 
565   }
566   
567 //_________________________________________________________________________________________
568 void AliTPCGoofieValues::FillAverageTempSpline()
569 {
570   /**
571    TSpline object of average temperature<br>
572    If the spline is already filled, it's printing a message.
573   */
574   if(!fAverageTempSpline)
575     fAverageTempSpline = new TSpline3("temperature",fAverageTempGraph);
576   //else
577     // cout<< " spline already filled !!! " << endl; 
578  
579 }
580
581 //_________________________________________________________________________________________
582 void AliTPCGoofieValues::FillTempGradSpline()
583 {
584
585   /**
586      TSpline object of temperature gradient<br>
587      If the spline is already filled, it's printing a message.
588   */
589   if(!fTempGradSpline)
590     fTempGradSpline = new TSpline3("temperature gradient",fTempGradGraph);
591   //else
592     // cout<< " spline already filled !!! " << endl; 
593 }
594
595 //_________________________________________________________________________________________
596 void AliTPCGoofieValues::FillPressSpline()
597 {
598
599   /**
600      TSpline object of pressure<br>
601      If the spline is already filled, it's printing a message.
602   */
603   if(!fPressSpline)
604     fPressSpline = new TSpline3("pressure",fPressGraph);
605   //else
606     // cout<< " spline already filled !!! " << endl; 
607   
608 }
609
610 //_________________________________________________________________________________________
611 void AliTPCGoofieValues::FillVdriftSpline()
612 {
613
614   /**
615      TSpline object of drift velocity<br>
616      If the spline is already filled, it's printing a message.
617   */
618   if(!fVdriftSpline)
619     fVdriftSpline = new TSpline3("vdrift",fVdriftGraph);
620   //else{
621     // cout<< " spline already filled !!! " << endl; 
622   //}
623 }
624
625 //_________________________________________________________________________________________
626 void AliTPCGoofieValues::FillVdriftcorSpline()
627 {
628
629
630   /**
631      TSpline object of drift velocit corrected<br>
632      If the spline is already filled, it's printing a message.
633   */
634   if(!fVdriftcorSpline)
635     fVdriftcorSpline = new TSpline3("vdriftcor",fVdriftcorGraph);
636   //else
637     // cout<< " spline already filled !!! " << endl; 
638
639 }
640
641 //_________________________________________________________________________________________
642 void AliTPCGoofieValues::FillGainFSpline()
643 {
644
645   /**
646      return TSpline object of gain in far point<br>
647      If the spline is already filled, it's printing a message.
648   */
649   if(!fGainFSpline)
650     fGainFSpline = new TSpline3("gainF",fGainFGraph);
651   //else
652     // cout<< " spline already filled !!! " << endl; 
653
654 }
655
656 //_________________________________________________________________________________________
657 void AliTPCGoofieValues::FillGainNSpline()
658 {
659
660   /**
661      TSpline object of gain in near point<br>
662      If the spline is already filled, it's printing a message.
663   */
664   if(!fGainNSpline)
665     fGainNSpline = new TSpline3("gainN",fGainNGraph);
666   //else
667     // cout<< " spline already filled !!! " << endl; 
668  
669 }
670
671 //_________________________________________________________________________________________
672 void AliTPCGoofieValues::FillCO2Spline()
673 {
674
675   /**
676      TSpline object of average temperature<br>
677      If the spline is already filled, it's printing a message.
678   */  
679   if(!fCO2Spline)
680     fCO2Spline = new TSpline3("co2",fCO2Graph);
681   //else
682     // cout<< " spline already filled !!! " << endl; 
683 }
684
685 //_________________________________________________________________________________________
686 void AliTPCGoofieValues::FillN2Spline()
687 {
688
689   /**
690      TSpline object of average temperature<br>
691      If the spline is already filled, it's printing a message.
692   */ 
693   if(!fN2Spline)
694     fN2Spline = new TSpline3("n2",fN2Graph);
695   //else
696     // cout<< " spline already filled !!! " << endl; 
697 }
698
699 //__________________________________________________________________________________________
700 Double_t AliTPCGoofieValues::EvalTempGrad(Double_t timeSec)
701 {
702   if(!fTempGradSpline)
703     fTempGradSpline = new TSpline3("temperature gradient",fTempGradGraph);
704   Double_t a = fTempGradSpline->Eval(timeSec);
705   return a;
706 }
707
708 //___________________________________________________________________________________________
709 Double_t AliTPCGoofieValues::EvalAverageTemp(Double_t timeSec)
710 {
711   if(!fAverageTempSpline)
712     fAverageTempSpline = new TSpline3("temperature",fAverageTempGraph);
713   Double_t a = fAverageTempSpline->Eval(timeSec);
714   return a;
715 }
716
717 //___________________________________________________________________________________________
718 Double_t AliTPCGoofieValues::EvalPress(Double_t timeSec)
719 {
720   if(!fPressSpline)
721     fPressSpline = new TSpline3("pressure",fPressGraph);
722   Double_t a = fPressSpline->Eval(timeSec);
723   return a;
724 }
725
726 //___________________________________________________________________________________________
727 Double_t AliTPCGoofieValues::EvalVdrift(Double_t timeSec)
728 {
729   if(!fVdriftSpline)
730     fVdriftSpline = new TSpline3("vdrift",fVdriftGraph);
731   Double_t a = fVdriftSpline->Eval(timeSec);
732   return a;
733 }
734
735 //___________________________________________________________________________________________
736 Double_t AliTPCGoofieValues::EvalVdriftcor(Double_t timeSec)
737 {
738   if(!fVdriftcorSpline)
739     fVdriftcorSpline = new TSpline3("vdriftcor",fVdriftcorGraph);
740   Double_t a = fVdriftcorSpline->Eval(timeSec);
741   return a;
742 }
743
744 //___________________________________________________________________________________________
745 Double_t AliTPCGoofieValues::EvalGainF(Double_t timeSec)
746 {
747   if(!fGainFSpline)
748     fGainFSpline = new TSpline3("gainF",fGainFGraph);
749   Double_t a = fGainFSpline->Eval(timeSec);
750   return a;
751 }
752
753 //___________________________________________________________________________________________
754 Double_t AliTPCGoofieValues::EvalGainN(Double_t timeSec)
755 {
756   if(!fGainNSpline)
757     fGainNSpline = new TSpline3("gainN",fGainNGraph);
758   Double_t a  = fGainNSpline->Eval(timeSec);
759   return a;
760 }
761
762 //___________________________________________________________________________________________
763 Double_t AliTPCGoofieValues::EvalCO2(Double_t timeSec)
764 {
765   if(!fCO2Spline)
766     fCO2Spline  = new TSpline3("co2",fCO2Graph);
767   Double_t a = fCO2Spline->Eval(timeSec);
768   return a;
769 }
770
771 //___________________________________________________________________________________________
772 Double_t AliTPCGoofieValues::EvalN2(Double_t timeSec)
773 {
774   if(!fN2Spline)
775     fN2Spline = new TSpline3("n2",fN2Graph);
776   Double_t a = fN2Spline->Eval(timeSec);
777   return a;
778 }
779
780 void AliTPCGoofieValues::PrintTree(){
781   /** 
782       Testing function: it prints all the information stored in the tree
783    */
784
785   Long64_t nevent = fGoofieValues->GetEntries();
786   // cout<< " number of entries: " << nevent << endl;
787   //temporal for reading the branches
788   Double_t fGoofieTime   = 0; 
789   Double_t fGoofieTempN  = 0; 
790   Double_t fGoofieTempF  = 0; 
791   Double_t fGoofiePress  = 0;   
792   Double_t fGoofieAreaF  = 0; 
793   Double_t fGoofieAreaN  = 0; 
794   
795   Double_t fGoofieVdriftcor  = 0; 
796   Double_t fGoofieVdrift     = 0; 
797   Double_t fGoofieCO2  = 0; 
798   Double_t fGoofieN2   = 0; 
799
800   fGoofieValues->SetBranchAddress("fGoofieTime",&fGoofieTime);
801   fGoofieValues->SetBranchAddress("fGoofieTempN",&fGoofieTempN); 
802   fGoofieValues->SetBranchAddress("fGoofieTempF",&fGoofieTempF);  
803   fGoofieValues->SetBranchAddress("fGoofiePress",&fGoofiePress);
804   
805   fGoofieValues->SetBranchAddress("fGoofieAreaF",&fGoofieAreaF);
806   fGoofieValues->SetBranchAddress("fGoofieAreaN",&fGoofieAreaN);
807   
808   fGoofieValues->SetBranchAddress("fGoofieVdriftcor",&fGoofieVdriftcor);
809   fGoofieValues->SetBranchAddress("fGoofieVdrift",&fGoofieVdrift);
810   
811   fGoofieValues->SetBranchAddress("fGoofieCO2",&fGoofieCO2);
812   fGoofieValues->SetBranchAddress("fGoofieN2",&fGoofieN2); 
813
814   for (int j = 0; j < nevent; ++j){
815     if (fGoofieValues->GetEvent(j)<0){
816       // cout<< "you're done, man  !" << endl;
817       continue;
818     } 
819 //     // cout<< "  reading event: " << j << " " << fGoofieTime << " " 
820 //       << fGoofieTempN << " " << fGoofieTempF << " " 
821 //       << fGoofiePress << " " << fGoofiePress << " " 
822 //       << fGoofieAreaF << " " << fGoofieAreaN << " " 
823 //       << fGoofieVdriftcor << " " << fGoofieVdrift << " " 
824 //       <<  fGoofieCO2 << " " << fGoofieN2 << endl;
825   }
826 }
827
828   
829   
830   
831   
832   
833   
834