remove mapping in evtReader and DataBlock
This commit is contained in:
parent
15a825e68a
commit
b92673ee7a
|
@ -35,8 +35,6 @@ public:
|
||||||
Int_t baseline;
|
Int_t baseline;
|
||||||
Int_t QDCsum[8];
|
Int_t QDCsum[8];
|
||||||
|
|
||||||
UShort_t id;
|
|
||||||
Int_t detID;
|
|
||||||
ULong64_t eventID;
|
ULong64_t eventID;
|
||||||
|
|
||||||
UShort_t trace[1024];
|
UShort_t trace[1024];
|
||||||
|
@ -59,8 +57,6 @@ public:
|
||||||
energy = 0;
|
energy = 0;
|
||||||
trace_length = 0;
|
trace_length = 0;
|
||||||
trace_out_of_range = 0;
|
trace_out_of_range = 0;
|
||||||
id = 0;
|
|
||||||
detID = -1;
|
|
||||||
eventID = 0;
|
eventID = 0;
|
||||||
ClearQDC();
|
ClearQDC();
|
||||||
ClearTrace();
|
ClearTrace();
|
||||||
|
@ -81,7 +77,7 @@ public:
|
||||||
|
|
||||||
void Print(){
|
void Print(){
|
||||||
printf("============== eventID : %llu\n", eventID);
|
printf("============== eventID : %llu\n", eventID);
|
||||||
printf("Crate: %d, Slot: %d, Ch: %d | id: %d = detID : %d \n", crate, slot, ch, id, detID);
|
printf("Crate: %d, Slot: %d, Ch: %d \n", crate, slot, ch);
|
||||||
printf("HeaderLength: %d, Event Length: %d, energy: %d, timeStamp: %llu\n", headerLength, eventLength, energy, time);
|
printf("HeaderLength: %d, Event Length: %d, energy: %d, timeStamp: %llu\n", headerLength, eventLength, energy, time);
|
||||||
printf("trace_length: %d, pile-up:%d\n", trace_length, pileup);
|
printf("trace_length: %d, pile-up:%d\n", trace_length, pileup);
|
||||||
if( headerLength > 4 ){
|
if( headerLength > 4 ){
|
||||||
|
|
|
@ -50,7 +50,7 @@ int main(int argn, char **argv) {
|
||||||
|
|
||||||
evtReader * evt = new evtReader();
|
evtReader * evt = new evtReader();
|
||||||
DataBlock * data = evt->data;
|
DataBlock * data = evt->data;
|
||||||
|
short detID;
|
||||||
printf("====================================\n");
|
printf("====================================\n");
|
||||||
|
|
||||||
//====== ROOT file
|
//====== ROOT file
|
||||||
|
@ -58,7 +58,7 @@ int main(int argn, char **argv) {
|
||||||
TTree * tree = new TTree("tree", "tree");
|
TTree * tree = new TTree("tree", "tree");
|
||||||
|
|
||||||
tree->Branch("evID", &data->eventID, "data_ID/L");
|
tree->Branch("evID", &data->eventID, "data_ID/L");
|
||||||
tree->Branch("id", &data->detID, "ID/s");
|
tree->Branch("detID", &detID, "detID/s");
|
||||||
tree->Branch("e", &data->energy, "crystal_energy/s");
|
tree->Branch("e", &data->energy, "crystal_energy/s");
|
||||||
tree->Branch("e_t", &data->time, "crystal_timestamp/l");
|
tree->Branch("e_t", &data->time, "crystal_timestamp/l");
|
||||||
|
|
||||||
|
@ -67,7 +67,6 @@ int main(int argn, char **argv) {
|
||||||
gClock.Reset();
|
gClock.Reset();
|
||||||
gClock.Start("timer");
|
gClock.Start("timer");
|
||||||
|
|
||||||
|
|
||||||
//=========================================
|
//=========================================
|
||||||
//=========================================
|
//=========================================
|
||||||
//=========================================
|
//=========================================
|
||||||
|
@ -89,10 +88,16 @@ int main(int argn, char **argv) {
|
||||||
evt->ReadBlock();
|
evt->ReadBlock();
|
||||||
evt->PrintStatus(10000);
|
evt->PrintStatus(10000);
|
||||||
|
|
||||||
|
|
||||||
|
int id = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
||||||
|
detID = mapping[id];
|
||||||
|
|
||||||
|
printf("--------- a\n");
|
||||||
|
outFile->
|
||||||
|
|
||||||
//cern fill tree
|
//cern fill tree
|
||||||
outFile->cd();
|
outFile->cd();
|
||||||
tree->Fill();
|
tree->Fill();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clock2.Stop("timer");
|
clock2.Stop("timer");
|
||||||
|
|
|
@ -109,14 +109,15 @@ int main(int argn, char **argv) {
|
||||||
//================ ROOT tree
|
//================ ROOT tree
|
||||||
TFile * fFile = NULL;
|
TFile * fFile = NULL;
|
||||||
TTree * tree = NULL;
|
TTree * tree = NULL;
|
||||||
|
|
||||||
|
short detID;
|
||||||
|
|
||||||
if( rootFileName != "" ){
|
if( rootFileName != "" ){
|
||||||
fFile = new TFile(rootFileName, "RECREATE");
|
fFile = new TFile(rootFileName, "RECREATE");
|
||||||
tree = new TTree("tree", "tree");
|
tree = new TTree("tree", "tree");
|
||||||
|
|
||||||
|
|
||||||
tree->Branch("headerLenght", &data->headerLength, "HeaderLength/s");
|
tree->Branch("headerLenght", &data->headerLength, "HeaderLength/s");
|
||||||
tree->Branch("detID", &data->detID, "detID/s");
|
tree->Branch("detID", &detID, "detID/s");
|
||||||
tree->Branch("id", &data->id, "id/s");
|
|
||||||
tree->Branch("e", &data->energy, "energy/s");
|
tree->Branch("e", &data->energy, "energy/s");
|
||||||
tree->Branch("e_t", &data->time, "timestamp/l");
|
tree->Branch("e_t", &data->time, "timestamp/l");
|
||||||
tree->Branch("p", &data->pileup, "pileup/O");
|
tree->Branch("p", &data->pileup, "pileup/O");
|
||||||
|
@ -191,22 +192,26 @@ int main(int argn, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//==== Fill Histogram
|
//==== Fill Histogram
|
||||||
if( 0 <= data->detID && data->detID < 100 && data->energy > rawEnergyThreshold ){
|
|
||||||
|
int haha = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
||||||
|
detID = mapping[haha];
|
||||||
|
|
||||||
|
if( 0 <= detID && detID < 100 && data->energy > rawEnergyThreshold ){
|
||||||
if( corrFile != ""){
|
if( corrFile != ""){
|
||||||
///========= apply correction
|
///========= apply correction
|
||||||
int order = (int) eCorr[data->detID].size();
|
int order = (int) eCorr[detID].size();
|
||||||
double eCal = 0;
|
double eCal = 0;
|
||||||
for( int k = 0; k < order ; k++){
|
for( int k = 0; k < order ; k++){
|
||||||
eCal += eCorr[data->detID][k] * TMath::Power(data->energy, k);
|
eCal += eCorr[detID][k] * TMath::Power(data->energy, k);
|
||||||
}
|
}
|
||||||
he[data->detID]->Fill(eCal);
|
he[detID]->Fill(eCal);
|
||||||
}else{
|
}else{
|
||||||
he[data->detID]->Fill(data->energy);
|
he[detID]->Fill(data->energy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///============ QDC
|
///============ QDC
|
||||||
if( data->detID == GAGGID && (data->headerLength < data->eventLength) ){
|
if( detID == GAGGID && (data->headerLength < data->eventLength) ){
|
||||||
double bg = (data->QDCsum[0] + data->QDCsum[1])/60.;
|
double bg = (data->QDCsum[0] + data->QDCsum[1])/60.;
|
||||||
double peak = data->QDCsum[3]/20. - bg;
|
double peak = data->QDCsum[3]/20. - bg;
|
||||||
double tail = data->QDCsum[5]/55. - bg;
|
double tail = data->QDCsum[5]/55. - bg;
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
#include "TString.h"
|
#include "TString.h"
|
||||||
#include "TBenchmark.h"
|
#include "TBenchmark.h"
|
||||||
|
|
||||||
#include "../mapping.h"
|
|
||||||
#include "../armory/DataBlock.h"
|
#include "../armory/DataBlock.h"
|
||||||
|
|
||||||
#define MAX_CRATES 2
|
#define MAX_CRATES 2
|
||||||
|
@ -120,6 +119,8 @@ void evtReader::OpenFile(TString inFileName){
|
||||||
|
|
||||||
gClock.Reset();
|
gClock.Reset();
|
||||||
gClock.Start("timer");
|
gClock.Start("timer");
|
||||||
|
|
||||||
|
isOpened = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ bool evtReader::IsEndOfFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int evtReader::ReadBlock(int opt = 0){
|
int evtReader::ReadBlock(int opt){
|
||||||
|
|
||||||
if( feof(inFile) ) return -1;
|
if( feof(inFile) ) return -1;
|
||||||
if( endOfFile ) return -1;
|
if( endOfFile ) return -1;
|
||||||
|
@ -165,9 +166,6 @@ int evtReader::ReadBlock(int opt = 0){
|
||||||
data->trace_length = (header[3] >> 16) & 0x7FFF;
|
data->trace_length = (header[3] >> 16) & 0x7FFF;
|
||||||
data->trace_out_of_range = header[3] >> 31;
|
data->trace_out_of_range = header[3] >> 31;
|
||||||
|
|
||||||
data->id = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
|
||||||
data->detID = mapping[data->id];
|
|
||||||
|
|
||||||
data->ClearQDC();
|
data->ClearQDC();
|
||||||
|
|
||||||
///======== read QDCsum
|
///======== read QDCsum
|
||||||
|
@ -198,7 +196,7 @@ int evtReader::ReadBlock(int opt = 0){
|
||||||
fread(traceBlock, sizeof(unsigned int) * ( data->trace_length / 2 ), 1, inFile);
|
fread(traceBlock, sizeof(unsigned int) * ( data->trace_length / 2 ), 1, inFile);
|
||||||
|
|
||||||
for( int i = 0; i < data->trace_length/2 ; i++){
|
for( int i = 0; i < data->trace_length/2 ; i++){
|
||||||
data->trace[2*i+0] = traceBlock[i] & 0xFFFF ;
|
data->trace[2*i+0] = traceBlock[i] & 0xFFFF ;
|
||||||
data->trace[2*i+1] = (traceBlock[i] >> 16 ) & 0xFFFF ;
|
data->trace[2*i+1] = (traceBlock[i] >> 16 ) & 0xFFFF ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -158,23 +158,25 @@ int main(int argc, char **argv) {
|
||||||
multiCry = 0;
|
multiCry = 0;
|
||||||
multiGagg = 0;
|
multiGagg = 0;
|
||||||
|
|
||||||
id[multi] = data->detID;
|
int haha = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
||||||
|
id[multi] = mapping[haha];
|
||||||
e[multi] = data->energy;
|
e[multi] = data->energy;
|
||||||
e_t[multi] = data->time;
|
e_t[multi] = data->time;
|
||||||
for( int i = 0; i < 8; i++) qdc[multi][i] = data->QDCsum[i];
|
for( int i = 0; i < 8; i++) qdc[multi][i] = data->QDCsum[i];
|
||||||
multi++ ;
|
multi++ ;
|
||||||
if( data->detID < 100 ) multiCry ++;
|
if( id[multi] < 100 ) multiCry ++;
|
||||||
if( data->detID >= 200 ) multiGagg ++;
|
if( id[multi] >= 200 ) multiGagg ++;
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
//if within time window, fill array;
|
//if within time window, fill array;
|
||||||
id[multi] = data->detID;
|
int haha = data->crate*MAX_BOARDS_PER_CRATE*MAX_CHANNELS_PER_BOARD + (data->slot-BOARD_START)*MAX_CHANNELS_PER_BOARD + data->ch;
|
||||||
|
id[multi] = mapping[haha];
|
||||||
e[multi] = data->energy;
|
e[multi] = data->energy;
|
||||||
e_t[multi] = data->time;
|
e_t[multi] = data->time;
|
||||||
for( int i = 0; i < 8; i++) qdc[multi-1][i] = data->QDCsum[i];
|
for( int i = 0; i < 8; i++) qdc[multi-1][i] = data->QDCsum[i];
|
||||||
multi++ ;
|
multi++ ;
|
||||||
if( data->detID < 100 ) multiCry ++;
|
if( id[multi] < 100 ) multiCry ++;
|
||||||
if( data->detID >= 200 ) multiGagg ++;
|
if( id[multi] >= 200 ) multiGagg ++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user