Commit 3efa74b5 authored by Breno Rilho Lemos's avatar Breno Rilho Lemos 💬
Browse files

Uniquely identify animation event regardless of URL being informed

parent 604d8f75
...@@ -106,14 +106,14 @@ void AliAnalysisTaskMyTask::UserCreateOutputObjects() ...@@ -106,14 +106,14 @@ void AliAnalysisTaskMyTask::UserCreateOutputObjects()
// fOutputList object. the manager will in the end take care of writing your output to file // fOutputList object. the manager will in the end take care of writing your output to file
// so it needs to know what's in the output // so it needs to know what's in the output
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEventID) void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEventID)
{ {
ofstream esd_detail; ofstream esd_detail, uniqueid;
std::stringstream esd_filename; std::stringstream esd_filename;
esd_filename << "esd_detail-event_" << selectedEventID << ".dat"; esd_filename << "esd_detail-event_" << selectedEventID << ".dat";
esd_detail.open (esd_filename.str(),std::ofstream::app); esd_detail.open (esd_filename.str(),std::ofstream::app);
uniqueid.open ("uniqueid.txt");
fESD = dynamic_cast<AliESDEvent*>(InputEvent()); // get an event (called fESD) from the input file fESD = dynamic_cast<AliESDEvent*>(InputEvent()); // get an event (called fESD) from the input file
...@@ -125,6 +125,20 @@ void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEven ...@@ -125,6 +125,20 @@ void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEven
// example part: i'll show how to loop over the tracks in an event // example part: i'll show how to loop over the tracks in an event
// and extract some information from them which we'll store in a histogram // and extract some information from them which we'll store in a histogram
// ___________________________________________
// Write ESD unique_id information on file
Int_t run_number = fESD->GetRunNumber();
Int_t orbit_number = fESD->GetOrbitNumber();
Int_t bunch_cross_number = fESD->GetBunchCrossNumber();
if(run_number != 0 && orbit_number != 0 && bunch_cross_number != 0) { // If all numbers are different than zero, write'em to file
uniqueid << "Run" << run_number << "_Orbit" << orbit_number << "_BunchCross" << bunch_cross_number << endl;
}
//___________________________________________
Int_t iTracks(fESD->GetNumberOfTracks()); // see how many tracks there are in the event Int_t iTracks(fESD->GetNumberOfTracks()); // see how many tracks there are in the event
Double_t Vx = 0.01 * fESD->GetPrimaryVertex()->GetX(); // gets vertexes from individual events, in METERS Double_t Vx = 0.01 * fESD->GetPrimaryVertex()->GetX(); // gets vertexes from individual events, in METERS
...@@ -171,6 +185,7 @@ void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEven ...@@ -171,6 +185,7 @@ void AliAnalysisTaskMyTask::export_to_our_ESD_textual_format (Int_t selectedEven
} }
esd_detail.close(); esd_detail.close();
uniqueid.close();
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
......
...@@ -75,7 +75,7 @@ driver.configure(renderCamera, duration, fps, simulated_t, outputPath, fileIdent ...@@ -75,7 +75,7 @@ driver.configure(renderCamera, duration, fps, simulated_t, outputPath, fileIdent
""" """
# Create and configure animation driver # Create and configure animation driver
driver = dataDriver("AlirootFileGenerator",n_event,args.datafile) # Simple dataDriver takes one parameters: filename driver = dataDriver("AlirootFileGenerator",n_event,args.datafile) # Simple dataDriver
driver.configure(renderCamera, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent) driver.configure(renderCamera, duration, fps, simulated_t, outputPath, fileIdentifier, resolution_percent)
### Build scene ### Build scene
......
...@@ -46,7 +46,7 @@ class animationDriver: ...@@ -46,7 +46,7 @@ class animationDriver:
bcsr.ffmpeg.packetsize = 2048 bcsr.ffmpeg.packetsize = 2048
bcsr.ffmpeg.muxrate = 10080000 bcsr.ffmpeg.muxrate = 10080000
xpixels = int(bcsr.resolution_percentage * bcsr.resolution_x / 100) xpixels = int(bcsr.resolution_percentage * bcsr.resolution_x / 100)
output_prefix=fileIdentifier+str(xpixels)+"px_"+self.name+self.renderCamera output_prefix=self.fileIdentifier+str(xpixels)+"px_"+self.name+self.renderCamera
bcsr.filepath = "/tmp/blender/"+output_prefix bcsr.filepath = "/tmp/blender/"+output_prefix
class genDriver(animationDriver): # A driver for particle generators class genDriver(animationDriver): # A driver for particle generators
......
...@@ -219,12 +219,6 @@ else ...@@ -219,12 +219,6 @@ else
fi fi
if [[ $URL = "" ]]; then
echo "URL parameter is obligatory."
exit
usage
fi
# handle non-option arguments # handle non-option arguments
if [[ $# -ne 0 ]]; then if [[ $# -ne 0 ]]; then
echo "$0: non-option arguments ($#, $*) are ignored." echo "$0: non-option arguments ($#, $*) are ignored."
...@@ -237,23 +231,25 @@ fi ...@@ -237,23 +231,25 @@ fi
############################## ##############################
if [ "$DOWNLOAD" = "true" ]; then if [ "$DOWNLOAD" = "true" ]; then
if [ -z $URL ]; then if [ -z $URL ]; then
echo "Error. Must pass the dataset URL." echo "Error. Must pass the dataset URL in order to download ESD file."
usage usage
exit exit
fi fi
echo "Downloading data." echo "Downloading data."
wget $URL wget $URL
fi
###################################### ######################################
# Established Unique ID based on URL # # Established Unique ID based on URL #
###################################### ######################################
UNIQUEID=$(echo $URL | sed \ UNIQUEID=$(echo $URL | sed \
-e "s#http://opendata.cern.ch/##" \ -e "s#http://opendata.cern.ch/##" \
-e "s#/AliESDs.root##" \ -e "s#/AliESDs.root##" \
-e "s#files/assets/##" \ -e "s#files/assets/##" \
-e "s#/#_#g") -e "s#/#_#g")
echo "The unique ID is $UNIQUEID."
echo "The unique ID is $UNIQUEID."
fi
############################## ##############################
# Default synthetic animation# # Default synthetic animation#
...@@ -284,10 +280,6 @@ elif [ "$DEFAULT" = "false" ]; then ...@@ -284,10 +280,6 @@ elif [ "$DEFAULT" = "false" ]; then
exit exit
fi fi
# Create directory where animations will be saved
BLENDER_OUTPUT=$(pwd)/$UNIQUEID
mkdir --verbose -p ${BLENDER_OUTPUT}
############################ ############################
# Phase 1: aliroot extract # # Phase 1: aliroot extract #
############################ ############################
...@@ -300,14 +292,24 @@ elif [ "$DEFAULT" = "false" ]; then ...@@ -300,14 +292,24 @@ elif [ "$DEFAULT" = "false" ]; then
# Run the extraction tool # Run the extraction tool
aliroot runAnalysis.C aliroot runAnalysis.C
if [ "$DOWNLOAD" = "false" ]; then
UNIQUEID=$(more uniqueid.txt)
echo "The unique ID is $UNIQUEID."
rm uniqueid.txt
fi
# Create directory where animations will be saved
popd
BLENDER_OUTPUT=$(pwd)/$UNIQUEID
mkdir --verbose -p ${BLENDER_OUTPUT}
pushd ${ALIROOT_SCRIPT_DIR} # push back to aliroot directory
################################################# #################################################
# Phase 1: iteration for every event identifier # # Phase 1: iteration for every event identifier #
################################################# #################################################
# Create directory where animations will be saved
#BLENDER_OUTPUT=$(pwd)/$UNIQUEID
#mkdir --verbose -p ${BLENDER_OUTPUT}
# Get all extracted files # Get all extracted files
EXTRACTED_FILES=$(ls -1 esd_detail-event_*.dat | sort --version-sort) EXTRACTED_FILES=$(ls -1 esd_detail-event_*.dat | sort --version-sort)
for FILE_WITH_DATA in $EXTRACTED_FILES; do for FILE_WITH_DATA in $EXTRACTED_FILES; do
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment