#include <AlgMergeEvent.h>
Inheritance diagram for AlgMergeEvent:

Public Member Functions | |
| AlgMergeEvent () | |
| virtual | ~AlgMergeEvent () |
| virtual void | RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx) |
| virtual void | Trace (const char *c) const |
|
|
Definition at line 39 of file AlgMergeEvent.cxx. 00040 {
00041 }
|
|
|
Definition at line 44 of file AlgMergeEvent.cxx. 00045 {
00046 }
|
|
||||||||||||||||
|
Implements AlgBase. Definition at line 49 of file AlgMergeEvent.cxx. References CandHandle::AddDaughterLink(), RawDigitDataBlock::At(), PmtMap::BuildMap(), PmtMap::channel, digit(), Registry::Get(), CandDigitListHandle::GetAbsTime(), RawDigit::GetADC(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), AlgFactory::GetInstance(), CandDigitListHandle::GetIsSparse(), CandContext::GetMom(), PlexSEIdAltL::GetPlane(), CandDigitHandle::GetPlexSEIdAltL(), RawRecord::GetRawBlockIter(), CandDigitHandle::GetRawDigitIndex(), RawDigit::GetTDC(), RecMinos::GetVldContext(), CandDigit::MakeCandidate(), PmtMap::Merge(), MSG, CandDigitListHandle::SetAbsTime(), and CandDigitListHandle::SetIsSparse(). 00050 {
00051
00052 //set up the sub-algs and this alg's config
00053 AlgFactory &algfactory = AlgFactory::GetInstance();
00054 const char *tmpcs = 0;
00055 const char *conv_algorithm = 0;
00056 const char *conv_algconfig = 0;
00057
00058 if (ac.Get("RawDigitInfoConvAlgorithm", tmpcs)) conv_algorithm = tmpcs;
00059 if (ac.Get("RawDigitInfoConvConfig", tmpcs)) conv_algconfig = tmpcs;
00060
00061 AlgHandle conv_alg = algfactory.GetAlgHandle(conv_algorithm, conv_algconfig);
00062 CandContext cxx(this, cx.GetMom());
00063 cxx.SetCandRecord(cx.GetCandRecord());
00064 const VldContext *vldc = cx.GetCandRecord()->GetVldContext();
00065
00066 MSG("EvtMrg",Msg::kDebug) << " AlgMergeEvent::RunAlg() " <<endl;
00067 MSG("EvtMrg",Msg::kDebug) << " SubAlg : " <<conv_algorithm<<endl;
00068 MSG("EvtMrg",Msg::kDebug) << " SubAlg Config : " <<conv_algconfig<<endl;
00069
00070 //Get pointers to all the bits we need
00071 const TObjArray *input = (TObjArray *)(cx.GetDataIn());
00072 assert(input);
00073 TClonesArray* input_mc = dynamic_cast<TClonesArray*>(input->At(0));
00074 CandDigitListHandle* input_digits = dynamic_cast<CandDigitListHandle*>(input->At(1));
00075 RawRecord* rawrecord = dynamic_cast<RawRecord*>(input->At(2));
00076 assert(rawrecord);
00077 RawDigitDataBlock *input_datablock = NULL;
00078 if(rawrecord){
00079 TIter rdbit = rawrecord->GetRawBlockIter();
00080 TObject *tob;
00081 while ((tob = rdbit())) {
00082 if (tob->InheritsFrom("RawDigitDataBlock")) {
00083 input_datablock = (RawDigitDataBlock *) tob;
00084 }
00085 }
00086 }
00087
00088 //Build an array of raw data digits that are going to be used on the event
00089 vector<const RawDigit*> selected_data_digits;
00090 vector<int> selected_data_digits_index;
00091 TIter digititer(input_digits->GetDaughterIterator());
00092 while (CandDigitHandle *digit = dynamic_cast<CandDigitHandle*>(digititer())) {
00093 const RawDigit* raw_digit = input_datablock->At(digit->GetRawDigitIndex());
00094 if(raw_digit!=NULL){
00095 MSG("EvtMrg",Msg::kVerbose) << "Index TDC ADC Plane: "
00096 << digit->GetRawDigitIndex() << " "
00097 << raw_digit->GetTDC() << " "
00098 << raw_digit->GetADC() << " "
00099 << digit->GetPlexSEIdAltL().GetPlane() << endl;
00100 selected_data_digits.push_back(raw_digit);
00101 selected_data_digits_index.push_back(digit->GetRawDigitIndex());
00102 }
00103 else {
00104 MSG("EvtMrg",Msg::kError) << " Failed to find raw digit for reco'd digit " <<endl;
00105 return;
00106 }
00107 }
00108
00109 //Build the PMT maps
00110 PmtMap *data_map = new PmtMap();
00111 data_map->BuildMap(selected_data_digits, selected_data_digits_index,vldc);
00112 PmtMap* mc_map = new PmtMap();
00113 mc_map->BuildMap(input_mc);
00114
00115 //Make the merged Detector map
00116 PmtMap* merged_map = new PmtMap();
00117 merged_map->Merge(*data_map, *mc_map);
00118
00119 /*
00120 //Do some debug print out TO BE REMOVED
00121 MSG("EvtMrg", Msg::kDebug) << "***********************************"<<endl;
00122 MSG("EvtMrg", Msg::kDebug) << "DATA: " << endl;
00123 data_map->PrintSummary();
00124 MSG("EvtMrg", Msg::kDebug) << "***********************************"<<endl;
00125 MSG("EvtMrg", Msg::kDebug) << "MC: " << endl;
00126 mc_map->PrintSummary();
00127 MSG("EvtMrg", Msg::kDebug) << "***********************************"<<endl;
00128 MSG("EvtMrg", Msg::kDebug) << "MERGE: " << endl;
00129 merged_map->PrintSummary();
00130 MSG("EvtMrg", Msg::kDebug) << "***********************************"<<endl;
00131 */
00132
00133 //delete the work space
00134 delete data_map; data_map = NULL;
00135 delete mc_map; mc_map = NULL;
00136
00137 //Iterate over the whole chip set and make the new candidates
00138 const unsigned int nchannel = merged_map->channel.size();
00139 for(unsigned int ichannel=0; ichannel<nchannel; ichannel++){
00140 if(merged_map->channel[ichannel].valid!=0){
00141 cxx.SetDataIn(&(merged_map->channel[ichannel]));
00142 CandDigitHandle cdh = CandDigit::MakeCandidate(conv_alg, cxx);
00143 ch.AddDaughterLink(cdh, kFALSE);
00144 }
00145 }
00146
00147 //delete the detector map
00148 delete merged_map; merged_map = NULL;
00149
00150 //global list stuff
00151 CandDigitListHandle &cdlh = dynamic_cast<CandDigitListHandle &>(ch);
00152 cdlh.SetAbsTime(input_digits->GetAbsTime());
00153 cdlh.SetIsSparse(input_digits->GetIsSparse());
00154 }
|
|
|
Reimplemented from AlgBase. Definition at line 156 of file AlgMergeEvent.cxx. 00157 {
00158 }
|
1.3.9.1