]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/AliEMCALSensorTemp.cxx
debug message removed
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALSensorTemp.cxx
1 /**************************************************************************
2  * Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16
17 ////////////////////////////////////////////////////////////////////////////////
18 //                                                                            //
19 // Class describing EMCAL temperature sensors (including pointers to graphs/fits//
20 // Authors: David Silvermyr, copied from TPC (Ivanov, Helstrup, Siska)        //
21 //                                                                            //
22 ////////////////////////////////////////////////////////////////////////////////
23
24 // Running instructions:
25 /*
26   TClonesArray * arr = AliEMCALSensorTemp::ReadList("TempSensor.txt","emc_PT_%d.Temperature");
27   TFile f("TempSensors.root","RECREATE");
28   TTree * tree = new TTree("TempSensor", "TempSensor");
29   tree->Branch("Temp",&arr);
30   tree->Fill();
31   tree->Write();
32   
33 */
34
35 //
36
37 #include <strings.h>
38 #include "AliEMCALSensorTemp.h"
39 ClassImp(AliEMCALSensorTemp)
40
41 //______________________________________________________________________________________________
42
43 AliEMCALSensorTemp::AliEMCALSensorTemp(): AliDCSSensor(),
44   fSide(0),
45   fSector(0),
46   fNum(0)
47 {
48   //
49   //  Standard constructor
50   //
51 }
52 //______________________________________________________________________________________________
53
54 AliEMCALSensorTemp::AliEMCALSensorTemp(const AliEMCALSensorTemp& source) :
55   AliDCSSensor(source),
56    fSide(source.fSide),
57    fSector(source.fSector),
58    fNum(source.fNum)
59
60 //
61 //  Copy constructor
62 //
63 { }
64 //______________________________________________________________________________________________
65
66 AliEMCALSensorTemp& AliEMCALSensorTemp::operator=(const AliEMCALSensorTemp& source){
67 //
68 // assignment operator
69 //
70   if (&source == this) return *this;
71   new (this) AliEMCALSensorTemp(source);
72   
73   return *this;  
74 }
75 //______________________________________________________________________________________________
76
77 TClonesArray * AliEMCALSensorTemp::ReadList(const char *fname,
78                                           const TString& amandaString) {
79   //
80   // read values from ascii file
81   //
82   TTree * tree = new TTree("asci","asci");
83   tree->ReadFile(fname,"");
84   TClonesArray *arr = ReadTree(tree, amandaString);
85   delete tree;
86   return arr;
87 }
88      
89 //______________________________________________________________________________________________
90
91 TClonesArray * AliEMCALSensorTemp::ReadTree(TTree *tree, 
92                                           const TString& amandaString) 
93 { // read selected info from TTree
94   
95   Int_t nentries = tree->GetEntries();
96   Int_t sensor=0;
97   Int_t sector=0;
98   char  side[100];
99   Int_t num=0;
100   Int_t echa=0;
101   //Double_t x=0;
102   //Double_t y=0;
103   //Double_t z=0;
104   //String_t namedtp[100];
105
106   tree->SetBranchAddress("Sensor",&sensor);
107   tree->SetBranchAddress("Side",&side);
108   tree->SetBranchAddress("Sec",&sector);
109   tree->SetBranchAddress("Num",&num);
110   tree->SetBranchAddress("ECha",&echa);
111   //tree->SetBranchAddress("X",&x);
112   //tree->SetBranchAddress("Y",&y);
113   //tree->SetBranchAddress("Z",&z);
114
115   // firstSensor = (Int_t)tree->GetMinimum("ECha");
116   // lastSensor = (Int_t)tree->GetMaximum("ECha");
117
118   TClonesArray * array = new TClonesArray("AliEMCALSensorTemp",nentries);
119
120   for (Int_t isensor=0; isensor<nentries; isensor++){
121     AliEMCALSensorTemp * temp = new ((*array)[isensor])AliEMCALSensorTemp;
122     tree->GetEntry(isensor);
123     temp->SetId(sensor);
124     temp->SetIdDCS(echa);
125     TString stringID = Form (amandaString.Data(),echa);
126     temp->SetStringID(stringID);
127     if (side[0]=='C') temp->SetSide(1);
128     temp->SetSector(sector);
129     temp->SetNum(num);
130
131     // Don't yet know the local or global coordinates for where the sensors will be placed..
132     //temp->SetX(x);
133     //temp->SetY(y);
134     //temp->SetZ(z);
135
136   }
137   return array;
138 }