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 TPC pressure sensors (including pointers to graphs/fits //
20 // Authors: Marian Ivanov and Haavard Helstrup //
22 ////////////////////////////////////////////////////////////////////////////////
24 // Running instructions:
26 TClonesArray * arr = AliTPCSensorPressure::ReadList("PressureSensor.txt");
27 TFile f("PressureSensors.root","RECREATE");
28 TTree * tree = new TTree("PressureSensor", "PressureSensor");
29 tree->Branch("Pressure",&arr);
37 #include "AliTPCSensorPressure.h"
38 ClassImp(AliTPCSensorPressure)
42 AliTPCSensorPressure::AliTPCSensorPressure(): AliDCSSensor(),
49 // Standard constructor
53 AliTPCSensorPressure::AliTPCSensorPressure(const AliTPCSensorPressure& source) :
57 fSector(source.fSector),
65 AliTPCSensorPressure& AliTPCSensorPressure::operator=(const AliTPCSensorPressure& source){
67 // assignment operator
69 if (&source == this) return *this;
70 new (this) AliTPCSensorPressure(source);
77 TClonesArray * AliTPCSensorPressure::ReadList(const char *fname) {
79 // read values from ascii file
81 TTree * tree = new TTree("asci","asci");
82 tree->ReadFile(fname,"");
84 Int_t nentries = tree->GetEntries();
94 //String_t namedtp[100];
96 tree->SetBranchAddress("Sensor",&sensor);
97 tree->SetBranchAddress("Type",&type);
98 tree->SetBranchAddress("Side",&side);
99 tree->SetBranchAddress("Sec",§or);
100 tree->SetBranchAddress("Num",&num);
101 tree->SetBranchAddress("ECha",&echa);
102 //tree->SetBranchAddress("X",&x);
103 //tree->SetBranchAddress("Y",&y);
104 //tree->SetBranchAddress("Z",&z);
106 // firstSensor = (Int_t)tree->GetMinimum("ECha");
107 // lastSensor = (Int_t)tree->GetMaximum("ECha");
109 TClonesArray * array = new TClonesArray("AliTPCSensorPressure",nentries);
111 for (Int_t isensor=0; isensor<nentries; isensor++){
112 AliTPCSensorPressure * temp = new ((*array)[isensor])AliTPCSensorPressure;
113 tree->GetEntry(isensor);
115 temp->SetIdDCS(echa);
116 if (side[0]=='C') temp->SetSide(1);
117 temp->SetSector(sector);
119 //temp->SetType(type);
120 if (bcmp(type,"ROC",3)==0) temp->SetType(0);
121 if (bcmp(type,"OFC",3)==0) temp->SetType(1);
122 if (bcmp(type,"IFC",3)==0) temp->SetType(2);
123 if (bcmp(type,"TPC",3)==0) temp->SetType(3);
124 if (bcmp(type,"ELM",3)==0) temp->SetType(4);
125 if (bcmp(type,"TS",2)==0) temp->SetType(5);
126 if (bcmp(type,"COOL",3)==0)temp->SetType(6);
134 /* if (temp->GetType()==0){
135 // temp->SetX(TMath::Cos((2*sector+1)*0.1745)*(83+(num+1)*30));
137 temp->SetX(kCSideX[sector][num]);
139 temp->SetX(kASideX[sector][num]);
142 if ((temp->GetType()==1) || (temp->GetType()==4)){
143 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*278);
145 if ((temp->GetType()==2) || (temp->GetType()==3)){
146 temp->SetX(TMath::Cos((2*sector+1)*0.1745)*kIFCrad[num]);
148 if ((temp->GetType()==5) || (temp->GetType()==6)){
153 if (temp->GetType()==0){
154 // temp->SetY(TMath::Sin((2*sector+1)*0.1745)*(83+(num+1)*30));
156 temp->SetY(kCSideY[sector][num]);
158 temp->SetY(kASideY[sector][num]);
161 if ((temp->GetType()==1) || (temp->GetType()==4)){
162 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*278);
164 if ((temp->GetType()==2) || (temp->GetType()==3)){
165 temp->SetY(TMath::Sin((2*sector+1)*0.1745)*kIFCrad[num]);
167 if ((temp->GetType()==5) || (temp->GetType()==6)){
171 if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==0) {
174 if ((temp->GetType()==0 || temp->GetType()==3 || temp->GetType()==4 || temp->GetType()==5 || temp->GetType()==6) && temp->GetSide()==1){
177 if((temp->GetType()==1 || temp->GetType()==2) && (num==0)) {
180 if((temp->GetType()==1 || temp->GetType()==2) && (num==1)) {
183 if((temp->GetType()==1 || temp->GetType()==2) && (num==2)) {
186 if((temp->GetType()==1 || temp->GetType()==2) && (num==3)) {
189 if((temp->GetType()==1 || temp->GetType()==2) && (num==4)) {
192 if((temp->GetType()==1 || temp->GetType()==2) && (num==5)) {