kind of OK for ApplyMapping.h/C

This commit is contained in:
splitPoleDAQ 2024-01-26 20:34:16 -05:00
parent 6c48087fd0
commit 8c6f48e034
10 changed files with 1225 additions and 192 deletions

17
.vscode/c_cpp_properties.json vendored Normal file
View File

@ -0,0 +1,17 @@
{
"configurations": [
{
"name": "splitpole",
"includePath": [
"${workspaceFolder}/**",
"/home/splitpole/cern/root/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}

18
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,18 @@
{
"files.associations": {
"ryanScript.C": "cpp",
"ryanSelector.C": "cpp",
"array": "cpp",
"deque": "cpp",
"list": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"string_view": "cpp",
"initializer_list": "cpp",
"span": "cpp",
"ApplyMapping.C": "cpp",
"script.C": "cpp"
}
}

147
ApplyMapping.C Normal file
View File

@ -0,0 +1,147 @@
#define ApplyMapping_cxx
#include "ApplyMapping.h"
#include <TH1.h>
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <vector>
#include <utility>
void ApplyMapping::Begin(TTree * /*tree*/){
TString option = GetOption();
run = option.Atoi();
}
void ApplyMapping::SlaveBegin(TTree * /*tree*/){
TString option = GetOption();
}
Bool_t ApplyMapping::Process(Long64_t entry){
b_event_ID->GetEntry(entry);
b_multi->GetEntry(entry);
b_sn->GetEntry(entry);
b_ch->GetEntry(entry);
b_e->GetEntry(entry);
b_e_t->GetEntry(entry);
eventID = evID;
// printf("======================== %llu, %u\n", evID, multi);
sx3.multi = 0;
qqq.multi = 0;
pc.multi = 0;
for( unsigned int i = 0; i < multi; i++){
//printf("%10u/%10u| %5d, %2u, %6u, %14llu\n", i, multi, sn[i], ch[i], e[i], e_t[i] );
int globalCh = ch[i];
for( int j = 0; j < nBd; j++){
if( board.at(j) == sn[i]){
globalCh += sn[i] > 1000 ? j * 64 : 7*64 + (j-7) * 16;
}
}
unsigned short ID = mapping[globalCh];
//=================================== sx3
if( ID < 10000 ) {
sx3.id[sx3.multi] = ID / 100;
sx3.ch[sx3.multi] = ID % 100;
sx3.e[sx3.multi] = e[i];
sx3.t[sx3.multi] = e_t[i];
sx3.multi ++;
}
//=================================== qqq
if( 10000 <= ID && ID < 20000 ) {
qqq.id[qqq.multi] = (ID - 10000) / 100;
qqq.ch[qqq.multi] = (ID - 10000) % 100;
qqq.e[qqq.multi] = e[i];
qqq.t[qqq.multi] = e_t[i];
qqq.multi ++;
}
//=================================== pc
if( 20000 <= ID && ID < 30000 ) {
pc.id[pc.multi] = (ID - 20000) / 100;
pc.ch[pc.multi] = (ID - 20000) % 100;
pc.e[pc.multi] = e[i];
pc.t[pc.multi] = e_t[i];
pc.multi ++;
}
}
//if(entry == 0 ) sx3.Print();
/************************************************************************/
saveFile->cd(); //set focus on this file
newTree->Fill();
newTree->Write();
printf("%6lu/%6u [%2d%%]\n\033[A\r", eventID, totnumEntry, TMath::Nint((eventID+1)*100./totnumEntry));
// clock.Stop("timer");
// Double_t time = clock.GetRealTime("timer");
// clock.Start("timer");
// if ( !shown ) {
// if (fmod(time, 10) < 1 ){
// printf( "%10lu[%2d%%]|%3.0f min %5.2f sec | expect:%5.2f min\n",
// eventID,
// TMath::Nint((eventID+1)*100./totnumEntry),
// TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.,
// totnumEntry*time/(eventID+1.)/60.);
// shown = true;
// }
// }else{
// if (fmod(time, 10) > 9 ){
// shown = false;
// }
// }
return kTRUE;
}
void ApplyMapping::SlaveTerminate(){
}
void ApplyMapping::Terminate(){
// Double_t time = clock.GetRealTime("timer");
// printf( "%10lu[%2d%%]|%3.0f min %5.2f sec | expect:%5.2f min\n",
// eventID,
// TMath::Nint((eventID+1)*100./totnumEntry),
// TMath::Floor(time/60.), time - TMath::Floor(time/60.)*60.,
// totnumEntry*time/(eventID+1.)/60.);
// shown = true;
saveFile->cd(); //set focus on this file
newTree->Write();
UInt_t eventNumber = newTree->GetEntries();
saveFile->Close();
printf("-------------- done, saved in %s, %u\n", saveFileName.Data(), eventNumber);
}

245
ApplyMapping.h Normal file
View File

@ -0,0 +1,245 @@
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Mon Jan 22 14:02:44 2024 by ROOT version 6.26/04
// from TTree tree/pulsertest_018_10000_noTrace.root
// found on file: pulsertest_018_10000_noTrace.root
//////////////////////////////////////////////////////////
#ifndef ApplyMapping_h
#define ApplyMapping_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
#include <TMath.h>
#include <TBenchmark.h>
#include "mapping.h"
#define MAXMULTI 1000
// Header file for the classes stored in the TTree if any.
class Det{
public:
Det(): multi(0) {Clear(); }
UShort_t multi;
UShort_t id[MAXMULTI];
UShort_t ch[MAXMULTI];
UShort_t e[MAXMULTI];
ULong64_t t[MAXMULTI];
void Clear(){
multi = 0;
for( int i = 0; i < MAXMULTI; i++){
id[i] = 0;
ch[i] = 0;
e[i] = 0;
t[i] = 0;
}
}
void Print(){
printf("=============================== multi : %u\n", multi);
for( int i = 0; i < multi; i++) {
printf(" %3d | %2d-%2d %5u %llu \n", i, id[i], ch[i], e[i], t[i]);
}
}
};
class ApplyMapping : public TSelector {
public :
TChain *fChain; //!pointer to the analyzed TTree or TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
ULong64_t evID;
UInt_t multi;
UShort_t sn[MAXMULTI]; //[multi]
UShort_t ch[MAXMULTI]; //[multi]
UShort_t e[MAXMULTI]; //[multi]
UShort_t e2[MAXMULTI]; //[multi]
ULong64_t e_t[MAXMULTI]; //[multi]
UShort_t e_f[MAXMULTI]; //[multi]
// List of branches
TBranch *b_event_ID; //!
TBranch *b_multi; //!
TBranch *b_sn; //!
TBranch *b_ch; //!
TBranch *b_e; //!
TBranch *b_e2; //!
TBranch *b_e_t; //!
TBranch *b_e_f; //!
ApplyMapping(TTree * /*tree*/ =0) : fChain(0) { }
virtual ~ApplyMapping() { }
virtual Int_t Version() const { return 2; }
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) { fInput = input; }
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
void SetRunID(UInt_t runID) { run = runID; }
ClassDef(ApplyMapping,0);
//===============================
TFile * saveFile;
TTree * newTree;
TString saveFileName;
int totnumEntry; // of original root
//tree
ULong_t eventID;
UInt_t run;
Det sx3;
Det qqq;
Det pc ;
//clock
TBenchmark clock;
Bool_t shown;
};
#endif
#ifdef ApplyMapping_cxx
void ApplyMapping::Init(TTree *tree){
if (!tree) return;
//======================================
totnumEntry = tree->GetEntries();
printf( "===================================== \n");
printf( "====== total Entry : %d \n", totnumEntry);
printf( "===================================== \n");
fChain = (TChain *) tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("evID", &evID, &b_event_ID);
fChain->SetBranchAddress("multi", &multi, &b_multi);
fChain->SetBranchAddress("sn", sn, &b_sn);
fChain->SetBranchAddress("ch", ch, &b_ch);
fChain->SetBranchAddress("e", e, &b_e);
fChain->SetBranchAddress("e2", e2, &b_e2);
fChain->SetBranchAddress("e_t", e_t, &b_e_t);
fChain->SetBranchAddress("e_f", e_f, &b_e_f);
PrintMapping();
//================= Formation of file name
// TString expName = "";
// fChain->GetListOfFiles()->Print();
// int numFile = fChain->GetListOfFiles()->GetLast() + 1;
// if( numFile > 0 ) {
// int oldRunNum = -100;
// bool contFlag = false; // is runNumber continue;
// for( int i = 0; i < numFile ; i++){
// TString name = fChain->GetListOfFiles()->At(i)->GetTitle();
// TString prefix = name;
// int found = name.Last('/');
// found = name.Index("_", found+1); // find next "_"
// name.Remove(0, found+1);
// name.Remove(3); // name should be only runID
// int runNum = name.Atoi(); // this should give the 3 digit run number
// if( i == 0 ) {
// int found = prefix.Last('/');
// prefix.Remove(0, found+1);
// found = name.Index("_");
// prefix.Remove(0, found+1); // this should give the expName;
// expName = prefix;
// saveFileName = expName + "_" + prefix + "_run";
// }
// if( runNum == oldRunNum + 1 ){
// int kk = saveFileName.Sizeof();
// if( contFlag == false ){
// saveFileName.Remove(kk-2); //remove the "-"
// saveFileName += "-";
// }else{
// saveFileName.Remove(kk-5); //remove the runNum and "-"
// }
// contFlag = true;
// }
// if( runNum > oldRunNum + 1) contFlag = false;
// saveFileName += Form("%03d_", runNum);
// oldRunNum = runNum;
// }
// int kk = saveFileName.Sizeof();
// saveFileName.Remove(kk-2); // remove the last "-"
// saveFileName += ".root";
// }else{
// saveFileName.Form("%s_default.root", expName.Data());
// }
saveFileName = "test.root";
printf("save file name : %s \n", saveFileName.Data());
printf("---------------------------------------------\n");
if( saveFileName == ".root" ) gROOT->ProcessLine(".q");
saveFile = new TFile( saveFileName,"recreate");
//====================== Create tree
newTree = new TTree("tree","tree");
eventID = 0;
run = 0;
sx3.Clear();
qqq.Clear();
pc.Clear();
newTree->Branch("eventID",&eventID,"eventID/l");
newTree->Branch("run", &run,"run/i");
newTree->Branch("sx3Multi", &sx3.multi, "sx3Multi/s");
newTree->Branch("sx3ID", &sx3.id, "sx3ID[sx3Multi]/s");
newTree->Branch("sx3Ch", &sx3.ch, "sx3Ch[sx3Multi]/s");
newTree->Branch("sx3E", &sx3.e, "sx3Energy[sx3Multi]/s");
newTree->Branch("sx3T", &sx3.t, "sx3Time[sx3Multi]/l");
newTree->Branch("qqqMulti", &qqq.multi, "qqqMulti/s");
newTree->Branch("qqqID", &qqq.id, "qqqID[qqqMulti]/s");
newTree->Branch("qqqCh", &qqq.ch, "qqqCh[qqqMulti]/s");
newTree->Branch("qqqE", &qqq.e, "qqqEnergy[qqqMulti]/s");
newTree->Branch("qqqT", &qqq.t, "qqqTime[qqqMulti]/l");
newTree->Branch("pcMulti", &pc.multi, "pcMulti/s");
newTree->Branch("pcID", &pc.id, "pcID[pcMulti]/s");
newTree->Branch("pcCh", &pc.ch, "pcCh[pcMulti]/s");
newTree->Branch("pcE", &pc.e, "pcEnergy[pcMulti]/s");
newTree->Branch("pcT", &pc.t, "pcTime[pcMulti]/l");
shown = false;
}
Bool_t ApplyMapping::Notify(){
return kTRUE;
}
#endif // #ifdef ApplyMapping_cxx

View File

@ -9,8 +9,11 @@ fi
runID=$1
timeWindow=$2
fileList=`\ls -1 ../*${runID}*.fsu`
rawFolder=/media/nvmeData/ANASEN_test
rootFoler=/media/nvmeData/ANASEN_test/root_data
fileList=`\ls -1 ${rawFolder}/*${runID}*.fsu`
./EventBuilderNoTrace ${timeWindow} 0 ${fileList}
mv -vf ../*${runID}*${timeWindow}_noTrace.root .
mv -vf ${rawFolder}/*${runID}*${timeWindow}_noTrace.root ${rootFoler}/.

290
mapping.h Normal file
View File

@ -0,0 +1,290 @@
#ifndef Mapping_h
#define Mapping_h
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <map>
#include <utility>
#include <TMath.h>
// class Hit{
// public:
// std::string label;
// unsigned short ch;
// double energy;
// unsigned long long timestamp;
// Hit() : label(""), ch(-1), energy(TMath::QuietNaN()), timestamp(0) {}
// Hit(std::string label, unsigned short ch, double energy, unsigned long long timestamp){
// this->label = label;
// this->ch = ch;
// this->energy = energy;
// this->timestamp = timestamp;
// }
// };
const std::map<int, unsigned short> board = {
{0, 17122}, // id, sn
{1, 17123},
{2, 22320},
{3, 22130},
{4, 22129},
{5, 15529},
{6, 15528},
{7, 379},
{8, 409},
{9, 405}
};
const int nBd = board.size();
//+++++++++++++++++++ detID;
// The detectors are seperated into 2 type: SuperX3, QQQ, and PC
// the SuperX3 has 24 detectors for each kind, wach detector has 12 channels
// the QQQ has 4 detectors for each kind, each detector has 32 channels
// the PC has 2 types, anode and cathode, each has 24 channels
// The detID = Type * 10000 + index * 100 + channel
// fro example, detID(superX3-8, ch-7) = 00807
// use the GenMapping() to get that
const std::vector<int> mapping = {
//================== 17122
206, 207, 204, 205, 203, 202, 201, 200, 406, 407, 404, 405, 403, 402, 401, 400,
6, 7, 4, 5, 3, 2, 1, 0, 506, 507, 504, 505, 503, 502, 501, 500,
111, 110, 109, 108, 211, 210, 209, 208, 311, 310, 309, 308, 411, 410, 409, 408,
106, 107, 104, 105, 103, 102, 101, 100, 306, 307, 304, 305, 303, 302, 301, 300,
//================== 17123
606, 607, 604, 605, 603, 602, 601, 600, 1106, 1107, 1104, 1105, 1103, 1102, 1101, 1100,
711, 710, 709, 708, 811, 810, 809, 808, 911, 910, 909, 908, 1011, 1010, 1009, 1008,
706, 707, 704, 705, 703, 702, 701, 700, 906, 907, 904, 905, 903, 902, 901, 900,
806, 807, 804, 805, 803, 802, 801, 800, 1006, 1007, 1004, 1005, 1003, 1002, 1001, 1000,
//================== 22320
1911, 1910, 1909, 1908, 2011, 2010, 2009, 2008, 2111, 2110, 2109, 2108, 2211, 2210, 2209, 2208,
1906, 1907, 1904, 1905, 1903, 1902, 1901, 1900, 2106, 2107, 2104, 2105, 2103, 2102, 2101, 2100,
1806, 1807, 1804, 1805, 1803, 1802, 1801, 1800, 2306, 2307, 2304, 2305, 2303, 2302, 2301, 2300,
2006, 2007, 2004, 2005, 2003, 2002, 2001, 2000, 2206, 2207, 2204, 2205, 2203, 2202, 2201, 2200,
//================== 22130
1311, 1310, 1309, 1308, 1411, 1410, 1409, 1408, 1511, 1510, 1509, 1508, 1611, 1610, 1609, 1608,
11, 10, 9, 8, 511, 510, 509, 508, 611, 610, 609, 608, 1111, 1110, 1109, 1108,
1406, 1407, 1404, 1405, 1403, 1402, 1401, 1400, 1606, 1607, 1604, 1605, 1603, 1602, 1601, 1600,
1306, 1307, 1304, 1305, 1303, 1302, 1301, 1300, 1506, 1507, 1504, 1505, 1503, 1502, 1501, 1500,
//================== 22129
10015, 10014, 10013, 10012, 10011, 10010, 10009, 10008, 10007, 10006, 10005, 10004, 10003, 10002, 10001, 10000,
1206, 1207, 1204, 1205, 1203, 1202, 1201, 1200, 1706, 1707, 1704, 1705, 1703, 1702, 1701, 1700,
10115, 10114, 10113, 10112, 10111, 10110, 10109, 10108, 10107, 10106, 10105, 10104, 10103, 10102, 10101, 10100,
10116, 10117, 10118, 10119, 10120, 10121, 10122, 10123, 10124, 10125, 10126, 10127, 10128, 10129, 10130, 10131,
//================== 15529
10016, 10017, 10018, 10019, 10020, 10021, 10022, 10023, 10024, 10025, 10026, 10027, 10028, 10029, 10030, 10031,
10215, 10214, 10213, 10212, 10211, 10210, 10209, 10208, 10207, 10206, 10205, 10204, 10203, 10202, 10201, 10200,
10216, 10217, 10218, 10219, 10220, 10221, 10222, 10223, 10224, 10225, 10226, 10227, 10228, 10229, 10230, 10231,
10315, 10314, 10313, 10312, 10311, 10310, 10309, 10308, 10307, 10306, 10305, 10304, 10303, 10302, 10301, 10300,
//================== 15528
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
10316, 10317, 10318, 10319, 10320, 10321, 10322, 10323, 10324, 10325, 10326, 10327, 10328, 10329, 10330, 10331,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
//================== 379
20116, 20117, 20118, 20119, 20120, 20121, 20122, 20123, 20016, 20017, 20018, 20019, 20020, 20021, 20022, 20023,
//================== 409
20000, 20001, 20002, 20003, 20004, 20005, 20006, 20007, 20008, 20009, 20010, 20011, 20012, 20013, 20014, 20015,
//================== 405
20100, 20101, 20102, 20103, 20104, 20105, 20106, 20107, 20108, 20109, 20110, 20111, 20112, 20113, 20114, 20115,
};
void PrintMapping(){
int digiID = 0;
int count = 0;
printf("==================== ID-MAP: \n");
printf("%11s|", ""); for(int i = 0 ; i < 16; i++ ) printf("%7d|", i);
printf("\n");
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
for(size_t i = 0 ; i < mapping.size(); i ++){
if( (i) % 16 == 0 ) {
printf("\n");
if( digiID < nBd ){
if( board.at(digiID) > 1000 ) {
if( count == 3 ) digiID ++;
if( i % 64 == 0 ) {
printf("%11d|", board.at(digiID));
count = 0;
}
}else{
if( count == 1 ) digiID ++;
if( i % 16 == 0 ) {
printf("%11d|", board.at(digiID));
count = 0;
}
}
}
if( count != 0) printf("%11s|", "");
count ++;
}
int typeID = mapping[i] / 10000;
int detID = (mapping[i] - typeID*10000 )/100;
int ch = mapping[i] - typeID*10000 - detID * 100;
if( mapping[i] == -1 ) {
printf("%7s|", "");
}else{
if( typeID == 0){ // SX3
printf("\033[36m%3d(%2d)\033[0m|", detID, ch);
}else if( typeID == 1){ // QQQ
printf("\033[91m%3d(%2d)\033[0m|", detID, ch);
}else if( typeID == 2){ // PC
printf("\033[35m%3d(%2d)\033[0m|", detID, ch);
}else{
}
}
}
printf("\n");
for(int i = 0 ; i < 12 + 16*8; i++ ) printf("-");
printf("\n");
}
void GenMapping(std::string mapFile){
std::vector<int> map;
std::ifstream inputFile(mapFile); // Replace "your_file.txt" with the actual file path
if (!inputFile.is_open()) {
printf("Error: Could not open the file (%s).\n", mapFile.c_str());
return ;
}
std::string line;
// Read the file line by line
while (std::getline(inputFile, line)) {
std::vector<std::string> words;
std::istringstream iss(line);
// Extract words from the current line
while (true) {
std::string word;
if (!(iss >> word)) break; // Break if there are no more words
word.erase(std::remove_if(word.begin(), word.end(), ::isspace), word.end());
words.push_back(word);
}
if( atoi(words[0].c_str()) % 16 == 0 ) printf("=================\n");
for( size_t i = 0; i < words.size(); i++) printf("|%9s", words[i].c_str());
int detID = atoi(words[1].c_str())*100;
if( words[2] == "BARREL" ) {
if( words[3] == "FRONTDOWN" ){
int chID = atoi(words[4].c_str());
if( chID % 2 != 0 ) chID -= 1;
detID += chID;
}
if( words[3] == "FRONTUP" ){
int chID = atoi(words[4].c_str());
if( chID % 2 == 0 ) chID += 1;
detID += chID;
}
if( words[3] == "BACK") detID += atoi(words[4].c_str()) + 8;
}
if( words[2] == "FQQQ" ) {
detID += 10000;
if( words[3] == "WEDGE") detID += atoi(words[4].c_str());
if( words[3] == "RING") detID += atoi(words[4].c_str()) + 16;
}
if( words[2] == "PC" ) {
detID += 20000;
if( words[3] == "ANODE") detID += atoi(words[4].c_str());
if( words[3] == "CATHODE") detID += 100 + atoi(words[4].c_str());
}
if( words[2] == "blank") {
detID = -1;
}
map.push_back(detID);
printf("| %5d", detID);
printf("|\n");
}
// Close the file
inputFile.close();
int digiID = 0;
int count = 0;
printf("===============================\n");
for( size_t i = 0; i < ((map.size() +15)/16) * 16; i++){
if( i % 16 == 0) {
printf("\n");
if( digiID < nBd ){
if( board.at(digiID) > 1000 ) {
if( count == 3 ) digiID ++;
if( i % 64 == 0 ) {
printf(" //================== %d\n", board.at(digiID));
count = 0;
}
}else{
if( count == 1 ) digiID ++;
if( i % 16 == 0 ) {
printf(" //================== %d\n", board.at(digiID));
count = 0;
}
}
}
count ++;
}
if( i < map.size() ){
printf(" %5d,", map[i]);
}else{
printf(" %5d,", -1);
}
}
printf("\n\n===============================\n");
printf("sorting mapping and see if there any repeated\n");
std::sort(map.begin(), map.end());
for( size_t i = 1; i < map.size(); i++){
if( map[i] == -1 ) continue;
if( map[i] == map[i-1] ) printf("%5d \n", map[i]);
}
printf("=========== Done. if nothing show, no repeat. \n");
}
#endif

496
mapping_old.txt Normal file
View File

@ -0,0 +1,496 @@
0 2 BARREL FRONTDOWN 7
1 2 BARREL FRONTUP 6
2 2 BARREL FRONTDOWN 5
3 2 BARREL FRONTUP 4
4 2 BARREL FRONTUP 3
5 2 BARREL FRONTDOWN 2
6 2 BARREL FRONTUP 1
7 2 BARREL FRONTDOWN 0
8 4 BARREL FRONTDOWN 7
9 4 BARREL FRONTUP 6
10 4 BARREL FRONTDOWN 5
11 4 BARREL FRONTUP 4
12 4 BARREL FRONTUP 3
13 4 BARREL FRONTDOWN 2
14 4 BARREL FRONTUP 1
15 4 BARREL FRONTDOWN 0
16 0 BARREL FRONTDOWN 7
17 0 BARREL FRONTUP 6
18 0 BARREL FRONTDOWN 5
19 0 BARREL FRONTUP 4
20 0 BARREL FRONTUP 3
21 0 BARREL FRONTDOWN 2
22 0 BARREL FRONTUP 1
23 0 BARREL FRONTDOWN 0
24 5 BARREL FRONTDOWN 7
25 5 BARREL FRONTUP 6
26 5 BARREL FRONTDOWN 5
27 5 BARREL FRONTUP 4
28 5 BARREL FRONTUP 3
29 5 BARREL FRONTDOWN 2
30 5 BARREL FRONTUP 1
31 5 BARREL FRONTDOWN 0
32 1 BARREL BACK 3
33 1 BARREL BACK 2
34 1 BARREL BACK 1
35 1 BARREL BACK 0
36 2 BARREL BACK 3
37 2 BARREL BACK 2
38 2 BARREL BACK 1
39 2 BARREL BACK 0
40 3 BARREL BACK 3
41 3 BARREL BACK 2
42 3 BARREL BACK 1
43 3 BARREL BACK 0
44 4 BARREL BACK 3
45 4 BARREL BACK 2
46 4 BARREL BACK 1
47 4 BARREL BACK 0
48 1 BARREL FRONTDOWN 7
49 1 BARREL FRONTUP 6
50 1 BARREL FRONTDOWN 5
51 1 BARREL FRONTUP 4
52 1 BARREL FRONTUP 3
53 1 BARREL FRONTDOWN 2
54 1 BARREL FRONTUP 1
55 1 BARREL FRONTDOWN 0
56 3 BARREL FRONTDOWN 7
57 3 BARREL FRONTUP 6
58 3 BARREL FRONTDOWN 5
59 3 BARREL FRONTUP 4
60 3 BARREL FRONTUP 3
61 3 BARREL FRONTDOWN 2
62 3 BARREL FRONTUP 1
63 3 BARREL FRONTDOWN 0
64 6 BARREL FRONTDOWN 7
65 6 BARREL FRONTUP 6
66 6 BARREL FRONTDOWN 5
67 6 BARREL FRONTUP 4
68 6 BARREL FRONTUP 3
69 6 BARREL FRONTDOWN 2
70 6 BARREL FRONTUP 1
71 6 BARREL FRONTDOWN 0
72 11 BARREL FRONTDOWN 7
73 11 BARREL FRONTUP 6
74 11 BARREL FRONTDOWN 5
75 11 BARREL FRONTUP 4
76 11 BARREL FRONTUP 3
77 11 BARREL FRONTDOWN 2
78 11 BARREL FRONTUP 1
79 11 BARREL FRONTDOWN 0
80 7 BARREL BACK 3
81 7 BARREL BACK 2
82 7 BARREL BACK 1
83 7 BARREL BACK 0
84 8 BARREL BACK 3
85 8 BARREL BACK 2
86 8 BARREL BACK 1
87 8 BARREL BACK 0
88 9 BARREL BACK 3
89 9 BARREL BACK 2
90 9 BARREL BACK 1
91 9 BARREL BACK 0
92 10 BARREL BACK 3
93 10 BARREL BACK 2
94 10 BARREL BACK 1
95 10 BARREL BACK 0
96 7 BARREL FRONTDOWN 7
97 7 BARREL FRONTUP 6
98 7 BARREL FRONTDOWN 5
99 7 BARREL FRONTUP 4
100 7 BARREL FRONTUP 3
101 7 BARREL FRONTDOWN 2
102 7 BARREL FRONTUP 1
103 7 BARREL FRONTDOWN 0
104 9 BARREL FRONTDOWN 7
105 9 BARREL FRONTUP 6
106 9 BARREL FRONTDOWN 5
107 9 BARREL FRONTUP 4
108 9 BARREL FRONTUP 3
109 9 BARREL FRONTDOWN 2
110 9 BARREL FRONTUP 1
111 9 BARREL FRONTDOWN 0
112 8 BARREL FRONTDOWN 7
113 8 BARREL FRONTUP 6
114 8 BARREL FRONTDOWN 5
115 8 BARREL FRONTUP 4
116 8 BARREL FRONTUP 3
117 8 BARREL FRONTDOWN 2
118 8 BARREL FRONTUP 1
119 8 BARREL FRONTDOWN 0
120 10 BARREL FRONTDOWN 7
121 10 BARREL FRONTUP 6
122 10 BARREL FRONTDOWN 5
123 10 BARREL FRONTUP 4
124 10 BARREL FRONTUP 3
125 10 BARREL FRONTDOWN 2
126 10 BARREL FRONTUP 1
127 10 BARREL FRONTDOWN 0
128 19 BARREL BACK 3
129 19 BARREL BACK 2
130 19 BARREL BACK 1
131 19 BARREL BACK 0
132 20 BARREL BACK 3
133 20 BARREL BACK 2
134 20 BARREL BACK 1
135 20 BARREL BACK 0
136 21 BARREL BACK 3
137 21 BARREL BACK 2
138 21 BARREL BACK 1
139 21 BARREL BACK 0
140 22 BARREL BACK 3
141 22 BARREL BACK 2
142 22 BARREL BACK 1
143 22 BARREL BACK 0
144 19 BARREL FRONTDOWN 7
145 19 BARREL FRONTUP 6
146 19 BARREL FRONTDOWN 5
147 19 BARREL FRONTUP 4
148 19 BARREL FRONTUP 3
149 19 BARREL FRONTDOWN 2
150 19 BARREL FRONTUP 1
151 19 BARREL FRONTDOWN 0
152 21 BARREL FRONTDOWN 7
153 21 BARREL FRONTUP 6
154 21 BARREL FRONTDOWN 5
155 21 BARREL FRONTUP 4
156 21 BARREL FRONTUP 3
157 21 BARREL FRONTDOWN 2
158 21 BARREL FRONTUP 1
159 21 BARREL FRONTDOWN 0
160 18 BARREL FRONTDOWN 7
161 18 BARREL FRONTUP 6
162 18 BARREL FRONTDOWN 5
163 18 BARREL FRONTUP 4
164 18 BARREL FRONTUP 3
165 18 BARREL FRONTDOWN 2
166 18 BARREL FRONTUP 1
167 18 BARREL FRONTDOWN 0
168 23 BARREL FRONTDOWN 7
169 23 BARREL FRONTUP 6
170 23 BARREL FRONTDOWN 5
171 23 BARREL FRONTUP 4
172 23 BARREL FRONTUP 3
173 23 BARREL FRONTDOWN 2
174 23 BARREL FRONTUP 1
175 23 BARREL FRONTDOWN 0
176 20 BARREL FRONTDOWN 7
177 20 BARREL FRONTUP 6
178 20 BARREL FRONTDOWN 5
179 20 BARREL FRONTUP 4
180 20 BARREL FRONTUP 3
181 20 BARREL FRONTDOWN 2
182 20 BARREL FRONTUP 1
183 20 BARREL FRONTDOWN 0
184 22 BARREL FRONTDOWN 7
185 22 BARREL FRONTUP 6
186 22 BARREL FRONTDOWN 5
187 22 BARREL FRONTUP 4
188 22 BARREL FRONTUP 3
189 22 BARREL FRONTDOWN 2
190 22 BARREL FRONTUP 1
191 22 BARREL FRONTDOWN 0
192 13 BARREL BACK 3
193 13 BARREL BACK 2
194 13 BARREL BACK 1
195 13 BARREL BACK 0
196 14 BARREL BACK 3
197 14 BARREL BACK 2
198 14 BARREL BACK 1
199 14 BARREL BACK 0
200 15 BARREL BACK 3
201 15 BARREL BACK 2
202 15 BARREL BACK 1
203 15 BARREL BACK 0
204 16 BARREL BACK 3
205 16 BARREL BACK 2
206 16 BARREL BACK 1
207 16 BARREL BACK 0
208 0 BARREL BACK 3
209 0 BARREL BACK 2
210 0 BARREL BACK 1
211 0 BARREL BACK 0
212 5 BARREL BACK 3
213 5 BARREL BACK 2
214 5 BARREL BACK 1
215 5 BARREL BACK 0
216 6 BARREL BACK 3
217 6 BARREL BACK 2
218 6 BARREL BACK 1
219 6 BARREL BACK 0
220 11 BARREL BACK 3
221 11 BARREL BACK 2
222 11 BARREL BACK 1
223 11 BARREL BACK 0
224 14 BARREL FRONTDOWN 7
225 14 BARREL FRONTUP 6
226 14 BARREL FRONTDOWN 5
227 14 BARREL FRONTUP 4
228 14 BARREL FRONTUP 3
229 14 BARREL FRONTDOWN 2
230 14 BARREL FRONTUP 1
231 14 BARREL FRONTDOWN 0
232 16 BARREL FRONTDOWN 7
233 16 BARREL FRONTUP 6
234 16 BARREL FRONTDOWN 5
235 16 BARREL FRONTUP 4
236 16 BARREL FRONTUP 3
237 16 BARREL FRONTDOWN 2
238 16 BARREL FRONTUP 1
239 16 BARREL FRONTDOWN 0
240 13 BARREL FRONTDOWN 7
241 13 BARREL FRONTUP 6
242 13 BARREL FRONTDOWN 5
243 13 BARREL FRONTUP 4
244 13 BARREL FRONTUP 3
245 13 BARREL FRONTDOWN 2
246 13 BARREL FRONTUP 1
247 13 BARREL FRONTDOWN 0
248 15 BARREL FRONTDOWN 7
249 15 BARREL FRONTUP 6
250 15 BARREL FRONTDOWN 5
251 15 BARREL FRONTUP 4
252 15 BARREL FRONTUP 3
253 15 BARREL FRONTDOWN 2
254 15 BARREL FRONTUP 1
255 15 BARREL FRONTDOWN 0
256 0 FQQQ WEDGE 15
257 0 FQQQ WEDGE 14
258 0 FQQQ WEDGE 13
259 0 FQQQ WEDGE 12
260 0 FQQQ WEDGE 11
261 0 FQQQ WEDGE 10
262 0 FQQQ WEDGE 9
263 0 FQQQ WEDGE 8
264 0 FQQQ WEDGE 7
265 0 FQQQ WEDGE 6
266 0 FQQQ WEDGE 5
267 0 FQQQ WEDGE 4
268 0 FQQQ WEDGE 3
269 0 FQQQ WEDGE 2
270 0 FQQQ WEDGE 1
271 0 FQQQ WEDGE 0
272 12 BARREL FRONTDOWN 7
273 12 BARREL FRONTUP 6
274 12 BARREL FRONTDOWN 5
275 12 BARREL FRONTUP 4
276 12 BARREL FRONTUP 3
277 12 BARREL FRONTDOWN 2
278 12 BARREL FRONTUP 1
279 12 BARREL FRONTDOWN 0
280 17 BARREL FRONTDOWN 7
281 17 BARREL FRONTUP 6
282 17 BARREL FRONTDOWN 5
283 17 BARREL FRONTUP 4
284 17 BARREL FRONTUP 3
285 17 BARREL FRONTDOWN 2
286 17 BARREL FRONTUP 1
287 17 BARREL FRONTDOWN 0
288 1 FQQQ WEDGE 15
289 1 FQQQ WEDGE 14
290 1 FQQQ WEDGE 13
291 1 FQQQ WEDGE 12
292 1 FQQQ WEDGE 11
293 1 FQQQ WEDGE 10
294 1 FQQQ WEDGE 9
295 1 FQQQ WEDGE 8
296 1 FQQQ WEDGE 7
297 1 FQQQ WEDGE 6
298 1 FQQQ WEDGE 5
299 1 FQQQ WEDGE 4
300 1 FQQQ WEDGE 3
301 1 FQQQ WEDGE 2
302 1 FQQQ WEDGE 1
303 1 FQQQ WEDGE 0
304 1 FQQQ RING 0
305 1 FQQQ RING 1
306 1 FQQQ RING 2
307 1 FQQQ RING 3
308 1 FQQQ RING 4
309 1 FQQQ RING 5
310 1 FQQQ RING 6
311 1 FQQQ RING 7
312 1 FQQQ RING 8
313 1 FQQQ RING 9
314 1 FQQQ RING 10
315 1 FQQQ RING 11
316 1 FQQQ RING 12
317 1 FQQQ RING 13
318 1 FQQQ RING 14
319 1 FQQQ RING 15
320 0 FQQQ RING 0
321 0 FQQQ RING 1
322 0 FQQQ RING 2
323 0 FQQQ RING 3
324 0 FQQQ RING 4
325 0 FQQQ RING 5
326 0 FQQQ RING 6
327 0 FQQQ RING 7
328 0 FQQQ RING 8
329 0 FQQQ RING 9
330 0 FQQQ RING 10
331 0 FQQQ RING 11
332 0 FQQQ RING 12
333 0 FQQQ RING 13
334 0 FQQQ RING 14
335 0 FQQQ RING 15
336 2 FQQQ WEDGE 15
337 2 FQQQ WEDGE 14
338 2 FQQQ WEDGE 13
339 2 FQQQ WEDGE 12
340 2 FQQQ WEDGE 11
341 2 FQQQ WEDGE 10
342 2 FQQQ WEDGE 9
343 2 FQQQ WEDGE 8
344 2 FQQQ WEDGE 7
345 2 FQQQ WEDGE 6
346 2 FQQQ WEDGE 5
347 2 FQQQ WEDGE 4
348 2 FQQQ WEDGE 3
349 2 FQQQ WEDGE 2
350 2 FQQQ WEDGE 1
351 2 FQQQ WEDGE 0
352 2 FQQQ RING 0
353 2 FQQQ RING 1
354 2 FQQQ RING 2
355 2 FQQQ RING 3
356 2 FQQQ RING 4
357 2 FQQQ RING 5
358 2 FQQQ RING 6
359 2 FQQQ RING 7
360 2 FQQQ RING 8
361 2 FQQQ RING 9
362 2 FQQQ RING 10
363 2 FQQQ RING 11
364 2 FQQQ RING 12
365 2 FQQQ RING 13
366 2 FQQQ RING 14
367 2 FQQQ RING 15
368 3 FQQQ WEDGE 15
369 3 FQQQ WEDGE 14
370 3 FQQQ WEDGE 13
371 3 FQQQ WEDGE 12
372 3 FQQQ WEDGE 11
373 3 FQQQ WEDGE 10
374 3 FQQQ WEDGE 9
375 3 FQQQ WEDGE 8
376 3 FQQQ WEDGE 7
377 3 FQQQ WEDGE 6
378 3 FQQQ WEDGE 5
379 3 FQQQ WEDGE 4
380 3 FQQQ WEDGE 3
381 3 FQQQ WEDGE 2
382 3 FQQQ WEDGE 1
383 3 FQQQ WEDGE 0
384 0 blank blank 0
385 0 blank blank 1
386 0 blank blank 2
387 0 blank blank 3
388 0 blank blank 4
389 0 blank blank 5
390 0 blank blank 6
391 0 blank blank 7
392 0 blank blank 8
393 0 blank blank 9
394 0 blank blank 10
395 0 blank blank 11
396 0 blank blank 12
397 0 blank blank 13
398 0 blank blank 14
399 0 blank blank 15
400 3 FQQQ RING 0
401 3 FQQQ RING 1
402 3 FQQQ RING 2
403 3 FQQQ RING 3
404 3 FQQQ RING 4
405 3 FQQQ RING 5
406 3 FQQQ RING 6
407 3 FQQQ RING 7
408 3 FQQQ RING 8
409 3 FQQQ RING 9
410 3 FQQQ RING 10
411 3 FQQQ RING 11
412 3 FQQQ RING 12
413 3 FQQQ RING 13
414 3 FQQQ RING 14
415 3 FQQQ RING 15
416 0 blank blank 0
417 0 blank blank 1
418 0 blank blank 2
419 0 blank blank 3
420 0 blank blank 4
421 0 blank blank 5
422 0 blank blank 6
423 0 blank blank 7
424 0 blank blank 8
425 0 blank blank 9
426 0 blank blank 10
427 0 blank blank 11
428 0 blank blank 12
429 0 blank blank 13
430 0 blank blank 14
431 0 blank blank 15
432 0 blank blank 0
433 0 blank blank 1
434 0 blank blank 2
435 0 blank blank 3
436 0 blank blank 4
437 0 blank blank 5
438 0 blank blank 6
439 0 blank blank 7
440 0 blank blank 8
441 0 blank blank 9
442 0 blank blank 10
443 0 blank blank 11
444 0 blank blank 12
445 0 blank blank 13
446 0 blank blank 14
447 0 blank blank 15
448 0 PC CATHODE 16
449 0 PC CATHODE 17
450 0 PC CATHODE 18
451 0 PC CATHODE 19
452 0 PC CATHODE 20
453 0 PC CATHODE 21
454 0 PC CATHODE 22
455 0 PC CATHODE 23
457 0 PC ANODE 16
458 0 PC ANODE 17
459 0 PC ANODE 18
460 0 PC ANODE 19
461 0 PC ANODE 20
462 0 PC ANODE 21
463 0 PC ANODE 22
464 0 PC ANODE 23
465 0 PC ANODE 0
466 0 PC ANODE 1
467 0 PC ANODE 2
468 0 PC ANODE 3
469 0 PC ANODE 4
470 0 PC ANODE 5
471 0 PC ANODE 6
472 0 PC ANODE 7
473 0 PC ANODE 8
474 0 PC ANODE 9
475 0 PC ANODE 10
476 0 PC ANODE 11
477 0 PC ANODE 12
478 0 PC ANODE 13
479 0 PC ANODE 14
480 0 PC ANODE 15
481 0 PC CATHODE 0
482 0 PC CATHODE 1
483 0 PC CATHODE 2
484 0 PC CATHODE 3
485 0 PC CATHODE 4
486 0 PC CATHODE 5
487 0 PC CATHODE 6
488 0 PC CATHODE 7
489 0 PC CATHODE 8
490 0 PC CATHODE 9
491 0 PC CATHODE 10
492 0 PC CATHODE 11
493 0 PC CATHODE 12
494 0 PC CATHODE 13
495 0 PC CATHODE 14
496 0 PC CATHODE 15

View File

@ -1,57 +0,0 @@
#define ryanSelector_cxx
#include "ryanSelector.h"
#include <TH1.h>
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <vector>
#include <utility>
const std::map<int, unsigned short> board = {
{0, 17122}, // id, sn
{1, 17123},
{2, 22320},
{3, 22130},
{4, 22129},
{5, 15529},
{6, 15528},
{7, 379},
{8, 409},
{9, 405}
};
const int nBd = board.size();
void ryanSelector::Begin(TTree * /*tree*/){
TString option = GetOption();
}
void ryanSelector::SlaveBegin(TTree * /*tree*/){
TString option = GetOption();
}
Bool_t ryanSelector::Process(Long64_t entry){
b_sn->GetEntry(entry);
b_e_t->GetEntry(entry);
return kTRUE;
}
void ryanSelector::SlaveTerminate(){
}
void ryanSelector::Terminate(){
// TCanvas * canvas = new TCanvas("c1", "c1", 800, 600);
}

View File

@ -1,130 +0,0 @@
//////////////////////////////////////////////////////////
// This class has been automatically generated on
// Mon Jan 22 14:02:44 2024 by ROOT version 6.26/04
// from TTree tree/pulsertest_018_10000_noTrace.root
// found on file: pulsertest_018_10000_noTrace.root
//////////////////////////////////////////////////////////
#ifndef ryanSelector_h
#define ryanSelector_h
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TSelector.h>
#include <TMath.h>
#define MAXMULTI 500
// Header file for the classes stored in the TTree if any.
class ryanSelector : public TSelector {
public :
TTree *fChain; //!pointer to the analyzed TTree or TChain
// Fixed size dimensions of array or collections stored in the TTree if any.
// Declaration of leaf types
ULong64_t evID;
UInt_t multi;
UShort_t sn[MAXMULTI]; //[multi]
UShort_t ch[MAXMULTI]; //[multi]
UShort_t e[MAXMULTI]; //[multi]
UShort_t e2[MAXMULTI]; //[multi]
ULong64_t e_t[MAXMULTI]; //[multi]
UShort_t e_f[MAXMULTI]; //[multi]
// List of branches
TBranch *b_event_ID; //!
TBranch *b_multi; //!
TBranch *b_sn; //!
TBranch *b_ch; //!
TBranch *b_e; //!
TBranch *b_e2; //!
TBranch *b_e_t; //!
TBranch *b_e_f; //!
ryanSelector(TTree * /*tree*/ =0) : fChain(0) { }
virtual ~ryanSelector() { }
virtual Int_t Version() const { return 2; }
virtual void Begin(TTree *tree);
virtual void SlaveBegin(TTree *tree);
virtual void Init(TTree *tree);
virtual Bool_t Notify();
virtual Bool_t Process(Long64_t entry);
virtual Int_t GetEntry(Long64_t entry, Int_t getall = 0) { return fChain ? fChain->GetTree()->GetEntry(entry, getall) : 0; }
virtual void SetOption(const char *option) { fOption = option; }
virtual void SetObject(TObject *obj) { fObject = obj; }
virtual void SetInputList(TList *input) { fInput = input; }
virtual TList *GetOutputList() const { return fOutput; }
virtual void SlaveTerminate();
virtual void Terminate();
ClassDef(ryanSelector,0);
//===============================
TFile * saveFile;
TTree * newTree;
TString saveFileName;
int totnumEntry; // of original root
//tree
ULong_t eventID;
UShort_t run;
UInt_t multi;
UShort_t snC[MAXMULTI];
UShort_t chC[MAXMULTI];
Float_t eC[MAXMULTI];
ULong64_t eC_t[MAXMULTI];
};
#endif
#ifdef ryanSelector_cxx
void ryanSelector::Init(TTree *tree){
if (!tree) return;
//======================================
totnumEntry = tree->GetEntries();
printf( "===================================== \n");
printf( "====== total Entry : %d \n", totnumEntry);
printf( "===================================== \n");
fChain = tree;
fChain->SetMakeClass(1);
fChain->SetBranchAddress("evID", &evID, &b_event_ID);
fChain->SetBranchAddress("multi", &multi, &b_multi);
fChain->SetBranchAddress("sn", sn, &b_sn);
fChain->SetBranchAddress("ch", ch, &b_ch);
fChain->SetBranchAddress("e", e, &b_e);
fChain->SetBranchAddress("e2", e2, &b_e2);
fChain->SetBranchAddress("e_t", e_t, &b_e_t);
fChain->SetBranchAddress("e_f", e_f, &b_e_f);
//====================== Create tree
newTree = new TTree("tree","tree");
eventID = -1;
run = 0;
newTree->Branch("eventID",&eventID,"eventID/l");
newTree->Branch("run", &run,"run/i");
newTree->Branch("mutli", &multi,"mutli/s");
newTree->Branch("sn" , snC, "sn/s");
newTree->Branch("ch" , chC, "ch/s");
newTree->Branch("e" , eC, "energy/F");
newTree->Branch("e_t" , eC_t, "timestamp/l");
}
Bool_t ryanSelector::Notify(){
return kTRUE;
}
#endif // #ifdef ryanSelector_cxx

View File

@ -3,9 +3,12 @@
#include <TGraph.h>
#include <TFile.h>
#include <TTree.h>
#include <TROOT.h>
#include <TString.h>
#include <TMath.h>
#include "mapping.h"
class PulserChecker {
public:
PulserChecker(int sn) : SN(sn){
@ -66,7 +69,7 @@ private:
};
void ryanScript(TString fileName, int maxEvent = -1){
void script(TString fileName, int maxEvent = -1){
/*
//+++++++++++++++++++++++++++++++++++++++++++
@ -145,8 +148,8 @@ void ryanScript(TString fileName, int maxEvent = -1){
file0->Close();
f1->Close();
*/
/*
//+++++++++++++++++++++++++++++++++++++++++++
printf("######### file : %s \n", fileName.Data());
TFile * file0 = new TFile(fileName);
@ -232,7 +235,8 @@ void ryanScript(TString fileName, int maxEvent = -1){
for( int i = 0; i< nBd; i++){
printf(" %5d | %16llu \n", stat[i]->getSN(), stat[i]->getTime0() - time0);
}
*/
//+++++++++++++++++++++++++++++++++++++++++++
}