Sample Application |
On this page, a sample of a simple ROME generated framework is discussed. The framework should contain the following objects:
3 Folders
PMTData | Folder containing photomultiplier data. |
Calib | Folder containing calibration data form the database. |
PMTInfo | Folder containing photomultiplier info form the database. |
2 Tasks
ReadMidas | This task reads the data from the midas bank, rearanges the data and stores it in the PMTData folder. |
ADCCalib | This task makes a calibration and fills a histogram. |
1 Midas Bank
ADC0 | Midas bank containing raw data. |
The ROME xml framework definition file for the objects in the list above looks like this :
<ROMEFrameworkDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:/rome/rome.xsd"> <Experiment> <ExperimentShortCut>XYZ</ExperimentShortCut> </Experiment> <Folders> <Folder> <FolderName>PMTData</FolderName> <ArraySize>228</ArraySize> <Field> <FieldName>ADC</FieldName> <FieldType>Float_t</FieldType> <FieldComment>ADC Data</FieldComment> </Field> </Folder> <Folder> <FolderName>Calib</FolderName> <ArraySize>228</ArraySize> <DataBaseAccess>true</DataBaseAccess> <Field> <FieldName>ADCPedestal</FieldName> <FieldType>Float_t</FieldType> <FieldComment>ADC Pedestal</FieldComment> <DataBasePath>"/RunCatalog(id=#)/LPConf/LPCalibPedestal[0,227]/mean0"</DataBasePath> </Field> </Folder> </Folders> <Tasks> <Task> <TaskName>ReadMidas</TaskName> </Task> <Task> <TaskName>ADCCalib</TaskName> <Histogram> <HistName>ADCHisto</HistName> <HistType>TH1F</HistType> <HistArraySize>257</HistArraySize> <HistXNbins>500</HistXNbins> <HistXmin>0</HistXmin> <HistXmax>500</HistXmax> </Histogram> </Task> </Tasks> <MidasBanks> <Bank> <BankName>ADC0</BankName> <BankType>unsigned short</BankType> </Bank> </MidasBanks> </ROMEFrameworkDefinition> |
After running the ROMEBuilder with this xml file, the generated tasks have to be filled with code. Code is added to the event method of the XYZTReadMidas task. To access methods of ROME objects, one should always use the 'gAnalyzer' handle. The first line gets the ADCID from the data base. This value is needed to set the ADC value always at the same position in the folder array, even if e.g. the cable configuration has changed. The second line reads the adc value from the bank in the midas file. In the third line the adc value is stored in the folder.
void XYZTReadMidas::Event() { for (int i=0;i<257;i++) { int iadc = gAnalyzer->GetPMTInfoAt(i)->GetADCID(); Float_t adcValue = gAnalyzer->GetADC0BankAt(iadc); gAnalyzer->GetPMTDataAt(i)->SetADC(adcValue); } } |
Code is also added to the event and the end of run method of the XYZTADCCalib task. The first line in the event method gets the adc value back from the folder. The second line reads the pedestal value from the data base. In the third line the histograms are filled with the calibrated adc value. In the end of run method the histograms are drawn.
void XYZTADCCalib::Event() { for (int i=0;i<257;i++) { float pmtData = gAnalyzer->GetPMTDataAt(i)->GetADC(); float pedestal = gAnalyzer->GetCalibAt(i)->GetADCPedestal(); FillADCHistoAt(i,pmtData - pedestal); } }
void XYZTADCCalib::EndOfRun() |
Matthias Schneebeli, Ryu Sawada | |
e-mail: ryu.sawada@cern.ch |