19 #include <boost/algorithm/string.hpp>
22 using namespace boost;
27 cout <<
"I am GROOT!";
31 for(
int i=0;
i<4;
i++)
33 theTraces.push_back(
new ATrace());
44 for (
int i=0;
i<
Nr;
i++)
55 int channel = 32 * (
i % 4 ) + 8 * (
i >> 2) - 31 * (
i >> 4);
70 for(
unsigned int i=0;
i<theTraces.size();
i++ ) {
delete theTraces[
i]; }
72 for(
unsigned int i=0;
i< theTracks.size();
i++ ) {
delete theTracks[
i]; }
74 for(
unsigned int i=0;
i< theZigzags.size();
i++ ) {
delete theZigzags[
i]; }
76 for(
unsigned int i=0;
i<
Nr;
i++ )
78 for (
unsigned int j=0;
i< theBlobs[
i].size();
j++ ) {
delete (theBlobs[
i])[
j]; }
87 cout <<
"I am groot!" << endl;
89 cout <<
"TRACES -------------------------------------------------------" << endl;
90 for (
unsigned int i=0;
i< theTraces.size();
i++)
92 cout <<
" Trace " <<
i;
93 cout <<
" Maximum: " << theTraces[
i]->FindMaximum(1) <<
" " <<endl;
96 cout <<
"ZIGZAGS -------------------------------------------------------" << endl;
98 for (
unsigned int i=0;
i< theZigzags.size();
i++)
115 cout <<
" BLOBS --------------------------------------------------------------" << endl;
116 for(
int i=0;
i<
Nr;
i++)
118 cout <<
"*** ROW: " <<
i+1 << endl;
119 for (
int j=0;
j<theBlobs[
i].size();
j++)
121 theBlobs[
i][
j]->Report();
130 for (
int i=0;
i<4;
i++)
132 theTraces[
i]->voltage.clear();
143 for(
unsigned int i=0;
i<
Nr;
i++)
145 for (
unsigned int j=0;
j< theBlobs[
i].size();
j++ )
147 delete (theBlobs[
i])[
j];
153 for (
unsigned int i=0;
i< theTracks.size();
i++ )
163 cout <<
"waveform neighbors" << endl;
169 int i = CHhybrid*
j +
k;
172 if (k>0) ZWaveMap[
i]->PreWaveform = ZWaveMap[i-1];
173 if (k<CHhybrid-1) ZWaveMap[
i]->PostWaveform = ZWaveMap[i+1];
178 cout <<
"logical neighbors" << endl;
180 for (
int j=0;
j<
Nr;
j++)
184 if (ZigzagMap2[
j][
k] !=0)
186 if (
k>0) ZigzagMap2[
j][
k]->PreLogical = ZigzagMap2[
j][
k-1];
187 if (
k<Nphi-1) ZigzagMap2[
j][
k]->PostLogical = ZigzagMap2[
j][
k+1];
196 cout <<
"Filling the Zigzag Maps..." << endl;
198 string dir( getenv(
"MYCALIB") );
199 string file(
"PadMap.txt");
200 string result = dir +
file;
201 cout <<
"Looking for PadMap.txt in " << result << endl;
202 ifstream fin(result.c_str());
206 cout <<
"Groot could not open the file PadMap.txt." << endl;
207 cout <<
"Please initialize the variable $MYCALIB in your .login." << endl;
208 cout <<
"Then move the PadMap.txt file from the groot source to there." << endl;
209 cout <<
"Only after that will you be allowed to continue analysis." << endl;
212 cout <<
"FOUND!" << endl;
219 vector<string>
items;
220 boost::split(items, line, [](
char c){
return c ==
',';});
222 Padplane_NameToConnector[items[0]] = items[1];
223 Padplane_NameToSamPin[items[0]] = items[2];
235 dir = getenv(
"MYCALIB");
236 file =
"PanSamMap.txt";
238 cout <<
"Looking for PadMap.txt in " << result << endl;
239 fin.open(result.c_str());
243 cout <<
"You could not open the file PanSamMap.txt." << endl;
244 cout <<
"Please initialize the variable $MYCALIB in your .login." << endl;
245 cout <<
"Then move the PanSamMap.txt file from the groot source to there." << endl;
246 cout <<
"Only after that will you be allowed to continue analysis." << endl;
249 cout <<
"FOUND!" << endl;
255 vector<string>
items;
256 boost::split(items, line, [](
char c){
return c ==
',';});
258 PanSam_SamPinToPanPin[items[0]] = atoi(items[1].c_str());
288 string ConnNumber = Conn.substr(2);
289 int Number = atoi(ConnNumber.c_str());
315 string dir( getenv(
"MYCALIB") );
316 string file(
"OUTPUT_trim.XML");
317 string result = dir +
file;
318 cout <<
"Looking for OUTPUT_trim.XML in " << result << endl;
319 ifstream fin(result.c_str());
323 cout <<
"You could not open the file OUTPUT_trim.XML." << endl;
324 cout <<
"Please initialize the variable $MYCALIB in your .login." << endl;
325 cout <<
"Then move the OUTPUT_trim.XML file from the groot source to there." << endl;
326 cout <<
"Only after that will you be allowed to continue analysis." << endl;
329 cout <<
"FOUND!" << endl;
337 if(!fin.good())
break;
340 fin >> thispad.
fName;
346 if(tmp==999999)
break;
347 thispad.
fX.push_back(tmp);
350 thispad.
fY.push_back(tmp);
352 double R = TMath::Sqrt(x*x+y*y);
353 double Phi = TMath::Pi()+TMath::ATan2(-y,-x);
354 thispad.
r.push_back( R );
355 thispad.
phi.push_back( Phi );
359 fin >>
tmp; thispad.
fVia.push_back( tmp );
360 fin >>
tmp; thispad.
fVia.push_back( tmp );
361 fin >>
tmp; thispad.
fVia.push_back( tmp );
362 fin >>
tmp; thispad.
fVia.push_back( tmp );
363 fin >>
tmp; thispad.
fVia.push_back( tmp );
364 fin >>
tmp; thispad.
fVia.push_back( tmp );
365 fin >>
tmp; thispad.
fVia.push_back( tmp );
366 fin >>
tmp; thispad.
fVia.push_back( tmp );
368 fin >>
tmp; thispad.
fWire.push_back( tmp );
369 fin >>
tmp; thispad.
fWire.push_back( tmp );
370 fin >>
tmp; thispad.
fWire.push_back( tmp );
371 fin >>
tmp; thispad.
fWire.push_back( tmp );
372 fin >>
tmp; thispad.
fWire.push_back( tmp );
373 fin >>
tmp; thispad.
fWire.push_back( tmp );
375 int hybrid = ConnectorToHybrid(Padplane_NameToConnector[thispad.
fName]);
376 int channel = PanPinToChannel(PanSam_SamPinToPanPin[Padplane_NameToSamPin[thispad.
fName]]);
380 if (hybrid >=
Nhybrid)
continue;
389 theZigzags.push_back( thisZigzag );
392 vector<string>
items;
393 split(items, thispad.
fName, [](
char c){
return c ==
'.';});
394 int ir = atoi(
items[1].c_str());
395 int iphi = atoi(
items[2].c_str());
397 thisZigzag->iPhi = iphi;
398 ZigzagMap [
index] = thisZigzag;
399 ZigzagMap2[ir][iphi] = thisZigzag;
400 ZWaveMap[hybrid*128+demapper[
channel]] = thisZigzag;
418 thispad.
fVia.clear();
419 thispad.
fWire.clear();
428 TFile *theFile =
new TFile(filename.c_str(),
"RECREATE");
430 for (
int i=0;
i<theHistograms.size();
i++)
432 theHistograms[
i]->Write();
441 for (
int i=0;
i<
Nr;
i++)
443 for (
int j=0;
j<10;
j++)
445 AccessBlobs[
i][
j] = 0;
450 for (
int i=0;
i<
Nr;
i++)
452 BlobCount[
i] = theBlobs[
i].size();
453 int MAX = (( theBlobs[
i].size() < 10) ? theBlobs[
i].
size() : 10);
456 AccessBlobs[
i][
j] = theBlobs[
i][
j];