void chkef( ULong64_t low, ULong64_t high, ULong64_t n ){
cout<<endl;
cout<< "=========================================================\n" ;
cout<<"i... HOUR: "<<n<<endl; //" "<<low<<" "<<high<<endl;
string sep = "----------------------------\n" ;
TTree *t1 = (TTree*) gROOT->FindObject("AD");
TH1F * hc = new TH1F("hc","hc",2000,0.1,50);
TH1F * ht = new TH1F("ht","ht",2000,0.1,50);
TString cond= Form("(((RTS<<32)+(VTS<<16)+LTS)>=%lld)&&(((RTS<<32)+(VTS<<16)+LTS)<%lld)",low,high);
TString condad=Form("&&( (((RTS<<32)+(VTS<<16)+LTS)>=%lld)&&(((RTS<<32)+(VTS<<16)+LTS)<%lld) )",low,high);
// cout<<cond<<endl<<condad<<endl;
cout << "Forward (condition by before)" << endl;
for(int i =0; i<4;i++)
{
t1->Draw(Form("IC[%d]>>ht",i+1),cond.Data() ,"goff");
t1->Draw(Form("IC[%d]>>hc",i+1),Form("IC[%d]>0.1 %s",i,condad.Data() ),"goff");
cout << "IC " << i << " " << hc->Integral()/ht->Integral()*100. << "%"<< endl;
}
cout << sep ;
cout << "Backward (condition by after)" << endl;
for(int i =0; i<4;i++)
{
t1->Draw(Form("IC[%d]>>ht",i),cond.Data() ,"goff");
t1->Draw(Form("IC[%d]>>hc",i),Form("IC[%d]>0.1 %s",i+1, condad.Data() ),"goff");
cout << "IC " << i+1 << " " << hc->Integral()/ht->Integral()*100. << "%"<< endl;
}
cout << sep ;
cout << "DC (condition by IC[0])" << endl;
for(int i =0; i<4;i++)
{
t1->Draw(Form("IC[0]>>ht"),cond.Data(),"goff");
t1->Draw(Form("IC[0]>>hc"),Form("EWIRE_%d>100 %s",i, condad.Data() ),"goff");
cout << "DC WIRE " << i << " " << hc->Integral()/ht->Integral()*100. << "%"<< endl;
}
cout << sep ;
cout << "DC X (condition by IC[0])" << endl;
for(int i =0; i<4;i++)
{
t1->Draw(Form("IC[0]>>ht"),cond.Data(),"goff");
t1->Draw(Form("IC[0]>>hc"),Form("DC%d_X>-1500 %s",i, condad.Data() ),"goff");
cout << "DCX" << i << " " << hc->Integral()/ht->Integral()*100. << "%"<< endl;
}
cout << sep ;
cout << "Xf (condition by IC[0])" << endl;
t1->Draw(Form("IC[0]>>ht"),cond.Data() ,"goff");
t1->Draw(Form("IC[0]>>hc"),Form("Xf>-1500 %s", condad.Data() ),"goff");
cout << "Xf " << hc->Integral()/ht->Integral()*100. << "%"<< endl;
cout << sep ;
delete hc;
delete ht;
}
/*
ORIGINAL NAME but now the original code for VAMOS eff is above
*/
void EffCheck()
{
ULong64_t hour;
ULong64_t LTSmin=-1;
ULong64_t LTSmax=-1;
ULong64_t LTS,VTS,RTS, tmin,tmax,tmp;
cout<< "============================================================\n" ;
cout<<" "<<gFile->GetName()<<endl;
cout<< "============================================================\n" ;
cout<<"Looking for min and max time stamp... very slow"<<endl;
TTree *tree= (TTree*)gDirectory->Get("AD");
tree->SetBranchAddress("LTS",<S);
tree->SetBranchAddress("VTS",&VTS);
tree->SetBranchAddress("RTS",&RTS);
for (int i=1;i<tree->GetEntries();i++){
tree->GetEntry(i);
tmp=(RTS<<32)+(VTS<<16)+LTS;
if ((LTS>0)&&(tmp>1e+14)){ //================== kill some low values?
if ((LTSmin>tmp) || (LTSmin==-1)){
LTSmin=tmp;
}
if ((LTSmax<tmp) || (LTSmax==-1)){
LTSmax=tmp;
}
}
}
//tree->Draw("(RTS<<32)+(VTS<<16)+LTS>>h(10000)","","");
// Long64_t LTSmin=AD->GetV1()[0];
// AD->Draw("RTS<<32+VTS<<16+LTS","LTS>0","goff", 1, AD->GetEntries()-1 );
// Long64_t LTSmax=AD->GetV1()[0];
cout<<"min "<<LTSmin<<" "<<endl;
cout<<"max "<<LTSmax<<" "<< endl;
cout<<"delta "<<LTSmax-LTSmin<<endl;
cout<<"delta "<<(LTSmax-LTSmin)/100/1e+6/3600/282162*4.3<<" hours EMPIRICAL RUN LENGHT"<<endl;
hour=143567947269965277/6.0775;
cout<<"1hour=="<<hour<<endl<<endl<<endl;
//==========================================================================================
ULong64_t n=0;
int hourstep=2;
for (ULong64_t i=LTSmin; i<LTSmax; i+=hour*hourstep){
n=n+1;
chkef( i, i+hour , n*hourstep);
}
return NULL;
}
|