CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemLUTWriter Class Reference

#include <CgemLUTWriter.h>

+ Inheritance diagram for CgemLUTWriter:

Public Member Functions

 CgemLUTWriter (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~CgemLUTWriter ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Definition at line 24 of file CgemLUTWriter.h.

Constructor & Destructor Documentation

◆ CgemLUTWriter()

CgemLUTWriter::CgemLUTWriter ( const std::string & name,
ISvcLocator * pSvcLocator )

Definition at line 87 of file CgemLUTWriter.cxx.

87 :
88 Algorithm(name,pSvcLocator){
89 declareProperty("InputFileData" , InputFileData = "ciao.root");
90 declareProperty("InputFileMapping" , InputFileMapping ="mapping.txt");
91 declareProperty("InputFileTiger" , InputFileTiger ="tiger.txt");
92 declareProperty("InputFileHvSetting", InputFileHvSetting="hv_setting.txt");
93 declareProperty("PrintCanvas" , PrintCanvas = false);
94 declareProperty("OutputPdf" , OutputPdf = "Output.pdf");
95 declareProperty("OutputRoot" , OutputRoot = "Output.root");
96 declareProperty("DisableMeasures" , DisableMeasures = false);
97 declareProperty("DisableLowEntries" , DisableLowEntries = false);
98 declareProperty("MinEntries" , MinEntries = 100);
99 declareProperty("Debug" , Debug = false);
100}

◆ ~CgemLUTWriter()

CgemLUTWriter::~CgemLUTWriter ( )

Definition at line 102 of file CgemLUTWriter.cxx.

102{}

Member Function Documentation

◆ execute()

StatusCode CgemLUTWriter::execute ( )

Definition at line 202 of file CgemLUTWriter.cxx.

202 {
203 MsgStream log(msgSvc(), name());
204 log << MSG::INFO << "CgemLUTWriter execute()" << endreq;
205 Read_HV_Setting();
206 while(mapping_file.peek()!=EOF){
207 Read_Mapping();
208 Read_Tiger();
209 //Measure
210 Measure_Noise();
211 Measure_Threshold();
212 Measure_Signal();
213 //Fill
214 Fill_TTree();
215 //Terminate
216 if(PrintCanvas) canvas->Print((TString)OutputPdf);
217 if(is_failing) return StatusCode::FAILURE;
218 if(FEB_i==79 && chip_i==1 && ch_i==63) return StatusCode::SUCCESS;
219 }
220 return StatusCode::SUCCESS;
221}
IMessageSvc * msgSvc()

◆ finalize()

StatusCode CgemLUTWriter::finalize ( )

Definition at line 223 of file CgemLUTWriter.cxx.

223 {
224 MsgStream log(msgSvc(), name());
225 log << MSG::INFO << "CgemLUTWriter finalize()" << endreq;
226 if(PrintCanvas){
227 TString OutputPdf2 = OutputPdf+"]";
228 canvas->Print(OutputPdf2);
229 }
230 otree->Write();
231 ootree->Fill();
232 ootree->Write();
233 return StatusCode::SUCCESS;
234}

◆ initialize()

StatusCode CgemLUTWriter::initialize ( )

Definition at line 104 of file CgemLUTWriter.cxx.

104 {
105 MsgStream log(msgSvc(), name());
106 bool print_here = (false || Debug);
107 log << MSG::INFO << "CgemLUTWriter initialize()" << endreq;
108 //
109 //
110 //Define input file
111 inFile_name = InputFileData;
112 std::ifstream inStream(inFile_name, std::ios::binary);
113 //Check the input file ROOT
114 if (!inStream) {
115 std::cerr << "File " << inFile_name << " not found" << std::endl;
116 return StatusCode::FAILURE;
117 }
118 TFile *file1 = new TFile((TString)inFile_name);
119 TTree *tree1 = (TTree*)file1->Get("t1");
120 bool b1(0),b2(0),b3(0);
121 b1=file1->IsOpen();
122 b2=(bool)tree1;
123 if(b2) b3=tree1->IsFolder();
124 if(b1*b2*b3 == 0) {
125 std::cerr <<"ERROR in file "<<inFile_name<<" "<<b1<<" "<<b2<<" "<<b3<<endl;
126 return StatusCode::FAILURE;
127 }
128 //Check the input file Mapping
129 mapping_file.open(InputFileMapping.c_str());
130 if(!mapping_file.is_open()){
131 std::cerr << "File " << InputFileMapping<<" not found"<<endl;
132 return StatusCode::FAILURE;
133 }
134 int nlines_mapping=0;
135 string line_mapping;
136 while(getline(mapping_file,line_mapping)) nlines_mapping++;
137 if(print_here)cout<<"The number of lines in "<<InputFileMapping<<" is: "<<nlines_mapping<<endl;
138 mapping_file.clear();
139 mapping_file.seekg (0, ios_base::beg);
140 getline(mapping_file,line_mapping);
141 //Check the input file Tiger
142 tiger_file.open(InputFileTiger.c_str());
143 if(!tiger_file.is_open()){
144 std::cerr << "File " << InputFileTiger<<" not found"<<endl;
145 return StatusCode::FAILURE;
146 }
147 int nlines_tiger=0;
148 string line_tiger;
149 while(getline(tiger_file,line_tiger)) nlines_tiger++;
150 if(print_here)cout<<"The number of lines in "<<InputFileTiger<<" is: "<<nlines_tiger<<endl;
151 tiger_file.clear();
152 tiger_file.seekg (0, ios_base::beg);
153 getline(tiger_file,line_tiger);
154 //Check the consistency between Tiger and Mapping files
155 if(nlines_tiger!=10241 && nlines_mapping!=10241){
156 std::cerr <<" The number of lines in the files "<<InputFileMapping<<" and "<<InputFileTiger<<" is not correct"<<endl;
157 return StatusCode::FAILURE;
158 }
159 //Check the input file HV Setting
160 hv_file.open(InputFileHvSetting.c_str());
161 if(!hv_file.is_open()){
162 std::cerr << "File " << InputFileHvSetting<<" not found"<<endl;
163 return StatusCode::FAILURE;
164 }
165 string line_hv;
166 int nlines_hv=0;
167 while(getline(hv_file,line_hv)) nlines_hv++;
168 if(print_here)cout<<"The number of lines in "<<InputFileHvSetting<<" is: "<<nlines_hv<<endl;
169 hv_file.clear();
170 hv_file.seekg (0, ios_base::beg);
171 getline(hv_file,line_hv);
172 if(nlines_hv!=2){
173 std::cerr <<" The number of lines in the file "<<InputFileHvSetting<<" is not correct"<<endl;
174 return StatusCode::FAILURE;
175 }
176 //Include the input file to the TChain
177 ch.Add((TString)inFile_name);
178 if(ch.GetEntries()==0){
179 std::cerr << "No entries in the event file "<<inFile_name<<endl;
180 return StatusCode::FAILURE;
181 }
182 //Define the output tree aka LUT
183 Define_TTree();
184 //Define Draw Canvas
185 canvas = new TCanvas("canvas","canvas",800,600);
186 if(PrintCanvas){
187 TString OutputPdf1 = OutputPdf+"[";
188 canvas->Print(OutputPdf1);
189 canvas->Divide(3,2);
190 DrawOption = "";
191 }
192 else{
193 DrawOption = "goff";
194 }
195 //Other TO BE CHECK
196 is_failing=false;
197 expected_noise_per_chip*=ch.GetEntries();
198 //Terminate
199 return StatusCode::SUCCESS;
200}
TString inFile_name
double expected_noise_per_chip
TChain ch("t1")

The documentation for this class was generated from the following files: