Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
EUDAQ Patch for 2 SPEC DAQ概要2SPECでDAQした場合、EUDAQを適切に修正する必要があります。 | ||||||||
Added: | ||||||||
> > | Patch file: patch_eudaq.tar.gz | |||||||
STEP 1:Bug fix for YARRConverterPluginEUDAQで収集したrawdataは通常どの順番でDAQのデータが保存されているかを記録するBore(Beginning Of Run Event)ヘッダ部が存在する。この情報はRunControlでConfigボタンを押した際に自動的に記録される。Boreの中に含まれるDAQ情報を詰めているのはSPECの場合YarrFe65p2Producer.ccで、以下のようにDAQ情報をBore Eventに対してSetTagしている。 | ||||||||
Line: 38 to 38 | ||||||||
1、Rawdataがある 2、RawdataのBoreを読み込む(Initialize) →ここでBoreにRawdata内の各Eventに詰まっている順で各DAQの情報が記載されている* 3、PluginManagerがこの順番に従って、適切なConverterPluginを探してバイナリを読んでいく → 今回の場合、HSIO2、SPEC、SPECの順番(DAQボードの枚数分ある、Front Endの数分ではない) → つまり、2回同じPluginを呼び出すことになるので、converter側で2回目に呼び出されたことを知って、1回目、2回目それぞれで適切なDAQIDを割り振る必要がある(*からこの順番 は先ほどのVectorにつめた順と同じになる) 4、Eoreに達したら終了 | ||||||||
Changed: | ||||||||
< < | 基本的なこととして、Rawdataの構造 | |||||||
> > | 基本的なこととして、Eventの構造※Plane, Hitは正式名ではないかも。イメージです。![]() | |||||||
具体的な修正箇所 | ||||||||
Line: 131 to 130 | ||||||||
Comments | ||||||||
Added: | ||||||||
> > |
|
Line: 1 to 1 | ||||||||
---|---|---|---|---|---|---|---|---|
Added: | ||||||||
> > |
EUDAQ Patch for 2 SPEC DAQ概要2SPECでDAQした場合、EUDAQを適切に修正する必要があります。STEP 1:Bug fix for YARRConverterPluginEUDAQで収集したrawdataは通常どの順番でDAQのデータが保存されているかを記録するBore(Beginning Of Run Event)ヘッダ部が存在する。この情報はRunControlでConfigボタンを押した際に自動的に記録される。Boreの中に含まれるDAQ情報を詰めているのはSPECの場合YarrFe65p2Producer.ccで、以下のようにDAQ情報をBore Eventに対してSetTagしている。bore.SetTag("DAQID", m_daqId); bore.SetTag("DUTNAME", m_dutName);通常DAQIDで複数枚のFEやDAQを区別するが、現在配布されているYarrFe65p2Producer.ccにはバグがあり、今回取得したデータはすべて0になってしまっている。 そこで、STEP1ではDUTNAMEからDAQを区別できるように修正する。(斜体部を追加) YARRConverterPlugin.cc Line37〜 class YARRConverterPlugin : public DataConverterPlugin { private: <i><b> std::vector<int> v_dutID; </b></i> public: // This is called once at the beginning of each run. // You may extract information from the BORE and/or configuration // and store it in member variables to use during the decoding later. virtual void Initialize(const Event &bore, const Configuration &cnf) { <i><b> std::string str_id=bore.GetTag("DUTNAME");</b></i> <i><b> str_id.replace(0, 8, "");</b></i> <i><b> str_id.replace(2, str_id.size()-1, "");</b></i> <i><b> int sensorid=std::stoi(str_id);</b></i> <i><b> if(sensorid<17)v_dutID.push_back(30);</b></i> <i><b> if(sensorid>=17)v_dutID.push_back(31);</b></i>ここでやっていること ・BoreからSetTagされたDUTNAMEを取得(configfile名が入っている:例KEKFE65-11_700e_noisemask_v1) ・記名ルールより、必ずKEKFE65-(SensorID)で始まるので、SensorIDまでを切り取る ・SensorID以降の文字数を取得して削除 ・irrad(16まで)はdutid=30を、non-irrad(17から)はdutid=31を割り振る ・これらを順次vectorにつめる(理由は後述) STEP2:DataConverterPluginの修正Converterが回る手順1、Rawdataがある2、RawdataのBoreを読み込む(Initialize) →ここでBoreにRawdata内の各Eventに詰まっている順で各DAQの情報が記載されている* 3、PluginManagerがこの順番に従って、適切なConverterPluginを探してバイナリを読んでいく → 今回の場合、HSIO2、SPEC、SPECの順番(DAQボードの枚数分ある、Front Endの数分ではない) → つまり、2回同じPluginを呼び出すことになるので、converter側で2回目に呼び出されたことを知って、1回目、2回目それぞれで適切なDAQIDを割り振る必要がある(*からこの順番 は先ほどのVectorにつめた順と同じになる) 4、Eoreに達したら終了 基本的なこととして、Rawdataの構造具体的な修正箇所DataConverterPlugin.hh 各コンバータはこのクラスを継承しているので、PluginManagerで2個目のDAQが呼び出された情報をこのクラスに持たせることで YARRConverterPlugin から、この情報を見ることができる。2枚目情報のSetメソッド追加 class DataConverterPlugin { public: typedef std::pair<unsigned, std::string> t_eventid; virtual void Initialize(eudaq::Event const &, eudaq::Configuration const &) {} virtual unsigned GetTriggerID(eudaq::Event const &) const; virtual int IsSyncWithTLU(eudaq::Event const &ev, eudaq::TLUEvent const &tlu) const { // dummy comparator. it is just checking if the event numbers are the // same. // auto triggerID=ev.GetEventNumber(); unsigned triggerID = ev.GetTag<unsigned>("tlu_trigger_id", 0); auto tlu_triggerID = tlu.GetEventNumber(); return compareTLU2DUT(tlu_triggerID, triggerID); } <i><b> void SetSameDAQ(int stat){</b></i> <i><b> if(stat==1)isSame=true;</b></i> <i><b> if(stat==0)isSame=false;</b></i> <i><b> }</b></i>2枚目情報のメンバ変数を加える protected: /** The string storing the event type this plugin can convert to lcio. * This string has to be set in the constructor of the actual * implementations * of the plugin. */ t_eventid m_eventtype; <i><b> bool isSame;</b></i> /** The protected constructor which automatically registeres the plugin * at the pluginMPluginManager に2枚目検知機能の追加(正確には2同じ名前でConverterを呼び出したかどうかを区別し、DataConverterPluginに知らせる機能) PluginManager.cc DataConverterPlugin & PluginManager::GetPlugin(PluginManager::t_eventid eventtype) { std::map<t_eventid, DataConverterPlugin *>::iterator pluginiter = m_pluginmap.find(eventtype); <i><b> if(beforedaq==eventtype.second){</b></i> <i><b> pluginiter->second->SetSameDAQ(1);</b></i> <i><b> }else{</b></i> <i><b> pluginiter->second->SetSameDAQ(0);</b></i> <i><b> }</b></i> if (pluginiter == m_pluginmap.end()) { std::cout<<"PluginManager::GetPlugin(): Unkown event type " + Event::id2str(eventtype.first) + ":" + eventtype.second<<std::endl;; } <i><b>beforedaq=eventtype.second;</b></i> return *pluginiter->second; }PluginManager.hh private: /** The map that correlates the event type with its converter plugin. */ std::map<t_eventid, DataConverterPlugin *> m_pluginmap; PluginManager() {} PluginManager(PluginManager const &) {} class _dummy; friend class _dummy; // Silence superfluous warnings in some gcc versions <i><b> std::string beforedaq;</b></i> <i><b> </b></i> };最後、YARRConverterPluginでSetPlaneする際に必要なDAQIDの修正 <i><b>if(!isSame)zsDataEncoder["sensorID"] = v_dutID[0];</b></i> <i><b> if(isSame)zsDataEncoder["sensorID"] = v_dutID[1];</b></i> zsDataEncoder["sparsePixelType"] = eutelescope::kEUTelGenericSparsePixel;-- ![]() Comments |