Skip to content

Commit

Permalink
Further code cleaning + a bug fix in the overlap tagger
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessio Bonato committed Nov 11, 2009
1 parent 6cb0369 commit 5fae04b
Show file tree
Hide file tree
Showing 10 changed files with 60 additions and 30 deletions.
20 changes: 14 additions & 6 deletions Alignment/TrackerAlignment/plugins/TkAlCaOverlapTagger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit1D.h"
#include "DataFormats/TrackerRecHit2D/interface/SiStripRecHit2D.h"
#include "DataFormats/TrackerRecHit2D/interface/SiPixelRecHit.h"
//#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h"
#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit1D.h"
#include "RecoTracker/TransientTrackingRecHit/interface/TSiStripRecHit2DLocalPos.h"
#include "RecoTracker/TransientTrackingRecHit/interface/TSiPixelRecHit.h"
#include "Utilities/General/interface/ClassName.h"

Expand Down Expand Up @@ -142,8 +143,13 @@ void TkAlCaOverlapTagger::produce(edm::Event &iEvent, const edm::EventSetup &iSe
if (hitInStrip){
//cout<<" TypeId of the RecHit: "<<className(*hit)<<endl;
const std::type_info &type = typeid(*hit);
if (type == typeid(SiStripRecHit1D)) {
const SiStripRecHit1D* striphit=dynamic_cast<const SiStripRecHit1D*>(hit);
const TSiStripRecHit2DLocalPos* transstriphit2D = dynamic_cast<const TSiStripRecHit2DLocalPos*>(hit);
const TSiStripRecHit1D* transstriphit1D = dynamic_cast<const TSiStripRecHit1D*>(hit);

// if (type == typeid(SiStripRecHit1D)) {
if(transstriphit1D!=0){
// const SiStripRecHit1D* striphit=dynamic_cast<const SiStripRecHit1D*>(hit);
const SiStripRecHit1D* striphit=transstriphit1D->specificHit();
if(striphit!=0){
SiStripRecHit1D::ClusterRef stripclust(striphit->cluster());

Expand All @@ -158,8 +164,10 @@ void TkAlCaOverlapTagger::produce(edm::Event &iEvent, const edm::EventSetup &iSe
edm::LogError("TkAlCaOverlapTagger")<<"ERROR in <TkAlCaOverlapTagger::produce>: Dynamic cast of Strip RecHit failed! TypeId of the RecHit: "<<className(*hit);
}
}//end if sistriprechit1D
else if (type == typeid(SiStripRecHit2D)) {
const SiStripRecHit2D* striphit=dynamic_cast<const SiStripRecHit2D*>(hit);
else if(transstriphit2D!=0){
//else if (type == typeid(SiStripRecHit2D)) {
// const SiStripRecHit2D* striphit=dynamic_cast<const SiStripRecHit2D*>(hit);
const SiStripRecHit2D* striphit=transstriphit2D->specificHit();
if(striphit!=0){
SiStripRecHit2D::ClusterRef stripclust(striphit->cluster());

Expand All @@ -179,7 +187,7 @@ void TkAlCaOverlapTagger::produce(edm::Event &iEvent, const edm::EventSetup &iSe
}
}//end if Sistriprechit2D
else{
edm::LogError("TkAlCaOverlapTagger")<<"ERROR in <TkAlCaOverlapTagger::produce>: Impossible to determine the type of SiStripRecHit.";
edm::LogError("TkAlCaOverlapTagger")<<"ERROR in <TkAlCaOverlapTagger::produce>: Impossible to determine the type of SiStripRecHit. TypeId of the RecHit: "<<className(*hit);
}

}//end if hit in Strips
Expand Down
3 changes: 2 additions & 1 deletion Alignment/TrackerAlignment/scripts/Looper.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#! /bin/bash

echo ""
echo "#############################################################################"
echo "##### #####"
echo "##### Starting the TK Alignment Skim&Prescale workflow!!! #####"
Expand Down Expand Up @@ -29,7 +30,7 @@ for ALCATAG in $( cat "taglist.txt" )
do
echo ""
echo "Counting events for ${ALCATAG} ; Log in ./log_nevents_${ALCATAG}.out"
#time ./cntevts_in_file.sh "../data/${ALCATAG}.dat" $ALCATAG &> log_nevents_${ALCATAG}.out
time ./cntevts_in_file.sh "../data/${ALCATAG}.dat" $ALCATAG &> log_nevents_${ALCATAG}.out
done


Expand Down
26 changes: 13 additions & 13 deletions Alignment/TrackerAlignment/scripts/PlotTrackStats.C
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@ void PlotTrackStats(){

//define paths
char basepath[128];
sprintf(basepath,"/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/HIP/bonato/DEVEL/HIPWorkflow/ALCARECOskim/v2.1/MONITORING/DQM");
sprintf(basepath,"./MONITORING/DQM");
char filename[256];

const int StartFile=1;//211;
const int FinFile=999;

int addedfiles=0;

//create a chain with all the DQM histograms
TChain *ch=new TChain("AlignmentTrackStats");

for(int i=StartFile;i<=FinFile;++i){
sprintf(filename,"%s/CTF/TkAlCaRecoSkimming.MinBias09MC.ALCARECOTkAlMinBias_cfg.%d_TrackStats.root",basepath,i);
if(!CheckFileExistence(filename)){
cout<<"Added to the chain "<<i-1<<" files"<<endl;
break;
}
ch->Add(filename);
if( (i%50==0) || (i==FinFile))cout<<"Added to the chain "<<i<<" files"<<endl;
sprintf(filename,"%s/CTF/TkAlCaRecoSkimming.ALCARECOTkAlMinBias.ALCARECOTkAlMinBias_cfg.%d_TrackStats.root",basepath,i);
// if(!CheckFileExistence(filename)){
// cout<<"Added to the chain "<<i-1<<" files"<<endl;
// break;
// }
if(CheckFileExistence(filename)){ch->Add(filename);addedfiles++;}
if( (i%50==0) || (i==FinFile))cout<<"File: "<<i<<" "<<flush;
}

cout<<"\nAdded to the chain "<<addedfiles<<" files"<<endl;

//create histograms with the TTree:Draw function
ch->Draw("Chi2n>>hchi2n(600,0.0,12.0)","Ntracks>0","goff");
Expand Down Expand Up @@ -113,8 +113,8 @@ void PlotTrackStats(){
hnhitstotPXB->Draw();

//save png files
c1->SaveAs("./MinBiasMC09_CTFSkimmed_TrackStats_ALLTRKS.png");
c2->SaveAs("./MinBiasMC09_CTFSkimmed_TrackStats_PIXTRKS.png");
c1->SaveAs("./ALCARECOTkAlMinBias_CTFSkimmed_TrackStats_ALLTRKS.png");
c2->SaveAs("./ALCARECOTkAlMinBias_CTFSkimmed_TrackStats_PIXTRKS.png");
delete c1;
delete c2;

Expand All @@ -133,7 +133,7 @@ void PlotTrackStats(){
// cout<<"start draw"<<endl;
hnhvsp->Draw("colz");
//cout<<"start save"<<endl;
can_nhvsp->SaveAs("./MinBiasMC09_CTFSkimmed_NhitsVsMom.ps");
can_nhvsp->SaveAs("./ALCARECOTkAlMinBias_CTFSkimmed_NhitsVsMom.ps");
}

bool CheckFileExistence(char *filename){
Expand Down
22 changes: 21 additions & 1 deletion Alignment/TrackerAlignment/scripts/PrescaleLooper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ DQM_OUT="${curdir}/MONITORING/DQM/CTF/"
#DQM_OUT=$1
ALCAFILELIST=$1
MAXEVENTS=18000
BASE_TPL=$(basename "$TPL_FILE" .tpl)


#check if output directory exists
nsls $CASTOR_OUT
Expand Down Expand Up @@ -64,6 +64,7 @@ do
###DAT_FILE="/afs/cern.ch/cms/CAF/CMSALCA/ALCA_TRACKERALIGN/HIP/bonato/DEVEL/HIPWorkflow/ALCARECOskim/v1.4/data/${ALCATAG}.dat"
DAT_FILE="${curdir}/../data/${ALCATAG}.dat"
TPL_FILE="TkAlCaRecoPrescaling.${ALCATAG}.tpl"
BASE_TPL=$(basename "$TPL_FILE" .tpl)
TAG=$ALCATAG #"CRAFT"
JOBTAG="ALCAPresc_"${TAG}

Expand Down Expand Up @@ -117,6 +118,12 @@ time cmsRun mergemytree_${TAG}_cfg.py
replace "<JOB>" $JOB "<INPATH>" $i "<INIEVT>" $firstev "<FINEVT>" $lastev "<ALCATAG>" $ALCATAG "<MERGEDHITMAP>" $dqmtotfile < $TPL_FILE > $CFG_FILE
let INDEX=INDEX+1
let nsplits=nsplits+1
# if [ $INDEX -ge 3 ]
# then
# echo "Reached a maximum number of files: $INDEX. Stopping the submission"
# break
# fi

done

else #file is small and does not contain too many events
Expand All @@ -126,8 +133,21 @@ time cmsRun mergemytree_${TAG}_cfg.py
CFG_FILE=$BASE_TPL"."$TAG"_cfg."$INDEX".py"
replace "<JOB>" $JOB "<INPATH>" $i "<INIEVT>" $firstev "<FINEVT>" $lastev "<ALCATAG>" $ALCATAG "<MERGEDHITMAP>" $dqmtotfile< $TPL_FILE > $CFG_FILE
let INDEX=INDEX+1
# if [ $INDEX -ge 3 ]
# then
# echo "Reached a maximum number of files: $INDEX. Stopping the submission"
# break
# fi

fi


# if [ $INDEX -ge 3 ]
# then
# echo "Reached a maximum number of files: $INDEX. Stopping the submission"
# break
# fi

#echo "--- moving to next file. At the moment INDEX=$INDEX"
done

Expand Down
6 changes: 3 additions & 3 deletions Alignment/TrackerAlignment/scripts/SkimLooper.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ do
fi

# if [ $INDEX -ge 3 ]
# then
# echo "Reached a maximum number of files: $INDEX. Stopping the submission"
# break
# then
# echo "Reached a maximum number of files: $INDEX. Stopping the submission"
# break
# fi

#echo "--- moving to next file. At the moment INDEX=$INDEX"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")

# setting global tag

process.GlobalTag.globaltag = "STARTUP31X_V5::All"
process.GlobalTag.globaltag = "STARTUP3XY_V9::All"

##__________________________________Filter____________________________________________
process.maxEvents = cms.untracked.PSet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")

# setting global tag
process.GlobalTag.globaltag = "MC_3XY_V10::All"

process.GlobalTag.globaltag = "MC_31X_V6::All"

##__________________________________Filter____________________________________________
process.maxEvents = cms.untracked.PSet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")

# setting global tag
process.GlobalTag.globaltag = "STARTUP31X_V5::All"
#process.GlobalTag.globaltag = "STARTUP31X_V5::All"
process.GlobalTag.globaltag = "STARTUP3XY_V9::All"



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")

# setting global tag
process.GlobalTag.globaltag = "MC_31X_V6::All"
#process.GlobalTag.globaltag = "MC_31X_V6::All"
process.GlobalTag.globaltag = "MC_3XY_V10::All"



Expand Down
2 changes: 1 addition & 1 deletion Alignment/TrackerAlignment/scripts/mergemytree_cfg.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ process.maxEvents = cms.untracked.PSet(
input = cms.untracked.int32(0)
)

process.load("Alignment.TrackerAlignment.TreeMerger_cff")
process.load("Alignment.TrackerAlignment.TkAlCaSkimTreeMerger_cff")
process.AlignmentTreeMerger.FileList="<DQMLIST>"
process.AlignmentTreeMerger.TreeName='AlignmentHitMap'
process.AlignmentTreeMerger.OutputFile="<DQMTOTFILE>"
Expand Down

0 comments on commit 5fae04b

Please sign in to comment.