Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions QC/timeseries/DoMerge.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include "TFileMerger.h"

// macro to merge all the files in a list (they should belong to the same school)
// The header of the first file will be kept
void DoMerge(char* nomelista="listaM",char* output="filtered.root"){
// system("ls calib/*.root >listaM");
FILE *f = fopen(nomelista,"r");

// TGrid::Connect("alien://");

TFileMerger m(kFALSE);
m.OutputFile(output);

Int_t i=0;
char nome[100];
while (fscanf(f,"%s",nome)==1) {
m.AddFile(nome);
i++;
}
if (i)
m.Merge();
}

18 changes: 18 additions & 0 deletions QC/timeseries/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# creating our tree from TPC timeseries accessing inputs from remote (alien), note that in the script apass5 is assumed (in case change it)
./dorun.sh PERIOD RUN
#example ./dorun.sh LHC23zzh 544091
# output -> 544091.root


# process the output (files list taken from listaT)
# requirements
# 1)dedx peramaterization (provided a default here) -> expDeDx.root
# 2) mismatch plots from qcdb -> etaMism.root, mism.root
# qc_async/TOF/MO/PID/mHistMismatchVsEta
# qc_async/TOF/MO/PID/LoverCvsEta

ls YOUR_RUNS > listaT
root -b -q -l process.C

# check paramerization of track contribution to expected time resolution (only antiparticles used)
root getRes.C
6 changes: 6 additions & 0 deletions QC/timeseries/checkrun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
export period=$2
export year=$(echo $2|awk -F"LHC" '{print "20"substr($2,1,2)}')

echo $year $period $1
alien.py find /alice/data/$year/${period}/$1/apass5/ time_series_tracks_0.root |grep Stage_5
12 changes: 12 additions & 0 deletions QC/timeseries/dorun.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
export period=$2
export year=$(echo $2|awk -F"LHC" '{print "20"substr($2,1,2)}')

echo alien.py find /alice/data/$year/${period}/$1/apass5/ time_series_tracks_0.root

alien.py find /alice/data/$year/${period}/$1/apass5/ time_series_tracks_0.root |grep Stage_5 >lista
rm -rf $1
mkdir $1
cat -b lista|awk '{print "./filter.sh","alien://"$2,"'$1'/"$1".root"}'|bash

ls $1/*.root >listaM ; root -b -q -l DoMerge.C\(\"listaM\",\"$1.root\"\)
Binary file added QC/timeseries/expDeDx.root
Binary file not shown.
14 changes: 14 additions & 0 deletions QC/timeseries/filter
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
double 1 mTOFSignal tof
float 9 mTOFLength.mT[9] texp
float 1 pt pt
float 1 mDXatTOF dx
float 1 mDZatTOF dz
float 1 vertex_time vertex_time
int 1 ncl ncl
UShort_t 1 vertex_nContributors vertex_nContributors
UInt_t 1 TOFmask TOFmask
float 1 phi phi
float 1 tgl tgl
float 1 dedxTPC.dEdxTotTPC dedx
UInt_t 1 firstTFOrbit firstTFOrbit
float 1 qpt qpt
118 changes: 118 additions & 0 deletions QC/timeseries/filter.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
void filter(const char* fname="time_series_tracks_0.root",const char* fnameOut="filtered.root"){
int typoV[1000];
int intV[1000]; // 0
float floatV[1000]; // 1
double doubleV[1000]; // 2
UShort_t ushortV[1000]; // 3
UInt_t uintV[1000]; // 4

float *pt;
int *ncl;

// float downscaleextra = 1;

TGrid::Connect("alien://");

TFile *fts = TFile::Open(fname);
TTree *t = (TTree *) fts->Get("treeTimeSeries");

TFile *fout = new TFile(fnameOut,"RECREATE");
TTree *tout = new TTree("tree","tree");

char hasITS;
t->SetBranchAddress("hasITSTPC",&hasITS);

FILE *f = fopen("filter","r");
char typeV[30],labelIn[100],labelOut[100];
int ndim;
int np=0;
while(fscanf(f,"%s %d %s %s",typeV,&ndim,labelIn,labelOut) == 4){
printf("new\n");
TString a(typeV);
TString b(labelIn);
if(a.Contains("int")){
printf("%s -> int\n",typeV);
typoV[np] = 0;
t->SetBranchAddress(labelIn,&(intV[np]));
if(ndim==1){
tout->Branch(labelOut,&(intV[np]));
} else {
tout->Branch(labelOut,&(intV[np]),Form("%s[%d]",labelOut,ndim));
}

if(b.Contains("ncl")){
ncl = &(intV[np]);
}

} else if(a.Contains("float")){
printf("%s -> float\n",typeV);
typoV[np] = 1;
t->SetBranchAddress(labelIn,&(floatV[np]));
if(ndim==1){
tout->Branch(labelOut,&(floatV[np]));
} else {
tout->Branch(labelOut,&(floatV[np]),Form("%s[%d]",labelOut,ndim));
}

if(b.Contains("pt") && !b.Contains("qpt")){
pt = &(floatV[np]);
}

} else if(a.Contains("double")){
printf("%s -> double\n",typeV);
typoV[np] = 2;
t->SetBranchAddress(labelIn,&(doubleV[np]));
if(ndim==1){
tout->Branch(labelOut,&(doubleV[np]));
} else {
tout->Branch(labelOut,&(doubleV[np]),Form("%s[%d]",labelOut,ndim));
}
} else if(a.Contains("UShort_t")){
printf("%s -> ushort\n",typeV);
typoV[np] = 2;
t->SetBranchAddress(labelIn,&(ushortV[np]));
if(ndim==1){
tout->Branch(labelOut,&(ushortV[np]));
} else {
tout->Branch(labelOut,&(ushortV[np]),Form("%s[%d]",labelOut,ndim));
}
} else if(a.Contains("UInt_t")){
printf("%s -> uint\n",typeV);
typoV[np] = 2;
t->SetBranchAddress(labelIn,&(uintV[np]));
if(ndim==1){
tout->Branch(labelOut,&(uintV[np]));
} else {
tout->Branch(labelOut,&(uintV[np]),Form("%s[%d]",labelOut,ndim));
}
}
np+=ndim;
}

// factor 10 downscale for pT < 1
for(int i=0; i < t->GetEntries();i++){
t->GetEvent(i);

/*
if(gRandom->Rndm() < downscaleextra){
continue;
}
*/

if(! hasITS){
continue;
}

if(*pt > 40 || *ncl < 100){
continue;
}
if(1 || *pt > 1 || gRandom->Rndm() < 0.1){
tout->Fill();
}
}

fout->cd();
tout->Write();
fout->Close();

}
4 changes: 4 additions & 0 deletions QC/timeseries/filter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

root -b -q -l filter.C\(\"$1\",\"$2\"\)

Loading