//------------------------------------------------------------------------------ // Application task example -- // (C) Piero Giubilato 2008-2010, Berkeley Lab -- //------------------------------------------------------------------------------ //______________________________________________________________________________ // {Trace} // [File name] "task_TEAM_Detector.cpp" // [Author] "Piero Giubilato" // [Version] "0.1" // [Modified by] "Piero Giubilato" // [Last revision] "13 Jul 2009" // [Language] "C++" // [Compiler] "Visual C++ 8.x 9.x" // [Member of] "Cool SEAL" // [Project] "SEAL" // [Description] "TEAM imaging task" // [Key documentation] // "Visual C++ Reference Help" // {Trace} //______________________________________________________________________________ // Standard components //#include // Root Components //#include "TSystem.h" // Application components #include "global.h" #include "cool.h" #include "task_TEAM_Detector.h" //______________________________________________________________________________ task_TEAM_Detector::task_TEAM_Detector() { // Standard constructor dbg_Print("task_TEAM_Detector::task_TEAM_Detector:()", DBG_LVL_ZERO); // Call the init Init(); } //______________________________________________________________________________ task_TEAM_Detector::~task_TEAM_Detector() { // Standard destructor dbg_Print("task_TEAM_Detector::~task_TEAM_Detector:()", DBG_LVL_ZERO); // Delte the geometry frame delete gf_TEAM; } //______________________________________________________________________________ void task_TEAM_Detector::Init() { // Debug dbg_Print("task_TEAM_Detector::Init:()", DBG_LVL_MAKE); // Pivot UInt_t dta_col_Count = 1024; // TEAM total col count UInt_t dta_row_Count = 1024; // TEAM total row count UInt_t chn_col_Count = dta_col_Count / 4; // Channel col count UInt_t chn_row_Count = dta_row_Count; // Channel row count // Initialize teh detector gf_TEAM = new geom_Frame(); gf_TEAM->HrdID(128); // Hardware coded TEAM driver ID // Set the chips. As we have data coming from 4 channel in parallel // (2 for each digitizer), we read the detector as a composition of // 4 identical chip. gf_TEAM->chip(0)->col_Count(chn_col_Count); // Each virtual chip is 1/4 of the real detector gf_TEAM->chip(0)->row_Count(chn_row_Count); for (UInt_t i = 1; i < 4; i++) { gf_TEAM->chip_Add(); gf_TEAM->chip(i)->col_Count(chn_col_Count); // Each virtual chip is 1/4 of the real detector gf_TEAM->chip(i)->row_Count(chn_row_Count); } // All the data from the 4 chip are arranged into one single layer, which // represent the original chip geometry. gf_TEAM->layer(0)->Name("TEAM chip"); gf_TEAM->layer(0)->dp_col_Count(dta_col_Count); gf_TEAM->layer(0)->dp_row_Count(dta_row_Count); // 4 data channel connects the 4 virtual chip to the single data layer gf_TEAM->channel(0)->chip_Idx(0); gf_TEAM->channel(0)->layer_Idx(0); for (UInt_t i = 1; i < 4; i++) gf_TEAM->channel_Add(i, 0); // The data sequence from the digitizer is: // Chn: 0 1 2 3 0 1 2 3 ... 0 1 2 3 0 1 2 3 ... 0 1 2 3 0 1 2 3 0 1 2 3 ... 0 1 2 3 // Sec: 0 0 8 8 0 0 8 8 ... 0 0 8 8 0 0 8 8 ... 0 0 8 8 1 1 9 9 1 1 9 9 ... 1 1 9 9 // Row: 0 0 0 0 0 0 0 0 ... 0 0 0 0 1 1 1 1 ... k k k k 0 0 0 0 0 0 0 0 k k k k // Col: 0 1 0 1 2 3 2 3 ... 626362630 1 0 1 ... 626362630 1 0 1 2 3 2 3 ... 62636263 // Trhough all the expected data point per channel UInt_t width = chn_col_Count * 4; UInt_t half_Width = chn_col_Count * 2; // Remaps the 4 virtual chip into the single data layer for (UInt_t y = 0; y < chn_row_Count; y++) { for (UInt_t x = 0; x < chn_col_Count; x++) { // Column left-right swapped version // Digitizer 0 gf_TEAM->chip(0)->dp_Value(x, y) = y * width + ((x*2)/64+1)*64 - (x*2)%64 - 1; gf_TEAM->chip(1)->dp_Value(x, y) = y * width + ((x*2+1)/64+1)*64 - (x*2+1)%64 -1; // Digitizer 1 gf_TEAM->chip(2)->dp_Value(x, y) = y * width + half_Width + ((x*2) /64+1)*64 - (x*2)%64 - 1; gf_TEAM->chip(3)->dp_Value(x, y) = y * width + half_Width + ((x*2+1)/64+1)*64 - (x*2+1)%64 -1; // Correct version //gf_TEAM->chip(0)->dp_Value(x, y)= y * width + x * 2; //gf_TEAM->chip(1)->dp_Value(x, y)= y * width + x * 2 + 1; //gf_TEAM->chip(2)->dp_Value(x, y)= y * width + x * 2 + half_Width; //gf_TEAM->chip(3)->dp_Value(x, y)= y * width + x * 2 + half_Width + 1; // Debug version, Left and right swapped to account for a similar swap // into the data_Mux moddule on the firmware //gf_TEAM->chip(0)->dp_Value(x, y)= y * width + x * 2 + 1; //gf_TEAM->chip(1)->dp_Value(x, y)= y * width + x * 2; //gf_TEAM->chip(2)->dp_Value(x, y)= y * width + x * 2 + half_Width + 1; //gf_TEAM->chip(3)->dp_Value(x, y)= y * width + x * 2 + half_Width; } } }