Have the GeneralSort to be quite general. it depends on the Mapping.h
This commit is contained in:
parent
38cf50ce5c
commit
095818bfae
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
|
@ -75,7 +75,8 @@
|
||||||
"forward_list": "cpp",
|
"forward_list": "cpp",
|
||||||
"ChainMonitors.C": "cpp",
|
"ChainMonitors.C": "cpp",
|
||||||
"GeneralSortAgent.C": "cpp",
|
"GeneralSortAgent.C": "cpp",
|
||||||
"kaka.C": "cpp"
|
"kaka.C": "cpp",
|
||||||
|
"Rabbit.C": "cpp"
|
||||||
},
|
},
|
||||||
|
|
||||||
"better-comments.multilineComments": true,
|
"better-comments.multilineComments": true,
|
||||||
|
|
|
@ -5,54 +5,55 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
std::vector<int> ExtractDetNum(std::vector<std::vector<int>> mapping, std::vector<std::string> detName, std::vector<int> detMaxID){
|
|
||||||
std::vector<int> detNum;
|
int FindDetType(int detID, std::vector<int> detMaxID){
|
||||||
for( int i = 0; i < (int) detName.size(); i ++) detNum.push_back(0);
|
for( int k = 0; k < (int) detMaxID.size(); k++){
|
||||||
|
int low = (k == 0 ? 0 : detMaxID[k-1]);
|
||||||
|
int high = detMaxID[k];
|
||||||
|
if( low <= detID && detID < high ) {
|
||||||
|
return k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int> ExtractDetNum(std::vector<std::vector<int>> mapping, std::vector<std::string> detTypeName, std::vector<int> detMaxID){
|
||||||
|
std::vector<int> detTypeNum;
|
||||||
|
for( int i = 0; i < (int) detTypeName.size(); i ++) detTypeNum.push_back(0);
|
||||||
for( int i = 0; i < (int) mapping.size(); i ++){
|
for( int i = 0; i < (int) mapping.size(); i ++){
|
||||||
for( int j = 0; j < (int) mapping[i].size(); j++){
|
for( int j = 0; j < (int) mapping[i].size(); j++){
|
||||||
if( mapping[i][j] < 0) continue;
|
if( mapping[i][j] < 0) continue;
|
||||||
for( int k = 0; k < (int) detName.size() ; k ++ ){
|
for( int k = 0; k < (int) detTypeName.size() ; k ++ ){
|
||||||
int low = (k == 0 ? 0 : detMaxID[k-1]);
|
int low = (k == 0 ? 0 : detMaxID[k-1]);
|
||||||
int high = detMaxID[k];
|
int high = detMaxID[k];
|
||||||
if( low <= mapping[i][j] && mapping[i][j] < high ) {
|
if( low <= mapping[i][j] && mapping[i][j] < high ) {
|
||||||
detNum[k]++;
|
detTypeNum[k]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return detNum;
|
return detTypeNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintMapping(std::vector<std::vector<int>> mapping, std::vector<std::string> detName, std::vector<int> detMaxID){
|
void PrintMapping(std::vector<std::vector<int>> mapping, std::vector<std::string> detTypeName, std::vector<int> detMaxID){
|
||||||
|
|
||||||
//------------ Red Green Yellow Cyan
|
//------------ Red Green Yellow Cyan blue Magenta Gray
|
||||||
std::vector<const char* > Color = {"\033[31m", "\033[32m", "\033[33m", "\033[36m"};
|
std::vector<const char* > Color = {"\033[31m", "\033[32m", "\033[33m", "\033[36m", "\033[34m", "\033[35m", "\033[37m"};
|
||||||
|
|
||||||
printf("==================================== Mapping ===================================\n");
|
printf("==================================== Mapping ===================================\n");
|
||||||
std::vector<int> detNum = ExtractDetNum(mapping, detName, detMaxID);
|
std::vector<int> detTypeNum = ExtractDetNum(mapping, detTypeName, detMaxID);
|
||||||
for(int i = 0 ; i < (int) detName.size(); i++) {
|
for(int i = 0 ; i < (int) detTypeName.size(); i++) {
|
||||||
printf(" %2d | %7s | %3d | %3d - %3d\n", i, detName[i].c_str(), detNum[i], (i == 0 ? 0 : detMaxID[i-1]), detMaxID[i]);
|
printf(" %2d | %7s | %3d | %3d - %3d\n", i, detTypeName[i].c_str(), detTypeNum[i], (i == 0 ? 0 : detMaxID[i-1]), detMaxID[i]);
|
||||||
}
|
}
|
||||||
for( int i = 0; i < (int) mapping.size(); i++){
|
for( int i = 0; i < (int) mapping.size(); i++){
|
||||||
printf("Digi-%d ------------------------------------------------------------------------ \n", i);
|
printf("Digi-%d ------------------------------------------------------------------------ \n", i);
|
||||||
int colorIndex = -1;
|
|
||||||
for( int j = 0; j < (int) mapping[i].size(); j++){
|
for( int j = 0; j < (int) mapping[i].size(); j++){
|
||||||
if( mapping[i][j] < 0 ){
|
if( mapping[i][j] < 0 ){
|
||||||
printf("%4d,", mapping[i][j]);
|
printf("%4d,", mapping[i][j]);
|
||||||
}else{
|
}else{
|
||||||
for( int k = 0; k < (int) detName.size() ; k ++ ){
|
int colorIndex = FindDetType(mapping[i][j], detMaxID);
|
||||||
int low = (k == 0 ? 0 : detMaxID[k-1]);
|
|
||||||
int high = detMaxID[k];
|
|
||||||
if( low <= mapping[i][j] && mapping[i][j] < high ) {
|
|
||||||
if( k == 0 ) {
|
|
||||||
colorIndex = (colorIndex + 1) % 3;
|
|
||||||
}else{
|
|
||||||
colorIndex = 3;
|
|
||||||
}
|
|
||||||
printf("%s%4d\033[0m,", Color[colorIndex], mapping[i][j]);
|
printf("%s%4d\033[0m,", Color[colorIndex], mapping[i][j]);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if( j % 16 == 15 ) printf("\n");
|
if( j % 16 == 15 ) printf("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,28 +17,10 @@ Bool_t GeneralSort::Process(Long64_t entry){
|
||||||
if( entry < 2 ) printf("%s %lld\n", __func__, entry);
|
if( entry < 2 ) printf("%s %lld\n", __func__, entry);
|
||||||
|
|
||||||
///initialization
|
///initialization
|
||||||
for( int i = 0; i < detNum[0]; i++){
|
for( int i = 0; i < nDetType; i++){
|
||||||
eE[i] = TMath::QuietNaN();
|
for( int j = 0; j < detNum[i]; j++){
|
||||||
xf[i] = TMath::QuietNaN();
|
eE[i][j] = TMath::QuietNaN();
|
||||||
xn[i] = TMath::QuietNaN();
|
eT[i][j] = 0;
|
||||||
eT [i] = 0;
|
|
||||||
xfT[i] = 0;
|
|
||||||
xnT[i] = 0;
|
|
||||||
|
|
||||||
if( isTraceExist && traceMethod > 0 ){
|
|
||||||
teE[i] = TMath::QuietNaN();
|
|
||||||
teT[i] = TMath::QuietNaN();
|
|
||||||
teR[i] = TMath::QuietNaN();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for( int i = 0; i < detNum[1]; i++){
|
|
||||||
rdt[i] = TMath::QuietNaN();
|
|
||||||
rdtT[i] = 0;
|
|
||||||
if( isTraceExist && traceMethod > 0 ){
|
|
||||||
trdt[i] = TMath::QuietNaN();
|
|
||||||
trdtT[i] = TMath::QuietNaN();
|
|
||||||
trdtR[i] = TMath::QuietNaN();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,41 +32,25 @@ Bool_t GeneralSort::Process(Long64_t entry){
|
||||||
b_e->GetEntry(entry);
|
b_e->GetEntry(entry);
|
||||||
b_e_t->GetEntry(entry);
|
b_e_t->GetEntry(entry);
|
||||||
|
|
||||||
|
|
||||||
for( int i = 0 ; i < multi; i++){
|
for( int i = 0 ; i < multi; i++){
|
||||||
int detID = mapping[bd[i]][ch[i]];
|
int detID = mapping[bd[i]][ch[i]];
|
||||||
int kindIndex = -1;
|
int detType = FindDetType(detID, detMaxID);
|
||||||
|
|
||||||
for( int g = 0; g < (int) detMaxID.size(); g ++){
|
int low = (i == 0 ? 0 : detMaxID[detType-1]);
|
||||||
int low = ( g == 0 ? 0 : detMaxID[g-1]);
|
|
||||||
int high = detMaxID[g];
|
|
||||||
|
|
||||||
if( low <= detID && detID < high ){
|
int reducedDetID = detID - low;
|
||||||
|
|
||||||
//************** array
|
eE[detType][reducedDetID] = e[i] * detParity[detType];
|
||||||
if( g == 0 ){
|
eT[detType][reducedDetID] = e_t[i];
|
||||||
kindIndex = (kindIndex + 1) % 3;
|
|
||||||
switch (kindIndex){
|
|
||||||
case 0 : { eE[detID] = e[i] * detParity[g]; eT[detID] = e_t[i]; } break;
|
|
||||||
case 1 : { xf[detID] = e[i] * detParity[g]; xfT[detID] = e_t[i]; } break;
|
|
||||||
case 2 : { xn[detID] = e[i] * detParity[g]; xnT[detID] = e_t[i]; } break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//************** rdt
|
|
||||||
if( g == 1 ){
|
|
||||||
detID = detID - detMaxID[g-1];
|
|
||||||
rdt[detID] = e[i] * detParity[g]; rdtT[detID] = e_t[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if( isTraceExist && traceMethod >= 0 ){
|
if( isTraceExist && traceMethod >= 0 ){
|
||||||
|
|
||||||
|
b_tl->GetEntry(entry);
|
||||||
|
b_trace->GetEntry(entry);
|
||||||
|
|
||||||
int countTrace = 0;
|
int countTrace = 0;
|
||||||
|
|
||||||
arr->Clear("C");
|
arr->Clear("C");
|
||||||
|
@ -92,11 +58,21 @@ Bool_t GeneralSort::Process(Long64_t entry){
|
||||||
for( int i = 0; i < multi; i++){
|
for( int i = 0; i < multi; i++){
|
||||||
int detID = mapping[bd[i]][ch[i]];
|
int detID = mapping[bd[i]][ch[i]];
|
||||||
|
|
||||||
}
|
int traceLength = tl[i];
|
||||||
|
gTrace = (TGraph*) arr->ConstructedAt(countTrace, "C");
|
||||||
|
gTrace->Clear();
|
||||||
|
gTrace->Set(traceLength);
|
||||||
|
|
||||||
|
gTrace->SetTitle(Form("ev:%llu,nHit:%d,id:%d,len:%d", evID, i, detID, traceLength));
|
||||||
|
countTrace ++;
|
||||||
|
|
||||||
|
for( int k = 0 ; k < traceLength; k++){
|
||||||
|
gTrace->SetPoint(k, k, trace[i][k]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
newTree->Fill();
|
newTree->Fill();
|
||||||
|
|
||||||
|
@ -108,10 +84,13 @@ void GeneralSort::Terminate(){
|
||||||
|
|
||||||
printf("========================= %s\n", __func__);
|
printf("========================= %s\n", __func__);
|
||||||
|
|
||||||
TString option = GetOption();
|
DecodeOption();
|
||||||
TObjArray * tokens = option.Tokenize(",");
|
|
||||||
traceMethod = ((TObjString*) tokens->At(0))->String().Atoi();
|
if( !isParallel){
|
||||||
saveFileName = ((TObjString*) tokens->At(1))->String();
|
saveFile->cd();
|
||||||
|
newTree->Write();
|
||||||
|
saveFile->Close();
|
||||||
|
}
|
||||||
|
|
||||||
//get entries
|
//get entries
|
||||||
saveFile = TFile::Open(saveFileName);
|
saveFile = TFile::Open(saveFileName);
|
||||||
|
@ -134,7 +113,8 @@ void GeneralSort::Begin(TTree * tree){
|
||||||
printf( "===================== SOLARIS GeneralSort.C =================\n");
|
printf( "===================== SOLARIS GeneralSort.C =================\n");
|
||||||
printf( "=================================================================\n");
|
printf( "=================================================================\n");
|
||||||
|
|
||||||
PrintMapping(mapping, detName, detMaxID);
|
PrintMapping(mapping, detTypeName, detMaxID);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,9 +124,14 @@ void GeneralSort::SlaveBegin(TTree * /*tree*/){
|
||||||
}
|
}
|
||||||
|
|
||||||
void GeneralSort::SlaveTerminate(){
|
void GeneralSort::SlaveTerminate(){
|
||||||
|
|
||||||
printf("%s\n", __func__);
|
printf("%s\n", __func__);
|
||||||
|
|
||||||
|
if( isParallel){
|
||||||
saveFile->cd();
|
saveFile->cd();
|
||||||
newTree->Write();
|
newTree->Write();
|
||||||
fOutput->Add(proofFile);
|
fOutput->Add(proofFile);
|
||||||
saveFile->Close();
|
saveFile->Close();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -82,6 +82,9 @@ public :
|
||||||
isTraceExist = false;
|
isTraceExist = false;
|
||||||
traceMethod = 0; // -1 = ignore trace, 0 = no trace fit, 1 = fit, 2 = trapezoid
|
traceMethod = 0; // -1 = ignore trace, 0 = no trace fit, 1 = fit, 2 = trapezoid
|
||||||
|
|
||||||
|
isParallel = false;
|
||||||
|
detNum.clear();
|
||||||
|
nDetType = 0;
|
||||||
}
|
}
|
||||||
virtual ~GeneralSort() { }
|
virtual ~GeneralSort() { }
|
||||||
virtual Int_t Version() const { return 2; }
|
virtual Int_t Version() const { return 2; }
|
||||||
|
@ -107,24 +110,19 @@ public :
|
||||||
void PrintTraceMethod();
|
void PrintTraceMethod();
|
||||||
|
|
||||||
std::vector<int> detNum;
|
std::vector<int> detNum;
|
||||||
|
int nDetType;
|
||||||
|
|
||||||
|
void SetUpTree();
|
||||||
|
void DecodeOption();
|
||||||
|
bool isParallel;
|
||||||
|
|
||||||
TString saveFileName;
|
TString saveFileName;
|
||||||
TFile * saveFile; //!
|
TFile * saveFile; //!
|
||||||
TProofOutputFile * proofFile; //!
|
TProofOutputFile * proofFile; //!
|
||||||
TTree * newTree; //!
|
TTree * newTree; //!
|
||||||
|
|
||||||
//TODO ---- 2D array
|
Float_t ** eE; //!
|
||||||
Float_t *eE; //!
|
ULong64_t ** eT; //!
|
||||||
ULong64_t *eT; //!
|
|
||||||
|
|
||||||
Float_t *xf ; //!
|
|
||||||
ULong64_t *xfT; //!
|
|
||||||
|
|
||||||
Float_t *xn ; //!
|
|
||||||
ULong64_t *xnT; //!
|
|
||||||
|
|
||||||
Float_t *rdt ; //!
|
|
||||||
ULong64_t *rdtT; //!
|
|
||||||
|
|
||||||
//trace
|
//trace
|
||||||
TClonesArray * arr ;//!
|
TClonesArray * arr ;//!
|
||||||
|
@ -132,13 +130,10 @@ public :
|
||||||
TClonesArray * arrTrapezoid ;//!
|
TClonesArray * arrTrapezoid ;//!
|
||||||
TGraph * gTrapezoid; //!
|
TGraph * gTrapezoid; //!
|
||||||
|
|
||||||
Float_t *teE; //!
|
//trace energy, trigger time, rise time
|
||||||
Float_t *teT; //!
|
Float_t **teE; //!
|
||||||
Float_t *teR; //!
|
Float_t **teT; //!
|
||||||
|
Float_t **teR; //!
|
||||||
Float_t *trdt ; //!
|
|
||||||
Float_t *trdtT ; //!
|
|
||||||
Float_t *trdtR ; //!
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -146,6 +141,96 @@ public :
|
||||||
|
|
||||||
#ifdef GeneralSort_cxx
|
#ifdef GeneralSort_cxx
|
||||||
|
|
||||||
|
//^##############################################################
|
||||||
|
void GeneralSort::SetUpTree(){
|
||||||
|
|
||||||
|
printf("%s\n", __func__);
|
||||||
|
|
||||||
|
if( isParallel){
|
||||||
|
proofFile = new TProofOutputFile(saveFileName, "M");
|
||||||
|
saveFile = proofFile->OpenFile("RECREATE");
|
||||||
|
}else{
|
||||||
|
saveFile = new TFile(saveFileName,"RECREATE");
|
||||||
|
}
|
||||||
|
|
||||||
|
newTree = new TTree("gen_tree", "Tree After GeneralSort");
|
||||||
|
newTree->SetDirectory(saveFile);
|
||||||
|
newTree->AutoSave();
|
||||||
|
|
||||||
|
detNum = ExtractDetNum(mapping, detTypeName, detMaxID);
|
||||||
|
|
||||||
|
nDetType = (int) detTypeName.size();
|
||||||
|
|
||||||
|
eE = new Float_t * [nDetType];
|
||||||
|
eT = new ULong64_t * [nDetType];
|
||||||
|
|
||||||
|
for( int i = 0 ; i < nDetType; i++){
|
||||||
|
eE[i] = new Float_t[detNum[i]];
|
||||||
|
eT[i] = new ULong64_t[detNum[i]];
|
||||||
|
|
||||||
|
for( int j = 0; j < detNum[i]; j++){
|
||||||
|
eE[i][j] = TMath::QuietNaN();
|
||||||
|
eT[i][j] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
newTree->Branch( detTypeName[i].c_str(), eE[i], Form("%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
|
||||||
|
newTree->Branch( (detTypeName[i]+"_t").c_str(), eT[i], Form("%s_Timestamp[%d]/l", detTypeName[i].c_str(), detNum[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if( isTraceExist && traceMethod >= 0){
|
||||||
|
|
||||||
|
arr = new TClonesArray("TGraph");
|
||||||
|
|
||||||
|
newTree->Branch("trace", arr, 256000);
|
||||||
|
arr->BypassStreamer();
|
||||||
|
|
||||||
|
if( traceMethod > 0 ){
|
||||||
|
|
||||||
|
teE = new Float_t * [nDetType];
|
||||||
|
teT = new Float_t * [nDetType];
|
||||||
|
teR = new Float_t * [nDetType];
|
||||||
|
|
||||||
|
for( int i = 0 ; i < nDetType; i++){
|
||||||
|
teE[i] = new Float_t[detNum[i]];
|
||||||
|
teT[i] = new Float_t[detNum[i]];
|
||||||
|
teR[i] = new Float_t[detNum[i]];
|
||||||
|
|
||||||
|
for( int j = 0; j < detNum[i]; j++){
|
||||||
|
teE[i][j] = TMath::QuietNaN();
|
||||||
|
teT[i][j] = TMath::QuietNaN();
|
||||||
|
teR[i][j] = TMath::QuietNaN();
|
||||||
|
}
|
||||||
|
|
||||||
|
newTree->Branch( ("t" + detTypeName[i]).c_str(), teE[i], Form("trace_%s[%d]/F", detTypeName[i].c_str(), detNum[i]));
|
||||||
|
newTree->Branch( ("t" + detTypeName[i]+"_t").c_str(), teT[i], Form("trace_%s_time[%d]/l", detTypeName[i].c_str(), detNum[i]));
|
||||||
|
newTree->Branch( ("t" + detTypeName[i]+"_r").c_str(), teR[i], Form("trace_%s_rise[%d]/l", detTypeName[i].c_str(), detNum[i]));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//^##############################################################
|
||||||
|
void GeneralSort::DecodeOption(){
|
||||||
|
TString option = GetOption();
|
||||||
|
if( option != ""){
|
||||||
|
TObjArray * tokens = option.Tokenize(",");
|
||||||
|
traceMethod = ((TObjString*) tokens->At(0))->String().Atoi();
|
||||||
|
saveFileName = ((TObjString*) tokens->At(1))->String();
|
||||||
|
isParallel = ((TObjString*) tokens->At(2))->String().Atoi();
|
||||||
|
}else{
|
||||||
|
traceMethod = -1;
|
||||||
|
saveFileName = "temp.root";
|
||||||
|
isParallel = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("|%s| %d %s %d \n", option.Data(), traceMethod, saveFileName.Data(), isParallel);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//^##############################################################
|
//^##############################################################
|
||||||
void GeneralSort::Init(TTree *tree){
|
void GeneralSort::Init(TTree *tree){
|
||||||
|
|
||||||
|
@ -179,10 +264,7 @@ void GeneralSort::Init(TTree *tree){
|
||||||
printf( "========== total Entry : %ld\n", NumEntries);
|
printf( "========== total Entry : %ld\n", NumEntries);
|
||||||
|
|
||||||
//########################### Get Option
|
//########################### Get Option
|
||||||
TString option = GetOption();
|
DecodeOption();
|
||||||
TObjArray * tokens = option.Tokenize(",");
|
|
||||||
traceMethod = ((TObjString*) tokens->At(0))->String().Atoi();
|
|
||||||
saveFileName = ((TObjString*) tokens->At(1))->String();
|
|
||||||
|
|
||||||
if( isTraceExist ){
|
if( isTraceExist ){
|
||||||
PrintTraceMethod();
|
PrintTraceMethod();
|
||||||
|
@ -190,65 +272,7 @@ void GeneralSort::Init(TTree *tree){
|
||||||
printf("++++++++ no Trace found\n");
|
printf("++++++++ no Trace found\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
proofFile = new TProofOutputFile(saveFileName, "M");
|
SetUpTree();
|
||||||
saveFile = proofFile->OpenFile("RECREATE");
|
|
||||||
|
|
||||||
newTree = new TTree("gen_tree", "Tree After GeneralSort");
|
|
||||||
newTree->SetDirectory(saveFile);
|
|
||||||
newTree->AutoSave();
|
|
||||||
|
|
||||||
detNum = ExtractDetNum(mapping, detName, detMaxID);
|
|
||||||
|
|
||||||
eE = new Float_t[detNum[0]];
|
|
||||||
xf = new Float_t[detNum[0]];
|
|
||||||
xn = new Float_t[detNum[0]];
|
|
||||||
eT = new ULong64_t[detNum[0]];
|
|
||||||
xfT = new ULong64_t[detNum[0]];
|
|
||||||
xnT = new ULong64_t[detNum[0]];
|
|
||||||
|
|
||||||
rdt = new Float_t[detNum[1]];
|
|
||||||
rdtT = new ULong64_t[detNum[1]];
|
|
||||||
|
|
||||||
newTree->Branch("e", eE, Form("Energy[%d]/F", detNum[0]));
|
|
||||||
newTree->Branch("e_t", eT, Form("Energy_Timestamp[%d]/l", detNum[0]));
|
|
||||||
|
|
||||||
newTree->Branch("xf", xf, Form("XF[%d]/F", detNum[0]));
|
|
||||||
newTree->Branch("xf_t", xfT, Form("XF_Timestamp[%d]/l", detNum[0]));
|
|
||||||
|
|
||||||
newTree->Branch("xn", xn, Form("XN[%d]/F", detNum[0]));
|
|
||||||
newTree->Branch("xn_t", xnT, Form("XN_Timestamp[%d]/l", detNum[0]));
|
|
||||||
|
|
||||||
newTree->Branch("rdt", rdt, Form("Recoil[%d]/F", detNum[1]));
|
|
||||||
newTree->Branch("rdt_t", rdtT, Form("Recoil_Timestamp[%d]/l", detNum[1]));
|
|
||||||
|
|
||||||
if( isTraceExist && traceMethod >= 0){
|
|
||||||
|
|
||||||
arr = new TClonesArray("TGraph");
|
|
||||||
|
|
||||||
newTree->Branch("trace", arr, 256000);
|
|
||||||
arr->BypassStreamer();
|
|
||||||
|
|
||||||
if( traceMethod > 0 ){
|
|
||||||
|
|
||||||
teE = new Float_t[detNum[0]];
|
|
||||||
teT = new Float_t[detNum[0]];
|
|
||||||
teR = new Float_t[detNum[0]];
|
|
||||||
|
|
||||||
trdt = new Float_t[detNum[1]];
|
|
||||||
trdtT = new Float_t[detNum[1]];
|
|
||||||
trdtR = new Float_t[detNum[1]];
|
|
||||||
|
|
||||||
newTree->Branch("te", teE, Form("Trace_Energy[%d]/F", detNum[0]));
|
|
||||||
newTree->Branch("te_t", teT, Form("Trace_Energy_Time[%d]/F", detNum[0]));
|
|
||||||
newTree->Branch("te_r", teR, Form("Trace_Energy_RiseTime[%d]/F", detNum[0]));
|
|
||||||
|
|
||||||
newTree->Branch("trdt", trdt , Form("Trace_RDT[%d]/F", detNum[1]));
|
|
||||||
newTree->Branch("trdt_t", trdtT, Form("Trace_RDT_Time[%d]/F", detNum[1]));
|
|
||||||
newTree->Branch("trdt_r", trdtR, Form("Trace_RDT_RiseTime[%d]/F", detNum[1]));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
printf("---- end of Init %s\n ", __func__);
|
printf("---- end of Init %s\n ", __func__);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
#include "TProof.h"
|
#include "TProof.h"
|
||||||
#include "TChain.h"
|
#include "TChain.h"
|
||||||
|
|
||||||
void GeneralSortAgent(Int_t runNum, int nWorker = 1, int traceMethod = 0){
|
void GeneralSortAgent(Int_t runNum, int nWorker = 1, int traceMethod = -1){
|
||||||
|
|
||||||
TString name;
|
TString name;
|
||||||
name.Form("../root_data/run%03d.root", runNum);
|
name.Form("../root_data/run%03d.root", runNum);
|
||||||
|
@ -15,18 +15,24 @@ void GeneralSortAgent(Int_t runNum, int nWorker = 1, int traceMethod = 0){
|
||||||
|
|
||||||
printf("----------------------------\n");
|
printf("----------------------------\n");
|
||||||
|
|
||||||
|
//this is the option for TSelector, the first one is traceMethod, 2nd is save fileName;
|
||||||
|
TString option;
|
||||||
|
|
||||||
|
if( nWorker == 1){
|
||||||
|
|
||||||
|
option.Form("%d,../root_data/gen_run%03d.root,%d", traceMethod, runNum, 0);
|
||||||
|
chain->Process("../armory/GeneralSort.C+", option);
|
||||||
|
|
||||||
|
}else{
|
||||||
|
|
||||||
TProof * p = TProof::Open("", Form("workers=%d", abs(nWorker)));
|
TProof * p = TProof::Open("", Form("workers=%d", abs(nWorker)));
|
||||||
p->ShowCache();
|
p->ShowCache();
|
||||||
printf("----------------------------\n");
|
printf("----------------------------\n");
|
||||||
|
|
||||||
TString option;
|
|
||||||
|
|
||||||
//this is the option for TSelector, the first one is traceMethod, 2nd is save fileName;
|
|
||||||
option.Form("%d,../root_data/gen_run%03d.root", traceMethod, runNum);
|
|
||||||
|
|
||||||
chain->SetProof();
|
chain->SetProof();
|
||||||
|
option.Form("%d,../root_data/gen_run%03d.root,%d", traceMethod, runNum, 1);
|
||||||
chain->Process("../armory/GeneralSort.C+", option);
|
chain->Process("../armory/GeneralSort.C+", option);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -72,7 +72,7 @@ else
|
||||||
mkdir ~/.proof/armory
|
mkdir ~/.proof/armory
|
||||||
cp ${SOLARISANADIR}/armory/AnalysisLib.h ~/.proof/armory/.
|
cp ${SOLARISANADIR}/armory/AnalysisLib.h ~/.proof/armory/.
|
||||||
|
|
||||||
root -l -q -b "${SOLARISANADIR}/armory/GeneralSortAgent.C($runNum, ${nWorker})"
|
root -l -q -b "${SOLARISANADIR}/armory/GeneralSortAgent.C($runNum, ${nWorker}, 0)"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
#################################### Monitor
|
#################################### Monitor
|
||||||
|
|
|
@ -7,8 +7,10 @@
|
||||||
//^ If this file is modified, please Close Digitizer and Open again
|
//^ If this file is modified, please Close Digitizer and Open again
|
||||||
//^-------------------------------------------------------------------------------
|
//^-------------------------------------------------------------------------------
|
||||||
//^
|
//^
|
||||||
//^ Array : 0 - 99
|
//^ Array-e : 0 - 99
|
||||||
//^ Recoil : 100 - 199
|
//^ Array-xf : 100 - 199
|
||||||
|
//^ Array-xn : 200 - 299
|
||||||
|
//^ Recoil : 300 - 399
|
||||||
//^
|
//^
|
||||||
//^ line comment is '//^'
|
//^ line comment is '//^'
|
||||||
//^
|
//^
|
||||||
|
@ -17,40 +19,43 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
const std::vector<std::string> detName = {"Array", "Recoil"}; //C= The comment "//C=" is an indicator DON't Remove
|
const std::vector<std::string> detTypeName = { "e", "xf", "xn", "rdt"}; //C= The comment "//C=" is an indicator DON't Remove
|
||||||
const std::vector<int> detMaxID = { 100, 200}; //C# The comment "//C#" is an indicator DON't Remove
|
const std::vector<int> detGroupID = { 0, 0, 0, 1}; //C& The comment "//C&" is an indicator DON't Remove
|
||||||
const std::vector<int> detParity = { 1, 1};
|
const std::vector<int> detMaxID = { 100, 200, 300, 400}; //C# The comment "//C#" is an indicator DON't Remove
|
||||||
|
const std::vector<int> detParity = { 1, 1, 1, 1};
|
||||||
|
|
||||||
|
const std::vector<std::string> groupName = { "Array", "Recoil"}; //C% The comment "//C%" is an indicator DON't Remove
|
||||||
|
|
||||||
//!The mapping[i] must match as the IP setting in the DAQ
|
//!The mapping[i] must match as the IP setting in the DAQ
|
||||||
|
|
||||||
const std::vector<std::vector<int>> mapping = {
|
const std::vector<std::vector<int>> mapping = {
|
||||||
{
|
{
|
||||||
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
||||||
0, 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, -1, /// 0 - 15
|
0, 100, 200, 1, 101, 201, 2, 102, 202, 3, 103, 203, 4, 104, 204, -1, /// 0 - 15
|
||||||
5, 5, 5, 6, 6, 6, 7, 7, 7, 8, 8, 8, 9, 9, 9, -1, /// 16 - 31
|
5, 105, 205, 6, 106, 206, 7, 107, 207, 8, 108, 208, 9, 109, 209, -1, /// 16 - 31
|
||||||
10, 10, 10, 11, 11, 11, 12, 12, 12, 13, 13, 13, 14, 14, 14, -1, /// 32 - 47
|
10, 110, 210, 11, 111, 211, 12, 112, 212, 13, 113, 213, 14, 114, 214, -1, /// 32 - 47
|
||||||
15, 15, 15, 16, 16, 16, 17, 17, 17, 18, 18, 18, 19, 19, 19, -1 /// 48 - 63
|
15, 115, 215, 16, 116, 216, 17, 117, 217, 18, 118, 218, 19, 119, 219, -1 /// 48 - 63
|
||||||
//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
||||||
},
|
},
|
||||||
//^{
|
|
||||||
//^//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
|
||||||
//^ 20, 20, 20, 21, 21, 21, 22, 22, 22, 23, 23, 23, 24, 24, 24, -1, /// 0 - 15
|
|
||||||
//^ 25, 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, -1, /// 16 - 31
|
|
||||||
//^ 30, 30, 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 34, -1, /// 32 - 47
|
|
||||||
//^ 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 39, -1 /// 48 - 63
|
|
||||||
//^//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
|
||||||
//^},
|
|
||||||
//^{
|
|
||||||
//^//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
|
||||||
//^ 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 44, -1, /// 0 - 15
|
|
||||||
//^ 45, 45, 45, 46, 46, 46, 47, 47, 47, 48, 48, 48, 49, 49, 49, -1, /// 16 - 31
|
|
||||||
//^ 50, 50, 50, 51, 51, 51, 52, 52, 52, 53, 53, 53, 54, 54, 54, -1, /// 32 - 47
|
|
||||||
//^ 55, 55, 55, 56, 56, 56, 57, 57, 57, 58, 58, 58, 59, 59, 59, -1 /// 48 - 63
|
|
||||||
//^//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
|
||||||
//^},
|
|
||||||
{
|
{
|
||||||
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
||||||
100, 101, 102, 103, 104, 105, 106, 107, -1, -1, -1, -1, -1, -1, -1, -1, /// 0 - 15
|
20, 120, 220, 21, 121, 221, 22, 122, 222, 23, 123, 223, 24, 124, 224, -1, /// 0 - 15
|
||||||
|
25, 125, 225, 26, 126, 226, 27, 127, 227, 28, 128, 228, 29, 129, 229, -1, /// 16 - 31
|
||||||
|
30, 130, 230, 31, 131, 231, 32, 132, 232, 33, 133, 233, 34, 134, 234, -1, /// 32 - 47
|
||||||
|
35, 135, 235, 36, 136, 236, 37, 137, 237, 38, 138, 238, 39, 139, 239, -1 /// 48 - 63
|
||||||
|
//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
||||||
|
},
|
||||||
|
{
|
||||||
|
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
||||||
|
40, 140, 240, 41, 141, 241, 42, 142, 242, 43, 143, 243, 44, 144, 244, -1, /// 0 - 15
|
||||||
|
45, 145, 245, 46, 146, 246, 47, 147, 247, 48, 148, 248, 49, 149, 249, -1, /// 16 - 31
|
||||||
|
50, 150, 250, 51, 151, 251, 52, 152, 252, 53, 153, 253, 54, 154, 254, -1, /// 32 - 47
|
||||||
|
55, 155, 255, 56, 156, 256, 57, 157, 257, 58, 158, 258, 59, 159, 259, -1 /// 48 - 63
|
||||||
|
//C------------- end of a digitizer // this line is an indicator DON'T Remove "//C-" is an indcator
|
||||||
|
},
|
||||||
|
{
|
||||||
|
//C 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 // this line is an indicator DON'T Remove "//C " is an indcator
|
||||||
|
300, 301, 302, 303, 304, 305, 306, 307, -1, -1, -1, -1, -1, -1, -1, -1, /// 0 - 15
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /// 16 - 31
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /// 16 - 31
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /// 32 - 47
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, /// 32 - 47
|
||||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /// 48 - 63
|
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /// 48 - 63
|
||||||
|
|
Loading…
Reference in New Issue
Block a user