1 |
#!/bin/bash
|
2 |
|
3 |
if (( ${#LOCALRT} < 4 ))
|
4 |
then
|
5 |
if (( ${#HCALDAQ_SW_LOC} > 3 && ${#HCAL_CMSSW_RELEASE} > 3 ))
|
6 |
then
|
7 |
pushd $HCALDAQ_SW_LOC/src/$HCAL_CMSSW_RELEASE/src >/dev/null
|
8 |
eval `scramv1 runtime -sh`
|
9 |
popd >/dev/null
|
10 |
fi
|
11 |
fi
|
12 |
|
13 |
if (( ${#LOCALRT} < 4 ))
|
14 |
then
|
15 |
echo Please setup your runtime environment!
|
16 |
exit
|
17 |
fi
|
18 |
|
19 |
ARG1=$1
|
20 |
OUTPUTFILE=$2
|
21 |
|
22 |
if [[ -e ./reco_setup.rc ]]
|
23 |
then
|
24 |
source ./reco_setup.rc
|
25 |
fi
|
26 |
|
27 |
if (( ${#DOCALIB} > 1 ))
|
28 |
then
|
29 |
UNPACKCALIB=true
|
30 |
else
|
31 |
UNPACKCALIB=false
|
32 |
fi
|
33 |
|
34 |
# ARG1 determines the file selection mode
|
35 |
#
|
36 |
if [[ "${ARG1}" == *[[:alpha:]]* ]]
|
37 |
then
|
38 |
# Filename mode
|
39 |
FILE=$ARG1
|
40 |
else
|
41 |
# Run Number mode
|
42 |
FILE=`printf "${FORMAT}" ${ARG1}`
|
43 |
fi
|
44 |
|
45 |
echo $FILE
|
46 |
|
47 |
if (( ${#EVENTLIMIT} == 0 ))
|
48 |
then
|
49 |
EVENTLIMIT="-1";
|
50 |
fi
|
51 |
|
52 |
if (( ${#MAPFILE} < 10 ))
|
53 |
then
|
54 |
echo "Must have a map file in the reco_setup.rc or config file"
|
55 |
exit 1
|
56 |
fi
|
57 |
|
58 |
#### common head part of Config File
|
59 |
### create the file
|
60 |
CFGFILE=/tmp/runCMSSWReco_${USER}.cfg
|
61 |
cat > ${CFGFILE}<<EOF
|
62 |
process RECO = {
|
63 |
service = MessageLogger
|
64 |
{
|
65 |
untracked vstring destinations = { "cout" }
|
66 |
untracked vstring categories = { "DDLParser", "FwkJob", "FwkReport"}
|
67 |
untracked PSet cout = {untracked string threshold = "INFO"
|
68 |
untracked PSet INFO = { untracked int32 limit = 10000 }
|
69 |
untracked PSet DDLParser = { untracked int32 limit = 0 }
|
70 |
untracked PSet FwkJob = { untracked int32 limit =10 }
|
71 |
untracked PSet FwkReport = { untracked int32 limit = 20 }
|
72 |
}
|
73 |
}
|
74 |
EOF
|
75 |
|
76 |
### Mode-dependent part
|
77 |
|
78 |
if [[ "$MODE" == "TESTSTAND" || "${FILE}" == *"HTB_"* ]]
|
79 |
then
|
80 |
# STREAMS: comma-separated list of strings, like: " 'HCAL_Trigger','HCAL_DCC020' "
|
81 |
STREAMS=","${FEDS}
|
82 |
STREAMS=${STREAMS/20/020} # special case for teststand files
|
83 |
STREAMS=${STREAMS//,/\',\'HCAL_DCC}
|
84 |
STREAMS="'HCAL_Trigger"${STREAMS}\'
|
85 |
|
86 |
if [[ "$MODE" == "TESTSTAND" && "$FIRSTFED" == "" ]]
|
87 |
then
|
88 |
FIRSTFED=20
|
89 |
fi
|
90 |
EXTRAPREPATH="tbunpacker,"
|
91 |
cat >> ${CFGFILE}<<EOF
|
92 |
// Loads the events from testbeam files
|
93 |
source = HcalTBSource {
|
94 |
untracked vstring fileNames = { "file:${FILE}" }
|
95 |
untracked int32 maxEvents = ${EVENTLIMIT}
|
96 |
untracked vstring streams = { ${STREAMS} }
|
97 |
}
|
98 |
module tbunpacker = HcalTBObjectUnpacker {
|
99 |
untracked int32 HcalTriggerFED = 1
|
100 |
untracked int32 HcalSlowDataFED = -1
|
101 |
untracked int32 HcalTDCFED = -1
|
102 |
untracked int32 HcalSourcePosFED = -1
|
103 |
untracked bool IncludeUnmatchedHits = false
|
104 |
untracked string ConfigurationFile='configQADCTDC.txt'
|
105 |
}
|
106 |
module hcaldigi = HcalRawToDigi {
|
107 |
int32 firstSample = 0
|
108 |
int32 lastSample = 9
|
109 |
untracked bool UnpackCalib = ${UNPACKCALIB}
|
110 |
bool FilterDataQuality = true
|
111 |
untracked int32 HcalFirstFED = ${FIRSTFED}
|
112 |
untracked vint32 FEDs = { ${FEDS} }
|
113 |
}
|
114 |
EOF
|
115 |
# MTCC mode unavailable for now
|
116 |
# elif [[ "$MODE" == "MTCC" ]]
|
117 |
# then
|
118 |
#
|
119 |
# if [[ -z "$FIRSTFED" ]]
|
120 |
# then
|
121 |
# FIRSTFED=700
|
122 |
# fi
|
123 |
#
|
124 |
# EXT=${FILE##*.}
|
125 |
# if [[ "$EXT" == "dat" ]]
|
126 |
# then
|
127 |
#
|
128 |
# cat >> ${CFGFILE}<<EOF
|
129 |
# source = NewEventStreamFileReader
|
130 |
# {
|
131 |
# string fileName = "${FILE}"
|
132 |
# untracked int32 maxEvents = ${EVENTLIMIT}
|
133 |
# int32 max_event_size = 7000000
|
134 |
# int32 max_queue_depth = 5
|
135 |
# }
|
136 |
# EOF
|
137 |
# elif [[ "$EXT" == "root" ]]
|
138 |
# then
|
139 |
#
|
140 |
# PREF=${FILE#*:}
|
141 |
# if (( ${#PREF} == ${#FILE} ))
|
142 |
# then
|
143 |
# FILE="file:$FILE"
|
144 |
# fi
|
145 |
#
|
146 |
#
|
147 |
# cat >> ${CFGFILE}<<EOF
|
148 |
# source = PoolConvert {
|
149 |
# untracked vstring fileNames = { '${FILE}' }
|
150 |
# untracked int32 maxEvents = ${EVENTLIMIT}
|
151 |
# }
|
152 |
# EOF
|
153 |
# fi
|
154 |
elif [[ "$MODE" == "TB06" ]]
|
155 |
then
|
156 |
|
157 |
if [[ -z "$FIRSTFED" ]]
|
158 |
then
|
159 |
FIRSTFED=700
|
160 |
fi
|
161 |
|
162 |
PREF=${FILE#*:}
|
163 |
if (( ${#PREF} == ${#FILE} ))
|
164 |
then
|
165 |
FILE="file:$FILE"
|
166 |
fi
|
167 |
|
168 |
EXTRAPREPATH="tbunpacker,"
|
169 |
cat >> ${CFGFILE}<<EOF
|
170 |
source = PoolSource {
|
171 |
untracked vstring fileNames = { "${FILE}" }
|
172 |
untracked int32 maxEvents = ${EVENTLIMIT}
|
173 |
}
|
174 |
|
175 |
module tbunpacker = HcalTBObjectUnpacker {
|
176 |
untracked int32 HcalTriggerFED = 1
|
177 |
untracked int32 HcalSlowDataFED = -1 # 3
|
178 |
untracked int32 HcalTDCFED = -1 # 8
|
179 |
untracked int32 HcalQADCFED = -1 # 8
|
180 |
untracked int32 HcalSourcePosFED = -1
|
181 |
untracked bool IncludeUnmatchedHits = false
|
182 |
# untracked string ConfigurationFile='configQADCTDC.txt'
|
183 |
}
|
184 |
module hcaldigi = HcalRawToDigi {
|
185 |
int32 firstSample = 0
|
186 |
int32 lastSample = 9
|
187 |
untracked bool UnpackCalib = ${UNPACKCALIB}
|
188 |
bool FilterDataQuality = true
|
189 |
untracked int32 HcalFirstFED = ${FIRSTFED}
|
190 |
untracked vint32 FEDs = { ${FEDS} }
|
191 |
}
|
192 |
EOF
|
193 |
elif [[ "$MODE" == "USC" ]]
|
194 |
then
|
195 |
EXTRAPREPATH="tbunpacker,"
|
196 |
cat >> ${CFGFILE}<<EOF
|
197 |
// Loads the events from testbeam files
|
198 |
source = HcalTBSource {
|
199 |
untracked vstring fileNames = { "file:${FILE}" }
|
200 |
untracked int32 maxEvents = ${EVENTLIMIT}
|
201 |
untracked vstring streams = { 'HCAL_Trigger',
|
202 |
'HCAL_DCC700','HCAL_DCC701','HCAL_DCC702','HCAL_DCC703',
|
203 |
'HCAL_DCC704','HCAL_DCC705','HCAL_DCC706','HCAL_DCC707',
|
204 |
'HCAL_DCC708','HCAL_DCC709','HCAL_DCC710','HCAL_DCC711',
|
205 |
'HCAL_DCC712','HCAL_DCC713','HCAL_DCC714','HCAL_DCC715',
|
206 |
'HCAL_DCC716','HCAL_DCC717','HCAL_DCC718','HCAL_DCC719',
|
207 |
'HCAL_DCC720','HCAL_DCC721','HCAL_DCC722','HCAL_DCC723',
|
208 |
'HCAL_DCC724','HCAL_DCC725','HCAL_DCC726','HCAL_DCC727',
|
209 |
'HCAL_DCC728','HCAL_DCC729','HCAL_DCC730','HCAL_DCC731' }
|
210 |
}
|
211 |
|
212 |
module tbunpacker = HcalTBObjectUnpacker {
|
213 |
untracked int32 HcalTriggerFED = 1
|
214 |
untracked int32 HcalSlowDataFED = -1
|
215 |
untracked int32 HcalTDCFED = -1
|
216 |
untracked int32 HcalSourcePosFED = -1
|
217 |
untracked bool IncludeUnmatchedHits = false
|
218 |
untracked string ConfigurationFile='configQADCTDC.txt'
|
219 |
}
|
220 |
|
221 |
module hcaldigi = HcalRawToDigi {
|
222 |
int32 firstSample = 0
|
223 |
int32 lastSample = 9
|
224 |
untracked bool UnpackCalib = ${UNPACKCALIB}
|
225 |
bool FilterDataQuality = true
|
226 |
// untracked int32 HcalFirstFED = ${FIRSTFED} # use default!
|
227 |
untracked vint32 FEDs = {}
|
228 |
}
|
229 |
EOF
|
230 |
else
|
231 |
echo Unknown mode '$MODE'
|
232 |
exit
|
233 |
fi
|
234 |
|
235 |
#### common tail part of Config File
|
236 |
cat >> ${CFGFILE}<<EOF99
|
237 |
module hbhereco = HcalSimpleReconstructor {
|
238 |
/// Indicate which digi time sample to start with when
|
239 |
/// integrating the signal
|
240 |
int32 firstSample = 1
|
241 |
/// Indicate how many digi time samples to integrate over
|
242 |
int32 samplesToAdd = 8
|
243 |
/// Indicate whether to apply energy-dependent time-slew corrections
|
244 |
bool correctForTimeslew = true
|
245 |
/// Indicate whether to apply corrections for pulse containment in the summing window
|
246 |
bool correctForPhaseContainment = true
|
247 |
/// Nanosecond phase for pulse containment correction (default of 13 ns appropriate for simulation)
|
248 |
double correctionPhaseNS = 13.0
|
249 |
/// Indicate which subdetector to reconstruct for.
|
250 |
string Subdetector = 'HBHE'
|
251 |
/// Give the label associated with the HcalRawToDigi unpacker module.
|
252 |
/// NOTE: cross-dependency here.
|
253 |
InputTag digiLabel = hcaldigi
|
254 |
}
|
255 |
|
256 |
module horeco = HcalSimpleReconstructor {
|
257 |
/// Indicate which digi time sample to start with when
|
258 |
/// integrating the signal
|
259 |
int32 firstSample = 1
|
260 |
/// Indicate how many digi time samples to integrate over
|
261 |
int32 samplesToAdd = 8
|
262 |
/// Indicate whether to apply energy-dependent time-slew corrections
|
263 |
bool correctForTimeslew = false
|
264 |
/// Indicate whether to apply corrections for pulse containment in the summing window
|
265 |
bool correctForPhaseContainment = true
|
266 |
/// Nanosecond phase for pulse containment correction (default of 13 ns appropriate for simulation)
|
267 |
double correctionPhaseNS = 13.0
|
268 |
/// Indicate which subdetector to reconstruct for.
|
269 |
string Subdetector = 'HO'
|
270 |
/// Give the label associated with the HcalRawToDigi unpacker module.
|
271 |
/// NOTE: cross-dependency here.
|
272 |
InputTag digiLabel = hcaldigi
|
273 |
}
|
274 |
|
275 |
module hfreco = HcalSimpleReconstructor {
|
276 |
/// Indicate which digi time sample to start with when
|
277 |
/// integrating the signal
|
278 |
int32 firstSample = 1
|
279 |
/// Indicate how many digi time samples to integrate over
|
280 |
int32 samplesToAdd = 4
|
281 |
/// Indicate whether to apply energy-dependent time-slew corrections
|
282 |
bool correctForTimeslew = true
|
283 |
/// Indicate whether to apply corrections for pulse containment in the summing window (not in HF or ZDC)
|
284 |
bool correctForPhaseContainment = false
|
285 |
/// Nanosecond phase for pulse containment correction (ignored if correction is not used)
|
286 |
double correctionPhaseNS = 0.0
|
287 |
/// Indicate which subdetector to reconstruct for.
|
288 |
string Subdetector = 'HF'
|
289 |
/// Give the label associated with the HcalRawToDigi unpacker module.
|
290 |
/// NOTE: cross-dependency here.
|
291 |
InputTag digiLabel = hcaldigi
|
292 |
}
|
293 |
|
294 |
module plotanal = HcalQLPlotAnal {
|
295 |
untracked InputTag hbheRHtag = hbhereco
|
296 |
untracked InputTag hoRHtag = horeco
|
297 |
untracked InputTag hfRHtag = hfreco
|
298 |
untracked InputTag hcalDigiTag = hcaldigi
|
299 |
untracked InputTag hcalTrigTag = tbunpacker
|
300 |
untracked string outputFilename = "${OUTPUTFILE}"
|
301 |
untracked bool doCalib = ${UNPACKCALIB} // false is the default
|
302 |
|
303 |
// untracked double calibFC2GeV = 0.2 // 0.2 is the default
|
304 |
|
305 |
PSet HistoParameters =
|
306 |
{
|
307 |
double pedGeVlo = ${PED_E_GEV_LO}
|
308 |
double pedGeVhi = ${PED_E_GEV_HI}
|
309 |
double pedADClo = ${PED_E_ADC_LO}
|
310 |
double pedADChi = ${PED_E_ADC_HI}
|
311 |
double ledGeVlo = ${LED_E_GEV_LO}
|
312 |
double ledGeVhi = ${LED_E_GEV_HI}
|
313 |
double laserGeVlo = ${LASER_E_GEV_LO}
|
314 |
double laserGeVhi = ${LASER_E_GEV_HI}
|
315 |
double otherGeVlo = ${OTHER_E_GEV_LO}
|
316 |
double otherGeVhi = ${OTHER_E_GEV_HI}
|
317 |
double beamGeVlo = ${BEAM_E_GEV_LO}
|
318 |
double beamGeVhi = ${BEAM_E_GEV_HI}
|
319 |
double timeNSlo = ${TIME_NS_LO}
|
320 |
double timeNShi = ${TIME_NS_HI}
|
321 |
}
|
322 |
}
|
323 |
|
324 |
path p = { ${EXTRAPREPATH} hcaldigi, hbhereco, horeco, hfreco, plotanal }
|
325 |
|
326 |
|
327 |
// stuff for the calibration system
|
328 |
es_module = HcalDbProducer {}
|
329 |
EOF99
|
330 |
|
331 |
# Stuff related to the setup
|
332 |
|
333 |
HARDCODED="\"PedestalWidths\", \"GainWidths\", \"QIEShape\", \"QIEData\", \"ChannelQuality\""
|
334 |
TEXT="{\nstring object=\"ElectronicsMap\"\nFileInPath file=\"${MAPFILE}\"\n}\n"
|
335 |
|
336 |
if (( ${#PEDESTALFILE} > 1 ))
|
337 |
then
|
338 |
TEXT=${TEXT}",{\nstring object=\"Pedestals\"\nFileInPath file=\"${PEDESTALFILE}\"\n}\n"
|
339 |
else
|
340 |
HARDCODED=${HARDCODED}", \"Pedestals\""
|
341 |
fi
|
342 |
|
343 |
if (( ${#GAINSFILE} > 1 ))
|
344 |
then
|
345 |
TEXT=${TEXT}",{\nstring object=\"Gains\"\nFileInPath file=\"${GAINSFILE}\"\n}\n"
|
346 |
else
|
347 |
HARDCODED=${HARDCODED}", \"Gains\""
|
348 |
fi
|
349 |
|
350 |
echo " es_source es_hardcode = HcalHardcodeCalibrations { untracked vstring toGet= { ${HARDCODED} } }" >> ${CFGFILE}
|
351 |
|
352 |
echo " es_source es_ascii = HcalTextCalibrations { VPSet input = {" >> ${CFGFILE}
|
353 |
printf "${TEXT}" >> ${CFGFILE}
|
354 |
echo " } }" >> ${CFGFILE}
|
355 |
|
356 |
echo "}" >> ${CFGFILE}
|
357 |
|
358 |
# run cmsRun
|
359 |
cmsRun ${CFGFILE}
|