104 {
105 MsgStream log(
msgSvc(), name());
106 bool print_here = (false || Debug);
107 log << MSG::INFO << "CgemLUTWriter initialize()" << endreq;
108
109
110
112 std::ifstream inStream(
inFile_name, std::ios::binary);
113
114 if (!inStream) {
115 std::cerr <<
"File " <<
inFile_name <<
" not found" << std::endl;
116 return StatusCode::FAILURE;
117 }
119 TTree *tree1 = (TTree*)file1->Get("t1");
120 bool b1(0),b2(0),b3(0);
121 b1=file1->IsOpen();
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
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
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
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
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
178 if(
ch.GetEntries()==0){
179 std::cerr <<
"No entries in the event file "<<
inFile_name<<endl;
180 return StatusCode::FAILURE;
181 }
182
183 Define_TTree();
184
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
196 is_failing=false;
198
199 return StatusCode::SUCCESS;
200}
double expected_noise_per_chip