16 #define MYSQLPP_SSQLS_NO_STATICS
36 Int_t QwBeamLine::AddToElementList<VQwClock_ptr>(std::vector<VQwClock_ptr> &elementlist,
39 if (detector_id.fTypeID ==
kQwClock){
42 detector_id.fdetectorname,
43 detector_id.fmoduletype) );
44 elementlist.push_back(element);
46 detector_id.fIndex = elementlist.size()-1;
47 return detector_id.fIndex;
51 Int_t QwBeamLine::AddToElementList<VQwBCM_ptr>(std::vector<VQwBCM_ptr> &elementlist,
54 if (detector_id.fTypeID ==
kQwBCM){
57 detector_id.fdetectorname,
58 detector_id.fmoduletype) );
59 elementlist.push_back(element);
61 detector_id.fIndex = elementlist.size()-1;
62 return detector_id.fIndex;
66 Int_t QwBeamLine::AddToElementList<VQwBPM_ptr>(std::vector<VQwBPM_ptr> &elementlist,
72 detector_id.fdetectorname,
73 detector_id.fmoduletype) );
74 elementlist.push_back(element);
76 detector_id.fIndex = elementlist.size()-1;
77 return detector_id.fIndex;
81 template <
typename TT>
86 elementlist.push_back(element);
87 detector_id.
fIndex = elementlist.size()-1;
98 TString varname, varvalue;
100 TString combotype, comboname, dev_name;
103 Bool_t combolistdecoded;
106 std::vector<TString> fDeviceName;
107 std::vector<TString> fProperty;
108 std::vector<TString> fType;
109 std::vector<Double_t> fQWeight;
110 std::vector<Double_t> fXWeight;
111 std::vector<Double_t> fYWeight;
112 Double_t sumQweights = 0.0;
114 std::vector<QwBeamDetectorID> clock_needed_list;
118 mapstr.EnableGreediness();
119 mapstr.SetCommentChars(
"!");
120 mapstr.AddBreakpointKeyword(
"begin");
121 mapstr.AddBreakpointKeyword(
"end");
123 while (mapstr.ReadNextLine()
124 && mapstr.SkipSection(
"PUBLISH") ){
126 if (mapstr.PopValue(
"roc",value)){
130 if (mapstr.PopValue(
"bank",value)){
135 if (mapstr.HasVariablePair(
"=",varname,varvalue)){
138 if (varname==
"begin"){
142 combotype = varvalue;
143 combolistdecoded = kFALSE;
147 while(mapstr.ReadNextLine()&&!combolistdecoded){
148 if (mapstr.HasVariablePair(
"=",varname,varvalue)){
153 for(
size_t i=0;i<fDeviceName.size();i++)
154 sumQweights+=fQWeight[i];
155 combolistdecoded = kTRUE;
160 if (mapstr.PopValue(
"name",varvalue)){
161 comboname = varvalue;
164 dev_name = mapstr.GetTypedNextToken<TString>();
166 dettype = mapstr.GetTypedNextToken<TString>();
174 QwError <<
"QwBeamLine::LoadChannelMap: Unknown device: "
175 << dev_name <<
" used in "<< comboname
176 <<
". This combination will not be decoded!"
179 combolistdecoded = kTRUE;
183 fDeviceName.push_back(dev_name);
188 fQWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
191 if(combotype ==
"combinedbpm"){
192 fXWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
193 fYWeight.push_back(mapstr.GetTypedNextToken<Double_t>());
197 if(combotype ==
"energycalculator"){
198 fType.push_back(dettype);
199 fProperty.push_back(mapstr.GetTypedNextToken<TString>());
208 localComboID.
fdetectorname=comboname(0,comboname.Sizeof()-1);
209 localComboID.fIndex =
GetDetectorIndex(localComboID.fTypeID,localComboID.fdetectorname);
212 QwError <<
"QwBeamLine::LoadChannelMap: Unknown detector type: "
213 << combotype <<
", the detector "<<comboname<<
" will not be decoded "
219 if((localComboID.fIndex==-1) && deviceok) {
226 localComboID.fdetectorname,localComboID.fmoduletype));
229 for(
size_t i=0;i<fDeviceName.size();i++){
232 fQWeight[i],sumQweights );
243 localComboID.fdetectorname,localComboID.fmoduletype));
246 for(
size_t i=0;i<fDeviceName.size();i++){
249 fStripline.at(index).get(), fQWeight[i],fXWeight[i],
250 fYWeight[i],sumQweights );
266 for(
size_t i=0;i<fDeviceName.size();i++){
296 if (! lineok)
continue;
298 localBeamDetectorID.
fIndex=
302 if(localBeamDetectorID.
fIndex==-1){
312 local_element = &(
fCavity.at(index));
320 local_element =
fBCM.at(index).get();
324 local_element =
fClock.at(index).get();
328 local_element = &(
fQPD.at(index));
337 QwDebug <<
"Try to push device "
339 <<
" (address=" << std::hex << local_element
340 <<
") onto the clock_needed_list"
342 clock_needed_list.push_back(localBeamDetectorID);
353 mapstr.RewindToFileStart();
355 std::vector<TString> publishinfo;
357 if (varvalue ==
"PUBLISH") {
362 for (
int ii = 0; ii < 4; ii++) {
364 if (varvalue.Length()) {
365 publishinfo.push_back(varvalue);
368 if (publishinfo.size() == 4)
383 std::cout<<
"QwBeamLine::Done with Load map channel \n";
391 std::string clockname;
392 for (
size_t i=0; i<clock_needed_list.size();i++ ) {
393 local_element =
GetElement(clock_needed_list[i]);
395 if (clockname.empty()){
396 QwWarning <<
"QwBeamLine::LoadChannelMap "
398 <<
" needs a reference clock, but the reference clock name is empty"
403 QwMessage <<
"QwBeamLine::LoadChannelMap "
404 <<
"Setting " <<
fClock.at(index).get()->GetElementName()
405 <<
" as the reference clock for channel "
410 QwWarning <<
"QwBeamLine::LoadChannelMap "
427 Int_t eventcut_flag = 1;
432 while (mapstr.ReadNextLine()){
433 mapstr.TrimComment(
'!');
434 mapstr.TrimWhitespace();
435 if (mapstr.LineIsEmpty())
continue;
437 TString varname, varvalue;
438 if (mapstr.HasVariablePair(
"=",varname,varvalue)){
439 if (varname ==
"EVENTCUTS"){
444 TString device_type = mapstr.GetTypedNextToken<TString>();
445 device_type.ToLower();
446 TString device_name = mapstr.GetTypedNextToken<TString>();
447 device_name.ToLower();
450 if (det_index == -1) {
456 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
457 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
458 varvalue = mapstr.GetTypedNextToken<TString>();
459 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
462 fBCM[det_index].get()->SetSingleEventCuts(
GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut),LLX,ULX,stabilitycut);
465 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
466 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
467 varvalue = mapstr.GetTypedNextToken<TString>();
468 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
474 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
475 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
476 varvalue = mapstr.GetTypedNextToken<TString>();
477 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
483 TString channel_name = mapstr.GetTypedNextToken<TString>();
484 channel_name.ToLower();
485 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
486 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
487 varvalue = mapstr.GetTypedNextToken<TString>();
488 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
492 fStripline[det_index].get()->SetSingleEventCuts(channel_name,
GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut);
495 TString channel_name = mapstr.GetTypedNextToken<TString>();
496 channel_name.ToLower();
497 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
498 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
499 varvalue = mapstr.GetTypedNextToken<TString>();
500 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
503 fQPD[det_index].SetSingleEventCuts(channel_name,
GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut);
506 TString channel_name = mapstr.GetTypedNextToken<TString>();
507 channel_name.ToLower();
508 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
509 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
510 varvalue = mapstr.GetTypedNextToken<TString>();
511 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
517 TString channel_name = mapstr.GetTypedNextToken<TString>();
518 channel_name.ToLower();
519 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
520 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
521 varvalue = mapstr.GetTypedNextToken<TString>();
522 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
525 fCavity[det_index].SetSingleEventCuts(channel_name,
GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut);
528 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
529 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
530 varvalue = mapstr.GetTypedNextToken<TString>();
531 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
539 TString channel_name = mapstr.GetTypedNextToken<TString>();
540 channel_name.ToLower();
542 Double_t LLX = mapstr.GetTypedNextToken<Double_t>();
543 Double_t ULX = mapstr.GetTypedNextToken<Double_t>();
544 varvalue = mapstr.GetTypedNextToken<TString>();
545 Double_t stabilitycut = mapstr.GetTypedNextToken<Double_t>();
548 fBPMCombo[det_index].get()->SetSingleEventCuts(channel_name,
GetGlobalErrorFlag(varvalue,eventcut_flag,stabilitycut), LLX, ULX, stabilitycut);
559 fStripline[i].
get()->SetEventCutMode(eventcut_flag);
561 for (
size_t i=0;i<
fQPD.size();i++)
562 fQPD[i].SetEventCutMode(eventcut_flag);
567 for (
size_t i=0;i<
fCavity.size();i++)
568 fCavity[i].SetEventCutMode(eventcut_flag);
570 for (
size_t i=0;i<
fBCM.size();i++)
571 fBCM[i].
get()->SetEventCutMode(eventcut_flag);
573 for (
size_t i=0;i<
fClock.size();i++)
574 fClock[i].
get()->SetEventCutMode(eventcut_flag);
581 fBCMCombo[i].
get()->SetEventCutMode(eventcut_flag);
584 fBPMCombo[i].
get()->SetEventCutMode(eventcut_flag);
598 Bool_t ldebug=kFALSE;
599 TString varname, varvalue;
602 TString devname,devtype;
604 Double_t devOffsetX = 0,devOffsetY = 0, devOffsetZ = 0;
605 Double_t devSENfactor = 0, devAlphaX = 0, devAlphaY = 0;
606 TString rotation_stat;
609 if(ldebug)std::cout<<
"QwBeamLine::LoadGeometryParameters("<< mapfile<<
")\n";
613 while (mapstr.ReadNextLine()){
615 if(ldebug)std::cout<<
" line read so far ="<<lineread<<
"\n";
616 mapstr.TrimComment(
'!');
617 mapstr.TrimWhitespace();
619 if (mapstr.LineIsEmpty())
continue;
621 Bool_t notfound=kTRUE;
623 devtype = mapstr.GetTypedNextToken<TString>();
625 devtype.Remove(TString::kBoth,
' ');
626 devname = mapstr.GetTypedNextToken<TString>();
628 devname.Remove(TString::kBoth,
' ');
631 QwError <<
"Error! Unknown detector type '"<<devtype
640 QwWarning <<
"Unrecognized detector name '" << devname
641 <<
"' in Geometry file. This may not be a problem, "
642 <<
"if we're using a reduced channel map."
646 devOffsetX = mapstr.GetTypedNextToken<Double_t>();
647 devOffsetY = mapstr.GetTypedNextToken<Double_t>();
648 devOffsetZ = mapstr.GetTypedNextToken<Double_t>();
649 devSENfactor = mapstr.GetTypedNextToken<Double_t>();
650 devAlphaX = mapstr.GetTypedNextToken<Double_t>();
651 devAlphaY = mapstr.GetTypedNextToken<Double_t>();
662 std::cout<<
"####################\n";
663 std::cout<<
"! device type, device_name, Xoffset, Yoffset, Zoffset, BSEN scaling factor, AlpaX, AlpaY\n"<<std::endl;
669 <<devSENfactor <<
" / "
680 QwWarning <<
"QwBeamLine::LoadGeometryDefinition: Unknown bpm in qweak_beamline_geometry.map: "
687 TString localname =
fStripline.at(index).get()->GetElementName();
689 if(ldebug) std::cout<<
"element name =="<<localname
690 <<
"== to be compared to =="<<devname<<
"== \n";
692 if(localname==devname){
693 if(ldebug) std::cout<<
" I found the bpm !\n";
704 QwError <<
"QwBeamLine::LoadGeometryDefinition: Unknown combined bpm in qweak_beamline_geometry.map: "
705 <<devname<<
" Check the combined bpm names!\n "
711 TString localname =
fBPMCombo.at(index).get()->GetElementName();
714 std::cout<<
"element name =="<<localname<<
"== to be compared to =="<<devname<<
"== \n";
716 if(localname==devname){
717 if(ldebug) std::cout<<
" I found the combinedbpm !\n";
718 fBPMCombo.at(index).get()->GetSurveyOffsets(devOffsetX,devOffsetY,devOffsetZ);
725 QwError <<
"QwBeamLine::LoadGeometryDefinition: Unknown bpm : "
726 <<devname<<
" will not be asigned with geometry parameters. \n"
731 TString localname =
fCavity.at(index).GetElementName();
733 if(ldebug) std::cout<<
"element name =="<<localname
734 <<
"== to be compared to =="<<devname<<
"== \n";
736 if(localname==devname){
737 if(ldebug) std::cout<<
" I found the cavity bpm !\n";
738 fCavity.at(index).GetSurveyOffsets(devOffsetX,devOffsetY,devOffsetZ);
745 QwError <<
"QwBeamLine::LoadGeometryDefinition: Unknown QPD : "
746 <<devname<<
" will not be asigned with calibration factors. \n"
751 TString localname =
fQPD.at(index).GetElementName();
753 if(ldebug) std::cout<<
"element name =="<<localname
754 <<
"== to be compared to =="<<devname<<
"== \n";
756 if(localname==devname){
757 if(ldebug) std::cout<<
" I found the QPD !\n";
758 fQPD.at(index).GetCalibrationFactors(devAlphaX, devAlphaY);
762 else QwError<<
" QwBeamLine::LoadGeometryDefinition: Unknown device type :"<<devtype<<
". Are you sure we have this in the beamline? I am skipping this."<<
QwLog::endl;
767 if(ldebug) std::cout<<
" line read in the geometry file ="<<lineread<<
" \n";
779 Bool_t ldebug = kFALSE;
782 TString angle,xgain,ygain;
783 Double_t rotation_angle = 0;
787 token.Remove(TString::kBoth,
'\0');
789 if(token.Contains(
"unrotated")){
790 if(ldebug) std::cout<<
" unrotated "<<std::endl;
793 else if(token.Contains(
"rotation")){
797 if(token.Contains(
"=")){
798 angle = token.Remove(0,9);
799 rotation_angle = atof(angle);
800 if(ldebug) std::cout<<
"Rotation angle = "<<rotation_angle<<std::endl;
806 if(token.Contains(
"xgain")){
807 xgain = token.Remove(0,6);
808 if(ldebug) std::cout<<
" xgain ="<<xgain<<std::endl;
812 if(token.Contains(
"ygain")){
813 ygain = token.Remove(0,6);
814 if(ldebug) std::cout<<
" ygain ="<<ygain<<std::endl;
823 Bool_t ldebug=kFALSE;
827 if(ldebug)std::cout<<
"QwBeamLine::LoadInputParameters("<< pedestalfile<<
")\n";
832 while (mapstr.ReadNextLine())
835 if(ldebug)std::cout<<
" line read so far ="<<lineread<<
"\n";
836 mapstr.TrimComment(
'!');
837 mapstr.TrimWhitespace();
838 if (mapstr.LineIsEmpty())
continue;
841 TString varname = mapstr.GetTypedNextToken<TString>();
843 varname.Remove(TString::kBoth,
' ');
844 Double_t varped = mapstr.GetTypedNextToken<Double_t>();
845 Double_t varcal = mapstr.GetTypedNextToken<Double_t>();
846 mapstr.GetTypedNextToken<Double_t>();
850 Bool_t notfound=kTRUE;
858 TString localname =
fStripline[i].get()->GetSubElementName(j);
860 if(ldebug) std::cout<<
"Stripline element name =="<<localname
861 <<
"== to be compared to =="<<varname<<
"== \n";
862 if(localname==varname)
864 if(ldebug) std::cout<<
" I found it !\n";
865 fStripline[i].get()->SetSubElementPedestal(j,varped);
866 fStripline[i].get()->SetSubElementCalibrationFactor(j,varcal);
874 for(
size_t i=0;i<
fQPD.size();i++)
878 TString localname =
fQPD[i].GetSubElementName(j);
880 if(ldebug) std::cout<<
"QPD element name =="<<localname
881 <<
"== to be compared to =="<<varname<<
"== \n";
882 if(localname==varname)
884 if(ldebug) std::cout<<
" I found it !\n";
885 fQPD[i].SetSubElementPedestal(j,varped);
886 fQPD[i].SetSubElementCalibrationFactor(j,varcal);
898 TString localname =
fLinearArray[i].GetSubElementName(j);
900 if(ldebug) std::cout<<
"LinearArray element name =="<<localname
901 <<
"== to be compared to =="<<varname<<
"== \n";
902 if(localname==varname)
904 if(ldebug) std::cout<<
" I found it !\n";
906 fLinearArray[i].SetSubElementCalibrationFactor(j,varcal);
914 for(
size_t i=0;i<
fCavity.size();i++)
918 TString localname =
fCavity[i].GetSubElementName(j);
920 if(ldebug) std::cout<<
"Cavity element name =="<<localname
921 <<
"== to be compared to =="<<varname<<
"== \n";
922 if(localname==varname)
924 if(ldebug) std::cout<<
" I found it !\n";
925 fCavity[i].SetSubElementPedestal(j,varped);
926 fCavity[i].SetSubElementCalibrationFactor(j,varcal);
934 for(
size_t i=0;i<
fBCM.size();i++) {
935 if(
fBCM[i].
get()->GetElementName()==varname)
937 fBCM[i].get()->SetPedestal(varped);
938 fBCM[i].get()->SetCalibrationFactor(varcal);
944 for(
size_t i=0;i<
fClock.size();i++) {
945 if(
fClock[i].
get()->GetElementName()==varname)
947 fClock[i].get()->SetPedestal(varped);
948 fClock[i].get()->SetCalibrationFactor(varcal);
960 std::cout<<varname<<
" I found it ! "<<varcal<<
" ped. "<<varped<<
"\n";
977 if(ldebug) std::cout<<
" line read in the pedestal + cal file ="<<lineread<<
" \n";
989 for (
size_t i = 0; i <
fStripline.size(); i++)
990 fStripline[i].
get()->RandomizeEventData(helicity, time);
992 for (
size_t i = 0; i <
fCavity.size(); i++)
996 for (
size_t i = 0; i <
fBCM.size(); i++)
997 fBCM[i].
get()->RandomizeEventData(helicity, time);
1008 std::vector<UInt_t> elements;
1023 std::vector<UInt_t> subbankheader;
1024 std::vector<UInt_t> rocheader;
1025 if (elements.size() > 0) {
1028 subbankheader.clear();
1029 subbankheader.push_back(elements.size() + 1);
1030 subbankheader.push_back((
fCurrentBank_ID << 16) | (0x01 << 8) | (1 & 0xff));
1035 rocheader.push_back(subbankheader.size() + elements.size() + 1);
1036 rocheader.push_back((
fCurrentROC_ID << 16) | (0x10 << 8) | (1 & 0xff));
1040 buffer.insert(buffer.end(), rocheader.begin(), rocheader.end());
1041 buffer.insert(buffer.end(), subbankheader.begin(), subbankheader.end());
1042 buffer.insert(buffer.end(), elements.begin(), elements.end());
1050 Bool_t lkDEBUG=kFALSE;
1053 if (index>=0 && num_words>0){
1056 std::cout <<
"QwBeamLine::ProcessEvBuffer: "
1057 <<
"Begin processing ROC" << roc_id
1058 <<
" and subbank "<<bank_id
1059 <<
" number of words="<<num_words<<std::endl;
1060 if (buffer[0]==0xf0f0f0f0 && num_words%2==1){
1063 std::cout <<
"QwBeamLine::ProcessEvBuffer: "
1064 <<
"Skipped padding word 0xf0f0f0f0 at beginning of buffer."
1077 std::cout<<
"found stripline data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1078 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1090 std::cout<<
"found qpd data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1091 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1104 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1117 std::cout<<
"found stripline data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1118 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1130 std::cout<<
"found bcm data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1131 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1142 std::cout<<
"found clock data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1143 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1154 std::cout<<
"found halo monitor data for "<<
fBeamDetectorID[i].fdetectorname<<std::endl;
1155 std::cout<<
"word left to read in this buffer:"<<num_words-
fBeamDetectorID[i].fWordInSubbank<<std::endl;
1174 Bool_t status=kTRUE;
1176 for(
size_t i=0;i<
fBCM.size();i++){
1177 status &=
fBCM[i].get()->ApplySingleEventCuts();
1178 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->BCM[ "<<i
1179 <<
" , "<<
fBCM[i].get()->GetElementName()<<
" ] ******\n";
1182 for(
size_t i=0;i<
fClock.size();i++){
1183 status &=
fClock[i].get()->ApplySingleEventCuts();
1184 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->Clock[ "<<i
1185 <<
" , "<<
fClock[i].get()->GetElementName()<<
" ] ******\n";
1190 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->HaloMonitor[ "<<i
1191 <<
" , "<<
fHaloMonitor[i].GetElementName()<<
" ] ******\n";
1195 status &=
fStripline[i].get()->ApplySingleEventCuts();
1196 if(!status &&
bDEBUG) std::cout<<
"******** QwBeamLine::SingleEventCuts()->BPMStripline[ "<<i
1197 <<
" , "<<
fStripline[i].get()->GetElementName()<<
" ] *****\n";
1201 for(
size_t i=0;i<
fQPD.size();i++){
1202 status &=
fQPD[i].ApplySingleEventCuts();
1203 if(!status &&
bDEBUG) std::cout<<
"******** QwBeamLine::SingleEventCuts()->QPD[ "<<i
1204 <<
" , "<<
fQPD[i].GetElementName()<<
" ] *****\n";
1208 if(!status &&
bDEBUG) std::cout<<
"******** QwBeamLine::SingleEventCuts()->LinearArray[ "<<i
1209 <<
" , "<<
fLinearArray[i].GetElementName()<<
" ] *****\n";
1212 for(
size_t i=0;i<
fCavity.size();i++){
1213 status &=
fCavity[i].ApplySingleEventCuts();
1214 if(!status &&
bDEBUG) std::cout<<
"******** QwBeamLine::SingleEventCuts()->BPMCavity[ "<<i
1215 <<
" , "<<
fCavity[i].GetElementName()<<
" ] *****\n";
1219 status &=
fBCMCombo[i].get()->ApplySingleEventCuts();
1220 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->CombinedBCM[ "<<i
1221 <<
" , "<<
fBCMCombo[i].get()->GetElementName()<<
" ] ******\n";
1225 status &=
fBPMCombo[i].get()->ApplySingleEventCuts();
1226 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->CombinedBPM[ "<<i
1227 <<
" , "<<
fBPMCombo[i].get()->GetElementName()<<
" ] ******\n";
1232 if(!status &&
bDEBUG) std::cout<<
"******* QwBeamLine::SingleEventCuts()->EnergyCalculator[ "<<i
1233 <<
" , "<<
fECalculator[i].GetElementName()<<
" ] ******\n";
1254 for(
size_t i=0;i<
fClock.size();i++){
1255 fClock[i].get()->PrintErrorCounters();
1258 for(
size_t i=0;i<
fBCM.size();i++){
1259 fBCM[i].get()->PrintErrorCounters();
1270 for(
size_t i=0;i<
fQPD.size();i++){
1271 fQPD[i].PrintErrorCounters();
1278 for(
size_t i=0;i<
fCavity.size();i++){
1279 fCavity[i].PrintErrorCounters();
1283 fBCMCombo[i].get()->PrintErrorCounters();
1287 fBPMCombo[i].get()->PrintErrorCounters();
1299 for(
size_t i=0;i<
fClock.size();i++){
1300 fClock[i].get()->IncrementErrorCounters();
1302 for(
size_t i=0;i<
fBCM.size();i++){
1303 fBCM[i].get()->IncrementErrorCounters();
1309 fStripline[i].get()->IncrementErrorCounters();
1311 for(
size_t i=0;i<
fQPD.size();i++){
1312 fQPD[i].IncrementErrorCounters();
1317 for(
size_t i=0;i<
fCavity.size();i++){
1318 fCavity[i].IncrementErrorCounters();
1321 fBCMCombo[i].get()->IncrementErrorCounters();
1324 fBPMCombo[i].get()->IncrementErrorCounters();
1334 UInt_t ErrorFlagtmp;
1336 for(
size_t i=0;i<
fBCM.size();i++){
1337 ErrorFlagtmp =
fBCM[i].get()->GetEventcutErrorFlag();
1338 ErrorFlag |=ErrorFlagtmp;
1341 ErrorFlag |=
fStripline[i].get()->GetEventcutErrorFlag();
1343 for(
size_t i=0;i<
fQPD.size();i++){
1344 ErrorFlag |=
fQPD[i].GetEventcutErrorFlag();
1349 for(
size_t i=0;i<
fCavity.size();i++){
1350 ErrorFlag |=
fCavity[i].GetEventcutErrorFlag();
1353 ErrorFlag |=
fBCMCombo[i].get()->GetEventcutErrorFlag();
1356 ErrorFlag |=
fBPMCombo[i].get()->GetEventcutErrorFlag();
1369 UInt_t ErrorFlagtmp;
1371 for(
size_t i=0;i<
fBCM.size();i++){
1372 ErrorFlagtmp =
fBCM[i].get()->UpdateErrorFlag();
1373 ErrorFlag |=ErrorFlagtmp;
1376 ErrorFlag |=
fStripline[i].get()->UpdateErrorFlag();
1378 for(
size_t i=0;i<
fQPD.size();i++){
1379 ErrorFlag |=
fQPD[i].UpdateErrorFlag();
1384 for(
size_t i=0;i<
fCavity.size();i++){
1385 ErrorFlag |=
fCavity[i].UpdateErrorFlag();
1388 ErrorFlag |=
fBCMCombo[i].get()->UpdateErrorFlag();
1391 ErrorFlag |=
fBPMCombo[i].get()->UpdateErrorFlag();
1413 for(
size_t i=0;i<input->
fStripline.size();i++)
1415 for(
size_t i=0;i<input->
fQPD.size();i++)
1416 (this->
fQPD[i]).UpdateErrorFlag(&(input->
fQPD[i]));
1419 for(
size_t i=0;i<input->
fCavity.size();i++)
1421 for(
size_t i=0;i<input->
fBCM.size();i++){
1424 for(
size_t i=0;i<input->
fBCMCombo.size();i++)
1426 for(
size_t i=0;i<input->
fBPMCombo.size();i++)
1444 for(
size_t i=0;i<
fClock.size();i++)
1445 fClock[i].
get()->ProcessEvent();
1450 for(
size_t i=0;i<
fCavity.size();i++)
1453 for(
size_t i=0;i<
fBCM.size();i++)
1454 fBCM[i].
get()->ProcessEvent();
1456 for(
size_t i=0;i<
fQPD.size();i++)
1490 Bool_t status = kTRUE;
1499 device_type.ToLower();
1500 device_prop.ToLower();
1505 if (device_type ==
"combobpm")
1507 else if (device_type ==
"combobcm")
1509 else if (device_type ==
"comboenergy")
1511 else if (device_type ==
"scaler")
1520 tmp_channel =
GetChannel(type_id,index,device_prop);
1524 if (tmp_channel == NULL) {
1525 QwError <<
"QwBeamLine::PublishInternalValues(): " << publish_name <<
" not found" <<
QwLog::endl;
1528 QwDebug <<
"QwBeamLine::PublishInternalValues(): " << publish_name <<
" found" <<
QwLog::endl;
1540 Bool_t status = kFALSE;
1543 std::vector<TString> publishinfo(4,TString(
""));
1544 publishinfo.at(0) = device_name;
1549 TString name = device_name;
1550 TString device_prop =
"value";
1551 if (device_name.EndsWith(
"_EffectiveCharge")){
1552 name = device_name(0,device_name.Length()-16);
1554 }
else if (device_name.EndsWith(
"XSlope")){
1555 name = device_name(0,device_name.Length()-6);
1557 }
else if (device_name.EndsWith(
"YSlope")){
1558 name = device_name(0,device_name.Length()-6);
1560 }
else if (device_name.EndsWith(
"X")){
1561 name = device_name(0,device_name.Length()-1);
1563 }
else if (device_name.EndsWith(
"Y")){
1564 name = device_name(0,device_name.Length()-1);
1576 publishinfo.at(3) = device_prop;
1582 tmp_channel =
GetChannel(type_id,index,publishinfo.at(3));
1595 for(
size_t i=0;i<
fClock.size();i++)
1596 fClock[i].
get()->ClearEventData();
1599 for(
size_t i=0;i<
fCavity.size();i++)
1601 for(
size_t i=0;i<
fBCM.size();i++)
1603 for(
size_t i=0;i<
fQPD.size();i++)
1622 Bool_t ldebug=kFALSE;
1625 std::cout<<
"QwBeamLine::GetDetectorIndex\n";
1626 std::cout<<
"type_id=="<<type_id<<
" name="<<name<<
"\n";
1662 tmp_ptr = &(
fQPD.at(index));
1668 tmp_ptr =
fBCM.at(index).get();
1683 tmp_ptr = &(
fCavity.at(index));
1686 tmp_ptr =
fClock.at(index).get();
1689 TString loc=
"QwBeamLine::GetElement called by "
1693 throw std::invalid_argument(loc.Data());
1709 if (device_prop ==
"x")
1711 else if (device_prop ==
"y")
1713 else if (device_prop ==
"ef")
1716 if (device_prop ==
"x")
1718 else if (device_prop ==
"y")
1720 else if (device_prop ==
"ef")
1721 tmp_channel =
fBPMCombo.at(index)->GetEffectiveCharge();
1722 else if (device_prop ==
"xp")
1723 tmp_channel =
fBPMCombo.at(index)->GetAngleX();
1724 else if (device_prop ==
"yp")
1725 tmp_channel =
fBPMCombo.at(index)->GetAngleY();
1730 tmp_channel =
dynamic_cast<const VQwBCM*
>(
GetElement(TypeID,index))->GetCharge();
1736 tmp_channel =
fClock.at(index)->GetTime();
1738 TString loc=
"QwBeamLine::GetChannel called by "
1742 throw std::invalid_argument(loc.Data());
1751 for (std::vector<VQwBPM_ptr >::iterator stripline =
fStripline.begin(); stripline !=
fStripline.end(); ++stripline) {
1752 if ((*stripline).get()->GetElementName() == name) {
1753 return (*stripline).get();
1765 for (std::vector<QwBPMCavity>::iterator cavity =
fCavity.begin(); cavity !=
fCavity.end(); ++cavity) {
1766 if (cavity->GetElementName() == name) {
1779 if (!
fBCM.empty()) {
1780 for (std::vector<VQwBCM_ptr >::iterator bcm =
fBCM.begin(); bcm !=
fBCM.end(); ++bcm) {
1781 if ((*bcm).get()->GetElementName() == name) {
1782 return (*bcm).get();
1798 for (std::vector<VQwClock_ptr >::iterator clock =
fClock.begin(); clock !=
fClock.end(); ++clock) {
1799 if ((*clock).get()->GetElementName() == name) {
1800 return (*clock).get();
1816 for (std::vector<VQwBCM_ptr>::iterator cbcm =
fBCMCombo.begin(); cbcm !=
fBCMCombo.end(); ++cbcm) {
1817 if ((*cbcm).get()->GetElementName() == name) {
1818 return (*cbcm).get();
1833 for (std::vector<VQwBPM_ptr>::iterator cbpm =
fBPMCombo.begin(); cbpm !=
fBPMCombo.end(); ++cbpm) {
1834 if ((*cbpm).get()->GetElementName() == name) {
1835 return (*cbpm).get();
1849 if (ecal->GetElementName() == name) {
1869 if (halo->GetElementName() == name) {
1927 for(
size_t i=0;i<input->
fClock.size();i++)
1929 for(
size_t i=0;i<input->
fStripline.size();i++)
1931 for(
size_t i=0;i<input->
fQPD.size();i++)
1935 for(
size_t i=0;i<input->
fCavity.size();i++)
1937 for(
size_t i=0;i<input->
fBCM.size();i++)
1938 *(this->
fBCM[i].
get())=*(input->
fBCM[i].get());
1941 for(
size_t i=0;i<input->
fBCMCombo.size();i++)
1943 for(
size_t i=0;i<input->
fBPMCombo.size();i++)
1952 for(
size_t j=0;j<input->
fPublishList.at(i).size();j++){
1971 for(
size_t i=0;i<input->
fClock.size();i++)
1973 for(
size_t i=0;i<input->
fStripline.size();i++)
1975 for(
size_t i=0;i<input->
fCavity.size();i++)
1977 for(
size_t i=0;i<input->
fQPD.size();i++)
1981 for(
size_t i=0;i<input->
fBCM.size();i++)
1982 *(this->
fBCM[i].
get())+=*(input->
fBCM[i].get());
1985 for(
size_t i=0;i<input->
fBCMCombo.size();i++)
1987 for(
size_t i=0;i<input->
fBPMCombo.size();i++)
1996 for(
size_t j=0;j<input->
fPublishList.at(i).size();j++){
2014 for(
size_t i=0;i<input->
fClock.size();i++)
2016 for(
size_t i=0;i<input->
fStripline.size();i++)
2018 for(
size_t i=0;i<input->
fCavity.size();i++)
2020 for(
size_t i=0;i<input->
fQPD.size();i++)
2024 for(
size_t i=0;i<input->
fBCM.size();i++)
2025 *(this->
fBCM[i].
get())-=*(input->
fBCM[i].get());
2028 for(
size_t i=0;i<input->
fBCMCombo.size();i++)
2030 for(
size_t i=0;i<input->
fBPMCombo.size();i++)
2039 for(
size_t j=0;j<input->
fPublishList.at(i).size();j++){
2080 for(
size_t i=0;i<innumer->
fClock.size();i++)
2081 this->
fClock[i].
get()->Ratio(*(innumer->
fClock[i].get()),
2082 *(indenom->
fClock[i].get()));
2083 for(
size_t i=0;i<innumer->
fStripline.size();i++)
2086 for(
size_t i=0;i<innumer->
fCavity.size();i++)
2088 for(
size_t i=0;i<innumer->
fQPD.size();i++)
2092 for(
size_t i=0;i<innumer->
fBCM.size();i++)
2093 this->
fBCM[i].
get()->Ratio(*(innumer->
fBCM[i].get()),
2094 *(indenom->
fBCM[i].get()));
2097 for(
size_t i=0;i<innumer->
fBCMCombo.size();i++)
2100 for(
size_t i=0;i<innumer->
fBPMCombo.size();i++)
2117 for(
size_t i=0;i<
fClock.size();i++)
fClock[i].
get()->Scale(factor);
2122 for(
size_t i=0;i<
fBCM.size();i++)
fBCM[i].
get()->Scale(factor);
2133 for (
size_t i = 0; i <
fClock.size(); i++)
fClock[i].
get()->CalculateRunningAverage();
2138 for (
size_t i = 0; i <
fBCM.size(); i++)
fBCM[i].
get()->CalculateRunningAverage();
2140 for (
size_t i = 0; i <
fBCMCombo.size(); i++)
fBCMCombo[i].
get()->CalculateRunningAverage();
2141 for (
size_t i = 0; i <
fBPMCombo.size(); i++)
fBPMCombo[i].
get()->CalculateRunningAverage();
2150 for (
size_t i = 0; i <
fClock.size(); i++)
fClock[i].
get()->PrintValue();
2160 for (
size_t i = 0; i <
fBCM.size(); i++)
fBCM[i].
get()->PrintValue();
2178 for (
size_t i = 0; i <
fClock.size(); i++)
2179 fClock[i].
get()->AccumulateRunningSum(*(value->
fClock[i].get()));
2180 for (
size_t i = 0; i <
fStripline.size(); i++)
2182 for (
size_t i = 0; i <
fCavity.size(); i++)
2184 for (
size_t i = 0; i <
fBCM.size(); i++)
2185 fBCM[i].
get()->AccumulateRunningSum(*(value->
fBCM[i].get()));
2186 for (
size_t i = 0; i <
fBCMCombo.size(); i++)
2188 for (
size_t i = 0; i <
fBPMCombo.size(); i++)
2192 for (
size_t i = 0; i <
fQPD.size(); i++)
2210 for (
size_t i = 0; i <
fStripline.size(); i++)
2212 for (
size_t i = 0; i <
fCavity.size(); i++)
2214 for (
size_t i = 0; i <
fBCM.size(); i++)
2215 fBCM[i].
get()->DeaccumulateRunningSum(*(value->
fBCM[i].get()));
2216 for (
size_t i = 0; i <
fBCMCombo.size(); i++)
2218 for (
size_t i = 0; i <
fBPMCombo.size(); i++)
2220 for (
size_t i = 0; i <
fQPD.size(); i++)
2238 if(
typeid(*value)!=
typeid(*
this))
2252 else if(input->
fBCM.size()!=
fBCM.size())
2275 }
else if(input->
fQPD.size()!=
fQPD.size()){
2289 for(
size_t i=0;i<
fClock.size();i++)
2290 fClock[i].
get()->ConstructHistograms(folder,prefix);
2293 fStripline[i].
get()->ConstructHistograms(folder,prefix);
2295 for(
size_t i=0;i<
fQPD.size();i++)
2301 for(
size_t i=0;i<
fCavity.size();i++)
2304 for(
size_t i=0;i<
fBCM.size();i++)
2305 fBCM[i].
get()->ConstructHistograms(folder,prefix);
2311 fBCMCombo[i].
get()->ConstructHistograms(folder,prefix);
2314 fBPMCombo[i].
get()->ConstructHistograms(folder,prefix);
2324 for(
size_t i=0;i<
fClock.size();i++)
2325 fClock[i].
get()->FillHistograms();
2328 for(
size_t i=0;i<
fQPD.size();i++)
2332 for(
size_t i=0;i<
fCavity.size();i++)
2334 for(
size_t i=0;i<
fBCM.size();i++)
2335 fBCM[i].
get()->FillHistograms();
2353 for(
size_t i = 0; i <
fClock.size(); i++)
2354 fClock[i].
get()->ConstructBranchAndVector(tree, prefix, values);
2355 for(
size_t i = 0; i <
fStripline.size(); i++)
2356 fStripline[i].
get()->ConstructBranchAndVector(tree, prefix, values);
2357 for(
size_t i = 0; i <
fQPD.size(); i++)
2361 for(
size_t i = 0; i <
fCavity.size(); i++)
2363 for(
size_t i = 0; i <
fBCM.size(); i++)
2364 fBCM[i].
get()->ConstructBranchAndVector(tree, prefix, values);
2367 for(
size_t i = 0; i <
fBCMCombo.size();i++)
2368 fBCMCombo[i].
get()->ConstructBranchAndVector(tree, prefix, values);
2369 for(
size_t i = 0; i <
fBPMCombo.size();i++)
2370 fBPMCombo[i].
get()->ConstructBranchAndVector(tree, prefix, values);
2380 for(
size_t i = 0; i <
fClock.size(); i++)
2381 fClock[i].
get()->ConstructBranch(tree, prefix);
2382 for(
size_t i = 0; i <
fStripline.size(); i++)
2383 fStripline[i].
get()->ConstructBranch(tree, prefix);
2384 for(
size_t i = 0; i <
fQPD.size(); i++)
2388 for(
size_t i = 0; i <
fBCM.size(); i++)
2389 fBCM[i].
get()->ConstructBranch(tree, prefix);
2390 for(
size_t i = 0; i <
fCavity.size(); i++)
2391 fStripline[i].
get()->ConstructBranch(tree, prefix);
2394 for(
size_t i = 0; i <
fBCMCombo.size();i++)
2395 fBCMCombo[i].
get()->ConstructBranch(tree, prefix);
2396 for(
size_t i = 0; i <
fBPMCombo.size();i++)
2397 fBPMCombo[i].
get()->ConstructBranch(tree, prefix);
2408 TString tmp,varname,varvalue;
2414 tmp=
"QwBPMStripline";
2418 for(
size_t i = 0; i <
fStripline.size(); i++)
2419 fStripline[i].
get()->ConstructBranch(tree, prefix,*nextmodule);
2427 for(
size_t i = 0; i <
fQPD.size(); i++)
2431 tmp=
"QwLinearDiodeArray";
2443 for(
size_t i = 0; i <
fCavity.size(); i++)
2452 for(
size_t i = 0; i <
fBCM.size(); i++)
2453 fBCM[i].
get()->ConstructBranch(tree, prefix,*nextmodule);
2460 for(
size_t i = 0; i <
fClock.size(); i++)
2461 fClock[i].
get()->ConstructBranch(tree, prefix,*nextmodule);
2464 tmp=
"QwHaloMonitor";
2473 tmp=
"QwCombinedBCM";
2477 for(
size_t i = 0; i <
fBCMCombo.size();i++)
2478 fBCMCombo[i].
get()->ConstructBranch(tree, prefix,*nextmodule);
2482 tmp=
"QwCombinedBPM";
2486 for(
size_t i = 0; i <
fBPMCombo.size();i++)
2487 fBPMCombo[i].
get()->ConstructBranch(tree, prefix,*nextmodule);
2490 tmp=
"QwEnergyCalculator";
2504 for(
size_t i = 0; i <
fClock.size(); i++)
2505 fClock[i].
get()->FillTreeVector(values);
2506 for(
size_t i = 0; i <
fStripline.size(); i++)
2508 for(
size_t i = 0; i <
fQPD.size(); i++)
2512 for(
size_t i = 0; i <
fCavity.size(); i++)
2514 for(
size_t i = 0; i <
fBCM.size(); i++)
2515 fBCM[i].
get()->FillTreeVector(values);
2518 for(
size_t i = 0; i <
fBCMCombo.size(); i++)
2519 fBCMCombo[i].
get()->FillTreeVector(values);
2520 for(
size_t i = 0; i <
fBPMCombo.size(); i++)
2521 fBPMCombo[i].
get()->FillTreeVector(values);
2531 std::cout<<
"Name of the subsystem ="<<
fSystemName<<
"\n";
2532 std::cout<<
"there are "<<
fClock.size()<<
" clock \n";
2533 std::cout<<
"there are "<<
fStripline.size()<<
" striplines \n";
2534 std::cout<<
"there are "<<
fQPD.size()<<
" QPDs \n";
2535 std::cout<<
"there are "<<
fLinearArray.size()<<
" LinearArrays \n";
2536 std::cout<<
"there are "<<
fCavity.size()<<
" cavities \n";
2537 std::cout<<
"there are "<<
fBCM.size()<<
" bcm \n";
2538 std::cout<<
"there are "<<
fHaloMonitor.size()<<
" halomonitors \n";
2539 std::cout<<
"there are "<<
fBCMCombo.size()<<
" combined bcms \n";
2540 std::cout<<
"there are "<<
fBPMCombo.size()<<
" combined bpms \n";
2541 std::cout<<
"there are "<<
fECalculator.size()<<
" energy calculators \n";
2542 std::cout<<
" Printing Running AVG and other channel info for BCMs"<<std::endl;
2543 for(
size_t i=0;i<
fBCM.size();i++)
2544 fBCM[i].
get()->PrintInfo();
2556 std::cout<<
"============================="<<std::endl;
2557 std::cout<<
" Detector ID="<<i<<std::endl;
2571 for(
size_t i=0;i<input->
fClock.size();i++) {
2576 for(
size_t i=0;i<input->
fStripline.size();i++) {
2581 this->
fBCM.reserve(input->
fBCM.size());
2582 for(
size_t i=0;i<input->
fBCM.size();i++) {
2588 for(
size_t i=0;i<input->
fBCMCombo.size();i++) {
2595 for(
size_t i=0;i<input->
fBPMCombo.size();i++){
2605 Bool_t local_print_flag =
false;
2607 if(local_print_flag) {
2608 QwMessage <<
" --------------------------------------------------------------- " <<
QwLog::endl;
2610 QwMessage <<
" --------------------------------------------------------------- " <<
QwLog::endl;
2613 std::vector<QwDBInterface> interface;
2614 std::vector<QwParitySSQLS::beam> entrylist;
2618 TString measurement_type_bcm;
2619 TString measurement_type_bpm;
2620 TString measurement_type_halo;
2622 measurement_type_bcm =
2624 measurement_type_bpm =
2626 measurement_type_halo =
2636 for(i=0; i<
fBCM.size(); i++) {
2638 interface =
fBCM[i].get()->GetDBEntry();
2639 for (j=0; j<interface.size(); j++){
2640 interface.at(j).SetAnalysisID( analysis_id );
2641 interface.at(j).SetMonitorID( db );
2642 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2643 interface.at(j).PrintStatus( local_print_flag );
2644 interface.at(j).AddThisEntryToList( entrylist );
2653 interface =
fStripline[i].get()->GetDBEntry();
2654 for (j=0; j<interface.size()-5; j++){
2655 interface.at(j).SetAnalysisID( analysis_id ) ;
2656 interface.at(j).SetMonitorID( db );
2657 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2658 interface.at(j).PrintStatus( local_print_flag);
2659 interface.at(j).AddThisEntryToList( entrylist );
2662 for (j=interface.size()-5; j<interface.size(); j++){
2663 interface.at(j).SetAnalysisID( analysis_id ) ;
2664 interface.at(j).SetMonitorID( db );
2665 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2666 interface.at(j).PrintStatus( local_print_flag);
2667 interface.at(j).AddThisEntryToList( entrylist );
2677 interface =
fBPMCombo[i].get()->GetDBEntry();
2678 for (j=0; j<interface.size()-5; j++){
2679 interface.at(j).SetAnalysisID( analysis_id ) ;
2680 interface.at(j).SetMonitorID( db );
2681 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2682 interface.at(j).PrintStatus( local_print_flag);
2683 interface.at(j).AddThisEntryToList( entrylist );
2686 for (j=interface.size()-5; j<interface.size(); j++){
2687 interface.at(j).SetAnalysisID( analysis_id ) ;
2688 interface.at(j).SetMonitorID( db );
2689 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2690 interface.at(j).PrintStatus( local_print_flag);
2691 interface.at(j).AddThisEntryToList( entrylist );
2700 interface =
fBCMCombo[i].get()->GetDBEntry();
2701 for (j=0; j<interface.size(); j++){
2702 interface.at(j).SetAnalysisID( analysis_id );
2703 interface.at(j).SetMonitorID( db );
2704 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2705 interface.at(j).PrintStatus( local_print_flag );
2706 interface.at(j).AddThisEntryToList( entrylist );
2716 for (j=0; j<interface.size(); j++){
2717 interface.at(j).SetAnalysisID( analysis_id );
2718 interface.at(j).SetMonitorID( db );
2719 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2720 interface.at(j).PrintStatus( local_print_flag );
2721 interface.at(j).AddThisEntryToList( entrylist );
2728 for(i=0; i<
fQPD.size(); i++) {
2731 interface =
fQPD[i].GetDBEntry();
2732 for (j=0; j<interface.size()-5; j++){
2733 interface.at(j).SetAnalysisID( analysis_id ) ;
2734 interface.at(j).SetMonitorID( db );
2735 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2736 interface.at(j).PrintStatus( local_print_flag);
2737 interface.at(j).AddThisEntryToList( entrylist );
2740 for (j=interface.size()-5; j<interface.size(); j++){
2741 interface.at(j).SetAnalysisID( analysis_id ) ;
2742 interface.at(j).SetMonitorID( db );
2743 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2744 interface.at(j).PrintStatus( local_print_flag);
2745 interface.at(j).AddThisEntryToList( entrylist );
2755 for (j=0; j<interface.size()-5; j++){
2756 interface.at(j).SetAnalysisID( analysis_id ) ;
2757 interface.at(j).SetMonitorID( db );
2758 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2759 interface.at(j).PrintStatus( local_print_flag);
2760 interface.at(j).AddThisEntryToList( entrylist );
2762 for (j=interface.size()-5; j<interface.size(); j++){
2763 interface.at(j).SetAnalysisID( analysis_id ) ;
2764 interface.at(j).SetMonitorID( db );
2765 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2766 interface.at(j).PrintStatus( local_print_flag);
2767 interface.at(j).AddThisEntryToList( entrylist );
2773 for(i=0; i<
fCavity.size(); i++) {
2776 interface =
fCavity[i].GetDBEntry();
2777 for (j=0; j<interface.size()-5; j++){
2778 interface.at(j).SetAnalysisID( analysis_id ) ;
2779 interface.at(j).SetMonitorID( db );
2780 interface.at(j).SetMeasurementTypeID( measurement_type_bpm );
2781 interface.at(j).PrintStatus( local_print_flag);
2782 interface.at(j).AddThisEntryToList( entrylist );
2784 for (j=interface.size()-5; j<interface.size(); j++){
2785 interface.at(j).SetAnalysisID( analysis_id ) ;
2786 interface.at(j).SetMonitorID( db );
2787 interface.at(j).SetMeasurementTypeID( measurement_type_bcm );
2788 interface.at(j).PrintStatus( local_print_flag);
2789 interface.at(j).AddThisEntryToList( entrylist );
2799 for (j=0; j<interface.size(); j++){
2800 interface.at(j).SetAnalysisID( analysis_id );
2801 interface.at(j).SetMonitorID( db );
2802 interface.at(j).SetMeasurementTypeID( measurement_type_halo );
2803 interface.at(j).PrintStatus( local_print_flag );
2804 interface.at(j).AddThisEntryToList( entrylist );
2808 if(local_print_flag){
2816 if( entrylist.size() ) {
2817 mysqlpp::Query query= db->
Query();
2818 query.insert(entrylist.begin(), entrylist.end());
2822 QwMessage <<
"QwBeamLine::FillDB :: This is the case when the entrlylist contains nothing in "<< datatype.Data() <<
QwLog::endl;
2833 Bool_t local_print_flag =
false;
2835 if(local_print_flag) {
2836 QwMessage <<
" --------------------------------------------------------------- " <<
QwLog::endl;
2838 QwMessage <<
" --------------------------------------------------------------- " <<
QwLog::endl;
2841 std::vector<QwErrDBInterface> interface;
2842 std::vector<QwParitySSQLS::beam_errors> entrylist;
2850 for(i=0; i<
fBCM.size(); i++) {
2852 interface =
fBCM[i].get()->GetErrDBEntry();
2853 for (j=0; j<interface.size(); j++){
2854 interface.at(j).SetAnalysisID( analysis_id );
2855 interface.at(j).SetMonitorID( db );
2856 interface.at(j).PrintStatus( local_print_flag );
2857 interface.at(j).AddThisEntryToList( entrylist );
2859 if(local_print_flag) printf(
"\n");
2866 interface =
fStripline[i].get()->GetErrDBEntry();
2867 for (j=0; j<interface.size(); j++){
2868 interface.at(j).SetAnalysisID( analysis_id ) ;
2869 interface.at(j).SetMonitorID( db );
2870 interface.at(j).PrintStatus( local_print_flag );
2871 interface.at(j).AddThisEntryToList( entrylist );
2873 if(local_print_flag) printf(
"\n");
2879 interface =
fBPMCombo[i].get()->GetErrDBEntry();
2880 for (j=0; j<interface.size(); j++){
2881 interface.at(j).SetAnalysisID( analysis_id ) ;
2882 interface.at(j).SetMonitorID( db );
2883 interface.at(j).PrintStatus( local_print_flag );
2884 interface.at(j).AddThisEntryToList( entrylist );
2886 if(local_print_flag) printf(
"\n");
2893 interface =
fBCMCombo[i].get()->GetErrDBEntry();
2894 for (j=0; j<interface.size(); j++){
2895 interface.at(j).SetAnalysisID( analysis_id ) ;
2896 interface.at(j).SetMonitorID( db );
2897 interface.at(j).PrintStatus( local_print_flag );
2898 interface.at(j).AddThisEntryToList( entrylist );
2900 if(local_print_flag) printf(
"\n");
2908 for (j=0; j<interface.size(); j++){
2909 interface.at(j).SetAnalysisID( analysis_id ) ;
2910 interface.at(j).SetMonitorID( db );
2911 interface.at(j).PrintStatus( local_print_flag );
2912 interface.at(j).AddThisEntryToList( entrylist );
2914 if(local_print_flag) printf(
"\n");
2919 for(i=0; i<
fQPD.size(); i++) {
2921 interface =
fQPD[i].GetErrDBEntry();
2922 for (j=0; j<interface.size(); j++){
2923 interface.at(j).SetAnalysisID( analysis_id ) ;
2924 interface.at(j).SetMonitorID( db );
2925 interface.at(j).PrintStatus( local_print_flag );
2926 interface.at(j).AddThisEntryToList( entrylist );
2928 if(local_print_flag) printf(
"\n");
2936 for (j=0; j<interface.size(); j++){
2937 interface.at(j).SetAnalysisID( analysis_id ) ;
2938 interface.at(j).SetMonitorID( db );
2939 interface.at(j).PrintStatus( local_print_flag );
2940 interface.at(j).AddThisEntryToList( entrylist );
2942 if(local_print_flag) printf(
"\n");
2947 for(i=0; i<
fCavity.size(); i++) {
2949 interface =
fCavity[i].GetErrDBEntry();
2950 for (j=0; j<interface.size(); j++){
2951 interface.at(j).SetAnalysisID( analysis_id ) ;
2952 interface.at(j).SetMonitorID( db );
2953 interface.at(j).PrintStatus( local_print_flag );
2954 interface.at(j).AddThisEntryToList( entrylist );
2956 if(local_print_flag) printf(
"\n");
2964 for (j=0; j<interface.size(); j++){
2965 interface.at(j).SetAnalysisID( analysis_id ) ;
2966 interface.at(j).SetMonitorID( db );
2967 interface.at(j).PrintStatus( local_print_flag );
2968 interface.at(j).AddThisEntryToList( entrylist );
2970 if(local_print_flag) printf(
"\n");
2974 if(local_print_flag){
2982 if( entrylist.size() ) {
2983 mysqlpp::Query query= db->
Query();
2984 query.insert(entrylist.begin(), entrylist.end());
2988 QwMessage <<
"QwBeamLine::FillErrDB :: This is the case when the entrlylist contains nothing in "<< datatype.Data() <<
QwLog::endl;
2997 Bool_t local_print_flag =
true;
2999 if(local_print_flag) {
3000 printf(
"---------------------------------------------------------------\n");
3001 printf(
"QwBeamLine::WritePromptSummary() Type : %12s\n", type.Data());
3002 printf(
"---------------------------------------------------------------\n");
3005 TString element_name =
"";
3006 Double_t element_value = 0.0;
3007 Double_t element_value_err = 0.0;
3008 Double_t element_value_width = 0.0;
3014 for (
size_t i = 0; i <
fBCM.size(); i++)
3016 element_name =
fBCM[i].get()->GetElementName();
3017 element_value = 0.0;
3018 element_value_err = 0.0;
3019 element_value_width = 0.0;
3021 if (element_name.Contains(
"qwk_bcm1")) {
3022 local_ps_element = ps-> GetElementByName(
"bcm1");
3023 }
else if (element_name.Contains(
"qwk_bcm2")) {
3024 local_ps_element = ps-> GetElementByName(
"bcm2");
3025 }
else if (element_name.Contains(
"qwk_bcm5")) {
3026 local_ps_element = ps-> GetElementByName(
"bcm5");
3027 }
else if (element_name.Contains(
"qwk_bcm6")) {
3028 local_ps_element = ps-> GetElementByName(
"bcm6");
3029 }
else if (element_name.Contains(
"qwk_bcm7")) {
3030 local_ps_element = ps-> GetElementByName(
"bcm7");
3031 }
else if (element_name.Contains(
"qwk_bcm8")) {
3032 local_ps_element = ps-> GetElementByName(
"bcm8");
3034 local_ps_element = NULL;
3037 if(local_ps_element) {
3038 element_value =
fBCM[i].get()->GetValue();
3039 element_value_err =
fBCM[i].get()->GetValueError();
3040 element_value_width =
fBCM[i].get()->GetValueWidth();
3042 local_ps_element->
Set(type, element_value, element_value_err, element_value_width);
3045 if( local_print_flag && local_ps_element) {
3046 printf(
"Type %12s, Element %32s, value %12.4e error %8.4e width %12.4e\n",
3047 type.Data(), element_name.Data(), element_value, element_value_err, element_value_width);
Int_t GetSubbankIndex() const
void AssignGeometry(QwParameterFile *mapstr, VQwBPM *bpm)
#define QwMessage
Predefined log drain for regular messages.
std::vector< VQwBPM_ptr > fBPMCombo
boost::shared_ptr< VQwBCM > VQwBCM_ptr
std::map< TString, TString > fDetectorMaps
void PrintDetectorID() const
void Scale(Double_t factor)
virtual Bool_t NeedsExternalClock()
Int_t fQwBeamLineErrorCount
QwBPMCavity * GetBPMCavity(const TString name)
static VQwBCM * Create(TString subsystemname, TString type, TString name, TString clock="")
A fast way of creating a BCM of specified type.
UInt_t GetEventcutErrorFlag()
Return the error flag to the top level routines related to stability checks and ErrorFlag updates...
EQwBeamInstrumentType GetQwBeamInstrumentType(TString name)
void FillDoubleDifference(TString type, TString name1, TString name2)
Bool_t PublishInternalValues() const
Publish all variables of the subsystem.
void Difference(VQwSubsystem *value1, VQwSubsystem *value2)
Bool_t ApplySingleEventCuts()
Apply the single event cuts.
static const Bool_t bDEBUG
Bool_t Connect()
Open a connection to the database using the predefined parameters.
static UInt_t GetUInt(const TString &varvalue)
std::vector< QwBPMCavity > fCavity
QwEnergyCalculator * GetEnergyCalculator(const TString name)
static VQwClock * Create(TString subsystemname, TString type, TString name)
A fast way of creating a Clock of specified type.
boost::shared_ptr< VQwClock > VQwClock_ptr
UInt_t UpdateErrorFlag()
Uses the error flags of contained data elements to update Returns the error flag to the top level rou...
std::vector< QwEnergyCalculator > fECalculator
void PrintValue() const
Print values of all channels.
void TrimComment(const char commentchar)
Int_t LoadChannelMap(TString mapfile)
Mandatory map file definition.
void CalculateRunningAverage()
Calculate the average for all good events.
void Ratio(VQwSubsystem *numer, VQwSubsystem *denom)
VQwBCM * GetCombinedBCM(const TString name)
virtual const VQwHardwareChannel * GetEffectiveCharge() const =0
Bool_t ReportInitErrors() const
void GetSurveyOffsets(Double_t Xoffset, Double_t Yoffset, Double_t Zoffset)
TString GetQwBeamInstrumentTypeName(EQwBeamInstrumentType type)
Int_t LoadInputParameters(TString pedestalfile)
Mandatory parameter file definition.
virtual void LoadChannelParameters(QwParameterFile ¶mfile)
const VQwHardwareChannel * GetChannel(EQwBeamInstrumentType TypeID, Int_t index, TString device_prop) const
virtual void ConstructHistograms()
Construct the histograms for this subsystem.
static void PrintErrorCounterHead()
QwParameterFile * ReadNextSection(std::string &secname, const bool keep_header=false)
std::vector< VQwClock_ptr > fClock
virtual const VQwHardwareChannel * GetPosition(EBeamPositionMonitorAxis axis) const =0
Int_t ProcessConfigurationBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
VQwClock * GetClock(const TString name)
void PrintErrorCounters() const
Report the number of events failed due to HW and event cut failures.
Int_t AddToElementList(std::vector< TT > &elementlist, QwBeamDetectorID &detector_id)
Adds a new element to a vector of data elements, and returns the index of that element within the arr...
std::vector< VQwBCM_ptr > fBCM
std::vector< VQwBPM_ptr > fStripline
void FillDB(QwParityDB *db, TString datatype)
Fill the database.
VQwSubsystem & operator=(VQwSubsystem *value)
Assignment Note: Must be called at the beginning of all subsystems routine call to operator=(VQwSubsy...
Bool_t FileHasModuleHeader(const std::string &secname)
The pure virtual base class of all data elements.
Int_t GetDetectorIndex(EQwBeamInstrumentType TypeID, TString name) const
VQwBCM * GetBCM(const TString name)
#define QwDebug
Predefined log drain for debugging output.
void EncodeEventData(std::vector< UInt_t > &buffer)
A logfile class, based on an identical class in the Hermes analyzer.
std::vector< QwHaloMonitor > fHaloMonitor
void ConstructBranchAndVector(TTree *tree, TString &prefix, std::vector< Double_t > &values)
Construct the branch and tree vector.
EQwBeamInstrumentType fTypeID
void PrintInfo() const
Print some information about the subsystem.
TString fSystemName
Name of this subsystem.
void SetRotation(Double_t)
void AccumulateRunningSum(VQwSubsystem *value)
Update the running sums for devices.
mysqlpp::Query Query(const char *qstr=0)
void FillErrDB(QwParityDB *db, TString datatype)
QwHaloMonitor * GetScalerChannel(const TString name)
void FillTreeVector(std::vector< Double_t > &values) const
Fill the tree vector.
Int_t LoadEventCuts(TString filename)
Load the event cuts file.
Bool_t PublishByRequest(TString device_name)
Try to publish an internal variable matching the submitted name.
void WritePromptSummary(QwPromptSummary *ps, TString type)
void Set(TString type, const Double_t a, const Double_t a_err, const Double_t a_width)
std::vector< std::vector< TString > > fPublishList
List of parameters to be published (loaded at the channel map)
The pure virtual base class of all subsystems.
virtual std::string GetExternalClockName()
void IncrementErrorCounters()
Increment the error counters.
virtual void SetExternalClockPtr(const VQwHardwareChannel *clock)
A color changing class for the output stream.
Int_t fCurrentROC_ID
ROC ID that is currently being processed.
Int_t RegisterSubbank(const UInt_t bank_id)
Tell the object that it will decode data from this sub-bank in the ROC currently open for registratio...
virtual Int_t RegisterROCNumber(const UInt_t roc_id, const UInt_t bank_id=0)
Tell the object that it will decode data from this ROC and sub-bank.
std::vector< VQwBCM_ptr > fBCMCombo
Bool_t Compare(VQwSubsystem *source)
std::vector< QwBeamDetectorID > fBeamDetectorID
static std::ostream & endl(std::ostream &)
End of the line.
std::vector< QwLinearDiodeArray > fLinearArray
Int_t ProcessEvBuffer(const UInt_t roc_id, const UInt_t bank_id, UInt_t *buffer, UInt_t num_words)
TODO: The non-event-type-aware ProcessEvBuffer routine should be replaced with the event-type-aware v...
virtual const TString & GetElementName() const
Get the name of this element.
VQwDataElement * GetElement(QwBeamDetectorID det_id)
static VQwBPM * CreateCombo(TString subsystemname, TString type, TString name)
A fast way of creating a BPM stripline of specified type.
void RandomizeEventData(int helicity=0, double time=0.0)
T GetTypedNextToken()
Get next token into specific type.
void ConstructBranch(TTree *tree, TString &prefix)
Construct the branch and tree vector.
void TrimWhitespace(TString::EStripType head_tail=TString::kBoth)
VQwSubsystem & operator-=(VQwSubsystem *value)
static TString DetermineMeasurementTypeID(TString type, TString suffix="", Bool_t forcediffs=kFALSE)
void SetGains(TString pos, Double_t value)
void FillHistograms()
Fill the histograms for this subsystem.
static VQwBPM * CreateStripline(TString subsystemname, TString type, TString name)
A fast way of creating a BPM stripline of specified type.
Bool_t PublishInternalValue(const TString &name, const TString &desc, const VQwHardwareChannel *value) const
Publish a variable name to the parent subsystem array.
static void PrintErrorCounterTail()
void DeaccumulateRunningSum(VQwSubsystem *value)
remove one entry from the running sums for devices
#define QwWarning
Predefined log drain for warnings.
void ProcessOptions(QwOptions &options)
Process the command line options.
boost::shared_ptr< VQwBPM > VQwBPM_ptr
void CopyTemplatedDataElements(const VQwSubsystem *source)
VQwSubsystem & operator+=(VQwSubsystem *value)
void GetElectronicFactors(Double_t BSENfactor, Double_t AlphaX, Double_t AlphaY)
std::vector< QwQPD > fQPD
VQwBPM * GetBPMStripline(const TString name)
Int_t fCurrentBank_ID
Bank ID that is currently being processed.
static VQwBCM * CreateCombo(TString subsystemname, TString type, TString name)
A fast way of creating a combo BCM of specified type.
QwParameterFile * ReadUntilNextModule(const bool add_current_line=false)
VQwBPM * GetCombinedBPM(const TString name)
#define RegisterSubsystemFactory(A)
void Sum(VQwSubsystem *value1, VQwSubsystem *value2)
#define QwError
Predefined log drain for errors.
UInt_t GetGlobalErrorFlag(TString evtype, Int_t evMode, Double_t stabilitycut)
Int_t LoadGeometryDefinition(TString mapfile)
Optional geometry definition.
TString GetSubsystemName() const