---+ EUDAQ Patch for 2 SPEC DAQ ---++ 概要 2SPECでDAQした場合、EUDAQを適切に修正する必要があります。 Patch file: [[%ATTACHURL%/patch_eudaq.tar.gz][patch_eudaq.tar.gz]] ---++ STEP 1:Bug fix for YARRConverterPlugin EUDAQで収集したrawdataは通常どの順番でDAQのデータが保存されているかを記録するBore(Beginning Of Run Event)ヘッダ部が存在する。この情報はRunControlでConfigボタンを押した際に自動的に記録される。Boreの中に含まれるDAQ情報を詰めているのはSPECの場合YarrFe65p2Producer.ccで、以下のようにDAQ情報をBore Eventに対してSetTagしている。 <verbatim> bore.SetTag("DAQID", m_daqId); bore.SetTag("DUTNAME", m_dutName);</verbatim> 通常DAQIDで複数枚のFEやDAQを区別するが、現在配布されているYarrFe65p2Producer.ccにはバグがあり、今回取得したデータはすべて0になってしまっている。<br />そこで、STEP1ではDUTNAMEからDAQを区別できるように修正する。(斜体部を追加) <b style="background-color: transparent; color: #000000;">YARRConverterPlugin.cc </b>Line37〜 <verbatim>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></verbatim> ここでやっていること<br />・BoreからSetTagされたDUTNAMEを取得(configfile名が入っている:例KEKFE65-11_700e_noisemask_v1)<br />・記名ルールより、必ずKEKFE65-(SensorID)で始まるので、SensorIDまでを切り取る<br />・SensorID以降の文字数を取得して削除<br />・irrad(16まで)はdutid=30を、non-irrad(17から)はdutid=31を割り振る<br />・これらを順次vectorにつめる(理由は後述) ---++ STEP2:DataConverterPluginの修正 ---++++ Converterが回る手順 1、Rawdataがある<br />2、RawdataのBoreを読み込む(Initialize)<br />   →ここでBoreにRawdata内の各Eventに詰まっている順で各DAQの情報が記載されている*<br />3、PluginManagerがこの順番に従って、適切なConverterPluginを探してバイナリを読んでいく<br />   → 今回の場合、HSIO2、SPEC、SPECの順番(DAQボードの枚数分ある、Front Endの数分ではない)<br />   → つまり、2回同じPluginを呼び出すことになるので、converter側で2回目に呼び出されたことを知って、1回目、2回目それぞれで適切なDAQIDを割り振る必要がある(*からこの順番<br /> は先ほどのVectorにつめた順と同じになる)<br />4、Eoreに達したら終了 ---++++ 基本的なこととして、Eventの構造 ※Plane, Hitは正式名ではないかも。イメージです。 <img alt="Event.png" height="354" src="%ATTACHURL%/Event.png" title="Event.png" width="908" /> ---++++ 具体的な修正箇所 *DataConverterPlugin.hh* 各コンバータはこのクラスを継承しているので、PluginManagerで2個目のDAQが呼び出された情報をこのクラスに持たせることで YARRConverterPlugin から、この情報を見ることができる。<br /><br /> 2枚目情報のSetメソッド追加 <verbatim>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></verbatim> 2枚目情報のメンバ変数を加える <verbatim> 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 pluginM</verbatim> PluginManager に2枚目検知機能の追加(正確には2同じ名前でConverterを呼び出したかどうかを区別し、DataConverterPluginに知らせる機能) *PluginManager.cc* <verbatim>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; }</verbatim> *PluginManager.hh* <verbatim> 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> };</verbatim> 最後、YARRConverterPluginでSetPlaneする際に必要なDAQIDの修正 <verbatim> <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; </verbatim> -- %USERSIG{JunkiSuzuki - 2017-10-18}% ---++ Comments <br />%COMMENT%
Attachments
Attachments
Topic attachments
I
Attachment
History
Action
Size
Date
Who
Comment
png
Event.png
r1
manage
240.5 K
2017-10-19 - 08:20
JunkiSuzuki
gz
patch_eudaq.tar.gz
r1
manage
6.0 K
2017-10-19 - 08:12
JunkiSuzuki
This topic: Main
>
PlanerPixelTestBeam
>
2SPEC
Topic revision: r2 - 2017-10-19 - JunkiSuzuki
Copyright © 2008-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback