bugfix on EventBuilder
This commit is contained in:
parent
c13738e699
commit
6b7f165ac2
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
#include "../mapping.h"
|
#include "../mapping.h"
|
||||||
|
|
||||||
#define MAXMULTI 200
|
#define MAXMULTI 100
|
||||||
|
|
||||||
int main(int argn, char **argv){
|
int main(int argn, char **argv){
|
||||||
printf("=====================================\n");
|
printf("=====================================\n");
|
||||||
|
@ -65,7 +65,7 @@ int main(int argn, char **argv){
|
||||||
printf(">>> Buidling Index using the timestamp\n");
|
printf(">>> Buidling Index using the timestamp\n");
|
||||||
tree->BuildIndex("e_t");
|
tree->BuildIndex("e_t");
|
||||||
TTreeIndex *in = (TTreeIndex*) tree->GetTreeIndex();
|
TTreeIndex *in = (TTreeIndex*) tree->GetTreeIndex();
|
||||||
Long64_t * index = in->GetIndex();
|
Long64_t * index = in->GetIndex();
|
||||||
|
|
||||||
ULong64_t time0; //time-0 for each event
|
ULong64_t time0; //time-0 for each event
|
||||||
int timeDiff;
|
int timeDiff;
|
||||||
|
@ -91,9 +91,9 @@ int main(int argn, char **argv){
|
||||||
Int_t multiCry = 0 ; /// thi is total multiplicity for all crystal
|
Int_t multiCry = 0 ; /// thi is total multiplicity for all crystal
|
||||||
newtree->Branch("multiCry", &multiCry, "multiplicity_crystal/I");
|
newtree->Branch("multiCry", &multiCry, "multiplicity_crystal/I");
|
||||||
|
|
||||||
int id[MAXMULTI];
|
int id[MAXMULTI] = {0};
|
||||||
double e[MAXMULTI];
|
double e[MAXMULTI] = {TMath::QuietNaN()};
|
||||||
ULong64_t e_t[MAXMULTI];
|
ULong64_t e_t[MAXMULTI] = {0};
|
||||||
newtree->Branch("id", id, "id[multi]/I" );
|
newtree->Branch("id", id, "id[multi]/I" );
|
||||||
newtree->Branch("e", e, "e[multi]/D" );
|
newtree->Branch("e", e, "e[multi]/D" );
|
||||||
newtree->Branch("e_t", e_t, "e_timestamp[multi]/l");
|
newtree->Branch("e_t", e_t, "e_timestamp[multi]/l");
|
||||||
|
@ -103,9 +103,10 @@ int main(int argn, char **argv){
|
||||||
TStopwatch StpWatch;
|
TStopwatch StpWatch;
|
||||||
StpWatch.Start();
|
StpWatch.Start();
|
||||||
|
|
||||||
|
int multiOverflow = 0;
|
||||||
|
|
||||||
for( Long64_t entry = 0; entry < totnumEntry; entry++){
|
for( Long64_t entry = 0; entry < totnumEntry; entry++){
|
||||||
|
|
||||||
|
|
||||||
/*********** Progress Bar ******************************************/
|
/*********** Progress Bar ******************************************/
|
||||||
if (entry>totnumEntry*Frac-1) {
|
if (entry>totnumEntry*Frac-1) {
|
||||||
TString msg; msg.Form("%llu", totnumEntry/1000);
|
TString msg; msg.Form("%llu", totnumEntry/1000);
|
||||||
|
@ -116,26 +117,29 @@ int main(int argn, char **argv){
|
||||||
Frac+=0.1;
|
Frac+=0.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = index[entry];
|
Long64_t ev = index[entry];
|
||||||
|
|
||||||
b_ID->GetEntry(entry, 0);
|
b_ID->GetEntry(ev, 0);
|
||||||
b_energy->GetEntry(entry, 0);
|
b_energy->GetEntry(ev, 0);
|
||||||
b_energy_timestamp->GetEntry(entry, 0);
|
b_energy_timestamp->GetEntry(ev, 0);
|
||||||
|
|
||||||
if( time0 == 0) {
|
if( time0 == 0) {
|
||||||
time0 = energy_t;
|
time0 = energy_t;
|
||||||
multi = 0;
|
multi = 0;
|
||||||
}
|
}
|
||||||
timeDiff = (int) (energy_t - time0);
|
timeDiff = (int) (energy_t - time0);
|
||||||
|
|
||||||
if( timeDiff < timeWindow ) {
|
if( timeDiff < timeWindow ) {
|
||||||
|
|
||||||
id[multi] = detID;
|
if( multi > MAXMULTI ){
|
||||||
e[multi] = energy;
|
multiOverflow++;
|
||||||
e_t[multi] = energy_t;
|
}else{
|
||||||
multi ++;
|
id[multi] = detID;
|
||||||
if( detID < NCRYSTAL ) multiCry++;
|
e[multi] = energy;
|
||||||
|
e_t[multi] = energy_t;
|
||||||
|
multi ++;
|
||||||
|
if( detID < NCRYSTAL ) multiCry++;
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
///---- end of event
|
///---- end of event
|
||||||
saveFile->cd();
|
saveFile->cd();
|
||||||
|
@ -143,7 +147,7 @@ int main(int argn, char **argv){
|
||||||
eventID ++;
|
eventID ++;
|
||||||
|
|
||||||
///---- clear data
|
///---- clear data
|
||||||
for( int i = 0; i < multi ; i ++){
|
for( int i = 0; i < MAXMULTI ; i ++){
|
||||||
id[i] = 0;
|
id[i] = 0;
|
||||||
e[i] = TMath::QuietNaN();
|
e[i] = TMath::QuietNaN();
|
||||||
e_t[i] = 0;
|
e_t[i] = 0;
|
||||||
|
@ -161,9 +165,7 @@ int main(int argn, char **argv){
|
||||||
e_t[multi] = energy_t;
|
e_t[multi] = energy_t;
|
||||||
multi++;
|
multi++;
|
||||||
if( detID < NCRYSTAL ) multiCry++;
|
if( detID < NCRYSTAL ) multiCry++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("============================== finished.\n");
|
printf("============================== finished.\n");
|
||||||
|
@ -172,6 +174,6 @@ int main(int argn, char **argv){
|
||||||
newtree->Write();
|
newtree->Write();
|
||||||
saveFile->Close();
|
saveFile->Close();
|
||||||
|
|
||||||
printf(" total number of event Built : %d \n", eventID);
|
printf(" total number of event Built : %d \n", eventID);
|
||||||
|
printf(" total event has multi > %6d : %d \n", MAXMULTI, multiOverflow);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user