AliRoot Core  3dc7879 (3dc7879)
AliEMCALSensorTemp.cxx
Go to the documentation of this file.
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 #include <strings.h>
17 
18 #include "AliEMCALSensorTemp.h"
19 
21 ClassImp(AliEMCALSensorTemp) ;
23 
26 //______________________________________________________________________________________________
28  fSide(0),
29  fSector(0),
30  fNum(0)
31 { }
32 
35 //______________________________________________________________________________________________
37  AliDCSSensor(source),
38  fSide(source.fSide),
39  fSector(source.fSector),
40  fNum(source.fNum)
41 { }
42 
45 //______________________________________________________________________________________________
47 {
48  if (&source == this) return *this;
49 
50  new (this) AliEMCALSensorTemp(source);
51 
52  return *this;
53 }
54 
57 //______________________________________________________________________________________________
58 TClonesArray * AliEMCALSensorTemp::ReadList(const char *fname,
59  const TString& amandaString)
60 {
61  TTree * tree = new TTree("asci","asci");
62  tree->ReadFile(fname,"");
63  TClonesArray *arr = ReadTree(tree, amandaString);
64  delete tree;
65  return arr;
66 }
67 
70 //______________________________________________________________________________________________
71 TClonesArray * AliEMCALSensorTemp::ReadTree(TTree *tree,
72  const TString& amandaString)
73 {
74  Int_t nentries = tree->GetEntries();
75  Int_t sensor=0;
76  Int_t sector=0;
77  char side[100];
78  Int_t num=0;
79  Int_t echa=0;
80  //Double_t x=0;
81  //Double_t y=0;
82  //Double_t z=0;
83  //String_t namedtp[100];
84 
85  tree->SetBranchAddress("Sensor",&sensor);
86  tree->SetBranchAddress("Side",&side);
87  tree->SetBranchAddress("Sec",&sector);
88  tree->SetBranchAddress("Num",&num);
89  tree->SetBranchAddress("ECha",&echa);
90  //tree->SetBranchAddress("X",&x);
91  //tree->SetBranchAddress("Y",&y);
92  //tree->SetBranchAddress("Z",&z);
93 
94  // firstSensor = (Int_t)tree->GetMinimum("ECha");
95  // lastSensor = (Int_t)tree->GetMaximum("ECha");
96 
97  TClonesArray * array = new TClonesArray("AliEMCALSensorTemp",nentries);
98 
99  for (Int_t isensor=0; isensor<nentries; isensor++)
100  {
101  AliEMCALSensorTemp * temp = new ((*array)[isensor])AliEMCALSensorTemp;
102  tree->GetEntry(isensor);
103 
104  temp->SetId(sensor);
105  temp->SetIdDCS(echa);
106 
107  TString stringID = Form (amandaString.Data(),echa);
108  temp->SetStringID(stringID);
109 
110  if (side[0]=='C') temp->SetSide(1);
111  temp->SetSector(sector);
112  temp->SetNum(num);
113 
114  // Don't yet know the local or global coordinates for where the sensors will be placed..
115  //temp->SetX(x);
116  //temp->SetY(y);
117  //temp->SetZ(z);
118  }
119 
120  return array;
121 }
static TClonesArray * ReadList(const char *fname, const TString &amandaString=kAmandaString)
Read values from ascii file.
Container class for temperature sensor positions.
void SetStringID(const TString &stringID)
Definition: AliDCSSensor.h:58
Int_t fNum
Number within a SuperModule: 8 sensors => index range 0-7.
Int_t fSide
EMCAL side; 0:Shaft Side (A) – 1:Muon Side (C)
Int_t fSector
Number of sector (0-5)
TObjArray * array
Definition: AnalyzeLaser.C:12
static TClonesArray * ReadTree(TTree *tree, const TString &amandaString=kAmandaString)
Read selected info from TTree.
TTree * tree
void SetIdDCS(Int_t iddcs)
Definition: AliDCSSensor.h:57
void SetSide(Int_t side)
void SetSector(Int_t sector)
AliEMCALSensorTemp()
Default constructor.
void SetId(Int_t id)
Definition: AliDCSSensor.h:56
char * fname
AliEMCALSensorTemp & operator=(const AliEMCALSensorTemp &source)
Assignment operator.
void SetNum(Int_t num)