1 /**************************************************************************
2 * Copyright(c) 2006-07, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 ////////////////////////////////////////////////////////////////////////////////
19 // Class describing EMCAL temperature sensors (including pointers to graphs/fits//
20 // Authors: David Silvermyr, copied from TPC (Ivanov, Helstrup, Siska) //
22 ////////////////////////////////////////////////////////////////////////////////
24 // Running instructions:
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);
38 #include "AliEMCALSensorTemp.h"
39 ClassImp(AliEMCALSensorTemp)
41 //______________________________________________________________________________________________
43 AliEMCALSensorTemp::AliEMCALSensorTemp(): AliDCSSensor(),
49 // Standard constructor
52 //______________________________________________________________________________________________
54 AliEMCALSensorTemp::AliEMCALSensorTemp(const AliEMCALSensorTemp& source) :
57 fSector(source.fSector),
64 //______________________________________________________________________________________________
66 AliEMCALSensorTemp& AliEMCALSensorTemp::operator=(const AliEMCALSensorTemp& source){
68 // assignment operator
70 if (&source == this) return *this;
71 new (this) AliEMCALSensorTemp(source);
75 //______________________________________________________________________________________________
77 TClonesArray * AliEMCALSensorTemp::ReadList(const char *fname,
78 const TString& amandaString) {
80 // read values from ascii file
82 TTree * tree = new TTree("asci","asci");
83 tree->ReadFile(fname,"");
84 TClonesArray *arr = ReadTree(tree, amandaString);
89 //______________________________________________________________________________________________
91 TClonesArray * AliEMCALSensorTemp::ReadTree(TTree *tree,
92 const TString& amandaString)
93 { // read selected info from TTree
95 Int_t nentries = tree->GetEntries();
104 //String_t namedtp[100];
106 tree->SetBranchAddress("Sensor",&sensor);
107 tree->SetBranchAddress("Side",&side);
108 tree->SetBranchAddress("Sec",§or);
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);
115 // firstSensor = (Int_t)tree->GetMinimum("ECha");
116 // lastSensor = (Int_t)tree->GetMaximum("ECha");
118 TClonesArray * array = new TClonesArray("AliEMCALSensorTemp",nentries);
120 for (Int_t isensor=0; isensor<nentries; isensor++){
121 AliEMCALSensorTemp * temp = new ((*array)[isensor])AliEMCALSensorTemp;
122 tree->GetEntry(isensor);
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);
131 // Don't yet know the local or global coordinates for where the sensors will be placed..